Fixed autodetection support of pthreads. Added classic nspr threads to the mix. Added autodetection of MOZILLA_CLIENT setting. unlabeled-1.1.2
authorcls%seawood.org
Sat, 14 Aug 1999 02:56:45 +0000
branchunlabeled-1.1.2
changeset 750 42d90fbfd0664b158158ad2c969c4580c0f2f1ee
parent 743 949926dd0156a8c4d49be9f3c10b8c159aa600ac
child 751 d206488be5ecd41ca91722ac952921118b6dde69
child 753 51e51f0d5493ff83fbb9f63dcfb04af6fcfbff24
push idunknown
push userunknown
push dateunknown
Fixed autodetection support of pthreads. Added classic nspr threads to the mix. Added autodetection of MOZILLA_CLIENT setting.
configure.in
--- a/configure.in
+++ b/configure.in
@@ -10,27 +10,25 @@ fi
 
 AC_CONFIG_AUX_DIR(${srcdir}/build/autoconf)
 AC_CANONICAL_SYSTEM
 AC_VALIDATE_CACHED_SYSTEM_TUPLE
 
 dnl Set this define to make fixes w/o breaking anything else.
 AC_DEFINE(USE_AUTOCONF)
 
-dnl Always set this for mozilla.
-AC_DEFINE(MOZILLA_CLIENT)
-
 dnl ========================================================
 dnl = Version defaults
 dnl ========================================================
 NSPR_VERSION=3
 NSPR_MODNAME=nspr20
 _HAVE_PTHREADS=
 USE_PTHREADS=
-USE_USER_PTHREADS=1
+USE_USER_PTHREADS=
+USE_NSPR_THREADS=
 
 dnl ========================================================
 dnl =
 dnl = Dont change the following lines.  Doing so breaks:
 dnl =
 dnl = CFLAGS="-foo" ./configure
 dnl =
 dnl ========================================================
@@ -42,23 +40,23 @@ HOST_LDFLAGS="${HOST_LDFLAGS=}"
 
 dnl ========================================================
 dnl =
 dnl = Check options that may affect the compiler
 dnl =
 dnl ========================================================
 MOZ_DEBUG=1
 AC_ARG_ENABLE(debug,
-    [  --disable-debug             Do not compile in debugging symbols],
+    [  --disable-debug         Do not compile in debugging symbols],
     [	if test "$enableval" = "no"; then
     	    MOZ_DEBUG=
 	fi])
 
 AC_ARG_ENABLE(target,
-    [  --enable-target=\$t         Turn on features for target \$t when build has multiple targets],
+    [  --enable-target=\$t      Turn on features for target \$t when build has multiple targets],
     MOZ_TARGET=`echo $enableval | tr a-z A-Z`,
     MOZ_TARGET=)
 
 if test -n "$MOZ_DEBUG"; then
     CFLAGS="$CFLAGS -g"
     CXXFLAGS="$CXXFLAGS -g"
 fi
 
@@ -128,16 +126,17 @@ if test "$target" != "$host"; then
     fi
 else
     AC_PROG_CC
     AC_PROG_CXX
     AC_PROG_RANLIB
     AC_PATH_PROGS(AS, as, $CC)
     AC_PATH_PROGS(AR, ar, :)
     AC_PATH_PROGS(DLLTOOL, dlltool, :)
+    AC_PATH_PROGS(WINDRES, windres, :)
     if test -z "$HOST_CC"; then
 	HOST_CC="$CC"
     fi
     if test -z "$HOST_CFLAGS"; then
 	HOST_CFLAGS="$CFLAGS"
     fi
 fi
 
@@ -303,87 +302,116 @@ dnl AC_FUNC_STRCOLL
 dnl AC_FUNC_STRFTIME
 dnl AC_FUNC_UTIME_NULL
 dnl AC_FUNC_VPRINTF
 dnl AC_CHECK_FUNCS(ftime getcwd gethostname gettimeofday getwd mkdir mktime putenv rmdir select socket strdup strerror strstr strtol strtoul uname)
 
 dnl ========================================================
 dnl Check options
 dnl ========================================================
+dnl
+dnl Check if NSPR is being compiled for Mozilla
+dnl Let --with-arg override environment setting
+dnl
+AC_ARG_WITH(mozilla,
+    [  --with-mozilla          Compile NSPR with Mozilla support],
+    [	if test "$withval" = "yes"; then
+	    AC_DEFINE(MOZILLA_CLIENT)
+	else
+	    MOZILLA_CLIENT=
+	fi],
+    [	if test -n "$MOZILLA_CLIENT"; then
+	    AC_DEFINE(MOZILLA_CLIENT)
+	fi])
+
 AC_CHECK_LIB(pthread, pthread_attr_init, 
              _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lpthread")
 
 dnl 
 dnl If the above test failed, try lib c_r
 dnl 
 if test "x$ac_cv_lib_pthread_pthread_attr_init" = "xno" -a \
 "x$ac_cv_lib_c_r_gethostbyname_r" = "xno"
 then
   AC_CHECK_LIB(c_r, pthread_attr_init,
                _HAVE_PTHREADS=1 _PTHREAD_LDFLAGS="-lc_r")
 fi
 
 AC_ARG_WITH(pthreads,
-    [  --with-pthreads           Use system pthreads library as thread subsystem],
+    [  --with-pthreads         Use system pthreads library as thread subsystem],
     [	if test "$withval" = "yes"; then
 	    if test -n "$_HAVE_PTHREADS"; then
 		USE_PTHREADS=1 
 		USE_USER_PTHREADS=
+		USE_NSPR_THREADS=
 	    else
 		AC_MSG_ERROR([ --with-pthreads specified for a system without pthread support ]);
 	    fi
 	else
 	    USE_PTHREADS=
 	    _PTHREAD_LDFLAGS=
-	    USE_USER_PTHREADS=1
 	fi],
 	[ if test -n "$_HAVE_PTHREADS"; then
 	    USE_PTHREADS=1
 	    USE_USER_PTHREADS=
+	    USE_NSPR_THREADS=
 	  fi])
 
 AC_ARG_ENABLE(user-pthreads,
-    [  --enable-user-pthreads      Build using userland pthreads],
+    [  --enable-user-pthreads  Build using userland pthreads],
     [	if test "$enableval" = "yes"; then
-	    USE_USER_PTHREADS=1
+	    if test -n "$_HAVE_PTHREADS"; then
+		USE_PTHREADS=
+		USE_USER_PTHREADS=1
+		USE_NSPR_THREADS=
+	    else
+		AC_MSG_ERROR([ --enable-user-pthreads specified for a system without pthread support ]);
+	    fi
+	fi])
+
+AC_ARG_ENABLE(nspr-threads,
+    [  --enable-nspr-threads   Build using classic nspr threads],
+    [	if test "$enableval" = "yes"; then
 	    USE_PTHREADS=
+	    USE_USER_PTHREADS=
+	    USE_NSPR_THREADS=1
 	fi])
 
 case "$target" in
 *-beos*)
     AC_ARG_WITH(bthreads,
-    [  --with-bthreads           Use system bthreads library as thread subsystem],
+    [  --with-bthreads         Use system bthreads library as thread subsystem (BeOS only)],
     [	if test "$withval" = "yes"; then
     	    USE_BTHREADS=1
 	    USE_USER_PTHREADS=
 	    USE_PTHREADS=
 	fi])
     ;;
 
 *-solaris*)
     AC_ARG_WITH(native-threads,
-    [  --with-native-threads     Use native system threads as thread subsystem],
+    [  --with-native-threads   Use native system threads as thread subsystem (Solaris only)],
     [	if test "$withval" = "yes"; then
 	    USE_NATIVE_THREADS=1
 	    USE_USER_PTHREADS=
 	    USE_PTHREADS=
 	fi])
     ;;
 esac
 
 USE_CPLUS=
 AC_ARG_ENABLE(cplus,
-    [  --enable-cplus              Use cplus for whatever reason],
+    [  --enable-cplus          Use cplus for whatever reason],
     [ if test "$enableval" = "yes"; then
 	USE_CPLUS=1
       fi]) 
 
 USE_IPV6=
 AC_ARG_ENABLE(ipv6,
-    [  --enable-ipv6               Compile ipv6 support],
+    [  --enable-ipv6           Compile ipv6 support],
     [ if test "$enableval" = "yes"; then
 	USE_IPV6=1
       fi])
 
 if test -n "$USE_PTHREADS"; then
    dnl See if -pthread is supported.
    rm -f conftest*
    ac_cv_have_dash_pthread=no
@@ -397,86 +425,83 @@ if test -n "$USE_PTHREADS"; then
 	    CXXFLAGS="$CXXFLAGS -pthread"
 	fi
     fi
     rm -f conftest*
     AC_MSG_RESULT($ac_cv_have_dash_pthread)
 
     case "$target" in
     *-mingw*|*-cygwin*|*-uwin*)
-	# win32 does not use pthreads
-	USE_PTHREADS=
-	PTHREAD_LDFLAGS=
-	USE_USER_PTHREADS=
-	;;
-    *-linux*)
-	AC_DEFINE(_REENTRANT)
 	;;
     *-solaris*)
 	AC_DEFINE(_REENTRANT)
 	if test -n "$GNU_CC"; then
 	    CFLAGS="$CFLAGS -mt"
 	    CXXFLAGS="$CXXFLAGS -mt"
 	fi
 	;;
-    alpha*-osf*)
-	AC_DEFINE(_REENTRANT)
-	;;
     *-freebsd*)
 	AC_DEFINE(_REENTRANT)
 	AC_DEFINE(_THREAD_SAFE)
 	 dnl -pthread links in -lc_r, so don't specify it explicitly.
 	if test "$ac_cv_have_dash_pthread" = "yes"; then
 	    PTHREAD_LDFLAGS=
 	fi
 	;;
     *)
 	AC_DEFINE(_REENTRANT)
 	;;
     esac
 
-else
-    case "$target" in
+else 
+    if test -n "$USE_USER_PTHREADS"; then
+	USE_PTHREADS=
+	USE_NSPR_THREADS=
+    else
+	USE_NSPR_THREADS=1
+	AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
+    fi
+fi
+dnl Special thread exceptions
+
+case "$target" in
     *-mingw*|*-cygwin*|*-uwin*)
 	# win32 does not use pthreads
 	USE_PTHREADS=
 	PTHREAD_LDFLAGS=
 	USE_USER_PTHREADS=
 	;;
     *-solaris*)
 	if test -n "$USE_NATIVE_THREADS"; then
 	    AC_DEFINE(_PR_GLOBAL_THREADS_ONLY)
 	else
 	    AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
 	fi
 	;;
-    *)
-	AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
-	;;
-    esac
- 
-fi
+esac
 
 dnl ========================================================
 dnl Substitution of found variables.
 dnl ========================================================
+AC_SUBST(MOZILLA_CLIENT)
 AC_SUBST(CC)
 AC_SUBST(CXX)
 AC_SUBST(CFLAGS)
 AC_SUBST(CXXFLAGS)
 AC_SUBST(HOST_CC)
 AC_SUBST(HOST_CFLAGS)
 AC_SUBST(GNU_CC)
 
 AC_SUBST(USE_PTHREADS)
 AC_SUBST(USE_BTHREADS)
 AC_SUBST(USE_CPLUS)
 AC_SUBST(USE_IPV6)
 AC_SUBST(USE_USER_PTHREADS)
 AC_SUBST(USE_NATIVE_THREADS)
+AC_SUBST(USE_NSPR_THREADS)
 
 AC_SUBST(NSPR_VERSION)
 AC_SUBST(NSPR_MODNAME)
 AC_SUBST(MDCPUCFG_H)
 AC_SUBST(MOZ_TARGET)
 AC_SUBST(PR_MD_CSRCS)
 AC_SUBST(PR_MD_ASFILES)
 AC_SUBST(PR_MD_ARCH_DIR)