From 0c7a029ed490e46ef192284d77eabbe22f5dfdf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IOhannes=20m=20zm=C3=B6lnig?= Date: Tue, 7 Apr 2009 16:55:10 +0000 Subject: added checks for fat-binaries; LATER check whether this actually works svn path=/trunk/externals/zexy/; revision=10970 --- src/Make.config.in | 9 ++++----- src/Makefile | 4 ++-- src/configure.ac | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 7 deletions(-) diff --git a/src/Make.config.in b/src/Make.config.in index e1748db..33b2ad3 100644 --- a/src/Make.config.in +++ b/src/Make.config.in @@ -1,4 +1,5 @@ LIBNAME =@LIBNAME@ +TARNAME = $(LIBNAME)-@LIBRARY_VERSION@.tgz # when build as a library this holds a pre-processor define # (e.g. "-DZEXY_LIBRARY") @@ -23,12 +24,10 @@ AFLAGS = LFLAGS = @LFLAGS@ WFLAGS = -TARNAME = $(LIBNAME)-@LIBRARY_VERSION@.tgz - -# ICCFLAGS=-march=pentiumiii -axK Z_CFLAGS = $(IFLAGS) $(DEFS) $(BUILDLIBRARY) -DPD $(WFLAGS) @CFLAGS@ $(CFLAGS) - +LIBS = @LIBS@ MAKEDEP_FLAGS = @MAKEDEP_FLAGS@ +ARCH_FLAG = @ARCH_FLAG@ + CONFIGUREFLAGS = @CONFIGUREFLAGS@ -LIBS = @LIBS@ diff --git a/src/Makefile b/src/Makefile index 86a472d..0e03580 100644 --- a/src/Makefile +++ b/src/Makefile @@ -61,7 +61,7 @@ all: $(OBJECTS) endif $(OBJECTS): %.$(EXT) : %.o - $(LD) $(LFLAGS) -o $@ $*.o $(LIBS) + $(LD) $(LFLAGS) $(ARCH_FLAG) -o $@ $*.o $(LIBS) $(STRIP) $(STRIPFLAGS) $@ $(LIBNAME): $(TARGETS) z_zexy.c z_zexy.h @@ -69,7 +69,7 @@ $(LIBNAME): $(TARGETS) z_zexy.c z_zexy.h $(STRIP) $(STRIPFLAGS) $@.$(EXT) $(TARGETS): %.o : %.c - $(CC) $(Z_CFLAGS) -c -o $@ $*.c + $(CC) $(Z_CFLAGS) $(ARCH_FLAG) -c -o $@ $*.c externals: $(OBJECTS) diff --git a/src/configure.ac b/src/configure.ac index c78e0b0..f3647d0 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -137,6 +137,55 @@ dnl Checks for library functions. AC_FUNC_MMAP AC_CHECK_FUNCS(select socket strerror) + +dnl checks for fat-binary +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]) + + # /usr/lib/arch_tool -archify_list $TARGET_ARCHS + ARCH_FLAG= + for archs in $TARGET_ARCHS + do + ARCH_FLAG="$ARCH_FLAG -arch $archs" + done + + if test "x$ARCH_FLAG" != "x"; then + tmp_arch_cflags="$CFLAGS" + AC_CHECK_CFLAGS([$ARCH_FLAG],,ARCH_FLAG="") + CFLAGS="$tmp_arch_cflags" + fi + + if test "x$ARCH_FLAG" != "x"; then + tmp_arch_ldflags="$LDFLAGS" + AC_CHECK_LDFLAGS([$ARCH_FLAG],,ARCH_FLAG="") + LDFLAGS="$tmp_arch_ldflags" + fi +fi +AC_SUBST(ARCH_FLAG) + dnl check for "-mms-bitfields" cflag dnl why is there no generic compiler-check for a given flag ? dnl it would make things so easy: AC_CHECK_FLAG([-mms-bitfields],,) -- cgit v1.2.1