changeset 1530:f0635543beb3 icedtea-3.0.0pre08

PR1983: Support using the system installation of NSS with the SunEC provider Summary: Add new configure option --enable-system-nss
author andrew
date Wed, 27 Jan 2016 02:50:07 +0000
parents 4a5a0d4e1ae0
children 842cc183c9f6
files common/autoconf/generated-configure.sh common/autoconf/jdk-options.m4 common/autoconf/libraries.m4 common/autoconf/spec.gmk.in
diffstat 4 files changed, 175 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/common/autoconf/generated-configure.sh	Mon Jan 11 17:16:40 2016 +0000
+++ b/common/autoconf/generated-configure.sh	Wed Jan 27 02:50:07 2016 +0000
@@ -642,6 +642,9 @@
 LIBFFI_LIBS
 LIBFFI_CFLAGS
 STATIC_CXX_SETTING
+USE_EXTERNAL_NSS
+NSS_LIBS
+NSS_CFLAGS
 LIBDL
 LIBM
 LIBZIP_CAN_USE_MMAP
@@ -1081,6 +1084,7 @@
 with_lcms
 with_libpng
 with_zlib
+enable_system_nss
 with_stdc__lib
 with_num_cores
 with_memory_size
@@ -1116,6 +1120,8 @@
 LCMS_LIBS
 PNG_CFLAGS
 PNG_LIBS
+NSS_CFLAGS
+NSS_LIBS
 LIBFFI_CFLAGS
 LIBFFI_LIBS'
 
@@ -1758,6 +1764,8 @@
                           disable bundling of the freetype library with the
                           build result [enabled on Windows or when using
                           --with-freetype, disabled otherwise]
+  --enable-system-nss     build the SunEC provider using the system NSS
+                          libraries [disabled]
   --enable-sjavac         use sjavac to do fast incremental compiles
                           [disabled]
   --disable-precompiled-headers
@@ -1911,6 +1919,8 @@
   LCMS_LIBS   linker flags for LCMS, overriding pkg-config
   PNG_CFLAGS  C compiler flags for PNG, overriding pkg-config
   PNG_LIBS    linker flags for PNG, overriding pkg-config
+  NSS_CFLAGS  C compiler flags for NSS, overriding pkg-config
+  NSS_LIBS    linker flags for NSS, overriding pkg-config
   LIBFFI_CFLAGS
               C compiler flags for LIBFFI, overriding pkg-config
   LIBFFI_LIBS linker flags for LIBFFI, overriding pkg-config
@@ -3912,7 +3922,7 @@
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1448583611
+DATE_WHEN_GENERATED=1453861283
 
 ###############################################################################
 #
@@ -35641,6 +35651,118 @@
 
   LIBS="$save_LIBS"
 
+  ###############################################################################
+  #
+  # Check for the NSS libraries
+  #
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build the Sun EC provider against the system NSS libraries" >&5
+$as_echo_n "checking whether to build the Sun EC provider against the system NSS libraries... " >&6; }
+
+  # default is bundled
+  DEFAULT_SYSTEM_NSS=no
+
+  # Check whether --enable-system-nss was given.
+if test "${enable_system_nss+set}" = set; then :
+  enableval=$enable_system_nss;
+    case "${enableval}" in
+      yes)
+        system_nss=yes
+        ;;
+      *)
+        system_nss=no
+        ;;
+    esac
+
+else
+
+    system_nss=${DEFAULT_SYSTEM_NSS}
+
+fi
+
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $system_nss" >&5
+$as_echo "$system_nss" >&6; }
+
+  if test "x${system_nss}" = "xyes"; then
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for NSS" >&5
+$as_echo_n "checking for NSS... " >&6; }
+
+if test -n "$NSS_CFLAGS"; then
+    pkg_cv_NSS_CFLAGS="$NSS_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"nss-softokn >= 3.16.1\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "nss-softokn >= 3.16.1") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_NSS_CFLAGS=`$PKG_CONFIG --cflags "nss-softokn >= 3.16.1" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$NSS_LIBS"; then
+    pkg_cv_NSS_LIBS="$NSS_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"nss-softokn >= 3.16.1\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "nss-softokn >= 3.16.1") 2>&5
+  ac_status=$?
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_NSS_LIBS=`$PKG_CONFIG --libs "nss-softokn >= 3.16.1" 2>/dev/null`
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+	        NSS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "nss-softokn >= 3.16.1" 2>&1`
+        else
+	        NSS_PKG_ERRORS=`$PKG_CONFIG --print-errors "nss-softokn >= 3.16.1" 2>&1`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$NSS_PKG_ERRORS" >&5
+
+	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+                NSS_SOFTOKN_FOUND=no
+elif test $pkg_failed = untried; then
+	NSS_SOFTOKN_FOUND=no
+else
+	NSS_CFLAGS=$pkg_cv_NSS_CFLAGS
+	NSS_LIBS=$pkg_cv_NSS_LIBS
+        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+	NSS_SOFTOKN_FOUND=yes
+fi
+      if test "x${NSS_SOFTOKN_FOUND}" = "xyes"; then
+          NSS_LIBS="$NSS_LIBS -lfreebl";
+	  USE_EXTERNAL_NSS=true
+      else
+	  as_fn_error $? "--enable-system-nss specified, but NSS not found." "$LINENO" 5
+      fi
+  else
+      USE_EXTERNAL_NSS=false
+  fi
+
+
+
 
   ###############################################################################
   #
@@ -35983,10 +36105,11 @@
 
 
 
-    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if elliptic curve crypto implementation is present" >&5
-$as_echo_n "checking if elliptic curve crypto implementation is present... " >&6; }
-
-    if test -d "${SRC_ROOT}/jdk/src/share/native/sun/security/ec/impl"; then
+
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the elliptic curve crypto implementation is present" >&5
+$as_echo_n "checking if the elliptic curve crypto implementation is present... " >&6; }
+
+    if test "x${system_nss}" = "xyes" -o -d "${SRC_ROOT}/jdk/src/share/native/sun/security/ec/impl"; then
       ENABLE_INTREE_EC=yes
       { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
--- a/common/autoconf/jdk-options.m4	Mon Jan 11 17:16:40 2016 +0000
+++ b/common/autoconf/jdk-options.m4	Wed Jan 27 02:50:07 2016 +0000
@@ -414,9 +414,10 @@
   #
   AC_DEFUN_ONCE([JDKOPT_DETECT_INTREE_EC],
   [
-    AC_MSG_CHECKING([if elliptic curve crypto implementation is present])
+    AC_REQUIRE([LIB_SETUP_MISC_LIBS])
+    AC_MSG_CHECKING([if the elliptic curve crypto implementation is present])
 
-    if test -d "${SRC_ROOT}/jdk/src/share/native/sun/security/ec/impl"; then
+    if test "x${system_nss}" = "xyes" -o -d "${SRC_ROOT}/jdk/src/share/native/sun/security/ec/impl"; then
       ENABLE_INTREE_EC=yes
       AC_MSG_RESULT([yes])
     else
--- a/common/autoconf/libraries.m4	Mon Jan 11 17:16:40 2016 +0000
+++ b/common/autoconf/libraries.m4	Wed Jan 27 02:50:07 2016 +0000
@@ -832,6 +832,47 @@
   LIBDL="$LIBS"
   AC_SUBST(LIBDL)
   LIBS="$save_LIBS"
+
+  ###############################################################################
+  #
+  # Check for the NSS libraries
+  #
+
+  AC_MSG_CHECKING([whether to build the Sun EC provider against the system NSS libraries])
+
+  # default is bundled
+  DEFAULT_SYSTEM_NSS=no
+
+  AC_ARG_ENABLE([system-nss], [AS_HELP_STRING([--enable-system-nss],
+     [build the SunEC provider using the system NSS libraries @<:@disabled@:>@])],
+  [
+    case "${enableval}" in
+      yes)
+        system_nss=yes
+        ;;
+      *)
+        system_nss=no
+        ;;
+    esac
+  ],
+  [
+    system_nss=${DEFAULT_SYSTEM_NSS}
+  ])
+  AC_MSG_RESULT([$system_nss])
+
+  if test "x${system_nss}" = "xyes"; then
+      PKG_CHECK_MODULES(NSS, nss-softokn >= 3.16.1, [NSS_SOFTOKN_FOUND=yes], [NSS_SOFTOKN_FOUND=no])
+      if test "x${NSS_SOFTOKN_FOUND}" = "xyes"; then
+          NSS_LIBS="$NSS_LIBS -lfreebl";
+	  USE_EXTERNAL_NSS=true
+      else
+	  AC_MSG_ERROR([--enable-system-nss specified, but NSS not found.])
+      fi
+  else
+      USE_EXTERNAL_NSS=false
+  fi
+  AC_SUBST(USE_EXTERNAL_NSS)
+
 ])
 
 AC_DEFUN_ONCE([LIB_SETUP_STATIC_LINK_LIBSTDCPP],
--- a/common/autoconf/spec.gmk.in	Mon Jan 11 17:16:40 2016 +0000
+++ b/common/autoconf/spec.gmk.in	Wed Jan 27 02:50:07 2016 +0000
@@ -671,6 +671,9 @@
 PNG_LIBS:=@PNG_LIBS@
 PNG_CFLAGS:=@PNG_CFLAGS@
 
+USE_EXTERNAL_NSS:=@USE_EXTERNAL_NSS@
+NSS_LIBS:=@NSS_LIBS@
+NSS_CFLAGS:=@NSS_CFLAGS@
 
 ####################################################
 #