Blame SOURCES/pr1983-rh1565658-support_using_the_system_installation_of_nss_with_the_sunec_provider_root8.patch

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