annotate m4/multiarch.m4 @ 273:88bbffa404ea 2.5 2.5

Updated version for release
author lost
date Sun, 16 Aug 2009 17:18:11 +0000
parents d5392bb5da3c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
272
d5392bb5da3c Added generated files
lost
parents:
diff changeset
1 # multiarch.m4 serial 3
d5392bb5da3c Added generated files
lost
parents:
diff changeset
2 dnl Copyright (C) 2008 Free Software Foundation, Inc.
d5392bb5da3c Added generated files
lost
parents:
diff changeset
3 dnl This file is free software; the Free Software Foundation
d5392bb5da3c Added generated files
lost
parents:
diff changeset
4 dnl gives unlimited permission to copy and/or distribute it,
d5392bb5da3c Added generated files
lost
parents:
diff changeset
5 dnl with or without modifications, as long as this notice is preserved.
d5392bb5da3c Added generated files
lost
parents:
diff changeset
6
d5392bb5da3c Added generated files
lost
parents:
diff changeset
7 # Determine whether the compiler is or may be producing universal binaries.
d5392bb5da3c Added generated files
lost
parents:
diff changeset
8 #
d5392bb5da3c Added generated files
lost
parents:
diff changeset
9 # On MacOS X 10.5 and later systems, the user can create libraries and
d5392bb5da3c Added generated files
lost
parents:
diff changeset
10 # executables that work on multiple system types--known as "fat" or
d5392bb5da3c Added generated files
lost
parents:
diff changeset
11 # "universal" binaries--by specifying multiple '-arch' options to the
d5392bb5da3c Added generated files
lost
parents:
diff changeset
12 # compiler but only a single '-arch' option to the preprocessor. Like
d5392bb5da3c Added generated files
lost
parents:
diff changeset
13 # this:
d5392bb5da3c Added generated files
lost
parents:
diff changeset
14 #
d5392bb5da3c Added generated files
lost
parents:
diff changeset
15 # ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
d5392bb5da3c Added generated files
lost
parents:
diff changeset
16 # CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
d5392bb5da3c Added generated files
lost
parents:
diff changeset
17 # CPP="gcc -E" CXXCPP="g++ -E"
d5392bb5da3c Added generated files
lost
parents:
diff changeset
18 #
d5392bb5da3c Added generated files
lost
parents:
diff changeset
19 # Detect this situation and set the macro AA_APPLE_UNIVERSAL_BUILD at the
d5392bb5da3c Added generated files
lost
parents:
diff changeset
20 # beginning of config.h and set APPLE_UNIVERSAL_BUILD accordingly.
d5392bb5da3c Added generated files
lost
parents:
diff changeset
21
d5392bb5da3c Added generated files
lost
parents:
diff changeset
22 AC_DEFUN([gl_MULTIARCH],
d5392bb5da3c Added generated files
lost
parents:
diff changeset
23 [
d5392bb5da3c Added generated files
lost
parents:
diff changeset
24 dnl This AC_REQUIRE is not necessary in theory. It works around a bug in
d5392bb5da3c Added generated files
lost
parents:
diff changeset
25 dnl autoconf <= 2.63: AC_REQUIRE invocations inside AC_REQUIREd macros are
d5392bb5da3c Added generated files
lost
parents:
diff changeset
26 dnl being handled better than AC_REQUIRE invocations inside normally invoked
d5392bb5da3c Added generated files
lost
parents:
diff changeset
27 dnl macros.
d5392bb5da3c Added generated files
lost
parents:
diff changeset
28 AC_REQUIRE([gl_MULTIARCH_BODY])
d5392bb5da3c Added generated files
lost
parents:
diff changeset
29 ])
d5392bb5da3c Added generated files
lost
parents:
diff changeset
30
d5392bb5da3c Added generated files
lost
parents:
diff changeset
31 AC_DEFUN([gl_MULTIARCH_BODY],
d5392bb5da3c Added generated files
lost
parents:
diff changeset
32 [
d5392bb5da3c Added generated files
lost
parents:
diff changeset
33 dnl Code similar to autoconf-2.63 AC_C_BIGENDIAN.
d5392bb5da3c Added generated files
lost
parents:
diff changeset
34 gl_cv_c_multiarch=no
d5392bb5da3c Added generated files
lost
parents:
diff changeset
35 AC_COMPILE_IFELSE(
d5392bb5da3c Added generated files
lost
parents:
diff changeset
36 [AC_LANG_SOURCE(
d5392bb5da3c Added generated files
lost
parents:
diff changeset
37 [[#ifndef __APPLE_CC__
d5392bb5da3c Added generated files
lost
parents:
diff changeset
38 not a universal capable compiler
d5392bb5da3c Added generated files
lost
parents:
diff changeset
39 #endif
d5392bb5da3c Added generated files
lost
parents:
diff changeset
40 typedef int dummy;
d5392bb5da3c Added generated files
lost
parents:
diff changeset
41 ]])],
d5392bb5da3c Added generated files
lost
parents:
diff changeset
42 [
d5392bb5da3c Added generated files
lost
parents:
diff changeset
43 dnl Check for potential -arch flags. It is not universal unless
d5392bb5da3c Added generated files
lost
parents:
diff changeset
44 dnl there are at least two -arch flags with different values.
d5392bb5da3c Added generated files
lost
parents:
diff changeset
45 arch=
d5392bb5da3c Added generated files
lost
parents:
diff changeset
46 prev=
d5392bb5da3c Added generated files
lost
parents:
diff changeset
47 for word in ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}; do
d5392bb5da3c Added generated files
lost
parents:
diff changeset
48 if test -n "$prev"; then
d5392bb5da3c Added generated files
lost
parents:
diff changeset
49 case $word in
d5392bb5da3c Added generated files
lost
parents:
diff changeset
50 i?86 | x86_64 | ppc | ppc64)
d5392bb5da3c Added generated files
lost
parents:
diff changeset
51 if test -z "$arch" || test "$arch" = "$word"; then
d5392bb5da3c Added generated files
lost
parents:
diff changeset
52 arch="$word"
d5392bb5da3c Added generated files
lost
parents:
diff changeset
53 else
d5392bb5da3c Added generated files
lost
parents:
diff changeset
54 gl_cv_c_multiarch=yes
d5392bb5da3c Added generated files
lost
parents:
diff changeset
55 fi
d5392bb5da3c Added generated files
lost
parents:
diff changeset
56 ;;
d5392bb5da3c Added generated files
lost
parents:
diff changeset
57 esac
d5392bb5da3c Added generated files
lost
parents:
diff changeset
58 prev=
d5392bb5da3c Added generated files
lost
parents:
diff changeset
59 else
d5392bb5da3c Added generated files
lost
parents:
diff changeset
60 if test "x$word" = "x-arch"; then
d5392bb5da3c Added generated files
lost
parents:
diff changeset
61 prev=arch
d5392bb5da3c Added generated files
lost
parents:
diff changeset
62 fi
d5392bb5da3c Added generated files
lost
parents:
diff changeset
63 fi
d5392bb5da3c Added generated files
lost
parents:
diff changeset
64 done
d5392bb5da3c Added generated files
lost
parents:
diff changeset
65 ])
d5392bb5da3c Added generated files
lost
parents:
diff changeset
66 if test $gl_cv_c_multiarch = yes; then
d5392bb5da3c Added generated files
lost
parents:
diff changeset
67 AC_DEFINE([AA_APPLE_UNIVERSAL_BUILD], [1],
d5392bb5da3c Added generated files
lost
parents:
diff changeset
68 [Define if the compiler is building for multiple architectures of Apple platforms at once.])
d5392bb5da3c Added generated files
lost
parents:
diff changeset
69 APPLE_UNIVERSAL_BUILD=1
d5392bb5da3c Added generated files
lost
parents:
diff changeset
70 else
d5392bb5da3c Added generated files
lost
parents:
diff changeset
71 APPLE_UNIVERSAL_BUILD=0
d5392bb5da3c Added generated files
lost
parents:
diff changeset
72 fi
d5392bb5da3c Added generated files
lost
parents:
diff changeset
73 AC_SUBST([APPLE_UNIVERSAL_BUILD])
d5392bb5da3c Added generated files
lost
parents:
diff changeset
74 ])