This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: (no) GCC pre-compiled headers on Cygwin


On Jul 22, 2003, Benjamin Kosnik <bkoz@redhat.com> wrote:

>> Would a change that made it fail in the current conditions be acceptable
>> for libstdc++?

> Yes please.

How's this?  Ok to install?

Index: libstdc++-v3/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* acinclude.m4 (GLIBCXX_ENABLE_PCH): Rework test such that it
	tests not only generation of pch files, but also their use.
	* aclocal.m4, configure: Rebuilt.

Index: libstdc++-v3/acinclude.m4
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/acinclude.m4,v
retrieving revision 1.257
diff -u -p -r1.257 acinclude.m4
--- libstdc++-v3/acinclude.m4 14 Jul 2003 18:23:00 -0000 1.257
+++ libstdc++-v3/acinclude.m4 23 Jul 2003 05:05:06 -0000
@@ -1394,7 +1394,7 @@ AC_ARG_ENABLE(libstdcxx_pch,
 changequote(<<, >>)dnl
 <<  --enable-libstdcxx-pch     build pre-compiled libstdc++ includes [default=>>GLIBCXX_ENABLE_PCH_DEFAULT],
 changequote([, ])dnl
-[case "${enableval}" in
+[case ${enableval} in
  yes) enable_libstdcxx_pch=yes ;;
  no)  enable_libstdcxx_pch=no ;;
  *)   AC_MSG_ERROR([Unknown argument to enable/disable PCH]) ;;
@@ -1402,27 +1402,30 @@ changequote([, ])dnl
 enable_libstdcxx_pch=GLIBCXX_ENABLE_PCH_DEFAULT)dnl
 
   if test x$enable_libstdcxx_pch = xyes; then
-    ac_test_CXXFLAGS="${CXXFLAGS+set}"
-    ac_save_CXXFLAGS="$CXXFLAGS"
-    CXXFLAGS='-Werror -Winvalid-pch -Wno-deprecated -x c++-header'
-
-    AC_MSG_CHECKING([for compiler that seems to compile .gch files])
-    if test x${pch_comp+set} != xset; then
-      AC_CACHE_VAL(pch_comp, [
+    AC_CACHE_CHECK([for pch support], [libstdcxx_cv_pch_comp],[
         AC_LANG_SAVE
         AC_LANG_CPLUSPLUS
-        AC_TRY_COMPILE([#include <math.h>], ,
-                       [pch_comp=yes], [pch_comp=no])
+	ac_save_CXXFLAGS=$CXXFLAGS
+	CXXFLAGS="$CXXFLAGS -Werror -Winvalid-pch -Wno-deprecated"
+	echo '#include <math.h>' > conftest.h
+	if ${CXX-g++} $CXXFLAGS $CPPFLAGS -x c++-header conftest.h \
+		-o conftest.h.gch 1>&5 2>&1 &&
+	   echo '#error "pch failed"' > conftest.h &&
+	   echo '#include "conftest.h"' > conftest.C &&
+	   ${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.C 1>&5 2>&1 ; then
+	  libstdcxx_cv_pch_comp=yes
+	else
+	  libstdcxx_cv_pch_comp=no
+	fi
+	rm -f conftest*
+	CXXFLAGS=$ac_save_CXXFLAGS
         AC_LANG_RESTORE
-      ])
-    fi
-    AC_MSG_RESULT([$pch_comp])
-
-    CXXFLAGS="$ac_save_CXXFLAGS"
+    ])
   fi
 
-  if test x"$enable_libstdcxx_pch" = xyes && test x"$pch_comp" = xno; then
-    enable_pch=no
+  if test x"$enable_libstdcxx_pch" = xyes &&
+     test x"$libstdcxx_cv_pch_comp" = xno; then
+    enable_libstdcxx_pch=no
   fi
 
   AC_MSG_CHECKING([for enabled PCH])
-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]