This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
In Darwin's hints, only add -no-cpp-precomp to ccflags if it's not an error.
authorNicholas Clark <nick@ccl4.org>
Tue, 5 Apr 2011 10:32:08 +0000 (11:32 +0100)
committerNicholas Clark <nick@ccl4.org>
Tue, 5 Apr 2011 10:32:08 +0000 (11:32 +0100)
Previously -no-cpp-precomp was added uncondtionally to cppflags and ccflags.
Apple's compiler accepts this unconditionally. gcc 4.5 warns about it, but
ignores it. gcc 4.6 treats the unknown flag as an error. Hence test whether
the flag causes problems, and only add it if it does not.

(Searching with Google suggests that this flag has been unnecessary on OS X
for some time. However, there's no clear documentation about it to confirm
when it stopped being necessary.)

hints/darwin.sh

index dab0607..95dc549 100644 (file)
@@ -126,11 +126,13 @@ case "$(grep '^#define INT32_MIN' /usr/include/stdint.h)" in
 esac
 
 # Avoid Apple's cpp precompiler, better for extensions
-cppflags="${cppflags} -no-cpp-precomp"
+if [ "X`echo | ${cc} -no-cpp-precomp -E - 2>&1 >/dev/null`" = "X" ]; then
+    cppflags="${cppflags} -no-cpp-precomp"
 
-# This is necessary because perl's build system doesn't
-# apply cppflags to cc compile lines as it should.
-ccflags="${ccflags} ${cppflags}"
+    # This is necessary because perl's build system doesn't
+    # apply cppflags to cc compile lines as it should.
+    ccflags="${ccflags} ${cppflags}"
+fi
 
 # Known optimizer problems.
 case "`cc -v 2>&1`" in