summary refs log tree commit diff
path: root/configure.in
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2009-04-02 17:00:46 +0000
committerUlrich Drepper <drepper@redhat.com>2009-04-02 17:00:46 +0000
commitff886b82a2b65758950bdb4687cf5a1238f697a1 (patch)
tree46f1826abb9c0fba4227b39fc7ff7e91b3e94c2c /configure.in
parent900d7961d48f704b8396841efb916435faf9c374 (diff)
downloadglibc-ff886b82a2b65758950bdb4687cf5a1238f697a1.tar.gz
glibc-ff886b82a2b65758950bdb4687cf5a1238f697a1.tar.xz
glibc-ff886b82a2b65758950bdb4687cf5a1238f697a1.zip
* configure.in: Recognize --enable-nss-crypt.
	* config.make.in: Add nss-crypt entry.
	* crypt/Makefile: If nss-crypt==yes, don't build md5.c, sha256.c,
	sha512.c.  Don't run md5test, sha256test, sha512test.  Pass -DUSE_NSS
	and include path for NSS directory to compiler for md5-crypt,
	sha256-crypt, sha512-crypt.  Link libcrypt.so with -lfreebl3.
	* crypt/md5-crypt.c: If USE_NSS is defined, don't use local hash
	function implementation, use NSS.  Introduce wrappers around the
	hash function calls.  Little code size optimization.
	* crypt/sha256-crypt.c: Likewise.
	* crypt/sha512-crypt.c: Likewise.
	* scripts/check-local-headers.sh: Ignore nss3 directory.

	* configure.in: Rename pic_default to libc_cv_pic_default.
	* config.make.in: Likewise.
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in43
1 files changed, 39 insertions, 4 deletions
diff --git a/configure.in b/configure.in
index 4015722d5a..02832ddd30 100644
--- a/configure.in
+++ b/configure.in
@@ -272,6 +272,41 @@ AC_ARG_ENABLE([experimental-malloc],
 	      [])
 AC_SUBST(experimental_malloc)
 
+AC_ARG_ENABLE([nss-crypt],
+	      AC_HELP_STRING([--enable-nss-crypt],
+			     [enable libcrypt to use nss]),
+	      [nss_crypt=$enableval],
+	      [nss_crypt=no])
+if test x$nss_crypt = xyes; then
+  nss_includes=-I$(nss-config --includedir 2>/dev/null)
+  if test $? -ne 0; then
+    AC_MSG_ERROR([cannot find include directory with nss-config])
+  fi
+  old_CFLAGS="$CFLAGS"
+  CFLAGS="$CFLAGS $nss_includes"
+  AC_COMPILE_IFELSE([typedef int PRBool;
+#include <hasht.h>
+#include <nsslowhash.h>
+void f (void) { NSSLOW_Init (); }],
+	     libc_cv_nss_crypt=yes,
+	     AC_MSG_ERROR([
+cannot find NSS headers with lowlevel hash function interfaces]))
+  old_LIBS="$LIBS"
+  LIBS="$LIBS -lfreebl3"
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
+#include <hasht.h>
+#include <nsslowhash.h>],
+				  [NSSLOW_Init();])],
+		 libc_cv_nss_crypt=yes,
+		 AC_MSG_ERROR([
+cannot link program using lowlevel NSS hash functions]))
+  CFLAGS="$old_CFLAGS"
+  LIBS="$old_LIBS"
+else
+  libc_cv_nss_crypt=no
+fi
+AC_SUBST(libc_cv_nss_crypt)
+
 AC_CANONICAL_HOST
 
 # The way shlib-versions is used to generate soversions.mk uses a
@@ -2241,18 +2276,18 @@ if test $shared = default; then
   shared=$elf
 fi
 
-AC_CACHE_CHECK([whether -fPIC is default], pic_default,
-[pic_default=yes
+AC_CACHE_CHECK([whether -fPIC is default], libc_cv_pic_default,
+[libc_cv_pic_default=yes
 cat > conftest.c <<EOF
 #if defined __PIC__ || defined __pic__ || defined PIC || defined pic
 # error PIC is default.
 #endif
 EOF
 if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
-  pic_default=no
+  libc_cv_pic_default=no
 fi
 rm -f conftest.*])
-AC_SUBST(pic_default)
+AC_SUBST(libc_cv_pic_default)
 
 AC_SUBST(profile)
 AC_SUBST(omitfp)