diff --git a/cmake/config.in b/cmake/config.in index f2524e41e4..6054b6dbe7 100644 --- a/cmake/config.in +++ b/cmake/config.in @@ -19,9 +19,6 @@ /* Define to 1 if you have the `gmtime_r' function. */ #cmakedefine HAVE_GMTIME_R @HAVE_GMTIME_R@ -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_LIMITS_H @HAVE_LIMITS_H@ - /* Define to 1 if you have the header file. */ #cmakedefine HAVE_PCAP_PCAP_H @HAVE_PCAP_PCAP_H@ diff --git a/cmake/options.h.in b/cmake/options.h.in index 967fe7b2ad..dfdee642ca 100644 --- a/cmake/options.h.in +++ b/cmake/options.h.in @@ -38,6 +38,9 @@ extern "C" { #undef _POSIX_THREADS #cmakedefine _POSIX_THREADS #endif +/* Since types.h depends on HAVE_LIMITS_H, we must define it in options.h. */ +#undef HAVE_LIMITS_H +#cmakedefine HAVE_LIMITS_H @HAVE_LIMITS_H@ #undef ASIO_USE_WOLFSSL #cmakedefine ASIO_USE_WOLFSSL #undef BOOST_ASIO_USE_WOLFSSL diff --git a/configure.ac b/configure.ac index 24ab654b4e..f59bf21c3a 100644 --- a/configure.ac +++ b/configure.ac @@ -204,7 +204,9 @@ then fi fi -AC_CHECK_HEADERS([arpa/inet.h fcntl.h limits.h netdb.h netinet/in.h stddef.h time.h sys/ioctl.h sys/socket.h sys/time.h errno.h sys/un.h ctype.h sys/random.h]) +AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stddef.h time.h sys/ioctl.h sys/socket.h sys/time.h errno.h sys/un.h ctype.h sys/random.h]) +# Special case: Since types.h depends on HAVE_LIMITS_H, we must define it in options.h. +AC_CHECK_HEADER([limits.h], [AM_CPPFLAGS="$AM_CPPFLAGS -DHAVE_LIMITS_H=1"], []) AC_CHECK_LIB([network],[socket]) AC_C_BIGENDIAN AC_C___ATOMIC