- cmake: add auto-detection. Sync this with autotools.
- enable for MS-DOS and AmigaOS builds.
(auto-detection doesn't work for cross-builds.)
- tidy up detection snippet.
- fix comment.
Closes #15868
set(HAVE_MSG_NOSIGNAL 0)
set(HAVE_STRUCT_TIMEVAL 1)
set(HAVE_STRUCT_SOCKADDR_STORAGE 1)
+set(HAVE_TIME_T_UNSIGNED 0)
set(HAVE_GETHOSTBYNAME_R_3 0)
set(HAVE_GETHOSTBYNAME_R_3_REENTRANT 0)
elseif(AMIGA)
set(HAVE_GETADDRINFO 0) # Breaks the build when detected and used.
endif()
+if(DOS OR AMIGA)
+ set(HAVE_TIME_T_UNSIGNED 1)
+endif()
if(ENABLE_THREADED_RESOLVER)
if(WIN32)
}" HAVE_WRITABLE_ARGV)
endif()
+if(NOT CMAKE_CROSSCOMPILING)
+ include(CheckCSourceRuns)
+ check_c_source_runs("
+ #include <time.h>
+ int main(void) {
+ time_t t = -1;
+ return t < 0;
+ }" HAVE_TIME_T_UNSIGNED)
+endif()
+
curl_internal_test(HAVE_GLIBC_STRERROR_R)
curl_internal_test(HAVE_POSIX_STRERROR_R)
#endif
])
-AC_MSG_CHECKING([if time_t is unsigned])
-CURL_RUN_IFELSE(
- [
- #include <time.h>
- #include <limits.h>
- int main(void) {
- time_t t = -1;
- return (t < 0);
- }
- ],[
- AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_TIME_T_UNSIGNED, 1, [Define this if time_t is unsigned])
-],[
- AC_MSG_RESULT([no])
-],[
- dnl cross-compiling, most systems are unsigned
- AC_MSG_RESULT([no])
-])
+case $host_os in
+ amigaos*|msdos*)
+ AC_DEFINE(HAVE_TIME_T_UNSIGNED, 1, [Define this if time_t is unsigned])
+ ;;
+ *)
+ AC_MSG_CHECKING([if time_t is unsigned])
+ CURL_RUN_IFELSE(
+ [
+ #include <time.h>
+ int main(void) {
+ time_t t = -1;
+ return t < 0;
+ }
+ ],[
+ AC_MSG_RESULT([yes])
+ AC_DEFINE(HAVE_TIME_T_UNSIGNED, 1, [Define this if time_t is unsigned])
+ ],[
+ AC_MSG_RESULT([no])
+ ],[
+ dnl cross-compiling, most systems are signed
+ AC_MSG_RESULT([no])
+ ])
+ ;;
+esac
TYPE_IN_ADDR_T
/* Define this symbol if your OS supports changing the contents of argv */
#cmakedefine HAVE_WRITABLE_ARGV 1
+/* Define this if time_t is unsigned */
+#cmakedefine HAVE_TIME_T_UNSIGNED 1
+
/* Define to 1 if _REENTRANT preprocessor symbol must be defined. */
#cmakedefine NEED_REENTRANT 1