about summary refs log tree commit diff
path: root/configure.ac
diff options
context:
space:
mode:
authorCarlos O'Donell <carlos@systemhalted.org>2016-12-02 15:39:09 -0500
committerCarlos O'Donell <carlos@systemhalted.org>2016-12-02 15:39:09 -0500
commit84aa75162cd5ba73caa76864496fadd2551a5caa (patch)
tree0840bcbc833f69aeaf450a49a2f4bf5048386b45 /configure.ac
parent01b23a30b42a90b1ebd882a0d81110a1542e504a (diff)
downloadglibc-84aa75162cd5ba73caa76864496fadd2551a5caa.tar.gz
glibc-84aa75162cd5ba73caa76864496fadd2551a5caa.tar.xz
glibc-84aa75162cd5ba73caa76864496fadd2551a5caa.zip
Bug 20918 - Building with --enable-nss-crypt fails tst-linkall-static
Some configurations may use NSS cryptographic routines but have no
static library for those routines. The following changes allow glibc to
be built and tested with --enable-nss-crypt, but without having a static
NSS library. At a high level the change does two things:

(1) Detect at configure time if static NSS crypto libraries are
    available.  Assumes libfreebl3.a (instead of the existing Fedora
    libfreebl.a which is incomplete) which matches libfreebl3.so.

(2) If static NSS crypto libraries are _not_ available then adjust the
    way in which we build tst-linkall-static. This includes excluding a
    reference to crypt and not linking against libcrypt.a, all of which
    will fail otherwise.

Testing assumptions:
* Static library is named libfreebl3.a (not libfreebl.a as is currently
  provided in Fedora), matching libfreebl3.so shared link name.

Tested on x86_64 on Fedora with:

(a) --enable-nss-crypt, with no static NSS library support: PASS
    (previous FAIL)

(b) --enable-nss-crypt, with faked static NSS library support: PASS
    (unsupported)
	* Requires changing elf/Makefile to include a stub
	  /lib64/libfreebl3.a for testing purposes.

(c) --disable-nss-crypt: PASS
    (default)

No regressions on x86_64.

For details see:
https://www.sourceware.org/ml/libc-alpha/2016-11/msg00647.html
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac14
1 files changed, 14 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index de0a40f1a7..d719fadeef 100644
--- a/configure.ac
+++ b/configure.ac
@@ -321,6 +321,7 @@ void f (void) { NSSLOW_Init (); }])],
 	     AC_MSG_ERROR([
 cannot find NSS headers with lowlevel hash function interfaces]))
   old_LIBS="$LIBS"
+  old_LDFLAGS="$LDFLAGS"
   LIBS="$LIBS -lfreebl3"
   AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
 #include <hasht.h>
@@ -329,12 +330,25 @@ cannot find NSS headers with lowlevel hash function interfaces]))
 		 libc_cv_nss_crypt=yes,
 		 AC_MSG_ERROR([
 cannot link program using lowlevel NSS hash functions]))
+  # Check to see if there is a static NSS cryptographic library.
+  # If there isn't then we can't link anything with libcrypt.a,
+  # and that might mean disabling some static tests.
+  LDFLAGS="$LDFLAGS -static"
+  AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
+#include <hasht.h>
+#include <nsslowhash.h>],
+				  [NSSLOW_Init();])],
+		 libc_cv_static_nss_crypt=yes,
+		 libc_cv_static_nss_crypt=no)
+  LDFLAGS="$old_LDFLAGS"
   CFLAGS="$old_CFLAGS"
   LIBS="$old_LIBS"
 else
   libc_cv_nss_crypt=no
+  libc_cv_static_nss_crypt=no
 fi
 AC_SUBST(libc_cv_nss_crypt)
+AC_SUBST(libc_cv_static_nss_crypt)
 
 
 AC_ARG_ENABLE([obsolete-rpc],