]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
configure: fix and cleanup nss and nspr detection
authorVictor Julien <victor@inliniac.net>
Mon, 8 Oct 2018 11:07:38 +0000 (13:07 +0200)
committerVictor Julien <victor@inliniac.net>
Mon, 8 Oct 2018 14:54:39 +0000 (16:54 +0200)
configure.ac

index 723300b1600c99da2955a28e16cf4d95020ea698..43807c8a379da98e47e1042a19c823e3fbafb9e8 100644 (file)
         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])
             [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