2024-05-11 13:16:48 -07:00
|
|
|
# multiarch.m4
|
|
|
|
# serial 9
|
2025-01-01 07:39:17 +00:00
|
|
|
dnl Copyright (C) 2008-2025 Free Software Foundation, Inc.
|
2011-01-08 22:57:07 -08:00
|
|
|
dnl This file is free software; the Free Software Foundation
|
|
|
|
dnl gives unlimited permission to copy and/or distribute it,
|
|
|
|
dnl with or without modifications, as long as this notice is preserved.
|
2024-12-17 14:02:41 -08:00
|
|
|
dnl This file is offered as-is, without any warranty.
|
2011-01-08 22:57:07 -08:00
|
|
|
|
|
|
|
# Determine whether the compiler is or may be producing universal binaries.
|
|
|
|
#
|
Merge from gnulib.
* lib/filemode.h, lib/signal.in.h, lib/stat.c, lib/stdint.in.h:
* lib/stdlib.in.h, lib/unistd.in.h, m4/extensions.m4, m4/getloadavg.m4:
* m4/getopt.m4, m4/gnulib-common.m4, m4/largefile.m4, m4/mktime.m4:
* m4/multiarch.m4, m4/nocrash.m4, m4/stdio_h.m4, m4/time_r.m4:
Copy new versions from gnulib, incorporating the following changes:
2012-06-22 time_r: fix typo that always overrode localtime_r decl
2012-06-22 Write "Mac OS X" instead of "MacOS X".
2012-06-21 mktime: fix integer overflow in 'configure'-time test
2012-06-21 nonblocking: Avoid compilation error on mingw64.
2012-06-19 stat, fstat: Avoid warnings on mingw64.
2012-06-19 getopt-gnu: Fix exit code overflow in autoconf test.
2012-06-22 10:20:00 -07:00
|
|
|
# On Mac OS X 10.5 and later systems, the user can create libraries and
|
2011-01-08 22:57:07 -08:00
|
|
|
# executables that work on multiple system types--known as "fat" or
|
|
|
|
# "universal" binaries--by specifying multiple '-arch' options to the
|
|
|
|
# compiler but only a single '-arch' option to the preprocessor. Like
|
|
|
|
# this:
|
|
|
|
#
|
|
|
|
# ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
|
|
|
# CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
|
|
|
|
# CPP="gcc -E" CXXCPP="g++ -E"
|
|
|
|
#
|
2011-01-21 16:12:10 -08:00
|
|
|
# Detect this situation and set APPLE_UNIVERSAL_BUILD accordingly.
|
2011-01-08 22:57:07 -08:00
|
|
|
|
|
|
|
AC_DEFUN_ONCE([gl_MULTIARCH],
|
|
|
|
[
|
|
|
|
dnl Code similar to autoconf-2.63 AC_C_BIGENDIAN.
|
Update from Gnulib
This incorporates:
2020-07-30 work around some Oracle Studio attribute bugs
2020-07-29 fsusage, regex, stat-size: remove Cray support
2020-07-26 inttypes: remove support for AIX 4
2020-07-26 gettimeofday: remove workaround for Mac OS X 10.0
2020-07-26 don't require gl_LOCALTIME_BUFFER_DEFAULTS
2020-07-26 alloca: remove Cray-2 and Cray Y-MP support
2020-07-26 libgmp: remove dependency on havelib
2020-07-26 libgmp: remove HAVE_GMP, LIB_GMP
2020-07-25 multiarch: prepare for x86_64+arm64 universal in macOS 11
2020-07-25 sigprocmask: small autoconf macro improvement
2020-07-25 small autoconf macro improvements
2020-07-24 timespec: remove dependence on ‘verify’
2020-07-24 optimize a few more three-valued comparisons
2020-07-24 fix _GL_CMP parenthesization typo
2020-07-23 optimize three-valued comparison between integers
2020-07-24 doc: update for Mac OS X 10.13
2020-07-23 fchmodat, lchmod: use /proc on Cygwin
2020-07-21 inttypes: fix PRI*PTR and SCN*PTR on 64-bit native Windows
2020-07-12 libgmp: avoid warning when --without-libgmp is used
2020-07-12 libgmp: link to the correct shared library
* lib/mini-gmp-gnulib.c: Ignore -Wsuggest-attribute=malloc only for
* build-aux/config.guess, build-aux/config.sub:
* build-aux/install-sh, doc/misc/texinfo.tex, lib/c-strcasecmp.c:
* lib/c-strncasecmp.c, lib/fchmodat.c, lib/fsusage.c:
* lib/gettimeofday.c, lib/inttypes.in.h, lib/lchmod.c:
* lib/mini-gmp-gnulib.c, lib/nstrftime.c, lib/regex.h, lib/timespec.h:
* m4/alloca.m4, m4/getgroups.m4, m4/gettimeofday.m4:
* m4/gnulib-common.m4, m4/inttypes.m4, m4/libgmp.m4, m4/mktime.m4:
* m4/multiarch.m4:
Copy from Gnulib.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* src/Makefile.in, test/Makefile.in (LIBGMP):
Rename from LIB_GMP for compatibility with Gnulib.
All uses changed.
2020-07-30 13:58:58 -07:00
|
|
|
AC_CACHE_CHECK([whether the compiler produces multi-arch binaries],
|
|
|
|
[gl_cv_c_multiarch],
|
|
|
|
[gl_cv_c_multiarch=no
|
|
|
|
AC_COMPILE_IFELSE(
|
|
|
|
[AC_LANG_SOURCE(
|
|
|
|
[[#ifndef __APPLE_CC__
|
|
|
|
not a universal capable compiler
|
|
|
|
#endif
|
|
|
|
typedef int dummy;
|
|
|
|
]])],
|
|
|
|
[
|
|
|
|
dnl Check for potential -arch flags. It is not universal unless
|
|
|
|
dnl there are at least two -arch flags with different values.
|
|
|
|
arch=
|
|
|
|
prev=
|
|
|
|
for word in ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}; do
|
|
|
|
if test -n "$prev"; then
|
|
|
|
case $word in
|
|
|
|
i?86 | x86_64 | ppc | ppc64 | arm | arm64)
|
|
|
|
if test -z "$arch" || test "$arch" = "$word"; then
|
|
|
|
arch="$word"
|
|
|
|
else
|
|
|
|
gl_cv_c_multiarch=yes
|
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
prev=
|
|
|
|
else
|
|
|
|
if test "x$word" = "x-arch"; then
|
|
|
|
prev=arch
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
])
|
2011-01-08 22:57:07 -08:00
|
|
|
])
|
|
|
|
if test $gl_cv_c_multiarch = yes; then
|
|
|
|
APPLE_UNIVERSAL_BUILD=1
|
|
|
|
else
|
|
|
|
APPLE_UNIVERSAL_BUILD=0
|
|
|
|
fi
|
|
|
|
AC_SUBST([APPLE_UNIVERSAL_BUILD])
|
|
|
|
])
|