diff --git a/make/autoconf/jdk-options.m4 b/make/autoconf/jdk-options.m4 index dafac618c59..89fcbc88521 100644 --- a/make/autoconf/jdk-options.m4 +++ b/make/autoconf/jdk-options.m4 @@ -102,6 +102,13 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS], CHECKING_MSG: [if we should build headless-only (no GUI)]) AC_SUBST(ENABLE_HEADLESS_ONLY) + # Avoid headless-only on macOS and Windows, it is not supported there + if test "x$ENABLE_HEADLESS_ONLY" = xtrue; then + if test "x$OPENJDK_TARGET_OS" = xwindows || test "x$OPENJDK_TARGET_OS" = xmacosx; then + AC_MSG_ERROR([headless-only is not supported on macOS and Windows]) + fi + fi + # should we linktime gc unused code sections in the JDK build ? if test "x$OPENJDK_TARGET_OS" = "xlinux"; then if test "x$OPENJDK_TARGET_CPU" = "xs390x" || test "x$OPENJDK_TARGET_CPU" = "xppc64le"; then