From 04fbe62bbcb53c999698b67b1f0e9fdff3f37d92 Mon Sep 17 00:00:00 2001 From: Lev Walkin Date: Wed, 17 Sep 2014 02:27:01 -0700 Subject: [PATCH] check if timegm is present before emulating --- config.h.in | 3 +++ configure | 31 +++++++++++++++-------- configure.ac | 1 + skeletons/GeneralizedTime.c | 2 ++ tests/125-bitstring-constraint-OK.asn1.-X | 2 +- 5 files changed, 28 insertions(+), 11 deletions(-) diff --git a/config.h.in b/config.h.in index 383523ff..4ee7da1d 100644 --- a/config.h.in +++ b/config.h.in @@ -45,6 +45,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H +/* Define to 1 if you have the `timegm' function. */ +#undef HAVE_TIMEGM + /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H diff --git a/configure b/configure index 83cc4e49..c621f2c9 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for asn1c 0.9.27. +# Generated by GNU Autoconf 2.69 for asn1c 0.9.28. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='asn1c' PACKAGE_TARNAME='asn1c' -PACKAGE_VERSION='0.9.27' -PACKAGE_STRING='asn1c 0.9.27' +PACKAGE_VERSION='0.9.28' +PACKAGE_STRING='asn1c 0.9.28' PACKAGE_BUGREPORT='vlm@lionet.info' PACKAGE_URL='' @@ -1320,7 +1320,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures asn1c 0.9.27 to adapt to many kinds of systems. +\`configure' configures asn1c 0.9.28 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1390,7 +1390,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of asn1c 0.9.27:";; + short | recursive ) echo "Configuration of asn1c 0.9.28:";; esac cat <<\_ACEOF @@ -1501,7 +1501,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -asn1c configure 0.9.27 +asn1c configure 0.9.28 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1924,7 +1924,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by asn1c $as_me 0.9.27, which was +It was created by asn1c $as_me 0.9.28, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2739,7 +2739,7 @@ fi # Define the identity of the package. PACKAGE='asn1c' - VERSION='0.9.27' + VERSION='0.9.28' cat >>confdefs.h <<_ACEOF @@ -13302,6 +13302,17 @@ _ACEOF fi done +for ac_func in timegm +do : + ac_fn_c_check_func "$LINENO" "timegm" "ac_cv_func_timegm" +if test "x$ac_cv_func_timegm" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_TIMEGM 1 +_ACEOF + +fi +done + ac_config_files="$ac_config_files skeletons/tests/Makefile libasn1compiler/Makefile libasn1parser/Makefile libasn1print/Makefile asn1c/tests/Makefile libasn1fix/Makefile doc/docsrc/Makefile skeletons/Makefile examples/Makefile asn1c/Makefile doc/Makefile asn1c.spec Makefile" @@ -13840,7 +13851,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by asn1c $as_me 0.9.27, which was +This file was extended by asn1c $as_me 0.9.28, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -13906,7 +13917,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -asn1c config.status 0.9.27 +asn1c config.status 0.9.28 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 05b373a3..889b6a8d 100644 --- a/configure.ac +++ b/configure.ac @@ -91,6 +91,7 @@ AC_SEARCH_LIBS(getopt, iberty) AC_CHECK_FUNCS(strtoimax strtoll) AC_CHECK_FUNCS(mergesort) AC_CHECK_FUNCS(mkstemps) +AC_CHECK_FUNCS(timegm) AC_OUTPUT( \ skeletons/tests/Makefile \ diff --git a/skeletons/GeneralizedTime.c b/skeletons/GeneralizedTime.c index 4b0ae5d4..9672c967 100644 --- a/skeletons/GeneralizedTime.c +++ b/skeletons/GeneralizedTime.c @@ -128,6 +128,7 @@ static long GMTOFF(struct tm a){ tzset(); \ } while(0); } while(0); +#ifndef HAVE_TIMEGM #ifdef _EMULATE_TIMEGM static time_t timegm(struct tm *tm) { time_t tloc; @@ -138,6 +139,7 @@ static time_t timegm(struct tm *tm) { return tloc; } #endif /* _EMULATE_TIMEGM */ +#endif #ifndef __ASN_INTERNAL_TEST_MODE__ diff --git a/tests/125-bitstring-constraint-OK.asn1.-X b/tests/125-bitstring-constraint-OK.asn1.-X index cb3bc7c2..b33feccd 100644 --- a/tests/125-bitstring-constraint-OK.asn1.-X +++ b/tests/125-bitstring-constraint-OK.asn1.-X @@ -1,4 +1,4 @@ - +