diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2014-03-05 13:20:57 +0000 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2014-03-05 13:20:57 +0000 |
commit | 90c9b75d5a625e6d8136b64677f1cc8d684639bf (patch) | |
tree | 3f680fc9da6eb3213e961552799620edcc7fbb9c | |
parent | 1087b3a1c465fb61a9b8782c383a9fd4e27d3ed6 (diff) | |
download | libmicrohttpd-90c9b75d5a625e6d8136b64677f1cc8d684639bf.tar.gz libmicrohttpd-90c9b75d5a625e6d8136b64677f1cc8d684639bf.zip |
configure.ac: update crypt libs detections, use crypt libs flags only where is required
-rw-r--r-- | configure.ac | 117 | ||||
-rw-r--r-- | src/microhttpd/Makefile.am | 6 |
2 files changed, 77 insertions, 46 deletions
diff --git a/configure.ac b/configure.ac index 379756a6..367091a9 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -204,7 +204,7 @@ fi | |||
204 | AC_CHECK_HEADERS([fcntl.h math.h errno.h limits.h stdio.h locale.h sys/stat.h sys/types.h pthread.h],,AC_MSG_ERROR([Compiling libmicrohttpd requires standard UNIX headers files])) | 204 | AC_CHECK_HEADERS([fcntl.h math.h errno.h limits.h stdio.h locale.h sys/stat.h sys/types.h pthread.h],,AC_MSG_ERROR([Compiling libmicrohttpd requires standard UNIX headers files])) |
205 | 205 | ||
206 | # Check for optional headers | 206 | # Check for optional headers |
207 | AC_CHECK_HEADERS([sys/types.h sys/time.h sys/msg.h netdb.h netinet/in.h netinet/tcp.h time.h sys/socket.h sys/mman.h arpa/inet.h sys/select.h poll.h gcrypt.h search.h]) | 207 | AC_CHECK_HEADERS([sys/types.h sys/time.h sys/msg.h netdb.h netinet/in.h netinet/tcp.h time.h sys/socket.h sys/mman.h arpa/inet.h sys/select.h poll.h search.h]) |
208 | AM_CONDITIONAL([HAVE_TSEARCH], [test "x$ac_cv_header_search_h" = "xyes"]) | 208 | AM_CONDITIONAL([HAVE_TSEARCH], [test "x$ac_cv_header_search_h" = "xyes"]) |
209 | 209 | ||
210 | AC_CHECK_MEMBER([struct sockaddr_in.sin_len], | 210 | AC_CHECK_MEMBER([struct sockaddr_in.sin_len], |
@@ -488,70 +488,109 @@ AM_CONDITIONAL(HAVE_SOCAT, test 0 != $HAVE_SOCAT) | |||
488 | 488 | ||
489 | 489 | ||
490 | # libgcrypt linkage: required for HTTPS support | 490 | # libgcrypt linkage: required for HTTPS support |
491 | AM_PATH_LIBGCRYPT(1.2.2, gcrypt=true) | 491 | AM_PATH_LIBGCRYPT([1.2.2], [have_gcrypt=yes], [have_gcrypt=no]) |
492 | 492 | if test "x$have_gcrypt" = "xyes" | |
493 | # define the minimal version of libgcrypt required | 493 | then |
494 | MHD_GCRYPT_VERSION=1:1.2.2 | 494 | SAVE_CFLAGS="$CFLAGS" |
495 | AC_DEFINE_UNQUOTED([MHD_GCRYPT_VERSION], "$MHD_GCRYPT_VERSION", [gcrypt lib version]) | 495 | CFLAGS="$CFLAGS $LIBGCRYPT_CFLAGS" |
496 | 496 | AC_CHECK_HEADERS([gcrypt.h], [], [have_gcrypt=no]) | |
497 | CFLAGS="$SAVE_CFLAGS" | ||
498 | fi | ||
497 | 499 | ||
498 | # gnutls | 500 | # gnutls |
499 | gnutls=0 | 501 | have_gnutls=no |
500 | AC_MSG_CHECKING(for gnutls) | 502 | AC_MSG_CHECKING(for gnutls) |
501 | AC_ARG_WITH(gnutls, | 503 | AC_ARG_WITH(gnutls, |
502 | [ --with-gnutls=PFX base of gnutls installation], | 504 | [AC_HELP_STRING([--with-gnutls=PFX],[base of gnutls installation])], |
503 | [AC_MSG_RESULT([$with_gnutls]) | 505 | [AC_MSG_RESULT([$with_gnutls]) |
504 | case $with_gnutls in | 506 | case $with_gnutls in |
505 | no) | 507 | no) |
506 | ;; | 508 | ;; |
507 | yes) | 509 | yes) |
510 | GNUTLS_CPPFLAGS="" | ||
511 | GNUTLS_CFLAGS="" | ||
512 | GNUTLS_LDFLAGS="" | ||
513 | GNUTLS_LIBS="-lgnutls" | ||
508 | AC_CHECK_HEADERS([gnutls/gnutls.h], | 514 | AC_CHECK_HEADERS([gnutls/gnutls.h], |
509 | AC_CHECK_LIB([gnutls], [gnutls_priority_set], | 515 | AC_CHECK_LIB([gnutls], [gnutls_priority_set], |
510 | gnutls=true)) | 516 | have_gnutls=yes)) |
511 | ;; | 517 | ;; |
512 | *) | 518 | *) |
519 | GNUTLS_CPPFLAGS="-I$with_gnutls/include" | ||
520 | GNUTLS_CFLAGS="" | ||
521 | GNUTLS_LDFLAGS="-L$with_gnutls/lib" | ||
522 | GNUTLS_LIBS="-lgnutls" | ||
523 | SAVE_LDFLAGS="$LDFLAGS" | ||
524 | SAVE_CPPFLAGS="$CPPFLAGS" | ||
513 | LDFLAGS="-L$with_gnutls/lib $LDFLAGS" | 525 | LDFLAGS="-L$with_gnutls/lib $LDFLAGS" |
514 | CPPFLAGS="-I$with_gnutls/include $CPPFLAGS" | 526 | CPPFLAGS="-I$with_gnutls/include $CPPFLAGS" |
515 | AC_CHECK_HEADERS([gnutls/gnutls.h], | 527 | AC_CHECK_HEADERS([gnutls/gnutls.h], |
516 | AC_CHECK_LIB([gnutls], [gnutls_priority_set], | 528 | AC_CHECK_LIB([gnutls], [gnutls_priority_set], |
517 | EXT_LIB_PATH="-L$with_gnutls/lib $EXT_LIB_PATH" | 529 | EXT_LIB_PATH="-L$with_gnutls/lib $EXT_LIB_PATH" |
518 | gnutls=true)) | 530 | have_gnutls=yes)) |
531 | LDFLAGS="$SAVE_LDFLAGS" | ||
532 | CPPFLAGS="$SAVE_CPPFLAGS" | ||
519 | ;; | 533 | ;; |
520 | esac | 534 | esac |
521 | ], | 535 | ], |
522 | [AC_MSG_RESULT([--with-gnutls not specified]) | 536 | [AC_MSG_RESULT([--with-gnutls not specified]) |
523 | AC_CHECK_HEADERS([gnutls/gnutls.h], | 537 | AC_CHECK_HEADERS([gnutls/gnutls.h], |
524 | AC_CHECK_LIB([gnutls], [gnutls_priority_set], | 538 | AC_CHECK_LIB([gnutls], [gnutls_priority_set], |
525 | gnutls=true))]) | 539 | have_gnutls=yes))]) |
526 | AM_CONDITIONAL(HAVE_GNUTLS, test x$gnutls = xtrue) | 540 | AM_CONDITIONAL(HAVE_GNUTLS, test "x$have_gnutls" = "xyes") |
527 | AC_DEFINE_UNQUOTED([HAVE_GNUTLS], $gnutls, [We have gnutls]) | ||
528 | |||
529 | 541 | ||
530 | 542 | ||
531 | # optional: HTTPS support. Enabled by default | 543 | # optional: HTTPS support. Enabled by default |
532 | AC_MSG_CHECKING(whether to support HTTPS) | 544 | AC_MSG_CHECKING(whether to support HTTPS) |
533 | AC_ARG_ENABLE([https], | 545 | AC_ARG_ENABLE([https], |
534 | [AS_HELP_STRING([--disable-https], | 546 | [AS_HELP_STRING([--enable-https], |
535 | [disable HTTPS support])], | 547 | [enable HTTPS support (yes, no, auto)[auto]])], |
536 | [enable_https=${enableval}], | 548 | [enable_https=${enableval}]) |
537 | [enable_https=yes]) | 549 | if test "x$enable_https" != "xno" |
538 | if test "$enable_https" = "yes" | ||
539 | then | 550 | then |
540 | if test "$gcrypt" = "true" -a "$gnutls" = "true" | 551 | AS_IF([test "x$have_gnutls" = "xyes"], [ |
541 | then | 552 | AC_DEFINE([HTTPS_SUPPORT],[1],[include HTTPS support]) |
542 | AC_DEFINE([HTTPS_SUPPORT],[1],[include HTTPS support]) | 553 | CPP_FLAGS_CRYPT="$GNUTLS_CPPFLAGS" |
543 | MHD_LIBDEPS="$LIBGCRYPT_LIBS" | 554 | C_FLAGS_CRYPT="$GNUTLS_CFLAGS" |
544 | else | 555 | LD_FLAGS_CRYPT="$GNUTLS_LDFLAGS" |
545 | AC_DEFINE([HTTPS_SUPPORT],[0],[no libgcrypt or libgnutls]) | 556 | LIB_CRYPT="$GNUTLS_LIBS" |
546 | enable_https="no (lacking libgcrypt or libgnutls)" | 557 | enable_https=yes |
547 | fi | 558 | MSG_HTTPS="yes (using GnuTLS)" |
559 | ], | ||
560 | [test "x$have_gcrypt" = "xyes"], [ | ||
561 | AC_DEFINE([HTTPS_SUPPORT],[1],[include HTTPS support]) | ||
562 | CPP_FLAGS_CRYPT="" | ||
563 | C_FLAGS_CRYPT="$LIBGCRYPT_CFLAGS" | ||
564 | LD_FLAGS_CRYPT="" | ||
565 | LIB_CRYPT="$LIBGCRYPT_LIBS" | ||
566 | enable_https=yes | ||
567 | MSG_HTTPS="yes (using libgcrypt)" | ||
568 | ], | ||
569 | [ | ||
570 | AS_IF([[test "x$enable_https" = "xyes" ]], [AC_MSG_ERROR([[HTTPS support cannot be enabled without libgcrypt or GnuTLS.]])]) | ||
571 | AC_DEFINE([HTTPS_SUPPORT],[0],[no libgcrypt or libgnutls]) | ||
572 | enable_https=no | ||
573 | MSG_HTTPS="no (lacking libgcrypt or libgnutls)" | ||
574 | ]) | ||
548 | else | 575 | else |
549 | AC_DEFINE([HTTPS_SUPPORT],[0],[disable HTTPS support]) | 576 | AC_DEFINE([HTTPS_SUPPORT],[0],[disable HTTPS support]) |
550 | enable_https="no (disabled)" | 577 | MSG_HTTPS="no (disabled)" |
578 | fi | ||
579 | AC_MSG_RESULT([$MSG_HTTPS]) | ||
580 | |||
581 | if test "x$enable_https" = "yes"; then | ||
582 | MHD_LIB_CPPFLAGS="$CPP_FLAGS_CRYPT" | ||
583 | MHD_LIB_CFLAGS="$C_FLAGS_CRYPT" | ||
584 | MHD_LIB_LDFLAGS="$LD_FLAGS_CRYPT" | ||
585 | MHD_LIBDEPS="$LIB_CRYPT" | ||
586 | else | ||
587 | CPP_FLAGS_CRYPT="" | ||
588 | C_FLAGS_CRYPT="" | ||
589 | LD_FLAGS_CRYPT="" | ||
590 | LIB_CRYPT="" | ||
551 | fi | 591 | fi |
552 | AC_MSG_RESULT($enable_https) | ||
553 | 592 | ||
554 | AM_CONDITIONAL(ENABLE_HTTPS, test "$enable_https" = "yes") | 593 | AM_CONDITIONAL([ENABLE_HTTPS], [test "x$enable_https" = "xyes"]) |
555 | 594 | ||
556 | # optional: HTTP Basic Auth support. Enabled by default | 595 | # optional: HTTP Basic Auth support. Enabled by default |
557 | AC_MSG_CHECKING(whether to support HTTP basic authentication) | 596 | AC_MSG_CHECKING(whether to support HTTP basic authentication) |
@@ -587,7 +626,7 @@ AM_CONDITIONAL(ENABLE_DAUTH, [test "x$enable_dauth" != "xno"]) | |||
587 | 626 | ||
588 | 627 | ||
589 | 628 | ||
590 | MHD_LIB_LDFLAGS="-export-dynamic -no-undefined" | 629 | MHD_LIB_LDFLAGS="$MHD_LIB_LDFLAGS -export-dynamic -no-undefined" |
591 | 630 | ||
592 | # gcov compilation | 631 | # gcov compilation |
593 | AC_MSG_CHECKING(whether to compile with support for code coverage analysis) | 632 | AC_MSG_CHECKING(whether to compile with support for code coverage analysis) |
@@ -600,6 +639,8 @@ AC_MSG_RESULT($use_gcov) | |||
600 | AM_CONDITIONAL([USE_COVERAGE], [test "x$use_gcov" = "xyes"]) | 639 | AM_CONDITIONAL([USE_COVERAGE], [test "x$use_gcov" = "xyes"]) |
601 | 640 | ||
602 | 641 | ||
642 | AC_SUBST(MHD_LIB_CPPFLAGS) | ||
643 | AC_SUBST(MHD_LIB_CFLAGS) | ||
603 | AC_SUBST(MHD_LIB_LDFLAGS) | 644 | AC_SUBST(MHD_LIB_LDFLAGS) |
604 | 645 | ||
605 | # for pkg-config | 646 | # for pkg-config |
@@ -608,8 +649,6 @@ AC_SUBST(MHD_LIBDEPS) | |||
608 | AC_SUBST(CPPFLAGS) | 649 | AC_SUBST(CPPFLAGS) |
609 | AC_SUBST(LIBS) | 650 | AC_SUBST(LIBS) |
610 | AC_SUBST(LDFLAGS) | 651 | AC_SUBST(LDFLAGS) |
611 | AC_SUBST(EXT_LIB_PATH) | ||
612 | AC_SUBST(EXT_LIBS) | ||
613 | 652 | ||
614 | AC_CONFIG_FILES([ | 653 | AC_CONFIG_FILES([ |
615 | libmicrohttpd.pc | 654 | libmicrohttpd.pc |
@@ -639,23 +678,15 @@ else | |||
639 | MSG_CURL="yes" | 678 | MSG_CURL="yes" |
640 | fi | 679 | fi |
641 | 680 | ||
642 | if test "$gcrypt" != true | ||
643 | then | ||
644 | MSG_GCRYPT="no, HTTPS will not be built" | ||
645 | else | ||
646 | MSG_GCRYPT="yes" | ||
647 | fi | ||
648 | |||
649 | AC_MSG_NOTICE([Configuration Summary: | 681 | AC_MSG_NOTICE([Configuration Summary: |
650 | Operating System: ${host_os} | 682 | Operating System: ${host_os} |
651 | libgcrypt: ${MSG_GCRYPT} | ||
652 | libcurl (testing): ${MSG_CURL} | 683 | libcurl (testing): ${MSG_CURL} |
653 | Target directory: ${prefix} | 684 | Target directory: ${prefix} |
654 | Messages: ${enable_messages} | 685 | Messages: ${enable_messages} |
655 | Basic auth.: ${enable_bauth} | 686 | Basic auth.: ${enable_bauth} |
656 | Digest auth.: ${enable_dauth} | 687 | Digest auth.: ${enable_dauth} |
657 | Postproc: ${enable_postprocessor} | 688 | Postproc: ${enable_postprocessor} |
658 | HTTPS support: ${enable_https} | 689 | HTTPS support: ${MSG_HTTPS} |
659 | epoll support: ${enable_epoll=no} | 690 | epoll support: ${enable_epoll=no} |
660 | libmicrospdy: ${enable_spdy} | 691 | libmicrospdy: ${enable_spdy} |
661 | spdylay (testing): ${have_spdylay} | 692 | spdylay (testing): ${have_spdylay} |
diff --git a/src/microhttpd/Makefile.am b/src/microhttpd/Makefile.am index 77aef84e..99e22273 100644 --- a/src/microhttpd/Makefile.am +++ b/src/microhttpd/Makefile.am | |||
@@ -64,16 +64,16 @@ libmicrohttpd_la_SOURCES = \ | |||
64 | memorypool.c memorypool.h \ | 64 | memorypool.c memorypool.h \ |
65 | response.c response.h | 65 | response.c response.h |
66 | libmicrohttpd_la_CPPFLAGS = \ | 66 | libmicrohttpd_la_CPPFLAGS = \ |
67 | $(AM_CPPFLAGS) \ | 67 | $(AM_CPPFLAGS) $(MHD_LIB_CPPFLAGS) \ |
68 | -DBUILDING_MHD_LIB=1 | 68 | -DBUILDING_MHD_LIB=1 |
69 | libmicrohttpd_la_CFLAGS = \ | 69 | libmicrohttpd_la_CFLAGS = \ |
70 | $(PTHREAD_CFLAGS) $(AM_CFLAGS) | 70 | $(PTHREAD_CFLAGS) $(AM_CFLAGS) $(MHD_LIB_CFLAGS) |
71 | libmicrohttpd_la_LDFLAGS = \ | 71 | libmicrohttpd_la_LDFLAGS = \ |
72 | $(MHD_LIB_LDFLAGS) \ | 72 | $(MHD_LIB_LDFLAGS) \ |
73 | $(W32_MHD_LIB_LDFLAGS) \ | 73 | $(W32_MHD_LIB_LDFLAGS) \ |
74 | -version-info @LIB_VERSION_CURRENT@:@LIB_VERSION_REVISION@:@LIB_VERSION_AGE@ | 74 | -version-info @LIB_VERSION_CURRENT@:@LIB_VERSION_REVISION@:@LIB_VERSION_AGE@ |
75 | libmicrohttpd_la_LIBADD = \ | 75 | libmicrohttpd_la_LIBADD = \ |
76 | $(MHD_W32_LIB) $(PTHREAD_LIBS) | 76 | $(MHD_W32_LIB) $(PTHREAD_LIBS) $(MHD_LIBDEPS) |
77 | 77 | ||
78 | if HAVE_W32 | 78 | if HAVE_W32 |
79 | MHD_DLL_RES_SRC = microhttpd_dll_res.rc | 79 | MHD_DLL_RES_SRC = microhttpd_dll_res.rc |