From f56f78dbaeac7476c872e2b24eed34d9d738af23 Mon Sep 17 00:00:00 2001 From: Hugh McMaster Date: Mar 29 2019 01:39:47 +0000 Subject: Use PKG_CHECK_MODULES to detect the nspr library --- diff --git a/Makefile.am b/Makefile.am index e06f7c0..e87f35e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -29,7 +29,7 @@ SYSTEMD_DEFINES = @systemd_defs@ CMOCKA_INCLUDES = @cmocka_inc@ PROFILING_DEFINES = @profiling_defs@ -NSPR_INCLUDES = @nspr_inc@ +NSPR_INCLUDES = $(NSPR_CFLAGS) SASL_INCLUDES = @sasl_inc@ @@ -154,7 +154,7 @@ SYSTEMD_LINK = @systemd_lib@ CMOCKA_LINKS = @cmocka_lib@ PROFILING_LINKS = @profiling_links@ -NSPR_LINK = @nspr_lib@ -lplc4 -lplds4 -lnspr4 +NSPR_LINK = $(NSPR_LIBS) NSS_LINK = @nss_lib@ -lssl3 -lnss3 if OPENLDAP @@ -1973,7 +1973,7 @@ libwhoami_plugin_la_LDFLAGS = -avoid-version #------------------------ dbscan_SOURCES = ldap/servers/slapd/tools/dbscan.c -dbscan_CPPFLAGS = @db_inc@ @nspr_inc@ $(AM_CPPFLAGS) +dbscan_CPPFLAGS = @db_inc@ $(NSPR_INCLUDES) $(AM_CPPFLAGS) dbscan_LDADD = $(NSPR_LINK) $(DB_LINK) #------------------------ @@ -2221,7 +2221,6 @@ fixupcmd = sed \ -e 's,@sbindir\@,$(sbindir),g' \ -e 's,@libdir\@,$(libdir),g' \ -e 's,@libexecdir\@,$(libexecdir),g' \ - -e 's,@nspr_libdir\@,$(nspr_libdir),g' \ -e 's,@nss_libdir\@,$(nss_libdir),g' \ -e 's,@ldapsdk_libdir\@,$(ldapsdk_libdir),g' \ -e 's,@ldapsdk_bindir\@,$(ldapsdk_bindir),g' \ diff --git a/configure.ac b/configure.ac index 27b2944..a7318ce 100644 --- a/configure.ac +++ b/configure.ac @@ -818,7 +818,12 @@ AM_CONDITIONAL([SPARC],[test "x$TARGET" = xSPARC]) # Check for library dependencies PKG_CHECK_MODULES([EVENT], [libevent]) -m4_include(m4/nspr.m4) +if $PKG_CONFIG --exists nspr; then + PKG_CHECK_MODULES([NSPR], [nspr]) +else + PKG_CHECK_MODULES([NSPR], [dirsec-nspr]) +fi + m4_include(m4/nss.m4) m4_include(m4/openldap.m4) m4_include(m4/mozldap.m4) diff --git a/m4/mozldap.m4 b/m4/mozldap.m4 index 8084ed8..40fdb88 100644 --- a/m4/mozldap.m4 +++ b/m4/mozldap.m4 @@ -145,7 +145,7 @@ dnl default path for the ldap c sdk tools (see [210947] for more details) dnl the old 5.x or prior versions - the ldap server code expects the new dnl ber types and other code used with version 6 save_cppflags="$CPPFLAGS" - CPPFLAGS="$ldapsdk_inc $nss_inc $nspr_inc" + CPPFLAGS="$ldapsdk_inc $nss_inc $NSPR_CFLAGS" AC_CHECK_HEADER([ldap.h], [isversion6=1], [isversion6=], [#include #if LDAP_VENDOR_VERSION < 600 diff --git a/m4/nspr.m4 b/m4/nspr.m4 deleted file mode 100644 index 503a87f..0000000 --- a/m4/nspr.m4 +++ /dev/null @@ -1,93 +0,0 @@ -# BEGIN COPYRIGHT BLOCK -# Copyright (C) 2007 Red Hat, Inc. -# All rights reserved. -# -# License: GPL (version 3 or any later version). -# See LICENSE for details. -# END COPYRIGHT BLOCK - -AC_CHECKING(for NSPR) - -# check for --with-nspr -AC_MSG_CHECKING(for --with-nspr) -AC_ARG_WITH(nspr, AS_HELP_STRING([--with-nspr@<:@=PATH@:>@],[Netscape Portable Runtime (NSPR) directory]), -[ - if test "$withval" = "yes" - then - AC_MSG_RESULT(yes) - elif test "$withval" = "no" - then - AC_MSG_RESULT(no) - AC_MSG_ERROR([NSPR is required.]) - elif test -e "$withval"/include/nspr.h -a -d "$withval"/lib - then - AC_MSG_RESULT([using $withval]) - NSPRDIR=$withval - nspr_inc="-I$NSPRDIR/include" - nspr_lib="-L$NSPRDIR/lib" - nspr_libdir="$NSPRDIR/lib" - else - echo - AC_MSG_ERROR([$withval not found]) - fi -], -AC_MSG_RESULT(yes)) - -# check for --with-nspr-inc -AC_MSG_CHECKING(for --with-nspr-inc) -AC_ARG_WITH(nspr-inc, AS_HELP_STRING([--with-nspr-inc=PATH],[Netscape Portable Runtime (NSPR) include directory]), -[ - if test -e "$withval"/nspr.h - then - AC_MSG_RESULT([using $withval]) - nspr_inc="-I$withval" - else - echo - AC_MSG_ERROR([$withval not found]) - fi -], -AC_MSG_RESULT(no)) - -# check for --with-nspr-lib -AC_MSG_CHECKING(for --with-nspr-lib) -AC_ARG_WITH(nspr-lib, AS_HELP_STRING([--with-nspr-lib=PATH],[Netscape Portable Runtime (NSPR) library directory]), -[ - if test -d "$withval" - then - AC_MSG_RESULT([using $withval]) - nspr_lib="-L$withval" - nspr_libdir="$withval" - else - echo - AC_MSG_ERROR([$withval not found]) - fi -], -AC_MSG_RESULT(no)) - -# if NSPR is not found yet, try pkg-config - -# last resort -if test -z "$nspr_inc" -o -z "$nspr_lib" -o -z "$nspr_libdir"; then - AC_PATH_PROG(PKG_CONFIG, pkg-config) - AC_MSG_CHECKING(for nspr with pkg-config) - if test -n "$PKG_CONFIG"; then - if $PKG_CONFIG --exists nspr; then - nspr_inc=`$PKG_CONFIG --cflags-only-I nspr` - nspr_lib=`$PKG_CONFIG --libs-only-L nspr` - nspr_libdir=`$PKG_CONFIG --libs-only-L nspr | sed -e s/-L// | sed -e s/\ .*$//` - AC_MSG_RESULT([using system NSPR]) - elif $PKG_CONFIG --exists dirsec-nspr; then - nspr_inc=`$PKG_CONFIG --cflags-only-I dirsec-nspr` - nspr_lib=`$PKG_CONFIG --libs-only-L dirsec-nspr` - nspr_libdir=`$PKG_CONFIG --libs-only-L dirsec-nspr | sed -e s/-L// | sed -e s/\ .*$//` - AC_MSG_RESULT([using system dirsec NSPR]) - else - AC_MSG_ERROR([NSPR not found, specify with --with-nspr.]) - fi - fi -fi - -AC_SUBST(nspr_inc) -AC_SUBST(nspr_lib) -AC_SUBST(nspr_libdir) - diff --git a/m4/openldap.m4 b/m4/openldap.m4 index f3381ff..71a05b5 100644 --- a/m4/openldap.m4 +++ b/m4/openldap.m4 @@ -118,7 +118,7 @@ dnl lets see if we can find the headers and libs if test "$with_openldap" = yes ; then save_cppflags="$CPPFLAGS" - CPPFLAGS="$openldap_inc $nss_inc $nspr_inc" + CPPFLAGS="$openldap_inc $nss_inc $NSPR_CFLAGS" AC_CHECK_HEADER([ldap_features.h], [], [AC_MSG_ERROR([specified with-openldap but ldap_features.h not found])]) dnl figure out which version we're using from the header file