aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2009-04-07 16:55:10 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2009-04-07 16:55:10 +0000
commit0c7a029ed490e46ef192284d77eabbe22f5dfdf9 (patch)
tree8acecb710eaf12d44b9f8a9b7aca7a91ca465283
parente4982423e8f19640229df3009faea04a64ed676e (diff)
added checks for fat-binaries; LATER check whether this actually works
svn path=/trunk/externals/zexy/; revision=10970
-rw-r--r--src/Make.config.in9
-rw-r--r--src/Makefile4
-rw-r--r--src/configure.ac49
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],,)