Message ID | 1464698125.24965.18.camel@trentalancia.net |
---|---|
State | Superseded |
Headers |
Received: (qmail 65385 invoked by alias); 31 May 2016 12:35:41 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <libc-alpha.sourceware.org> List-Unsubscribe: <mailto:libc-alpha-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:libc-alpha-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 65373 invoked by uid 89); 31 May 2016 12:35:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.4 required=5.0 tests=AWL, BAYES_20, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=includedir, U*guido, D*trentalancia.net, nspr X-HELO: authsmtp.register.it X-Rid: guido@trentalancia.net@151.76.58.157 Message-ID: <1464698125.24965.18.camel@trentalancia.net> Subject: [PATCH v2] When using the Mozilla NSS library for cryptography, include the NSPR header files From: Guido Trentalancia <guido@trentalancia.net> To: GLIBC Devel <libc-alpha@sourceware.org> Date: Tue, 31 May 2016 14:35:25 +0200 In-Reply-To: <1464696577.24965.16.camel@trentalancia.net> References: <1464696577.24965.16.camel@trentalancia.net> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit |
Commit Message
Guido Trentalancia
May 31, 2016, 12:35 p.m. UTC
When configuring and building GNU libc using the Mozilla NSS library
for cryptography (--enable-nss-crypt option), also include the
NSPR header files along with the Mozilla NSS library header files.
Signed-off-by: Guido Trentalancia <guido@trentalancia.net>
---
configure | 6 +++++-
configure.ac | 6 +++++-
crypt/Makefile | 6 +++---
3 files changed, 13 insertions(+), 5 deletions(-)
Comments
On 31/05/2016 09:35, Guido Trentalancia wrote: > When configuring and building GNU libc using the Mozilla NSS library > for cryptography (--enable-nss-crypt option), also include the > NSPR header files along with the Mozilla NSS library header files. > > Signed-off-by: Guido Trentalancia <guido@trentalancia.net> This patch is missing a proper ChangeLog [1] [1] https://sourceware.org/glibc/wiki/Contribution%20checklist#Properly_Formatted_GNU_ChangeLog > --- > configure | 6 +++++- > configure.ac | 6 +++++- > crypt/Makefile | 6 +++--- > 3 files changed, 13 insertions(+), 5 deletions(-) > > --- glibc-31052016-0900GMT/configure 2016-05-30 13:25:35.299696688 +0200 > +++ glibc-configure-nss-crypt-include-nspr-headers/configure 2016-05-31 13:57:28.117571376 +0200 > @@ -3501,8 +3501,12 @@ if test x$nss_crypt = xyes; then > if test $? -ne 0; then > as_fn_error $? "cannot find include directory with nss-config" "$LINENO" 5 > fi > + nspr_includes=-I$(nspr-config --includedir 2>/dev/null) > + if test $? -ne 0; then > + as_fn_error $? "cannot find include directory with nspr-config" "$LINENO" 5 > + fi > old_CFLAGS="$CFLAGS" > - CFLAGS="$CFLAGS $nss_includes" > + CFLAGS="$CFLAGS $nss_includes $nspr_includes" I tried to build it on Ubuntu 16.04 and even with the patch configure failed due it could not find libfreebl3.so. On this distro this is installed on /usr/lib/x86_64-linux-gnu/nss/ and I am not familiar with this project to say if this is the default folder, if it is something recently changed or if it a distro-based modification. Either way I think to fully re-enable the NSS configure option we need to take care of it. > > cat confdefs.h - <<_ACEOF >conftest.$ac_ext > /* end confdefs.h. */ > --- glibc-31052016-0900GMT/configure.ac 2016-05-30 13:25:35.299696688 +0200 > +++ glibc-configure-nss-crypt-include-nspr-headers/configure.ac 2016-05-31 13:58:03.962731844 +0200 > @@ -311,8 +311,12 @@ if test x$nss_crypt = xyes; then > if test $? -ne 0; then > AC_MSG_ERROR([cannot find include directory with nss-config]) > fi > + nspr_includes=-I$(nspr-config --includedir 2>/dev/null) > + if test $? -ne 0; then > + AC_MSG_ERROR([cannot find include directory with nspr-config]) > + fi > old_CFLAGS="$CFLAGS" > - CFLAGS="$CFLAGS $nss_includes" > + CFLAGS="$CFLAGS $nss_includes $nspr_includes" > AC_COMPILE_IFELSE([AC_LANG_PROGRAM([typedef int PRBool; > #include <hasht.h> > #include <nsslowhash.h> > --- glibc-31052016-0900GMT/crypt/Makefile 2016-05-30 13:25:35.306696710 +0200 > +++ glibc-configure-nss-crypt-include-nspr-headers/crypt/Makefile 2016-05-31 14:28:38.995883272 +0200 > @@ -37,9 +37,9 @@ routines += $(libcrypt-routines) > endif > > ifeq ($(nss-crypt),yes) > -CPPFLAGS-sha256-crypt.c = -DUSE_NSS -I$(shell nss-config --includedir) > -CPPFLAGS-sha512-crypt.c = -DUSE_NSS -I$(shell nss-config --includedir) > -CPPFLAGS-md5-crypt.c = -DUSE_NSS -I$(shell nss-config --includedir) > +CPPFLAGS-sha256-crypt.c = -DUSE_NSS -I$(shell nss-config --includedir) -I$(shell nspr-config --includedir) > +CPPFLAGS-sha512-crypt.c = -DUSE_NSS -I$(shell nss-config --includedir) -I$(shell nspr-config --includedir) > +CPPFLAGS-md5-crypt.c = -DUSE_NSS -I$(shell nss-config --includedir) -I$(shell nspr-config --includedir) > LDLIBS-crypt.so = -lfreebl3 > else > libcrypt-routines += md5 sha256 sha512 >
Hello Adhemerval. I'll try to get back on the problem that you mention... On Tue, 31/05/2016 at 11.39 -0300, Adhemerval Zanella wrote: > > On 31/05/2016 09:35, Guido Trentalancia wrote: > > When configuring and building GNU libc using the Mozilla NSS > > library > > for cryptography (--enable-nss-crypt option), also include the > > NSPR header files along with the Mozilla NSS library header files. > > > > Signed-off-by: Guido Trentalancia <guido@trentalancia.net> > > This patch is missing a proper ChangeLog [1] > > [1] https://sourceware.org/glibc/wiki/Contribution%20checklist#Proper > ly_Formatted_GNU_ChangeLog > > > --- > > configure | 6 +++++- > > configure.ac | 6 +++++- > > crypt/Makefile | 6 +++--- > > 3 files changed, 13 insertions(+), 5 deletions(-) > > > > --- glibc-31052016-0900GMT/configure 2016-05-30 > > 13:25:35.299696688 +0200 > > +++ glibc-configure-nss-crypt-include-nspr-headers/configure > > 2016-05-31 13:57:28.117571376 +0200 > > @@ -3501,8 +3501,12 @@ if test x$nss_crypt = xyes; then > > if test $? -ne 0; then > > as_fn_error $? "cannot find include directory with nss-config" > > "$LINENO" 5 > > fi > > + nspr_includes=-I$(nspr-config --includedir 2>/dev/null) > > + if test $? -ne 0; then > > + as_fn_error $? "cannot find include directory with nspr- > > config" "$LINENO" 5 > > + fi > > old_CFLAGS="$CFLAGS" > > - CFLAGS="$CFLAGS $nss_includes" > > + CFLAGS="$CFLAGS $nss_includes $nspr_includes" > > I tried to build it on Ubuntu 16.04 and even with the patch configure > failed > due it could not find libfreebl3.so. On this distro this is > installed on > /usr/lib/x86_64-linux-gnu/nss/ and I am not familiar with this > project to say > if this is the default folder, if it is something recently changed or > if it a > distro-based modification. I suspect it is a distro-based modification. FHS specifies different directories, please see: http://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s09.html http://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s10.html Try adding "/usr/lib/x86_64-linux-gnu/nss/" to LDFLAGS and passing such variable to configure, for example as follows (please adapt it to your needs): LDFLAGS="-L/usr/lib/x86_64-linux-gnu/nss" configure --enable-nss-crypt --whatever-other-options-you-might-need Best regards, Guido Trentalancia > Either way I think to fully re-enable the NSS > configure option we need to take care of it. > > > > > cat confdefs.h - <<_ACEOF >conftest.$ac_ext > > /* end confdefs.h. */ > > --- glibc-31052016-0900GMT/configure.ac 2016-05-30 > > 13:25:35.299696688 +0200 > > +++ glibc-configure-nss-crypt-include-nspr-headers/configure.ac > > 2016-05-31 13:58:03.962731844 +0200 > > @@ -311,8 +311,12 @@ if test x$nss_crypt = xyes; then > > if test $? -ne 0; then > > AC_MSG_ERROR([cannot find include directory with nss-config]) > > fi > > + nspr_includes=-I$(nspr-config --includedir 2>/dev/null) > > + if test $? -ne 0; then > > + AC_MSG_ERROR([cannot find include directory with nspr-config]) > > + fi > > old_CFLAGS="$CFLAGS" > > - CFLAGS="$CFLAGS $nss_includes" > > + CFLAGS="$CFLAGS $nss_includes $nspr_includes" > > AC_COMPILE_IFELSE([AC_LANG_PROGRAM([typedef int PRBool; > > #include <hasht.h> > > #include <nsslowhash.h> > > --- glibc-31052016-0900GMT/crypt/Makefile 2016-05-30 > > 13:25:35.306696710 +0200 > > +++ glibc-configure-nss-crypt-include-nspr-headers/crypt/Makefile > > 2016-05-31 14:28:38.995883272 +0200 > > @@ -37,9 +37,9 @@ routines += $(libcrypt-routines) > > endif > > > > ifeq ($(nss-crypt),yes) > > -CPPFLAGS-sha256-crypt.c = -DUSE_NSS -I$(shell nss-config -- > > includedir) > > -CPPFLAGS-sha512-crypt.c = -DUSE_NSS -I$(shell nss-config -- > > includedir) > > -CPPFLAGS-md5-crypt.c = -DUSE_NSS -I$(shell nss-config -- > > includedir) > > +CPPFLAGS-sha256-crypt.c = -DUSE_NSS -I$(shell nss-config -- > > includedir) -I$(shell nspr-config --includedir) > > +CPPFLAGS-sha512-crypt.c = -DUSE_NSS -I$(shell nss-config -- > > includedir) -I$(shell nspr-config --includedir) > > +CPPFLAGS-md5-crypt.c = -DUSE_NSS -I$(shell nss-config -- > > includedir) -I$(shell nspr-config --includedir) > > LDLIBS-crypt.so = -lfreebl3 > > else > > libcrypt-routines += md5 sha256 sha512 > > >
On 31/05/2016 14:28, Guido Trentalancia wrote: > Hello Adhemerval. > > I'll try to get back on the problem that you mention... > > On Tue, 31/05/2016 at 11.39 -0300, Adhemerval Zanella wrote: >> >> On 31/05/2016 09:35, Guido Trentalancia wrote: >>> When configuring and building GNU libc using the Mozilla NSS >>> library >>> for cryptography (--enable-nss-crypt option), also include the >>> NSPR header files along with the Mozilla NSS library header files. >>> >>> Signed-off-by: Guido Trentalancia <guido@trentalancia.net> >> >> This patch is missing a proper ChangeLog [1] >> >> [1] https://sourceware.org/glibc/wiki/Contribution%20checklist#Proper >> ly_Formatted_GNU_ChangeLog >> >>> --- >>> configure | 6 +++++- >>> configure.ac | 6 +++++- >>> crypt/Makefile | 6 +++--- >>> 3 files changed, 13 insertions(+), 5 deletions(-) >>> >>> --- glibc-31052016-0900GMT/configure 2016-05-30 >>> 13:25:35.299696688 +0200 >>> +++ glibc-configure-nss-crypt-include-nspr-headers/configure >>> 2016-05-31 13:57:28.117571376 +0200 >>> @@ -3501,8 +3501,12 @@ if test x$nss_crypt = xyes; then >>> if test $? -ne 0; then >>> as_fn_error $? "cannot find include directory with nss-config" >>> "$LINENO" 5 >>> fi >>> + nspr_includes=-I$(nspr-config --includedir 2>/dev/null) >>> + if test $? -ne 0; then >>> + as_fn_error $? "cannot find include directory with nspr- >>> config" "$LINENO" 5 >>> + fi >>> old_CFLAGS="$CFLAGS" >>> - CFLAGS="$CFLAGS $nss_includes" >>> + CFLAGS="$CFLAGS $nss_includes $nspr_includes" >> >> I tried to build it on Ubuntu 16.04 and even with the patch configure >> failed >> due it could not find libfreebl3.so. On this distro this is >> installed on >> /usr/lib/x86_64-linux-gnu/nss/ and I am not familiar with this >> project to say >> if this is the default folder, if it is something recently changed or >> if it a >> distro-based modification. > > I suspect it is a distro-based modification. > > FHS specifies different directories, please see: > > http://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s09.html > http://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s10.html > > Try adding "/usr/lib/x86_64-linux-gnu/nss/" to LDFLAGS and passing such > variable to configure, for example as follows (please adapt it to your > needs): > > LDFLAGS="-L/usr/lib/x86_64-linux-gnu/nss" configure --enable-nss-crypt > --whatever-other-options-you-might-need It is indeed an ubuntu/debian modification (patch 85_security_load.patch from libnss3 package) and I think it mainly due ubuntu/debian does not build glibc with NSS flag. > > Best regards, > > Guido Trentalancia > >> Either way I think to fully re-enable the NSS >> configure option we need to take care of it. >> >>> >>> cat confdefs.h - <<_ACEOF >conftest.$ac_ext >>> /* end confdefs.h. */ >>> --- glibc-31052016-0900GMT/configure.ac 2016-05-30 >>> 13:25:35.299696688 +0200 >>> +++ glibc-configure-nss-crypt-include-nspr-headers/configure.ac >>> 2016-05-31 13:58:03.962731844 +0200 >>> @@ -311,8 +311,12 @@ if test x$nss_crypt = xyes; then >>> if test $? -ne 0; then >>> AC_MSG_ERROR([cannot find include directory with nss-config]) >>> fi >>> + nspr_includes=-I$(nspr-config --includedir 2>/dev/null) >>> + if test $? -ne 0; then >>> + AC_MSG_ERROR([cannot find include directory with nspr-config]) >>> + fi >>> old_CFLAGS="$CFLAGS" >>> - CFLAGS="$CFLAGS $nss_includes" >>> + CFLAGS="$CFLAGS $nss_includes $nspr_includes" >>> AC_COMPILE_IFELSE([AC_LANG_PROGRAM([typedef int PRBool; >>> #include <hasht.h> >>> #include <nsslowhash.h> >>> --- glibc-31052016-0900GMT/crypt/Makefile 2016-05-30 >>> 13:25:35.306696710 +0200 >>> +++ glibc-configure-nss-crypt-include-nspr-headers/crypt/Makefile >>> 2016-05-31 14:28:38.995883272 +0200 >>> @@ -37,9 +37,9 @@ routines += $(libcrypt-routines) >>> endif >>> >>> ifeq ($(nss-crypt),yes) >>> -CPPFLAGS-sha256-crypt.c = -DUSE_NSS -I$(shell nss-config -- >>> includedir) >>> -CPPFLAGS-sha512-crypt.c = -DUSE_NSS -I$(shell nss-config -- >>> includedir) >>> -CPPFLAGS-md5-crypt.c = -DUSE_NSS -I$(shell nss-config -- >>> includedir) >>> +CPPFLAGS-sha256-crypt.c = -DUSE_NSS -I$(shell nss-config -- >>> includedir) -I$(shell nspr-config --includedir) >>> +CPPFLAGS-sha512-crypt.c = -DUSE_NSS -I$(shell nss-config -- >>> includedir) -I$(shell nspr-config --includedir) >>> +CPPFLAGS-md5-crypt.c = -DUSE_NSS -I$(shell nss-config -- >>> includedir) -I$(shell nspr-config --includedir) >>> LDLIBS-crypt.so = -lfreebl3 >>> else >>> libcrypt-routines += md5 sha256 sha512 >>> >> >
Hello again. On Tue, 31/05/2016 at 15.50 -0300, Adhemerval Zanella wrote: > > On 31/05/2016 14:28, Guido Trentalancia wrote: > > Hello Adhemerval. > > > > I'll try to get back on the problem that you mention... > > > > On Tue, 31/05/2016 at 11.39 -0300, Adhemerval Zanella wrote: > > > > > > On 31/05/2016 09:35, Guido Trentalancia wrote: > > > > When configuring and building GNU libc using the Mozilla NSS > > > > library > > > > for cryptography (--enable-nss-crypt option), also include the > > > > NSPR header files along with the Mozilla NSS library header > > > > files. > > > > > > > > Signed-off-by: Guido Trentalancia <guido@trentalancia.net> > > > > > > This patch is missing a proper ChangeLog [1] By the way, I have re-submitted the patch with the ChangeLog. So, it's just waiting to be committed... > > > [1] > > > https://sourceware.org/glibc/wiki/Contribution%20checklist#Proper > > > ly_Formatted_GNU_ChangeLog > > > > > > > --- > > > > configure | 6 +++++- > > > > configure.ac | 6 +++++- > > > > crypt/Makefile | 6 +++--- > > > > 3 files changed, 13 insertions(+), 5 deletions(-) > > > > > > > > --- glibc-31052016-0900GMT/configure 2016-05-30 > > > > 13:25:35.299696688 +0200 > > > > +++ glibc-configure-nss-crypt-include-nspr-headers/configure > > > > 2016-05-31 13:57:28.117571376 +0200 > > > > @@ -3501,8 +3501,12 @@ if test x$nss_crypt = xyes; then > > > > if test $? -ne 0; then > > > > as_fn_error $? "cannot find include directory with nss- > > > > config" > > > > "$LINENO" 5 > > > > fi > > > > + nspr_includes=-I$(nspr-config --includedir 2>/dev/null) > > > > + if test $? -ne 0; then > > > > + as_fn_error $? "cannot find include directory with nspr- > > > > config" "$LINENO" 5 > > > > + fi > > > > old_CFLAGS="$CFLAGS" > > > > - CFLAGS="$CFLAGS $nss_includes" > > > > + CFLAGS="$CFLAGS $nss_includes $nspr_includes" > > > > > > I tried to build it on Ubuntu 16.04 and even with the patch > > > configure > > > failed > > > due it could not find libfreebl3.so. On this distro this is > > > installed on > > > /usr/lib/x86_64-linux-gnu/nss/ and I am not familiar with this > > > project to say > > > if this is the default folder, if it is something recently > > > changed or > > > if it a > > > distro-based modification. [...] > > Try adding "/usr/lib/x86_64-linux-gnu/nss/" to LDFLAGS and passing > > such > > variable to configure, for example as follows (please adapt it to > > your > > needs): > > > > LDFLAGS="-L/usr/lib/x86_64-linux-gnu/nss" configure --enable-nss- > > crypt > > --whatever-other-options-you-might-need > > It is indeed an ubuntu/debian modification (patch > 85_security_load.patch > from libnss3 package) and I think it mainly due ubuntu/debian does > not > build glibc with NSS flag. So, have you managed to configure GNU libc to use the Mozilla NSS library on your distribution ? Set LDFLAGS as mentioned above, eventually export it and run configure. The configure script should then be able to link the test program correctly... I look forward to hearing from you. Best regards, Guido Trentalancia
On 31/05/2016 15:56, Guido Trentalancia wrote: > Hello again. > > On Tue, 31/05/2016 at 15.50 -0300, Adhemerval Zanella wrote: >> >> On 31/05/2016 14:28, Guido Trentalancia wrote: >>> Hello Adhemerval. >>> >>> I'll try to get back on the problem that you mention... >>> >>> On Tue, 31/05/2016 at 11.39 -0300, Adhemerval Zanella wrote: >>>> >>>> On 31/05/2016 09:35, Guido Trentalancia wrote: >>>>> When configuring and building GNU libc using the Mozilla NSS >>>>> library >>>>> for cryptography (--enable-nss-crypt option), also include the >>>>> NSPR header files along with the Mozilla NSS library header >>>>> files. >>>>> >>>>> Signed-off-by: Guido Trentalancia <guido@trentalancia.net> >>>> >>>> This patch is missing a proper ChangeLog [1] > > By the way, I have re-submitted the patch with the ChangeLog. So, it's > just waiting to be committed... > >>>> [1] >>>> https://sourceware.org/glibc/wiki/Contribution%20checklist#Proper >>>> ly_Formatted_GNU_ChangeLog >>>> >>>>> --- >>>>> configure | 6 +++++- >>>>> configure.ac | 6 +++++- >>>>> crypt/Makefile | 6 +++--- >>>>> 3 files changed, 13 insertions(+), 5 deletions(-) >>>>> >>>>> --- glibc-31052016-0900GMT/configure 2016-05-30 >>>>> 13:25:35.299696688 +0200 >>>>> +++ glibc-configure-nss-crypt-include-nspr-headers/configure >>>>> 2016-05-31 13:57:28.117571376 +0200 >>>>> @@ -3501,8 +3501,12 @@ if test x$nss_crypt = xyes; then >>>>> if test $? -ne 0; then >>>>> as_fn_error $? "cannot find include directory with nss- >>>>> config" >>>>> "$LINENO" 5 >>>>> fi >>>>> + nspr_includes=-I$(nspr-config --includedir 2>/dev/null) >>>>> + if test $? -ne 0; then >>>>> + as_fn_error $? "cannot find include directory with nspr- >>>>> config" "$LINENO" 5 >>>>> + fi >>>>> old_CFLAGS="$CFLAGS" >>>>> - CFLAGS="$CFLAGS $nss_includes" >>>>> + CFLAGS="$CFLAGS $nss_includes $nspr_includes" >>>> >>>> I tried to build it on Ubuntu 16.04 and even with the patch >>>> configure >>>> failed >>>> due it could not find libfreebl3.so. On this distro this is >>>> installed on >>>> /usr/lib/x86_64-linux-gnu/nss/ and I am not familiar with this >>>> project to say >>>> if this is the default folder, if it is something recently >>>> changed or >>>> if it a >>>> distro-based modification. > > [...] > >>> Try adding "/usr/lib/x86_64-linux-gnu/nss/" to LDFLAGS and passing >>> such >>> variable to configure, for example as follows (please adapt it to >>> your >>> needs): >>> >>> LDFLAGS="-L/usr/lib/x86_64-linux-gnu/nss" configure --enable-nss- >>> crypt >>> --whatever-other-options-you-might-need >> >> It is indeed an ubuntu/debian modification (patch >> 85_security_load.patch >> from libnss3 package) and I think it mainly due ubuntu/debian does >> not >> build glibc with NSS flag. > > So, have you managed to configure GNU libc to use the Mozilla NSS > library on your distribution ? Set LDFLAGS as mentioned above, > eventually export it and run configure. The configure script should > then be able to link the test program correctly... > > I look forward to hearing from you. > > Best regards, > > Guido Trentalancia > In fact I did something different: configure.ac 314 nss_libs=-L$(nss-config --libdir 2>/dev/null) 315 if test $? -ne 0; then 316 AC_MSG_ERROR([cannot find library directory with nss-config]) 317 fi 332 LIBS="$LIBS $nss_libs/nss -lfreebl3" 333 AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool; 334 #include <hasht.h> 335 #include <nsslowhash.h>], And added the linker flag as well on crypt/Makefile. However this is ad hoc fix just to check the patch on my non-default system libnss installation. With these change I could build glibc corretly and libcryto.so is linked against libfreebl3.so (although since its patch is not on ld.so search patch is not found). I think general patch seems correct, I will comment on the third version.
--- glibc-31052016-0900GMT/configure 2016-05-30 13:25:35.299696688 +0200 +++ glibc-configure-nss-crypt-include-nspr-headers/configure 2016-05-31 13:57:28.117571376 +0200 @@ -3501,8 +3501,12 @@ if test x$nss_crypt = xyes; then if test $? -ne 0; then as_fn_error $? "cannot find include directory with nss-config" "$LINENO" 5 fi + nspr_includes=-I$(nspr-config --includedir 2>/dev/null) + if test $? -ne 0; then + as_fn_error $? "cannot find include directory with nspr-config" "$LINENO" 5 + fi old_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $nss_includes" + CFLAGS="$CFLAGS $nss_includes $nspr_includes" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ --- glibc-31052016-0900GMT/configure.ac 2016-05-30 13:25:35.299696688 +0200 +++ glibc-configure-nss-crypt-include-nspr-headers/configure.ac 2016-05-31 13:58:03.962731844 +0200 @@ -311,8 +311,12 @@ if test x$nss_crypt = xyes; then if test $? -ne 0; then AC_MSG_ERROR([cannot find include directory with nss-config]) fi + nspr_includes=-I$(nspr-config --includedir 2>/dev/null) + if test $? -ne 0; then + AC_MSG_ERROR([cannot find include directory with nspr-config]) + fi old_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $nss_includes" + CFLAGS="$CFLAGS $nss_includes $nspr_includes" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([typedef int PRBool; #include <hasht.h> #include <nsslowhash.h> --- glibc-31052016-0900GMT/crypt/Makefile 2016-05-30 13:25:35.306696710 +0200 +++ glibc-configure-nss-crypt-include-nspr-headers/crypt/Makefile 2016-05-31 14:28:38.995883272 +0200 @@ -37,9 +37,9 @@ routines += $(libcrypt-routines) endif ifeq ($(nss-crypt),yes) -CPPFLAGS-sha256-crypt.c = -DUSE_NSS -I$(shell nss-config --includedir) -CPPFLAGS-sha512-crypt.c = -DUSE_NSS -I$(shell nss-config --includedir) -CPPFLAGS-md5-crypt.c = -DUSE_NSS -I$(shell nss-config --includedir) +CPPFLAGS-sha256-crypt.c = -DUSE_NSS -I$(shell nss-config --includedir) -I$(shell nspr-config --includedir) +CPPFLAGS-sha512-crypt.c = -DUSE_NSS -I$(shell nss-config --includedir) -I$(shell nspr-config --includedir) +CPPFLAGS-md5-crypt.c = -DUSE_NSS -I$(shell nss-config --includedir) -I$(shell nspr-config --includedir) LDLIBS-crypt.so = -lfreebl3 else libcrypt-routines += md5 sha256 sha512