Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2004:
[Freeciv-Dev] (PR#10188) [Patch] Force rebuild when CPPFLAGS,CFLAGS chan
Home

[Freeciv-Dev] (PR#10188) [Patch] Force rebuild when CPPFLAGS,CFLAGS chan

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#10188) [Patch] Force rebuild when CPPFLAGS,CFLAGS change
From: "Marko Lindqvist" <marko.lindqvist@xxxxxxxxxxx>
Date: Sun, 19 Sep 2004 04:19:35 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=10188 >


  Currently you can end up with inconsistent build if you reconfigure 
with different CPPFLAGS and/or CFLAGS than used by previous configure. 
Object files compiled before reconfiguration are compiled using old 
flags, but new compilations (triggered by source changes) are made with 
new flags.
  Note that reconfiguring with different flags can happen without user 
realizing it. One may ./configure after explicitly setting flags, but 
some later date reconfigures in new session where flags are not set. 
Original configuration may have been made by some script that set flags, 
but user reconfigures manually...

  Attached patch forces total recompilation after reconfiguration, if 
flags differ from previous configuration. This is achieved by storing 
flags into config.h. As all source files should include, and thus 
depend, on config.h, change in config.h forces total recompilation.

  configure.ac is tested with autoconf-2.59, configure.in + acconfig.old 
are not tested at all. Would it be ok to make change for autoconf-2.59 
(ie to configure.ac) only and to leave autoconf-2.13 behavior as it is?


  - Caz


diff -Nurd -X.diff_ignore freeciv/acconfig.old freeciv/acconfig.old
--- freeciv/acconfig.old        2004-09-18 13:28:35.906250000 +0300
+++ freeciv/acconfig.old        2004-09-19 13:28:34.500000000 +0300
@@ -67,6 +67,8 @@
 #undef WINMM
 #undef HAVE_GETTIMEOFDAY
 #undef HAVE_WORKING_FORK
+#undef FC_STORE_CPPFLAGS
+#undef FC_STORE_CFLAGS
 @BOTTOM@
 
 #endif /* FC_CONFIG_H */
diff -Nurd -X.diff_ignore freeciv/configure.ac freeciv/configure.ac
--- freeciv/configure.ac        2004-09-18 13:28:54.218750000 +0300
+++ freeciv/configure.ac        2004-09-19 13:39:55.109375000 +0300
@@ -623,6 +623,14 @@
 dnl Rebuild 'configure' whenever version.in changes, if maintainer mode 
enabled.
 AC_SUBST([CONFIGURE_DEPENDENCIES], ["$CONFIGURE_DEPENDENCIES 
\$(top_srcdir)/version.in"])
 
+dnl Make sure that config.h changes when ever CPPFLAGS or CFLAGS
+dnl change so everything gets rebuilt. LDFLAGS is not handled here
+dnl since change in it should not cause recompilation, only relinking.
+dnl Note: Variables are named FC_STORE_* instead of FC_*_STORE in order to 
make them
+dnl       appear next to each other in config.h.
+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_CONFIG_FILES([Makefile
           data/Makefile 
          data/flags/Makefile
diff -Nurd -X.diff_ignore freeciv/configure.in freeciv/configure.in
--- freeciv/configure.in        2004-09-18 13:28:54.218750000 +0300
+++ freeciv/configure.in        2004-09-19 13:31:21.359375000 +0300
@@ -618,6 +618,12 @@
 CONFIGURE_DEPENDENCIES="$CONFIGURE_DEPENDENCIES \$(top_srcdir)/version.in"
 AC_SUBST([CONFIGURE_DEPENDENCIES])
 
+dnl Make sure that config.h changes when ever CPPFLAGS or CFLAGS
+dnl change so everything gets rebuilt. LDFLAGS is not handled here
+dnl since change in it should not cause recompilation, only relinking.
+AC_DEFINE_UNQUOTED(FC_STORE_CPPFLAGS, "$CPPFLAGS")
+AC_DEFINE_UNQUOTED(FC_STORE_CFLAGS, "$CFLAGS")
+
 AC_OUTPUT(Makefile
           data/Makefile 
          data/flags/Makefile

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#10188) [Patch] Force rebuild when CPPFLAGS,CFLAGS change, Marko Lindqvist <=