+rm -f _cflags.c _cflags$_exe
+
+case "$gccversion" in
+'') ;;
+*)
+ case "$warn$ccflags" in
+ *-pedantic*)
+ # If we have -Duse64bitint (or equivalent) in effect and the quadtype
+ # has become 'long long', gcc -pedantic* becomes unbearable
+ # (moreso when combined with -Wall) because long long and LL and %lld|%Ld
+ # become warn-worthy. So let's drop the -pedantic in that case.
+ #
+ # Similarly, since 'long long' isn't part of C89, FreeBSD 6.2 headers
+ # don't declare atoll() under -std=c89, but we need it. In general,
+ # insisting on -std=c89 is inconsistent with insisting on using
+ # 'long long'. So drop -std=c89 and -ansi as well if we're using
+ # 'long long' as our main integral type.
+ #
+ # usedtrace (DTrace) uses unportable features (dollars in identifiers,
+ # and gcc statement expressions), it is just easier to turn off pedantic.
+ remove=''
+ case "$quadtype:$ivtype:$sPRId64:$usedtrace" in
+ *"long long"*|*lld*|*Ld*) remove='long long' ;;
+ *) case "$usedtrace" in
+ define) remove='usedtrace' ;;
+ esac
+ ;;
+ esac
+ case "$remove" in
+ '') ;;
+ *) echo "cflags.SH: Removing -pedantic*, -std=c89, and -ansi because of $remove."
+ ccflags=`echo $ccflags|sed -e 's/-pedantic-errors/ /' -e 's/-pedantic/ /' -e 's/-std=c89/ /' -e 's/-ansi/ /' -e 's/-DPERL_GCC_PEDANTIC/ /'`
+ warn=`echo $warn|sed -e 's/-pedantic-errors/ /' -e 's/-pedantic/ /' -e 's/-ansi/ /' -e 's/-DPERL_GCC_PEDANTIC/ /'`
+ stdflags=`echo $stdflags|sed -e 's/-std=c89/ /'`
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+esac
+
+# Older clang releases are not wise enough for -Wunused-value.
+case "$gccversion" in
+*"Apple LLVM "[34]*|*"Apple LLVM version "[34]*)
+ for f in -Wno-unused-value
+ do
+ echo "cflags.SH: Adding $f because clang version '$gccversion'"
+ warn="$warn $f"
+ done
+ ;;
+esac
+
+# The quadmath Q format specifier will cause -Wformat to whine.
+case "$gccversion" in
+'') ;;
+*) case "$usequadmath" in
+ define)
+ for f in -Wno-format
+ do
+ echo "cflags.SH: Adding $f because of usequadmath."
+ warn="$warn $f"
+ done
+ ;;
+ esac
+ ;;
+esac
+
+case "$cc" in
+*g++*)
+ # Extra paranoia in case people have bad canned ccflags:
+ # bad in the sense that the flags are accepted by g++,
+ # but then whined about.
+ #
+ # -Werror=d-a-s option is valid for g++, by definition,
+ # but we remove it just for cleanliness and shorter command lines.
+ for f in -Wdeclaration-after-statement \
+ -Werror=declaration-after-statement \
+ -Wc++-compat \
+ -std=c89
+ do
+ case "$ccflags$warn" in
+ *"$f"*)
+ echo "cflags.SH: Removing $f because of g++."
+ ccflags=`echo $ccflags|sed 's/$f/ /'`
+ warn=`echo $warn|sed 's/$f/ /'`
+ ;;
+ esac
+ done
+ ;;
+esac
+
+for f in -Wdeclaration-after-statement -Werror=declaration-after-statement
+do
+ case "$cppflags" in
+ *"$f"*)
+ echo "cflags.SH: Removing $f from cppflags."
+ cppflags=`echo $cppflags|sed 's/$f/ /'` ;;
+ esac
+done
+
+# If usethreads and clang, add -Wthread-safety for clang 3.6 or later.
+# gccversion is defined also for clang, because compat, use that for matching.
+# Apple overwrites clang version with XCode version, see hints/darwin.sh
+# for the gory details. Aggressively forward-proofing.
+case "$usethreads" in
+define)
+case "$gccversion" in
+*" Clang 3."[56789]*|*" Clang "[456]*|*"Apple LLVM 6.1"*|*"Apple LLVM "[789]*)
+ for f in -Wthread-safety
+ do
+ case " $warn " in
+ *" $f "*) ;; # Skip if already there.
+ *)
+ echo "cflags.SH: Adding $f because usethreads and clang and gccversion '$gccversion'"
+ warn="$warn $f"
+ ;;
+ esac
+ done
+;;
+esac
+;;
+esac
+
+echo "cflags.SH: cc = $cc"
+echo "cflags.SH: ccflags = $ccflags"
+echo "cflags.SH: stdflags = $stdflags"
+echo "cflags.SH: optimize = $optimize"
+echo "cflags.SH: warn = $warn"
+
+# Code to set any extra flags here.
+extra=''
+
+# Protect double or single quotes for better restoring of ccflags.
+myccflags=`echo $ccflags | sed -e 's/"/\\\"/g' -e "s/'/\\\'/g"`