You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by mi...@apache.org on 2009/01/04 17:28:51 UTC

svn commit: r731291 - in /apr/apr-util/trunk: CHANGES build/crypto.m4 crypto/apr_crypto_nss.c

Author: minfrin
Date: Sun Jan  4 08:28:51 2009
New Revision: 731291

URL: http://svn.apache.org/viewvc?rev=731291&view=rev
Log:
apr_crypto_nss: Oh that it was this easy. Use pgk-config to find
NSS where possible.

Modified:
    apr/apr-util/trunk/CHANGES
    apr/apr-util/trunk/build/crypto.m4
    apr/apr-util/trunk/crypto/apr_crypto_nss.c

Modified: apr/apr-util/trunk/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/CHANGES?rev=731291&r1=731290&r2=731291&view=diff
==============================================================================
--- apr/apr-util/trunk/CHANGES [utf-8] (original)
+++ apr/apr-util/trunk/CHANGES [utf-8] Sun Jan  4 08:28:51 2009
@@ -1,6 +1,9 @@
                                                      -*- coding: utf-8 -*-
 Changes with APR-util 1.4.0
 
+  *) apr_crypto_nss: Oh that it was this easy. Use pgk-config to find
+     NSS where possible. [Graham Leggett]
+
   *) apr_crypto_nss: The nss.h header file could be in nss or nss3, the
      prerror.h header file could be in nspr4. [Graham Leggett]
 

Modified: apr/apr-util/trunk/build/crypto.m4
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/build/crypto.m4?rev=731291&r1=731290&r2=731291&view=diff
==============================================================================
--- apr/apr-util/trunk/build/crypto.m4 (original)
+++ apr/apr-util/trunk/build/crypto.m4 Sun Jan  4 08:28:51 2009
@@ -139,10 +139,17 @@
   nss_have_libs=0
 
   AC_ARG_WITH([nss], 
-  [APR_HELP_STRING([--with-nss=DIR], [specify location of OpenSSL])],
+  [APR_HELP_STRING([--with-nss=DIR], [specify location of NSS])],
   [
     if test "$withval" = "yes"; then
-      AC_CHECK_HEADERS(prerror.h nspr4/prerror.h nss/nss.h nss3/nss.h nss/pk11pub.h nss3/pk11pub.h, [nss_have_headers=1])
+      AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
+      if test -n "$PKG_CONFIG"; then
+        nss_CPPFLAGS=`$PKG_CONFIG --cflags-only-I nss`
+        nss_LDFLAGS=`$PKG_CONFIG --libs nss`
+        APR_ADDTO(CPPFLAGS, [$nss_CPPFLAGS])
+        APR_ADDTO(LDFLAGS, [$nss_LDFLAGS])
+      fi
+      AC_CHECK_HEADERS(prerror.h nss/nss.h nss.h nss/pk11pub.h pk11pub.h, [nss_have_headers=1])
       AC_CHECK_LIB(nspr4, PR_Initialize, AC_CHECK_LIB(nss3, PK11_CreatePBEV2AlgorithmID, [nss_have_libs=1],,-lnspr4))
       if test "$nss_have_headers" != "0" && test "$nss_have_libs" != "0"; then
         apu_have_nss=1
@@ -160,27 +167,18 @@
       APR_ADDTO(LDFLAGS, [$nss_LDFLAGS])
 
       AC_MSG_NOTICE(checking for nss in $withval)
-      AC_CHECK_HEADERS(prerror.h nspr4/prerror.h nss/nss.h nss3/nss.h nss/pk11pub.h nss3/pk11pub.h, [nss_have_headers=1])
+      AC_CHECK_HEADERS(prerror.h nss/nss.h nss.h nss/pk11pub.h pk11pub.h, [nss_have_headers=1])
       AC_CHECK_LIB(nspr4, PR_Initialize, AC_CHECK_LIB(nss3, PK11_CreatePBEV2AlgorithmID, [nss_have_libs=1],,-lnspr4))
       if test "$nss_have_headers" != "0" && test "$nss_have_libs" != "0"; then
         apu_have_nss=1
-        APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
-        APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include -I$withval/../public])
-      fi
-
-      if test "$apu_have_nss" != "1"; then
-        AC_CHECK_HEADERS(prerror.h nspr4/prerror.h nss/nss.h nss3/nss.h nss/pk11pub.h nss3/pk11pub.h, [nss_have_headers=1])
-        AC_CHECK_LIB(nspr4, PR_Initialize, AC_CHECK_LIB(nss3, PK11_CreatePBEV2AlgorithmID, [nss_have_libs=1],,-lnspr4))
-        if test "$nss_have_headers" != "0" && test "$nss_have_libs" != "0"; then
-          apu_have_nss=1
-          APR_ADDTO(APRUTIL_LDFLAGS, [-L$withval/lib])
-          APR_ADDTO(APRUTIL_INCLUDES, [-I$withval/include -I$withval/../public])
-        fi
       fi
 
       CPPFLAGS="$old_cppflags"
       LDFLAGS="$old_ldflags"
     fi
+    if test "$apu_have_nss" != "0"; then
+      APR_ADDTO(APRUTIL_PRIV_INCLUDES, [$nss_CPPFLAGS])
+    fi
   ], [
     apu_have_nss=0
   ])

Modified: apr/apr-util/trunk/crypto/apr_crypto_nss.c
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/crypto/apr_crypto_nss.c?rev=731291&r1=731290&r2=731291&view=diff
==============================================================================
--- apr/apr-util/trunk/crypto/apr_crypto_nss.c (original)
+++ apr/apr-util/trunk/crypto/apr_crypto_nss.c Sun Jan  4 08:28:51 2009
@@ -30,25 +30,20 @@
 
 #if APU_HAVE_CRYPTO
 
-#ifdef HAVE_PRERROR_H
 #include <prerror.h>
-#endif
-#ifdef HAVE_NSPR4_PRERROR_H
-#include <nspr4/prerror.h>
-#endif
 
 #ifdef HAVE_NSS_NSS_H
 #include <nss/nss.h>
 #endif
-#ifdef HAVE_NSS3_NSS_H
-#include <nss3/nss.h>
+#ifdef HAVE_NSS_H
+#include <nss.h>
 #endif
 
 #ifdef HAVE_NSS_PK11PUB_H
 #include <nss/pk11pub.h>
 #endif
-#ifdef HAVE_NSS3_PK11PUB_H
-#include <nss3/pk11pub.h>
+#ifdef HAVE_PK11PUB_H
+#include <pk11pub.h>
 #endif
 
 struct apr_crypto_config_t {



Re: svn commit: r731291 - in /apr/apr-util/trunk: CHANGES build/crypto.m4 crypto/apr_crypto_nss.c

Posted by Ruediger Pluem <rp...@apache.org>.

On 01/04/2009 05:28 PM, minfrin@apache.org wrote:
> Author: minfrin
> Date: Sun Jan  4 08:28:51 2009
> New Revision: 731291
> 
> URL: http://svn.apache.org/viewvc?rev=731291&view=rev
> Log:
> apr_crypto_nss: Oh that it was this easy. Use pgk-config to find
> NSS where possible.
> 
> Modified:
>     apr/apr-util/trunk/CHANGES
>     apr/apr-util/trunk/build/crypto.m4
>     apr/apr-util/trunk/crypto/apr_crypto_nss.c

> Modified: apr/apr-util/trunk/build/crypto.m4
> URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/build/crypto.m4?rev=731291&r1=731290&r2=731291&view=diff
> ==============================================================================
> --- apr/apr-util/trunk/build/crypto.m4 (original)
> +++ apr/apr-util/trunk/build/crypto.m4 Sun Jan  4 08:28:51 2009
> @@ -139,10 +139,17 @@
>    nss_have_libs=0
>  
>    AC_ARG_WITH([nss], 
> -  [APR_HELP_STRING([--with-nss=DIR], [specify location of OpenSSL])],
> +  [APR_HELP_STRING([--with-nss=DIR], [specify location of NSS])],
>    [
>      if test "$withval" = "yes"; then
> -      AC_CHECK_HEADERS(prerror.h nspr4/prerror.h nss/nss.h nss3/nss.h nss/pk11pub.h nss3/pk11pub.h, [nss_have_headers=1])
> +      AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
> +      if test -n "$PKG_CONFIG"; then
> +        nss_CPPFLAGS=`$PKG_CONFIG --cflags-only-I nss`
> +        nss_LDFLAGS=`$PKG_CONFIG --libs nss`
> +        APR_ADDTO(CPPFLAGS, [$nss_CPPFLAGS])
> +        APR_ADDTO(LDFLAGS, [$nss_LDFLAGS])

      old_cppflags="$CPPFLAGS"
      old_ldflags="$LDFLAGS"

need to be moved before this code. Otherwise we do not restore the correct values later on.

Regards

RĂ¼diger