This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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]

Use $CXX not cc1plus to locate C++ headers


The code in configure.in to detect the C++ compiler's header directory
doesn't work if the compiler is installed in a location other than its
configured prefix, because this code runs cc1plus directly and the
relocation support is handled by the compiler driver, so cc1plus when
run directly finds the configured header locations do not exist and
does not report any header paths.  Instead, errors about not being
able to create /dev/null.s are interpreted as the header directory.

This patch fixes this code to use $CXX directly when locating the C++
header directory.  Tested x86_64, and ARM with a relocated compiler
installation to verify that case now works.

2012-10-10  Joseph Myers  <joseph@codesourcery.com>

	* configure.in: Run $CXX, not cc1plus, to locate C++ headers.
	* configure: Regenerated.

diff --git a/configure b/configure
index a5e9316..74ff690 100755
--- a/configure
+++ b/configure
@@ -5342,10 +5342,9 @@ if test -n "$sysheaders"; then
 -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
   if test -n "$CXX"; then
     CXX_SYSINCLUDES=
-    cxxversion=`$CXX -dumpversion 2>&5` &&
     cxxmachine=`$CXX -dumpmachine 2>&5` &&
-    cxxplus=`$CXX -print-prog-name=cc1plus`
-    cxxheaders=`$cxxplus -v /dev/null 2>&1 | sed -n '/ \//{p;q;}' | sed 's/ //'`
+    cxxheaders=`$CXX -v -S -x c++ /dev/null -o /dev/null 2>&1 \
+	| sed -n -e '1,/#include/d' -e '/^ \//{p;q;}' | sed 's/ //'`
     test "x$cxxheaders" != x && test "x$i" != "x$cxxheaders" &&
     CXX_SYSINCLUDES="$CXX_SYSINCLUDES -isystem $cxxheaders \
 -isystem $cxxheaders/$cxxmachine -isystem $cxxheaders/backward"
diff --git a/configure.in b/configure.in
index b9b5703..facde5e 100644
--- a/configure.in
+++ b/configure.in
@@ -973,10 +973,9 @@ if test -n "$sysheaders"; then
 -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
   if test -n "$CXX"; then
     CXX_SYSINCLUDES=
-    cxxversion=`$CXX -dumpversion 2>&AS_MESSAGE_LOG_FD` &&
     cxxmachine=`$CXX -dumpmachine 2>&AS_MESSAGE_LOG_FD` &&
-    cxxplus=`$CXX -print-prog-name=cc1plus`
-    cxxheaders=`$cxxplus -v /dev/null 2>&1 | sed -n '/ \//{p;q;}' | sed 's/ //'`
+    cxxheaders=`$CXX -v -S -x c++ /dev/null -o /dev/null 2>&1 \
+	| sed -n -e '1,/#include/d' -e '/^ \//{p;q;}' | sed 's/ //'`
     test "x$cxxheaders" != x && test "x$i" != "x$cxxheaders" &&
     CXX_SYSINCLUDES="$CXX_SYSINCLUDES -isystem $cxxheaders \
 -isystem $cxxheaders/$cxxmachine -isystem $cxxheaders/backward"

-- 
Joseph S. Myers
joseph@codesourcery.com


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