summaryrefslogtreecommitdiff
path: root/src/configure.in
diff options
context:
space:
mode:
Diffstat (limited to 'src/configure.in')
-rw-r--r--src/configure.in76
1 files changed, 46 insertions, 30 deletions
diff --git a/src/configure.in b/src/configure.in
index 574e2df9e..60609ec8f 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -32,7 +32,7 @@ if test "$GCC" = yes; then
gccversion=`"$CC" --version | sed -e '2,$d;s/^[[^0-9]]*\(darwin.[[^0-9]]*\)*\([[0-9]]\.[[0-9.]]*\).*$/\2/g'`
dnl version 4.0.1 was reported to cause trouble on Macintosh by Marcin Dalecki
if test "$gccversion" = "3.0.1" -o "$gccversion" = "3.0.2" -o "$gccversion" = "4.0.1"; then
- echo 'GCC [34].0.[12] has a bug in the optimizer, disabling "-O#"'
+ echo 'GCC [[34]].0.[[12]] has a bug in the optimizer, disabling "-O#"'
CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-O/'`
else
if test "$gccversion" = "3.1" -o "$gccversion" = "3.2" -o "$gccversion" = "3.2.1" && `echo "$CFLAGS" | grep -v fno-strength-reduce >/dev/null`; then
@@ -105,48 +105,53 @@ if test "`(uname) 2>/dev/null`" = Darwin; then
AC_MSG_CHECKING(--with-mac-arch argument)
AC_ARG_WITH(mac-arch, [ --with-mac-arch=ARCH intel, ppc or both],
MACARCH="$withval"; AC_MSG_RESULT($MACARCH),
- MACARCH="both"; AC_MSG_RESULT(Defaulting to $MACARCH))
+ MACARCH="both"; AC_MSG_RESULT(defaulting to $MACARCH))
if test "x$MACARCH" = "xboth"; then
- AC_MSG_CHECKING(if both architectures are supported)
+ AC_MSG_CHECKING(for 10.4 universal SDK)
+ dnl There is a terrible inconsistency (but we appear to get away with it):
+ dnl $CFLAGS uses the 10.4u SDK library for the headers, while $CPPFLAGS
+ dnl doesn't, because "gcc -E" doesn't grok it. That means the configure
+ dnl tests using the preprocessor are actually done with the wrong header
+ dnl files. $LDFLAGS is set at the end, because configure uses it together
+ dnl with $CFLAGS and we can only have one -sysroot argument.
save_cppflags="$CPPFLAGS"
+ save_cflags="$CFLAGS"
save_ldflags="$LDFLAGS"
- CPPFLAGS="$CPPFLAGS -arch i386 -arch ppc"
- LDFLAGS="$LDFLAGS -arch i386 -arch ppc"
+ CFLAGS="$CFLAGS -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
AC_TRY_LINK([ ], [ ],
- AC_MSG_RESULT(yes),
- AC_MSG_RESULT(no)
- AC_MSG_CHECKING(if Intel architecture is supported)
- CPPFLAGS="$save_cppflags -arch i386"
- LDFLAGS="$save_ldflags -arch i386"
- AC_TRY_LINK([ ], [ ],
- AC_MSG_RESULT(yes); MACARCH="intel",
- AC_MSG_RESULT(no); MACARCH="ppc"))
- CPPFLAGS="$save_cppflags"
- LDFLAGS="$save_ldflags"
- fi
+ AC_MSG_RESULT(found, will make universal binary),
- case "$MACARCH" in
- intel) MAC_OSX_ARCH="-arch i386";;
- both) MAC_OSX_ARCH="-arch i386 -arch ppc";;
- ppc) MAC_OSX_ARCH="-arch ppc";;
- *) MAC_OSX_ARCH="";;
- esac
-
- dnl avoid a bug with -O2 for intel
- if test "$MACARCH" = "intel" -o "$MACARCH" = "both"; then
- CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-O/'`
+ AC_MSG_RESULT(not found)
+ CFLAGS="save_cflags"
+ AC_MSG_CHECKING(if Intel architecture is supported)
+ CPPFLAGS="$CPPFLAGS -arch i386"
+ LDFLAGS="$save_ldflags -arch i386"
+ AC_TRY_LINK([ ], [ ],
+ AC_MSG_RESULT(yes); MACARCH="intel",
+ AC_MSG_RESULT(no, using PowerPC)
+ MACARCH="ppc"
+ CPPFLAGS="$save_cppflags -arch ppc"
+ LDFLAGS="$save_ldflags -arch ppc"))
+ elif test "x$MACARCH" = "xintel"; then
+ CPPFLAGS="$CPPFLAGS -arch intel"
+ LDFLAGS="$LDFLAGS -arch intel"
+ else
+ CPPFLAGS="$CPPFLAGS -arch ppc"
+ LDFLAGS="$LDFLAGS -arch ppc"
fi
- CPPFLAGS="$CPPFLAGS $MAC_OSX_ARCH"
- LDFLAGS="$LDFLAGS $MAC_OSX_ARCH"
-
if test "$enable_darwin" = "yes"; then
MACOSX=yes
OS_EXTRA_SCR="os_macosx.c os_mac_conv.c";
OS_EXTRA_OBJ="objects/os_macosx.o objects/os_mac_conv.o"
dnl TODO: use -arch i386 on Intel machines
- CPPFLAGS="$CPPFLAGS -DMACOS_X_UNIX -I/Developer/Headers/FlatCarbon -no-cpp-precomp"
+ CPPFLAGS="$CPPFLAGS -DMACOS_X_UNIX -no-cpp-precomp"
+ if test "x$MACARCH" = "xboth"; then
+ CPPFLAGS="$CPPFLAGS -I/Developer/SDKs/MacOSX10.4u.sdk/Developer/Headers/FlatCarbon"
+ else
+ CPPFLAGS="$CPPFLAGS -I/Developer/Headers/FlatCarbon"
+ fi
dnl If Carbon is found, assume we don't want X11
dnl unless it was specifically asked for (--with-x)
@@ -159,6 +164,14 @@ if test "`(uname) 2>/dev/null`" = Darwin; then
fi
fi
+ dnl avoid a bug with -O2 for intel
+ if test "$MACARCH" = "intel" -o "$MACARCH" = "both"; then
+ CFLAGS=`echo "$CFLAGS" | sed 's/-O[[23456789]]/-Oz/'`
+ fi
+
+ CPPFLAGS="$CPPFLAGS $MAC_OSX_ARCH"
+ LDFLAGS="$LDFLAGS $MAC_OSX_ARCH"
+
else
AC_MSG_RESULT(no)
fi
@@ -2794,6 +2807,9 @@ if test "x$MACOSX" = "xyes" && test "x$CARBON" = "xyes" \
AC_MSG_RESULT(no)
fi
fi
+if test "x$MACARCH" = "xboth"; then
+ LDFLAGS="$LDFLAGS -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc"
+fi
dnl gcc 3.1 changed the meaning of -MM. The only solution appears to be to
dnl use "-isystem" instead of "-I" for all non-Vim include dirs.