/ Check-in [9894d2ce]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Use autoconf to detect presence of gmtime_r() and localtime_r() (CVS 4846)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9894d2ce418180b874406a7407e019dc872f289a
User & Date: mlcreech 2008-03-09 01:38:09
Context
2008-03-09
02:00
Change <sqlite3.h> to "sqlite3.h" in #includes (CVS 4847) check-in: 98e55fa4 user: mlcreech tags: trunk
01:38
Use autoconf to detect presence of gmtime_r() and localtime_r() (CVS 4846) check-in: 9894d2ce user: mlcreech tags: trunk
01:14
Replace SQLITE_EXTERN with SQLITE_API in exported variables when generating the amalgamation. Should fix #2982 (CVS 4845) check-in: f134c282 user: mlcreech tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to configure.

  1942   1942   ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
  1943   1943   ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
  1944   1944   ac_compiler_gnu=$ac_cv_c_compiler_gnu
  1945   1945   
  1946   1946   
  1947   1947   
  1948   1948   # The following RCS revision string applies to configure.in
  1949         -# $Revision: 1.50 $
         1949  +# $Revision: 1.51 $
  1950   1950   
  1951   1951   #########
  1952   1952   # Programs needed
  1953   1953   #
  1954   1954   # Check whether --enable-shared was given.
  1955   1955   if test "${enable_shared+set}" = set; then
  1956   1956     enableval=$enable_shared; p=${PACKAGE-default}
................................................................................
 19528  19528   #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
 19529  19529   _ACEOF
 19530  19530   
 19531  19531   fi
 19532  19532   
 19533  19533   done
 19534  19534   
        19535  +
        19536  +#########
        19537  +# Figure out whether or not we have these functions
        19538  +#
        19539  +
        19540  +
        19541  +
        19542  +
        19543  +for ac_func in usleep fdatasync localtime_r gmtime_r
        19544  +do
        19545  +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
        19546  +{ echo "$as_me:$LINENO: checking for $ac_func" >&5
        19547  +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
        19548  +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
        19549  +  echo $ECHO_N "(cached) $ECHO_C" >&6
        19550  +else
        19551  +  cat >conftest.$ac_ext <<_ACEOF
        19552  +/* confdefs.h.  */
        19553  +_ACEOF
        19554  +cat confdefs.h >>conftest.$ac_ext
        19555  +cat >>conftest.$ac_ext <<_ACEOF
        19556  +/* end confdefs.h.  */
        19557  +/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
        19558  +   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
        19559  +#define $ac_func innocuous_$ac_func
        19560  +
        19561  +/* System header to define __stub macros and hopefully few prototypes,
        19562  +    which can conflict with char $ac_func (); below.
        19563  +    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
        19564  +    <limits.h> exists even on freestanding compilers.  */
        19565  +
        19566  +#ifdef __STDC__
        19567  +# include <limits.h>
        19568  +#else
        19569  +# include <assert.h>
        19570  +#endif
        19571  +
        19572  +#undef $ac_func
        19573  +
        19574  +/* Override any GCC internal prototype to avoid an error.
        19575  +   Use char because int might match the return type of a GCC
        19576  +   builtin and then its argument prototype would still apply.  */
        19577  +#ifdef __cplusplus
        19578  +extern "C"
        19579  +#endif
        19580  +char $ac_func ();
        19581  +/* The GNU C library defines this for functions which it implements
        19582  +    to always fail with ENOSYS.  Some functions are actually named
        19583  +    something starting with __ and the normal name is an alias.  */
        19584  +#if defined __stub_$ac_func || defined __stub___$ac_func
        19585  +choke me
        19586  +#endif
        19587  +
        19588  +int
        19589  +main ()
        19590  +{
        19591  +return $ac_func ();
        19592  +  ;
        19593  +  return 0;
        19594  +}
        19595  +_ACEOF
        19596  +rm -f conftest.$ac_objext conftest$ac_exeext
        19597  +if { (ac_try="$ac_link"
        19598  +case "(($ac_try" in
        19599  +  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
        19600  +  *) ac_try_echo=$ac_try;;
        19601  +esac
        19602  +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
        19603  +  (eval "$ac_link") 2>conftest.er1
        19604  +  ac_status=$?
        19605  +  grep -v '^ *+' conftest.er1 >conftest.err
        19606  +  rm -f conftest.er1
        19607  +  cat conftest.err >&5
        19608  +  echo "$as_me:$LINENO: \$? = $ac_status" >&5
        19609  +  (exit $ac_status); } && {
        19610  +	 test -z "$ac_c_werror_flag" ||
        19611  +	 test ! -s conftest.err
        19612  +       } && test -s conftest$ac_exeext &&
        19613  +       $as_test_x conftest$ac_exeext; then
        19614  +  eval "$as_ac_var=yes"
        19615  +else
        19616  +  echo "$as_me: failed program was:" >&5
        19617  +sed 's/^/| /' conftest.$ac_ext >&5
        19618  +
        19619  +	eval "$as_ac_var=no"
        19620  +fi
        19621  +
        19622  +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
        19623  +      conftest$ac_exeext conftest.$ac_ext
        19624  +fi
        19625  +ac_res=`eval echo '${'$as_ac_var'}'`
        19626  +	       { echo "$as_me:$LINENO: result: $ac_res" >&5
        19627  +echo "${ECHO_T}$ac_res" >&6; }
        19628  +if test `eval echo '${'$as_ac_var'}'` = yes; then
        19629  +  cat >>confdefs.h <<_ACEOF
        19630  +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
        19631  +_ACEOF
        19632  +
        19633  +fi
        19634  +done
        19635  +
        19636  +
 19535  19637   
 19536  19638   #########
 19537  19639   # Set up an appropriate program prefix
 19538  19640   #
 19539  19641   if test "$program_prefix" = "NONE"; then
 19540  19642     program_prefix=""
 19541  19643   fi
................................................................................
 20649  20751   if test "${use_loadextension}" = "yes" ; then
 20650  20752     LOADEXTENSION_FLAGS=""
 20651  20753   else
 20652  20754     LOADEXTENSION_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1"
 20653  20755   fi
 20654  20756   
 20655  20757   
 20656         -#########
 20657         -# Figure out whether or not we have a "usleep()" function.
 20658         -#
 20659         -{ echo "$as_me:$LINENO: checking for usleep" >&5
 20660         -echo $ECHO_N "checking for usleep... $ECHO_C" >&6; }
 20661         -if test "${ac_cv_func_usleep+set}" = set; then
 20662         -  echo $ECHO_N "(cached) $ECHO_C" >&6
 20663         -else
 20664         -  cat >conftest.$ac_ext <<_ACEOF
 20665         -/* confdefs.h.  */
 20666         -_ACEOF
 20667         -cat confdefs.h >>conftest.$ac_ext
 20668         -cat >>conftest.$ac_ext <<_ACEOF
 20669         -/* end confdefs.h.  */
 20670         -/* Define usleep to an innocuous variant, in case <limits.h> declares usleep.
 20671         -   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
 20672         -#define usleep innocuous_usleep
 20673         -
 20674         -/* System header to define __stub macros and hopefully few prototypes,
 20675         -    which can conflict with char usleep (); below.
 20676         -    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
 20677         -    <limits.h> exists even on freestanding compilers.  */
 20678         -
 20679         -#ifdef __STDC__
 20680         -# include <limits.h>
 20681         -#else
 20682         -# include <assert.h>
 20683         -#endif
 20684         -
 20685         -#undef usleep
 20686         -
 20687         -/* Override any GCC internal prototype to avoid an error.
 20688         -   Use char because int might match the return type of a GCC
 20689         -   builtin and then its argument prototype would still apply.  */
 20690         -#ifdef __cplusplus
 20691         -extern "C"
 20692         -#endif
 20693         -char usleep ();
 20694         -/* The GNU C library defines this for functions which it implements
 20695         -    to always fail with ENOSYS.  Some functions are actually named
 20696         -    something starting with __ and the normal name is an alias.  */
 20697         -#if defined __stub_usleep || defined __stub___usleep
 20698         -choke me
 20699         -#endif
 20700         -
 20701         -int
 20702         -main ()
 20703         -{
 20704         -return usleep ();
 20705         -  ;
 20706         -  return 0;
 20707         -}
 20708         -_ACEOF
 20709         -rm -f conftest.$ac_objext conftest$ac_exeext
 20710         -if { (ac_try="$ac_link"
 20711         -case "(($ac_try" in
 20712         -  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
 20713         -  *) ac_try_echo=$ac_try;;
 20714         -esac
 20715         -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
 20716         -  (eval "$ac_link") 2>conftest.er1
 20717         -  ac_status=$?
 20718         -  grep -v '^ *+' conftest.er1 >conftest.err
 20719         -  rm -f conftest.er1
 20720         -  cat conftest.err >&5
 20721         -  echo "$as_me:$LINENO: \$? = $ac_status" >&5
 20722         -  (exit $ac_status); } && {
 20723         -	 test -z "$ac_c_werror_flag" ||
 20724         -	 test ! -s conftest.err
 20725         -       } && test -s conftest$ac_exeext &&
 20726         -       $as_test_x conftest$ac_exeext; then
 20727         -  ac_cv_func_usleep=yes
 20728         -else
 20729         -  echo "$as_me: failed program was:" >&5
 20730         -sed 's/^/| /' conftest.$ac_ext >&5
 20731         -
 20732         -	ac_cv_func_usleep=no
 20733         -fi
 20734         -
 20735         -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
 20736         -      conftest$ac_exeext conftest.$ac_ext
 20737         -fi
 20738         -{ echo "$as_me:$LINENO: result: $ac_cv_func_usleep" >&5
 20739         -echo "${ECHO_T}$ac_cv_func_usleep" >&6; }
 20740         -if test $ac_cv_func_usleep = yes; then
 20741         -  CFLAGS="$CFLAGS -DHAVE_USLEEP=1"
 20742         -fi
 20743         -
 20744         -
 20745         -#--------------------------------------------------------------------
 20746         -# Redefine fdatasync as fsync on systems that lack fdatasync
 20747         -#--------------------------------------------------------------------
 20748         -
 20749         -{ echo "$as_me:$LINENO: checking for fdatasync" >&5
 20750         -echo $ECHO_N "checking for fdatasync... $ECHO_C" >&6; }
 20751         -if test "${ac_cv_func_fdatasync+set}" = set; then
 20752         -  echo $ECHO_N "(cached) $ECHO_C" >&6
 20753         -else
 20754         -  cat >conftest.$ac_ext <<_ACEOF
 20755         -/* confdefs.h.  */
 20756         -_ACEOF
 20757         -cat confdefs.h >>conftest.$ac_ext
 20758         -cat >>conftest.$ac_ext <<_ACEOF
 20759         -/* end confdefs.h.  */
 20760         -/* Define fdatasync to an innocuous variant, in case <limits.h> declares fdatasync.
 20761         -   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
 20762         -#define fdatasync innocuous_fdatasync
 20763         -
 20764         -/* System header to define __stub macros and hopefully few prototypes,
 20765         -    which can conflict with char fdatasync (); below.
 20766         -    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
 20767         -    <limits.h> exists even on freestanding compilers.  */
 20768         -
 20769         -#ifdef __STDC__
 20770         -# include <limits.h>
 20771         -#else
 20772         -# include <assert.h>
 20773         -#endif
 20774         -
 20775         -#undef fdatasync
 20776         -
 20777         -/* Override any GCC internal prototype to avoid an error.
 20778         -   Use char because int might match the return type of a GCC
 20779         -   builtin and then its argument prototype would still apply.  */
 20780         -#ifdef __cplusplus
 20781         -extern "C"
 20782         -#endif
 20783         -char fdatasync ();
 20784         -/* The GNU C library defines this for functions which it implements
 20785         -    to always fail with ENOSYS.  Some functions are actually named
 20786         -    something starting with __ and the normal name is an alias.  */
 20787         -#if defined __stub_fdatasync || defined __stub___fdatasync
 20788         -choke me
 20789         -#endif
 20790         -
 20791         -int
 20792         -main ()
 20793         -{
 20794         -return fdatasync ();
 20795         -  ;
 20796         -  return 0;
 20797         -}
 20798         -_ACEOF
 20799         -rm -f conftest.$ac_objext conftest$ac_exeext
 20800         -if { (ac_try="$ac_link"
 20801         -case "(($ac_try" in
 20802         -  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
 20803         -  *) ac_try_echo=$ac_try;;
 20804         -esac
 20805         -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
 20806         -  (eval "$ac_link") 2>conftest.er1
 20807         -  ac_status=$?
 20808         -  grep -v '^ *+' conftest.er1 >conftest.err
 20809         -  rm -f conftest.er1
 20810         -  cat conftest.err >&5
 20811         -  echo "$as_me:$LINENO: \$? = $ac_status" >&5
 20812         -  (exit $ac_status); } && {
 20813         -	 test -z "$ac_c_werror_flag" ||
 20814         -	 test ! -s conftest.err
 20815         -       } && test -s conftest$ac_exeext &&
 20816         -       $as_test_x conftest$ac_exeext; then
 20817         -  ac_cv_func_fdatasync=yes
 20818         -else
 20819         -  echo "$as_me: failed program was:" >&5
 20820         -sed 's/^/| /' conftest.$ac_ext >&5
 20821         -
 20822         -	ac_cv_func_fdatasync=no
 20823         -fi
 20824         -
 20825         -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
 20826         -      conftest$ac_exeext conftest.$ac_ext
 20827         -fi
 20828         -{ echo "$as_me:$LINENO: result: $ac_cv_func_fdatasync" >&5
 20829         -echo "${ECHO_T}$ac_cv_func_fdatasync" >&6; }
 20830         -if test $ac_cv_func_fdatasync = yes; then
 20831         -  CFLAGS="$CFLAGS -DHAVE_FDATASYNC=1"
 20832         -fi
 20833         -
 20834  20758   
 20835  20759   #########
 20836  20760   # Output the config header
 20837  20761   ac_config_headers="$ac_config_headers src/config.h"
 20838  20762   
 20839  20763   
 20840  20764   #########

Changes to configure.ac.

    88     88   # the corresponding code.
    89     89   #
    90     90   AC_INIT(sqlite, m4_esyscmd([cat VERSION | tr -d '\n']))
    91     91   
    92     92   dnl Put the RCS revision string after AC_INIT so that it will also
    93     93   dnl show in in configure.
    94     94   # The following RCS revision string applies to configure.in
    95         -# $Revision: 1.36 $
           95  +# $Revision: 1.37 $
    96     96   
    97     97   #########
    98     98   # Programs needed
    99     99   #
   100    100   AC_PROG_LIBTOOL
   101    101   AC_PROG_INSTALL
   102    102   AC_PROG_AWK
................................................................................
   104    104   #########
   105    105   # Check for needed/wanted data types
   106    106   AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t, intptr_t, uint8_t,
   107    107                   uint16_t, uint32_t, uint64_t, uintptr_t])
   108    108   
   109    109   #########
   110    110   # Check for needed/wanted headers
   111         -AC_CHECK_HEADERS(sys/types.h stdlib.h stdint.h inttypes.h)
          111  +AC_CHECK_HEADERS([sys/types.h stdlib.h stdint.h inttypes.h])
          112  +
          113  +#########
          114  +# Figure out whether or not we have these functions
          115  +#
          116  +AC_CHECK_FUNCS([usleep fdatasync localtime_r gmtime_r])
          117  +
   112    118   
   113    119   #########
   114    120   # Set up an appropriate program prefix
   115    121   #
   116    122   if test "$program_prefix" = "NONE"; then
   117    123     program_prefix=""
   118    124   fi
................................................................................
   590    596   if test "${use_loadextension}" = "yes" ; then
   591    597     LOADEXTENSION_FLAGS=""
   592    598   else
   593    599     LOADEXTENSION_FLAGS="-DSQLITE_OMIT_LOAD_EXTENSION=1"
   594    600   fi
   595    601   AC_SUBST(LOADEXTENSION_FLAGS)
   596    602   
   597         -#########
   598         -# Figure out whether or not we have a "usleep()" function.
   599         -#
   600         -AC_CHECK_FUNC(usleep, [CFLAGS="$CFLAGS -DHAVE_USLEEP=1"])
   601         -
   602         -#--------------------------------------------------------------------
   603         -# Redefine fdatasync as fsync on systems that lack fdatasync
   604         -#--------------------------------------------------------------------
   605         -
   606         -AC_CHECK_FUNC(fdatasync, [CFLAGS="$CFLAGS -DHAVE_FDATASYNC=1"])
   607    603   
   608    604   #########
   609    605   # Output the config header
   610    606   AC_CONFIG_HEADERS(src/config.h)
   611    607   
   612    608   #########
   613    609   # Generate the output files.
   614    610   #
   615    611   AC_SUBST(BUILD_CFLAGS)
   616    612   AC_OUTPUT([
   617    613   Makefile
   618    614   sqlite3.pc
   619    615   ])

Changes to src/config.h.in.

     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** Configuration header template to be filled in by 'configure' script
    13     13   **
    14         -** @(#) $Id: config.h.in,v 1.2 2008/03/06 16:28:58 mlcreech Exp $
           14  +** @(#) $Id: config.h.in,v 1.3 2008/03/09 01:38:10 mlcreech Exp $
    15     15   */
    16     16   #ifndef _CONFIG_H_
    17     17   #define _CONFIG_H_
    18     18   
           19  +
           20  +/*****************************
           21  +** Data types
           22  +*****************************/
           23  +
    19     24   /* Define as 1 if you have the int8_t type */
    20     25   #undef HAVE_INT8_T
    21     26   
    22     27   /* Define as 1 if you have the int16_t type */
    23     28   #undef HAVE_INT16_T
    24     29   
    25     30   /* Define as 1 if you have the int32_t type */
................................................................................
    42     47   
    43     48   /* Define as 1 if you have the uint64_t type */
    44     49   #undef HAVE_UINT64_T
    45     50   
    46     51   /* Define as 1 if you have the uintptr_t type */
    47     52   #undef HAVE_UINTPTR_T
    48     53   
           54  +
           55  +/*****************************
           56  +** Header Files
           57  +*****************************/
           58  +
    49     59   /* Define as 1 if you have the sys/types.h header */
    50     60   #undef HAVE_SYS_TYPES_H
    51     61   
    52     62   /* Define as 1 if you have the stdlib.h header */
    53     63   #undef HAVE_STDLIB_H
    54     64   
    55     65   /* Define as 1 if you have the stdint.h header */
    56     66   #undef HAVE_STDINT_H
    57     67   
    58     68   /* Define as 1 if you have the inttypes.h header */
    59     69   #undef HAVE_INTTYPES_H
    60     70   
           71  +
           72  +/*****************************
           73  +** Functions
           74  +*****************************/
           75  +
           76  +/* Define as 1 if you have the usleep() function */
           77  +#undef HAVE_USLEEP
           78  +
           79  +/* Define as 1 if you have the fdatasync() function */
           80  +#undef HAVE_FDATASYNC
           81  +
           82  +/* Define as 1 if you have the gmtime_r() function */
           83  +#undef HAVE_GMTIME_R
           84  +
           85  +/* Define as 1 if you have the localtime_r() function */
           86  +#undef HAVE_LOCALTIME_R
           87  +
           88  +
           89  +/* End of header */
    61     90   #endif