summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwtc%google.com <devnull@localhost>2007-10-31 17:56:18 +0000
committerwtc%google.com <devnull@localhost>2007-10-31 17:56:18 +0000
commitc3114c19b9bbbd33fc9d273ede1e23f0f478a9d8 (patch)
tree3cbf678fec02ceab21263e067056231fca77bf43
parent6fdac34876c9a5b4ecd7e8656477c911a018291d (diff)
downloadnspr-hg-c3114c19b9bbbd33fc9d273ede1e23f0f478a9d8.tar.gz
Bug 401768: enable us to build with gcc 3.3 and an SDK on Mac OS X 10.5
Leopard. The patch is contributed by Mark Mentovai <mark@moxienet.com>. r=wtc.
-rwxr-xr-xconfigure56
-rw-r--r--configure.in31
2 files changed, 55 insertions, 32 deletions
diff --git a/configure b/configure
index 2cd5974a..2857448e 100755
--- a/configure
+++ b/configure
@@ -3397,8 +3397,16 @@ tools are selected during the Xcode/Developer Tools installation." 1>&2; exit 1;
CPP="$CPP -nostdinc ${SDK_C_INCLUDE}"
- 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}"
- LDFLAGS="${MACOS_SDK_LIBS} $LDFLAGS"
+
+ HOST_DARWIN_MAJOR=`echo "$build_os" | sed -E -e 's/^darwin([0-9]+).*$/\1/'`
+
+ if test "$HOST_DARWIN_MAJOR" -lt 9 ; then
+ 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
+ MACOS_SDK_LIBS="-Wl,-syslibroot,${MACOS_SDK_DIR}"
+ fi
+
+ LDFLAGS="${MACOS_SDK_LIBS} $LDFLAGS"
DSO_LDOPTS="${MACOS_SDK_LIBS} $DSO_LDOPTS"
export NEXT_ROOT=$MACOS_SDK_DIR
@@ -4463,17 +4471,17 @@ EOF
_OPTIMIZE_FLAGS="$_OPTIMIZE_FLAGS -Olimit 4000"
ac_safe=`echo "machine/builtins.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for machine/builtins.h""... $ac_c" 1>&6
-echo "configure:4470: checking for machine/builtins.h" >&5
+echo "configure:4475: checking for machine/builtins.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4475 "configure"
+#line 4480 "configure"
#include "confdefs.h"
#include <machine/builtins.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4480: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4485: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -5043,7 +5051,7 @@ case $target in
;;
*)
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:5050: checking for dlopen in -ldl" >&5
+echo "configure:5055: checking for dlopen in -ldl" >&5
ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -5051,7 +5059,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5058 "configure"
+#line 5063 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -5062,7 +5070,7 @@ int main() {
dlopen()
; return 0; }
EOF
-if { (eval echo configure:5069: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5074: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -5079,17 +5087,17 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
echo "$ac_t""yes" 1>&6
ac_safe=`echo "dlfcn.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for dlfcn.h""... $ac_c" 1>&6
-echo "configure:5086: checking for dlfcn.h" >&5
+echo "configure:5091: checking for dlfcn.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5091 "configure"
+#line 5096 "configure"
#include "confdefs.h"
#include <dlfcn.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5096: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5101: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -5122,13 +5130,13 @@ esac
if test $ac_cv_prog_gcc = yes; then
echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:5129: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:5134: checking whether ${CC-cc} needs -traditional" >&5
if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_pattern="Autoconf.*'x'"
cat > conftest.$ac_ext <<EOF
-#line 5135 "configure"
+#line 5140 "configure"
#include "confdefs.h"
#include <sgtty.h>
Autoconf TIOCGETP
@@ -5146,7 +5154,7 @@ rm -f conftest*
if test $ac_cv_prog_gcc_traditional = no; then
cat > conftest.$ac_ext <<EOF
-#line 5153 "configure"
+#line 5158 "configure"
#include "confdefs.h"
#include <termio.h>
Autoconf TCGETA
@@ -5170,12 +5178,12 @@ fi
for ac_func in lchown strerror
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5177: checking for $ac_func" >&5
+echo "configure:5182: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 5182 "configure"
+#line 5187 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -5198,7 +5206,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:5205: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5210: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -5239,7 +5247,7 @@ hpux*)
if test -z "$GNU_CC"; then
echo $ac_n "checking for +Olit support""... $ac_c" 1>&6
-echo "configure:5246: checking for +Olit support" >&5
+echo "configure:5251: checking for +Olit support" >&5
if eval "test \"`echo '$''{'ac_cv_hpux_usable_olit_option'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -5278,7 +5286,7 @@ darwin*)
*)
echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6
-echo "configure:5285: checking for pthread_create in -lpthreads" >&5
+echo "configure:5290: checking for pthread_create in -lpthreads" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@@ -5300,7 +5308,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
-echo "configure:5307: checking for pthread_create in -lpthread" >&5
+echo "configure:5312: checking for pthread_create in -lpthread" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@@ -5322,7 +5330,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6
-echo "configure:5329: checking for pthread_create in -lc_r" >&5
+echo "configure:5334: checking for pthread_create in -lc_r" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@@ -5344,7 +5352,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6
-echo "configure:5351: checking for pthread_create in -lc" >&5
+echo "configure:5356: checking for pthread_create in -lc" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@@ -5498,7 +5506,7 @@ if test -n "$USE_PTHREADS"; then
rm -f conftest*
ac_cv_have_dash_pthread=no
echo $ac_n "checking whether ${CC-cc} accepts -pthread""... $ac_c" 1>&6
-echo "configure:5505: checking whether ${CC-cc} accepts -pthread" >&5
+echo "configure:5510: checking whether ${CC-cc} accepts -pthread" >&5
echo 'int main() { return 0; }' | cat > conftest.c
${CC-cc} -pthread -o conftest conftest.c > conftest.out 2>&1
if test $? -eq 0; then
@@ -5521,7 +5529,7 @@ echo "configure:5505: checking whether ${CC-cc} accepts -pthread" >&5
ac_cv_have_dash_pthreads=no
if test "$ac_cv_have_dash_pthread" = "no"; then
echo $ac_n "checking whether ${CC-cc} accepts -pthreads""... $ac_c" 1>&6
-echo "configure:5528: checking whether ${CC-cc} accepts -pthreads" >&5
+echo "configure:5533: checking whether ${CC-cc} accepts -pthreads" >&5
echo 'int main() { return 0; }' | cat > conftest.c
${CC-cc} -pthreads -o conftest conftest.c > conftest.out 2>&1
if test $? -eq 0; then
diff --git a/configure.in b/configure.in
index 10908eb4..a54fba61 100644
--- a/configure.in
+++ b/configure.in
@@ -1055,17 +1055,32 @@ tools are selected during the Xcode/Developer Tools installation.])
dnl CPP needs to be set for AC_CHECK_HEADER.
CPP="$CPP -nostdinc ${SDK_C_INCLUDE}"
- dnl ld support for -syslibroot is compiler-agnostic, but only
- dnl available on Tiger. Although it's possible to switch on
- dnl the build host's OS release to use ld -syslibroot when
- dnl available, ld -syslibroot cause warnings as long as
- dnl NEXT_ROOT is set. NEXT_ROOT should be set because both
- dnl both the compiler and linker use it.
- dnl
+ 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
+
dnl LDFLAGS is for the utilities built in config (now and
dnl nsinstall). DSO_LDOPTS is used when linking shared
dnl libraries.
- 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}"
LDFLAGS="${MACOS_SDK_LIBS} $LDFLAGS"
DSO_LDOPTS="${MACOS_SDK_LIBS} $DSO_LDOPTS"
export NEXT_ROOT=$MACOS_SDK_DIR