1
dnl ---------------------------------------------------------------------------
2
dnl Copyright (C) 2009 Progress Software, Inc.
3
dnl http://fusesource.com
5
dnl Licensed under the Apache License, Version 2.0 (the "License");
6
dnl you may not use this file except in compliance with the License.
7
dnl You may obtain a copy of the License at
9
dnl http://www.apache.org/licenses/LICENSE-2.0
11
dnl Unless required by applicable law or agreed to in writing, software
12
dnl distributed under the License is distributed on an "AS IS" BASIS,
13
dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
dnl See the License for the specific language governing permissions and
15
dnl limitations under the License.
16
dnl ---------------------------------------------------------------------------
17
dnl ---------------------------------------------------------------------------
20
dnl WITH_OSX_UNIVERSAL()
22
dnl Allows creating universal binaries on the
24
dnl Adds the --with-universal=ARCH option. This will will
25
dnl set sysroot option to /Developer/SDKs/MacOSX${OSX_VERSION}.sdk.
26
dnl if OSX_VERSION is not defined, it will set it to 10.5 (the first
27
dnl release where intel universal binaries were supported)
29
dnl You must use the no-dependencies option when automake is initialized.
30
dnl for example: AM_INIT_AUTOMAKE([no-dependencies])
35
dnl AC_SUBST(MAC_OSX_VERSION)
37
dnl AUTHOR: <a href="http://hiramchirino.com">Hiram Chrino</a>
38
dnl ---------------------------------------------------------------------------
40
AC_DEFUN([WITH_OSX_UNIVERSAL],
45
AS_IF(test -z "$OSX_VERSION", [
50
AC_MSG_CHECKING(whether to build universal binaries)
51
AC_ARG_WITH([universal],
52
[AS_HELP_STRING([--with-universal@<:@=ARCH@:>@],
53
[Build a universal binary. Set to a space separated architecture list. Pick from: i386, x86_64, ppc, and/or ppc64. @<:@default="i386 x86_64 ppc"@:>@])],
55
AS_IF(test "$withval" = "no", [
58
], test "$withval" = "yes", [
59
OSX_UNIVERSAL="i386 x86_64 ppc"
60
AC_MSG_RESULT([yes, archs: $OSX_UNIVERSAL])
62
OSX_UNIVERSAL="$withval"
63
AC_MSG_RESULT([yes, archs: $OSX_UNIVERSAL])
69
AS_IF(test -n "$OSX_UNIVERSAL", [
70
for i in $OSX_UNIVERSAL ; do
71
CFLAGS="-arch $i $CFLAGS"
72
LDFLAGS="-arch $i $LDFLAGS"
75
CFLAGS="-isysroot /Developer/SDKs/MacOSX${OSX_VERSION}.sdk $CFLAGS"
76
LDFLAGS="-syslibroot,/Developer/SDKs/MacOSX${OSX_VERSION}.sdk $LDFLAGS"