[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/4] test defs: setup `*FLAGS' variables for GNU compilers
From: |
Stefano Lattarini |
Subject: |
[PATCH 2/4] test defs: setup `*FLAGS' variables for GNU compilers |
Date: |
Fri, 21 Oct 2011 22:02:09 +0200 |
* configure.ac: Setup some `*FLAGS' variables for use by the
GNU compilers in our testsuite. For example, use `GNU_CFLAGS'
instead of `CFLAGS', and so on for similar variables. This
is especially useful in case the compilers found or defined
at configure time are not the GNU ones.
* tests/defs-static.in: Initialize those same variables with
the values set at configure time, but allowing overrides
from the environment.
* tests/Makefile.am (do_subst): Process configure-style
substitutions of those variables (e.g., address@hidden@').
* tests/defs: When a GNU compiler is required, override the
corresponding generic `*FLAGS' variable with the GNU-specific
variant (e.g., redefine `$CFLAGS' to take the value of
`$GNU_CFLAGS').
---
ChangeLog | 18 ++++++++++++
Makefile.in | 4 +++
configure | 59 +++++++++++++++++++++++++++++++++++++++-
configure.ac | 28 +++++++++++++++++++
doc/Makefile.in | 4 +++
lib/Automake/Makefile.in | 4 +++
lib/Automake/tests/Makefile.in | 4 +++
lib/Makefile.in | 4 +++
lib/am/Makefile.in | 4 +++
m4/Makefile.in | 4 +++
tests/Makefile.am | 4 +++
tests/Makefile.in | 8 +++++
tests/defs | 16 +++++++----
tests/defs-static.in | 6 ++++
14 files changed, 160 insertions(+), 7 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b057f92..e123561 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,23 @@
2011-10-21 Stefano Lattarini <address@hidden>
+ test defs: setup `*FLAGS' variables for GNU compilers
+ * configure.ac: Setup some `*FLAGS' variables for use by the
+ GNU compilers in our testsuite. For example, use `GNU_CFLAGS'
+ instead of `CFLAGS', and so on for similar variables. This
+ is especially useful in case the compilers found or defined
+ at configure time are not the GNU ones.
+ * tests/defs-static.in: Initialize those same variables with
+ the values set at configure time, but allowing overrides
+ from the environment.
+ * tests/Makefile.am (do_subst): Process configure-style
+ substitutions of those variables (e.g., address@hidden@').
+ * tests/defs: When a GNU compiler is required, override the
+ corresponding generic `*FLAGS' variable with the GNU-specific
+ variant (e.g., redefine `$CFLAGS' to take the value of
+ `$GNU_CFLAGS').
+
+2011-10-21 Stefano Lattarini <address@hidden>
+
configure: search generic compilers for use in the tests
* configure.ac: Look for "generic" C, C++ and Fortran compilers,
with the aim of starting to use them in the testsuite (this will
diff --git a/Makefile.in b/Makefile.in
index 20b6d56..f74ebab 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -195,6 +195,10 @@ FC = @FC@
FCFLAGS = @FCFLAGS@
FFLAGS = @FFLAGS@
FGREP = @FGREP@
+GNU_CFLAGS = @GNU_CFLAGS@
+GNU_CXXFLAGS = @GNU_CXXFLAGS@
+GNU_FCFLAGS = @GNU_FCFLAGS@
+GNU_FFLAGS = @GNU_FFLAGS@
GREP = @GREP@
HELP2MAN = @HELP2MAN@
INSTALL = @INSTALL@
diff --git a/configure b/configure
index 9889e40..33b6256 100755
--- a/configure
+++ b/configure
@@ -570,6 +570,10 @@ ac_subst_vars='am__EXEEXT_FALSE
am__EXEEXT_TRUE
LTLIBOBJS
LIBOBJS
+GNU_FFLAGS
+GNU_FCFLAGS
+GNU_CXXFLAGS
+GNU_CFLAGS
ac_ct_F77
FFLAGS
F77
@@ -697,7 +701,11 @@ CCC
FC
FCFLAGS
F77
-FFLAGS'
+FFLAGS
+GNU_CFLAGS
+GNU_CXXFLAGS
+GNU_FCFLAGS
+GNU_FFLAGS'
# Initialize some variables set by options.
@@ -1335,6 +1343,11 @@ Some influential environment variables:
FCFLAGS Fortran compiler flags
F77 Fortran 77 compiler command
FFLAGS Fortran 77 compiler flags
+ GNU_CFLAGS GNU C compiler flags
+ GNU_CXXFLAGS
+ GNU C++ compiler flags
+ GNU_FCFLAGS GNU Fortran compiler flags
+ GNU_FFLAGS GNU Fortran 77 compiler flags
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
@@ -3046,6 +3059,7 @@ sh_errexit_works=$am_cv_sh_errexit_works
# Prefer generic compilers to GNU ones when possible. This will ensure
# more testsuite coverage "in the wild".
+
# FIXME: maybe we should a more comprehensive list too look for more
# FIXME: "exotic" compilers? And what about looking also for the MSVC
# FIXME: compiler on Cygwin/MinGW systems?
@@ -3680,6 +3694,11 @@ fi
+if test x"$GCC" = x"yes"; then :
+ am_CC_is_GNU=yes
+else
+ am_CC_is_GNU=no
+fi
# The list of C++ compilers here has been copied, pasted and edited
# from `lib/autoconf/c.m4:AC_PROG_CXX' in the Autoconf distribution.
@@ -4223,6 +4242,11 @@ fi
+if test x"$GXX" = x"yes"; then :
+ am_CXX_is_GNU=yes
+else
+ am_CXX_is_GNU=no
+fi
# The lists of Fortran compilers here has been copied, pasted and edited
# from file `lib/autoconf/fortran.m4' in the Autoconf distribution.
@@ -4231,6 +4255,7 @@ fi
+
am__failed=no
while :; do
ac_ext=${ac_fc_srcext-f}
@@ -4697,6 +4722,13 @@ fi
+# FIXME this won't work as expected until we can assume autoconf 2.69 :-(
+if test x"$GFORTRAN" = x"yes"; then :
+ am_FC_is_GNU=yes
+else
+ am_FC_is_GNU=no
+fi
+
@@ -5171,6 +5203,31 @@ fi
+if test x"$G77" = x"yes"; then :
+ am_F77_is_GNU=yes
+else
+ am_F77_is_GNU=no
+fi
+
+# Some tests will need the GNU compilers. Searching for them here would
+# be overkill, since our testsuite already handles their search and setup
+# pretty well. However, in case the compilers detected above at configure
+# time are not the GNU ones, we cannot use the values of CFLAGS, CXXFLAGS,
+# FCFLAGS and FFLAGS detected for them with the GNU compilers too, since
+# it's likely they won't be compatible. So we allow the user to define
+# variants of this variables for the GNU compilers separately.
+
+test $am_CC_is_GNU = yes && GNU_CFLAGS=${GNU_CFLAGS-$CFLAGS}
+
+
+test $am_CXX_is_GNU = yes && GNU_CXXFLAGS=${GNU_CXXFLAGS-$CXXFLAGS}
+
+
+test $am_F77_is_GNU = yes && GNU_FCFLAGS=${GNU_FCFLAGS-$FCFLAGS}
+
+
+test $am_FC_is_GNU = yes && GNU_FFLAGS=${GNU_FFLAGS-$FFLAGS}
+
# If we have been able to find at least a working compiler above, we
# know what the object and executable extensions for this platform are.
diff --git a/configure.ac b/configure.ac
index 2b0bf2d..ed34c1c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -249,10 +249,12 @@ AC_DEFUN([_AM_COMPILER_CAN_FAIL], [
# Prefer generic compilers to GNU ones when possible. This will ensure
# more testsuite coverage "in the wild".
+
# FIXME: maybe we should a more comprehensive list too look for more
# FIXME: "exotic" compilers? And what about looking also for the MSVC
# FIXME: compiler on Cygwin/MinGW systems?
_AM_COMPILER_CAN_FAIL([AC_PROG_CC([cc gcc])], [CC=false])
+AS_IF([test x"$GCC" = x"yes"], [am_CC_is_GNU=yes], [am_CC_is_GNU=no])
# The list of C++ compilers here has been copied, pasted and edited
# from `lib/autoconf/c.m4:AC_PROG_CXX' in the Autoconf distribution.
@@ -261,18 +263,44 @@ _AM_COMPILER_CAN_FAIL([AC_PROG_CC([cc gcc])], [CC=false])
_AM_COMPILER_CAN_FAIL([AC_PROG_CXX(dnl
[aCC CC cl.exe FCC KCC RCC xlC_r xlC c++ cxx cc++ gpp g++])],
[CXX=false])
+AS_IF([test x"$GXX" = x"yes"], [am_CXX_is_GNU=yes], [am_CXX_is_GNU=no])
# The lists of Fortran compilers here has been copied, pasted and edited
# from file `lib/autoconf/fortran.m4' in the Autoconf distribution.
# Keep it in sync, or better again, find out a way to avoid this code
# duplication.
+
_AM_COMPILER_CAN_FAIL([AC_PROG_FC(dnl
[xlf95 f95 fort ifort ifc efc pgfortran pgf95 lf95 ftn nagfor] dnl
[xlf90 f90 pgf90 pghpf epcf90 g95 gfortran])],
[FC=false])
+# FIXME this won't work as expected until we can assume autoconf 2.69 :-(
+AS_IF([test x"$GFORTRAN" = x"yes"], [am_FC_is_GNU=yes], [am_FC_is_GNU=no])
+
_AM_COMPILER_CAN_FAIL([AC_PROG_F77(dnl
[xlf f77 frt pgf77 cf77 fort77 fl32 af77 g77 gfortran])],
[F77=false])
+AS_IF([test x"$G77" = x"yes"], [am_F77_is_GNU=yes], [am_F77_is_GNU=no])
+
+# Some tests will need the GNU compilers. Searching for them here would
+# be overkill, since our testsuite already handles their search and setup
+# pretty well. However, in case the compilers detected above at configure
+# time are not the GNU ones, we cannot use the values of CFLAGS, CXXFLAGS,
+# FCFLAGS and FFLAGS detected for them with the GNU compilers too, since
+# it's likely they won't be compatible. So we allow the user to define
+# variants of this variables for the GNU compilers separately.
+
+test $am_CC_is_GNU = yes && GNU_CFLAGS=${GNU_CFLAGS-$CFLAGS}
+AC_ARG_VAR([GNU_CFLAGS], [GNU C compiler flags])
+
+test $am_CXX_is_GNU = yes && GNU_CXXFLAGS=${GNU_CXXFLAGS-$CXXFLAGS}
+AC_ARG_VAR([GNU_CXXFLAGS], [GNU C++ compiler flags])
+
+test $am_F77_is_GNU = yes && GNU_FCFLAGS=${GNU_FCFLAGS-$FCFLAGS}
+AC_ARG_VAR([GNU_FCFLAGS], [GNU Fortran compiler flags])
+
+test $am_FC_is_GNU = yes && GNU_FFLAGS=${GNU_FFLAGS-$FFLAGS}
+AC_ARG_VAR([GNU_FFLAGS], [GNU Fortran 77 compiler flags])
# If we have been able to find at least a working compiler above, we
# know what the object and executable extensions for this platform are.
diff --git a/doc/Makefile.in b/doc/Makefile.in
index ac665c9..2a3361b 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -175,6 +175,10 @@ FC = @FC@
FCFLAGS = @FCFLAGS@
FFLAGS = @FFLAGS@
FGREP = @FGREP@
+GNU_CFLAGS = @GNU_CFLAGS@
+GNU_CXXFLAGS = @GNU_CXXFLAGS@
+GNU_FCFLAGS = @GNU_FCFLAGS@
+GNU_FFLAGS = @GNU_FFLAGS@
GREP = @GREP@
HELP2MAN = @HELP2MAN@
INSTALL = @INSTALL@
diff --git a/lib/Automake/Makefile.in b/lib/Automake/Makefile.in
index 21dcecd..afffb9a 100644
--- a/lib/Automake/Makefile.in
+++ b/lib/Automake/Makefile.in
@@ -173,6 +173,10 @@ FC = @FC@
FCFLAGS = @FCFLAGS@
FFLAGS = @FFLAGS@
FGREP = @FGREP@
+GNU_CFLAGS = @GNU_CFLAGS@
+GNU_CXXFLAGS = @GNU_CXXFLAGS@
+GNU_FCFLAGS = @GNU_FCFLAGS@
+GNU_FFLAGS = @GNU_FFLAGS@
GREP = @GREP@
HELP2MAN = @HELP2MAN@
INSTALL = @INSTALL@
diff --git a/lib/Automake/tests/Makefile.in b/lib/Automake/tests/Makefile.in
index 256c20b..a44085f 100644
--- a/lib/Automake/tests/Makefile.in
+++ b/lib/Automake/tests/Makefile.in
@@ -214,6 +214,10 @@ FC = @FC@
FCFLAGS = @FCFLAGS@
FFLAGS = @FFLAGS@
FGREP = @FGREP@
+GNU_CFLAGS = @GNU_CFLAGS@
+GNU_CXXFLAGS = @GNU_CXXFLAGS@
+GNU_FCFLAGS = @GNU_FCFLAGS@
+GNU_FFLAGS = @GNU_FFLAGS@
GREP = @GREP@
HELP2MAN = @HELP2MAN@
INSTALL = @INSTALL@
diff --git a/lib/Makefile.in b/lib/Makefile.in
index 3fd311e..be8a834 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -176,6 +176,10 @@ FC = @FC@
FCFLAGS = @FCFLAGS@
FFLAGS = @FFLAGS@
FGREP = @FGREP@
+GNU_CFLAGS = @GNU_CFLAGS@
+GNU_CXXFLAGS = @GNU_CXXFLAGS@
+GNU_FCFLAGS = @GNU_FCFLAGS@
+GNU_FFLAGS = @GNU_FFLAGS@
GREP = @GREP@
HELP2MAN = @HELP2MAN@
INSTALL = @INSTALL@
diff --git a/lib/am/Makefile.in b/lib/am/Makefile.in
index 6a63b2b..3e789a7 100644
--- a/lib/am/Makefile.in
+++ b/lib/am/Makefile.in
@@ -133,6 +133,10 @@ FC = @FC@
FCFLAGS = @FCFLAGS@
FFLAGS = @FFLAGS@
FGREP = @FGREP@
+GNU_CFLAGS = @GNU_CFLAGS@
+GNU_CXXFLAGS = @GNU_CXXFLAGS@
+GNU_FCFLAGS = @GNU_FCFLAGS@
+GNU_FFLAGS = @GNU_FFLAGS@
GREP = @GREP@
HELP2MAN = @HELP2MAN@
INSTALL = @INSTALL@
diff --git a/m4/Makefile.in b/m4/Makefile.in
index 8592def..a41669f 100644
--- a/m4/Makefile.in
+++ b/m4/Makefile.in
@@ -135,6 +135,10 @@ FC = @FC@
FCFLAGS = @FCFLAGS@
FFLAGS = @FFLAGS@
FGREP = @FGREP@
+GNU_CFLAGS = @GNU_CFLAGS@
+GNU_CXXFLAGS = @GNU_CXXFLAGS@
+GNU_FCFLAGS = @GNU_FCFLAGS@
+GNU_FFLAGS = @GNU_FFLAGS@
GREP = @GREP@
HELP2MAN = @HELP2MAN@
INSTALL = @INSTALL@
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 1e4b6d5..fc98bd6 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -134,6 +134,10 @@ do_subst = sed \
-e 's|@address@hidden|$(PERL)|g' \
-e 's|@address@hidden|$(EGREP)|g' \
-e 's|@address@hidden|$(FGREP)|g' \
+ -e 's|@address@hidden|$(GNU_CFLAGS)|g' \
+ -e 's|@address@hidden|$(GNU_CXXFLAGS)|g' \
+ -e 's|@address@hidden|$(GNU_F77FLAGS)|g' \
+ -e 's|@address@hidden|$(GNU_FCFLAGS)|g' \
-e 's|@address@hidden|$(TEX)|g' \
-e 's|@address@hidden|$(MODIFICATION_DELAY)|g' \
-e 's|@address@hidden|$(am_AUTOCONF)|g' \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 387f7b0..3c0245e 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -220,6 +220,10 @@ FC = @FC@
FCFLAGS = @FCFLAGS@
FFLAGS = @FFLAGS@
FGREP = @FGREP@
+GNU_CFLAGS = @GNU_CFLAGS@
+GNU_CXXFLAGS = @GNU_CXXFLAGS@
+GNU_FCFLAGS = @GNU_FCFLAGS@
+GNU_FFLAGS = @GNU_FFLAGS@
GREP = @GREP@
HELP2MAN = @HELP2MAN@
INSTALL = @INSTALL@
@@ -1672,6 +1676,10 @@ do_subst = sed \
-e 's|@address@hidden|$(PERL)|g' \
-e 's|@address@hidden|$(EGREP)|g' \
-e 's|@address@hidden|$(FGREP)|g' \
+ -e 's|@address@hidden|$(GNU_CFLAGS)|g' \
+ -e 's|@address@hidden|$(GNU_CXXFLAGS)|g' \
+ -e 's|@address@hidden|$(GNU_F77FLAGS)|g' \
+ -e 's|@address@hidden|$(GNU_FCFLAGS)|g' \
-e 's|@address@hidden|$(TEX)|g' \
-e 's|@address@hidden|$(MODIFICATION_DELAY)|g' \
-e 's|@address@hidden|$(am_AUTOCONF)|g' \
diff --git a/tests/defs b/tests/defs
index e5f66a5..d49eb50 100644
--- a/tests/defs
+++ b/tests/defs
@@ -639,7 +639,8 @@ do
# has defined CC in his environment, otherwise ./configure will
# prefer gcc to other compilers.
CC=${am__tool_prefix}gcc
- export CC
+ CFLAGS=$GNU_CFLAGS
+ export CC CFLAGS
echo "$me: running $CC --version"
$CC --version || skip_all_ "GNU C compiler not available"
echo "$me: running $CC -v"
@@ -655,7 +656,8 @@ do
;;
g++)
CXX=${am__tool_prefix}g++
- export CXX
+ CXXFLAGS=$GNU_CXXFLAGS
+ export CXX CXXFLAGS
echo "$me: running $CXX --version"
$CXX --version || skip_all_ "GNU C++ compiler not available"
echo "$me: running $CXX -v"
@@ -663,26 +665,28 @@ do
;;
gfortran)
FC=${am__tool_prefix}gfortran
- export FC
+ FCFLAGS=$GNU_FCFLAGS
+ export FC FCFLAGS
echo "$me: running $FC --version"
$FC --version || skip_all_ "GNU Fortran compiler not available"
echo "$me: running $FC -v"
$FC -v || skip_all_ "botched installation for GNU Fortran compiler"
case " $required " in
*\ g77\ *) ;;
- *) F77=$FC; export F77;;
+ *) F77=$FC FFLAGS=$FCFLAGS; export F77 FFLAGS;;
esac
;;
g77)
F77=${am__tool_prefix}g77
- export F77
+ FFLAGS=$GNU_F77FLAGS
+ export F77 FFLAGS
echo "$me: running $F77 --version"
$F77 --version || skip_all_ "GNU Fortran 77 compiler not available"
echo "$me: running $F77 -v"
$F77 -v || skip_all_ "botched installation for GNU Fortran 77 compiler"
case " $required " in
*\ gfortran\ *) ;;
- *) FC=$F77; export FC;;
+ *) FC=$F77 FCFLAGS=$FFLAGS; export FC FCFLAGS;;
esac
;;
icc)
diff --git a/tests/defs-static.in b/tests/defs-static.in
index df2fd43..f616d46 100644
--- a/tests/defs-static.in
+++ b/tests/defs-static.in
@@ -183,6 +183,12 @@ AUTOMAKE="$am_original_AUTOMAKE --foreign -Werror -Wall"
EGREP=${AM_TESTSUITE_EGREP-'@EGREP@'}
FGREP=${AM_TESTSUITE_FGREP-'@FGREP@'}
+# Flags for the GNU compilers.
+GNU_F77FLAGS=${AM_TESTSUITE_GNU_F77FLAGS-${GNU_F77FLAGS-'@GNU_F77FLAGS@'}}
+GNU_FCFLAGS=${AM_TESTSUITE_GNU_FCFLAGS-${GNU_FCFLAGS-'@GNU_FCFLAGS@'}}
+GNU_CXXFLAGS=${AM_TESTSUITE_GNU_CXXFLAGS-${GNU_CXXFLAGS-'@GNU_CXXFLAGS@'}}
+GNU_CFLAGS=${AM_TESTSUITE_GNU_CFLAGS-${GNU_CFLAGS-'@GNU_CFLAGS@'}}
+
# No all versions of Tex support `--version', so we use a configure
# check to decide if tex is available. This decision is embodied in
# this variable.
--
1.7.2.3