This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Improve C++ header detection in configure
- From: "Carlos O'Donell" <carlos at systemhalted dot org>
- To: Adam Conrad <adconrad at 0c3 dot net>
- Cc: libc-alpha at sourceware dot org
- Date: Fri, 23 Nov 2012 10:48:46 -0500
- Subject: Re: [PATCH] Improve C++ header detection in configure
- References: <20121123041931.GF11959@0c3.net>
On Thu, Nov 22, 2012 at 11:19 PM, Adam Conrad <adconrad@0c3.net> wrote:
> In Debian and Ubuntu, we recently shuffled around some of the
> C++ header locations to help multilib and multiarch co-exist
> more pleasantly. In the process, the configure magic to try
> to find headers broke, as it assumed a rather rigid directory
> structure.
>
> The following patch replaces the rigid assumptions with
> instead grabbing the full include list, and then grepping
> for /c++/ and using the return. This is working in current
> Ubuntu and Debian, and was further tested by Carlos to return
> correct results with older compilers back to gcc 4.2.
>
> 2012-11-22 Adam Conrad <adconrad@0c3.net>
>
> * configure.in: Improve search for C++ headers by not
> assuming a uniform directory structure on all hosts.
Overly verbose. Please save this for the git log.
Suggest ": Autodetect C++ header directories."
> * configure: Regenerated.
>
> --
> --- a/configure.in 2012-11-21 12:37:04.000000000 -0700
> +++ b/configure.in 2012-11-21 13:07:44.075825970 -0700
> @@ -1033,12 +1033,11 @@
> -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
> if test -n "$CXX"; then
> CXX_SYSINCLUDES=
> - cxxmachine=`$CXX -dumpmachine 2>&AS_MESSAGE_LOG_FD` &&
> - 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"
> + for cxxheaders in `$CXX -v -S -x c++ /dev/null -o /dev/null 2>&1 \
> + | sed -n -e '1,/#include/d' -e '/^ \//{p;}' | tr -d ' ' | grep '/c++/'`; do
I think that both `sed 's/ //'` and `tr -d ' '` are wrong.
We should support paths with spaces.
What about `sed 's/^ *//'` or similar?
Roll it into the previous sed?
> + test "x$cxxheaders" != x &&
> + CXX_SYSINCLUDES="$CXX_SYSINCLUDES -isystem $cxxheaders"
> + done
> fi
> fi
> AC_SUBST(SYSINCLUDES)
> --
>
Cheers,
Carlos.