Use autoconf to detect presence of gmtime_r() and localtime_r() (CVS 4846)

FossilOrigin-Name: 9894d2ce418180b874406a7407e019dc872f289a
This commit is contained in:
mlcreech 2008-03-09 01:38:09 +00:00
parent 6f10b3c0c9
commit 5b0a9ebe4c
5 changed files with 150 additions and 201 deletions

282
configure vendored
View File

@ -1946,7 +1946,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
# The following RCS revision string applies to configure.in
# $Revision: 1.50 $
# $Revision: 1.51 $
#########
# Programs needed
@ -19533,6 +19533,108 @@ fi
done
#########
# Figure out whether or not we have these functions
#
for ac_func in usleep fdatasync localtime_r gmtime_r
do
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
{ echo "$as_me:$LINENO: checking for $ac_func" >&5
echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define $ac_func innocuous_$ac_func
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
#undef $ac_func
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char $ac_func ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined __stub_$ac_func || defined __stub___$ac_func
choke me
#endif
int
main ()
{
return $ac_func ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
eval "$as_ac_var=yes"
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
eval "$as_ac_var=no"
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
fi
ac_res=`eval echo '${'$as_ac_var'}'`
{ echo "$as_me:$LINENO: result: $ac_res" >&5
echo "${ECHO_T}$ac_res" >&6; }
if test `eval echo '${'$as_ac_var'}'` = yes; then
cat >>confdefs.h <<_ACEOF
#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
#########
# Set up an appropriate program prefix
#
@ -20653,184 +20755,6 @@ else
fi
#########
# Figure out whether or not we have a "usleep()" function.
#
{ echo "$as_me:$LINENO: checking for usleep" >&5
echo $ECHO_N "checking for usleep... $ECHO_C" >&6; }
if test "${ac_cv_func_usleep+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Define usleep to an innocuous variant, in case <limits.h> declares usleep.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define usleep innocuous_usleep
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char usleep (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
#undef usleep
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char usleep ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined __stub_usleep || defined __stub___usleep
choke me
#endif
int
main ()
{
return usleep ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
ac_cv_func_usleep=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_func_usleep=no
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
fi
{ echo "$as_me:$LINENO: result: $ac_cv_func_usleep" >&5
echo "${ECHO_T}$ac_cv_func_usleep" >&6; }
if test $ac_cv_func_usleep = yes; then
CFLAGS="$CFLAGS -DHAVE_USLEEP=1"
fi
#--------------------------------------------------------------------
# Redefine fdatasync as fsync on systems that lack fdatasync
#--------------------------------------------------------------------
{ echo "$as_me:$LINENO: checking for fdatasync" >&5
echo $ECHO_N "checking for fdatasync... $ECHO_C" >&6; }
if test "${ac_cv_func_fdatasync+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Define fdatasync to an innocuous variant, in case <limits.h> declares fdatasync.
For example, HP-UX 11i <limits.h> declares gettimeofday. */
#define fdatasync innocuous_fdatasync
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char fdatasync (); below.
Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
<limits.h> exists even on freestanding compilers. */
#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif
#undef fdatasync
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char fdatasync ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined __stub_fdatasync || defined __stub___fdatasync
choke me
#endif
int
main ()
{
return fdatasync ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_link") 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } && {
test -z "$ac_c_werror_flag" ||
test ! -s conftest.err
} && test -s conftest$ac_exeext &&
$as_test_x conftest$ac_exeext; then
ac_cv_func_fdatasync=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_func_fdatasync=no
fi
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
conftest$ac_exeext conftest.$ac_ext
fi
{ echo "$as_me:$LINENO: result: $ac_cv_func_fdatasync" >&5
echo "${ECHO_T}$ac_cv_func_fdatasync" >&6; }
if test $ac_cv_func_fdatasync = yes; then
CFLAGS="$CFLAGS -DHAVE_FDATASYNC=1"
fi
#########
# Output the config header

View File

@ -92,7 +92,7 @@ AC_INIT(sqlite, m4_esyscmd([cat VERSION | tr -d '\n']))
dnl Put the RCS revision string after AC_INIT so that it will also
dnl show in in configure.
# The following RCS revision string applies to configure.in
# $Revision: 1.36 $
# $Revision: 1.37 $
#########
# Programs needed
@ -108,7 +108,13 @@ AC_CHECK_TYPES([int8_t, int16_t, int32_t, int64_t, intptr_t, uint8_t,
#########
# Check for needed/wanted headers
AC_CHECK_HEADERS(sys/types.h stdlib.h stdint.h inttypes.h)
AC_CHECK_HEADERS([sys/types.h stdlib.h stdint.h inttypes.h])
#########
# Figure out whether or not we have these functions
#
AC_CHECK_FUNCS([usleep fdatasync localtime_r gmtime_r])
#########
# Set up an appropriate program prefix
@ -594,16 +600,6 @@ else
fi
AC_SUBST(LOADEXTENSION_FLAGS)
#########
# Figure out whether or not we have a "usleep()" function.
#
AC_CHECK_FUNC(usleep, [CFLAGS="$CFLAGS -DHAVE_USLEEP=1"])
#--------------------------------------------------------------------
# Redefine fdatasync as fsync on systems that lack fdatasync
#--------------------------------------------------------------------
AC_CHECK_FUNC(fdatasync, [CFLAGS="$CFLAGS -DHAVE_FDATASYNC=1"])
#########
# Output the config header

View File

@ -1,5 +1,5 @@
C Replace\sSQLITE_EXTERN\swith\sSQLITE_API\sin\sexported\svariables\swhen\sgenerating\nthe\samalgamation.\s\sShould\sfix\s#2982\s(CVS\s4845)
D 2008-03-09T01:14:42
C Use\sautoconf\sto\sdetect\spresence\sof\sgmtime_r()\sand\slocaltime_r()\s(CVS\s4846)
D 2008-03-09T01:38:09
F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
F Makefile.in d521464011d6965bbda1b699f1850c6e33141c73
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -16,8 +16,8 @@ F art/nocopy.gif 716aa07d4bb7250d4e75756073bf8ef9f56bec8f
F art/powered_by_sqlite.gif 7fbcd7d3675391fd3d21672c14c05f5999eb60d1
F config.guess dba2d1300ec8f8cd00c6fb44b9edde21c14e960c
F config.sub 9a842e7c332ed65cef3f2c20354e06dc998b2796
F configure ff2b1ee24b75c386a493bd013dcf18b500a4888a x
F configure.ac 95fa89bde2948222857c2a341968a6e9c2c335b7
F configure fa502784b1efa3038d4d8ae0ab2eecd100102a1b x
F configure.ac 63c0c01703f4c19ee9d65998ddfcbd6496982210
F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad
F doc/lemon.html f0f682f50210928c07e562621c3b7e8ab912a538
F doc/report1.txt a031aaf37b185e4fa540223cb516d3bccec7eeac
@ -91,7 +91,7 @@ F src/build.c fa70bc0fb02e4d08202dd6a752ab5f5df5676e50
F src/callback.c 77b302b0d41468dcda78c70e706e5b84577f0fa0
F src/complete.c 4cf68fd75d60257524cbe74f87351b9848399131
F src/config.h b60286b542f5284d529b659adcb9c9d25eecab20
F src/config.h.in 46fc486f4c162bc9b3f641a6cfdeaa6bd1c011aa
F src/config.h.in 343f19cacc74d4baf84a4af701b5bb44419642ff
F src/date.c 187cad26eaaecd7bcdccd49d5a70c5aa3010bc74
F src/delete.c fa13c296262e89c32d28949f15be275e52d7f524
F src/experimental.c 1b2d1a6cd62ecc39610e97670332ca073c50792b
@ -623,7 +623,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
P 2db43738bfcd2db29167ff02f4291e74324225d7
R fb841dfcda6d1a0d05bee7105302b4c8
P f134c282ea841fe35f322a1f8c326242c6ad7b24
R ba3a515450d42ee359837a3678ae8eb8
U mlcreech
Z 3ad0903ec0700d3cf59532ddb2d43fdb
Z 74e3803d4de5a1f765d15ea72757db1d

View File

@ -1 +1 @@
f134c282ea841fe35f322a1f8c326242c6ad7b24
9894d2ce418180b874406a7407e019dc872f289a

View File

@ -11,11 +11,16 @@
*************************************************************************
** Configuration header template to be filled in by 'configure' script
**
** @(#) $Id: config.h.in,v 1.2 2008/03/06 16:28:58 mlcreech Exp $
** @(#) $Id: config.h.in,v 1.3 2008/03/09 01:38:10 mlcreech Exp $
*/
#ifndef _CONFIG_H_
#define _CONFIG_H_
/*****************************
** Data types
*****************************/
/* Define as 1 if you have the int8_t type */
#undef HAVE_INT8_T
@ -46,6 +51,11 @@
/* Define as 1 if you have the uintptr_t type */
#undef HAVE_UINTPTR_T
/*****************************
** Header Files
*****************************/
/* Define as 1 if you have the sys/types.h header */
#undef HAVE_SYS_TYPES_H
@ -58,4 +68,23 @@
/* Define as 1 if you have the inttypes.h header */
#undef HAVE_INTTYPES_H
/*****************************
** Functions
*****************************/
/* Define as 1 if you have the usleep() function */
#undef HAVE_USLEEP
/* Define as 1 if you have the fdatasync() function */
#undef HAVE_FDATASYNC
/* Define as 1 if you have the gmtime_r() function */
#undef HAVE_GMTIME_R
/* Define as 1 if you have the localtime_r() function */
#undef HAVE_LOCALTIME_R
/* End of header */
#endif