From: Ralf Wildenhues Date: Tue, 12 Jan 2010 18:43:04 +0000 (+0100) Subject: Allow AC_FUNC_MKTIME to work with C++. X-Git-Tag: v2.66~93 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=957768d52d14b28a5ee533ae99b538060ed95768;p=thirdparty%2Fautoconf.git Allow AC_FUNC_MKTIME to work with C++. * lib/autoconf/functions.m4 (AC_FUNC_MKTIME): ANSIfy KnR function definitions. Use `const char*' for character literals; cast them to `char*' for putenv. Signed-off-by: Ralf Wildenhues --- diff --git a/ChangeLog b/ChangeLog index 577c5211..2ca9eaba 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-01-12 Ralf Wildenhues + + Allow AC_FUNC_MKTIME to work with C++. + * lib/autoconf/functions.m4 (AC_FUNC_MKTIME): ANSIfy KnR function + definitions. Use `const char*' for character literals; cast them + to `char*' for putenv. + 2010-01-11 Ralf Wildenhues Export AUTOM4TE in tests/atlocal.in, for aclocal. diff --git a/lib/autoconf/functions.m4 b/lib/autoconf/functions.m4 index 9d51088c..24dcf869 100644 --- a/lib/autoconf/functions.m4 +++ b/lib/autoconf/functions.m4 @@ -1004,8 +1004,8 @@ static time_t time_t_max; static time_t time_t_min; /* Values we'll use to set the TZ environment variable. */ -static char *tz_strings[] = { - (char *) 0, "TZ=GMT0", "TZ=JST-9", +static const char *tz_strings[] = { + (const char *) 0, "TZ=GMT0", "TZ=JST-9", "TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00" }; #define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0])) @@ -1022,7 +1022,7 @@ spring_forward_gap () instead of "TZ=America/Vancouver" in order to detect the bug even on systems that don't support the Olson extension, or don't have the full zoneinfo tables installed. */ - putenv ("TZ=PST8PDT,M4.1.0,M10.5.0"); + putenv ((char*) "TZ=PST8PDT,M4.1.0,M10.5.0"); tm.tm_year = 98; tm.tm_mon = 3; @@ -1035,16 +1035,14 @@ spring_forward_gap () } static int -mktime_test1 (now) - time_t now; +mktime_test1 (time_t now) { struct tm *lt; return ! (lt = localtime (&now)) || mktime (lt) == now; } static int -mktime_test (now) - time_t now; +mktime_test (time_t now) { return (mktime_test1 (now) && mktime_test1 ((time_t) (time_t_max - now)) @@ -1068,8 +1066,7 @@ irix_6_4_bug () } static int -bigtime_test (j) - int j; +bigtime_test (int j) { struct tm tm; time_t now; @@ -1113,7 +1110,7 @@ year_2050_test () instead of "TZ=America/Vancouver" in order to detect the bug even on systems that don't support the Olson extension, or don't have the full zoneinfo tables installed. */ - putenv ("TZ=PST8PDT,M4.1.0,M10.5.0"); + putenv ((char*) "TZ=PST8PDT,M4.1.0,M10.5.0"); t = mktime (&tm); @@ -1148,7 +1145,7 @@ main () for (i = 0; i < N_STRINGS; i++) { if (tz_strings[i]) - putenv (tz_strings[i]); + putenv ((char*) tz_strings[i]); for (t = 0; t <= time_t_max - delta; t += delta) if (! mktime_test (t))