From dbf7da542fe26a390075ee5396f6fdcaeeede640 Mon Sep 17 00:00:00 2001 From: Volker Ruppert Date: Sun, 21 Apr 2019 20:08:32 +0000 Subject: [PATCH] Check if Xrandr extension is present. --- bochs/config.h.in | 1 + bochs/configure | 17 ++++++++++++++--- bochs/configure.in | 9 +++++++-- bochs/gui/x.cc | 6 ++++++ 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/bochs/config.h.in b/bochs/config.h.in index 17e20fb49..cfcbd4364 100644 --- a/bochs/config.h.in +++ b/bochs/config.h.in @@ -128,6 +128,7 @@ #define BX_HAVE_MKSTEMP 0 #define BX_HAVE_SYS_MMAN_H 0 #define BX_HAVE_XPM_H 0 +#define BX_HAVE_XRANDR_H 0 #define BX_HAVE_TIMELOCAL 0 #define BX_HAVE_GMTIME 0 #define BX_HAVE_MKTIME 0 diff --git a/bochs/configure b/bochs/configure index db2d03f0e..b23caa3a5 100755 --- a/bochs/configure +++ b/bochs/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Id: configure.in 13419 2017-12-30 14:56:54Z vruppert . +# From configure.in Id: configure.in 13425 2018-01-05 17:43:51Z vruppert . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69. # @@ -24515,6 +24515,7 @@ use_gui_console=0 # handled later. XPM_LIB='' +XRANDR_LIB='' if test "$with_x11" = yes; then display_libs="$display_libs X11" if test "$no_x" = yes; then @@ -24558,12 +24559,22 @@ fi fi + ac_fn_c_check_header_mongrel "$LINENO" "X11/extensions/Xrandr.h" "ac_cv_header_X11_extensions_Xrandr_h" "$ac_includes_default" +if test "x$ac_cv_header_X11_extensions_Xrandr_h" = xyes; then : + + $as_echo "#define BX_HAVE_XRANDR_H 1" >>confdefs.h + + XRANDR_LIB='-lXrandr' + +fi + + if test "$PKGCONFIG" != not_found; then X_CFLAGS="`pkg-config --cflags x11`" - X_LIBS="`pkg-config --libs x11` $XPM_LIB -lXrandr" + X_LIBS="`pkg-config --libs x11` $XPM_LIB $XRANDR_LIB" else - X_LIBS="$X_LIBS -lX11 $XPM_LIB -lXrandr" + X_LIBS="$X_LIBS -lX11 $XPM_LIB $XRANDR_LIB" fi $as_echo "#define BX_WITH_X11 1" >>confdefs.h diff --git a/bochs/configure.in b/bochs/configure.in index 399b5e9dd..16595e1fc 100644 --- a/bochs/configure.in +++ b/bochs/configure.in @@ -2328,6 +2328,7 @@ use_gui_console=0 # handled later. XPM_LIB='' +XRANDR_LIB='' if test "$with_x11" = yes; then display_libs="$display_libs X11" if test "$no_x" = yes; then @@ -2358,12 +2359,16 @@ if test "$with_x11" = yes; then XPM_LIB='-lXpm' ]) fi + AC_CHECK_HEADER(X11/extensions/Xrandr.h, [ + AC_DEFINE(BX_HAVE_XRANDR_H) + XRANDR_LIB='-lXrandr' + ]) if test "$PKGCONFIG" != not_found; then X_CFLAGS="`pkg-config --cflags x11`" - X_LIBS="`pkg-config --libs x11` $XPM_LIB -lXrandr" + X_LIBS="`pkg-config --libs x11` $XPM_LIB $XRANDR_LIB" else - X_LIBS="$X_LIBS -lX11 $XPM_LIB -lXrandr" + X_LIBS="$X_LIBS -lX11 $XPM_LIB $XRANDR_LIB" fi AC_DEFINE(BX_WITH_X11, 1) diff --git a/bochs/gui/x.cc b/bochs/gui/x.cc index bbc69fc3a..e9945689c 100644 --- a/bochs/gui/x.cc +++ b/bochs/gui/x.cc @@ -39,7 +39,9 @@ extern "C" { #include #include #include +#if BX_HAVE_XRANDR_H #include +#endif #if BX_HAVE_XPM_H #include #endif @@ -60,7 +62,9 @@ public: DECLARE_GUI_NEW_VIRTUAL_METHODS() virtual void beep_on(float frequency); virtual void beep_off(); +#if BX_HAVE_XRANDR_H virtual void get_capabilities(Bit16u *xres, Bit16u *yres, Bit16u *bpp); +#endif virtual void set_display_mode(disp_mode_t newmode); virtual void set_mouse_mode_absxy(bx_bool mode); #if BX_SHOW_IPS @@ -1800,6 +1804,7 @@ void bx_x_gui_c::beep_off() BX_INFO(("X11 Beep OFF")); } +#if BX_HAVE_XRANDR_H void bx_x_gui_c::get_capabilities(Bit16u *xres, Bit16u *yres, Bit16u *bpp) { int num_sizes; @@ -1829,6 +1834,7 @@ void bx_x_gui_c::get_capabilities(Bit16u *xres, Bit16u *yres, Bit16u *bpp) // always return 32 bit depth *bpp = 32; } +#endif void bx_x_gui_c::set_display_mode(disp_mode_t newmode) {