Simplify PGAC_STRUCT_TIMEZONE Autoconf macro

Since 63bd0db121 we don't use tzname
anymore, so we don't need to check for it.  Instead, just keep the
part of PGAC_STRUCT_TIMEZONE that we need, which is the check for
struct tm.tm_zone.

Discussion: https://www.postgresql.org/message-id/flat/5eb11a37-f3ca-5fb7-308f-4485dec25a2e%402ndquadrant.com
This commit is contained in:
Peter Eisentraut 2019-10-07 16:28:56 +02:00
parent 4d7e5a5db0
commit 400d5ffcaf
5 changed files with 7 additions and 123 deletions

View File

@ -26,33 +26,14 @@ fi])# PGAC_VAR_INT_TIMEZONE
# PGAC_STRUCT_TIMEZONE # PGAC_STRUCT_TIMEZONE
# ------------------ # ------------------
# Figure out how to get the current timezone. If `struct tm' has a # Figure out how to get the current timezone. If `struct tm' has a
# `tm_zone' member, define `HAVE_TM_ZONE'. Also, if the # `tm_zone' member, define `HAVE_STRUCT_TM_TM_ZONE'. Unlike the
# external array `tzname' is found, define `HAVE_TZNAME'. # standard macro AC_STRUCT_TIMEZONE, we don't check for `tzname[]' if
# This is the same as the standard macro AC_STRUCT_TIMEZONE, except that # not found, since we don't use it. (We use `int timezone' as a
# tzname[] is checked for regardless of whether we find tm_zone. # fallback.)
AC_DEFUN([PGAC_STRUCT_TIMEZONE], AC_DEFUN([PGAC_STRUCT_TIMEZONE],
[AC_REQUIRE([AC_STRUCT_TM])dnl [AC_CHECK_MEMBERS([struct tm.tm_zone],,,[#include <sys/types.h>
AC_CHECK_MEMBERS([struct tm.tm_zone],,,[#include <sys/types.h>
#include <$ac_cv_struct_tm>
])
if test "$ac_cv_member_struct_tm_tm_zone" = yes; then
AC_DEFINE(HAVE_TM_ZONE, 1,
[Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use
`HAVE_STRUCT_TM_TM_ZONE' instead.])
fi
AC_CACHE_CHECK(for tzname, ac_cv_var_tzname,
[AC_LINK_IFELSE([AC_LANG_PROGRAM(
[[#include <stdlib.h>
#include <time.h> #include <time.h>
#ifndef tzname /* For SGI. */ ])
extern char *tzname[]; /* RS6000 and others reject char **tzname. */
#endif
]],
[atoi(*tzname);])], ac_cv_var_tzname=yes, ac_cv_var_tzname=no)])
if test $ac_cv_var_tzname = yes; then
AC_DEFINE(HAVE_TZNAME, 1,
[Define to 1 if you have the external array `tzname'.])
fi
])# PGAC_STRUCT_TIMEZONE ])# PGAC_STRUCT_TIMEZONE

78
configure vendored
View File

@ -13964,43 +13964,8 @@ if test x"$pgac_cv_computed_goto" = xyes ; then
$as_echo "#define HAVE_COMPUTED_GOTO 1" >>confdefs.h $as_echo "#define HAVE_COMPUTED_GOTO 1" >>confdefs.h
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5
$as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; }
if ${ac_cv_struct_tm+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
#include <time.h>
int
main ()
{
struct tm tm;
int *p = &tm.tm_sec;
return !p;
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_struct_tm=time.h
else
ac_cv_struct_tm=sys/time.h
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm" >&5
$as_echo "$ac_cv_struct_tm" >&6; }
if test $ac_cv_struct_tm = sys/time.h; then
$as_echo "#define TM_IN_SYS_TIME 1" >>confdefs.h
fi
ac_fn_c_check_member "$LINENO" "struct tm" "tm_zone" "ac_cv_member_struct_tm_tm_zone" "#include <sys/types.h> ac_fn_c_check_member "$LINENO" "struct tm" "tm_zone" "ac_cv_member_struct_tm_tm_zone" "#include <sys/types.h>
#include <$ac_cv_struct_tm> #include <time.h>
" "
if test "x$ac_cv_member_struct_tm_tm_zone" = xyes; then : if test "x$ac_cv_member_struct_tm_tm_zone" = xyes; then :
@ -14012,47 +13977,6 @@ _ACEOF
fi fi
if test "$ac_cv_member_struct_tm_tm_zone" = yes; then
$as_echo "#define HAVE_TM_ZONE 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tzname" >&5
$as_echo_n "checking for tzname... " >&6; }
if ${ac_cv_var_tzname+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdlib.h>
#include <time.h>
#ifndef tzname /* For SGI. */
extern char *tzname[]; /* RS6000 and others reject char **tzname. */
#endif
int
main ()
{
atoi(*tzname);
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_var_tzname=yes
else
ac_cv_var_tzname=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_var_tzname" >&5
$as_echo "$ac_cv_var_tzname" >&6; }
if test $ac_cv_var_tzname = yes; then
$as_echo "#define HAVE_TZNAME 1" >>confdefs.h
fi
ac_fn_c_check_type "$LINENO" "union semun" "ac_cv_type_union_semun" "#include <sys/types.h> ac_fn_c_check_type "$LINENO" "union semun" "ac_cv_type_union_semun" "#include <sys/types.h>
#ifdef HAVE_SYS_IPC_H #ifdef HAVE_SYS_IPC_H

View File

@ -654,16 +654,9 @@
/* Define to 1 if you have the <termios.h> header file. */ /* Define to 1 if you have the <termios.h> header file. */
#undef HAVE_TERMIOS_H #undef HAVE_TERMIOS_H
/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use
`HAVE_STRUCT_TM_TM_ZONE' instead. */
#undef HAVE_TM_ZONE
/* Define to 1 if your compiler understands `typeof' or something similar. */ /* Define to 1 if your compiler understands `typeof' or something similar. */
#undef HAVE_TYPEOF #undef HAVE_TYPEOF
/* Define to 1 if you have the external array `tzname'. */
#undef HAVE_TZNAME
/* Define to 1 if you have the <ucred.h> header file. */ /* Define to 1 if you have the <ucred.h> header file. */
#undef HAVE_UCRED_H #undef HAVE_UCRED_H
@ -884,9 +877,6 @@
/* Define to 1 if strerror_r() returns int. */ /* Define to 1 if strerror_r() returns int. */
#undef STRERROR_R_INT #undef STRERROR_R_INT
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
#undef TM_IN_SYS_TIME
/* Define to 1 to use ARMv8 CRC Extension. */ /* Define to 1 to use ARMv8 CRC Extension. */
#undef USE_ARMV8_CRC32C #undef USE_ARMV8_CRC32C

View File

@ -508,16 +508,9 @@
/* Define to 1 if you have the <termios.h> header file. */ /* Define to 1 if you have the <termios.h> header file. */
/* #undef HAVE_TERMIOS_H */ /* #undef HAVE_TERMIOS_H */
/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use
`HAVE_STRUCT_TM_TM_ZONE' instead. */
/* #undef HAVE_TM_ZONE */
/* Define to 1 if your compiler understands `typeof' or something similar. */ /* Define to 1 if your compiler understands `typeof' or something similar. */
/* #undef HAVE_TYPEOF */ /* #undef HAVE_TYPEOF */
/* Define to 1 if you have the external array `tzname'. */
/* #undef HAVE_TZNAME */
/* Define to 1 if the system has the type `uint64'. */ /* Define to 1 if the system has the type `uint64'. */
/* #undef HAVE_UINT64 */ /* #undef HAVE_UINT64 */
@ -686,9 +679,6 @@
/* Define to 1 if strerror_r() returns int. */ /* Define to 1 if strerror_r() returns int. */
/* #undef STRERROR_R_INT */ /* #undef STRERROR_R_INT */
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
/* #undef TM_IN_SYS_TIME */
/* Define to 1 to build with assertion checks. (--enable-cassert) */ /* Define to 1 to build with assertion checks. (--enable-cassert) */
/* #undef USE_ASSERT_CHECKING */ /* #undef USE_ASSERT_CHECKING */

View File

@ -28,7 +28,6 @@
*/ */
#undef _POSIX_C_SOURCE #undef _POSIX_C_SOURCE
#undef _XOPEN_SOURCE #undef _XOPEN_SOURCE
#undef HAVE_TZNAME
/* /*
* Sometimes python carefully scribbles on our *printf macros. * Sometimes python carefully scribbles on our *printf macros.