summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwtc%google.com <devnull@localhost>2008-07-23 04:06:58 +0000
committerwtc%google.com <devnull@localhost>2008-07-23 04:06:58 +0000
commit636505d3674b3929cb7759765eeb009dcecfb45c (patch)
treee8ac3e94fff229e02e137e232e7273be93cae440
parent01d50fafd1c10656959d1063bcb6395efbaa6832 (diff)
downloadnspr-hg-636505d3674b3929cb7759765eeb009dcecfb45c.tar.gz
Bug 417044: Support building Mac universal binaries in a single pass.
The patch is contributed by Benjamin Smedberg <benjamin@smedbergs.us>. r=wtc. Modified files: configure configure.in _darwin.cfg Added files: os_Darwin.s
-rwxr-xr-xconfigure55
-rw-r--r--configure.in5
-rw-r--r--pr/include/md/_darwin.cfg2
-rw-r--r--pr/src/md/unix/os_Darwin.s43
4 files changed, 68 insertions, 37 deletions
diff --git a/configure b/configure
index fa246b14..0d1ac864 100755
--- a/configure
+++ b/configure
@@ -3349,20 +3349,10 @@ EOF
CFLAGS="$CFLAGS -Wmost -fno-common"
case "${target_cpu}" in
i*86*)
- cat >> confdefs.h <<\EOF
-#define i386 1
-EOF
-
CPU_ARCH=i386
- PR_MD_ASFILES=os_Darwin_x86.s
;;
*)
- cat >> confdefs.h <<\EOF
-#define ppc 1
-EOF
-
CPU_ARCH=ppc
- PR_MD_ASFILES=os_Darwin_ppc.s
;;
esac
DSO_CFLAGS=-fPIC
@@ -3373,6 +3363,7 @@ EOF
USE_PTHREADS=1
MDCPUCFG_H=_darwin.cfg
PR_MD_CSRCS=darwin.c
+ PR_MD_ASFILES=os_Darwin.s
# Add Mac OS X support for loading CFM & CFBundle plugins
if test -f /System/Library/Frameworks/Carbon.framework/Carbon; then
@@ -4501,17 +4492,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:4505: checking for machine/builtins.h" >&5
+echo "configure:4496: 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 4510 "configure"
+#line 4501 "configure"
#include "confdefs.h"
#include <machine/builtins.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4515: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4506: \"$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*
@@ -5027,7 +5018,7 @@ case $target in
;;
*)
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:5031: checking for dlopen in -ldl" >&5
+echo "configure:5022: 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
@@ -5035,7 +5026,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5039 "configure"
+#line 5030 "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
@@ -5046,7 +5037,7 @@ int main() {
dlopen()
; return 0; }
EOF
-if { (eval echo configure:5050: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5041: \"$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
@@ -5063,17 +5054,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:5067: checking for dlfcn.h" >&5
+echo "configure:5058: 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 5072 "configure"
+#line 5063 "configure"
#include "confdefs.h"
#include <dlfcn.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5077: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5068: \"$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*
@@ -5106,13 +5097,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:5110: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:5101: 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 5116 "configure"
+#line 5107 "configure"
#include "confdefs.h"
#include <sgtty.h>
Autoconf TIOCGETP
@@ -5130,7 +5121,7 @@ rm -f conftest*
if test $ac_cv_prog_gcc_traditional = no; then
cat > conftest.$ac_ext <<EOF
-#line 5134 "configure"
+#line 5125 "configure"
#include "confdefs.h"
#include <termio.h>
Autoconf TCGETA
@@ -5154,12 +5145,12 @@ fi
for ac_func in lchown strerror
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5158: checking for $ac_func" >&5
+echo "configure:5149: 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 5163 "configure"
+#line 5154 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -5182,7 +5173,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:5186: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5177: \"$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
@@ -5223,7 +5214,7 @@ hpux*)
if test -z "$GNU_CC"; then
echo $ac_n "checking for +Olit support""... $ac_c" 1>&6
-echo "configure:5227: checking for +Olit support" >&5
+echo "configure:5218: 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
@@ -5262,7 +5253,7 @@ darwin*)
*)
echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6
-echo "configure:5266: checking for pthread_create in -lpthreads" >&5
+echo "configure:5257: checking for pthread_create in -lpthreads" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@@ -5284,7 +5275,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
-echo "configure:5288: checking for pthread_create in -lpthread" >&5
+echo "configure:5279: checking for pthread_create in -lpthread" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@@ -5306,7 +5297,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6
-echo "configure:5310: checking for pthread_create in -lc_r" >&5
+echo "configure:5301: checking for pthread_create in -lc_r" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@@ -5328,7 +5319,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6
-echo "configure:5332: checking for pthread_create in -lc" >&5
+echo "configure:5323: checking for pthread_create in -lc" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@@ -5460,7 +5451,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:5464: checking whether ${CC-cc} accepts -pthread" >&5
+echo "configure:5455: 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
@@ -5483,7 +5474,7 @@ echo "configure:5464: 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:5487: checking whether ${CC-cc} accepts -pthreads" >&5
+echo "configure:5478: 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 e7a1e99e..01ea8f29 100644
--- a/configure.in
+++ b/configure.in
@@ -999,14 +999,10 @@ case "$target" in
CFLAGS="$CFLAGS -Wmost -fno-common"
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
@@ -1017,6 +1013,7 @@ case "$target" in
USE_PTHREADS=1
MDCPUCFG_H=_darwin.cfg
PR_MD_CSRCS=darwin.c
+ PR_MD_ASFILES=os_Darwin.s
# Add Mac OS X support for loading CFM & CFBundle plugins
if test -f /System/Library/Frameworks/Carbon.framework/Carbon; then
diff --git a/pr/include/md/_darwin.cfg b/pr/include/md/_darwin.cfg
index baa57958..1cc39aa5 100644
--- a/pr/include/md/_darwin.cfg
+++ b/pr/include/md/_darwin.cfg
@@ -44,7 +44,7 @@
#define PR_AF_INET6 30 /* same as AF_INET6 */
-#if defined(i386)
+#if defined(__i386__)
#undef IS_BIG_ENDIAN
#define IS_LITTLE_ENDIAN 1
#else
diff --git a/pr/src/md/unix/os_Darwin.s b/pr/src/md/unix/os_Darwin.s
new file mode 100644
index 00000000..00daf1e3
--- /dev/null
+++ b/pr/src/md/unix/os_Darwin.s
@@ -0,0 +1,43 @@
+# -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+#
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is the Netscape Portable Runtime (NSPR).
+#
+# The Initial Developer of the Original Code is
+# Netscape Communications Corporation.
+# Portions created by the Initial Developer are Copyright (C) 2008
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 2 or later (the "GPL"), or
+# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+#ifdef __i386__
+#include "os_Darwin_x86.s"
+#elif defined(__ppc__)
+#include "os_Darwin_ppc.s"
+#endif