< prev index next >

common/autoconf/jdk-options.m4

Print this page
rev 1673 : 8136556: Add the ability to perform static builds of MacOSX x64 binaries
Reviewed-by: ihse, bdelsart, gadams, lfoltan, rriggs, hseigel, twisti

@@ -663,5 +663,39 @@
     AC_MSG_ERROR([--enable-native-coverage can only be assigned "yes" or "no"])
   fi
 
   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)
+])
+
+
< prev index next >