From 57950dee96bdfc8595e9198e1715dfdbd422351f Mon Sep 17 00:00:00 2001 From: minfrin Date: Sun, 4 Jan 2009 16:28:51 +0000 Subject: apr_crypto_nss: Oh that it was this easy. Use pgk-config to find NSS where possible. git-svn-id: http://svn.apache.org/repos/asf/apr/apr-util/trunk@731291 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 3 +++ build/crypto.m4 | 28 +++++++++++++--------------- crypto/apr_crypto_nss.c | 13 ++++--------- 3 files changed, 20 insertions(+), 24 deletions(-) diff --git a/CHANGES b/CHANGES index f60794b1..287abb96 100644 --- a/CHANGES +++ b/CHANGES @@ -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] diff --git a/build/crypto.m4 b/build/crypto.m4 index 7a418669..e1a9500d 100644 --- a/build/crypto.m4 +++ b/build/crypto.m4 @@ -139,10 +139,17 @@ AC_DEFUN([APU_CHECK_CRYPTO_NSS], [ 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 @@ AC_DEFUN([APU_CHECK_CRYPTO_NSS], [ 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 ]) diff --git a/crypto/apr_crypto_nss.c b/crypto/apr_crypto_nss.c index 29a79bbb..89ba1274 100644 --- a/crypto/apr_crypto_nss.c +++ b/crypto/apr_crypto_nss.c @@ -30,25 +30,20 @@ #if APU_HAVE_CRYPTO -#ifdef HAVE_PRERROR_H #include -#endif -#ifdef HAVE_NSPR4_PRERROR_H -#include -#endif #ifdef HAVE_NSS_NSS_H #include #endif -#ifdef HAVE_NSS3_NSS_H -#include +#ifdef HAVE_NSS_H +#include #endif #ifdef HAVE_NSS_PK11PUB_H #include #endif -#ifdef HAVE_NSS3_PK11PUB_H -#include +#ifdef HAVE_PK11PUB_H +#include #endif struct apr_crypto_config_t { -- cgit v1.2.1