[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/4] test defs: substitute compilers and flags found at configure
From: |
Stefano Lattarini |
Subject: |
[PATCH 3/4] test defs: substitute compilers and flags found at configure time |
Date: |
Fri, 21 Oct 2011 22:02:10 +0200 |
* tests/Makefile.am (do_subst): Also substitute CC, CXX, F77, FC,
CPPFLAGS, CFLAGS, CXXFLAGS, FCFLAGS and FFLAGS.
* tests/defs-static.in: Define those variables, allowing for
overrides from the environment.
* tests/defs (for tool in $required): Export (subsets of) those
variables when the stuff in `$required' calls for it.
Add related explanatory comments.
---
ChangeLog | 11 +++++++++++
tests/Makefile.am | 9 +++++++++
tests/Makefile.in | 9 +++++++++
tests/defs | 28 ++++++++++++++++++++--------
tests/defs-static.in | 12 ++++++++++++
5 files changed, 61 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index e123561..e741c88 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2011-10-21 Stefano Lattarini <address@hidden>
+ test defs: substitute compilers and flags found at configure time
+ * tests/Makefile.am (do_subst): Also substitute CC, CXX, F77, FC,
+ CPPFLAGS, CFLAGS, CXXFLAGS, FCFLAGS and FFLAGS.
+ * tests/defs-static.in: Define those variables, allowing for
+ overrides from the environment.
+ * tests/defs (for tool in $required): Export (subsets of) those
+ variables when the stuff in `$required' calls for it.
+ Add related explanatory comments.
+
+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'
diff --git a/tests/Makefile.am b/tests/Makefile.am
index fc98bd6..c95e41c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -134,6 +134,15 @@ 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|$(CPPFLAGS)|g' \
+ -e 's|@address@hidden|$(CC)|g' \
+ -e 's|@address@hidden|$(CFLAGS)|g' \
+ -e 's|@address@hidden|$(CXX)|g' \
+ -e 's|@address@hidden|$(CXXFLAGS)|g' \
+ -e 's|@address@hidden|$(F77)|g' \
+ -e 's|@address@hidden|$(FFLAGS)|g' \
+ -e 's|@address@hidden|$(FC)|g' \
+ -e 's|@address@hidden|$(FCFLAGS)|g' \
-e 's|@address@hidden|$(GNU_CFLAGS)|g' \
-e 's|@address@hidden|$(GNU_CXXFLAGS)|g' \
-e 's|@address@hidden|$(GNU_F77FLAGS)|g' \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 3c0245e..73aa313 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -1676,6 +1676,15 @@ 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|$(CPPFLAGS)|g' \
+ -e 's|@address@hidden|$(CC)|g' \
+ -e 's|@address@hidden|$(CFLAGS)|g' \
+ -e 's|@address@hidden|$(CXX)|g' \
+ -e 's|@address@hidden|$(CXXFLAGS)|g' \
+ -e 's|@address@hidden|$(F77)|g' \
+ -e 's|@address@hidden|$(FFLAGS)|g' \
+ -e 's|@address@hidden|$(FC)|g' \
+ -e 's|@address@hidden|$(FCFLAGS)|g' \
-e 's|@address@hidden|$(GNU_CFLAGS)|g' \
-e 's|@address@hidden|$(GNU_CXXFLAGS)|g' \
-e 's|@address@hidden|$(GNU_F77FLAGS)|g' \
diff --git a/tests/defs b/tests/defs
index d49eb50..1005c20 100644
--- a/tests/defs
+++ b/tests/defs
@@ -577,13 +577,21 @@ do
case $tool in
:) ;;
cc)
- test "$CC" = false && skip_all_ "no C compiler available";;
+ test "$CC" = false && skip_all_ "no C compiler available"
+ export CC CFLAGS CPPFLAGS
+ ;;
c++)
- test "$CXX" = false && skip_all_ "no C++ compiler available";;
+ test "$CXX" = false && skip_all_ "no C++ compiler available"
+ export CXX CXXFLAGS CPPFLAGS
+ ;;
fortran)
- test "$FC" = false && skip_all_ "no Fortran compiler available";;
+ test "$FC" = false && skip_all_ "no Fortran compiler available"
+ export FC FCFLAGS
+ ;;
fortran77)
- test "$F77" = false && skip_all_ "no Fortran 77 compiler available";;
+ test "$F77" = false && skip_all_ "no Fortran 77 compiler available"
+ export F77 FFLAGS
+ ;;
xsi-shell)
require_xsi "$SHELL";;
xsi-bin-sh)
@@ -603,7 +611,11 @@ do
;;
cl)
CC=cl
- export CC
+ # Don't export CFLAGS, as that could have been initialized to only
+ # work with the C compiler detected at configure time. If the user
+ # wants CFLAGS to also influence `cl', he can still export CFLAGS
+ # in the environment "by hand" before calling the testsuite.
+ export CC CPPFLAGS
echo "$me: running $CC -?"
$CC -? || skip_all_ "Microsoft C compiler \`$CC' not available"
;;
@@ -640,7 +652,7 @@ do
# prefer gcc to other compilers.
CC=${am__tool_prefix}gcc
CFLAGS=$GNU_CFLAGS
- export CC CFLAGS
+ export CC CFLAGS CPPFLAGS
echo "$me: running $CC --version"
$CC --version || skip_all_ "GNU C compiler not available"
echo "$me: running $CC -v"
@@ -657,7 +669,7 @@ do
g++)
CXX=${am__tool_prefix}g++
CXXFLAGS=$GNU_CXXFLAGS
- export CXX CXXFLAGS
+ export CXX CXXFLAGS CPPFLAGS
echo "$me: running $CXX --version"
$CXX --version || skip_all_ "GNU C++ compiler not available"
echo "$me: running $CXX -v"
@@ -691,7 +703,7 @@ do
;;
icc)
CC=icc
- export CC
+ export CC CPPFLAGS # But not CFLAGS (see comments for `cl' above).
# There is no way to ask *only* the compiler's version.
# This tool always wants to do something (by default
# it will try link *nothing* and complain it cannot find
diff --git a/tests/defs-static.in b/tests/defs-static.in
index f616d46..1fa29ee 100644
--- a/tests/defs-static.in
+++ b/tests/defs-static.in
@@ -183,6 +183,18 @@ AUTOMAKE="$am_original_AUTOMAKE --foreign -Werror -Wall"
EGREP=${AM_TESTSUITE_EGREP-'@EGREP@'}
FGREP=${AM_TESTSUITE_FGREP-'@FGREP@'}
+# Compilers and their flags. These can point to non-GNU compilers (and
+# on non-Linux and non-BSD systems, they probably will).
+CC=${AM_TESTSUITE_CC-${CC-'@CC@'}}
+CXX=${AM_TESTSUITE_CXX-${CXX-'@CXX@'}}
+F77=${AM_TESTSUITE_F77-${F77-'@F77@'}}
+FC=${AM_TESTSUITE_FC-${FC-'@FC@'}}
+CFLAGS=${AM_TESTSUITE_CFLAGS-${CFLAGS-'@CFLAGS@'}}
+CXXFLAGS=${AM_TESTSUITE_CXXFLAGS-${CXXFLAGS-'@CXXFLAGS@'}}
+FCFLAGS=${AM_TESTSUITE_FCFLAGS-${FCFLAGS-'@FCFLAGS@'}}
+FFLAGS=${AM_TESTSUITE_FFLAGS-${FFLAGS-'@FFLAGS@'}}
+CPPFLAGS=${AM_TESTSUITE_CPPFLAGS-${CPPFLAGS-'@CPPFLAGS@'}}
+
# 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@'}}
--
1.7.2.3