From 74acf6cd24492cf32b412f7b1528d6a216a9e4d6 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 1 Mar 2014 11:20:58 -0800 Subject: * configure (conftest, conftest_o): New functions Use functions throughout tests instead of repeated code for removing target, invoking make with redirection and testing for existence of target. --- ChangeLog | 7 ++++ configure | 133 +++++++++++++++++++++++++++++--------------------------------- 2 files changed, 69 insertions(+), 71 deletions(-) diff --git a/ChangeLog b/ChangeLog index 25e11ec1..3bef2139 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2014-03-01 Kaz Kylheku + + * configure (conftest, conftest_o): New functions + Use functions throughout tests instead of repeated code for removing + target, invoking make with redirection and testing for existence of + target. + 2014-03-01 Kaz Kylheku * tests/011/special-1.txr: Add some coverage for evaluation diff --git a/configure b/configure index 63ce7f17..762fb104 100755 --- a/configure +++ b/configure @@ -628,6 +628,35 @@ cat < config.h */ ! +# +# Perform a configure test. +# Arguments are passed through to make +# +conftest() +{ + rm -f ${exe-"conftest conftest.exe"} ${exe+"conftest$exe"} + $make conftest "$@" > conftest.err 2>&1 && [ -x conftest ] +} + +# +# Like conftest but make only .o +# +conftest_o() +{ + rm -f conftest.o + $make conftest.o "$@" > conftest.err 2>&1 +} + +# +# Like conftest but make conftest.syms +# +conftest_syms() +{ + rm -f conftest.o conftest.syms + $make conftest.syms "$@" > conftest.err 2>&1 +} + + # # Check C compiler sanity # @@ -642,8 +671,7 @@ int main(void) } ! -rm -f conftest conftest.exe -if ! $make conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then +if ! conftest ; then printf "failed\n\n" printf "Errors from compilation: \n\n" cat conftest.err @@ -697,8 +725,7 @@ int $ident(void); int main(void) { return 0; } ! - rm -f conftest$exe - if ! $make conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then + if ! conftest ; then printf "#define %s txr_%s\n" $ident $ident >> config.h have_unistd=y fi @@ -721,8 +748,7 @@ int main(void) return fileno(stdin); } ! -rm -f conftest$exe -if ! $make EXTRA_FLAGS=-Werror conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then +if ! conftest EXTRA_FLAGS=-Werror ; then printf "no\n" lang_flags="$lang_flags -U__STRICT_ANSI__" printf "Regenerating config.make ..." @@ -767,7 +793,7 @@ int main(void) return isdigit(x); } ! -if ! $make EXTRA_FLAGS=-Werror conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then +if ! conftest EXTRA_FLAGS=-Werror ; then printf "present\n" cat >> config.h < conftest.c < conftest.err 2>&1 ; then + if conftest_o ; then longlong=$try_type break fi @@ -813,8 +838,7 @@ for try_type in uint64 __uint64 "unsigned long long" ; do cat > conftest.c < conftest.err 2>&1 ; then + if conftest_o; then ulonglong=$try_type break fi @@ -855,8 +879,7 @@ int main(void) } longlong_t a, b; ! - rm -f conftest.o - if $make conftest.o > conftest.err 2>&1 ; then + if conftest_o ; then superlong=$try_type break fi @@ -887,8 +910,7 @@ int main(void) } longlong_t a, b; ! - rm -f conftest.o - if $make conftest.o > conftest.err 2>&1 ; then + if conftest_o ; then usuperlong=$try_type break fi @@ -961,9 +983,7 @@ char SIZEOF_INT[sizeof (int)]; char SIZEOF_SHORT[sizeof (short)]; char DUMMY; ! - rm -f conftest.o conftest.syms - - if ! $make conftest.syms > conftest.err 2>&1 ; then + if ! conftest_syms ; then printf "failed\n\n" printf "Errors from compilation: \n\n" @@ -980,8 +1000,6 @@ char DUMMY; read_syms y - rm -f conftest.syms conftest.o - if [ $SIZEOF_PTR -eq 0 ] ; then printf "failed\n" exit 1 @@ -1050,9 +1068,7 @@ if [ -z "$lit_align" ] ; then char SIZEOF_WCHAR_T[sizeof (wchar_t)]; char DUMMY; ! - rm -f conftest.o conftest.syms - - if ! $make conftest.syms > conftest.err 2>&1 ; then + if ! conftest_syms ; then printf "failed\n\n" printf "Errors from compilation: \n\n" @@ -1065,8 +1081,6 @@ char DUMMY; read_syms - rm -f conftest.syms conftest.o - if [ $SIZEOF_WCHAR_T -eq 0 ] ; then printf "failed\n" exit 1 @@ -1139,8 +1153,7 @@ int main(void) syntax error #endif ! - rm -rf conftest - if ! $make conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then + if ! conftest ; then printf "failed\n\n" printf "Errors from compilation: \n\n" cat conftest.err @@ -1205,8 +1218,7 @@ int main(void) return 0; } ! -rm -f conftest$exe -if ! $make conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then +if ! conftest ; then printf "no\n" else printf "yes\n" @@ -1229,8 +1241,7 @@ int main(void) return 0; } ! -rm -f conftest$exe -if ! $make conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then +if ! conftest ; then printf "no\n" else printf "yes\n" @@ -1254,8 +1265,7 @@ int main(void) return 0; } ! -rm -f conftest$exe -if ! $make conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then +if ! conftest ; then printf "no\n" else printf "yes\n" @@ -1277,8 +1287,7 @@ int main(void) return 0; } ! -rm -f conftest$exe -if ! $make conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then +if ! conftest ; then printf "no\n" else printf "yes\n" @@ -1311,8 +1320,7 @@ int main(int argc, char **argv) return 0; } ! -rm -f conftest$exe -if ! $make conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then +if ! conftest ; then printf "no\n" else printf "yes\n" @@ -1334,8 +1342,7 @@ for try_field in tm_gmtoff __tm_gmtoff ; do #include int x = sizeof ((struct tm *) 0)->$try_field; ! - rm -f conftest.o - if $make conftest.o > conftest.err 2>&1 ; then + if conftest_o ; then printf "#define HAVE_TM_GMTOFF 1\n" >> config.h printf "#define TM_GMTOFF %s\n" $try_field >> config.h break @@ -1347,8 +1354,7 @@ for try_field in tm_zone __tm_zone ; do #include int x = sizeof ((struct tm *) 0)->$try_field; ! - rm -f conftest.o - if $make conftest.o > conftest.err 2>&1 ; then + if conftest_o ; then printf "#define HAVE_TM_ZONE 1\n" >> config.h printf "#define TM_ZONE %s\n" $try_field >> config.h break @@ -1369,8 +1375,7 @@ int main(void) return 0; } ! -rm -f conftest$exe -if ! $make conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then +if ! conftest ; then printf "no\n" else printf "yes\n" @@ -1390,8 +1395,7 @@ int main(void) return 0; } ! -rm -f conftest$exe -if ! $make conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then +if ! conftest ; then printf "no\n" else printf "yes\n" @@ -1408,8 +1412,7 @@ int main(void) return 0; } ! -rm -f conftest$exe -if ! $make conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then +if ! conftest ; then printf "no\n" else printf "yes\n" @@ -1431,8 +1434,7 @@ int main(int argc, char **argv) return 0; } ! -rm -f conftest$exe -if ! $make conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then +if ! conftest ; then printf "no\n" else printf "yes\n" @@ -1452,8 +1454,7 @@ int main(int argc, char **argv) return 0; } ! -rm -f conftest$exe -if ! $make conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then +if ! conftest ; then printf "no\n" else printf "yes\n" @@ -1472,8 +1473,7 @@ int main(int argc, char **argv) return 0; } ! -rm -f conftest$exe -if ! $make conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then +if ! conftest ; then printf "no\n" else printf "yes\n" @@ -1493,8 +1493,7 @@ int main(int argc, char **argv) return 0; } ! -rm -f conftest$exe -if ! $make conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then +if ! conftest ; then printf "no\n" else printf "yes\n" @@ -1512,8 +1511,7 @@ int main(int argc, char **argv) return daemon(0, 0); } ! -rm -f conftest$exe -if ! $make conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then +if ! conftest ; then printf "no\n" else printf "yes\n" @@ -1532,8 +1530,7 @@ int main(void) return 0; } ! -rm -f conftest$exe -if ! $make conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then +if ! conftest ; then printf "no\n" else printf "yes\n" @@ -1555,8 +1552,7 @@ int main(void) return 0; } ! -rm -f conftest$exe -if ! $make conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then +if ! conftest ; then printf "no\n" else printf "yes\n" @@ -1582,8 +1578,7 @@ int main(void) return 0; } ! -rm -f conftest$exe -if ! $make conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then +if ! conftest ; then printf "no\n" else printf "yes\n" @@ -1604,8 +1599,7 @@ int main(void) return 0; } ! -rm -f conftest$exe -if ! $make conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then +if ! conftest ; then printf "no\n" else printf "yes\n" @@ -1626,8 +1620,7 @@ int main(void) return 0; } ! -rm -f conftest$exe -if ! $make conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then +if ! conftest ; then printf "no\n" else printf "yes\n" @@ -1650,8 +1643,7 @@ int main(void) return 0; } ! -rm -f conftest$exe -if ! $make conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then +if ! conftest ; then printf "no\n" else printf "yes\n" @@ -1673,8 +1665,7 @@ int main(void) return 0; } ! -rm -f conftest$exe -if ! $make conftest > conftest.err 2>&1 || ! [ -x conftest ] ; then +if ! conftest ; then printf "no\n" else printf "yes\n" -- cgit v1.2.3