diff options
Diffstat (limited to 'configure.in')
-rw-r--r-- | configure.in | 288 |
1 files changed, 193 insertions, 95 deletions
diff --git a/configure.in b/configure.in index 3b2d9780..98295583 100644 --- a/configure.in +++ b/configure.in @@ -1,38 +1,43 @@ dnl -*- Mode: Autoconf; tab-width: 4; indent-tabs-mode: nil; -*- dnl -dnl The contents of this file are subject to the Mozilla Public -dnl License Version 1.1 (the "License"); you may not use this file -dnl except in compliance with the License. You may obtain a copy of -dnl the License at http://www.mozilla.org/MPL/ -dnl -dnl Software distributed under the License is distributed on an "AS -dnl IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -dnl implied. See the License for the specific language governing -dnl rights and limitations under the License. -dnl +dnl ***** BEGIN LICENSE BLOCK ***** +dnl Version: MPL 1.1/GPL 2.0/LGPL 2.1 +dnl +dnl The contents of this file are subject to the Mozilla Public License Version +dnl 1.1 (the "License"); you may not use this file except in compliance with +dnl the License. You may obtain a copy of the License at +dnl http://www.mozilla.org/MPL/ +dnl +dnl Software distributed under the License is distributed on an "AS IS" basis, +dnl WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +dnl for the specific language governing rights and limitations under the +dnl License. +dnl dnl The Original Code is the Netscape Portable Runtime (NSPR). -dnl -dnl The Initial Developer of the Original Code is Netscape -dnl Communications Corporation. Portions created by Netscape are -dnl Copyright (C) 1998o-2000 Netscape Communications Corporation. All -dnl Rights Reserved. -dnl +dnl +dnl The Initial Developer of the Original Code is +dnl Netscape Communications Corporation. +dnl Portions created by the Initial Developer are Copyright (C) 1998 +dnl the Initial Developer. All Rights Reserved. +dnl dnl Contributor(s): -dnl Christopher Seawood <cls@seawood.org> -dnl Howard Chu <hyc@symas.com> -dnl -dnl Alternatively, the contents of this file may be used under the -dnl terms of the GNU General Public License Version 2 or later (the -dnl "GPL"), in which case the provisions of the GPL are applicable -dnl instead of those above. If you wish to allow use of your -dnl version of this file only under the terms of the GPL and not to -dnl allow others to use your version of this file under the MPL, -dnl indicate your decision by deleting the provisions above and -dnl replace them with the notice and other provisions required by -dnl the GPL. If you do not delete the provisions above, a recipient -dnl may use your version of this file under either the MPL or the -dnl GPL. -dnl +dnl Christopher Seawood <cls@seawood.org> +dnl Howard Chu <hyc@symas.com> +dnl Mark Mentovai <mark@moxienet.com> +dnl +dnl Alternatively, the contents of this file may be used under the terms of +dnl either the GNU General Public License Version 2 or later (the "GPL"), or +dnl the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +dnl in which case the provisions of the GPL or the LGPL are applicable instead +dnl of those above. If you wish to allow use of your version of this file only +dnl under the terms of either the GPL or the LGPL, and not to allow others to +dnl use your version of this file under the terms of the MPL, indicate your +dnl decision by deleting the provisions above and replace them with the notice +dnl and other provisions required by the GPL or the LGPL. If you do not delete +dnl the provisions above, a recipient may use your version of this file under +dnl the terms of any one of the MPL, the GPL or the LGPL. +dnl +dnl ***** END LICENSE BLOCK ***** AC_PREREQ(2.12) AC_INIT(config/libc_r.h) @@ -45,7 +50,7 @@ dnl = Defaults dnl ======================================================== MOD_MAJOR_VERSION=4 MOD_MINOR_VERSION=6 -MOD_PATCH_VERSION=1 +MOD_PATCH_VERSION=7 NSPR_MODNAME=nspr20 _HAVE_PTHREADS= USE_PTHREADS= @@ -69,6 +74,8 @@ NOSUCHFILE=/no-such-file LIBNSPR='-L$(dist_libdir) -lnspr$(MOD_MAJOR_VERSION)' LIBPLC='-L$(dist_libdir) -lplc$(MOD_MAJOR_VERSION)' CYGWIN_WRAPPER= +MACOS_SDK_DIR= +NEXT_ROOT= dnl Link in libraries necessary to resolve all symbols for shared libs RESOLVE_LINK_SYMBOLS= @@ -226,6 +233,13 @@ AC_ARG_ENABLE(mdupdate, USE_MDUPDATE=1 fi ]) +dnl ======================================================== +dnl = Mac OS X SDK support +dnl ======================================================== +AC_ARG_WITH(macos-sdk, + [ --with-macos-sdk=dir Location of platform SDK to use (Mac OS X only)], + MACOS_SDK_DIR=$withval) + AC_ARG_ENABLE(macos-target, [ --enable-macos-target=VER Set the minimum MacOS version needed at runtime @@ -402,12 +416,37 @@ if test "$target" != "$host"; then CFLAGS=$_SAVE_CFLAGS LDFLAGS=$_SAVE_LDFLAGS + case "$build:$target" in + powerpc-apple-darwin8*:i?86-apple-darwin*) + dnl The Darwin cross compiler doesn't necessarily point itself at a + dnl root that has libraries for the proper architecture, it defaults + dnl to the system root. The libraries in the system root on current + dnl versions of PPC OS X 10.4 aren't fat, so these target compiler + dnl checks will fail. Fake a working SDK in that case. + _SAVE_CFLAGS=$CFLAGS + _SAVE_CXXFLAGS=$CXXLAGS + CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CFLAGS" + CXXFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk $CXXFLAGS" + ;; + esac + AC_CHECK_PROGS(CC, $CC "${target_alias}-gcc" "${target}-gcc", echo) unset ac_cv_prog_CC AC_PROG_CC AC_CHECK_PROGS(CXX, $CXX "${target_alias}-g++" "${target}-g++", echo) unset ac_cv_prog_CXX AC_PROG_CXX + + case "$build:$target" in + powerpc-apple-darwin8*:i?86-apple-darwin*) + dnl Revert the changes made above. From this point on, the target + dnl compiler will never be used without applying the SDK to CFLAGS + dnl (see --with-macos-sdk below). + CFLAGS=$_SAVE_CFLAGS + CXXFLAGS=$_SAVE_CXXFLAGS + ;; + esac + AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", echo) AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", echo) AC_CHECK_PROGS(AS, $AS "${target_alias}-as" "${target}-as", echo) @@ -448,6 +487,15 @@ if test "`echo | $AS -v 2>&1 | grep -c GNU`" != "0"; then fi rm -f a.out +case "$build:$target" in + i?86-apple-darwin*:powerpc-apple-darwin*) + dnl cross_compiling will have erroneously been set to "no" in this + dnl case, because the x86 build host is able to run ppc code in a + dnl translated environment, making a cross compiler appear native. + cross_compiling=yes + ;; +esac + if test "$cross_compiling" = "yes"; then CROSS_COMPILE=1 else @@ -581,6 +629,7 @@ if test -n "$CROSS_COMPILE"; then linux*) OS_ARCH=Linux ;; solaris*) OS_ARCH=SunOS OS_RELEASE=5 ;; mingw*) OS_ARCH=WINNT ;; + darwin*) OS_ARCH=Darwin ;; esac else OS_ARCH=`uname -s | sed -e 's|/|_|g'` @@ -917,26 +966,28 @@ case "$target" in AC_DEFINE(DARWIN) AC_DEFINE(HAVE_BSD_FLOCK) CFLAGS="$CFLAGS -Wmost -fno-common" - if echo $OS_TEST | grep -c 86 2>/dev/null; then - AC_DEFINE(i386) - CPU_ARCH=i386 - else - AC_DEFINE(ppc) - CPU_ARCH=ppc - fi + case "${target_cpu}" in + i*86*) + AC_DEFINE(i386) + CPU_ARCH=i386 + PR_MD_ASFILES=os_Darwin_x86.s + ;; + *) + AC_DEFINE(ppc) + CPU_ARCH=ppc + PR_MD_ASFILES=os_Darwin_ppc.s + ;; + esac DSO_CFLAGS=-fPIC DSO_LDOPTS='-dynamiclib -compatibility_version 1 -current_version 1 -all_load -install_name @executable_path/$@ -headerpad_max_install_names' # Use the standard preprocessor (cpp) CFLAGS="$CFLAGS -no-cpp-precomp" - MKSHLIB='$(CC) -arch $(CPU_ARCH) $(DSO_LDOPTS) -o $@' + MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@' STRIP="$STRIP -x -S" DLL_SUFFIX=dylib USE_PTHREADS=1 MDCPUCFG_H=_darwin.cfg PR_MD_CSRCS=darwin.c - if test "$CPU_ARCH" = "ppc"; then - PR_MD_ASFILES=os_Darwin_ppc.s - fi # Add Mac OS X support for loading CFM & CFBundle plugins if test -f /System/Library/Frameworks/Carbon.framework/Carbon; then @@ -961,52 +1012,89 @@ case "$target" in ;; esac fi - fi - # do the right thing for SDK support - if test "$NEXT_ROOT"; then - 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 - dnl gcc < 4.0 only supports PowerPC, OK to hard-code - 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 cpu-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=${target_cpu}-${target_vendor}-darwin`echo $NEXT_ROOT | $PERL -pe 's/MacOSX10\.([\d]*)//;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 + dnl MACOS_SDK_DIR will be set to the SDK location whenever one is + dnl in use. NEXT_ROOT will be set and exported if it's needed for + dnl ld. - if test -d "${NEXT_ROOT}/Library/Frameworks" ; then - SDK_C_INCLUDE="$SDK_C_INCLUDE -F${NEXT_ROOT}/Library/Frameworks" - fi + if test "$MACOS_SDK_DIR"; then + dnl Sync this section with the one in Mozilla's top level. - CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}" + if test ! -d "$MACOS_SDK_DIR"; then + AC_MSG_ERROR([SDK not found. When using --with-macos-sdk, you must +specify a valid SDK. SDKs are installed when the optional cross-development +tools are selected during the Xcode/Developer Tools installation.]) + fi - dnl CPP needs to be set for AC_CHECK_HEADER. - CPP="$CPP -nostdinc ${SDK_C_INCLUDE}" + 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 + SDK_C_FRAMEWORK="-F${MACOS_SDK_DIR}/System/Library/Frameworks" + if test -d "${MACOS_SDK_DIR}/Library/Frameworks" ; then + SDK_C_FRAMEWORK="$SDK_C_FRAMEWORK -F${MACOS_SDK_DIR}/Library/Frameworks" + fi - 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" + SDK_C_INCLUDE="-isystem ${MACOS_SDK_DIR}/usr/include/gcc/darwin/${GCC_VERSION} -isystem ${MACOS_SDK_DIR}/usr/include ${SDK_C_FRAMEWORK}" + + CFLAGS="$CFLAGS -nostdinc ${SDK_C_INCLUDE}" + + 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 + 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 + + if test -n "$CROSS_COMPILE" ; then + dnl NEXT_ROOT will be in the environment, but it + dnl shouldn't be set for the build host. HOST_CXX is + dnl presently unused. + HOST_CC="NEXT_ROOT= $HOST_CC" + HOST_CXX="NEXT_ROOT= $HOST_CXX" + fi + else + dnl gcc >= 4.0 uses different paths than above, but knows + dnl how to find them itself. + CFLAGS="$CFLAGS -isysroot ${MACOS_SDK_DIR}" + + dnl CPP needs to be set for AC_CHECK_HEADER. + CPP="$CPP -isysroot ${MACOS_SDK_DIR}" + + dnl If gcc >= 4.0.0, we're guaranteed to be on Tiger, which + dnl has an ld that supports -syslibroot. Don't set + dnl NEXT_ROOT because it will be ignored and cause + dnl warnings when -syslibroot is specified. + dnl + dnl Both LDFLAGS and DSO_LDOPTS are set here, see the + dnl gcc < 4.0 case for the explanation. + if test "$GCC_VERSION_FULL" != "4.0.0" ; then + dnl gcc > 4.0.0 will pass -syslibroot to ld automatically + dnl based on the -isysroot it receives. + LDFLAGS="$LDFLAGS -isysroot ${MACOS_SDK_DIR}" + DSO_LDOPTS="$DSO_LDOPTS -isysroot ${MACOS_SDK_DIR}" + else + dnl gcc 4.0.0 doesn't pass -syslibroot to ld, it needs + dnl to be explicit. + LDFLAGS="$LDFLAGS -Wl,-syslibroot,${MACOS_SDK_DIR}" + DSO_LDOPTS="$DSO_LDOPTS -Wl,-syslibroot,${MACOS_SDK_DIR}" + fi + fi + fi fi ;; @@ -1051,17 +1139,25 @@ case "$target" in AC_DEFINE(XP_UNIX) AC_DEFINE(HPUX) AC_DEFINE(_HPUX_SOURCE) - AC_DEFINE(hppa) # OSF1 and HPUX report the POLLHUP event for a socket when the # shutdown(SHUT_WR) operation is called for the remote end, even though # the socket is still writeable. Use select(), instead of poll(), to # workaround this problem. AC_DEFINE(_PR_POLL_WITH_SELECT) AC_DEFINE(_USE_BIG_FDS) - DLL_SUFFIX=sl DSO_LDOPTS='-b +h $(notdir $@)' PR_MD_CSRCS=hpux.c - if test "$OS_TEST" != "ia64"; then + if test "$OS_TEST" = "ia64"; then + DLL_SUFFIX=so + DSO_LDOPTS="$DSO_LDOPTS +b '\$\$ORIGIN'" + CPU_ARCH_TAG=_$OS_TEST + if test -z "$USE_64"; then + COMPILER_TAG=_32 + fi + PR_MD_ASFILES=os_HPUX_ia64.s + else + AC_DEFINE(hppa) + DLL_SUFFIX=sl PR_MD_ASFILES=os_HPUX.s fi if test -n "$USE_64"; then @@ -1104,10 +1200,10 @@ case "$target" in AC_DEFINE(HAVE_POINTER_LOCALTIME_R) fi - # HP-UX 11i (B.11.11) or higher + # HP-UX 11i v2 (B.11.23) or higher changequote(<<,>>) case "$OS_RELEASE" in - [C-Z]*|B.[2-9]*|B.1[2-9]*|B.11.[2-9]*|B.11.1[1-9]*) + [C-Z]*|B.[2-9]*|B.1[2-9]*|B.11.[3-9]*|B.11.2[3-9]*) USE_IPV6=1 ;; esac @@ -1292,14 +1388,11 @@ case "$target" in IMPL_STRATEGY=_PTH fi AC_DEFINE(XP_UNIX) - AC_DEFINE(_POSIX_SOURCE) - AC_DEFINE(_BSD_SOURCE) - AC_DEFINE(_SVID_SOURCE) - AC_DEFINE(_LARGEFILE64_SOURCE) + AC_DEFINE(_GNU_SOURCE) AC_DEFINE(HAVE_FCNTL_FILE_LOCKING) AC_DEFINE(LINUX) - CFLAGS="$CFLAGS -ansi -Wall" - CXXFLAGS="$CXXFLAGS -ansi -Wall" + CFLAGS="$CFLAGS -Wall" + CXXFLAGS="$CXXFLAGS -Wall" MDCPUCFG_H=_linux.cfg PR_MD_CSRCS=linux.c MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@' @@ -2578,6 +2671,7 @@ AC_SUBST(CPPFLAGS) AC_SUBST(HOST_CC) AC_SUBST(HOST_CFLAGS) AC_SUBST(LDFLAGS) +AC_SUBST(HOST_LDFLAGS) AC_SUBST(GNU_CC) AC_SUBST(GCC_USE_GNU_LD) AC_SUBST(MSC_VER) @@ -2659,6 +2753,8 @@ AC_SUBST(OS_DLLFLAGS) AC_SUBST(CYGWIN_WRAPPER) AC_SUBST(VISIBILITY_FLAGS) AC_SUBST(WRAP_SYSTEM_INCLUDES) +AC_SUBST(MACOS_SDK_DIR) +AC_SUBST(NEXT_ROOT) dnl ======================================================== dnl Generate output files. @@ -2715,4 +2811,6 @@ if test -n "$USE_CPLUS"; then MAKEFILES="$MAKEFILES pr/src/cplus/Makefile pr/src/cplus/tests/Makefile" fi +echo $MAKEFILES > unallmakefiles + AC_OUTPUT([$MAKEFILES], [chmod +x config/nspr-config]) |