Bug 1414067 Fix the compiler test for FORTIFY_SOURCE r?glandium
MozReview-Commit-ID: 8ozY0Zbuczx
--- a/js/src/old-configure.in
+++ b/js/src/old-configure.in
@@ -547,17 +547,22 @@ case "$host" in
;;
esac
MOZ_DOING_LTO(lto_is_enabled)
dnl ========================================================
dnl Add optional and non-optional hardening flags
dnl ========================================================
-if test "$GNU_CC" -o test -n "${CLANG_CC}${CLANG_CL}"; then
+
+dnl Note that in the top-level old-configure.in, we don't enable
+dnl FORTIFY_SOURCE on Android. But in js/ we *can* enable it on
+dnl Android, so we do.
+
+if test "$GNU_CC" -o -n "${CLANG_CC}${CLANG_CL}"; then
CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2"
CXXFLAGS="$CXXFLAGS -D_FORTIFY_SOURCE=2"
fi
dnl ========================================================
dnl System overrides of the defaults for target
dnl ========================================================
--- a/old-configure.in
+++ b/old-configure.in
@@ -495,20 +495,29 @@ fi
dnl ========================================================
dnl Add optional and non-optional hardening flags
dnl ========================================================
CFLAGS="$CFLAGS $HARDENING_CFLAGS"
CPPFLAGS="$CPPFLAGS $HARDENING_CFLAGS"
CXXFLAGS="$CXXFLAGS $HARDENING_CFLAGS"
-if test "$GNU_CC" -o test -n "${CLANG_CC}${CLANG_CL}"; then
- CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
- CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2"
- CXXFLAGS="$CXXFLAGS -D_FORTIFY_SOURCE=2"
+if test "$GNU_CC" -o -n "${CLANG_CC}${CLANG_CL}"; then
+ case $OS_TARGET in
+ Android)
+ dnl FORTIFY_SOURCE is not supported on Android on the
+ dnl top-level old-configure.in at this time.
+ dnl See Bug 1415595
+ ;;
+ *)
+ CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
+ CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2"
+ CXXFLAGS="$CXXFLAGS -D_FORTIFY_SOURCE=2"
+ ;;
+ esac
fi
dnl ========================================================
dnl GNU specific defaults
dnl ========================================================
if test "$GNU_CC"; then
MMX_FLAGS="-mmmx"
SSE_FLAGS="-msse"