summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2020-06-13 14:09:25 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2020-06-13 14:09:25 +0000
commita98030b2c30239c453712bbbf54fbb1adc01732c (patch)
treea26b9557b396ab5724c512c43857cb00243a0d73 /configure.ac
parentbb8ca81b0389208e835dbdb4defa40d9405d2e06 (diff)
downloadmpfr-a98030b2c30239c453712bbbf54fbb1adc01732c.tar.gz
[configure.ac] Improvements concerning the default CFLAGS with GCC.
* Add -Wc++-compat option to CFLAGS with GCC ≥ 4.1 not in C++ mode. Changes based on Bruno Haible's patch suggested at https://sympa.inria.fr/sympa/arc/mpfr/2020-06/msg00008.html (with some autoconf related fixes). * Output the $CFLAGS value that is eventually used. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@14020 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac10
1 files changed, 8 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 38d59c65e..bf7c8835e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -458,8 +458,6 @@ dnl (__GMP_CFLAGS macro in gmp.h) above. The consequence is that this
dnl might yield a compilation failure if the -Werror option appears in
dnl __GMP_CFLAGS. But in this case, since -Werror is not used by default,
dnl one may expect that the user would also set CFLAGS for MPFR.
-dnl Note: When the compiler is GCC not in C++ mode, -Wc++-compat may be
-dnl interesting, but it has been introduced in GCC 4.1 only.
if test "$test_CFLAGS" != set && test -n "$GCC"; then
CFLAGS="-Wpointer-arith $CFLAGS"
AC_MSG_CHECKING(whether the selected language is C++)
@@ -470,12 +468,20 @@ error
#endif
]], [[]])],[
AC_MSG_RESULT(no)
+ dnl The option -Wc++-compat is available in GCC 4.1.0 and newer.
+ [
+ case `$CC --version | $SED -e 's/^[^ ]* //' -e 's/([^)]*) //' -e 1q` in
+ 2.*|3.*|4.0*) ;;
+ *) CFLAGS="-Wc++-compat $CFLAGS" ;;
+ esac
CFLAGS="-Wmissing-prototypes $CFLAGS"
+ ]
],[
AC_MSG_RESULT(yes)
CFLAGS="-Wmissing-declarations -Wno-sign-compare $CFLAGS"
])
CFLAGS="-Wall $CFLAGS"
+ AC_MSG_NOTICE([using CFLAGS="$CFLAGS"])
fi
AM_PROG_CC_C_O