mirror of git://gcc.gnu.org/git/gcc.git
PR modula2/115276: libgm2 wraptime.cc field access all return -1.
This patch provides autoconf tests for each field used in wraptime.cc referencing struct tm and struct timeval. libgm2/ChangeLog: PR modula2/115276 * config.h.in: Regenerate. * configure: Regenerate. * configure.ac (AC_STRUCT_TIMEZONE): Add. (AC_CHECK_MEMBER): Test for struct tm.tm_year. (AC_CHECK_MEMBER): Test for struct tm.tm_mon. (AC_CHECK_MEMBER): Test for struct tm.tm_mday. (AC_CHECK_MEMBER): Test for struct tm.tm_hour. (AC_CHECK_MEMBER): Test for struct tm.tm_min. (AC_CHECK_MEMBER): Test for struct tm.tm_sec. (AC_CHECK_MEMBER): Test for struct tm.tm_year. (AC_CHECK_MEMBER): Test for struct tm.tm_yday. (AC_CHECK_MEMBER): Test for struct tm.tm_wday. (AC_CHECK_MEMBER): Test for struct tm.tm_isdst. (AC_CHECK_MEMBER): Test for struct timeval.tv_sec. (AC_CHECK_MEMBER): Test for struct timeval.tv_sec. (AC_CHECK_MEMBER): Test for struct timeval.tv_usec. * libm2iso/wraptime.cc (InitTimeval): Guard against lack struct timeval and malloc. (InitTimezone): Guard against lack of struct tm.tm_zone and malloc. (KillTimezone): Ditto. (InitTimeval): Guard against lack of struct timeval and malloc. (KillTimeval): Guard against lack of malloc. (settimeofday): Guard against lack of struct tm.tm_zone. (GetFractions): Guard against lack of struct timeval. (localtime_r): Ditto. (GetYear): Guard against lack of struct tm. (GetMonth): Ditto. (GetDay): Ditto. (GetHour): Ditto. (GetMinute): Ditto. (GetSecond): Ditto. (GetSummerTime): Ditto. (GetDST): Guards against lack of struct timezone. (SetTimezone): Ditto. (SetTimeval): Guard against lack of struct tm. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
This commit is contained in:
parent
05b6fc1eb5
commit
419f40af5c
|
@ -34,6 +34,10 @@
|
|||
*/
|
||||
#undef HAVE_DECL_GETENV
|
||||
|
||||
/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't.
|
||||
*/
|
||||
#undef HAVE_DECL_TZNAME
|
||||
|
||||
/* Define to 1 if you have the <direct.h> header file. */
|
||||
#undef HAVE_DIRECT_H
|
||||
|
||||
|
@ -232,6 +236,9 @@
|
|||
/* Define to 1 if the system has the type `struct tm'. */
|
||||
#undef HAVE_STRUCT_TM
|
||||
|
||||
/* Define to 1 if `tm_zone' is a member of `struct tm'. */
|
||||
#undef HAVE_STRUCT_TM_TM_ZONE
|
||||
|
||||
/* Define to 1 if you have the <sys/errno.h> header file. */
|
||||
#undef HAVE_SYS_ERRNO_H
|
||||
|
||||
|
@ -286,6 +293,10 @@
|
|||
/* Define if struct tm has a tm_gmtoff field. */
|
||||
#undef HAVE_TM_TM_GMTOFF
|
||||
|
||||
/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use
|
||||
`HAVE_STRUCT_TM_TM_ZONE' instead. */
|
||||
#undef HAVE_TM_ZONE
|
||||
|
||||
/* function tzname exists */
|
||||
#undef HAVE_TZNAME
|
||||
|
||||
|
@ -338,6 +349,9 @@
|
|||
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#undef TIME_WITH_SYS_TIME
|
||||
|
||||
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
|
||||
#undef TM_IN_SYS_TIME
|
||||
|
||||
/* Enable extensions on AIX 3, Interix. */
|
||||
#ifndef _ALL_SOURCE
|
||||
# undef _ALL_SOURCE
|
||||
|
@ -363,6 +377,45 @@
|
|||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* struct timeval was found */
|
||||
#undef WE_HAVE_STRUCT_TIMEVAL
|
||||
|
||||
/* struct timeval.tv_sec was found */
|
||||
#undef WE_HAVE_STRUCT_TIMEVAL_TV_SEC
|
||||
|
||||
/* struct timeval.tv_usec was found */
|
||||
#undef WE_HAVE_STRUCT_TIMEVAL_TV_USEC
|
||||
|
||||
/* struct tm was found */
|
||||
#undef WE_HAVE_STRUCT_TM
|
||||
|
||||
/* struct tm.tm_hour was found */
|
||||
#undef WE_HAVE_STRUCT_TM_HOUR
|
||||
|
||||
/* struct tm.tm_isdst was found */
|
||||
#undef WE_HAVE_STRUCT_TM_ISDST
|
||||
|
||||
/* struct tm.tm_mday was found */
|
||||
#undef WE_HAVE_STRUCT_TM_MDAY
|
||||
|
||||
/* struct tm.tm_min was found */
|
||||
#undef WE_HAVE_STRUCT_TM_MIN
|
||||
|
||||
/* struct tm.tm_mon was found */
|
||||
#undef WE_HAVE_STRUCT_TM_MON
|
||||
|
||||
/* struct tm.tm_sec was found */
|
||||
#undef WE_HAVE_STRUCT_TM_SEC
|
||||
|
||||
/* struct tm.tm_wday was found */
|
||||
#undef WE_HAVE_STRUCT_TM_WDAY
|
||||
|
||||
/* struct tm.tm_yday was found */
|
||||
#undef WE_HAVE_STRUCT_TM_YDAY
|
||||
|
||||
/* struct tm.tm_year was found */
|
||||
#undef WE_HAVE_STRUCT_TM_YEAR
|
||||
|
||||
/* Defined if no way to sleep is available. */
|
||||
#undef _GLIBCXX_NO_SLEEP
|
||||
|
||||
|
|
|
@ -2100,6 +2100,109 @@ $as_echo "$ac_res" >&6; }
|
|||
|
||||
} # ac_fn_cxx_check_func
|
||||
|
||||
# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
|
||||
# ----------------------------------------------------
|
||||
# Tries to find if the field MEMBER exists in type AGGR, after including
|
||||
# INCLUDES, setting cache variable VAR accordingly.
|
||||
ac_fn_c_check_member ()
|
||||
{
|
||||
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5
|
||||
$as_echo_n "checking for $2.$3... " >&6; }
|
||||
if eval \${$4+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
$5
|
||||
int
|
||||
main ()
|
||||
{
|
||||
static $2 ac_aggr;
|
||||
if (ac_aggr.$3)
|
||||
return 0;
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
eval "$4=yes"
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
$5
|
||||
int
|
||||
main ()
|
||||
{
|
||||
static $2 ac_aggr;
|
||||
if (sizeof ac_aggr.$3)
|
||||
return 0;
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
eval "$4=yes"
|
||||
else
|
||||
eval "$4=no"
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
eval ac_res=\$$4
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
|
||||
$as_echo "$ac_res" >&6; }
|
||||
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
|
||||
|
||||
} # ac_fn_c_check_member
|
||||
|
||||
# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
|
||||
# ---------------------------------------------
|
||||
# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
|
||||
# accordingly.
|
||||
ac_fn_c_check_decl ()
|
||||
{
|
||||
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
|
||||
as_decl_name=`echo $2|sed 's/ *(.*//'`
|
||||
as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
|
||||
$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
|
||||
if eval \${$3+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
$4
|
||||
int
|
||||
main ()
|
||||
{
|
||||
#ifndef $as_decl_name
|
||||
#ifdef __cplusplus
|
||||
(void) $as_decl_use;
|
||||
#else
|
||||
(void) $as_decl_name;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
eval "$3=yes"
|
||||
else
|
||||
eval "$3=no"
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
eval ac_res=\$$3
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
|
||||
$as_echo "$ac_res" >&6; }
|
||||
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
|
||||
|
||||
} # ac_fn_c_check_decl
|
||||
|
||||
# ac_fn_c_try_link LINENO
|
||||
# -----------------------
|
||||
# Try to link conftest.$ac_ext, and return whether this succeeded.
|
||||
|
@ -2269,52 +2372,6 @@ $as_echo "$ac_res" >&6; }
|
|||
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
|
||||
|
||||
} # ac_fn_c_check_type
|
||||
|
||||
# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
|
||||
# ---------------------------------------------
|
||||
# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
|
||||
# accordingly.
|
||||
ac_fn_c_check_decl ()
|
||||
{
|
||||
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
|
||||
as_decl_name=`echo $2|sed 's/ *(.*//'`
|
||||
as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
|
||||
$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
|
||||
if eval \${$3+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
$4
|
||||
int
|
||||
main ()
|
||||
{
|
||||
#ifndef $as_decl_name
|
||||
#ifdef __cplusplus
|
||||
(void) $as_decl_use;
|
||||
#else
|
||||
(void) $as_decl_name;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_c_try_compile "$LINENO"; then :
|
||||
eval "$3=yes"
|
||||
else
|
||||
eval "$3=no"
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
fi
|
||||
eval ac_res=\$$3
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
|
||||
$as_echo "$ac_res" >&6; }
|
||||
eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
|
||||
|
||||
} # ac_fn_c_check_decl
|
||||
cat >config.log <<_ACEOF
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
@ -6872,6 +6929,7 @@ $as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h
|
|||
|
||||
fi
|
||||
|
||||
|
||||
ac_fn_c_check_header_mongrel "$LINENO" "math.h" "ac_cv_header_math_h" "$ac_includes_default"
|
||||
if test "x$ac_cv_header_math_h" = xyes; then :
|
||||
|
||||
|
@ -6903,6 +6961,223 @@ fi
|
|||
done
|
||||
|
||||
|
||||
{ $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>
|
||||
#include <$ac_cv_struct_tm>
|
||||
|
||||
"
|
||||
if test "x$ac_cv_member_struct_tm_tm_zone" = xyes; then :
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_STRUCT_TM_TM_ZONE 1
|
||||
_ACEOF
|
||||
|
||||
|
||||
fi
|
||||
|
||||
if test "$ac_cv_member_struct_tm_tm_zone" = yes; then
|
||||
|
||||
$as_echo "#define HAVE_TM_ZONE 1" >>confdefs.h
|
||||
|
||||
else
|
||||
ac_fn_c_check_decl "$LINENO" "tzname" "ac_cv_have_decl_tzname" "#include <time.h>
|
||||
"
|
||||
if test "x$ac_cv_have_decl_tzname" = xyes; then :
|
||||
ac_have_decl=1
|
||||
else
|
||||
ac_have_decl=0
|
||||
fi
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_DECL_TZNAME $ac_have_decl
|
||||
_ACEOF
|
||||
|
||||
{ $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
|
||||
if test x$gcc_no_link = xyes; then
|
||||
as_fn_error $? "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
|
||||
fi
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <time.h>
|
||||
#if !HAVE_DECL_TZNAME
|
||||
extern char *tzname[];
|
||||
#endif
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return tzname[0][0];
|
||||
;
|
||||
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
|
||||
fi
|
||||
|
||||
|
||||
ac_fn_c_check_member "$LINENO" "struct tm" "tm_year" "ac_cv_member_struct_tm_tm_year" "#include <time.h>
|
||||
"
|
||||
if test "x$ac_cv_member_struct_tm_tm_year" = xyes; then :
|
||||
|
||||
$as_echo "#define WE_HAVE_STRUCT_TM 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
ac_fn_c_check_member "$LINENO" "struct tm" "tm_year" "ac_cv_member_struct_tm_tm_year" "#include <time.h>
|
||||
"
|
||||
if test "x$ac_cv_member_struct_tm_tm_year" = xyes; then :
|
||||
|
||||
$as_echo "#define WE_HAVE_STRUCT_TM_YEAR 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
ac_fn_c_check_member "$LINENO" "struct tm" "tm_mon" "ac_cv_member_struct_tm_tm_mon" "#include <time.h>
|
||||
"
|
||||
if test "x$ac_cv_member_struct_tm_tm_mon" = xyes; then :
|
||||
|
||||
$as_echo "#define WE_HAVE_STRUCT_TM_MON 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
ac_fn_c_check_member "$LINENO" "struct tm" "tm_mday" "ac_cv_member_struct_tm_tm_mday" "#include <time.h>
|
||||
"
|
||||
if test "x$ac_cv_member_struct_tm_tm_mday" = xyes; then :
|
||||
|
||||
$as_echo "#define WE_HAVE_STRUCT_TM_MDAY 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
ac_fn_c_check_member "$LINENO" "struct tm" "tm_hour" "ac_cv_member_struct_tm_tm_hour" "#include <time.h>
|
||||
"
|
||||
if test "x$ac_cv_member_struct_tm_tm_hour" = xyes; then :
|
||||
|
||||
$as_echo "#define WE_HAVE_STRUCT_TM_HOUR 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
ac_fn_c_check_member "$LINENO" "struct tm" "tm_min" "ac_cv_member_struct_tm_tm_min" "#include <time.h>
|
||||
"
|
||||
if test "x$ac_cv_member_struct_tm_tm_min" = xyes; then :
|
||||
|
||||
$as_echo "#define WE_HAVE_STRUCT_TM_MIN 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
ac_fn_c_check_member "$LINENO" "struct tm" "tm_sec" "ac_cv_member_struct_tm_tm_sec" "#include <time.h>
|
||||
"
|
||||
if test "x$ac_cv_member_struct_tm_tm_sec" = xyes; then :
|
||||
|
||||
$as_echo "#define WE_HAVE_STRUCT_TM_SEC 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
ac_fn_c_check_member "$LINENO" "struct tm" "tm_year" "ac_cv_member_struct_tm_tm_year" "#include <time.h>
|
||||
"
|
||||
if test "x$ac_cv_member_struct_tm_tm_year" = xyes; then :
|
||||
|
||||
$as_echo "#define WE_HAVE_STRUCT_TM_YEAR 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
ac_fn_c_check_member "$LINENO" "struct tm" "tm_yday" "ac_cv_member_struct_tm_tm_yday" "#include <time.h>
|
||||
"
|
||||
if test "x$ac_cv_member_struct_tm_tm_yday" = xyes; then :
|
||||
|
||||
$as_echo "#define WE_HAVE_STRUCT_TM_YDAY 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
ac_fn_c_check_member "$LINENO" "struct tm" "tm_wday" "ac_cv_member_struct_tm_tm_wday" "#include <time.h>
|
||||
"
|
||||
if test "x$ac_cv_member_struct_tm_tm_wday" = xyes; then :
|
||||
|
||||
$as_echo "#define WE_HAVE_STRUCT_TM_WDAY 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
ac_fn_c_check_member "$LINENO" "struct tm" "tm_isdst" "ac_cv_member_struct_tm_tm_isdst" "#include <time.h>
|
||||
"
|
||||
if test "x$ac_cv_member_struct_tm_tm_isdst" = xyes; then :
|
||||
|
||||
$as_echo "#define WE_HAVE_STRUCT_TM_ISDST 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
|
||||
ac_fn_c_check_member "$LINENO" "struct timeval" "tv_sec" "ac_cv_member_struct_timeval_tv_sec" "$ac_includes_default"
|
||||
if test "x$ac_cv_member_struct_timeval_tv_sec" = xyes; then :
|
||||
|
||||
$as_echo "#define WE_HAVE_STRUCT_TIMEVAL 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
ac_fn_c_check_member "$LINENO" "struct timeval" "tv_sec" "ac_cv_member_struct_timeval_tv_sec" "$ac_includes_default"
|
||||
if test "x$ac_cv_member_struct_timeval_tv_sec" = xyes; then :
|
||||
|
||||
$as_echo "#define WE_HAVE_STRUCT_TIMEVAL_TV_SEC 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
ac_fn_c_check_member "$LINENO" "struct timeval" "tv_usec" "ac_cv_member_struct_timeval_tv_usec" "$ac_includes_default"
|
||||
if test "x$ac_cv_member_struct_timeval_tv_usec" = xyes; then :
|
||||
|
||||
$as_echo "#define WE_HAVE_STRUCT_TIMEVAL_TV_USEC 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
case ${build_alias} in
|
||||
"") build_noncanonical=${build} ;;
|
||||
|
@ -14579,7 +14854,7 @@ else
|
|||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 14582 "configure"
|
||||
#line 14857 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
|
@ -14685,7 +14960,7 @@ else
|
|||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 14688 "configure"
|
||||
#line 14963 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
|
|
|
@ -89,6 +89,7 @@ AC_ARG_WITH(cross-host,
|
|||
AC_HEADER_STDC
|
||||
AC_HEADER_SYS_WAIT
|
||||
AC_HEADER_TIME
|
||||
|
||||
AC_CHECK_HEADER([math.h],
|
||||
[AC_DEFINE([HAVE_MATH_H], [1], [have math.h])])
|
||||
|
||||
|
@ -102,6 +103,49 @@ AC_CHECK_HEADERS(getopt.h limits.h stddef.h string.h strings.h \
|
|||
pthread.h stdarg.h stdio.h sys/types.h termios.h \
|
||||
netinet/in.h netdb.h sys/uio.h sys/stat.h wchar.h)
|
||||
|
||||
AC_STRUCT_TIMEZONE
|
||||
|
||||
AC_CHECK_MEMBER([struct tm.tm_year],
|
||||
[AC_DEFINE(WE_HAVE_STRUCT_TM, [1], [struct tm was found])],
|
||||
[], [[#include <time.h>]])
|
||||
AC_CHECK_MEMBER([struct tm.tm_year],
|
||||
[AC_DEFINE(WE_HAVE_STRUCT_TM_YEAR, [1], [struct tm.tm_year was found])],
|
||||
[], [[#include <time.h>]])
|
||||
AC_CHECK_MEMBER([struct tm.tm_mon],
|
||||
[AC_DEFINE(WE_HAVE_STRUCT_TM_MON, [1], [struct tm.tm_mon was found])],
|
||||
[], [[#include <time.h>]])
|
||||
AC_CHECK_MEMBER([struct tm.tm_mday],
|
||||
[AC_DEFINE(WE_HAVE_STRUCT_TM_MDAY, [1], [struct tm.tm_mday was found])],
|
||||
[], [[#include <time.h>]])
|
||||
AC_CHECK_MEMBER([struct tm.tm_hour],
|
||||
[AC_DEFINE(WE_HAVE_STRUCT_TM_HOUR, [1], [struct tm.tm_hour was found])],
|
||||
[], [[#include <time.h>]])
|
||||
AC_CHECK_MEMBER([struct tm.tm_min],
|
||||
[AC_DEFINE(WE_HAVE_STRUCT_TM_MIN, [1], [struct tm.tm_min was found])],
|
||||
[], [[#include <time.h>]])
|
||||
AC_CHECK_MEMBER([struct tm.tm_sec],
|
||||
[AC_DEFINE(WE_HAVE_STRUCT_TM_SEC, [1], [struct tm.tm_sec was found])],
|
||||
[], [[#include <time.h>]])
|
||||
AC_CHECK_MEMBER([struct tm.tm_year],
|
||||
[AC_DEFINE(WE_HAVE_STRUCT_TM_YEAR, [1], [struct tm.tm_year was found])],
|
||||
[], [[#include <time.h>]])
|
||||
AC_CHECK_MEMBER([struct tm.tm_yday],
|
||||
[AC_DEFINE(WE_HAVE_STRUCT_TM_YDAY, [1], [struct tm.tm_yday was found])],
|
||||
[], [[#include <time.h>]])
|
||||
AC_CHECK_MEMBER([struct tm.tm_wday],
|
||||
[AC_DEFINE(WE_HAVE_STRUCT_TM_WDAY, [1], [struct tm.tm_wday was found])],
|
||||
[], [[#include <time.h>]])
|
||||
AC_CHECK_MEMBER([struct tm.tm_isdst],
|
||||
[AC_DEFINE(WE_HAVE_STRUCT_TM_ISDST, [1], [struct tm.tm_isdst was found])],
|
||||
[], [[#include <time.h>]])
|
||||
|
||||
AC_CHECK_MEMBER([struct timeval.tv_sec],
|
||||
[AC_DEFINE(WE_HAVE_STRUCT_TIMEVAL, [1], [struct timeval was found])])
|
||||
AC_CHECK_MEMBER([struct timeval.tv_sec],
|
||||
[AC_DEFINE(WE_HAVE_STRUCT_TIMEVAL_TV_SEC, [1], [struct timeval.tv_sec was found])])
|
||||
AC_CHECK_MEMBER([struct timeval.tv_usec],
|
||||
[AC_DEFINE(WE_HAVE_STRUCT_TIMEVAL_TV_USEC, [1], [struct timeval.tv_usec was found])])
|
||||
|
||||
AC_CANONICAL_HOST
|
||||
ACX_NONCANONICAL_HOST
|
||||
ACX_NONCANONICAL_TARGET
|
||||
|
|
|
@ -58,7 +58,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|||
|
||||
/* InitTimeval returns a newly created opaque type. */
|
||||
|
||||
#if defined(HAVE_STRUCT_TIMEVAL) && defined(HAVE_MALLOC_H)
|
||||
#if defined(WE_HAVE_STRUCT_TIMEVAL) && defined(HAVE_MALLOC_H)
|
||||
extern "C" struct timeval *
|
||||
EXPORT(InitTimeval) (void)
|
||||
{
|
||||
|
@ -85,7 +85,7 @@ EXPORT(KillTimeval) (void *tv)
|
|||
|
||||
/* InitTimezone returns a newly created opaque type. */
|
||||
|
||||
#if defined(HAVE_STRUCT_TIMEZONE) && defined(HAVE_MALLOC_H)
|
||||
#if defined(HAVE_STRUCT_TM_TM_ZONE) && defined(HAVE_MALLOC_H)
|
||||
extern "C" struct timezone *
|
||||
EXPORT(InitTimezone) (void)
|
||||
{
|
||||
|
@ -102,14 +102,20 @@ EXPORT(InitTimezone) (void)
|
|||
/* KillTimezone - deallocates the memory associated with an opaque
|
||||
type. */
|
||||
|
||||
#if defined(HAVE_STRUCT_TM_TM_ZONE) && defined(HAVE_MALLOC_H)
|
||||
extern "C" struct timezone *
|
||||
EXPORT(KillTimezone) (struct timezone *tv)
|
||||
{
|
||||
#if defined(HAVE_MALLOC_H)
|
||||
free (tv);
|
||||
#endif
|
||||
return NULL;
|
||||
}
|
||||
#else
|
||||
extern "C" void *
|
||||
EXPORT(KillTimezone) (void *tv)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* InitTM - returns a newly created opaque type. */
|
||||
|
||||
|
@ -141,7 +147,7 @@ EXPORT(KillTM) (struct tm *tv)
|
|||
/* gettimeofday - calls gettimeofday(2) with the same parameters, tv,
|
||||
and, tz. It returns 0 on success. */
|
||||
|
||||
#if defined(HAVE_STRUCT_TIMEZONE) && defined(HAVE_GETTIMEOFDAY)
|
||||
#if defined(HAVE_STRUCT_TM_TM_ZONE) && defined(HAVE_GETTIMEOFDAY)
|
||||
extern "C" int
|
||||
EXPORT(gettimeofday) (void *tv, struct timezone *tz)
|
||||
{
|
||||
|
@ -158,7 +164,7 @@ EXPORT(gettimeofday) (void *tv, void *tz)
|
|||
/* settimeofday - calls settimeofday(2) with the same parameters, tv,
|
||||
and, tz. It returns 0 on success. */
|
||||
|
||||
#if defined(HAVE_STRUCT_TIMEZONE) && defined(HAVE_SETTIMEOFDAY)
|
||||
#if defined(HAVE_STRUCT_TM_TM_ZONE) && defined(HAVE_SETTIMEOFDAY)
|
||||
extern "C" int
|
||||
EXPORT(settimeofday) (void *tv, struct timezone *tz)
|
||||
{
|
||||
|
@ -175,7 +181,7 @@ EXPORT(settimeofday) (void *tv, void *tz)
|
|||
/* wraptime_GetFractions - returns the tv_usec field inside the
|
||||
timeval structure. */
|
||||
|
||||
#if defined(HAVE_STRUCT_TIMEVAL)
|
||||
#if defined(WE_HAVE_STRUCT_TIMEVAL_TV_USEC)
|
||||
extern "C" unsigned int
|
||||
EXPORT(GetFractions) (struct timeval *tv)
|
||||
{
|
||||
|
@ -194,7 +200,7 @@ EXPORT(GetFractions) (void *tv)
|
|||
this procedure function expects, timeval, as its first parameter
|
||||
and not a time_t (as expected by the posix equivalent). */
|
||||
|
||||
#if defined(HAVE_STRUCT_TIMEVAL)
|
||||
#if defined(WE_HAVE_STRUCT_TIMEVAL_TV_SEC)
|
||||
extern "C" struct tm *
|
||||
EXPORT(localtime_r) (struct timeval *tv, struct tm *m)
|
||||
{
|
||||
|
@ -210,7 +216,7 @@ EXPORT(localtime_r) (void *tv, struct tm *m)
|
|||
|
||||
/* wraptime_GetYear - returns the year from the structure, m. */
|
||||
|
||||
#if defined(HAVE_STRUCT_TM)
|
||||
#if defined(WE_HAVE_STRUCT_TM_YEAR)
|
||||
extern "C" unsigned int
|
||||
EXPORT(GetYear) (struct tm *m)
|
||||
{
|
||||
|
@ -226,7 +232,7 @@ EXPORT(GetYear) (void *m)
|
|||
|
||||
/* wraptime_GetMonth - returns the month from the structure, m. */
|
||||
|
||||
#if defined(HAVE_STRUCT_TM)
|
||||
#if defined(WE_HAVE_STRUCT_TM_MON)
|
||||
extern "C" unsigned int
|
||||
EXPORT(GetMonth) (struct tm *m)
|
||||
{
|
||||
|
@ -243,7 +249,7 @@ EXPORT(GetMonth) (void *m)
|
|||
/* wraptime_GetDay - returns the day of the month from the structure,
|
||||
m. */
|
||||
|
||||
#if defined(HAVE_STRUCT_TM)
|
||||
#if defined(WE_HAVE_STRUCT_TM_MDAY)
|
||||
extern "C" unsigned int
|
||||
EXPORT(GetDay) (struct tm *m)
|
||||
{
|
||||
|
@ -260,7 +266,7 @@ EXPORT(GetDay) (void *m)
|
|||
/* wraptime_GetHour - returns the hour of the day from the structure,
|
||||
m. */
|
||||
|
||||
#if defined(HAVE_STRUCT_TM)
|
||||
#if defined(WE_HAVE_STRUCT_TM_HOUR)
|
||||
extern "C" unsigned int
|
||||
EXPORT(GetHour) (struct tm *m)
|
||||
{
|
||||
|
@ -277,7 +283,7 @@ EXPORT(GetHour) (void *m)
|
|||
/* wraptime_GetMinute - returns the minute within the hour from the
|
||||
structure, m. */
|
||||
|
||||
#if defined(HAVE_STRUCT_TM)
|
||||
#if defined(WE_HAVE_STRUCT_TM_MIN)
|
||||
extern "C" unsigned int
|
||||
EXPORT(GetMinute) (struct tm *m)
|
||||
{
|
||||
|
@ -295,7 +301,7 @@ EXPORT(GetMinute) (void *m)
|
|||
structure, m. The return value will always be in the range 0..59.
|
||||
A leap minute of value 60 will be truncated to 59. */
|
||||
|
||||
#if defined(HAVE_STRUCT_TM)
|
||||
#if defined(WE_HAVE_STRUCT_TM_SEC)
|
||||
extern "C" unsigned int
|
||||
EXPORT(GetSecond) (struct tm *m)
|
||||
{
|
||||
|
@ -314,7 +320,7 @@ EXPORT(GetSecond) (void *m)
|
|||
|
||||
/* wraptime_GetSummerTime - returns true if summer time is in effect. */
|
||||
|
||||
#if defined(HAVE_STRUCT_TIMEZONE)
|
||||
#if defined(HAVE_STRUCT_TM_TM_ZONE)
|
||||
extern "C" bool
|
||||
EXPORT(GetSummerTime) (struct timezone *tz)
|
||||
{
|
||||
|
@ -330,7 +336,7 @@ EXPORT(GetSummerTime) (void *tz)
|
|||
|
||||
/* wraptime_GetDST - returns the number of minutes west of GMT. */
|
||||
|
||||
#if defined(HAVE_STRUCT_TIMEZONE)
|
||||
#if defined(HAVE_STRUCT_TM_TM_ZONE)
|
||||
extern "C" int
|
||||
EXPORT(GetDST) (struct timezone *tz)
|
||||
{
|
||||
|
@ -350,7 +356,7 @@ EXPORT(GetDST) (void *tz)
|
|||
|
||||
/* SetTimezone - set the timezone field inside timeval, tv. */
|
||||
|
||||
#if defined(HAVE_STRUCT_TIMEZONE)
|
||||
#if defined(HAVE_STRUCT_TM_TM_ZONE)
|
||||
extern "C" void
|
||||
EXPORT(SetTimezone) (struct timezone *tz, int zone, int minuteswest)
|
||||
{
|
||||
|
@ -367,22 +373,40 @@ EXPORT(SetTimezone) (void *tz, int zone, int minuteswest)
|
|||
/* SetTimeval - sets the fields in tm, t, with: second, minute, hour,
|
||||
day, month, year, fractions. */
|
||||
|
||||
#if defined(HAVE_STRUCT_TIMEVAL)
|
||||
#if defined(WE_HAVE_STRUCT_TM)
|
||||
extern "C" void
|
||||
EXPORT(SetTimeval) (struct tm *t, unsigned int second, unsigned int minute,
|
||||
unsigned int hour, unsigned int day, unsigned int month,
|
||||
unsigned int year, unsigned int yday, unsigned int wday,
|
||||
unsigned int isdst)
|
||||
{
|
||||
#if defined(WE_HAVE_STRUCT_TM_SEC)
|
||||
t->tm_sec = second;
|
||||
#endif
|
||||
#if defined(WE_HAVE_STRUCT_TM_MIN)
|
||||
t->tm_min = minute;
|
||||
#endif
|
||||
#if defined(WE_HAVE_STRUCT_TM_HOUR)
|
||||
t->tm_hour = hour;
|
||||
#endif
|
||||
#if defined(WE_HAVE_STRUCT_TM_MDAY)
|
||||
t->tm_mday = day;
|
||||
#endif
|
||||
#if defined(WE_HAVE_STRUCT_TM_MON)
|
||||
t->tm_mon = month;
|
||||
#endif
|
||||
#if defined(WE_HAVE_STRUCT_TM_YEAR)
|
||||
t->tm_year = year;
|
||||
#endif
|
||||
#if defined(WE_HAVE_STRUCT_TM_YDAY)
|
||||
t->tm_yday = yday;
|
||||
#endif
|
||||
#if defined(WE_HAVE_STRUCT_TM_WDAY)
|
||||
t->tm_wday = wday;
|
||||
#endif
|
||||
#if defined(WE_HAVE_STRUCT_TM_ISDST)
|
||||
t->tm_isdst = isdst;
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
extern "C" void
|
||||
|
|
Loading…
Reference in New Issue