From: Nicholas Clark Date: Tue, 5 Apr 2011 10:32:08 +0000 (+0100) Subject: In Darwin's hints, only add -no-cpp-precomp to ccflags if it's not an error. X-Git-Tag: v5.14.0-RC1~142 X-Git-Url: https://perl5.git.perl.org/perl5.git/commitdiff_plain/e727fa2798ffc794cbb99211cf1a5499354bc1d5 In Darwin's hints, only add -no-cpp-precomp to ccflags if it's not an error. 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.) --- diff --git a/hints/darwin.sh b/hints/darwin.sh index dab0607..95dc549 100644 --- a/hints/darwin.sh +++ b/hints/darwin.sh @@ -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