diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2023-03-14 15:35:53 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2023-03-14 21:32:19 +0300 |
commit | 04df67221a5f926d34173aaf6685485c3547482c (patch) | |
tree | cd38fe611f91dae4e5f540ff7dbe46d3567177e6 | |
parent | 059054995cbd2dbae9a7c54d128f04b583f5c228 (diff) | |
download | libmicrohttpd-04df67221a5f926d34173aaf6685485c3547482c.tar.gz libmicrohttpd-04df67221a5f926d34173aaf6685485c3547482c.zip |
configure: fixed potential compiler warnings, added usage of cache vars
Fixed compiler warnings on non-Linux based platforms.
Added some cache variables usages for easy override configure results.
-rw-r--r-- | configure.ac | 197 |
1 files changed, 80 insertions, 117 deletions
diff --git a/configure.ac b/configure.ac index fff77a23..5ea76ed0 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -1801,25 +1801,20 @@ AS_IF([test "$enable_poll" != "no"], | |||
1801 | ) | 1801 | ) |
1802 | ], | 1802 | ], |
1803 | [ | 1803 | [ |
1804 | AC_MSG_CHECKING([for WSAPoll()]) | 1804 | MHD_CHECK_FUNC([WSAPoll], |
1805 | AC_LINK_IFELSE( | 1805 | [[ |
1806 | [ | ||
1807 | AC_LANG_PROGRAM( | ||
1808 | [[ | ||
1809 | #include <winsock2.h> | 1806 | #include <winsock2.h> |
1810 | ]],[[ | 1807 | ]], |
1811 | WSAPOLLFD fda[2]; | 1808 | [[ |
1812 | WSAPoll(fda, 2, 0); | 1809 | WSAPOLLFD fda[2]; |
1813 | ]] | 1810 | WSAPoll(fda, 2, 0); |
1814 | ) | 1811 | ]], |
1815 | ], | ||
1816 | [ | 1812 | [ |
1817 | have_poll='yes' | 1813 | have_poll='yes' |
1818 | AC_DEFINE([HAVE_POLL],[1]) | 1814 | AC_DEFINE([HAVE_POLL],[1]) |
1819 | ], | 1815 | ], |
1820 | [have_poll='no'] | 1816 | [have_poll='no'] |
1821 | ) | 1817 | ) |
1822 | AC_MSG_RESULT([$have_poll]) | ||
1823 | ] | 1818 | ] |
1824 | ) | 1819 | ) |
1825 | AS_IF([test "$enable_poll" = "yes" && test "$have_poll" != "yes"], | 1820 | AS_IF([test "$enable_poll" = "yes" && test "$have_poll" != "yes"], |
@@ -1855,20 +1850,18 @@ AS_IF([test "$enable_epoll" != "no"], | |||
1855 | AM_CONDITIONAL([MHD_HAVE_EPOLL], [[test "x$enable_epoll" = xyes]]) | 1850 | AM_CONDITIONAL([MHD_HAVE_EPOLL], [[test "x$enable_epoll" = xyes]]) |
1856 | 1851 | ||
1857 | AS_IF([test "x$enable_epoll" = "xyes"], | 1852 | AS_IF([test "x$enable_epoll" = "xyes"], |
1858 | AC_CACHE_CHECK([for epoll_create1()], | 1853 | [ |
1859 | [mhd_cv_have_epoll_create1], [ | 1854 | MHD_CHECK_FUNC([epoll_create1], |
1860 | AC_LINK_IFELSE([ | 1855 | [[ |
1861 | AC_LANG_PROGRAM([[ | ||
1862 | #include <sys/epoll.h> | 1856 | #include <sys/epoll.h> |
1863 | ]], [[ | 1857 | ]], |
1864 | if (0 > epoll_create1(EPOLL_CLOEXEC)) | 1858 | [[ |
1859 | i][f (0 > epoll_create1(EPOLL_CLOEXEC)) | ||
1865 | return 3; | 1860 | return 3; |
1866 | ]] | 1861 | ]] |
1867 | )], | 1862 | ) |
1868 | [mhd_cv_have_epoll_create1=yes], | 1863 | ] |
1869 | [mhd_cv_have_epoll_create1=no])]) | 1864 | ) |
1870 | AS_IF([test "x$mhd_cv_have_epoll_create1" = "xyes"],[ | ||
1871 | AC_DEFINE([[HAVE_EPOLL_CREATE1]], [[1]], [Define if you have epoll_create1 function.])])) | ||
1872 | 1865 | ||
1873 | AC_CACHE_CHECK([for supported 'noreturn' keyword], [mhd_cv_decl_noreturn], | 1866 | AC_CACHE_CHECK([for supported 'noreturn' keyword], [mhd_cv_decl_noreturn], |
1874 | [ | 1867 | [ |
@@ -2533,32 +2526,22 @@ MHD_FIND_LIB([clock_gettime],[[#include <time.h>]], | |||
2533 | [MHD_LIBDEPS] | 2526 | [MHD_LIBDEPS] |
2534 | ) | 2527 | ) |
2535 | 2528 | ||
2536 | AC_MSG_CHECKING([[for clock_get_time]]) | 2529 | MHD_CHECK_FUNC([clock_get_time], |
2537 | AC_LINK_IFELSE( | 2530 | [[ |
2538 | [AC_LANG_PROGRAM( | ||
2539 | [[ | ||
2540 | #include <mach/clock.h> | 2531 | #include <mach/clock.h> |
2541 | #include <mach/mach.h> | 2532 | #include <mach/mach.h> |
2542 | ]], | 2533 | ]], |
2543 | [[ | 2534 | [[ |
2544 | clock_serv_t cs; | 2535 | clock_serv_t cs; |
2545 | mach_timespec_t mt; | 2536 | mach_timespec_t mt; |
2546 | host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &cs); | 2537 | host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &cs); |
2547 | clock_get_time(cs, &mt); | 2538 | clock_get_time(cs, &mt); |
2548 | mach_port_deallocate(mach_task_self(), cs); | 2539 | mach_port_deallocate(mach_task_self(), cs); |
2549 | ]]) | 2540 | ]] |
2550 | ], | 2541 | ) |
2551 | [ | ||
2552 | AC_DEFINE([HAVE_CLOCK_GET_TIME], [1], [Define to 1 if you have `clock_get_time', `host_get_clock_service' and `mach_port_deallocate' functions.]) | ||
2553 | AC_MSG_RESULT([[yes]]) | ||
2554 | ], | ||
2555 | [AC_MSG_RESULT([[no]]) | ||
2556 | ]) | ||
2557 | 2542 | ||
2558 | AC_MSG_CHECKING([[for gethrtime]]) | 2543 | MHD_CHECK_FUNC([gethrtime], |
2559 | AC_LINK_IFELSE( | 2544 | [[ |
2560 | [AC_LANG_PROGRAM( | ||
2561 | [[ | ||
2562 | #ifdef HAVE_SYS_TIME_H | 2545 | #ifdef HAVE_SYS_TIME_H |
2563 | /* Solaris define gethrtime() in sys/time.h */ | 2546 | /* Solaris define gethrtime() in sys/time.h */ |
2564 | #include <sys/time.h> | 2547 | #include <sys/time.h> |
@@ -2567,42 +2550,30 @@ AC_LINK_IFELSE( | |||
2567 | /* HP-UX define gethrtime() in time.h */ | 2550 | /* HP-UX define gethrtime() in time.h */ |
2568 | #include <time.h> | 2551 | #include <time.h> |
2569 | #endif /* HAVE_TIME_H */ | 2552 | #endif /* HAVE_TIME_H */ |
2570 | ]], [[hrtime_t hrt = gethrtime(); ]]) | 2553 | ]], |
2571 | ], | 2554 | [[ |
2572 | [ | 2555 | hrtime_t hrt = gethrtime(); |
2573 | AC_DEFINE([HAVE_GETHRTIME], [1], [Define to 1 if you have `gethrtime' function.]) | 2556 | i][f (0 == hrt) |
2574 | AC_MSG_RESULT([[yes]]) | 2557 | return 3; |
2575 | ], | 2558 | ]] |
2576 | [AC_MSG_RESULT([[no]]) | 2559 | ) |
2577 | ]) | ||
2578 | 2560 | ||
2579 | AS_VAR_IF([ac_cv_header_time_h], ["yes"], | 2561 | AS_VAR_IF([ac_cv_header_time_h], ["yes"], |
2580 | [ | 2562 | [ |
2581 | AC_CACHE_CHECK([[for C11 timespec_get()]], [mhd_cv_func_timespec_get], | 2563 | MHD_CHECK_FUNC([timespec_get], |
2582 | [ | 2564 | [[ |
2583 | AC_LINK_IFELSE( | ||
2584 | [ | ||
2585 | AC_LANG_PROGRAM( | ||
2586 | [[ | ||
2587 | #include <time.h> | 2565 | #include <time.h> |
2588 | 2566 | ||
2589 | #ifndef TIME_UTC | 2567 | #ifndef TIME_UTC |
2590 | #error TIME_UTC must be defined to use timespec_get() | 2568 | #error TIME_UTC must be defined to use timespec_get() |
2591 | choke me now | 2569 | choke me now |
2592 | #endif | 2570 | #endif |
2593 | ]], | 2571 | ]], |
2594 | [[ | 2572 | [[ |
2595 | struct timespec ts; | 2573 | struct timespec ts; |
2596 | if (TIME_UTC != timespec_get (&ts, TIME_UTC)) | 2574 | i][f (TIME_UTC != timespec_get (&ts, TIME_UTC)) |
2597 | return 1; | 2575 | return 3; |
2598 | ]] | 2576 | ]] |
2599 | ) | ||
2600 | ], [[mhd_cv_func_timespec_get="yes"]], [[mhd_cv_func_timespec_get="no"]] | ||
2601 | ) | ||
2602 | ] | ||
2603 | ) | ||
2604 | AS_VAR_IF([mhd_cv_func_timespec_get], ["yes"], | ||
2605 | [AC_DEFINE([HAVE_TIMESPEC_GET], [1], [Define to 1 if you have C11 `mhd_cv_func_timespec_get' function and TIME_UTC macro.])] | ||
2606 | ) | 2577 | ) |
2607 | ] | 2578 | ] |
2608 | ) | 2579 | ) |
@@ -2624,8 +2595,9 @@ MHD_CHECK_FUNC([[gettimeofday]], | |||
2624 | ) | 2595 | ) |
2625 | 2596 | ||
2626 | # IPv6 | 2597 | # IPv6 |
2627 | AC_MSG_CHECKING(for IPv6) | 2598 | AC_CACHE_CHECK([for IPv6],[mhd_cv_have_inet6], |
2628 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | 2599 | [ |
2600 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | ||
2629 | #include <stdio.h> | 2601 | #include <stdio.h> |
2630 | #ifdef HAVE_NETINET_IN_H | 2602 | #ifdef HAVE_NETINET_IN_H |
2631 | #include <netinet/in.h> | 2603 | #include <netinet/in.h> |
@@ -2639,18 +2611,22 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ | |||
2639 | #ifdef HAVE_WS2TCPIP_H | 2611 | #ifdef HAVE_WS2TCPIP_H |
2640 | #include <ws2tcpip.h> | 2612 | #include <ws2tcpip.h> |
2641 | #endif | 2613 | #endif |
2642 | ]], [[ | 2614 | ]], [[ |
2643 | int af=AF_INET6; | 2615 | int af=AF_INET6; |
2644 | int pf=PF_INET6; | 2616 | int pf=PF_INET6; |
2645 | struct sockaddr_in6 sa; | 2617 | struct sockaddr_in6 sa; |
2646 | printf("%d %d %p\n", af, pf, (void*) &sa); | 2618 | printf("%d %d %p\n", af, pf, (void*) &sa); |
2647 | ]])],[ | 2619 | ]] |
2648 | have_inet6=yes; | 2620 | ) |
2649 | AC_DEFINE([HAVE_INET6], [1], [Provides IPv6 headers]) | 2621 | ], |
2650 | ],[ | 2622 | [AS_VAR_SET([mhd_cv_have_inet6],["yes"])], |
2651 | have_inet6=no | 2623 | [AS_VAR_SET([mhd_cv_have_inet6],["no"])] |
2652 | ]) | 2624 | ) |
2653 | AC_MSG_RESULT($have_inet6) | 2625 | ] |
2626 | ) | ||
2627 | AS_VAR_IF([mhd_cv_have_inet6],["yes"], | ||
2628 | [AC_DEFINE([HAVE_INET6], [1], [Define to '1' if you have IPv6 headers])] | ||
2629 | ) | ||
2654 | 2630 | ||
2655 | MHD_CHECK_FUNC([[sysconf]], [[#include <unistd.h>]], [[long a = sysconf(0); if (a) return 1;]]) | 2631 | MHD_CHECK_FUNC([[sysconf]], [[#include <unistd.h>]], [[long a = sysconf(0); if (a) return 1;]]) |
2656 | 2632 | ||
@@ -2739,37 +2715,24 @@ AS_IF([test "x$enable_curl" = "xyes"], | |||
2739 | [MSG_CURL="no, many unit tests will not run"] | 2715 | [MSG_CURL="no, many unit tests will not run"] |
2740 | ) | 2716 | ) |
2741 | 2717 | ||
2742 | mhd_have_libmagic="no" | 2718 | MHD_CHECK_FUNC([magic_open], |
2743 | SAVE_LIBS="$LIBS" | 2719 | [[ |
2744 | LIBS="-lmagic $LIBS" | ||
2745 | AC_MSG_CHECKING([[for suitable libmagic]]) | ||
2746 | AC_LINK_IFELSE( | ||
2747 | [AC_LANG_PROGRAM( | ||
2748 | [AC_INCLUDES_DEFAULT | ||
2749 | [ | ||
2750 | #include <magic.h> | 2720 | #include <magic.h> |
2751 | ]], | 2721 | ]], |
2752 | [[ | 2722 | [[ |
2753 | char var_data[256]; | 2723 | char var_data[256]; |
2754 | const char *var_mime; | 2724 | const char *var_mime; |
2755 | magic_t var_magic = magic_open (MAGIC_MIME_TYPE); | 2725 | magic_t var_magic = magic_open (MAGIC_MIME_TYPE); |
2756 | (void)magic_load (var_magic, NULL); | 2726 | (void)magic_load (var_magic, NULL); |
2757 | var_data[0] = 0; | 2727 | var_data[0] = 0; |
2758 | var_mime = magic_buffer (var_magic, var_data, 1); | 2728 | var_mime = magic_buffer (var_magic, var_data, 1); |
2759 | magic_close (var_magic); | 2729 | magic_close (var_magic); |
2760 | ]] | 2730 | ]], |
2761 | ) | 2731 | [AC_DEFINE([MHD_HAVE_LIBMAGIC], [1], [Define to 1 if you have suitable libmagic.])], |
2762 | ], | 2732 | [], |
2763 | [ | 2733 | [-lmagic] |
2764 | AC_DEFINE([MHD_HAVE_LIBMAGIC], [1], [Define to 1 if you have suitable libmagic.]) | ||
2765 | mhd_have_libmagic="yes" | ||
2766 | AC_MSG_RESULT([[yes]]) | ||
2767 | ], | ||
2768 | [AC_MSG_RESULT([[no]]) | ||
2769 | ] | ||
2770 | ) | 2734 | ) |
2771 | LIBS="$SAVE_LIBS" | 2735 | AM_CONDITIONAL([MHD_HAVE_LIBMAGIC], [[test "x$mhd_cv_func_magic_open" = "xyes"]]) |
2772 | AM_CONDITIONAL([MHD_HAVE_LIBMAGIC], [[test "x$mhd_have_libmagic" = "xyes"]]) | ||
2773 | 2736 | ||
2774 | # large file support (> 4 GB) | 2737 | # large file support (> 4 GB) |
2775 | AC_SYS_LARGEFILE | 2738 | AC_SYS_LARGEFILE |
@@ -3833,7 +3796,7 @@ AS_VAR_IF([[mhd_cv_have_func_calloc]], [["yes"]], | |||
3833 | [AC_DEFINE([[HAVE_CALLOC]], [[1]], [Define to 1 if you have the usable `calloc' function.])]) | 3796 | [AC_DEFINE([[HAVE_CALLOC]], [[1]], [Define to 1 if you have the usable `calloc' function.])]) |
3834 | 3797 | ||
3835 | # Some systems have IPv6 disabled in kernel at run-time | 3798 | # Some systems have IPv6 disabled in kernel at run-time |
3836 | AS_IF([[test "x${have_inet6}" = "xyes" && test "x${cross_compiling}" = "xno"]], | 3799 | AS_IF([[test "x${mhd_cv_have_inet6}" = "xyes" && test "x${cross_compiling}" = "xno"]], |
3837 | [ | 3800 | [ |
3838 | AC_CACHE_CHECK([whether IPv6 could be used for testing],[mhd_cv_ipv6_for_testing], | 3801 | AC_CACHE_CHECK([whether IPv6 could be used for testing],[mhd_cv_ipv6_for_testing], |
3839 | [ | 3802 | [ |