<URL: http://bugs.freeciv.org/Ticket/Display.html?id=39661 >

 Those couple of lua warnings make it far too difficult to test how
our own code compiles with -Werror.
 Actually fixing those problems seems a bit complicated, and we are
trying to update lua anyway (though not in S2_1).

 Attached patch adds compiler option to ignore those warnings when
compiling lua library (and only then)

 We are using user variables CFLAGS etc wrong way in configure.ac. To
override -Werror from CFLAGS, I would have been forced to extend that
wrong style to lua Makefile. (Appending option to CFLAGS).
 I ended fixing configure.ac just a bit in this respect (more complete
fix should be done for trunk) so that "-Werror" from --enable-debug
goes to AM_CFLAGS.

 I have been compiling this with quite recent gcc versions only. I'm
not sure how long that particular option has been around. Have to to
check that.


 - ML

diff -Nurd -X.diff_ignore freeciv/configure.ac freeciv/configure.ac
--- freeciv/configure.ac	2007-08-26 22:11:42.000000000 +0300
+++ freeciv/configure.ac	2007-09-03 17:41:16.000000000 +0300
@@ -696,8 +696,8 @@
    fi]],[[]])
 
 if test -n "$GCC"; then
-  CFLAGS="$EXTRA_GCC_DEBUG_CFLAGS $CFLAGS"
-  CXXFLAGS="$EXTRA_GCC_DEBUG_CXXFLAGS $CXXFLAGS"
+  FC_CFLAGS="$EXTRA_GCC_DEBUG_CFLAGS $FC_CFLAGS"
+  FC_CXXFLAGS="$EXTRA_GCC_DEBUG_CXXFLAGS $FC_CXXFLAGS"
 fi
 
 dnl Rebuild 'configure' whenever version.in changes, if maintainer mode enabled.
@@ -711,6 +711,20 @@
 AC_DEFINE_UNQUOTED([FC_STORE_CPPFLAGS], ['$CPPFLAGS'], [These are the CPPFLAGS used in compilation])
 AC_DEFINE_UNQUOTED([FC_STORE_CFLAGS], ['$CFLAGS'], [These are the CFLAGS used in compilation])
 AC_DEFINE_UNQUOTED([FC_STORE_CXXFLAGS], ['$CXXFLAGS'], [These are the CXXFLAGS used in compilation])
+AC_DEFINE_UNQUOTED([FC_STORE_FC_CFLAGS], ['$FC_CFLAGS'], [These are the FC_CFLAGS used in compilation])
+AC_DEFINE_UNQUOTED([FC_STORE_FC_CXXFLAGS], ['$FC_CXXFLAGS'], [These are the FC_CXXFLAGS used in compilation])
+
+dnl We set AM_CFLAGS and AM_CXXFLAGS globally for all Makefiles to use.
+dnl Only lua Makefile currently adjust these (AM_CFLAGS).
+dnl We use FC_ -variants upto this point for a reason instead of modifying
+dnl AM_ -variants directly. aclocal thinks that everything starting with AM_
+dnl is meant to be m4 macro call and warns about these if not used carefully.
+dnl I'm undecided if it would be better style to just store FC_ -variants
+dnl here and set AM_ -variants to use them in every Makefile.
+AC_SUBST([AM_CFLAGS], [$FC_CFLAGS])
+AC_SUBST([AM_CXXFLAGS], [$FC_CXXFLAGS])
+
+AM_CONDITIONAL([GCC], [test -n "$GCC"])
 
 AC_CONFIG_FILES([Makefile
           data/Makefile
diff -Nurd -X.diff_ignore freeciv/dependencies/lua/src/Makefile.am freeciv/dependencies/lua/src/Makefile.am
--- freeciv/dependencies/lua/src/Makefile.am	2007-03-05 19:13:42.000000000 +0200
+++ freeciv/dependencies/lua/src/Makefile.am	2007-09-03 17:45:16.000000000 +0300
@@ -1,6 +1,12 @@
 SUBDIRS = lib
 noinst_LIBRARIES = liblua.a
 AM_CPPFLAGS = -I$(srcdir)/../include -I.
+
+if GCC
+# Override possible -Werror from AM_CFLAGS
+liblua_a_CFLAGS = -Wno-pointer-to-int-cast
+endif
+
 EXTRA_DIST= README
 liblua_a_SOURCES = \
 	../include/lauxlib.h \
@@ -45,4 +51,3 @@
 	lvm.h \
 	lzio.c \
 	lzio.h
-
diff -Nurd -X.diff_ignore freeciv/configure.ac freeciv/configure.ac
--- freeciv/configure.ac	2007-08-26 22:07:41.000000000 +0300
+++ freeciv/configure.ac	2007-09-03 17:51:01.000000000 +0300
@@ -713,8 +713,8 @@
    fi]],[[]])
 
 if test -n "$GCC"; then
-  CFLAGS="$EXTRA_GCC_DEBUG_CFLAGS $CFLAGS"
-  CXXFLAGS="$EXTRA_GCC_DEBUG_CXXFLAGS $CXXFLAGS"
+  FC_CFLAGS="$EXTRA_GCC_DEBUG_CFLAGS $FC_CFLAGS"
+  FC_CXXFLAGS="$EXTRA_GCC_DEBUG_CXXFLAGS $FC_CXXFLAGS"
 fi
 
 dnl Rebuild 'configure' whenever version.in changes, if maintainer mode enabled.
@@ -732,6 +732,22 @@
                    [These are the CFLAGS used in compilation])
 AC_DEFINE_UNQUOTED([FC_STORE_CXXFLAGS], ['$CXXFLAGS'],
                    [These are the CXXFLAGS used in compilation])
+AC_DEFINE_UNQUOTED([FC_STORE_FC_CFLAGS], ['$FC_CFLAGS'],
+                   [These are the FC_CFLAGS used in compilation])
+AC_DEFINE_UNQUOTED([FC_STORE_FC_CXXFLAGS], ['$FC_CXXFLAGS'],
+                   [These are the FC_CXXFLAGS used in compilation])
+
+dnl We set AM_CFLAGS and AM_CXXFLAGS globally for all Makefiles to use.
+dnl Only lua Makefile currently adjust these (AM_CFLAGS).
+dnl We use FC_ -variants upto this point for a reason instead of modifying
+dnl AM_ -variants directly. aclocal thinks that everything starting with AM_
+dnl is meant to be m4 macro call and warns about these if not used carefully.
+dnl I'm undecided if it would be better style to just store FC_ -variants
+dnl here and set AM_ -variants to use them in every Makefile.
+AC_SUBST([AM_CFLAGS], [$FC_CFLAGS])
+AC_SUBST([AM_CXXFLAGS], [$FC_CXXFLAGS])
+
+AM_CONDITIONAL([GCC], [test -n "$GCC"])
 
 AC_CONFIG_FILES([Makefile
           data/Makefile
diff -Nurd -X.diff_ignore freeciv/dependencies/lua/src/Makefile.am freeciv/dependencies/lua/src/Makefile.am
--- freeciv/dependencies/lua/src/Makefile.am	2007-08-04 18:36:08.000000000 +0300
+++ freeciv/dependencies/lua/src/Makefile.am	2007-09-03 17:50:01.000000000 +0300
@@ -1,6 +1,12 @@
 SUBDIRS = lib
 noinst_LIBRARIES = liblua.a
 AM_CPPFLAGS = -I$(srcdir)/../include -I.
+
+if GCC
+# Override possible -Werror from AM_CFLAGS
+liblua_a_CFLAGS = -Wno-pointer-to-int-cast
+endif
+
 EXTRA_DIST= README
 liblua_a_SOURCES = \
 	../include/lauxlib.h \
@@ -45,4 +51,3 @@
 	lvm.h \
 	lzio.c \
 	lzio.h
-
diff -Nurd -X.diff_ignore freeciv/configure.ac freeciv/configure.ac
--- freeciv/configure.ac	2007-08-26 22:11:42.000000000 +0300
+++ freeciv/configure.ac	2007-09-03 17:41:16.000000000 +0300
@@ -696,8 +696,8 @@
    fi]],[[]])
 
 if test -n "$GCC"; then
-  CFLAGS="$EXTRA_GCC_DEBUG_CFLAGS $CFLAGS"
-  CXXFLAGS="$EXTRA_GCC_DEBUG_CXXFLAGS $CXXFLAGS"
+  FC_CFLAGS="$EXTRA_GCC_DEBUG_CFLAGS $FC_CFLAGS"
+  FC_CXXFLAGS="$EXTRA_GCC_DEBUG_CXXFLAGS $FC_CXXFLAGS"
 fi
 
 dnl Rebuild 'configure' whenever version.in changes, if maintainer mode enabled.
@@ -711,6 +711,20 @@
 AC_DEFINE_UNQUOTED([FC_STORE_CPPFLAGS], ['$CPPFLAGS'], [These are the CPPFLAGS used in compilation])
 AC_DEFINE_UNQUOTED([FC_STORE_CFLAGS], ['$CFLAGS'], [These are the CFLAGS used in compilation])
 AC_DEFINE_UNQUOTED([FC_STORE_CXXFLAGS], ['$CXXFLAGS'], [These are the CXXFLAGS used in compilation])
+AC_DEFINE_UNQUOTED([FC_STORE_FC_CFLAGS], ['$FC_CFLAGS'], [These are the FC_CFLAGS used in compilation])
+AC_DEFINE_UNQUOTED([FC_STORE_FC_CXXFLAGS], ['$FC_CXXFLAGS'], [These are the FC_CXXFLAGS used in compilation])
+
+dnl We set AM_CFLAGS and AM_CXXFLAGS globally for all Makefiles to use.
+dnl Only lua Makefile currently adjust these (AM_CFLAGS).
+dnl We use FC_ -variants upto this point for a reason instead of modifying
+dnl AM_ -variants directly. aclocal thinks that everything starting with AM_
+dnl is meant to be m4 macro call and warns about these if not used carefully.
+dnl I'm undecided if it would be better style to just store FC_ -variants
+dnl here and set AM_ -variants to use them in every Makefile.
+AC_SUBST([AM_CFLAGS], [$FC_CFLAGS])
+AC_SUBST([AM_CXXFLAGS], [$FC_CXXFLAGS])
+
+AM_CONDITIONAL([GCC], [test -n "$GCC"])
 
 AC_CONFIG_FILES([Makefile
           data/Makefile
diff -Nurd -X.diff_ignore freeciv/dependencies/lua/src/Makefile.am freeciv/dependencies/lua/src/Makefile.am
--- freeciv/dependencies/lua/src/Makefile.am	2007-03-05 19:13:42.000000000 +0200
+++ freeciv/dependencies/lua/src/Makefile.am	2007-09-03 17:45:16.000000000 +0300
@@ -1,6 +1,12 @@
 SUBDIRS = lib
 noinst_LIBRARIES = liblua.a
 AM_CPPFLAGS = -I$(srcdir)/../include -I.
+
+if GCC
+# Override possible -Werror from AM_CFLAGS
+liblua_a_CFLAGS = -Wno-pointer-to-int-cast
+endif
+
 EXTRA_DIST= README
 liblua_a_SOURCES = \
 	../include/lauxlib.h \
@@ -45,4 +51,3 @@
 	lvm.h \
 	lzio.c \
 	lzio.h
-
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to