Skip to content

Commit

Permalink
Ubuntu 22.04 (jammy) compatibility
Browse files Browse the repository at this point in the history
Fixed to work with cmake 3.22.1, libmicrohttpd 0.9.75, gcc 11.2.0
  • Loading branch information
Jens Elkner committed Aug 14, 2022
1 parent 0e7755c commit 5e33963
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ distclean: clean cleandocs

prom:
-mkdir prom/build$(TESTDIR) && cd prom/build$(TESTDIR) && \
TEST=$(TEST) cmake -v -G "Unix Makefiles" $(CMAKE_EXTRA_OPTS) ..
TEST=$(TEST) cmake -G "Unix Makefiles" $(CMAKE_EXTRA_OPTS) ..
cd prom/build$(TESTDIR) && $(MAKE) $(MAKE_FLAGS)

# Run "ctest --verbose --force-new-ctest-process" to get the details
Expand Down Expand Up @@ -61,7 +61,7 @@ docs: cleandocs
smoke: build
promtest/prom2json.sh
-mkdir promtest/build && cd promtest/build && \
cmake -v -G "Unix Makefiles" $(CMAKE_EXTRA_OPTS) ..
cmake -G "Unix Makefiles" $(CMAKE_EXTRA_OPTS) ..
cd promtest/build && $(MAKE) $(MAKE_FLAGS)
@echo "Test takes ~ 1 min ..."
PATH=$${PWD}/bin:$${PATH} \
Expand Down
10 changes: 9 additions & 1 deletion promhttp/src/promhttp.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ promhttp_set_active_collector_registry(pcr_t *registry) {
PROM_WARN("No registry set to answer http requests", "");
}

int
#if MHD_VERSION >= 0x00097500
enum MHD_Result
#else
int
#endif
promhttp_handler(void *cls, struct MHD_Connection *connection, const char *url,
const char *method, const char *version, const char *upload_data,
size_t *upload_data_size, void **con_cls)
Expand All @@ -42,7 +46,11 @@ promhttp_handler(void *cls, struct MHD_Connection *connection, const char *url,
enum MHD_ResponseMemoryMode mode = MHD_RESPMEM_PERSISTENT;
unsigned int status = MHD_HTTP_BAD_REQUEST;

#if MHD_VERSION >= 0x00097500
enum MHD_Result ret;
#else
int ret;
#endif

if (strcmp(method, "GET") != 0) {
body = "Invalid HTTP Method\n";
Expand Down
1 change: 1 addition & 0 deletions promtest/test/promtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "promtest_helpers.h"
#include "unity.h"

struct MHD_Daemon *promtest_daemon;
pthread_mutex_t smoke_mutex = PTHREAD_MUTEX_INITIALIZER;

void
Expand Down
2 changes: 1 addition & 1 deletion promtest/test/promtest_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#define PORT 8000
#define ENDPOINT "http://0.0.0.0:8000/metrics" // keep in sync with PORT

struct MHD_Daemon *promtest_daemon;
extern struct MHD_Daemon *promtest_daemon;

typedef struct promtest_popen_buf {
char *buf;
Expand Down

0 comments on commit 5e33963

Please sign in to comment.