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