From 6b13775de2b03e564b1dd3a31582fb017a6e88fa Mon Sep 17 00:00:00 2001 From: Ralph Giles Date: Sun, 18 Dec 2011 20:20:28 +0100 Subject: [PATCH] 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. --- configure.in | 8 +++++--- js/src/configure.in | 7 ++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/configure.in b/configure.in index 8fb0cbf379b0..429145e24126 100644 --- a/configure.in +++ b/configure.in @@ -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 diff --git a/js/src/configure.in b/js/src/configure.in index 826245067a1f..deec156ed5d8 100644 --- a/js/src/configure.in +++ b/js/src/configure.in @@ -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