gnulib: update to 776af40e0
[deliverable/binutils-gdb.git] / gnulib / import / m4 / multiarch.m4
CommitLineData
9c9d63b1
PM
1# multiarch.m4 serial 9
2dnl Copyright (C) 2008-2021 Free Software Foundation, Inc.
f434ba03
PA
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7# Determine whether the compiler is or may be producing universal binaries.
8#
40a73391 9# On Mac OS X 10.5 and later systems, the user can create libraries and
f434ba03
PA
10# executables that work on multiple system types--known as "fat" or
11# "universal" binaries--by specifying multiple '-arch' options to the
12# compiler but only a single '-arch' option to the preprocessor. Like
13# this:
14#
15# ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
16# CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
17# CPP="gcc -E" CXXCPP="g++ -E"
18#
770d76d7 19# Detect this situation and set APPLE_UNIVERSAL_BUILD accordingly.
f434ba03
PA
20
21AC_DEFUN_ONCE([gl_MULTIARCH],
22[
23 dnl Code similar to autoconf-2.63 AC_C_BIGENDIAN.
9c9d63b1
PM
24 AC_CACHE_CHECK([whether the compiler produces multi-arch binaries],
25 [gl_cv_c_multiarch],
26 [gl_cv_c_multiarch=no
27 AC_COMPILE_IFELSE(
28 [AC_LANG_SOURCE(
29 [[#ifndef __APPLE_CC__
30 not a universal capable compiler
31 #endif
32 typedef int dummy;
33 ]])],
34 [
35 dnl Check for potential -arch flags. It is not universal unless
36 dnl there are at least two -arch flags with different values.
37 arch=
38 prev=
39 for word in ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}; do
40 if test -n "$prev"; then
41 case $word in
42 i?86 | x86_64 | ppc | ppc64 | arm | arm64)
43 if test -z "$arch" || test "$arch" = "$word"; then
44 arch="$word"
45 else
46 gl_cv_c_multiarch=yes
47 fi
48 ;;
49 esac
50 prev=
51 else
52 if test "x$word" = "x-arch"; then
53 prev=arch
54 fi
55 fi
56 done
57 ])
f434ba03
PA
58 ])
59 if test $gl_cv_c_multiarch = yes; then
f434ba03
PA
60 APPLE_UNIVERSAL_BUILD=1
61 else
62 APPLE_UNIVERSAL_BUILD=0
63 fi
64 AC_SUBST([APPLE_UNIVERSAL_BUILD])
65])
This page took 0.957851 seconds and 4 git commands to generate.