[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] early check for PowerPC AIX object mode
From: |
Michael Haubenwallner |
Subject: |
[PATCH] early check for PowerPC AIX object mode |
Date: |
Thu, 17 Mar 2016 15:34:12 +0100 |
Native PowerPC AIX tools do accept only 32 bit objects by default.
They either need the -X32_64 commandline flag to accept both, or the
OBJECT_MODE=64 environment variable to switch to accepting 64 bit
objects only, while the GNU toolchain ignores both the -X32_64 flag
and the environment variable. As this affects the whole toolchain, we
separately set the gl_cv_powerpc_aix_object_mode configure variable to
either '32' or '64', or to 'no' when not compiling for PowerPC AIX.
* m4/gnulib-common.m4 (gl_POWERPC_AIX_OBJECT_MODE): New.
(gl_PROG_AR_RANLIB): Require gl_POWERPC_AIX_OBJECT_MODE.
Search for AR and RANLIB accepting the -X32_64 flag when
gl_cv_powerpc_aix_object_mode != no.
---
ChangeLog | 16 ++++++++++++++++
m4/gnulib-common.m4 | 36 ++++++++++++++++++++++++++++++++++++
2 files changed, 52 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 49180d9..75cc906 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2016-03-17 Michael Haubenwallner <address@hidden>
+
+ early check for PowerPC AIX object mode
+
+ Native PowerPC AIX tools do accept only 32 bit objects by default.
+ They either need the -X32_64 commandline flag to accept both, or the
+ OBJECT_MODE=64 environment variable to switch to accepting 64 bit
+ objects only, while the GNU toolchain ignores both the -X32_64 flag
+ and the environment variable. As this affects the whole toolchain, we
+ separately set the gl_cv_powerpc_aix_object_mode configure variable to
+ either '32' or '64', or to 'no' when not compiling for PowerPC AIX.
+ * m4/gnulib-common.m4 (gl_POWERPC_AIX_OBJECT_MODE): New.
+ (gl_PROG_AR_RANLIB): Require gl_POWERPC_AIX_OBJECT_MODE.
+ Search for AR and RANLIB accepting the -X32_64 flag when
+ gl_cv_powerpc_aix_object_mode != no.
+
2016-03-15 Paul Eggert <address@hidden>
time_rz: port to clang -Wunused-const-variable
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index f8454c8..727b7d6 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -245,6 +245,37 @@ AC_DEFUN([gl_PROG_CC_C99],
[AC_REQUIRE([AC_PROG_CC_STDC])])
])
+# gl_POWERPC_AIX_OBJECT_MODE
+# Determines the current object mode used by the compiler for AIX.
+AC_DEFUN([gl_POWERPC_AIX_OBJECT_MODE],
+[
+ AC_CACHE_CHECK([for PowerPC AIX object mode],
+ [gl_cv_powerpc_aix_object_mode],
+ [
+ dnl like AS_EGREP_CPP but with AS_CASE instead of AS_IF
+ dnl to run preprocessor once for multiple variants
+ AC_LANG_PREPROC_REQUIRE()
+ AC_LANG_CONFTEST([AC_LANG_SOURCE(
+ [
+#if defined(_AIX) && defined(_POWER)
+# if defined(__64BIT__)
+OBJECT_MODE=64
+# else
+OBJECT_MODE=32
+# endif
+#else
+OBJECT_MODE=no
+#endif
+ ])])
+ AS_CASE(
+ [`(eval "$ac_cpp conftest.$ac_ext") 2>&AS_MESSAGE_LOG_FD`],
+ [*'OBJECT_MODE=64'*], [gl_cv_powerpc_aix_object_mode=64],
+ [*'OBJECT_MODE=32'*], [gl_cv_powerpc_aix_object_mode=32],
+ [gl_cv_powerpc_aix_object_mode=no])
+ rm -f conftest*
+ ])
+])
+
# gl_PROG_AR_RANLIB
# Determines the values for AR, ARFLAGS, RANLIB that fit with the compiler.
# The user can set the variables AR, ARFLAGS, RANLIB if he wants to override
@@ -256,6 +287,7 @@ AC_DEFUN([gl_PROG_AR_RANLIB],
dnl library formats. In particular, the GNU binutils programs ar and ranlib
dnl produce libraries that work only with gcc, not with cc.
AC_REQUIRE([AC_PROG_CC])
+ AC_REQUIRE([gl_POWERPC_AIX_OBJECT_MODE])
AC_BEFORE([$0], [AM_PROG_AR])
AC_CACHE_CHECK([for Minix Amsterdam compiler], [gl_cv_c_amsterdam_compiler],
[
@@ -278,6 +310,10 @@ Amsterdam
if test -z "$ARFLAGS"; then
ARFLAGS='-o'
fi
+ elif test $gl_cv_powerpc_aix_object_mode != no; then
+ dnl PowerPC AIX toolchain accepts only 32 bit objects by default.
+ AC_CHECK_TOOL([AR], [ar -X32_64], [ar])
+ AC_CHECK_TOOL([RANLIB], [ranlib -X32_64], [ranlib])
else
dnl AM_PROG_AR was added in automake v1.11.2. AM_PROG_AR does not AC_SUBST
dnl ARFLAGS variable (it is filed into Makefile.in directly by automake
--
2.4.6
- [PATCH] early check for PowerPC AIX object mode,
Michael Haubenwallner <=