summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwtc%google.com <devnull@localhost>2009-10-03 02:03:48 +0000
committerwtc%google.com <devnull@localhost>2009-10-03 02:03:48 +0000
commit54f30a57a518f163366354b9baa0a75f48240995 (patch)
tree7d4167fbe2f19219ade7ef203cca6eef004f93cb
parenta8f4bb8ec1bfebc84c55af8a8e6ea7eef8f267eb (diff)
downloadnspr-hg-54f30a57a518f163366354b9baa0a75f48240995.tar.gz
Bug 509262: Restore Mac OS X 10.2 and 10.3 support.
Modified Files: configure configure.in prsystem.c Tag: NSPR_4_7_BRANCH
-rwxr-xr-xconfigure84
-rw-r--r--configure.in15
-rw-r--r--pr/src/misc/prsystem.c43
3 files changed, 111 insertions, 31 deletions
diff --git a/configure b/configure
index f95a253e..70a522b8 100755
--- a/configure
+++ b/configure
@@ -3346,10 +3346,6 @@ EOF
#define HAVE_BSD_FLOCK 1
EOF
- cat >> confdefs.h <<\EOF
-#define HAVE_SOCKLEN_T 1
-EOF
-
CFLAGS="$CFLAGS -Wmost -fno-common"
case "${target_cpu}" in
i*86*)
@@ -3454,6 +3450,42 @@ tools are selected during the Xcode/Developer Tools installation." 1>&2; exit 1;
fi
fi
fi
+
+ echo $ac_n "checking for socklen_t""... $ac_c" 1>&6
+echo "configure:3456: checking for socklen_t" >&5
+ if eval "test \"`echo '$''{'ac_cv_socklen_t'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3461 "configure"
+#include "confdefs.h"
+#include <stdio.h>
+ #include <sys/socket.h>
+int main() {
+socklen_t foo = 0;
+; return 0; }
+EOF
+if { (eval echo configure:3469: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+ rm -rf conftest*
+ ac_cv_socklen_t=true
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_socklen_t=false
+fi
+rm -f conftest*
+fi
+
+ if test "$ac_cv_socklen_t" = true ; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_SOCKLEN_T 1
+EOF
+
+ echo "$ac_t""yes" 1>&6
+ else
+ echo "$ac_t""no" 1>&6
+ fi
;;
*-dgux*)
@@ -4503,17 +4535,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:4507: checking for machine/builtins.h" >&5
+echo "configure:4539: 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 4512 "configure"
+#line 4544 "configure"
#include "confdefs.h"
#include <machine/builtins.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4517: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4549: \"$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 +5075,7 @@ case $target in
;;
*)
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:5047: checking for dlopen in -ldl" >&5
+echo "configure:5079: 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 +5083,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-ldl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5055 "configure"
+#line 5087 "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 +5094,7 @@ int main() {
dlopen()
; return 0; }
EOF
-if { (eval echo configure:5066: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5098: \"$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 +5111,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:5083: checking for dlfcn.h" >&5
+echo "configure:5115: 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 5088 "configure"
+#line 5120 "configure"
#include "confdefs.h"
#include <dlfcn.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5093: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5125: \"$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 +5154,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:5126: checking whether ${CC-cc} needs -traditional" >&5
+echo "configure:5158: 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 5132 "configure"
+#line 5164 "configure"
#include "confdefs.h"
#include <sgtty.h>
Autoconf TIOCGETP
@@ -5146,7 +5178,7 @@ rm -f conftest*
if test $ac_cv_prog_gcc_traditional = no; then
cat > conftest.$ac_ext <<EOF
-#line 5150 "configure"
+#line 5182 "configure"
#include "confdefs.h"
#include <termio.h>
Autoconf TCGETA
@@ -5170,12 +5202,12 @@ fi
for ac_func in lchown strerror
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5174: checking for $ac_func" >&5
+echo "configure:5206: 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 5179 "configure"
+#line 5211 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -5198,7 +5230,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:5202: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:5234: \"$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 +5271,7 @@ hpux*)
if test -z "$GNU_CC"; then
echo $ac_n "checking for +Olit support""... $ac_c" 1>&6
-echo "configure:5243: checking for +Olit support" >&5
+echo "configure:5275: 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 +5310,7 @@ darwin*)
*)
echo $ac_n "checking for pthread_create in -lpthreads""... $ac_c" 1>&6
-echo "configure:5282: checking for pthread_create in -lpthreads" >&5
+echo "configure:5314: checking for pthread_create in -lpthreads" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@@ -5300,7 +5332,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
-echo "configure:5304: checking for pthread_create in -lpthread" >&5
+echo "configure:5336: checking for pthread_create in -lpthread" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@@ -5322,7 +5354,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6
-echo "configure:5326: checking for pthread_create in -lc_r" >&5
+echo "configure:5358: checking for pthread_create in -lc_r" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@@ -5344,7 +5376,7 @@ echo "
echo "$ac_t""no" 1>&6
echo $ac_n "checking for pthread_create in -lc""... $ac_c" 1>&6
-echo "configure:5348: checking for pthread_create in -lc" >&5
+echo "configure:5380: checking for pthread_create in -lc" >&5
echo "
#include <pthread.h>
void *foo(void *v) { return v; }
@@ -5476,7 +5508,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:5480: checking whether ${CC-cc} accepts -pthread" >&5
+echo "configure:5512: 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
@@ -5499,7 +5531,7 @@ echo "configure:5480: 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:5503: checking whether ${CC-cc} accepts -pthreads" >&5
+echo "configure:5535: 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 a91f4d6e..cb5363d0 100644
--- a/configure.in
+++ b/configure.in
@@ -996,7 +996,6 @@ case "$target" in
AC_DEFINE(XP_UNIX)
AC_DEFINE(DARWIN)
AC_DEFINE(HAVE_BSD_FLOCK)
- AC_DEFINE(HAVE_SOCKLEN_T)
CFLAGS="$CFLAGS -Wmost -fno-common"
case "${target_cpu}" in
i*86*)
@@ -1143,6 +1142,20 @@ tools are selected during the Xcode/Developer Tools installation.])
fi
fi
fi
+
+ AC_MSG_CHECKING(for socklen_t)
+ AC_CACHE_VAL(ac_cv_socklen_t,
+ [AC_TRY_COMPILE([#include <stdio.h>
+ #include <sys/socket.h>],
+ [socklen_t foo = 0;],
+ [ac_cv_socklen_t=true],
+ [ac_cv_socklen_t=false])])
+ if test "$ac_cv_socklen_t" = true ; then
+ AC_DEFINE(HAVE_SOCKLEN_T)
+ AC_MSG_RESULT(yes)
+ else
+ AC_MSG_RESULT(no)
+ fi
;;
*-dgux*)
diff --git a/pr/src/misc/prsystem.c b/pr/src/misc/prsystem.c
index f3542a50..2810e6af 100644
--- a/pr/src/misc/prsystem.c
+++ b/pr/src/misc/prsystem.c
@@ -269,6 +269,36 @@ PR_IMPLEMENT(PRInt32) PR_GetNumberOfProcessors( void )
return(numCpus);
} /* end PR_GetNumberOfProcessors() */
+#ifdef DARWIN
+
+/*
+ * Manually define the host_basic_info structure in Mac OS X 10.4 or later
+ * so that we can compile against Mac OS X 10.2 and 10.3 SDKs.
+ */
+
+#pragma pack(4)
+
+struct host_basic_info_new {
+ integer_t max_cpus;
+ integer_t avail_cpus;
+ natural_t memory_size;
+ cpu_type_t cpu_type;
+ cpu_subtype_t cpu_subtype;
+ /*cpu_threadtype_t*/ integer_t cpu_threadtype;
+ integer_t physical_cpu;
+ integer_t physical_cpu_max;
+ integer_t logical_cpu;
+ integer_t logical_cpu_max;
+ uint64_t max_mem;
+};
+
+#pragma pack()
+
+#define HOST_BASIC_INFO_NEW_COUNT ((mach_msg_type_number_t) \
+ (sizeof(struct host_basic_info_new)/sizeof(integer_t)))
+
+#endif /* DARWIN */
+
/*
** PR_GetPhysicalMemorySize()
**
@@ -299,15 +329,20 @@ PR_IMPLEMENT(PRUint64) PR_GetPhysicalMemorySize(void)
#elif defined(DARWIN)
- struct host_basic_info hInfo;
- mach_msg_type_number_t count = HOST_BASIC_INFO_COUNT;
+ struct host_basic_info_new hInfo;
+ mach_msg_type_number_t count = HOST_BASIC_INFO_NEW_COUNT;
int result = host_info(mach_host_self(),
HOST_BASIC_INFO,
(host_info_t) &hInfo,
&count);
- if (result == KERN_SUCCESS)
- bytes = hInfo.max_mem;
+ if (result == KERN_SUCCESS) {
+ if (count >= HOST_BASIC_INFO_NEW_COUNT) {
+ bytes = hInfo.max_mem;
+ } else {
+ bytes = hInfo.memory_size;
+ }
+ }
#elif defined(WIN32)