# Code from module xalloc-oversized:
-# It's helpful to have C macros available to GDB, so prefer -g3 to -g
-# if -g3 works and the user does not specify CFLAGS.
-# This test must follow gl_EARLY; otherwise AC_LINK_IFELSE complains.
if test "$ac_test_CFLAGS" != set; then
+ # It's helpful to have C macros available to GDB, so prefer -g3 to -g
+ # if -g3 works and the user does not specify CFLAGS.
+ # This test must follow gl_EARLY; otherwise AC_LINK_IFELSE complains.
case $CFLAGS in
'-g')
emacs_g3_CFLAGS='-g3';;
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_prog_cc_g3" >&5
$as_echo "$emacs_cv_prog_cc_g3" >&6; }
- if test $emacs_cv_prog_cc_g3 = yes; then
- CFLAGS=$emacs_g3_CFLAGS
- else
+ if test $emacs_cv_prog_cc_g3 != yes; then
CFLAGS=$emacs_save_CFLAGS
fi
fi
+
+ case $CFLAGS in
+ *-O*) ;;
+ *)
+ # No optimization flag was inferred for this non-GCC compiler.
+ # Try -O. This is needed for xlc on AIX; see Bug#14258.
+ emacs_save_CFLAGS=$CFLAGS
+ test -z "$CFLAGS" || CFLAGS="$CFLAGS "
+ CFLAGS=${CFLAGS}-O
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -O" >&5
+$as_echo_n "checking whether $CC accepts -O... " >&6; }
+if test "${emacs_cv_prog_cc_o+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ emacs_cv_prog_cc_o=yes
+else
+ emacs_cv_prog_cc_o=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_prog_cc_o" >&5
+$as_echo "$emacs_cv_prog_cc_o" >&6; }
+ if test $emacs_cv_prog_cc_o != yes; then
+ CFLAGS=$emacs_save_CFLAGS
+ fi ;;
+ esac
fi
# Check whether --enable-gcc-warnings was given.