diff options
author | David Barksdale <amatus@amat.us> | 2019-08-27 14:29:17 -0500 |
---|---|---|
committer | David Barksdale <amatus@amat.us> | 2019-08-27 14:29:17 -0500 |
commit | 53fd26b7e0deef386aeb207bfc1e3f7c00a1f775 (patch) | |
tree | db4ed21ae7fb6677b7f7092f529175a76e3d4f6b /configure.ac | |
parent | ba2cae9617e32bf789001415cd787f50af8b3ce9 (diff) | |
download | gnunet-53fd26b7e0deef386aeb207bfc1e3f7c00a1f775.tar.gz gnunet-53fd26b7e0deef386aeb207bfc1e3f7c00a1f775.zip |
Use pkg-config to check for MHD
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 82 |
1 files changed, 16 insertions, 66 deletions
diff --git a/configure.ac b/configure.ac index 330b02875..3ddebf7a6 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -1262,73 +1262,23 @@ AS_IF([test "$sqlite" = 0 -a "$mysql" = 0], | |||
1262 | 1262 | ||
1263 | # libmicrohttpd | 1263 | # libmicrohttpd |
1264 | lmhd=0 | 1264 | lmhd=0 |
1265 | AC_MSG_CHECKING([for libmicrohttpd]) | 1265 | m4_define([MHD_MODULE], [libmicrohttpd >= 0.9.63]) |
1266 | AC_ARG_WITH(microhttpd, | 1266 | AC_ARG_WITH(microhttpd, |
1267 | [ --with-microhttpd=PFX base of libmicrohttpd installation], | 1267 | [AS_HELP_STRING([--with-microhttpd[[=PFX]]], |
1268 | [AC_MSG_RESULT([$with_microhttpd]) | 1268 | [base of libmicrohttpd installation])], |
1269 | AS_CASE([$with_microhttpd], | 1269 | [], |
1270 | [no],[], | 1270 | [with_microhttpd=check]) |
1271 | [yes|""],[ | 1271 | AS_CASE([$with_microhttpd], |
1272 | AC_CHECK_HEADERS([microhttpd.h], | 1272 | [no], [], |
1273 | AC_CHECK_DECL(MHD_OPTION_PER_IP_CONNECTION_LIMIT, | 1273 | [yes], [PKG_CHECK_MODULES([MHD], [MHD_MODULE], [lmhd=1])], |
1274 | AC_CHECK_LIB([microhttpd], [MHD_get_fdset2], | 1274 | [check], [PKG_CHECK_MODULES([MHD], [MHD_MODULE], |
1275 | [AC_MSG_CHECKING([for libmicrohttpd >= 0.9.63]) | 1275 | [lmhd=1], |
1276 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([ | 1276 | [AC_MSG_WARN([Building without libmicrohttpd])])], |
1277 | #include "$native_srcdir/src/include/platform.h" | 1277 | [SAVE_PKG_CONFIG_PATH=$PKG_CONFIG_PATH |
1278 | #include <microhttpd.h> | 1278 | PKG_CONFIG_PATH=$with_microhttpd/lib/pkgconfig |
1279 | #if (MHD_VERSION < 0x0096300) | 1279 | export PKG_CONFIG_PATH |
1280 | #error needs at least version 0.9.63 | 1280 | PKG_CHECK_MODULES([MHD], [MHD_MODULE], [lmhd=1]) |
1281 | #endif | 1281 | PKG_CONFIG_PATH=$SAVE_PKG_CONFIG_PATH]) |
1282 | int main () { return 0; } | ||
1283 | ])], | ||
1284 | [AC_MSG_RESULT(ok) | ||
1285 | lmhd=1], | ||
1286 | [AC_MSG_RESULT(failed)])]), | ||
1287 | [],[#include "$native_srcdir/src/include/platform.h" | ||
1288 | #include <microhttpd.h>]),, | ||
1289 | [#include "$native_srcdir/src/include/platform.h"]) | ||
1290 | ],[ | ||
1291 | LDFLAGS="-L$with_microhttpd/lib $LDFLAGS" | ||
1292 | CPPFLAGS="-I$with_microhttpd/include $CPPFLAGS" | ||
1293 | AC_CHECK_HEADERS(microhttpd.h, | ||
1294 | AC_CHECK_DECL(MHD_OPTION_PER_IP_CONNECTION_LIMIT, | ||
1295 | AC_CHECK_LIB([microhttpd], [MHD_get_fdset2], | ||
1296 | EXT_LIB_PATH="-L$with_microhttpd/lib $EXT_LIB_PATH" | ||
1297 | [AC_MSG_CHECKING([for libmicrohttpd >= 0.9.52]) | ||
1298 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([ | ||
1299 | #include "$native_srcdir/src/include/platform.h" | ||
1300 | #include <microhttpd.h> | ||
1301 | #if (MHD_VERSION < 0x0094200) | ||
1302 | #error needs at least version 0.9.42 | ||
1303 | #endif | ||
1304 | int main () { return 0; } | ||
1305 | ])], | ||
1306 | [AC_MSG_RESULT(ok) | ||
1307 | lmhd=1], | ||
1308 | [AC_MSG_RESULT(failed)])]), | ||
1309 | [],[#include "$native_srcdir/src/include/platform.h" | ||
1310 | #include <microhttpd.h>]),, | ||
1311 | [#include "$native_srcdir/src/include/platform.h"]) | ||
1312 | ]) | ||
1313 | ], | ||
1314 | [AC_MSG_RESULT([--with-microhttpd not specified]) | ||
1315 | AC_CHECK_HEADERS([microhttpd.h], | ||
1316 | AC_CHECK_DECL(MHD_OPTION_PER_IP_CONNECTION_LIMIT, | ||
1317 | AC_CHECK_LIB([microhttpd], [MHD_get_fdset2], | ||
1318 | [AC_MSG_CHECKING([for libmicrohttpd >= 0.9.52]) | ||
1319 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([ | ||
1320 | #include "$native_srcdir/src/include/platform.h" | ||
1321 | #include <microhttpd.h> | ||
1322 | #if (MHD_VERSION < 0x0094200) | ||
1323 | #error needs at least version 0.9.52 | ||
1324 | #endif | ||
1325 | ])], | ||
1326 | [AC_MSG_RESULT(ok) | ||
1327 | lmhd=1], | ||
1328 | [AC_MSG_RESULT(failed)])]), | ||
1329 | [],[#include "$native_srcdir/src/include/platform.h" | ||
1330 | #include <microhttpd.h>]),, | ||
1331 | [#include "$native_srcdir/src/include/platform.h"])]) | ||
1332 | AM_CONDITIONAL(HAVE_MHD, test x$lmhd = x1) | 1282 | AM_CONDITIONAL(HAVE_MHD, test x$lmhd = x1) |
1333 | AC_DEFINE_UNQUOTED([HAVE_MHD], $lmhd, [We have libmicrohttpd]) | 1283 | AC_DEFINE_UNQUOTED([HAVE_MHD], $lmhd, [We have libmicrohttpd]) |
1334 | 1284 | ||