summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcls%seawood.org <devnull@localhost>2005-06-01 13:35:24 +0000
committercls%seawood.org <devnull@localhost>2005-06-01 13:35:24 +0000
commita2b265119f0bff4ac14fa4c1def01592b02151c6 (patch)
tree269816dd9b77bf75949349e95867636907d50ee8
parent9a7aa641e4d235a59fc825e311454932316a5e5b (diff)
downloadnspr-hg-a2b265119f0bff4ac14fa4c1def01592b02151c6.tar.gz
Update SDK support to build on OSX 10.4 (Tiger)
Thanks to Mark Mentovai <mark@moxienet.com> for the patch. Bug #292530 r=wtc a=brendan
-rwxr-xr-xconfigure76
-rw-r--r--configure.in45
2 files changed, 93 insertions, 28 deletions
diff --git a/configure b/configure
index f3b0ffd6..d70b31aa 100755
--- a/configure
+++ b/configure
@@ -3315,10 +3315,36 @@ EOF
fi
- # do the right thing for panther SDK support
+ # do the right thing for SDK support
if test "$NEXT_ROOT"; then
- CFLAGS="-I${NEXT_ROOT}/usr/include $CFLAGS"
- CXXFLAGS="-I${NEXT_ROOT}/usr/include $CXXFLAGS"
+
+
+
+ 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/;'`
+
+ GCC_VERSION_MAJOR=`echo $GCC_VERSION_FULL | $PERL -pe 's/(^\d*).*/$1/;'`
+
+ if test "$GCC_VERSION_MAJOR" -lt "4" ; then
+ TARGET_ARCH_LIB="darwin"
+ TARGET_ARCH_INCLUDE="ppc-darwin"
+ SDK_C_INCLUDE="-isystem ${NEXT_ROOT}/usr/include/gcc/darwin/${GCC_VERSION} -isystem ${NEXT_ROOT}/usr/include -F${NEXT_ROOT}/System/Library/Frameworks"
+ else
+ TARGET_ARCH_LIB=powerpc-apple-darwin`echo $NEXT_ROOT | $PERL -pe 's/MacOSX10\.(^\.*)//;if ($1) {$_=$1+4;} else {$_="'${target_os}'";s/(\d+)//;$_=$1;}'`
+ TARGET_ARCH_INCLUDE=$TARGET_ARCH_LIB
+ SDK_C_INCLUDE="-isystem ${NEXT_ROOT}/usr/lib/gcc/${TARGET_ARCH_LIB}/${GCC_VERSION_FULL}/include -isystem ${NEXT_ROOT}/usr/include -F${NEXT_ROOT}/System/Library/Frameworks"
+ fi
+
+ if test -d "${NEXT_ROOT}/Library/Frameworks" ; then
+ SDK_C_INCLUDE="$SDK_C_INCLUDE -F${NEXT_ROOT}/Library/Frameworks"
+ fi
+
+ CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}"
+
+ CPP="$CPP -nostdinc ${SDK_C_INCLUDE}"
+
+ OS_LIBS="-L${NEXT_ROOT}/usr/lib/gcc/${TARGET_ARCH_LIB} -L${NEXT_ROOT}/usr/lib/gcc/${TARGET_ARCH_LIB}/${GCC_VERSION_FULL} -L${NEXT_ROOT}/usr/lib $OS_LIBS"
fi
;;
@@ -4288,17 +4314,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:4292: checking for machine/builtins.h" >&5
+echo "configure:4318: 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 4297 "configure"
+#line 4323 "configure"
#include "confdefs.h"
#include <machine/builtins.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4302: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4328: \"$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*
@@ -4840,7 +4866,7 @@ case $target in
;;
*)
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:4844: checking for dlopen in -ldl" >&5
+echo "configure:4870: 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
@@ -4848,7 +4874,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4852 "configure"
+#line 4878 "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
@@ -4859,7 +4885,7 @@ int main() {
dlopen()
; return 0; }
EOF
-if { (eval echo configure:4863: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:4889: \"$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
@@ -4876,17 +4902,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:4880: checking for dlfcn.h" >&5
+echo "configure:4906: 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 4885 "configure"
+#line 4911 "configure"
#include "confdefs.h"
#include <dlfcn.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4890: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4916: \"$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*
@@ -4919,13 +4945,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:4923: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:4949: 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 4929 "configure"
+#line 4955 "configure"
#include "confdefs.h"
#include <sgtty.h>
Autoconf TIOCGETP
@@ -4943,7 +4969,7 @@ rm -f conftest*
if test $ac_cv_prog_gcc_traditional = no; then
cat > conftest.$ac_ext <<EOF
-#line 4947 "configure"
+#line 4973 "configure"
#include "confdefs.h"
#include <termio.h>
Autoconf TCGETA
@@ -4967,12 +4993,12 @@ fi
for ac_func in lchown strerror
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4971: checking for $ac_func" >&5
+echo "configure:4997: 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 4976 "configure"
+#line 5002 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4995,7 +5021,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:4999: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5025: \"$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
@@ -5036,7 +5062,7 @@ hpux*)
if test -z "$GNU_CC"; then
echo $ac_n "checking for +Olit support""... $ac_c" 1>&6
-echo "configure:5040: checking for +Olit support" >&5
+echo "configure:5066: 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
@@ -5070,7 +5096,7 @@ esac
echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6
-echo "configure:5074: checking for pthread_create in -lpthreads" >&5
+echo "configure:5100: checking for pthread_create in -lpthreads" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@@ -5092,7 +5118,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
-echo "configure:5096: checking for pthread_create in -lpthread" >&5
+echo "configure:5122: checking for pthread_create in -lpthread" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@@ -5114,7 +5140,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6
-echo "configure:5118: checking for pthread_create in -lc_r" >&5
+echo "configure:5144: checking for pthread_create in -lc_r" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@@ -5136,7 +5162,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6
-echo "configure:5140: checking for pthread_create in -lc" >&5
+echo "configure:5166: checking for pthread_create in -lc" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@@ -5288,7 +5314,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:5292: checking whether ${CC-cc} accepts -pthread" >&5
+echo "configure:5318: 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
@@ -5311,7 +5337,7 @@ echo "configure:5292: 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:5315: checking whether ${CC-cc} accepts -pthreads" >&5
+echo "configure:5341: 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 aa3b7669..9fe95464 100644
--- a/configure.in
+++ b/configure.in
@@ -953,10 +953,49 @@ case "$target" in
AC_DEFINE_UNQUOTED(MACOS_DEPLOYMENT_TARGET, $MACOS_DEPLOYMENT_TARGET)
fi
- # do the right thing for panther SDK support
+ # do the right thing for SDK support
if test "$NEXT_ROOT"; then
- CFLAGS="-I${NEXT_ROOT}/usr/include $CFLAGS"
- CXXFLAGS="-I${NEXT_ROOT}/usr/include $CXXFLAGS"
+ dnl Synced to the MACOS_SDK_DIR block in Mozilla's top-level
+ dnl configure.in
+
+ dnl Current known valid versions for GCC_VERSION are 2.95.2 3.1 3.3 4.0.
+ dnl 4.0 identifies itself as 4.0.x, so strip the decidecimal for
+ dnl the environment and includedir purposes (when using an SDK, below),
+ dnl but remember the full version number for the libdir (SDK).
+
+ 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
+ TARGET_ARCH_LIB="darwin"
+ TARGET_ARCH_INCLUDE="ppc-darwin"
+ SDK_C_INCLUDE="-isystem ${NEXT_ROOT}/usr/include/gcc/darwin/${GCC_VERSION} -isystem ${NEXT_ROOT}/usr/include -F${NEXT_ROOT}/System/Library/Frameworks"
+ else
+ dnl If gcc >= 4, use powerpc-apple-darwin#, where # is the version
+ dnl of the Darwin release corresponding to the target Mac OS X
+ dnl release. For OS X >= 10.1.1, take the minor version number and
+ dnl add 4 to get the Darwin major version number. If it can't be
+ dnl determined, use current Darwin major version number and hope
+ dnl that there's a symlink.
+ TARGET_ARCH_LIB=powerpc-apple-darwin`echo $NEXT_ROOT | $PERL -pe 's/MacOSX10\.([^\.]*)//;if ($1) {$_=$1+4;} else {$_="'${target_os}'";s/(\d+)//;$_=$1;}'`
+ TARGET_ARCH_INCLUDE=$TARGET_ARCH_LIB
+ SDK_C_INCLUDE="-isystem ${NEXT_ROOT}/usr/lib/gcc/${TARGET_ARCH_LIB}/${GCC_VERSION_FULL}/include -isystem ${NEXT_ROOT}/usr/include -F${NEXT_ROOT}/System/Library/Frameworks"
+ fi
+
+ if test -d "${NEXT_ROOT}/Library/Frameworks" ; then
+ SDK_C_INCLUDE="$SDK_C_INCLUDE -F${NEXT_ROOT}/Library/Frameworks"
+ fi
+
+ CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}"
+
+ dnl CPP needs to be set for AC_CHECK_HEADER.
+ CPP="$CPP -nostdinc ${SDK_C_INCLUDE}"
+
+ OS_LIBS="-L${NEXT_ROOT}/usr/lib/gcc/${TARGET_ARCH_LIB} -L${NEXT_ROOT}/usr/lib/gcc/${TARGET_ARCH_LIB}/${GCC_VERSION_FULL} -L${NEXT_ROOT}/usr/lib $OS_LIBS"
fi
;;