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
On Fri, Nov 23, 2012 at 3:46 PM, Adam Conrad <adconrad@0c3.net> wrote:
> On Fri, Nov 23, 2012 at 10:48:46AM -0500, Carlos O'Donell wrote:
>>
>> Suggest ": Autodetect C++ header directories."
>>
>> I think that both `sed 's/ //'` and `tr -d ' '` are wrong.
>>
>> Roll it into the previous sed?
>
> Alright, here's a second cut, incorporating the above suggestions,
> and rolling the grep into the sed as well:
>
> 2012-11-22 Adam Conrad <adconrad@0c3.net>
>
> * configure.in: 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 's/^ \(\/.*\/c++\/\)/\1/p'`; do
> + test "x$cxxheaders" != x &&
> + CXX_SYSINCLUDES="$CXX_SYSINCLUDES -isystem $cxxheaders"
> + done
Adam,
Some systems, namely gentoo, uses `g++-v4' (on hppa at least) as the
C++ header path segment. This leads me to believe that the path is
less likely to always be `c++'. However, there has always been a
`/.++' in the C++ header path, so lets stick with that. Therefore it
looks like what we want is 's/^ \(\/.*\/.++.*\)/\1/p'
Joseph,
Any comments on autodetecting the required C++ header paths?
Cheers,
Carlos.