changeset 109359:b7e047772c64

Properly handle C_WARNINGS_SWITCH, PROFILING_CFLAGS, PROFILING_LDFLAGS * configure.in (C_WARNINGS_SWITCH, PROFILING_CFLAGS) (PROFILING_LDFLAGS): Substitute, don't add them to CFLAGS/LDFLAGS. (C_OPTIMIZE_SWITCH): Remove. (TEMACS_LDFLAGS2): Add ${PROFILING_LDFLAGS}. * lib-src/Makefile.in (C_WARNINGS_SWITCH, PROFILING_CFLAGS) (PROFILING_LDFLAGS): Set from substitution. (BASE_CFLAGS): Add ${C_WARNINGS_SWITCH}. (ALL_CFLAGS, CPP_CFLAGS): Add ${PROFILING_CFLAGS}. (LINK_CFLAGS): Add ${PROFILING_LDFLAGS}. * lwlib/Makefile.in (C_WARNINGS_SWITCH, PROFILING_CFLAGS): Set from substitution. (ALL_CFLAGS): Add ${C_WARNINGS_SWITCH} and ${PROFILING_CFLAGS}. * oldXMenu/Makefile.in (C_WARNINGS_SWITCH, PROFILING_CFLAGS): Set from substitution. (ALL_CFLAGS): Add ${C_WARNINGS_SWITCH} and ${PROFILING_CFLAGS}. * src/Makefile.in (C_WARNINGS_SWITCH, PROFILING_CFLAGS) (PROFILING_LDFLAGS): Set from substitution. (ALL_CFLAGS): Add C_WARNINGS_SWITCH and PROFILING_CFLAGS, put CFLAGS last.
author Andreas Schwab <schwab@linux-m68k.org>
date Mon, 12 Jul 2010 16:16:38 +0200
parents 3cfd17e4be81
children f37b85834f7e
files ChangeLog configure configure.in lib-src/ChangeLog lib-src/Makefile.in lwlib/ChangeLog lwlib/Makefile.in oldXMenu/ChangeLog oldXMenu/Makefile.in src/ChangeLog src/Makefile.in
diffstat 11 files changed, 73 insertions(+), 74 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Jul 12 12:22:20 2010 +0300
+++ b/ChangeLog	Mon Jul 12 16:16:38 2010 +0200
@@ -1,3 +1,10 @@
+2010-07-12  Andreas Schwab  <schwab@linux-m68k.org>
+
+	* configure.in (C_WARNINGS_SWITCH, PROFILING_CFLAGS)
+	(PROFILING_LDFLAGS): Substitute, don't add them to CFLAGS/LDFLAGS.
+	(C_OPTIMIZE_SWITCH): Remove.
+	(TEMACS_LDFLAGS2): Add ${PROFILING_LDFLAGS}.
+
 2010-07-11  Andreas Schwab  <schwab@linux-m68k.org>
 
 	* configure.in: Don't check for index and rindex, check for strchr
--- a/configure	Mon Jul 12 12:22:20 2010 +0300
+++ b/configure	Mon Jul 12 16:16:38 2010 +0200
@@ -724,6 +724,7 @@
 INSTALL_DATA
 INSTALL_SCRIPT
 INSTALL_PROGRAM
+C_WARNINGS_SWITCH
 EGREP
 GREP
 CPP
@@ -742,6 +743,8 @@
 build_vendor
 build_cpu
 build
+PROFILING_LDFLAGS
+PROFILING_CFLAGS
 MAINT
 GZIP_INFO
 target_alias
@@ -3013,6 +3016,8 @@
    PROFILING_LDFLAGS=
 fi
 
+
+
 # Check whether --enable-autodepend was given.
 if test "${enable_autodepend+set}" = set; then :
   enableval=$enable_autodepend; ac_enable_autodepend="${enableval}"
@@ -4313,14 +4318,6 @@
   CC="$NON_GNU_CC"
 fi
 
-if test x$GCC = xyes; then
-  C_OPTIMIZE_SWITCH=-O2
-  test "x$GCC_TEST_OPTIONS" != x && CC="$CC $GCC_TEST_OPTIONS"
-else
-  C_OPTIMIZE_SWITCH=-O
-  test "x$NON_GCC_TEST_OPTIONS" != x && CC="$CC $NON_GCC_TEST_OPTIONS"
-fi
-
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -4875,6 +4872,7 @@
 unset SAVE_CFLAGS
 
 
+
 #### Some other nice autoconf tests.
 
 ac_ext=c
@@ -5485,34 +5483,12 @@
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
 
-LDFLAGS="${LDFLAGS} ${PROFILING_LDFLAGS}"
-
 
 # The value of CPP is a quoted variable reference, so we need to do this
 # to get its actual value...
 CPP=`eval "echo $CPP"`
 
 
-### First figure out CFLAGS (which we use for running the compiler here)
-### and REAL_CFLAGS (which we use for real compilation).
-### The two are the same except when using GCC where we might use
-### extra warning and profiling flags.
-
-### If the CFLAGS env var is specified, we use that value
-### instead of the default.
-
-if test "x$SPECIFIED_CFLAGS" = x; then
-  CFLAGS="-g $C_OPTIMIZE_SWITCH"
-  if test x$GCC = xyes; then
-    REAL_CFLAGS="$CFLAGS $C_WARNINGS_SWITCH $PROFILING_CFLAGS"
-  else
-    REAL_CFLAGS="$CFLAGS"
-  fi
-else
-  REAL_CFLAGS="$CFLAGS"
-fi
-
-
 CANNOT_DUMP=no
 case "$opsys" in
   your-opsys-here)
@@ -7417,7 +7393,7 @@
 tmp_CFLAGS="$CFLAGS"
 CPPFLAGS="$CPPFLAGS -x objective-c"
 CFLAGS="$CFLAGS -x objective-c"
-TEMACS_LDFLAGS2="\${LDFLAGS}"
+TEMACS_LDFLAGS2="\${LDFLAGS} \${PROFILING_LDFLAGS}"
 if test "${with_ns}" != no; then
   if test "${opsys}" = darwin; then
      NS_IMPL_COCOA=yes
@@ -7441,7 +7417,6 @@
        GNUSTEP_LOCAL_LIBRARIES="-L${GNUSTEP_LOCAL_LIBRARIES}"
      CPPFLAGS="$CPPFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
      CFLAGS="$CFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
-     REAL_CFLAGS="$REAL_CFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
      LDFLAGS="$LDFLAGS -L${GNUSTEP_SYSTEM_LIBRARIES} ${GNUSTEP_LOCAL_LIBRARIES}"
      LIB_STANDARD=
      START_FILES=
@@ -8075,6 +8050,7 @@
 # used for the tests that follow.  We set them back to REAL_CFLAGS and
 # REAL_CPPFLAGS later on.
 
+REAL_CFLAGS="$CFLAGS"
 REAL_CPPFLAGS="$CPPFLAGS"
 
 if test "${HAVE_X11}" = "yes"; then
--- a/configure.in	Mon Jul 12 12:22:20 2010 +0300
+++ b/configure.in	Mon Jul 12 16:16:38 2010 +0200
@@ -327,6 +327,8 @@
    PROFILING_CFLAGS=
    PROFILING_LDFLAGS=
 fi
+AC_SUBST(PROFILING_CFLAGS)
+AC_SUBST(PROFILING_LDFLAGS)
 
 AC_ARG_ENABLE(autodepend,
 [AS_HELP_STRING([--enable-autodepend],
@@ -720,14 +722,6 @@
   CC="$NON_GNU_CC"
 fi
 
-if test x$GCC = xyes; then
-  C_OPTIMIZE_SWITCH=-O2
-  test "x$GCC_TEST_OPTIONS" != x && CC="$CC $GCC_TEST_OPTIONS"
-else
-  C_OPTIMIZE_SWITCH=-O
-  test "x$NON_GCC_TEST_OPTIONS" != x && CC="$CC $NON_GCC_TEST_OPTIONS"
-fi
-
 dnl checks for Unix variants
 AC_USE_SYSTEM_EXTENSIONS
 
@@ -770,6 +764,7 @@
 CFLAGS="$SAVE_CFLAGS"
 unset has_option
 unset SAVE_CFLAGS
+AC_SUBST(C_WARNINGS_SWITCH)
 
 
 #### Some other nice autoconf tests.
@@ -861,35 +856,12 @@
   LDFLAGS=$late_LDFLAGS
   [AC_MSG_RESULT(no)])
 
-LDFLAGS="${LDFLAGS} ${PROFILING_LDFLAGS}"
-
 
 # The value of CPP is a quoted variable reference, so we need to do this
 # to get its actual value...
 CPP=`eval "echo $CPP"`
 
 
-### First figure out CFLAGS (which we use for running the compiler here)
-### and REAL_CFLAGS (which we use for real compilation).
-### The two are the same except when using GCC where we might use
-### extra warning and profiling flags.
-
-### If the CFLAGS env var is specified, we use that value
-### instead of the default.
-
-dnl Note AC_PROG_CC sets CFLAGS to -g -O2 for gcc anyway.
-if test "x$SPECIFIED_CFLAGS" = x; then
-  CFLAGS="-g $C_OPTIMIZE_SWITCH"
-  if test x$GCC = xyes; then
-    REAL_CFLAGS="$CFLAGS $C_WARNINGS_SWITCH $PROFILING_CFLAGS"
-  else
-    REAL_CFLAGS="$CFLAGS"
-  fi
-else
-  REAL_CFLAGS="$CFLAGS"
-fi
-
-
 dnl Not used by any currently supported platform.
 dnl The function dump-emacs will not be defined and temacs will do
 dnl (load "loadup") automatically unless told otherwise.
@@ -1497,7 +1469,7 @@
 tmp_CFLAGS="$CFLAGS"
 CPPFLAGS="$CPPFLAGS -x objective-c"
 CFLAGS="$CFLAGS -x objective-c"
-TEMACS_LDFLAGS2="\${LDFLAGS}"
+TEMACS_LDFLAGS2="\${LDFLAGS} \${PROFILING_LDFLAGS}"
 dnl I don't think it's especially important, but src/Makefile.in
 dnl (now the only user of ns_appdir) used to go to the trouble of adding a
 dnl trailing "/" to it, so now we do it here.
@@ -1526,7 +1498,6 @@
        GNUSTEP_LOCAL_LIBRARIES="-L${GNUSTEP_LOCAL_LIBRARIES}"
      CPPFLAGS="$CPPFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
      CFLAGS="$CFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
-     REAL_CFLAGS="$REAL_CFLAGS -I${GNUSTEP_SYSTEM_HEADERS} ${GNUSTEP_LOCAL_HEADERS}"
      LDFLAGS="$LDFLAGS -L${GNUSTEP_SYSTEM_LIBRARIES} ${GNUSTEP_LOCAL_LIBRARIES}"
      LIB_STANDARD=
      START_FILES=
@@ -1732,6 +1703,7 @@
 # used for the tests that follow.  We set them back to REAL_CFLAGS and
 # REAL_CPPFLAGS later on.
 
+REAL_CFLAGS="$CFLAGS"
 REAL_CPPFLAGS="$CPPFLAGS"
 
 if test "${HAVE_X11}" = "yes"; then
--- a/lib-src/ChangeLog	Mon Jul 12 12:22:20 2010 +0300
+++ b/lib-src/ChangeLog	Mon Jul 12 16:16:38 2010 +0200
@@ -1,3 +1,11 @@
+2010-07-12  Andreas Schwab  <schwab@linux-m68k.org>
+
+	* Makefile.in (C_WARNINGS_SWITCH, PROFILING_CFLAGS)
+	(PROFILING_LDFLAGS): Set from substitution.
+	(BASE_CFLAGS): Add  ${C_WARNINGS_SWITCH}.
+	(ALL_CFLAGS, CPP_CFLAGS): Add ${PROFILING_CFLAGS}.
+	(LINK_CFLAGS): Add ${PROFILING_LDFLAGS}.
+
 2010-07-12  Eli Zaretskii  <eliz@gnu.org>
 
 	* makefile.w32-in (lisp2): Change hebrew.el to hebrew.elc (see
--- a/lib-src/Makefile.in	Mon Jul 12 12:22:20 2010 +0300
+++ b/lib-src/Makefile.in	Mon Jul 12 16:16:38 2010 +0200
@@ -36,6 +36,9 @@
 EXEEXT=@EXEEXT@
 C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@
 C_SWITCH_MACHINE=@C_SWITCH_MACHINE@
+C_WARNINGS_SWITCH = @C_WARNINGS_SWITCH@
+PROFILING_CFLAGS = @PROFILING_CFLAGS@
+PROFILING_LDFLAGS = @PROFILING_LDFLAGS@
 
 # Program name transformation.
 TRANSFORM = @program_transform_name@
@@ -165,12 +168,12 @@
 # Those files shared with other GNU utilities need HAVE_CONFIG_H
 # defined before they know they can take advantage of the information
 # in ../src/config.h.
-BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) -DHAVE_CONFIG_H \
-              -I. -I../src -I${srcdir} -I${srcdir}/../src
+BASE_CFLAGS = $(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) ${C_WARNINGS_SWITCH} \
+	      -DHAVE_CONFIG_H -I. -I../src -I${srcdir} -I${srcdir}/../src
 
-ALL_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
-LINK_CFLAGS = ${BASE_CFLAGS} ${LDFLAGS} ${CFLAGS}
-CPP_CFLAGS = ${BASE_CFLAGS} ${CPPFLAGS} ${CFLAGS}
+ALL_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${LDFLAGS} ${CPPFLAGS} ${CFLAGS}
+LINK_CFLAGS = ${BASE_CFLAGS} ${PROFILING_LDFLAGS} ${LDFLAGS} ${CFLAGS}
+CPP_CFLAGS = ${BASE_CFLAGS} ${PROFILING_CFLAGS} ${CPPFLAGS} ${CFLAGS}
 
 LOADLIBES=$(LIBS_SYSTEM)
 
--- a/lwlib/ChangeLog	Mon Jul 12 12:22:20 2010 +0300
+++ b/lwlib/ChangeLog	Mon Jul 12 16:16:38 2010 +0200
@@ -1,3 +1,9 @@
+2010-07-12  Andreas Schwab  <schwab@linux-m68k.org>
+
+	* Makefile.in (C_WARNINGS_SWITCH, PROFILING_CFLAGS): Set from
+	substitution.
+	(ALL_CFLAGS): Add ${C_WARNINGS_SWITCH} and ${PROFILING_CFLAGS}.
+
 2010-07-08  Jan Djärv  <jan.h.d@swipnet.se>
 
 	* xlwmenu.c (size_menu_item): Change from K&R to prototype.
--- a/lwlib/Makefile.in	Mon Jul 12 12:22:20 2010 +0300
+++ b/lwlib/Makefile.in	Mon Jul 12 16:16:38 2010 +0200
@@ -29,6 +29,8 @@
 C_SWITCH_X_SYSTEM=@C_SWITCH_X_SYSTEM@
 C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@
 C_SWITCH_MACHINE=@C_SWITCH_MACHINE@
+C_WARNINGS_SWITCH = @C_WARNINGS_SWITCH@
+PROFILING_CFLAGS = @PROFILING_CFLAGS@
 
 CC=@CC@
 CFLAGS=@CFLAGS@
@@ -50,7 +52,8 @@
 
 # ../src is needed to find config.h.
 ALL_CFLAGS= $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \
-  $(C_SWITCH_X_SYSTEM) $(C_SWITCH_MACHINE) $(CFLAGS) \
+  $(C_SWITCH_X_SYSTEM) $(C_SWITCH_MACHINE) \
+  ${C_WARNINGS_SWITCH} ${PROFILING_CFLAGS} $(CFLAGS) \
   -DHAVE_CONFIG_H -Demacs -I. -I../src -I${srcdir} -I${srcdir}/../src
 
 .c.o:
--- a/oldXMenu/ChangeLog	Mon Jul 12 12:22:20 2010 +0300
+++ b/oldXMenu/ChangeLog	Mon Jul 12 16:16:38 2010 +0200
@@ -1,3 +1,9 @@
+2010-07-12  Andreas Schwab  <schwab@linux-m68k.org>
+
+	* Makefile.in (C_WARNINGS_SWITCH, PROFILING_CFLAGS): Set from
+	substitution.
+	(ALL_CFLAGS): Add ${C_WARNINGS_SWITCH} and ${PROFILING_CFLAGS}.
+
 2010-07-04  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	* Activate.c: Convert function definitions to standard C.
--- a/oldXMenu/Makefile.in	Mon Jul 12 12:22:20 2010 +0300
+++ b/oldXMenu/Makefile.in	Mon Jul 12 16:16:38 2010 +0200
@@ -49,6 +49,8 @@
 C_SWITCH_X_SYSTEM=@C_SWITCH_X_SYSTEM@
 C_SWITCH_SYSTEM=@C_SWITCH_SYSTEM@
 C_SWITCH_MACHINE=@C_SWITCH_MACHINE@
+C_WARNINGS_SWITCH = @C_WARNINGS_SWITCH@
+PROFILING_CFLAGS = @PROFILING_CFLAGS@
 
 EXTRA=insque.o
 CC=@CC@
@@ -88,6 +90,7 @@
 
 ALL_CFLAGS=$(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \
   $(C_SWITCH_X_SITE) $(C_SWITCH_X_SYSTEM) \
+  ${C_WARNINGS_SWITCH} ${PROFILING_CFLAGS} \
   $(CPPFLAGS) $(CFLAGS) -DEMACS_BITMAP_FILES \
   -I../src -I${srcdir} -I${srcdir}/../src
 
--- a/src/ChangeLog	Mon Jul 12 12:22:20 2010 +0300
+++ b/src/ChangeLog	Mon Jul 12 16:16:38 2010 +0200
@@ -1,3 +1,10 @@
+2010-07-12  Andreas Schwab  <schwab@linux-m68k.org>
+
+	* Makefile.in (C_WARNINGS_SWITCH, PROFILING_CFLAGS)
+	(PROFILING_LDFLAGS): Set from substitution.
+	(ALL_CFLAGS): Add C_WARNINGS_SWITCH and PROFILING_CFLAGS, put
+	CFLAGS last.
+
 2010-07-12  Kenichi Handa  <handa@m17n.org>
 
 	* Makefile.in (lisp): Change hebrew.el to hebrew.elc.
--- a/src/Makefile.in	Mon Jul 12 12:22:20 2010 +0300
+++ b/src/Makefile.in	Mon Jul 12 16:16:38 2010 +0200
@@ -63,6 +63,13 @@
 
 CRT_DIR=@CRT_DIR@
 
+## Flags to pass for profiling builds
+PROFILING_CFLAGS = @PROFILING_CFLAGS@
+PROFILING_LDFLAGS = @PROFILING_LDFLAGS@
+
+## Flags to pass to the compiler to enable build warnings
+C_WARNINGS_SWITCH = @C_WARNINGS_SWITCH@
+
 ## Machine-specific CFLAGS.
 C_SWITCH_MACHINE=@C_SWITCH_MACHINE@
 ## System-specific CFLAGS.
@@ -107,7 +114,7 @@
 ## Flags to pass to ld only for temacs.
 TEMACS_LDFLAGS = $(LD_SWITCH_SYSTEM) $(LD_SWITCH_SYSTEM_TEMACS)
 
-## $LDFLAGS, or empty if NS_IMPL_GNUSTEP (for some reason).
+## $LDFLAGS $PROFILING_LDFLAGS, or empty if NS_IMPL_GNUSTEP (for some reason).
 TEMACS_LDFLAGS2 = @TEMACS_LDFLAGS2@
 
 ## Some systems define this to request special libraries.
@@ -309,8 +316,9 @@
 ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(MYCPPFLAGS) -I. -I${srcdir} \
   ${C_SWITCH_MACHINE} ${C_SWITCH_SYSTEM} ${C_SWITCH_X_SITE} \
   ${C_SWITCH_X_SYSTEM} ${CFLAGS_SOUND} ${RSVG_CFLAGS} ${DBUS_CFLAGS} \
-  ${GCONF_CFLAGS} ${CFLAGS} ${FREETYPE_CFLAGS} ${FONTCONFIG_CFLAGS} \
-  ${LIBOTF_CFLAGS} ${M17N_FLT_CFLAGS} ${DEPFLAGS}
+  ${GCONF_CFLAGS} ${FREETYPE_CFLAGS} ${FONTCONFIG_CFLAGS} \
+  ${LIBOTF_CFLAGS} ${M17N_FLT_CFLAGS} ${DEPFLAGS} ${PROFILING_CFLAGS} \
+  ${C_WARNINGS_SWITCH} ${CFLAGS}
 ALL_OBJC_CFLAGS=$(ALL_CFLAGS) $(GNU_OBJC_CFLAGS)
 
 .SUFFIXES: .m