common/autoconf/jdk-options.m4
changeset 33562 c76b2fa11486
parent 32554 c8b77b422f5b
child 33954 6185394cbd60
--- a/common/autoconf/jdk-options.m4	Mon Oct 12 11:49:29 2015 +0200
+++ b/common/autoconf/jdk-options.m4	Mon Oct 19 13:21:27 2015 -0400
@@ -665,3 +665,37 @@
 
   AC_SUBST(GCOV_ENABLED)
 ])
+
+################################################################################
+#
+# Static build support.  When enabled will generate static 
+# libraries instead of shared libraries for all JDK libs.
+#
+AC_DEFUN_ONCE([JDKOPT_SETUP_STATIC_BUILD],
+[
+  AC_ARG_ENABLE([static-build], [AS_HELP_STRING([--enable-static-build],
+    [enable static library build @<:@disabled@:>@])])
+  STATIC_BUILD=false
+  if test "x$enable_static_build" = "xyes"; then
+    AC_MSG_CHECKING([if static build is enabled])
+    AC_MSG_RESULT([yes])
+    if test "x$OPENJDK_TARGET_OS" != "xmacosx"; then
+      AC_MSG_ERROR([--enable-static-build is only supported for macosx builds])
+    fi
+    STATIC_BUILD_CFLAGS="-DSTATIC_BUILD=1"
+    LEGACY_EXTRA_CFLAGS="$LEGACY_EXTRA_CFLAGS $STATIC_BUILD_CFLAGS"
+    LEGACY_EXTRA_CXXFLAGS="$LEGACY_EXTRA_CXXFLAGS $STATIC_BUILD_CFLAGS"
+    CFLAGS_JDKLIB_EXTRA="$CFLAGS_JDKLIB_EXTRA $STATIC_BUILD_CFLAGS"
+    CXXFLAGS_JDKLIB_EXTRA="$CXXFLAGS_JDKLIB_EXTRA $STATIC_BUILD_CFLAGS"
+    STATIC_BUILD=true
+  elif test "x$enable_static_build" = "xno"; then
+    AC_MSG_CHECKING([if static build is enabled])
+    AC_MSG_RESULT([no])
+  elif test "x$enable_static_build" != "x"; then
+    AC_MSG_ERROR([--enable-static-build can only be assigned "yes" or "no"])
+  fi
+
+  AC_SUBST(STATIC_BUILD)
+])
+
+