Selaa lähdekoodia

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.
Evgeny Grin (Karlson2k) 4 vuotta sitten
vanhempi
sitoutus
e87044f7a3
1 muutettua tiedostoa jossa 43 lisäystä ja 10 poistoa
  1. 43 10
      configure.ac

+ 43 - 10
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 <sys/types.h>
+#endif /* HAVE_SYS_TYPES_H */
+#ifdef HAVE_INTTYPES_H
+#include <inttypes.h>
+#endif /* HAVE_INTTYPES_H */
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif /* HAVE_SYS_SOCKET_H */
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif /* HAVE_NETINET_IN_H */
+#ifdef HAVE_NETINET_IP_H
+#include <netinet/ip.h>
+#endif /* HAVE_NETINET_IP_H */
+#ifdef HAVE_NETINET_TCP_H
+#include <netinet/tcp.h>
+#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]],
   [