From 25bb54e3bc501b31e4e647aa438c4494d64d819d Mon Sep 17 00:00:00 2001 From: Moinak Ghosh Date: Mon, 17 Dec 2012 18:37:27 +0530 Subject: [PATCH] Improve 64-bit compiler and platform checks. Ensure core dumps are enabled during testing. --- Makefile.in | 2 +- config | 23 +++++++++++++++++------ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Makefile.in b/Makefile.in index e7a7a46..0bd9fe1 100644 --- a/Makefile.in +++ b/Makefile.in @@ -266,7 +266,7 @@ $(PROG): $(OBJS) $(LINK) -o $@ $(OBJS) $(LDLIBS) test: all - (cd test; sh ./run_test.sh) 2>&1 | tee test.log + (cd test; ulimit -c unlimited; sh ./run_test.sh) 2>&1 | tee test.log clean: $(RM) $(PROG) $(OBJS) $(BAKFILES) diff --git a/config b/config index 50a16c4..151801a 100755 --- a/config +++ b/config @@ -82,16 +82,27 @@ fi gcc -v 2>&1 | grep lto > /dev/null [ $? -eq 0 ] && lto_flag="-flto" -# Check bitness of system +# Check bitness of system/toolchain bitness=`./tst` -rm -f tst tst.c if [ $bitness -lt 8 ] then - echo "ERROR:" - echo "Only 64-bit platforms are supported." - echo "" - exit 1 + # Hmmm maybe default compilation is 32-bit. Re-try with m64 flag. + gcc -m64 tst.c -o tst + if [ $? -ne 0 ] + then + rm -f tst tst.c + echo "ERROR:" + echo "Only 64-bit platforms are supported." + echo "" + exit 1 + fi + + # If m64 compilation succeeds we assume platform to be 64-bit capable but + # explicit flag is reqd. + # Instead of setting another variable lets cheat by plugging m64 into lto_flag! + lto_flag="${lto_flag} -m64" fi +rm -f tst tst.c while [ "${arg1}" != "" ] do