From e87044f7a3420cd57200db9cb368b75e2862bb1b Mon Sep 17 00:00:00 2001 From: "Evgeny Grin (Karlson2k)" Date: Wed, 1 Dec 2021 15:01:52 +0300 Subject: configure: header detection fixes Reordered headers detection to allow detect headers which require inclusion of other headers before them. Fixed detection of network/socket headers as on some platforms they require specific headers to be included before. --- configure.ac | 53 +++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 43 insertions(+), 10 deletions(-) diff --git a/configure.ac b/configure.ac index d0e957f6..335e5d2f 100644 --- a/configure.ac +++ b/configure.ac @@ -1095,16 +1095,49 @@ fd = epoll_create1(EPOLL_CLOEXEC);]])], AC_DEFINE([[HAVE_EPOLL_CREATE1]], [[1]], [Define if you have epoll_create1 function.])])) # Check for headers that are ALWAYS required -AC_CHECK_HEADERS_ONCE([fcntl.h errno.h limits.h stdio.h stdint.h], [], - [AC_MSG_ERROR([Compiling libmicrohttpd requires standard UNIX headers files])], [AC_INCLUDES_DEFAULT]) - -# Check for optional headers -AC_CHECK_HEADERS([sys/types.h sys/time.h sys/msg.h time.h sys/mman.h sys/ioctl.h \ - sys/socket.h sys/select.h netdb.h netinet/in.h netinet/ip.h netinet/tcp.h arpa/inet.h \ - endian.h machine/endian.h sys/endian.h sys/param.h sys/machine.h sys/byteorder.h machine/param.h sys/isa_defs.h \ - signal.h sys/stat.h \ - inttypes.h stddef.h stdlib.h unistd.h \ - sockLib.h inetLib.h net/if.h], [], [], [AC_INCLUDES_DEFAULT]) +AC_CHECK_HEADERS_ONCE([stdio.h string.h stdint.h errno.h limits.h fcntl.h], [], + [AC_MSG_ERROR([Compiling libmicrohttpd requires standard POSIX headers files])], [AC_INCLUDES_DEFAULT]) + +# Check for basic optional headers +AC_CHECK_HEADERS([stddef.h stdlib.h inttypes.h sys/types.h sys/stat.h unistd.h], [], [], [AC_INCLUDES_DEFAULT]) + +# Check for clock-specific optional headers +AC_CHECK_HEADERS([sys/time.h time.h], [], [], [AC_INCLUDES_DEFAULT]) + +# Check for system information and parameters optional headers +AC_CHECK_HEADERS([endian.h machine/endian.h sys/endian.h sys/byteorder.h \ + sys/machine.h machine/param.h sys/param.h sys/isa_defs.h \ + sys/ioctl.h], [], [], [AC_INCLUDES_DEFAULT]) + +# Check for network and sockets optional headers +AC_CHECK_HEADERS([sys/socket.h sys/select.h netinet/in.h arpa/inet.h \ + netinet/ip.h netinet/tcp.h net/if.h \ + netdb.h sockLib.h inetLib.h], [], [], + [AC_INCLUDES_DEFAULT + [ +#ifdef HAVE_SYS_TYPES_H +#include +#endif /* HAVE_SYS_TYPES_H */ +#ifdef HAVE_INTTYPES_H +#include +#endif /* HAVE_INTTYPES_H */ +#ifdef HAVE_SYS_SOCKET_H +#include +#endif /* HAVE_SYS_SOCKET_H */ +#ifdef HAVE_NETINET_IN_H +#include +#endif /* HAVE_NETINET_IN_H */ +#ifdef HAVE_NETINET_IP_H +#include +#endif /* HAVE_NETINET_IP_H */ +#ifdef HAVE_NETINET_TCP_H +#include +#endif /* HAVE_NETINET_TCP_H */ + ]] +) + +# Check for other optional headers +AC_CHECK_HEADERS([sys/msg.h sys/mman.h signal.h], [], [], [AC_INCLUDES_DEFAULT]) AC_CHECK_HEADER([[search.h]], [ -- cgit v1.2.3