configure: include <time.h> unconditionally when detecting time functions #6859
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In 2682e5f, several instances of
AC_HEADER_TIME
were removed since it is a deprecated autoconf macro. However, this was the macro that definedTIME_WITH_SYS_TIME
, which was used to indicate that <time.h> can be included alongside <sys/time.h>.TIME_WITH_SYS_TIME
is still used in the configure test body and since it is no longer defined, <time.h> is not included on systems that have <sys/time.h>.In particular, at least on musl libc and glibc, <sys/time.h> does not implicitly include <time.h> and does not declare clock_gettime, gmtime_r, or localtime_r. This causes configure to fail to detect those functions.
The
AC_HEADER_TIME
macro deprecation text saysSo, to fix this issue, simply include <time.h> unconditionally when testing for time-related functions and in libcurl, and don't bother checking for it.