In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/f5fdb0259d5e9470e8291544a8b209e202d36334?hp=bf78513fd9ba938ecdb1dcbf1ec2d3912924749b>

- Log -----------------------------------------------------------------
commit f5fdb0259d5e9470e8291544a8b209e202d36334
Author: Jarkko Hietaniemi <[email protected]>
Date:   Mon Nov 24 20:39:18 2014 -0500

    Remove -std=c89/-ansi if freebsd has "inline static" in <fenv.h>
    
    Since -std=c89 (eq -ansi) simply isn't compatible with "inline static".
    
    Based on a fix by TonyC.
-----------------------------------------------------------------------

Summary of changes:
 ext/POSIX/Makefile.PL | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/ext/POSIX/Makefile.PL b/ext/POSIX/Makefile.PL
index 5a24a34..fe93efc 100644
--- a/ext/POSIX/Makefile.PL
+++ b/ext/POSIX/Makefile.PL
@@ -144,3 +144,35 @@ WriteConstants(
     NAME => 'POSIX',
     NAMES => \@names,
 );
+
+package MY;
+
+use strict;
+use Config;
+
+sub cflags {
+    my $self = shift;
+
+    my $cflags = $self->SUPER::cflags(@_);
+
+    if ($^O eq 'freebsd') {
+        my $issue = "use <fenv.h> with -std=c89/-ansi";
+        print "$^O: checking if you can $issue\n";
+        # For example FreeBSD 10.0 uses "...static inline int" in <fenv.h>,
+        # which is incompatible with -std=c89 aka -ansi.
+        if (open(my $fh, ">fenv$$.c")) {
+            print { $fh } "#include <fenv.h>\nint main() { return 0; }\n";
+            close $fh;
+            system("$Config{cc} -std=c89 -o fenv$$ fenv$$.c 2>/dev/null");
+            if (-x "fenv$$") {
+                print "$^O: you can $issue\n";
+            } else {
+                print "$^O: you cannot $issue, removing those from flags\n";
+                $cflags =~ s/(?<=[ =])(?:-ansi|-std=c89)\b//g;
+            }
+            unlink("fenv$$.c", "fenv$$");
+        }
+   }
+
+   $cflags;
+}

--
Perl5 Master Repository

Reply via email to