Petter Reinholdtsen <[EMAIL PROTECTED]> writes:

> Aha.  I did not know Debian got a nspr package.  I'm developing on
> Debian as well, but I fetched NSPR myself. :-)

I think it's in both stable and unstable; Do you know about
'apt-cache search foo'?

> Could you extend this patch to accept --with-nspr=/path/... as a way
> to say --with-nspr-include=/path/... and --with-nspr-lib=/path/...?

The attached patch reimplements the old semantics for --with-nspr;
meaning it looks in $with_nspr/include for headers, and $with_nspr/lib
for libraries.  That's what you meant, right?  It seems unlikely that
the header files and shared libraries would be in the same
directory...

Index: configure.in
===================================================================
RCS file: /cvsroot/hungry/java/japhar/configure.in,v
retrieving revision 1.188
diff -u -r1.188 configure.in
--- configure.in	2001/01/07 15:21:59	1.188
+++ configure.in	2001/01/31 16:13:02
@@ -125,32 +125,6 @@
   ])
 
 dnl
-dnl get path to nspr install dir. 
-dnl
-AC_ARG_WITH(nspr,
- [  --with-nspr             Specify the path to NSPR.],
-  [
-   CFLAGS="-I${with_nspr}/include $CFLAGS"
-   JAPHAR_CFLAGS="-I${with_nspr}/include $JAPHAR_CFLAGS"
-   LDFLAGS="-L${with_nspr}/lib $LDFLAGS"
-
-   AC_MSG_CHECKING(for version of NSPR at ${with_nspr})
-   if test -f ${with_nspr}/lib/libnspr3.so; then 
-     AC_MSG_RESULT(NSPR V3)
-     NSPRVER="3"
-   else 
-    if test -f ${with_nspr}/lib/libnspr4.so; then
-      AC_MSG_RESULT(NSPR V4)
-      NSPRVER="4"
-    else
-      AC_MSG_ERROR(${with_nspr} is not a valid NSPR distribution)
-    fi
-  fi
-
-   AC_SUBST(NSPRVER)  
-  ])
-
-dnl
 dnl get path to sports model install dir.
 dnl
 AC_ARG_WITH(sm,
@@ -302,25 +276,70 @@
 
 AC_CHECK_LIB(c_r, pthread_create)
 AC_CHECK_LIB(pthread, pthread_create)
-AC_CHECK_LIB(nspr${NSPRVER}, PR_CreateThread)
-AC_CHECK_LIB(plds${NSPRVER}, PL_NewHashTable)
-AC_CHECK_LIB(plc${NSPRVER}, PL_strdup)
-if test "x${ac_cv_lib_nspr3_PR_CreateThread}" = xno &&
-   test "x${ac_cv_lib_nspr4_PR_CreateThread}" = xno ; then
-  nspr_missing=yes
-fi
-if test "x${ac_cv_lib_plds3_PL_NewHashTable}" = xno &&
-   test "x${ac_cv_lib_plds4_PL_NewHashTable}" = xno; then
-  nspr_missing=yes
-fi
-if test "x${ac_cv_lib_plc3_PL_strdup}" = xno &&
-   test "x${ac_cv_lib_plc4_PL_strdup}" = xno; then
-  nspr_missing=yes
-fi
 
-if test "x${NSPRVER}" = x || test "x$nspr_missing" = xyes; then
-  AC_MSG_ERROR(could not find NSPR install)
-fi
+AC_ARG_WITH(nspr,
+ [  --with-nspr             Specify the path to NSPR header files and libraries.],
+  [
+    CFLAGS="-I${with_nspr}/include $CFLAGS"
+    JAPHAR_CFLAGS="-I${with_nspr} $JAPHAR_CFLAGS"
+    LDFLAGS="-L${with_nspr}/lib $LDFLAGS"
+  ],
+  [
+    AC_ARG_WITH(nspr-includes,
+     [  --with-nspr-includes    Specify the path to NSPR header files.],
+      [
+       CFLAGS="-I${with_nspr_includes} $CFLAGS"
+       JAPHAR_CFLAGS="-I${with_nspr_includes} $JAPHAR_CFLAGS"
+      ],
+      [
+       nspr_header_path=no
+    
+       for x in /usr/include/nspr/ /usr/include/ /usr/local/include/ \
+                /usr/local/include/nspr/; do
+         AC_MSG_CHECKING("for NSPR headers in ${x}")
+         if test "x${nspr_header_path}" = xno && test -f "${x}nspr.h"; then
+           nspr_header_path=$x
+           AC_MSG_RESULT("${x}nspr.h")
+           break
+         fi
+       done
+       if test "x${nspr_header_path}" = xno; then
+         AC_MSG_ERROR(Could not find NSPR header files.  Try --with-nspr-includes.)
+       fi
+       CFLAGS="-I${nspr_header_path} $CFLAGS"
+       JAPHAR_CFLAGS="-I${nspr_header_path} $JAPHAR_CFLAGS "
+      ])
+    
+    AC_ARG_WITH(nspr-libs,
+     [  --with-nspr-libs        Specify the path to NSPR library files.],
+      [
+       LDFLAGS="-L${with_nspr_libs} $LDFLAGS"
+      ],
+      [
+       nspr_ver=no
+       nspr_missing=no
+       AC_CHECK_LIB(nspr4, PR_CreateThread,nspr_ver=4)
+       if test $nspr_ver = no; then
+       AC_CHECK_LIB(nspr3, PR_CreateThread,nspr_ver=3)
+       fi
+       AC_CHECK_LIB(plds${nspr_ver}, PL_NewHashTable)
+       AC_CHECK_LIB(plc${nspr_ver}, PL_strdup)   
+       if test $nspr_ver = no; then
+       nspr_missing=yes
+       fi
+       if test "x${ac_cv_lib_plds3_PL_NewHashTable}" = xno &&
+          test "x${ac_cv_lib_plds4_PL_NewHashTable}" = xno; then
+          nspr_missing=yes
+       fi
+       if test "x${ac_cv_lib_plc3_PL_strdup}" = xno &&
+          test "x${ac_cv_lib_plc4_PL_strdup}" = xno; then
+          nspr_missing=yes
+       fi
+       if test "x$nspr_missing" = xyes; then
+          AC_MSG_ERROR(Could not find NSPR library files.  Try --with-nspr-libs)
+       fi
+      ])
+    ])
 
 if test "x$with_sm" != "x"; then
   AC_CHECK_LIB(sm, SM_InitGC)

Reply via email to