Can you try this one out?

With some magic (sed and brace expansion) we might be able to use
AM_CPPFLAGS for PCH_FLAGS.

All-in-all the result is nicer than what we have now, but the
implementaion is a bit hairy.

Index: common.am
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/config/common.am,v
retrieving revision 1.11
diff -u -p -B -b -w -r1.11 common.am
--- common.am	3 Dec 2004 19:11:35 -0000	1.11
+++ common.am	4 Dec 2004 01:16:52 -0000
@@ -11,18 +11,19 @@ AM_INSTALL_DATA_FLAGS = $(INSTALL) -m 64
 AM_ETAGSFLAGS = --lang=c++
 
 if LYX_BUILD_PCH
-PCH_FLAGS = -Winvalid-pch --include=./pch.h
+PCH_SOURCE = $(srcdir)/pch.h
+PCH_FLAGS = -Winvalid-pch --include=$(PCH_SOURCE)
 PCH_FILE = ./pch.h.gch
-PCH_SOURCE = ./pch.h
 sinclude ./pch.h.gch.dep
 
 *.C *.cpp: $(PCH_FILE)
 
-pch.h.gch: $(PCH_SOURCE)
-	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) \
-        $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) \
+$(PCH_FILE): $(PCH_SOURCE)
+	TMPCMD=` echo $(CXXCOMPILE) | sed -e s,\",\',` ; \
+	PATTERN=`echo $(PCH_FLAGS) | sed -e 's,\/,\\\/,'` ; \
+	$${TMPCMD/$$PATTERN} \
 	-x c++-header $(PCH_SOURCE) -MT $@ -MD -MP -MF "./[EMAIL PROTECTED]" \
-	&& mv "./[EMAIL PROTECTED]" "./[EMAIL PROTECTED]" || rm "./[EMAIL PROTECTED]"
+	&& mv "./[EMAIL PROTECTED]" "./[EMAIL PROTECTED]" || rm -f "./[EMAIL PROTECTED]"
 
 endif
 
Index: lyxinclude.m4
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/config/lyxinclude.m4,v
retrieving revision 1.100
diff -u -p -B -b -w -r1.100 lyxinclude.m4
--- lyxinclude.m4	16 Nov 2004 20:43:08 -0000	1.100
+++ lyxinclude.m4	4 Dec 2004 01:16:52 -0000
@@ -213,7 +213,7 @@ if test x$GXX = xyes; then
       3.1*)    CXXFLAGS="$lyx_opt -finline-limit=500 -fno-exceptions";;
       3.2*)    CXXFLAGS="$lyx_opt -fno-exceptions";;
       3.3*)    CXXFLAGS="$lyx_opt -fno-exceptions";;
-      3.4*|3.5*)
+      3.4*|4.0*)
 	    CXXFLAGS="$lyx_opt -fno-exceptions"
 	    lyx_pch_comp=yes;;
       *)       CXXFLAGS="$lyx_opt";;
@@ -234,12 +234,12 @@ if test x$GXX = xyes; then
   fi
   if test x$enable_warnings = xyes ; then
     case $gxx_version in
-	2.95.*) CXXFLAGS="$CXXFLAGS -W -Wall";;
-	2.96*)  CXXFLAGS="$CXXFLAGS -W -Wall";;
-	3.1*) CXXFLAGS="$CXXFLAGS -W -Wall";;
-	3.2*) CXXFLAGS="$CXXFLAGS -W -Wall";;
-	3.3*) CXXFLAGS="$CXXFLAGS -W -Wall";;
-	*)    CXXFLAGS="$CXXFLAGS -Wextra -Wall";;
+	2.95.*) CPPFLAGS="$CPPFLAGS -W -Wall";;
+	2.96*)  CPPFLAGS="$CPPFLAGS -W -Wall";;
+	3.1*) CPPFLAGS="$CPPFLAGS -W -Wall";;
+	3.2*) CPPFLAGS="$CPPFLAGS -W -Wall";;
+	3.3*) CPPFLAGS="$CPPFLAGS -W -Wall";;
+	*)    CPPFLAGS="$CPPFLAGS -Wextra -Wall";;
     esac
   fi
 fi
-- 
        Lgb

Reply via email to