[Lemon-commits] Akos Ladanyi: Revert to the canonical way of cus...

Lemon HG hg at lemon.cs.elte.hu
Wed Nov 5 16:02:09 CET 2008


details:   http://lemon.cs.elte.hu/hg/lemon/rev/a637fb9d457b
changeset: 375:a637fb9d457b
user:      Akos Ladanyi <ladanyi [at] tmit.bme.hu>
date:      Wed Nov 05 14:44:37 2008 +0000
description:
	Revert to the canonical way of customizing CXXFLAGS

	A default list of compiler flags is set via AM_CXXFLAGS Automake
	variable. However this gets overridden by per-target CXXFLAGS
	variables (e.g. foo_CXXFLAGS in case the foo target). Because of
	this you should append $(AM_CXXFLAGS) to the end of the per-target
	CXXFLAGS variables (e.g. foo_CXXFLAGS = ... $(AM_CXXFLAGS)).

	After this default list of flags the contents of the CXXFLAGS user
	variable is passed to the compiler. This variable has a default
	value determined by configure (in case of g++ it is '-g -O2'). You
	can override this by specifying CXXFLAGS when invoking make (e.g.
	make CXXFLAGS='-O3').

diffstat:

3 files changed, 7 insertions(+), 7 deletions(-)
Makefile.am       |    3 ++-
configure.ac      |    9 ++++-----
lemon/Makefile.am |    2 +-

diffs (56 lines):

diff -r 51597950d0fe -r a637fb9d457b Makefile.am
--- a/Makefile.am	Wed Nov 05 08:11:44 2008 +0000
+++ b/Makefile.am	Wed Nov 05 14:44:37 2008 +0000
@@ -1,4 +1,6 @@
 ACLOCAL_AMFLAGS = -I m4
+
+AM_CXXFLAGS = $(WARNINGCXXFLAGS)
 
 AM_CPPFLAGS = -I$(top_srcdir) -I$(top_builddir)
 LDADD = $(top_builddir)/lemon/libemon.la
diff -r 51597950d0fe -r a637fb9d457b configure.ac
--- a/configure.ac	Wed Nov 05 08:11:44 2008 +0000
+++ b/configure.ac	Wed Nov 05 14:44:37 2008 +0000
@@ -18,8 +18,6 @@
 AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects nostdinc])
 AC_CONFIG_SRCDIR([lemon/list_graph.h])
 AC_CONFIG_HEADERS([config.h lemon/config.h])
-
-lx_cmdline_cxxflags_set=${CXXFLAGS+set}
 
 dnl Do compilation tests using the C++ compiler.
 AC_LANG([C++])
@@ -46,9 +44,10 @@
 fi
 
 dnl Set custom compiler flags when using g++.
-if test x"$lx_cmdline_cxxflags_set" != x"set" -a "$GXX" = yes -a "$ICC" = no; then
-  CXXFLAGS="$CXXFLAGS -Wall -W -Wall -W -Wunused -Wformat=2 -Wctor-dtor-privacy -Wnon-virtual-dtor -Wno-char-subscripts -Wwrite-strings -Wno-char-subscripts -Wreturn-type -Wcast-qual -Wcast-align -Wsign-promo -Woverloaded-virtual -Woverloaded-virtual -ansi -fno-strict-aliasing -Wold-style-cast -Wno-unknown-pragmas"
+if test "$GXX" = yes -a "$ICC" = no; then
+  WARNINGCXXFLAGS="-Wall -W -Wall -W -Wunused -Wformat=2 -Wctor-dtor-privacy -Wnon-virtual-dtor -Wno-char-subscripts -Wwrite-strings -Wno-char-subscripts -Wreturn-type -Wcast-qual -Wcast-align -Wsign-promo -Woverloaded-virtual -ansi -fno-strict-aliasing -Wold-style-cast -Wno-unknown-pragmas"
 fi
+AC_SUBST([WARNINGCXXFLAGS])
 
 dnl Checks for libraries.
 #LX_CHECK_GLPK
@@ -113,7 +112,7 @@
 echo Package version............... : $PACKAGE-$VERSION
 echo
 echo C++ compiler.................. : $CXX
-echo C++ compiles flags............ : $CXXFLAGS
+echo C++ compiles flags............ : $WARNINGCXXFLAGS $CXXFLAGS
 echo
 #echo GLPK support.................. : $lx_glpk_found
 #echo CPLEX support................. : $lx_cplex_found
diff -r 51597950d0fe -r a637fb9d457b lemon/Makefile.am
--- a/lemon/Makefile.am	Wed Nov 05 08:11:44 2008 +0000
+++ b/lemon/Makefile.am	Wed Nov 05 14:44:37 2008 +0000
@@ -12,7 +12,7 @@
         lemon/color.cc \
         lemon/random.cc
 
-#lemon_libemon_la_CXXFLAGS = $(GLPK_CFLAGS) $(CPLEX_CFLAGS) $(SOPLEX_CXXFLAGS)
+#lemon_libemon_la_CXXFLAGS = $(GLPK_CFLAGS) $(CPLEX_CFLAGS) $(SOPLEX_CXXFLAGS) $(AM_CXXFLAGS)
 #lemon_libemon_la_LDFLAGS = $(GLPK_LIBS) $(CPLEX_LIBS) $(SOPLEX_LIBS)
 
 lemon_HEADERS += \



More information about the Lemon-commits mailing list