>From 382a70efd75241ea495737faeffc32b09f75de31 Mon Sep 17 00:00:00 2001 From: Michael Haubenwallner Date: Tue, 15 Mar 2016 15:50:39 +0100 Subject: [PATCH] early detect AIX object mode for toolchain search 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_aix_object_mode configure variable. * m4/gnulib-common.m4 (gl_AIX_OBJECT_MODE): New. (gl_PROG_AR_RANLIB): AC_REQUIRE gl_AIX_OBJECT_MODE. Search for AR and RANLIB accepting the -X32_64 when gl_cv_aix_object_mode != no. --- m4/gnulib-common.m4 | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4 index f8454c8..a3a691f 100644 --- a/m4/gnulib-common.m4 +++ b/m4/gnulib-common.m4 @@ -245,6 +245,33 @@ AC_DEFUN([gl_PROG_CC_C99], [AC_REQUIRE([AC_PROG_CC_STDC])]) ]) +# gl_AIX_OBJECT_MODE +# Determines the current object mode used by the compiler for AIX. +AC_DEFUN([gl_AIX_OBJECT_MODE], +[ + AC_REQUIRE([AC_PROG_CC]) + AC_CACHE_CHECK([for AIX object mode], [gl_cv_aix_object_mode], + [ + AC_EGREP_CPP([OBJECT_MODE=64], + [ +#if defined(_AIX) && defined(__64BIT__) +OBJECT_MODE=64 +#endif + ], + [gl_cv_aix_object_mode=64], + [ + AC_EGREP_CPP([OBJECT_MODE=32], + [ +#if defined(_AIX) && !defined(__64BIT__) +OBJECT_MODE=32 +#endif + ], + [gl_cv_aix_object_mode=32], + [gl_cv_aix_object_mode=no]) + ]) + ]) +]) + # 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 +283,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_AIX_OBJECT_MODE]) AC_BEFORE([$0], [AM_PROG_AR]) AC_CACHE_CHECK([for Minix Amsterdam compiler], [gl_cv_c_amsterdam_compiler], [ @@ -279,6 +307,11 @@ Amsterdam ARFLAGS='-o' fi else + if test $gl_cv_aix_object_mode != no; then + dnl AIX toolchain does accept 32 bit objects by default only. + AC_CHECK_TOOL([AR], [ar -X32_64], [ar]) + AC_CHECK_TOOL([RANLIB], [ranlib -X32_64], [ranlib]) + fi 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 dnl script on-demand, if not specified by ./configure of course). -- 2.4.6