Fix gnulib to not replace gmtime() and localtime()
It cause issues when <ctime> latter undefine the gmtime/localtime macros to access the real function. * lib/Makefile.am, lib/time.in.h, m4/gettimeofday.m4, m4/time_h.m4: These changes are mostly based on the patch posted in http://permalink.gmane.org/gmane.comp.lib.gnulib.bugs/29229 but with the prototype of gmtime() and localtime() fixed.
This commit is contained in:
parent
96f32c73fb
commit
16b7206dd9
4 changed files with 51 additions and 4 deletions
|
|
@ -127,10 +127,15 @@ AC_DEFUN([gl_FUNC_GETTIMEOFDAY_CLOBBER],
|
|||
])
|
||||
|
||||
AC_DEFUN([gl_GETTIMEOFDAY_REPLACE_LOCALTIME], [
|
||||
AC_DEFINE([gmtime], [rpl_gmtime],
|
||||
[Define to rpl_gmtime if the replacement function should be used.])
|
||||
AC_DEFINE([localtime], [rpl_localtime],
|
||||
[Define to rpl_localtime if the replacement function should be used.])
|
||||
AC_CHECK_FUNCS_ONCE([gmtime localtime])
|
||||
if test $ac_cv_func_gmtime != yes; then
|
||||
HAVE_GMTIME=0
|
||||
fi
|
||||
if test $ac_cv_func_localtime != yes; then
|
||||
HAVE_LOCALTIME=0
|
||||
fi
|
||||
REPLACE_GMTIME=1
|
||||
REPLACE_LOCALTIME=1
|
||||
])
|
||||
|
||||
# Prerequisites of lib/gettimeofday.c.
|
||||
|
|
|
|||
|
|
@ -96,12 +96,16 @@ AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS],
|
|||
GNULIB_TIME_R=0; AC_SUBST([GNULIB_TIME_R])
|
||||
dnl Assume proper GNU behavior unless another module says otherwise.
|
||||
HAVE_DECL_LOCALTIME_R=1; AC_SUBST([HAVE_DECL_LOCALTIME_R])
|
||||
HAVE_GMTIME=1; AC_SUBST([HAVE_GMTIME])
|
||||
HAVE_LOCALTIME=1; AC_SUBST([HAVE_LOCALTIME])
|
||||
HAVE_NANOSLEEP=1; AC_SUBST([HAVE_NANOSLEEP])
|
||||
HAVE_STRPTIME=1; AC_SUBST([HAVE_STRPTIME])
|
||||
HAVE_TIMEGM=1; AC_SUBST([HAVE_TIMEGM])
|
||||
dnl If another module says to replace or to not replace, do that.
|
||||
dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK;
|
||||
dnl this lets maintainers check for portability.
|
||||
REPLACE_GMTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_GMTIME])
|
||||
REPLACE_LOCALTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_LOCALTIME])
|
||||
REPLACE_LOCALTIME_R=GNULIB_PORTCHECK; AC_SUBST([REPLACE_LOCALTIME_R])
|
||||
REPLACE_MKTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_MKTIME])
|
||||
REPLACE_NANOSLEEP=GNULIB_PORTCHECK; AC_SUBST([REPLACE_NANOSLEEP])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue