[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

[PATCH h2ph]: locate gcc include dir



gcc 4 on Debian no longer emits "Reading specs from ..." but rather
"Using built-in specs.".

Here is an alternate mechanism to locate the gcc include directory for
-a.

--bod

diff --exclude=debian -Naur perl-5.8.7.orig/utils/h2ph.PL perl-5.8.7/utils/h2ph.PL
--- perl-5.8.7.orig/utils/h2ph.PL	2005-04-05 07:47:17.000000000 +1000
+++ perl-5.8.7/utils/h2ph.PL	2005-11-13 11:06:37.000000000 +1100
@@ -734,10 +734,13 @@
 # non-GCC?) C compilers, but gcc uses an additional include directory.
 sub inc_dirs
 {
-    my $from_gcc    = `$Config{cc} -v 2>&1`;
-    $from_gcc       =~ s:^Reading specs from (.*?)/specs\b.*:$1/include:s;
-
-    length($from_gcc) ? ($from_gcc, $Config{usrinc}) : ($Config{usrinc});
+    my @inc = $Config{usrinc};
+    my $from_gcc = `$Config{cc} --print-libgcc-file-name 2>&1`;
+    if ($from_gcc =~ s!/libgcc\..*!/include!s and -d $from_gcc)
+    {
+	unshift @inc, $from_gcc;
+    }
+    @inc;
 }
 
 


Follow-Ups from:
"H.Merijn Brand" <h.m.brand@xs4all.nl>
Jason Vas Dias <jvdias@redhat.com>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]