From 9e3a6def62b0836671abfbb74b55f3d580a8998f Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 21 May 2011 16:14:17 +0200 Subject: [PATCH] mktime: Respect rules for use of AC_LIBOBJ. * m4/mktime.m4 (AC_FUNC_MKTIME): Remove macro. (gl_FUNC_MKTIME): Inline it here. Set gl_cv_func_working_mktime. Move AC_LIBOBJ and gl_PREREQ_MKTIME invocations from here... (gl_FUNC_MKTIME_INTERNAL): ... and here... * modules/mktime (configure.ac): ... to here. * modules/mktime-internal (configure.ac): ... and here. * m4/timegm.m4 (gl_FUNC_TIMEGM): Update. --- ChangeLog | 11 ++++++++ m4/mktime.m4 | 56 ++++++++++++++++++----------------------- m4/timegm.m4 | 4 +-- modules/mktime | 4 +++ modules/mktime-internal | 4 +++ 5 files changed, 45 insertions(+), 34 deletions(-) diff --git a/ChangeLog b/ChangeLog index 47d13298dc..216727a02d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2011-05-21 Bruno Haible + + mktime: Respect rules for use of AC_LIBOBJ. + * m4/mktime.m4 (AC_FUNC_MKTIME): Remove macro. + (gl_FUNC_MKTIME): Inline it here. Set gl_cv_func_working_mktime. Move + AC_LIBOBJ and gl_PREREQ_MKTIME invocations from here... + (gl_FUNC_MKTIME_INTERNAL): ... and here... + * modules/mktime (configure.ac): ... to here. + * modules/mktime-internal (configure.ac): ... and here. + * m4/timegm.m4 (gl_FUNC_TIMEGM): Update. + 2011-05-21 Bruno Haible mkstemps: Move AC_LIBOBJ invocations to module description. diff --git a/m4/mktime.m4 b/m4/mktime.m4 index 01167a1ec0..8ed6d5d2a3 100644 --- a/m4/mktime.m4 +++ b/m4/mktime.m4 @@ -1,4 +1,4 @@ -# serial 20 +# serial 21 dnl Copyright (C) 2002-2003, 2005-2007, 2009-2011 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation @@ -7,21 +7,24 @@ dnl with or without modifications, as long as this notice is preserved. dnl From Jim Meyering. -# Redefine AC_FUNC_MKTIME, because it is no longer maintained in Autoconf. -# AC_FUNC_MKTIME -# -------------- -AC_DEFUN([AC_FUNC_MKTIME], -[AC_CHECK_HEADERS_ONCE([unistd.h]) -AC_CHECK_FUNCS_ONCE([alarm]) -AC_REQUIRE([gl_MULTIARCH]) -if test $APPLE_UNIVERSAL_BUILD = 1; then - # A universal build on Apple MacOS X platforms. - # The test result would be 'yes' in 32-bit mode and 'no' in 64-bit mode. - # But we need a configuration result that is valid in both modes. - ac_cv_func_working_mktime=no -fi -AC_CACHE_CHECK([for working mktime], [ac_cv_func_working_mktime], -[AC_RUN_IFELSE([AC_LANG_SOURCE( +AC_DEFUN([gl_FUNC_MKTIME], +[ + AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) + + dnl We don't use AC_FUNC_MKTIME any more, because it is no longer maintained + dnl in Autoconf and because it invokes AC_LIBOBJ. + AC_CHECK_HEADERS_ONCE([unistd.h]) + AC_CHECK_FUNCS_ONCE([alarm]) + AC_REQUIRE([gl_MULTIARCH]) + if test $APPLE_UNIVERSAL_BUILD = 1; then + # A universal build on Apple MacOS X platforms. + # The test result would be 'yes' in 32-bit mode and 'no' in 64-bit mode. + # But we need a configuration result that is valid in both modes. + gl_cv_func_working_mktime=no + fi + AC_CACHE_CHECK([for working mktime], [gl_cv_func_working_mktime], + [AC_RUN_IFELSE( + [AC_LANG_SOURCE( [[/* Test program from Paul Eggert and Tony Leneis. */ #include #include @@ -213,22 +216,13 @@ main () result |= 64; return result; }]])], - [ac_cv_func_working_mktime=yes], - [ac_cv_func_working_mktime=no], - [ac_cv_func_working_mktime=no])]) -if test $ac_cv_func_working_mktime = no; then - AC_LIBOBJ([mktime]) -fi -])# AC_FUNC_MKTIME + [gl_cv_func_working_mktime=yes], + [gl_cv_func_working_mktime=no], + [gl_cv_func_working_mktime=no]) + ]) -AC_DEFUN([gl_FUNC_MKTIME], -[ - AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) - AC_FUNC_MKTIME - dnl Note: AC_FUNC_MKTIME does AC_LIBOBJ([mktime]). - if test $ac_cv_func_working_mktime = no; then + if test $gl_cv_func_working_mktime = no; then REPLACE_MKTIME=1 - gl_PREREQ_MKTIME else REPLACE_MKTIME=0 fi @@ -245,8 +239,6 @@ AC_DEFUN([gl_FUNC_MKTIME_INTERNAL], [ [dnl mktime works but it doesn't export __mktime_internal, dnl so we need to substitute our own mktime implementation. REPLACE_MKTIME=1 - AC_LIBOBJ([mktime]) - gl_PREREQ_MKTIME ]) fi ]) diff --git a/m4/timegm.m4 b/m4/timegm.m4 index ca97eb2529..f18568c5af 100644 --- a/m4/timegm.m4 +++ b/m4/timegm.m4 @@ -1,4 +1,4 @@ -# timegm.m4 serial 9 +# timegm.m4 serial 10 dnl Copyright (C) 2003, 2007, 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -11,7 +11,7 @@ AC_DEFUN([gl_FUNC_TIMEGM], REPLACE_TIMEGM=0 AC_CHECK_FUNCS_ONCE([timegm]) if test $ac_cv_func_timegm = yes; then - if test $ac_cv_func_working_mktime = no; then + if test $gl_cv_func_working_mktime = no; then # Assume that timegm is buggy if mktime is. REPLACE_TIMEGM=1 fi diff --git a/modules/mktime b/modules/mktime index 81aa7148d0..9653e90e3d 100644 --- a/modules/mktime +++ b/modules/mktime @@ -12,6 +12,10 @@ time_r [test $REPLACE_MKTIME = 1] configure.ac: gl_FUNC_MKTIME +if test $REPLACE_MKTIME = 1; then + AC_LIBOBJ([mktime]) + gl_PREREQ_MKTIME +fi gl_TIME_MODULE_INDICATOR([mktime]) Makefile.am: diff --git a/modules/mktime-internal b/modules/mktime-internal index c26b622221..90c8cbb6cf 100644 --- a/modules/mktime-internal +++ b/modules/mktime-internal @@ -10,6 +10,10 @@ mktime configure.ac: gl_FUNC_MKTIME_INTERNAL +if test $REPLACE_MKTIME = 1; then + AC_LIBOBJ([mktime]) + gl_PREREQ_MKTIME +fi Makefile.am: -- 2.30.2