diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2013-11-29 06:15:05 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2013-11-29 06:15:05 -0800 |
commit | 5cdd2fd5ff14c113b867df969779c75fca79932e (patch) | |
tree | 65ec24eb1a32105a182837804e532184b7278d3e /configure | |
parent | b730e5dce382923990bc4ad76b90da8b9f73100f (diff) | |
download | txr-5cdd2fd5ff14c113b867df969779c75fca79932e.tar.gz txr-5cdd2fd5ff14c113b867df969779c75fca79932e.tar.bz2 txr-5cdd2fd5ff14c113b867df969779c75fca79932e.zip |
* configure (config_flags): New variable, allowing us to
have stricter diagnosis for configure tests.
(have_timegm, need_svid_source, need_bsd_source): New
variables. sys/stat.h test only declares static data and
compiles an object file. Adding tests for timegm, tzset,
setenv and unsetenv.
* eval.c (eval_init): Register new intrinsic, make_time_utc.
* lib.c (make_time_impl): New static function.
(make_time): Reimplemented as call to make_time_impl.
(timegm_hack): New conditionally-defined static function.
(make_time_utc): New function.
* lib.h (make_time_utc): Declared.
* txr.1: make-time-utc documented.
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 86 |
1 files changed, 78 insertions, 8 deletions
@@ -84,6 +84,7 @@ opt_flags=-O2 lang_flags='-ansi -D_XOPEN_SOURCE=2' diag_flags='-Wall -Wmissing-prototypes -Wstrict-prototypes' debug_flags=-g +config_flags=' -Werror' # special: used only during configure inline= platform_flags= remove_flags= @@ -98,6 +99,9 @@ mpi_version=1.8.6 have_quilt= have_patch= have_unistd= +have_timegm= +need_svid_source= +need_bsd_source= # # Parse configuration variables @@ -583,7 +587,7 @@ NM := $nm OPT_FLAGS := $opt_flags LANG_FLAGS := $lang_flags -DIAG_FLAGS := $diag_flags +DIAG_FLAGS := $diag_flags$config_flags DBG_FLAGS := $debug_flags PLATFORM_FLAGS := $platform_flags REMOVE_FLAGS := $remove_flags @@ -1152,14 +1156,10 @@ printf "Checking whether we have <sys/stat.h> ... " cat > conftest.c <<! #include <sys/stat.h> -int main(void) -{ - struct stat s; - return 0; -} +struct stat s; ! rm -f conftest -if ! $make conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then +if ! $make conftest.o > conftest.err 2>&1; then printf "no\n" else printf "yes\n" @@ -1250,7 +1250,7 @@ fi # Check for fields inside struct tm # -printf "Printf detecting timezone fields in struct tm ..." +printf "Printf detecting timezone fields in struct tm ... " tm_gmtoff= tm_tmzone= @@ -1283,6 +1283,69 @@ done printf "done\n" +printf "Checking for timegm function ... " + +cat > conftest.c <<! +#include <time.h> + +int main(void) +{ + struct tm tms = { 0 }; + timegm(&tms); + return 0; +} +! +rm -f conftest +if ! $make EXTRA_FLAGS='-D_SVID_SOURCE' conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then + printf "no\n" +else + printf "yes\n" + printf "#define HAVE_TIMEGM 1\n" >> config.h + have_timegm=y + need_svid_source=y +fi + +if [ -z "$have_timegm" ] ; then + printf "Checking for setenv and unsetenv functions ... " + + cat > conftest.c <<! +#include <stdlib.h> + +int main(void) +{ + setenv("TERM", "foo", 1); + unsetenv("TERM"); + return 0; +} +! + rm -f conftest + if ! $make EXTRA_FLAGS='-D_BSD_SOURCE' conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then + printf "no\n" + else + printf "yes\n" + printf "#define HAVE_SETENV 1\n" >> config.h + need_bsd_source=y + fi +fi +printf "Checking for tzset function ... " + +cat > conftest.c <<! +#include <time.h> + +int main(void) +{ + tzset(); + return 0; +} +! +rm -f conftest +if ! $make conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then + printf "no\n" +else + printf "yes\n" + printf "#define HAVE_TZSET 1\n" >> config.h +fi + printf "Checking for POSIX sleep function ... " cat > conftest.c <<! @@ -1423,6 +1486,13 @@ fi # printf "Regenerating config.make ... " +config_flags= +if [ -n "$need_svid_source" ] ; then + lang_flags="$lang_flags -D_SVID_SOURCE" +fi +if [ -n "$need_bsd_source" ] ; then + lang_flags="$lang_flags -D_BSD_SOURCE" +fi gen_config_make printf "done\n" |