diff options
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 188 |
1 files changed, 91 insertions, 97 deletions
diff --git a/configure.in b/configure.in index f93dbea5..20b3a599 100644 --- a/configure.in +++ b/configure.in @@ -1346,116 +1346,110 @@ case "$target" in PR_MD_CSRCS=darwin.c PR_MD_ASFILES=os_Darwin.s - # Add Mac OS X support for loading CFM & CFBundle plugins - if test -f "${MACOS_SDK_DIR}/System/Library/Frameworks/Carbon.framework/Carbon"; then - AC_DEFINE(XP_MACOSX) - OS_TARGET=MacOSX - - if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then - dnl Use the specified value - export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET - elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then - dnl No value specified on the command line or in the environment, - dnl use the lesser of the library's minimum or the architecture's - dnl minimum. - case "${target_cpu}" in - powerpc*) - dnl Architecture minimum 10.3 - export MACOSX_DEPLOYMENT_TARGET=10.3 - ;; - i*86*) - dnl Architecture minimum 10.4 - export MACOSX_DEPLOYMENT_TARGET=10.4 - ;; - esac - fi + if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then + dnl Use the specified value + export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET + elif test -z "$MACOSX_DEPLOYMENT_TARGET" ; then + dnl No value specified on the command line or in the environment, + dnl use the lesser of the library's minimum or the architecture's + dnl minimum. + case "${target_cpu}" in + powerpc*) + dnl Architecture minimum 10.3 + export MACOSX_DEPLOYMENT_TARGET=10.3 + ;; + i*86*) + dnl Architecture minimum 10.4 + export MACOSX_DEPLOYMENT_TARGET=10.4 + ;; + esac + fi - dnl MACOS_SDK_DIR will be set to the SDK location whenever one is - dnl in use. NEXT_ROOT will be set and exported if it's needed for - dnl ld. + dnl MACOS_SDK_DIR will be set to the SDK location whenever one is + dnl in use. NEXT_ROOT will be set and exported if it's needed for + dnl ld. - if test "$MACOS_SDK_DIR"; then - dnl Sync this section with the one in Mozilla's top level. + if test "$MACOS_SDK_DIR"; then + dnl Sync this section with the one in Mozilla's top level. - if test ! -d "$MACOS_SDK_DIR"; then - AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must + if test ! -d "$MACOS_SDK_DIR"; then + AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must specify a valid SDK. SDKs are installed when the optional cross-development tools are selected during the Xcode/Developer Tools installation.]) - fi + fi - changequote(,) - CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'` - GCC_VERSION_FULL=`echo $CC_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'` - GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'` - changequote([,]) - GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'` - if test "$GCC_VERSION_MAJOR" -lt "4" ; then - SDK_C_FRAMEWORK="-F${MACOS_SDK_DIR}/System/Library/Frameworks" - if test -d "${MACOS_SDK_DIR}/Library/Frameworks" ; then - SDK_C_FRAMEWORK="$SDK_C_FRAMEWORK -F${MACOS_SDK_DIR}/Library/Frameworks" - fi + changequote(,) + CC_VERSION=`$CC -v 2>&1 | grep 'gcc version'` + GCC_VERSION_FULL=`echo $CC_VERSION | $PERL -pe 's/^.*gcc version ([^ ]*).*/$1/'` + GCC_VERSION=`echo $GCC_VERSION_FULL | $PERL -pe '(split(/\./))[0]>=4&&s/(^\d*\.\d*).*/$1/;'` + changequote([,]) + GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'` + if test "$GCC_VERSION_MAJOR" -lt "4" ; then + SDK_C_FRAMEWORK="-F${MACOS_SDK_DIR}/System/Library/Frameworks" + if test -d "${MACOS_SDK_DIR}/Library/Frameworks" ; then + SDK_C_FRAMEWORK="$SDK_C_FRAMEWORK -F${MACOS_SDK_DIR}/Library/Frameworks" + fi - SDK_C_INCLUDE="-isystem ${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION} -isystem ${MACOS_SDK_DIR}/usr/include ${SDK_C_FRAMEWORK}" + SDK_C_INCLUDE="-isystem ${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION} -isystem ${MACOS_SDK_DIR}/usr/include ${SDK_C_FRAMEWORK}" - CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}" + CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}" - dnl CPP needs to be set for AC_CHECK_HEADER. - CPP="$CPP -nostdinc ${SDK_C_INCLUDE}" + dnl CPP needs to be set for AC_CHECK_HEADER. + CPP="$CPP -nostdinc ${SDK_C_INCLUDE}" - changequote(,) - HOST_DARWIN_MAJOR=`echo "$build_os" | sed -E -e 's/^darwin([0-9]+).*$/\1/'` - changequote([,]) - if test "$HOST_DARWIN_MAJOR" -lt 9 ; then - dnl The build host is running Tiger (10.4) or earlier. - dnl ld support for -syslibroot is compiler-agnostic, but - dnl only available on Tiger and later. On Tiger and - dnl earlier build hosts, just rely on NEXT_ROOT, because - dnl it's not been shown to cause any problems. - MACOS_SDK_LIBS="-L${MACOS_SDK_DIR}/usr/lib/gcc/darwin -L${MACOS_SDK_DIR}/usr/lib/gcc/darwin/${GCC_VERSION_FULL} -L${MACOS_SDK_DIR}/usr/lib ${SDK_C_FRAMEWORK}" - else - dnl The build host is running Leopard (10.5) or later. - dnl With NEXT_ROOT set, the linker will still not apply - dnl it when resolving dependencies. This causes problems - dnl on Leopard, where an SDK depends on frameworks which - dnl were present in earlier OS releases (and the associated - dnl SDK) but not in Leopard. -syslibroot does not have - dnl this problem, but it results in harmless warnings when - dnl NEXT_ROOT is set. NEXT_ROOT needs to remain set even - dnl on Leopard because the compiler uses it too. - MACOS_SDK_LIBS="-Wl,-syslibroot,${MACOS_SDK_DIR}" - fi + changequote(,) + HOST_DARWIN_MAJOR=`echo "$build_os" | sed -E -e 's/^darwin([0-9]+).*$/\1/'` + changequote([,]) + if test "$HOST_DARWIN_MAJOR" -lt 9 ; then + dnl The build host is running Tiger (10.4) or earlier. + dnl ld support for -syslibroot is compiler-agnostic, but + dnl only available on Tiger and later. On Tiger and + dnl earlier build hosts, just rely on NEXT_ROOT, because + dnl it's not been shown to cause any problems. + MACOS_SDK_LIBS="-L${MACOS_SDK_DIR}/usr/lib/gcc/darwin -L${MACOS_SDK_DIR}/usr/lib/gcc/darwin/${GCC_VERSION_FULL} -L${MACOS_SDK_DIR}/usr/lib ${SDK_C_FRAMEWORK}" + else + dnl The build host is running Leopard (10.5) or later. + dnl With NEXT_ROOT set, the linker will still not apply + dnl it when resolving dependencies. This causes problems + dnl on Leopard, where an SDK depends on frameworks which + dnl were present in earlier OS releases (and the associated + dnl SDK) but not in Leopard. -syslibroot does not have + dnl this problem, but it results in harmless warnings when + dnl NEXT_ROOT is set. NEXT_ROOT needs to remain set even + dnl on Leopard because the compiler uses it too. + MACOS_SDK_LIBS="-Wl,-syslibroot,${MACOS_SDK_DIR}" + fi - LDFLAGS="${MACOS_SDK_LIBS} $LDFLAGS" - export NEXT_ROOT=$MACOS_SDK_DIR + LDFLAGS="${MACOS_SDK_LIBS} $LDFLAGS" + export NEXT_ROOT=$MACOS_SDK_DIR - if test -n "$CROSS_COMPILE" ; then - dnl NEXT_ROOT will be in the environment, but it - dnl shouldn't be set for the build host. HOST_CXX is - dnl presently unused. - HOST_CC="NEXT_ROOT= $HOST_CC" - HOST_CXX="NEXT_ROOT= $HOST_CXX" - fi + if test -n "$CROSS_COMPILE" ; then + dnl NEXT_ROOT will be in the environment, but it + dnl shouldn't be set for the build host. HOST_CXX is + dnl presently unused. + HOST_CC="NEXT_ROOT= $HOST_CC" + HOST_CXX="NEXT_ROOT= $HOST_CXX" + fi + else + dnl gcc >= 4.0 uses different paths than above, but knows + dnl how to find them itself. + CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}" + + dnl CPP needs to be set for AC_CHECK_HEADER. + CPP="$CPP -isysroot ${MACOS_SDK_DIR}" + + dnl If gcc >= 4.0.0, we're guaranteed to be on Tiger, which + dnl has an ld that supports -syslibroot. Don't set + dnl NEXT_ROOT because it will be ignored and cause + dnl warnings when -syslibroot is specified. + if test "$GCC_VERSION_FULL" != "4.0.0" ; then + dnl gcc > 4.0.0 will pass -syslibroot to ld automatically + dnl based on the -isysroot it receives. + LDFLAGS="$LDFLAGS -isysroot ${MACOS_SDK_DIR}" else - dnl gcc >= 4.0 uses different paths than above, but knows - dnl how to find them itself. - CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}" - - dnl CPP needs to be set for AC_CHECK_HEADER. - CPP="$CPP -isysroot ${MACOS_SDK_DIR}" - - dnl If gcc >= 4.0.0, we're guaranteed to be on Tiger, which - dnl has an ld that supports -syslibroot. Don't set - dnl NEXT_ROOT because it will be ignored and cause - dnl warnings when -syslibroot is specified. - if test "$GCC_VERSION_FULL" != "4.0.0" ; then - dnl gcc > 4.0.0 will pass -syslibroot to ld automatically - dnl based on the -isysroot it receives. - LDFLAGS="$LDFLAGS -isysroot ${MACOS_SDK_DIR}" - else - dnl gcc 4.0.0 doesn't pass -syslibroot to ld, it needs - dnl to be explicit. - LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}" - fi + dnl gcc 4.0.0 doesn't pass -syslibroot to ld, it needs + dnl to be explicit. + LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}" fi fi fi |