Skip to content

Commit

Permalink
C99 compatibility enhancements for the configure script (#2519)
Browse files Browse the repository at this point in the history
* configure.ac: Enable system extensions

Use AC_USE_SYSTEM_EXTENSIONS to build with _GNU_SOURCE (and similar
macros on non-GNU systems), to avoid an implicit declaration of the
strptime function.  This improves compatibility with future compilers
which do not support implicit function declarations.

* configure.ac: gettimeofday lives in <sys/time.h>

The gettimeofday function is declared in <sys/time.h>, not <time.h>,
according to POSIX and actual systems.  This avoids a configure
probe failure with compilers which do not support implicit function
declarations.
  • Loading branch information
fweimer-rh authored Jun 14, 2023
1 parent 9cb69ad commit 52d5988
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ AC_PROG_CPP_WERROR
AC_PROG_YACC
AC_OBJEXT
AC_EXEEXT
AC_USE_SYSTEM_EXTENSIONS
LT_INIT([shared static win32-dll])
AM_PROG_CC_C_O

Expand Down Expand Up @@ -144,7 +145,7 @@ AC_FIND_FUNC([gmtime_r], [c], [#include <time.h>], [0, 0])
AC_FIND_FUNC([gmtime], [c], [#include <time.h>], [0])
AC_FIND_FUNC([localtime_r], [c], [#include <time.h>], [0, 0])
AC_FIND_FUNC([localtime], [c], [#include <time.h>], [0])
AC_FIND_FUNC([gettimeofday], [c], [#include <time.h>], [0, 0])
AC_FIND_FUNC([gettimeofday], [c], [#include <sys/time.h>], [0, 0])
AC_CHECK_MEMBER([struct tm.tm_gmtoff], [AC_DEFINE([HAVE_TM_TM_GMT_OFF],1,[Define to 1 if the system has the tm_gmt_off field in struct tm])],
[], [[#include <time.h>]])
AC_CHECK_MEMBER([struct tm.__tm_gmtoff], [AC_DEFINE([HAVE_TM___TM_GMT_OFF],1,[Define to 1 if the system has the __tm_gmt_off field in struct tm])],
Expand Down

0 comments on commit 52d5988

Please sign in to comment.