9060861
# HG changeset patch
9060861
# User andrew
9060861
# Date 1453863007 0
9060861
#      Wed Jan 27 02:50:07 2016 +0000
9060861
# Node ID f0635543beb309c4da1bb88c906a76ee4b75e16d
9060861
# Parent  4a5a0d4e1ae0feec2f47d17be380d6fcd5eff126
9060861
PR1983: Support using the system installation of NSS with the SunEC provider
9060861
Summary: Add new configure option --enable-system-nss
9060861
9060861
diff -r 92af9369869f common/autoconf/jdk-options.m4
9060861
--- openjdk/common/autoconf/jdk-options.m4	Thu Jan 21 22:17:02 2016 +0000
9060861
+++ openjdk/common/autoconf/jdk-options.m4	Wed Jan 27 05:32:12 2016 +0000
9060861
@@ -414,9 +414,10 @@
9060861
   #
9060861
   AC_DEFUN_ONCE([JDKOPT_DETECT_INTREE_EC],
9060861
   [
9060861
-    AC_MSG_CHECKING([if elliptic curve crypto implementation is present])
9060861
+    AC_REQUIRE([LIB_SETUP_MISC_LIBS])
9060861
+    AC_MSG_CHECKING([if the elliptic curve crypto implementation is present])
9060861
 
9060861
-    if test -d "${SRC_ROOT}/jdk/src/share/native/sun/security/ec/impl"; then
9060861
+    if test "x${system_nss}" = "xyes" -o -d "${SRC_ROOT}/jdk/src/share/native/sun/security/ec/impl"; then
9060861
       ENABLE_INTREE_EC=yes
9060861
       AC_MSG_RESULT([yes])
9060861
     else
9060861
diff -r 92af9369869f common/autoconf/libraries.m4
9060861
--- openjdk/common/autoconf/libraries.m4	Thu Jan 21 22:17:02 2016 +0000
9060861
+++ openjdk/common/autoconf/libraries.m4	Wed Jan 27 05:32:12 2016 +0000
9060861
@@ -731,6 +731,47 @@
9060861
   LIBDL="$LIBS"
9060861
   AC_SUBST(LIBDL)
9060861
   LIBS="$save_LIBS"
9060861
+
9060861
+  ###############################################################################
9060861
+  #
9060861
+  # Check for the NSS libraries
9060861
+  #
9060861
+
9060861
+  AC_MSG_CHECKING([whether to build the Sun EC provider against the system NSS libraries])
9060861
+
9060861
+  # default is bundled
9060861
+  DEFAULT_SYSTEM_NSS=no
9060861
+
9060861
+  AC_ARG_ENABLE([system-nss], [AS_HELP_STRING([--enable-system-nss],
9060861
+     [build the SunEC provider using the system NSS libraries @<:@disabled@:>@])],
9060861
+  [
9060861
+    case "${enableval}" in
9060861
+      yes)
9060861
+        system_nss=yes
9060861
+        ;;
9060861
+      *)
9060861
+        system_nss=no
9060861
+        ;;
9060861
+    esac
9060861
+  ],
9060861
+  [
9060861
+    system_nss=${DEFAULT_SYSTEM_NSS}
9060861
+  ])
9060861
+  AC_MSG_RESULT([$system_nss])
9060861
+
9060861
+  if test "x${system_nss}" = "xyes"; then
9060861
+      PKG_CHECK_MODULES(NSS, nss-softokn >= 3.16.1, [NSS_SOFTOKN_FOUND=yes], [NSS_SOFTOKN_FOUND=no])
9060861
+      if test "x${NSS_SOFTOKN_FOUND}" = "xyes"; then
9060861
+          NSS_LIBS="$NSS_LIBS -lfreebl";
9060861
+	  USE_EXTERNAL_NSS=true
9060861
+      else
9060861
+	  AC_MSG_ERROR([--enable-system-nss specified, but NSS not found.])
9060861
+      fi
9060861
+  else
9060861
+      USE_EXTERNAL_NSS=false
9060861
+  fi
9060861
+  AC_SUBST(USE_EXTERNAL_NSS)
9060861
+
9060861
 ])
9060861
 
9060861
 AC_DEFUN_ONCE([LIB_SETUP_STATIC_LINK_LIBSTDCPP],
9060861
diff -r 92af9369869f common/autoconf/spec.gmk.in
9060861
--- openjdk/common/autoconf/spec.gmk.in	Thu Jan 21 22:17:02 2016 +0000
9060861
+++ openjdk/common/autoconf/spec.gmk.in	Wed Jan 27 05:32:12 2016 +0000
9060861
@@ -647,6 +647,9 @@
9060861
 # Read-only single-machine data
9060861
 INSTALL_SYSCONFDIR=@sysconfdir@
9060861
 
9060861
+USE_EXTERNAL_NSS:=@USE_EXTERNAL_NSS@
9060861
+NSS_LIBS:=@NSS_LIBS@
9060861
+NSS_CFLAGS:=@NSS_CFLAGS@
9060861
 
9060861
 ####################################################
9060861
 #