diff options
-rw-r--r-- | src/acinclude.m4 | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/acinclude.m4 b/src/acinclude.m4 index 772fecf..30a5080 100644 --- a/src/acinclude.m4 +++ b/src/acinclude.m4 @@ -93,3 +93,55 @@ AC_DEFUN([AC_CHECK_LDFLAGS], fi ])# AC_CHECK_LDFLAGS + +AC_DEFUN([AC_CHECK_FAT], +[ +AC_ARG_ENABLE(fat-binary, + [ --enable-fat-binary=ARCHS + build an Apple Multi Architecture Binary (MAB); + ARCHS is a comma-delimited list of architectures for + which to build; if ARCHS is omitted, then the package + will be built for all architectures supported by the + platform (e.g. "ppc,i386" for MacOS/X and Darwin; + if this option is disabled or omitted entirely, then + the package will be built only for the target + platform], + [fat_binary=$enableval], [fat_binary=no]) +if test "$fat_binary" != no; then + AC_MSG_CHECKING([target architectures]) + + # Respect TARGET_ARCHS setting from environment if available. + if test -z "$TARGET_ARCHS"; then + # Respect ARCH given to --enable-fat-binary if present. + if test "$fat_binary" != yes; then + TARGET_ARCHS=`echo "$fat_binary" | tr ',' ' '` + else + # Choose a default set of architectures based upon platform. + TARGET_ARCHS="ppc i386" + fi + fi + AC_MSG_RESULT([$TARGET_ARCHS]) + + define([Name],[translit([$1],[./-], [___])]) + # /usr/lib/arch_tool -archify_list $TARGET_ARCHS + []Name="" + for archs in $TARGET_ARCHS + do + []Name="$[]Name -arch $archs" + done + + if test "x$[]Name" != "x"; then + tmp_arch_cflags="$CFLAGS" + AC_CHECK_CFLAGS($[]Name,,[]Name="") + CFLAGS="$tmp_arch_cflags" + fi + + if test "x$[]Name" != "x"; then + tmp_arch_ldflags="$LDFLAGS" + AC_CHECK_LDFLAGS($[]Name,,[]Name="") + LDFLAGS="$tmp_arch_ldflags" + fi + + undefine([Name]) +fi +])# AC_CHECK_FAT |