From f780d632f2047ccf07208081aa477882ef4ecc2a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 26 Apr 2013 12:31:09 -0700 Subject: [PATCH] Port better to AIX. * configure.ac (CFLAGS): Append -O if the user did not specify CFLAGS, we did not already infer an optimization option, and -O works. AIX xlc needs -O, otherwise garbage collection doesn't work. * src/lisp.h (ENUM_BF) [__IBMC__]: Make it 'unsigned int' here, too, to pacify AIX xlc. Fixes: debbugs:14258 --- ChangeLog | 7 +++++++ configure.ac | 30 +++++++++++++++++++++++------- src/ChangeLog | 6 ++++++ src/lisp.h | 6 +++--- 4 files changed, 39 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5f74726a743..cf1d4f0d54e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2013-04-26 Paul Eggert + + Port better to AIX (Bug#14258). + * configure.ac (CFLAGS): Append -O if the user did not specify CFLAGS, + we did not already infer an optimization option, and -O works. + AIX xlc needs -O, otherwise garbage collection doesn't work. + 2013-04-22 Paul Eggert * make-dist: Do not distribute admin/unidata/Makefile. diff --git a/configure.ac b/configure.ac index 2b3afc1fb80..6c59dcaa7e3 100644 --- a/configure.ac +++ b/configure.ac @@ -613,10 +613,10 @@ AC_DEFUN([gl_THREADLIB]) dnl Amongst other things, this sets AR and ARFLAGS. gl_EARLY -# 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';; @@ -632,13 +632,29 @@ if test "$ac_test_CFLAGS" != set; then [emacs_cv_prog_cc_g3], [AC_LINK_IFELSE([AC_LANG_PROGRAM()], [emacs_cv_prog_cc_g3=yes], - [emacs_cv_prog_cc_g3=no])]) - if test $emacs_cv_prog_cc_g3 = yes; then - CFLAGS=$emacs_g3_CFLAGS - else + [emacs_cv_prog_cc_g3=no])]) + 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 + AC_CACHE_CHECK([whether $CC accepts -O], + [emacs_cv_prog_cc_o], + [AC_LINK_IFELSE([AC_LANG_PROGRAM()], + [emacs_cv_prog_cc_o=yes], + [emacs_cv_prog_cc_o=no])]) + if test $emacs_cv_prog_cc_o != yes; then + CFLAGS=$emacs_save_CFLAGS + fi ;; + esac fi AC_ARG_ENABLE([gcc-warnings], diff --git a/src/ChangeLog b/src/ChangeLog index 99e2c3d9a84..9ae5c29ab72 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2013-04-26 Paul Eggert + + Port better to AIX (Bug#14258). + * lisp.h (ENUM_BF) [__IBMC__]: Make it 'unsigned int' here, too, + to pacify AIX xlc. + 2013-04-24 Kenichi Handa * coding.c (decode_coding_iso_2022): When an invalid escape diff --git a/src/lisp.h b/src/lisp.h index bcb866b4cc4..e2c24eed352 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -231,9 +231,9 @@ enum enum_USE_LSB_TAG { USE_LSB_TAG = 0 }; #define case_Lisp_Int case Lisp_Int0: case Lisp_Int1 #define LISP_INT_TAG_P(x) (((x) & ~Lisp_Int1) == 0) -/* Stolen from GDB. The only known compiler that doesn't support - enums in bitfields is MSVC. */ -#ifdef _MSC_VER +/* Idea stolen from GDB. MSVC doesn't support enums in bitfields, + and xlc complains vociferously about them. */ +#if defined _MSC_VER || defined __IBMC__ #define ENUM_BF(TYPE) unsigned int #else #define ENUM_BF(TYPE) enum TYPE -- 2.39.2