diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2016-05-12 00:16:35 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2016-05-12 00:16:35 +0000 |
commit | edcaa5c85045f0d4d50532c808fbe604ad7071a1 (patch) | |
tree | 351821c747913352fd717a5616c4f71067afef08 /configure.ac | |
parent | 6712cd630edcbb176d3f6d8f7ace530f8f1d6d27 (diff) | |
download | mpfr-edcaa5c85045f0d4d50532c808fbe604ad7071a1.tar.gz |
[configure.ac] Better GMP CC/CFLAGS detection (based on a patch by
Patrick PĂ©lissier).
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@10290 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/configure.ac b/configure.ac index 8156a9319..eca01cb7b 100644 --- a/configure.ac +++ b/configure.ac @@ -227,26 +227,23 @@ if test -z "$GMP_CC$GMP_CFLAGS" ; then # used by GCC, such as C_INCLUDE_PATH. If the user has set up such # environment variables, he probably wants to use them. So, let us # prefer cpp and gcc to /lib/cpp. - for cpp in cpp gcc /lib/cpp cc c99 + for cpp in "cpp -P" "cpp" "gcc -P -E" "gcc -E" "/lib/cpp -P" "/lib/cpp" "cc -P -E" "cc -E" "c99 -P -E" "c99 -E" do - case $cpp in - *cpp*) cpp="$cpp -P" ;; - *) cpp="$cpp -E" ;; - esac + # Get CC echo "#include \"gmp.h\"" > conftest.c - if $cpp $CPPFLAGS conftest.c > /dev/null 2> /dev/null ; then - # Get CC - echo "#include \"gmp.h\"" > conftest.c - echo "MPFR_OPTION __GMP_CC" >> conftest.c - GMP_CC=`$cpp $CPPFLAGS conftest.c 2> /dev/null | $EGREP MPFR_OPTION | $SED -e 's/MPFR_OPTION //g;s/ *" *//g'` - # Get CFLAGS - echo "#include \"gmp.h\"" > conftest.c - echo "MPFR_OPTION __GMP_CFLAGS" >> conftest.c - unset rmpedantic - [test "$enable_logging" = yes && rmpedantic='s/[ "]-pedantic[ "]/ /g;'] - GMP_CFLAGS=`$cpp $CPPFLAGS conftest.c 2> /dev/null | $EGREP MPFR_OPTION | $SED -e "$rmpedantic"'s/MPFR_OPTION //g;s/ *" *//g'` - break - fi + echo "MPFR_OPTION __GMP_CC" >> conftest.c + $cpp $CPPFLAGS conftest.c 2> /dev/null > conftest.txt + test $? -ne 0 && continue + GMP_CC=`$EGREP MPFR_OPTION conftest.txt | $SED -e 's/MPFR_OPTION //g;s/ *" *//g'` + # Get CFLAGS + echo "#include \"gmp.h\"" > conftest.c + echo "MPFR_OPTION __GMP_CFLAGS" >> conftest.c + unset rmpedantic + [test "$enable_logging" = yes && rmpedantic='s/[ "]-pedantic[ "]/ /g;'] + $cpp $CPPFLAGS conftest.c 2> /dev/null > conftest.txt + test $? -ne 0 && continue + GMP_CFLAGS=`$EGREP MPFR_OPTION conftest.txt | $SED -e "$rmpedantic"'s/MPFR_OPTION //g;s/ *" *//g'` + break done rm -f conftest* if test "x$GMP_CC" = "x__GMP_CC" || test "x$GMP_CFLAGS" = "x__GMP_CFLAGS" ; then |