build: convert HAS_TIME_T_UNSIGNED to a compile-time check
No binary (build failed)
—
(log yok)
| @@ -388,3 +388,13 @@ int main(void) | |
| return 0; | |
| } | |
| #endif | |
| + | |
| + | #ifdef HAVE_TIME_T_UNSIGNED |
| + | #include <time.h> |
| + | static int time_t_is_unsigned[((time_t)-1 > 0) ? 1 : -1]; |
| + | int main(void) |
| + | { |
| + | (void)time_t_is_unsigned; |
| + | return 0; |
| + | } |
| + | #endif |
| @@ -1798,16 +1798,7 @@ if(NOT WIN32 AND NOT CMAKE_CROSSCOMPILING) | |
| }" 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_TIME_T_UNSIGNED) |
| curl_internal_test(HAVE_GLIBC_STRERROR_R) | |
| curl_internal_test(HAVE_POSIX_STRERROR_R) | |
| @@ -4157,22 +4157,21 @@ case $host_os in | |
| ;; | |
| *) | |
| 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_COMPILE_IFELSE([ |
| + | AC_LANG_SOURCE([[ |
| + | #include <time.h> |
| + | static int time_t_is_unsigned[((time_t)-1 > 0) ? 1 : -1]; |
| + | int main(void) |
| + | { |
| + | (void)time_t_is_unsigned; |
| + | return 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 | |