diff options
author | wtc%google.com <devnull@localhost> | 2007-10-31 18:07:38 +0000 |
---|---|---|
committer | wtc%google.com <devnull@localhost> | 2007-10-31 18:07:38 +0000 |
commit | e1a17b1e61ab6fbc17a9a7282294232f9ec6e148 (patch) | |
tree | e4a89f4b38890d4e3212f97797c613eb3937e485 | |
parent | 1d38b3aa4b123f995256ca3ad5d9f319482587ed (diff) | |
download | nspr-hg-e1a17b1e61ab6fbc17a9a7282294232f9ec6e148.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-x | configure | 56 | ||||
-rw-r--r-- | configure.in | 31 |
2 files changed, 55 insertions, 32 deletions
@@ -3384,8 +3384,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 @@ -4388,17 +4396,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:4392: checking for machine/builtins.h" >&5 +echo "configure:4400: 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 4397 "configure" +#line 4405 "configure" #include "confdefs.h" #include <machine/builtins.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4402: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4410: \"$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* @@ -4960,7 +4968,7 @@ case $target in ;; *) echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 -echo "configure:4964: checking for dlopen in -ldl" >&5 +echo "configure:4972: 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 @@ -4968,7 +4976,7 @@ else ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <<EOF -#line 4972 "configure" +#line 4980 "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 @@ -4979,7 +4987,7 @@ int main() { dlopen() ; return 0; } EOF -if { (eval echo configure:4983: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4991: \"$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 @@ -4996,17 +5004,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:5000: checking for dlfcn.h" >&5 +echo "configure:5008: 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 5005 "configure" +#line 5013 "configure" #include "confdefs.h" #include <dlfcn.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5010: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5018: \"$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* @@ -5039,13 +5047,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:5043: checking whether ${CC-cc} needs -traditional" >&5 +echo "configure:5051: 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 5049 "configure" +#line 5057 "configure" #include "confdefs.h" #include <sgtty.h> Autoconf TIOCGETP @@ -5063,7 +5071,7 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext <<EOF -#line 5067 "configure" +#line 5075 "configure" #include "confdefs.h" #include <termio.h> Autoconf TCGETA @@ -5087,12 +5095,12 @@ fi for ac_func in lchown strerror do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:5091: checking for $ac_func" >&5 +echo "configure:5099: 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 5096 "configure" +#line 5104 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -5115,7 +5123,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:5119: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5127: \"$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 @@ -5156,7 +5164,7 @@ hpux*) if test -z "$GNU_CC"; then echo $ac_n "checking for +Olit support""... $ac_c" 1>&6 -echo "configure:5160: checking for +Olit support" >&5 +echo "configure:5168: 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 @@ -5195,7 +5203,7 @@ darwin*) *) echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6 -echo "configure:5199: checking for pthread_create in -lpthreads" >&5 +echo "configure:5207: checking for pthread_create in -lpthreads" >&5 echo " #include <pthread.h> void *foo(void *v) { return v; } @@ -5217,7 +5225,7 @@ echo " echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 -echo "configure:5221: checking for pthread_create in -lpthread" >&5 +echo "configure:5229: checking for pthread_create in -lpthread" >&5 echo " #include <pthread.h> void *foo(void *v) { return v; } @@ -5239,7 +5247,7 @@ echo " echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6 -echo "configure:5243: checking for pthread_create in -lc_r" >&5 +echo "configure:5251: checking for pthread_create in -lc_r" >&5 echo " #include <pthread.h> void *foo(void *v) { return v; } @@ -5261,7 +5269,7 @@ echo " echo "$ac_t""no" 1>&6 echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6 -echo "configure:5265: checking for pthread_create in -lc" >&5 +echo "configure:5273: checking for pthread_create in -lc" >&5 echo " #include <pthread.h> void *foo(void *v) { return v; } @@ -5415,7 +5423,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:5419: checking whether ${CC-cc} accepts -pthread" >&5 +echo "configure:5427: 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 @@ -5438,7 +5446,7 @@ echo "configure:5419: 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:5442: checking whether ${CC-cc} accepts -pthreads" >&5 +echo "configure:5450: 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 005b9351..2c8e12b7 100644 --- a/configure.in +++ b/configure.in @@ -1045,17 +1045,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 |