aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2014-03-05 13:20:57 +0000
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2014-03-05 13:20:57 +0000
commit90c9b75d5a625e6d8136b64677f1cc8d684639bf (patch)
tree3f680fc9da6eb3213e961552799620edcc7fbb9c
parent1087b3a1c465fb61a9b8782c383a9fd4e27d3ed6 (diff)
downloadlibmicrohttpd-90c9b75d5a625e6d8136b64677f1cc8d684639bf.tar.gz
libmicrohttpd-90c9b75d5a625e6d8136b64677f1cc8d684639bf.zip
configure.ac: update crypt libs detections, use crypt libs flags only where is required
-rw-r--r--configure.ac117
-rw-r--r--src/microhttpd/Makefile.am6
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
204AC_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])) 204AC_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
207AC_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]) 207AC_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])
208AM_CONDITIONAL([HAVE_TSEARCH], [test "x$ac_cv_header_search_h" = "xyes"]) 208AM_CONDITIONAL([HAVE_TSEARCH], [test "x$ac_cv_header_search_h" = "xyes"])
209 209
210AC_CHECK_MEMBER([struct sockaddr_in.sin_len], 210AC_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
491AM_PATH_LIBGCRYPT(1.2.2, gcrypt=true) 491AM_PATH_LIBGCRYPT([1.2.2], [have_gcrypt=yes], [have_gcrypt=no])
492 492if test "x$have_gcrypt" = "xyes"
493# define the minimal version of libgcrypt required 493then
494MHD_GCRYPT_VERSION=1:1.2.2 494 SAVE_CFLAGS="$CFLAGS"
495AC_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"
498fi
497 499
498# gnutls 500# gnutls
499gnutls=0 501have_gnutls=no
500AC_MSG_CHECKING(for gnutls) 502AC_MSG_CHECKING(for gnutls)
501AC_ARG_WITH(gnutls, 503AC_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))])
526AM_CONDITIONAL(HAVE_GNUTLS, test x$gnutls = xtrue) 540AM_CONDITIONAL(HAVE_GNUTLS, test "x$have_gnutls" = "xyes")
527AC_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
532AC_MSG_CHECKING(whether to support HTTPS) 544AC_MSG_CHECKING(whether to support HTTPS)
533AC_ARG_ENABLE([https], 545AC_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]) 549if test "x$enable_https" != "xno"
538if test "$enable_https" = "yes"
539then 550then
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 ])
548else 575else
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)"
578fi
579AC_MSG_RESULT([$MSG_HTTPS])
580
581if 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"
586else
587 CPP_FLAGS_CRYPT=""
588 C_FLAGS_CRYPT=""
589 LD_FLAGS_CRYPT=""
590 LIB_CRYPT=""
551fi 591fi
552AC_MSG_RESULT($enable_https)
553 592
554AM_CONDITIONAL(ENABLE_HTTPS, test "$enable_https" = "yes") 593AM_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
557AC_MSG_CHECKING(whether to support HTTP basic authentication) 596AC_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
590MHD_LIB_LDFLAGS="-export-dynamic -no-undefined" 629MHD_LIB_LDFLAGS="$MHD_LIB_LDFLAGS -export-dynamic -no-undefined"
591 630
592# gcov compilation 631# gcov compilation
593AC_MSG_CHECKING(whether to compile with support for code coverage analysis) 632AC_MSG_CHECKING(whether to compile with support for code coverage analysis)
@@ -600,6 +639,8 @@ AC_MSG_RESULT($use_gcov)
600AM_CONDITIONAL([USE_COVERAGE], [test "x$use_gcov" = "xyes"]) 639AM_CONDITIONAL([USE_COVERAGE], [test "x$use_gcov" = "xyes"])
601 640
602 641
642AC_SUBST(MHD_LIB_CPPFLAGS)
643AC_SUBST(MHD_LIB_CFLAGS)
603AC_SUBST(MHD_LIB_LDFLAGS) 644AC_SUBST(MHD_LIB_LDFLAGS)
604 645
605# for pkg-config 646# for pkg-config
@@ -608,8 +649,6 @@ AC_SUBST(MHD_LIBDEPS)
608AC_SUBST(CPPFLAGS) 649AC_SUBST(CPPFLAGS)
609AC_SUBST(LIBS) 650AC_SUBST(LIBS)
610AC_SUBST(LDFLAGS) 651AC_SUBST(LDFLAGS)
611AC_SUBST(EXT_LIB_PATH)
612AC_SUBST(EXT_LIBS)
613 652
614AC_CONFIG_FILES([ 653AC_CONFIG_FILES([
615libmicrohttpd.pc 654libmicrohttpd.pc
@@ -639,23 +678,15 @@ else
639 MSG_CURL="yes" 678 MSG_CURL="yes"
640fi 679fi
641 680
642if test "$gcrypt" != true
643then
644 MSG_GCRYPT="no, HTTPS will not be built"
645else
646 MSG_GCRYPT="yes"
647fi
648
649AC_MSG_NOTICE([Configuration Summary: 681AC_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
66libmicrohttpd_la_CPPFLAGS = \ 66libmicrohttpd_la_CPPFLAGS = \
67 $(AM_CPPFLAGS) \ 67 $(AM_CPPFLAGS) $(MHD_LIB_CPPFLAGS) \
68 -DBUILDING_MHD_LIB=1 68 -DBUILDING_MHD_LIB=1
69libmicrohttpd_la_CFLAGS = \ 69libmicrohttpd_la_CFLAGS = \
70 $(PTHREAD_CFLAGS) $(AM_CFLAGS) 70 $(PTHREAD_CFLAGS) $(AM_CFLAGS) $(MHD_LIB_CFLAGS)
71libmicrohttpd_la_LDFLAGS = \ 71libmicrohttpd_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@
75libmicrohttpd_la_LIBADD = \ 75libmicrohttpd_la_LIBADD = \
76 $(MHD_W32_LIB) $(PTHREAD_LIBS) 76 $(MHD_W32_LIB) $(PTHREAD_LIBS) $(MHD_LIBDEPS)
77 77
78if HAVE_W32 78if HAVE_W32
79MHD_DLL_RES_SRC = microhttpd_dll_res.rc 79MHD_DLL_RES_SRC = microhttpd_dll_res.rc