diff options
author | Niko Tyni <ntyni@debian.org> | 2018-11-17 19:27:42 +0200 |
---|---|---|
committer | Tony Cook <tony@develop-help.com> | 2018-11-20 10:58:02 +1100 |
commit | 6c5080f25fa3dcede391007ffe328ea53779c52f (patch) | |
tree | 5902ad595855034a01c2264e609dfaf5369d9df0 /ext/Errno | |
parent | 72f80477dde6b7a55e4f16b0ed65951a10ef5fcc (diff) | |
download | perl-6c5080f25fa3dcede391007ffe328ea53779c52f.tar.gz |
Make Errno_pm.PL compatible with /usr/include/<ARCH>/errno.h
As seen in <https://bugs.debian.org/798955>, Debian glibc
maintainers intend to move system header files from /usr/include to
/usr/include/<arch> at some point. This would break Errno_pm.PL, which
has logic for asking cpp for the location of errno.h but fails earlier
if errno.h is not on a list of known paths.
Take the cpp fallback instead of dying. The behaviour should stay
identical as long as errno.h is not moved.
This will also enable multiarch (non-sysroot) cross builds.
Original patch by Helmut Grohne.
Bug-Debian: https://bugs.debian.org/875921
Diffstat (limited to 'ext/Errno')
-rw-r--r-- | ext/Errno/Errno_pm.PL | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/ext/Errno/Errno_pm.PL b/ext/Errno/Errno_pm.PL index d565f31b2f..84fd151d27 100644 --- a/ext/Errno/Errno_pm.PL +++ b/ext/Errno/Errno_pm.PL @@ -2,7 +2,7 @@ use ExtUtils::MakeMaker; use Config; use strict; -our $VERSION = "1.29"; +our $VERSION = "1.30"; my %err = (); @@ -111,6 +111,17 @@ sub default_cpp { sub get_files { my %file = (); + # When cross-compiling we may store a path for gcc's "sysroot" option: + my $sysroot = $Config{sysroot} || ''; + my $linux_errno_h; + if ($^O eq 'linux') { + # Some Linuxes have weird errno.hs which generate + # no #file or #line directives + ($linux_errno_h) = grep { -e $_ } map { "$_/errno.h" } + "$sysroot/usr/include", "$sysroot/usr/local/include", + split / / => $Config{locincpth}; + } + # VMS keeps its include files in system libraries if ($^O eq 'VMS') { $file{'Sys$Library:DECC$RTLDEF.TLB'} = 1; @@ -125,17 +136,10 @@ sub get_files { } } elsif ($^O eq 'linux' && $Config{gccversion} ne '' && - $Config{gccversion} !~ /intel/i + $Config{gccversion} !~ /intel/i && # might be using, say, Intel's icc + $linux_errno_h ) { - # When cross-compiling we may store a path for gcc's "sysroot" option: - my $sysroot = $Config{sysroot} || ''; - # Some Linuxes have weird errno.hs which generate - # no #file or #line directives - my ($linux_errno_h) = grep { -e $_ } map { "$_/errno.h" } - "$sysroot/usr/include", "$sysroot/usr/local/include", - split / / => $Config{locincpth} or - die "Cannot find errno.h"; $file{$linux_errno_h} = 1; } elsif ($^O eq 'haiku') { # hidden in a special place |