diff --git a/config/c-library.m4 b/config/c-library.m4 index 0233144321..c39fc8d878 100644 --- a/config/c-library.m4 +++ b/config/c-library.m4 @@ -30,7 +30,8 @@ fi])# PGAC_VAR_INT_TIMEZONE # This is the same as the standard macro AC_STRUCT_TIMEZONE, except that # tzname[] is checked for regardless of whether we find tm_zone. AC_DEFUN([PGAC_STRUCT_TIMEZONE], -[AC_CHECK_MEMBERS([struct tm.tm_zone],,,[#include +[AC_REQUIRE([AC_STRUCT_TM])dnl +AC_CHECK_MEMBERS([struct tm.tm_zone],,,[#include #include <$ac_cv_struct_tm> ]) if test "$ac_cv_member_struct_tm_tm_zone" = yes; then diff --git a/configure b/configure index 99daee9f31..2a8082b9f9 100755 --- a/configure +++ b/configure @@ -15430,6 +15430,68 @@ _ACEOF fi fi +{ $as_echo "$as_me:$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 test "${ac_cv_struct_tm+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include + +int +main () +{ +struct tm tm; + int *p = &tm.tm_sec; + return !p; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_struct_tm=time.h +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_struct_tm=sys/time.h +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5 +$as_echo "$ac_cv_struct_tm" >&6; } +if test $ac_cv_struct_tm = sys/time.h; then + +cat >>confdefs.h <<\_ACEOF +#define TM_IN_SYS_TIME 1 +_ACEOF + +fi + { $as_echo "$as_me:$LINENO: checking for struct tm.tm_zone" >&5 $as_echo_n "checking for struct tm.tm_zone... " >&6; } if test "${ac_cv_member_struct_tm_tm_zone+set}" = set; then diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index 0aa457214b..5454efdcbe 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -720,6 +720,9 @@ /* Define to 1 if strerror_r() returns a int. */ #undef STRERROR_R_INT +/* Define to 1 if your declares `struct tm'. */ +#undef TM_IN_SYS_TIME + /* Define to the appropriate snprintf format for unsigned 64-bit ints. */ #undef UINT64_FORMAT