Blame SOURCES/pr1983-rh1565658-support_using_the_system_installation_of_nss_with_the_sunec_provider_root8.patch

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