Bug 475654: Allow workaround for NSPR installations with no nspr-config script. a=wes, r=jimb
authorJim Blandy <jimb@mozilla.org>
Tue, 28 Jul 2009 13:18:50 -0700
changeset 30801 c3030aee31ab3462182dccfeaf4031afa18948b7
parent 30800 0468583f64f4ba451040840369df0dd03ce35e75
child 30802 4679ac688c5686bd41a7718604712808cd11b21d
push id8245
push userjblandy@mozilla.com
push dateTue, 28 Jul 2009 20:19:39 +0000
treeherdermozilla-central@c3030aee31ab [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswes, jimb
bugs475654
milestone1.9.2a1pre
Bug 475654: Allow workaround for NSPR installations with no nspr-config script. a=wes, r=jimb
build/autoconf/nspr.m4
js/src/build/autoconf/nspr.m4
js/src/configure.in
--- a/build/autoconf/nspr.m4
+++ b/build/autoconf/nspr.m4
@@ -1,15 +1,27 @@
 # -*- tab-width: 4; -*-
 # Configure paths for NSPR
 # Public domain - Chris Seawood <cls@seawood.org> 2001-04-05
 # Based upon gtk.m4 (also PD) by Owen Taylor
 
 dnl AM_PATH_NSPR([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
 dnl Test for NSPR, and define NSPR_CFLAGS and NSPR_LIBS
+dnl
+dnl If the nspr-config script is available, use it to find the
+dnl appropriate CFLAGS and LIBS, and to check for the required
+dnl version, and run ACTION-IF-FOUND.
+dnl
+dnl Otherwise, if NO_NSPR_CONFIG_SYSTEM_VERSION is set, we use it,
+dnl NO_NSPR_CONFIG_SYSTEM_CFLAGS, and NO_NSPR_CONFIG_SYSTEM_LIBS to
+dnl provide default values, and run ACTION-IF-FOUND.  (Some systems
+dnl ship NSPR without nspr-config, but can glean the appropriate flags
+dnl and version.)
+dnl
+dnl Otherwise, run ACTION-IF-NOT-FOUND.
 AC_DEFUN([AM_PATH_NSPR],
 [dnl
 
 AC_ARG_WITH(nspr-prefix,
 	[  --with-nspr-prefix=PFX  Prefix where NSPR is installed],
 	nspr_config_prefix="$withval",
 	nspr_config_prefix="")
 
@@ -33,27 +45,34 @@ AC_ARG_WITH(nspr-exec-prefix,
 	fi
 
 	unset ac_cv_path_NSPR_CONFIG
 	AC_PATH_PROG(NSPR_CONFIG, nspr-config, no)
 	min_nspr_version=ifelse([$1], ,4.0.0,$1)
 	AC_MSG_CHECKING(for NSPR - version >= $min_nspr_version)
 
 	no_nspr=""
-	if test "$NSPR_CONFIG" = "no"; then
-		no_nspr="yes"
-	else
+	if test "$NSPR_CONFIG" != "no"; then
 		NSPR_CFLAGS=`$NSPR_CONFIG $nspr_config_args --cflags`
 		NSPR_LIBS=`$NSPR_CONFIG $nspr_config_args --libs`
+		NSPR_VERSION_STRING=`$NSPR_CONFIG $nspr_config_args --version`	
+	elif test -n "${NO_NSPR_CONFIG_SYSTEM_VERSION}"; then
+	    NSPR_CFLAGS="${NO_NSPR_CONFIG_SYSTEM_CFLAGS}"
+		NSPR_LIBS="${NO_NSPR_CONFIG_SYSTEM_LDFLAGS}"
+		NSPR_VERSION_STRING="$NO_NSPR_CONFIG_SYSTEM_VERSION"
+	else
+	    no_nspr="yes"
+	fi
 
-		nspr_config_major_version=`$NSPR_CONFIG $nspr_config_args --version | \
+	if test -z "$no_nspr"; then
+		nspr_config_major_version=`echo $NSPR_VERSION_STRING | \
 			sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
-		nspr_config_minor_version=`$NSPR_CONFIG $nspr_config_args --version | \
+		nspr_config_minor_version=`echo $NSPR_VERSION_STRING | \
 			sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
-		nspr_config_micro_version=`$NSPR_CONFIG $nspr_config_args --version | \
+		nspr_config_micro_version=`echo $NSPR_VERSION_STRING | \
 			sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
 		min_nspr_major_version=`echo $min_nspr_version | \
 			sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
 		min_nspr_minor_version=`echo $min_nspr_version | \
 			sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
 		min_nspr_micro_version=`echo $min_nspr_version | \
 			sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
 		if test "$nspr_config_major_version" -ne "$min_nspr_major_version"; then
--- a/js/src/build/autoconf/nspr.m4
+++ b/js/src/build/autoconf/nspr.m4
@@ -1,15 +1,27 @@
 # -*- tab-width: 4; -*-
 # Configure paths for NSPR
 # Public domain - Chris Seawood <cls@seawood.org> 2001-04-05
 # Based upon gtk.m4 (also PD) by Owen Taylor
 
 dnl AM_PATH_NSPR([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
 dnl Test for NSPR, and define NSPR_CFLAGS and NSPR_LIBS
+dnl
+dnl If the nspr-config script is available, use it to find the
+dnl appropriate CFLAGS and LIBS, and to check for the required
+dnl version, and run ACTION-IF-FOUND.
+dnl
+dnl Otherwise, if NO_NSPR_CONFIG_SYSTEM_VERSION is set, we use it,
+dnl NO_NSPR_CONFIG_SYSTEM_CFLAGS, and NO_NSPR_CONFIG_SYSTEM_LIBS to
+dnl provide default values, and run ACTION-IF-FOUND.  (Some systems
+dnl ship NSPR without nspr-config, but can glean the appropriate flags
+dnl and version.)
+dnl
+dnl Otherwise, run ACTION-IF-NOT-FOUND.
 AC_DEFUN([AM_PATH_NSPR],
 [dnl
 
 AC_ARG_WITH(nspr-prefix,
 	[  --with-nspr-prefix=PFX  Prefix where NSPR is installed],
 	nspr_config_prefix="$withval",
 	nspr_config_prefix="")
 
@@ -33,27 +45,34 @@ AC_ARG_WITH(nspr-exec-prefix,
 	fi
 
 	unset ac_cv_path_NSPR_CONFIG
 	AC_PATH_PROG(NSPR_CONFIG, nspr-config, no)
 	min_nspr_version=ifelse([$1], ,4.0.0,$1)
 	AC_MSG_CHECKING(for NSPR - version >= $min_nspr_version)
 
 	no_nspr=""
-	if test "$NSPR_CONFIG" = "no"; then
-		no_nspr="yes"
-	else
+	if test "$NSPR_CONFIG" != "no"; then
 		NSPR_CFLAGS=`$NSPR_CONFIG $nspr_config_args --cflags`
 		NSPR_LIBS=`$NSPR_CONFIG $nspr_config_args --libs`
+		NSPR_VERSION_STRING=`$NSPR_CONFIG $nspr_config_args --version`	
+	elif test -n "${NO_NSPR_CONFIG_SYSTEM_VERSION}"; then
+	    NSPR_CFLAGS="${NO_NSPR_CONFIG_SYSTEM_CFLAGS}"
+		NSPR_LIBS="${NO_NSPR_CONFIG_SYSTEM_LDFLAGS}"
+		NSPR_VERSION_STRING="$NO_NSPR_CONFIG_SYSTEM_VERSION"
+	else
+	    no_nspr="yes"
+	fi
 
-		nspr_config_major_version=`$NSPR_CONFIG $nspr_config_args --version | \
+	if test -z "$no_nspr"; then
+		nspr_config_major_version=`echo $NSPR_VERSION_STRING | \
 			sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
-		nspr_config_minor_version=`$NSPR_CONFIG $nspr_config_args --version | \
+		nspr_config_minor_version=`echo $NSPR_VERSION_STRING | \
 			sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
-		nspr_config_micro_version=`$NSPR_CONFIG $nspr_config_args --version | \
+		nspr_config_micro_version=`echo $NSPR_VERSION_STRING | \
 			sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
 		min_nspr_major_version=`echo $min_nspr_version | \
 			sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
 		min_nspr_minor_version=`echo $min_nspr_version | \
 			sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
 		min_nspr_micro_version=`echo $min_nspr_version | \
 			sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
 		if test "$nspr_config_major_version" -ne "$min_nspr_major_version"; then
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -2288,16 +2288,21 @@ alpha*-*-osf*)
        DSO_LDOPTS='-G'
     fi
     ;;
 
 dnl the qsort routine under solaris is faulty
 *-solaris*) 
     AC_DEFINE(SOLARIS)
     TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
+    if test -z "$CROSS_COMPILE" && pkginfo -q SUNWpr && pkginfo -q SUNWprd; then
+       NO_NSPR_CONFIG_SYSTEM_LDFLAGS="-L/usr/lib/mps -R/usr/lib/mps -lnspr4"
+       NO_NSPR_CONFIG_SYSTEM_CFLAGS="-I/usr/include/mps"
+       NO_NSPR_CONFIG_SYSTEM_VERSION=["`pkgparam SUNWpr SUNW_PRODVERS | sed -e 's/^[1-9][0-9]*\.[0-9][0-9]*$/&.0/'`"]
+    fi
     SYSTEM_MAKEDEPEND=
     # $ORIGIN/.. is for shared libraries under components/ to locate shared
     # libraries one level up (e.g. libnspr4.so)
     LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
     if test "$SOLARIS_SUNPRO_CC"; then
        LIBS="-lCrun -lCstd $LIBS"
        NS_USE_NATIVE=1
        MOZ_FIX_LINK_PATHS=