summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
authorAleksey Sanin <aleksey@src.gnome.org>2003-05-05 15:02:51 +0000
committerAleksey Sanin <aleksey@src.gnome.org>2003-05-05 15:02:51 +0000
commit9ea848cb32577003171f8d80b626d24b8ee21ee0 (patch)
tree683196626b942b8a5753be255b9bdbb335530198 /configure.in
parentacb83f646b4d84c3ccadbdcb1981f551b17ed7f9 (diff)
downloadxmlsec1-9ea848cb32577003171f8d80b626d24b8ee21ee0.tar.gz
xmlsec1-9ea848cb32577003171f8d80b626d24b8ee21ee0.tar.bz2
xmlsec1-9ea848cb32577003171f8d80b626d24b8ee21ee0.zip
changes to NSS config and NSS includes (patch from Tej)
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in271
1 files changed, 207 insertions, 64 deletions
diff --git a/configure.in b/configure.in
index acee2b00..33d6e052 100644
--- a/configure.in
+++ b/configure.in
@@ -379,98 +379,241 @@ AC_SUBST(GNUTLS_LDADDS)
AC_SUBST(XMLSEC_GNUTLS_DEFINES)
dnl ==========================================================================
-dnl See if we can find NSS
+dnl See if we can find NSS and NSPR
+dnl Allow the use of:
+dnl 1. Mozilla style distribution where all mozilla components (NSS, NSPR
+dnl are just 2 of over 100 components) are under one directory.
+dnl options: [--with-mozilla-ver=<VERSION>]
+dnl
+dnl Using the version number, various directories are searched
+dnl for NSS & NSPR
+dnl
+dnl AND / OR
+dnl
+dnl 2. separate NSS & NSPR distributions
+dnl options: [--with-nss=<PFX>] [--with-nspr=<PFX>]
+dnl
+dnl 2 overrides 1
+dnl
dnl ==========================================================================
XMLSEC_NSS_DEFINES=""
NSS_WITHOUT="no"
-NSS_MIN_VERSION="1.2.1"
+NSS_MIN_VERSION="3.2"
NSS_VERSION=""
-NSS_PREFIX=""
NSS_CFLAGS=""
NSS_LIBS=""
NSS_LDADDS=""
-NSS_LIBS_LIST="-lnss3 -lnspr4 -lplds4 -lplc4"
-ac_mozilla_name=mozilla-$NSS_MIN_VERSION
-ac_nss_lib_dir="/usr/lib /usr/local/lib /usr/lib/$ac_mozilla_name /usr/local/lib/$ac_mozilla_name"
-ac_nss_inc_dir="/usr/include /usr/local/include /usr/include/$ac_mozilla_name /usr/local/include/$ac_mozilla_name"
-AC_MSG_CHECKING(for nss libraries >= $NSS_MIN_VERSION)
+NSS_PREFIX=""
+NSPR_PREFIX=""
+NSS_LIBS_LIST="-lnss3"
+NSPR_LIBS_LIST="-lnspr4 -lplds4 -lplc4"
+
+dnl if nss is disabled, bail out early
AC_ARG_WITH(nss, [ --with-nss=[PFX] nss location])
+AC_ARG_WITH(nspr, [ --with-nspr=[PFX] nspr location (needed for NSS)])
+AC_ARG_WITH(mozilla, [ --with-mozilla-ver=[VER] mozilla version (alt to --with-nss, --with-nspr)])
if test "$with_nss" = "no" ; then
NSS_WITHOUT="yes"
XMLSEC_CRYPTO_DISABLED_LIST="$XMLSEC_CRYPTO_DISABLED_LIST nss"
- AC_MSG_RESULT(no)
else
+ MOZILLA_VERSION="1.2.1"
+ NSPR_MIN_VERSION="4.0"
+ NSPR_INCLUDES_FOUND="no"
+ NSPR_LIBS_FOUND="no"
+ NSS_EXPLICIT="no"
+ NSPR_EXPLICIT="no"
+ NSPR_PRINIT_H=""
+ NSS_NSS_H=""
+
+ dnl process the mozilla options if any
+
+ if test "$with_mozilla_version" != "" ; then
+ MOZILLA_VERSION=$with_mozilla_version
+ fi
+
+ ac_mozilla_name=mozilla-$MOZILLA_VERSION
+ ac_nss_lib_dir="/usr/lib /usr/local/lib /usr/lib/$ac_mozilla_name /usr/local/lib/$ac_mozilla_name"
+ ac_nss_inc_dir="/usr/include /usr/local/include /usr/include/$ac_mozilla_name /usr/local/include/$ac_mozilla_name"
+
+ dnl now look for nspr
+ AC_MSG_CHECKING(for nspr libraries >= $NSPR_MIN_VERSION)
+
+ if test "$with_nspr" = "no" ; then
+ AC_MSG_RESULT(no)
+ else
+ if test "$with_nspr" != "" ; then
+ NSPR_PREFIX="$with_nspr"
+ NSPR_CFLAGS="-I$with_nspr/include"
+ NSPR_LIBS="-L$with_nspr/lib $NSPR_LIBS_LIST"
+ NSPR_LDADDS="-L$with_nspr/lib $NSPR_LIBS_LIST"
+ NSPR_INCLUDES_FOUND="yes"
+ NSPR_LIBS_FOUND="yes"
+ NSPR_EXPLICIT="yes"
+ NSPR_PRINIT_H="$with_nspr/include/prinit.h"
+ else
+ for dir in $ac_nss_inc_dir; do
+ if test -f $dir/nspr/prinit.h; then
+ dnl do not add -I/usr/include because compiler does it anyway
+ if test "$dir" = "/usr/include" ; then
+ NSPR_CFLAGS=""
+ else
+ NSPR_CFLAGS="-I$dir/nspr"
+ fi
+ NSPR_INCLUDES_FOUND="yes"
+ NSPR_PRINIT_H="$dir/nspr/prinit.h"
+ break
+ fi
+ done
+
+ for dir in $ac_nss_lib_dir; do
+ if test -f $dir/libnspr4.so; then
+ dnl do not add -L/usr/lib because compiler does it anyway
+ if test "$dir" = "/usr/lib" ; then
+ NSPR_LIBS="$NSPR_LIBS_LIST"
+ else
+ NSPR_LIBS="-L$dir $NSPR_LIBS_LIST"
+ fi
+ NSPR_LIBS_FOUND="yes"
+ break
+ fi
+ done
+ fi
+
+ if test "$NSPR_INCLUDES_FOUND" = "yes" -a "$NSPR_LIBS_FOUND" = "yes" ;
+ then
+ NSPR_VERSION=`cat $NSPR_PRINIT_H | grep PR_VERSION | grep '#define' | awk -F' ' '{printf "%s", $3}' | sed -e 's/"//g'`
+ OLD_CPPFLAGS=$CPPFLAGS
+ CPPFLAGS="$NSPR_CFLAGS"
+ AC_EGREP_CPP(yes,[
+ #include <prinit.h>
+ #if PR_VMAJOR >= 4
+ yes
+ #endif
+ ],[
+ AC_MSG_RESULT(yes ('$NSPR_VERSION'))
+ ],[
+ NSPR_INCLUDES_FOUND="no"
+ AC_MSG_RESULT(no)
+ ])
+ CPPFLAGS="$OLD_CPPFLAGS"
+ else
+ AC_MSG_RESULT(no)
+ fi
+
+ fi
+
+ dnl look for nss
+ AC_MSG_CHECKING(for nss libraries >= $NSS_MIN_VERSION)
+
if test "$with_nss" != "" ; then
- NSS_PREFIX=$with_nss
- NSS_CFLAGS="-I$NSS_PREFIX/include -I$NSS_PREFIX/include/nss -I$NSS_PREFIX/include/nspr"
- NSS_LIBS="-L$NSS_PREFIX/lib $NSS_LIBS_LIST"
- NSS_LDADDS="-L$NSS_PREFIX/lib $NSS_LIBS_LIST"
- NSS_INCLUDES_FOUND="yes"
- NSS_LIBS_FOUND="yes"
+ NSS_PREFIX="$with_nss"
+ NSS_CFLAGS="-I$with_nss/include"
+ NSS_LIBS="-L$with_nss/lib $NSS_LIBS_LIST"
+ NSS_LDADDS="-L$with_nss/lib $NSS_LIBS_LIST"
+ NSS_INCLUDES_FOUND="yes"
+ NSS_LIBS_FOUND="yes"
+ NSS_EXPLICIT="yes"
+ NSS_NSS_H="$with_nss/include/nss.h"
else
- NSS_INCLUDES_FOUND="no"
- NSS_LIBS_FOUND="no"
- for dir in $ac_nss_inc_dir; do
- if test -f $dir/nss/nss.h; then
- dnl do not add -I/usr/include because compiler does it anyway
- if test "$dir" = "/usr/include" ; then
- NSS_CFLAGS="-I$dir/nss -I$dir/nspr"
- else
- NSS_CFLAGS="-I$dir -I$dir/nss -I$dir/nspr"
- fi
- NSS_INCLUDES_FOUND="yes"
- break
- fi
- done
+ for dir in $ac_nss_inc_dir; do
+ if test -f $dir/nss/nss.h; then
+ dnl do not add -I/usr/include because compiler does it anyway
+ if test "$dir" = "/usr/include" ; then
+ NSS_CFLAGS=""
+ else
+ NSS_CFLAGS="-I$dir/nss"
+ fi
+ NSS_INCLUDES_FOUND="yes"
+ NSS_NSS_H="$dir/nss/nss.h"
+ break
+ fi
+ done
+ for dir in $ac_nss_lib_dir; do
+ if test -f $dir/libnss3.so; then
+ dnl do not add -L/usr/lib because compiler does it anyway
+ if test "$dir" = "/usr/lib" ; then
+ NSS_LIBS="$NSS_LIBS_LIST"
+ else
+ NSS_LIBS="-L$dir $NSS_LIBS_LIST"
+ fi
+ NSS_LIBS_FOUND="yes"
+ break
+ fi
+ done
+ fi
- for dir in $ac_nss_lib_dir; do
- if test -f $dir/libnss3.so; then
- dnl do not add -L/usr/lib because compiler does it anyway
- if test "$dir" = "/usr/lib" ; then
- NSS_LIBS="-L$dir $NSS_LIBS_LIST"
- NSS_LDADDS="-L$dir $NSS_LIBS_LIST"
- else
- NSS_LIBS="-L$dir $NSS_LIBS_LIST"
- NSS_LDADDS="-L$dir $NSS_LIBS_LIST"
- fi
- NSS_LIBS_FOUND="yes"
- ac_found_nss_lib_dir=$dir
- break;
- fi
- done
+ if test "$NSS_INCLUDES_FOUND" = "yes" -a "$NSS_LIBS_FOUND" = "yes" ;
+ then
+ NSS_VERSION=`cat $NSS_NSS_H | grep NSS_VERSION | grep '#define' | awk -F' ' '{printf "%s", $3}' | sed -e 's/"//g'`
+ OLD_CPPFLAGS=$CPPFLAGS
+ CPPFLAGS="$NSS_CFLAGS"
+ AC_EGREP_CPP(yes,[
+ #include <nss.h>
+ #if NSS_VMAJOR >= 3 && NSS_VMINOR >= 2
+ yes
+ #endif
+ ],[
+ AC_MSG_RESULT(yes ('$NSS_VERSION'))
+ ],[
+ NSS_INCLUDES_FOUND="no"
+ AC_MSG_RESULT(no)
+ ])
+ CPPFLAGS="$OLD_CPPFLAGS"
+ else
+ AC_MSG_RESULT(no)
fi
-
- if test "$NSS_INCLUDES_FOUND" = "yes" -a "$NSS_LIBS_FOUND" = "yes" ;
+
+ if test "$NSPR_INCLUDES_FOUND" != "yes" -o "$NSPR_LIBS_FOUND" != "yes"
then
- dnl Check the NSS version
- dnl todo: check the version
- NSS_WITHOUT="no"
+ if test "$NSPR_EXPLICIT" == "yes"
+ then
+ AC_MSG_ERROR(You need atleast version 4.0 of NSPR as a pre-requisite for NSS in this version of $PACKAGE)
+ else
+ NSS_WITHOUT="yes"
+ fi
+ fi
+
+ if test "$NSS_INCLUDES_FOUND" != "yes" -o "$NSS_LIBS_FOUND" != "yes"
+ then
+ if test "$NSS_EXPLICIT" == "yes"
+ then
+ AC_MSG_ERROR(You need atleast version 3.2 of NSS for this version of $PACKAGE)
+ else
+ NSS_WITHOUT="yes"
+ fi
+ fi
- dnl first crypto library is default one
- if test "z$XMLSEC_CRYPTO" = "z"
- then
- XMLSEC_CRYPTO="nss"
- XMLSEC_CRYPTO_LIB="xmlsec1-nss"
- XMLSEC_CRYPTO_CFLAGS="$NSS_CFLAGS -DXMLSEC_CRYPTO_NSS=1"
- XMLSEC_CRYPTO_LIBS="$NSS_LIBS"
- XMLSEC_CRYPTO_LDADDS="$NSS_LDADDS"
- fi
- XMLSEC_CRYPTO_LIST="$XMLSEC_CRYPTO_LIST nss"
- AC_MSG_RESULT(yes ('$NSS_VERSION'))
+ if test "$NSS_WITHOUT" = "no"
+ then
+ NSS_CFLAGS="$NSS_CFLAGS $NSPR_CFLAGS"
+ NSS_LIBS="$NSS_LIBS $NSPR_LIBS"
+ NSS_LDADDS="$NSS_LDADDS $NSPR_LDADDS"
+ dnl first crypto library is default one
+ if test "z$XMLSEC_CRYPTO" = "z"
+ then
+ XMLSEC_CRYPTO="nss"
+ XMLSEC_CRYPTO_LIB="xmlsec1-nss"
+ XMLSEC_CRYPTO_CFLAGS="$NSS_CFLAGS -DXMLSEC_CRYPTO_NSS=1"
+ XMLSEC_CRYPTO_LIBS="$NSS_LIBS"
+ XMLSEC_CRYPTO_LDADDS="$NSS_LDADDS"
+ fi
+ XMLSEC_CRYPTO_LIST="$XMLSEC_CRYPTO_LIST nss"
else
- XMLSEC_CRYPTO_DISABLED_LIST="$XMLSEC_CRYPTO_DISABLED_LIST nss"
- AC_MSG_RESULT(no)
+ XMLSEC_CRYPTO_DISABLED_LIST="$XMLSEC_CRYPTO_DISABLED_LIST nss"
fi
fi
+
AC_SUBST(NSS_WITHOUT)
AC_SUBST(NSS_MIN_VERSION)
AC_SUBST(NSS_VERSION)
-AC_SUBST(NSS_CONFIG)
-AC_SUBST(NSS_PREFIX)
AC_SUBST(NSS_CFLAGS)
AC_SUBST(NSS_LIBS)
AC_SUBST(NSS_LDADDS)
+AC_SUBST(NSS_LIBS_LIST)
+AC_SUBST(NSPR_LIBS_LIST)
+AC_SUBST(NSS_PREFIX)
+AC_SUBST(NSPR_PREFIX)
AC_SUBST(XMLSEC_NSS_DEFINES)
dnl ==========================================================================