Bug 697881 - Fall back to gcc on darwin if there's no gcc-4.2. r=ted

Since Bug 513353, we've defaulted to gcc-4.2 on darwin.
Unfortunately the default was unconditional, and while
XCode 4.1 provided a gcc-4.2 alias, XCode 4.2 does not,
although 'gcc' is llvm-gcc 4.2.1. As such, the configure
script immediately fails.

The patch still prefers gcc-4.2, but falls back to plain
gcc if it's not available.

Note that we try $CC and $CXX from the environment first
so it is still possible to override this default.
This commit is contained in:
Ralph Giles 2011-12-18 20:20:28 +01:00
parent 7d233af147
commit 1ea8cea5fd
2 changed files with 9 additions and 6 deletions

View File

@ -180,7 +180,7 @@ then
fi
MOZ_BUILD_ROOT=`pwd`
dnl Default to MSVC for win32 and gcc-4.2 for darwin
dnl Default to MSVC for win32 and gcc for darwin
dnl ==============================================================
if test -z "$CROSS_COMPILE"; then
case "$target" in
@ -203,8 +203,10 @@ case "$target" in
if test -z "$MIDL"; then MIDL=midl; fi
;;
*-darwin*)
if test -z "$CC"; then CC=gcc-4.2; fi
if test -z "$CXX"; then CXX=g++-4.2; fi
# we prefer gcc-4.2 over gcc on older darwin, so
# use that specific version if it's available.
MOZ_PATH_PROGS(CC, $CC gcc-4.2 gcc)
MOZ_PATH_PROGS(CXX, $CXX g++-4.2 g++)
;;
esac
fi

View File

@ -173,7 +173,7 @@ MOZ_ARG_WITH_STRING(dist-dir,
TOP_DIST=dist)
AC_SUBST(TOP_DIST)
dnl Default to MSVC for win32 and gcc-4.2 for darwin
dnl Default to MSVC for win32
dnl ==============================================================
if test -z "$CROSS_COMPILE"; then
case "$target" in
@ -196,8 +196,9 @@ case "$target" in
if test -z "$MIDL"; then MIDL=midl; fi
;;
*-darwin*)
if test -z "$CC"; then CC=gcc-4.2; fi
if test -z "$CXX"; then CXX=g++-4.2; fi
# prefer gcc-4.2 to default cc on older xcode
MOZ_PATH_PROGS(CC, $CC gcc-4.2 gcc)
MOZ_PATH_PROGS(CXX, $CXX g++-4.2 g++)
;;
esac
fi