diff -r 49baf50a6840 -r 5e83ad1a521a common/autoconf/libraries.m4 --- a/common/autoconf/libraries.m4 Wed Nov 05 09:51:33 2014 +0100 +++ b/common/autoconf/libraries.m4 Wed Nov 05 10:21:59 2014 +0100 @@ -91,85 +91,93 @@ # Check for X Windows # - # Check if the user has specified sysroot, but not --x-includes or --x-libraries. - # Make a simple check for the libraries at the sysroot, and setup --x-includes and - # --x-libraries for the sysroot, if that seems to be correct. - if test "x$OPENJDK_TARGET_OS" = "xlinux"; then - if test "x$SYSROOT" != "x"; then - if test "x$x_includes" = xNONE; then - if test -f "$SYSROOT/usr/X11R6/include/X11/Xlib.h"; then - x_includes="$SYSROOT/usr/X11R6/include" - elif test -f "$SYSROOT/usr/include/X11/Xlib.h"; then - x_includes="$SYSROOT/usr/include" + if test "x$X11_NOT_NEEDED" = xyes; then + if test "x${with_x}" != x; then + AC_MSG_WARN([X11 is not used, so --with-x is ignored]) + fi + X_CFLAGS= + X_LIBS= + else + # Check if the user has specified sysroot, but not --x-includes or --x-libraries. + # Make a simple check for the libraries at the sysroot, and setup --x-includes and + # --x-libraries for the sysroot, if that seems to be correct. + if test "x$OPENJDK_TARGET_OS" = "xlinux"; then + if test "x$SYSROOT" != "x"; then + if test "x$x_includes" = xNONE; then + if test -f "$SYSROOT/usr/X11R6/include/X11/Xlib.h"; then + x_includes="$SYSROOT/usr/X11R6/include" + elif test -f "$SYSROOT/usr/include/X11/Xlib.h"; then + x_includes="$SYSROOT/usr/include" + fi fi - fi - if test "x$x_libraries" = xNONE; then - if test -f "$SYSROOT/usr/X11R6/lib/libX11.so"; then - x_libraries="$SYSROOT/usr/X11R6/lib" - elif test "$SYSROOT/usr/lib64/libX11.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then - x_libraries="$SYSROOT/usr/lib64" - elif test -f "$SYSROOT/usr/lib/libX11.so"; then - x_libraries="$SYSROOT/usr/lib" + if test "x$x_libraries" = xNONE; then + if test -f "$SYSROOT/usr/X11R6/lib/libX11.so"; then + x_libraries="$SYSROOT/usr/X11R6/lib" + elif test "$SYSROOT/usr/lib64/libX11.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then + x_libraries="$SYSROOT/usr/lib64" + elif test -f "$SYSROOT/usr/lib/libX11.so"; then + x_libraries="$SYSROOT/usr/lib" + fi fi fi fi - fi - # Now let autoconf do it's magic - AC_PATH_X - AC_PATH_XTRA + # Now let autoconf do it's magic + AC_PATH_X + AC_PATH_XTRA - # AC_PATH_XTRA creates X_LIBS and sometimes adds -R flags. When cross compiling - # this doesn't make sense so we remove it. - if test "x$COMPILE_TYPE" = xcross; then - X_LIBS=`$ECHO $X_LIBS | $SED 's/-R \{0,1\}[[^ ]]*//g'` - fi + # AC_PATH_XTRA creates X_LIBS and sometimes adds -R flags. When cross compiling + # this doesn't make sense so we remove it. + if test "x$COMPILE_TYPE" = xcross; then + X_LIBS=`$ECHO $X_LIBS | $SED 's/-R \{0,1\}[[^ ]]*//g'` + fi - if test "x$no_x" = xyes && test "x$X11_NOT_NEEDED" != xyes; then - HELP_MSG_MISSING_DEPENDENCY([x11]) - AC_MSG_ERROR([Could not find X11 libraries. $HELP_MSG]) - fi + if test "x$no_x" = xyes; then + HELP_MSG_MISSING_DEPENDENCY([x11]) + AC_MSG_ERROR([Could not find X11 libraries. $HELP_MSG]) + fi - if test "x$OPENJDK_TARGET_OS" = xsolaris; then - OPENWIN_HOME="/usr/openwin" - X_CFLAGS="-I$SYSROOT$OPENWIN_HOME/include -I$SYSROOT$OPENWIN_HOME/include/X11/extensions" - X_LIBS="-L$SYSROOT$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \ - -L$SYSROOT$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR \ - -R$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \ - -R$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR" - fi + if test "x$OPENJDK_TARGET_OS" = xsolaris; then + OPENWIN_HOME="/usr/openwin" + X_CFLAGS="-I$SYSROOT$OPENWIN_HOME/include -I$SYSROOT$OPENWIN_HOME/include/X11/extensions" + X_LIBS="-L$SYSROOT$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \ + -L$SYSROOT$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR \ + -R$OPENWIN_HOME/sfw/lib$OPENJDK_TARGET_CPU_ISADIR \ + -R$OPENWIN_HOME/lib$OPENJDK_TARGET_CPU_ISADIR" + fi + + AC_LANG_PUSH(C) + OLD_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $SYSROOT_CFLAGS $X_CFLAGS" - AC_LANG_PUSH(C) - OLD_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $SYSROOT_CFLAGS $X_CFLAGS" - - # Need to include Xlib.h and Xutil.h to avoid "present but cannot be compiled" warnings on Solaris 10 - AC_CHECK_HEADERS([X11/extensions/shape.h X11/extensions/Xrender.h X11/extensions/XTest.h X11/Intrinsic.h], - [X11_A_OK=yes], - [X11_A_OK=no; break], - [ - # include - # include - ] - ) + # Need to include Xlib.h and Xutil.h to avoid "present but cannot be compiled" warnings on Solaris 10 + AC_CHECK_HEADERS([X11/extensions/shape.h X11/extensions/Xrender.h X11/extensions/XTest.h X11/Intrinsic.h], + [X11_HEADERS_OK=yes], + [X11_HEADERS_OK=no; break], + [ + # include + # include + ] + ) - # If XLinearGradient isn't available in Xrender.h, signal that it needs to be - # defined in libawt_xawt. - AC_MSG_CHECKING([if XlinearGradient is defined in Xrender.h]) - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#include ]], - [[XLinearGradient x;]])], - [AC_MSG_RESULT([yes])], - [AC_MSG_RESULT([no]) - X_CFLAGS="$X_CFLAGS -DSOLARIS10_NO_XRENDER_STRUCTS"]) + if test "x$X11_HEADERS_OK" = xno; then + HELP_MSG_MISSING_DEPENDENCY([x11]) + AC_MSG_ERROR([Could not find all X11 headers (shape.h Xrender.h XTest.h Intrinsic.h). $HELP_MSG]) + fi - CFLAGS="$OLD_CFLAGS" - AC_LANG_POP(C) + # If XLinearGradient isn't available in Xrender.h, signal that it needs to be + # defined in libawt_xawt. + AC_MSG_CHECKING([if XlinearGradient is defined in Xrender.h]) + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[XLinearGradient x;]])], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + X_CFLAGS="$X_CFLAGS -DSOLARIS10_NO_XRENDER_STRUCTS"]) - if test "x$X11_A_OK" = xno && test "x$X11_NOT_NEEDED" != xyes; then - HELP_MSG_MISSING_DEPENDENCY([x11]) - AC_MSG_ERROR([Could not find all X11 headers (shape.h Xrender.h XTest.h Intrinsic.h). $HELP_MSG]) - fi + CFLAGS="$OLD_CFLAGS" + AC_LANG_POP(C) + fi # X11_NOT_NEEDED AC_SUBST(X_CFLAGS) AC_SUBST(X_LIBS)