From: Victor Julien Date: Mon, 8 Oct 2018 11:07:38 +0000 (+0200) Subject: configure: fix and cleanup nss and nspr detection X-Git-Tag: suricata-4.1.0-rc2~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4ece6ba7588ad31df9fe6c93b8983cfe23f92ccb;p=thirdparty%2Fsuricata.git configure: fix and cleanup nss and nspr detection --- diff --git a/configure.ac b/configure.ac index 723300b160..43807c8a37 100644 --- a/configure.ac +++ b/configure.ac @@ -1646,10 +1646,10 @@ AC_DEFINE([HAVE_DAG],[1],(Endace DAG card support enabled)) fi - # libnspr - enable_nspr="no" +# libnspr AC_ARG_ENABLE(nspr, - AS_HELP_STRING([--disable-nspr],[Disable libnspr support])) + AS_HELP_STRING([--disable-nspr],[Disable libnspr support]), + [enable_nspr=$enableval],[enable_nspr="yes"]) AC_ARG_WITH(libnspr_includes, [ --with-libnspr-includes=DIR libnspr include directory], [with_libnspr_includes="$withval"],[with_libnspr_includes=no]) @@ -1658,86 +1658,87 @@ [with_libnspr_libraries="$withval"],[with_libnspr_libraries="no"]) if test "$enable_nspr" != "no"; then - # Try pkg-config first: - PKG_CHECK_MODULES([libnspr], nspr,, [with_pkgconfig_nspr=no]) - if test "$with_pkgconfig_nspr" != "no"; then - CPPFLAGS="${CPPFLAGS} ${libnspr_CFLAGS}" - LIBS="${LIBS} ${libnspr_LIBS}" - fi + # Try pkg-config first: + PKG_CHECK_MODULES([libnspr], nspr,, [with_pkgconfig_nspr=no]) + if test "$with_pkgconfig_nspr" != "no"; then + CPPFLAGS="${CPPFLAGS} ${libnspr_CFLAGS}" + LIBS="${LIBS} ${libnspr_LIBS}" + fi - if test "$with_libnspr_includes" != "no"; then - CPPFLAGS="${CPPFLAGS} -I${with_libnspr_includes}" - fi + if test "$with_libnspr_includes" != "no"; then + CPPFLAGS="${CPPFLAGS} -I${with_libnspr_includes}" + fi - AC_CHECK_HEADER(nspr.h,NSPR="yes",NSPR="no") - if test "$NSPR" = "yes"; then - if test "$with_libnspr_libraries" != "no"; then - LDFLAGS="${LDFLAGS} -L${with_libnspr_libraries}" - fi + AC_CHECK_HEADER(nspr.h,NSPR="yes",NSPR="no") + if test "$NSPR" = "yes"; then + if test "$with_libnspr_libraries" != "no"; then + LDFLAGS="${LDFLAGS} -L${with_libnspr_libraries}" + fi - AC_CHECK_LIB(nspr4, PR_GetCurrentThread,, NSPR="no") - - if test "$NSPR" = "no"; then - echo - echo " ERROR! libnspr library not found, go get it" - echo " from Mozilla or your distribution:" - echo - echo " Ubuntu: apt-get install libnspr4-dev" - echo " Fedora: dnf install nspr-devel" - echo " CentOS/RHEL: yum install nspr-devel" - echo - exit 1 - fi - enable_nspr="yes" - fi + AC_CHECK_LIB(nspr4, PR_GetCurrentThread,, NSPR="no") + + if test "$NSPR" = "no"; then + echo + echo " ERROR! libnspr library not found, go get it" + echo " from Mozilla or your distribution:" + echo + echo " Ubuntu: apt-get install libnspr4-dev" + echo " Fedora: dnf install nspr-devel" + echo " CentOS/RHEL: yum install nspr-devel" + echo + exit 1 + fi + else + enable_nspr="no" + fi fi # libnss - enable_nss="no" AC_ARG_ENABLE(nss, - AS_HELP_STRING([--disable-nss],[Disable libnss support])) + AS_HELP_STRING([--disable-nss],[Disable libnss support]), + [enable_nss=$enableval],[enable_nss="yes"]) AC_ARG_WITH(libnss_includes, [ --with-libnss-includes=DIR libnss include directory], - [with_libnss_includes="$withval"],[with_libnss_includes=no]) + [with_libnss_includes="$withval"],[with_libnss_includes="no"]) AC_ARG_WITH(libnss_libraries, [ --with-libnss-libraries=DIR libnss library directory], [with_libnss_libraries="$withval"],[with_libnss_libraries="no"]) if test "$enable_nss" != "no"; then - # Try pkg-config first: - PKG_CHECK_MODULES([libnss], nss,, [with_pkgconfig_nss=no]) - if test "$with_pkgconfig_nss" != "no"; then - CPPFLAGS="${CPPFLAGS} ${libnss_CFLAGS}" - LIBS="${LIBS} ${libnss_LIBS}" - fi - - if test "$with_libnss_includes" != "no"; then - CPPFLAGS="${CPPFLAGS} -I${with_libnss_includes}" - fi + # Try pkg-config first: + PKG_CHECK_MODULES([libnss], nss,, [with_pkgconfig_nss=no]) + if test "$with_pkgconfig_nss" != "no"; then + CPPFLAGS="${CPPFLAGS} ${libnss_CFLAGS}" + LIBS="${LIBS} ${libnss_LIBS}" + fi + if test "$with_libnss_includes" != "no"; then + CPPFLAGS="${CPPFLAGS} -I${with_libnss_includes}" + fi - AC_CHECK_HEADER(sechash.h,NSS="yes",NSS="no") - if test "$NSS" = "yes"; then - if test "$with_libnss_libraries" != "no"; then - LDFLAGS="${LDFLAGS} -L${with_libnss_libraries}" - fi + AC_CHECK_HEADER(sechash.h,NSS="yes",NSS="no") + if test "$NSS" = "yes"; then + if test "$with_libnss_libraries" != "no"; then + LDFLAGS="${LDFLAGS} -L${with_libnss_libraries}" + fi - AC_CHECK_LIB(nss3, HASH_Begin,, NSS="no") - - if test "$NSS" = "no"; then - echo - echo " ERROR! libnss library not found, go get it" - echo " from Mozilla or your distribution:" - echo - echo " Ubuntu: apt-get install libnss3-dev" - echo " Fedora: dnf install nss-devel" - echo " CentOS/RHEL: yum install nss-devel" - echo - exit 1 - fi + AC_CHECK_LIB(nss3, HASH_Begin,, NSS="no") + if test "$NSS" = "no"; then + echo + echo " ERROR! libnss library not found, go get it" + echo " from Mozilla or your distribution:" + echo + echo " Ubuntu: apt-get install libnss3-dev" + echo " Fedora: dnf install nss-devel" + echo " CentOS/RHEL: yum install nss-devel" + echo + exit 1 + fi - AC_DEFINE([HAVE_NSS],[1],[libnss available for md5]) - enable_nss="yes" - fi + AC_DEFINE([HAVE_NSS],[1],[libnss available for md5/sha1/sha256]) + enable_nss="yes" + else + enable_nss="no" + fi fi # libmagic