Use -dM for gcc (the suggested patch did it only for Linux,
authorPixel <pixel@mandrakesoft.com>
Sun, 5 Nov 2000 21:49:34 +0000 (22:49 +0100)
committerJarkko Hietaniemi <jhi@iki.fi>
Sun, 5 Nov 2000 21:15:13 +0000 (21:15 +0000)
but I think it can be generalized).

Subject: Re: connect and $!{EINPROGRESS} pb (was [ID 20001030.010] [PATCH] io_multihomed.t failing)
Message-ID: <ly8zqygn4x.fsf@leia.mandrakesoft.com>

p4raw-id: //depot/perl@7565

ext/Errno/Errno_pm.PL

index 0666b2a..9ea6041 100644 (file)
@@ -29,6 +29,12 @@ sub process_file {
             warn "Cannot open '$file'";
             return;
        }     
+    } elsif ($Config{gccversion} ne '') { 
+       # With the -dM option, gcc outputs every #define it finds
+       unless(open(FH,"$Config{cc} -E -dM $file |")) {
+            warn "Cannot open '$file'";
+            return;
+       }     
     } else {
        unless(open(FH,"< $file")) {
            # This file could be a temporary file created by cppstdin
@@ -79,6 +85,10 @@ sub get_files {
     } elsif ($^O eq 'vmesa') {
        # OS/390 C compiler doesn't generate #file or #line directives
        $file{'../../vmesa/errno.h'} = 1;
+    } elsif ($^O eq 'linux') {
+       # Some Linuxes have weird errno.hs which generate
+       # no #file or #line directives
+       $file{'/usr/include/errno.h'} = 1;
     } else {
        open(CPPI,"> errno.c") or
            die "Cannot open errno.c";