diff options
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 136 |
1 files changed, 101 insertions, 35 deletions
diff --git a/configure.ac b/configure.ac index 8600f18c..545c525b 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -20,7 +20,7 @@ | |||
20 | # Process this file with autoconf to produce a configure script. | 20 | # Process this file with autoconf to produce a configure script. |
21 | # | 21 | # |
22 | # | 22 | # |
23 | AC_PREREQ([2.60]) | 23 | AC_PREREQ([2.64]) |
24 | LT_PREREQ([2.4.0]) | 24 | LT_PREREQ([2.4.0]) |
25 | AC_INIT([GNU Libmicrohttpd],[0.9.51],[libmicrohttpd@gnu.org]) | 25 | AC_INIT([GNU Libmicrohttpd],[0.9.51],[libmicrohttpd@gnu.org]) |
26 | AM_INIT_AUTOMAKE([silent-rules] [subdir-objects]) | 26 | AM_INIT_AUTOMAKE([silent-rules] [subdir-objects]) |
@@ -562,7 +562,7 @@ AC_CHECK_HEADERS([sys/types.h sys/time.h sys/msg.h time.h sys/mman.h search.h sy | |||
562 | sys/socket.h sys/select.h netdb.h netinet/in.h netinet/ip.h netinet/tcp.h arpa/inet.h \ | 562 | sys/socket.h sys/select.h netdb.h netinet/in.h netinet/ip.h netinet/tcp.h arpa/inet.h \ |
563 | endian.h machine/endian.h sys/endian.h sys/param.h sys/machine.h sys/byteorder.h machine/param.h sys/isa_defs.h \ | 563 | endian.h machine/endian.h sys/endian.h sys/param.h sys/machine.h sys/byteorder.h machine/param.h sys/isa_defs.h \ |
564 | inttypes.h stddef.h unistd.h \ | 564 | inttypes.h stddef.h unistd.h \ |
565 | sockLib.h inetLib.h net/if.h sys/eventfd.h], [], [], [AC_INCLUDES_DEFAULT]) | 565 | sockLib.h inetLib.h net/if.h], [], [], [AC_INCLUDES_DEFAULT]) |
566 | AM_CONDITIONAL([HAVE_TSEARCH], [test "x$ac_cv_header_search_h" = "xyes"]) | 566 | AM_CONDITIONAL([HAVE_TSEARCH], [test "x$ac_cv_header_search_h" = "xyes"]) |
567 | 567 | ||
568 | # Check for generic functions | 568 | # Check for generic functions |
@@ -585,47 +585,112 @@ AC_CHECK_MEMBER([struct sockaddr_in.sin_len], | |||
585 | ]) | 585 | ]) |
586 | 586 | ||
587 | 587 | ||
588 | # Check for pipe/socketpair signaling | 588 | # Check for inter-thread signaling type |
589 | AC_MSG_CHECKING([[whether to enable signaling by socketpair]]) | 589 | AC_ARG_ENABLE([[itc]], |
590 | [AS_HELP_STRING([[--enable-itc=TYPE]], [use TYPE of inter-thread communication (pipe, socketpair, eventfd) [auto]])], [], | ||
591 | [[enable_itc='auto']] | ||
592 | ) | ||
593 | |||
594 | AS_CASE([[$enable_itc]], | ||
595 | [[pipe]], [[:]], | ||
596 | [[socketpair]], [[:]], | ||
597 | [[eventfd]], [[:]], | ||
598 | [[auto]], [AS_VAR_IF([[os_is_windows]], [["yes"]], [[enable_itc='socketpair']])], | ||
599 | [[eventFD]], [[enable_itc='eventfd']], | ||
600 | [[socket]], [[enable_itc='socketpair']], | ||
601 | [[no]], [AC_MSG_ERROR([[inter-thread communication cannot be disabled]])], | ||
602 | [AC_MSG_ERROR([[unrecognized type "$enable_itc" of inter-thread communication specified by "--enable-itc=$enable_itc"]])] | ||
603 | ) | ||
604 | # AS_UNSET([[use_itc]]) | ||
605 | |||
606 | AS_IF([[test "x$enable_itc" = "xeventfd" || test "x$enable_itc" = "xauto"]], [ | ||
607 | AS_VAR_IF([[os_is_native_w32]], [["yes"]], [], [ | ||
608 | AC_CHECK_HEADERS([[sys/eventfd.h]], [], [], [AC_INCLUDES_DEFAULT]) | ||
609 | AS_VAR_IF([[ac_cv_header_sys_eventfd_h]], [["yes"]], [ | ||
610 | AC_CACHE_CHECK([whether eventfd(2) is usable], [[mhd_cv_eventfd_usable]], [ | ||
611 | AC_LINK_IFELSE([ | ||
612 | AC_LANG_PROGRAM([[ | ||
613 | #include <sys/eventfd.h> | ||
614 | ]], [[int ef = eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK) | ||
615 | ]]) | ||
616 | ], [[mhd_cv_eventfd_usable='yes']], [[mhd_cv_eventfd_usable='no']]) | ||
617 | ]) | ||
618 | ]) | ||
619 | ]) | ||
620 | AS_VAR_IF([[mhd_cv_eventfd_usable]], [["yes"]], [ | ||
621 | use_itc='eventfd' | ||
622 | enable_itc="$use_itc" | ||
623 | AC_DEFINE([[_MHD_ITC_EVENTFD]], [[1]], [Define to use eventFD for inter-thread communication]) | ||
624 | ], [ | ||
625 | AS_VAR_IF([[enable_itc]], [["eventfd"]], [AC_MSG_ERROR([[eventfd(2) is not usable, consider using other type of inter-thread communication]])]) | ||
626 | ]) | ||
627 | ]) | ||
590 | 628 | ||
591 | AC_ARG_ENABLE([[socketpair]], | 629 | AS_IF([[test "x$enable_itc" = "xpipe" || test "x$enable_itc" = "xauto"]], [ |
592 | [AS_HELP_STRING([[--enable-socketpair[=ARG]]], [disable internal singalling by pipes and use socket pair instead (yes, no, try) [no]])], , | 630 | AS_VAR_IF([[os_is_native_w32]], [["yes"]], [], [ |
593 | [AS_IF([[test "x$os_is_windows" = "xyes"]], [enable_socketpair=yes], [enable_socketpair=no])] | 631 | AC_CACHE_CHECK([[whether pipe(3) is usable]], [[mhd_cv_pipe_usable]], [ |
594 | ) | 632 | AC_LINK_IFELSE([ |
633 | AC_LANG_PROGRAM([ | ||
634 | AC_INCLUDES_DEFAULT | ||
635 | #ifdef HAVE_UNISTD_H | ||
636 | #include <unistd.h> | ||
637 | #endif | ||
638 | ], [[ | ||
639 | int arr[2]; | ||
640 | int res; | ||
641 | res = pipe(arr) | ||
642 | ]]) | ||
643 | ], [[mhd_cv_pipe_usable='yes']], [[mhd_cv_pipe_usable='no']]) | ||
644 | ]) | ||
645 | ]) | ||
646 | AS_VAR_IF([[mhd_cv_pipe_usable]], [["yes"]], [ | ||
647 | use_itc='pipe' | ||
648 | enable_itc="$use_itc" | ||
649 | AC_DEFINE([[_MHD_ITC_PIPE]], [[1]], [Define to use pipe for inter-thread communication]) | ||
650 | ], [ | ||
651 | AS_VAR_IF([[enable_itc]], [["pipe"]], [AC_MSG_ERROR([[pipe(3) is not usable, consider using other type of inter-thread communication]])]) | ||
652 | ]) | ||
653 | ]) | ||
595 | 654 | ||
596 | AS_IF( | 655 | AS_IF([[test "x$enable_itc" = "xsocketpair" || test "x$enable_itc" = "xauto"]], [ |
597 | [[test "x$enable_socketpair" != "xno"]], | 656 | AS_VAR_IF([[os_is_native_w32]], [["yes"]], [[mhd_cv_socketpair_usable='yes']], [ |
598 | [AS_IF([[test "x$os_is_windows" = "xyes"]], | 657 | AC_CACHE_CHECK([[whether socketpair(3) is usable]], [[mhd_cv_socketpair_usable]], [ |
599 | [ AC_MSG_RESULT([[yes, forced on W32]]) ], | 658 | AC_LINK_IFELSE([ |
600 | [ AC_LINK_IFELSE( | 659 | AC_LANG_PROGRAM([ |
601 | [ AC_LANG_PROGRAM([[ | 660 | AC_INCLUDES_DEFAULT |
602 | #ifdef HAVE_SYS_TYPES_H | 661 | #ifdef HAVE_SYS_TYPES_H |
603 | #include <sys/types.h> | 662 | #include <sys/types.h> |
604 | #endif | 663 | #endif |
605 | #ifdef HAVE_SYS_SOCKET_H | 664 | #ifdef HAVE_SYS_SOCKET_H |
606 | #include <sys/socket.h> | 665 | #include <sys/socket.h> |
607 | #endif | 666 | #endif |
608 | ]],[[ | 667 | ], [[ |
609 | int sv[2]; | 668 | int arr[2]; |
610 | if (socketpair(AF_UNIX, SOCK_STREAM, 0, sv) != 0) return 1 | 669 | int res; |
611 | ]]) | 670 | #if defined(AF_LOCAL) |
612 | ], | 671 | res = socketpair(AF_LOCAL, SOCK_STREAM, 0, arr); |
613 | [ AC_MSG_RESULT([[yes, socketpair in available]]) ], | 672 | #elif defined(AF_UNIX) |
614 | [ AC_MSG_RESULT([[no, socketpair in not available]]) | 673 | res = socketpair(AF_UNIX, SOCK_STREAM, 0, arr); |
615 | AS_IF([[test "x$enable_socketpair" = "xyes"]], [ AC_MSG_ERROR([[socketpair signalling cannot be enabled.]]) ]) | 674 | #else |
616 | ] | 675 | #error AF_LOCAL and AF_UNIX are both undefined |
617 | ) | 676 | choke me now; |
618 | ] | 677 | #endif |
619 | ) | 678 | if (res != 0) return 1 |
620 | ], | 679 | ]]) |
621 | [ | 680 | ], [[mhd_cv_socketpair_usable='yes']], [[mhd_cv_socketpair_usable='no']]) |
622 | AC_MSG_RESULT([[no]]) | 681 | ]) |
623 | AS_IF([[test "x$os_is_windows" = "xyes"]], [ AC_MSG_ERROR([[socketpair must be enabled on W32]]) ]) | 682 | ]) |
624 | ] | 683 | AS_VAR_IF([[mhd_cv_socketpair_usable]], [["yes"]], [ |
625 | ) | 684 | use_itc='socketpair' |
626 | if test "x$enable_socketpair" = "xyes"; then | 685 | enable_itc="$use_itc" |
627 | AC_DEFINE([[MHD_DONT_USE_PIPES]], [[1]], [Define to use pair of sockets instead of pipes for signaling]) | 686 | AC_DEFINE([[_MHD_ITC_SOCKETPAIR]], [[1]], [Define to use socketpair for inter-thread communication]) |
628 | fi | 687 | ], [ |
688 | AS_VAR_IF([[enable_itc]], [["socketpair"]], [AC_MSG_ERROR([[socketpair(3) is not usable, consider using other type of inter-thread communication]])]) | ||
689 | ]) | ||
690 | ]) | ||
691 | |||
692 | AS_IF([[test -z "$use_itc"]], [AC_MSG_ERROR([[cannot find useable type of inter-thread communication]])]) | ||
693 | |||
629 | 694 | ||
630 | AC_CHECK_FUNCS_ONCE([accept4 gmtime_r memmem snprintf]) | 695 | AC_CHECK_FUNCS_ONCE([accept4 gmtime_r memmem snprintf]) |
631 | AC_CHECK_DECL([gmtime_s], | 696 | AC_CHECK_DECL([gmtime_s], |
@@ -1116,6 +1181,7 @@ AC_MSG_NOTICE([libmicrohttpd ${PACKAGE_VERSION} Configuration Summary: | |||
1116 | Operating System: ${host_os} | 1181 | Operating System: ${host_os} |
1117 | Threading lib: ${USE_THREADS} | 1182 | Threading lib: ${USE_THREADS} |
1118 | Use thread names: ${enable_thread_names} | 1183 | Use thread names: ${enable_thread_names} |
1184 | Inter-thread comm: ${use_itc} | ||
1119 | libcurl (testing): ${MSG_CURL} | 1185 | libcurl (testing): ${MSG_CURL} |
1120 | Target directory: ${prefix} | 1186 | Target directory: ${prefix} |
1121 | Messages: ${enable_messages} | 1187 | Messages: ${enable_messages} |