From ba1a0441ab8a8eafd377cb554b28eeecebefd95c Mon Sep 17 00:00:00 2001 From: Volker Ruppert Date: Sat, 30 Mar 2024 16:59:06 +0100 Subject: [PATCH] Setting GTK version number in config.h fixes GTK3 compilation. GTK3 forbids to include gtkversion.h directly. --- bochs/config.h.in | 4 +++- bochs/configure | 13 ++++++++----- bochs/configure.ac | 10 +++++----- bochs/gui/gtk_enh_dbg_osdep.cc | 4 ++-- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/bochs/config.h.in b/bochs/config.h.in index b108114ec..f15d57dce 100644 --- a/bochs/config.h.in +++ b/bochs/config.h.in @@ -1,5 +1,5 @@ // -// Copyright (C) 2001-2021 The Bochs Project +// Copyright (C) 2001-2024 The Bochs Project // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -317,6 +317,8 @@ #define WX_MSW_UNICODE 0 // set to GDK major version for wxGTK #define WX_GDK_VERSION 0 +// set to GTK major version for GTK debugger +#define BX_HAVE_GTK_VERSION 0 // A certain functions must NOT be fastcall even if compiled with fastcall // option, and those are callbacks from Windows which are defined either diff --git a/bochs/configure b/bochs/configure index 240000003..95eecc296 100755 --- a/bochs/configure +++ b/bochs/configure @@ -26289,7 +26289,7 @@ if test "$display_libs" = ""; then fi # some display libraries and the enhanced debugger may depend on the GTK+ software package -bx_have_gtk_version=0 +BX_HAVE_GTK_VERSION=0 if test "$needs_gtk2" = 1; then # pkg-config is required to set TOOLKIT_CXXFLAGS and LIBS if test "x$PKG_CONFIG" != x; then @@ -26299,20 +26299,23 @@ if test "$needs_gtk2" = 1; then if test x$? = x0; then TOOLKIT_CXXFLAGS="`$PKG_CONFIG --cflags gtk+-3.0`" LIBS="$LIBS `$PKG_CONFIG --libs gtk+-3.0`" - bx_have_gtk_version=3 + printf "%s\n" "#define BX_HAVE_GTK_VERSION 3" >>confdefs.h + fi else $PKG_CONFIG --exists gtk+-2.0 if test x$? = x0; then TOOLKIT_CXXFLAGS="`$PKG_CONFIG --cflags gtk+-2.0`" LIBS="$LIBS `$PKG_CONFIG --libs gtk+-2.0`" - bx_have_gtk_version=2 + printf "%s\n" "#define BX_HAVE_GTK_VERSION 2" >>confdefs.h + else $PKG_CONFIG --exists gtk+-3.0 if test x$? = x0; then TOOLKIT_CXXFLAGS="`$PKG_CONFIG --cflags gtk+-3.0`" LIBS="$LIBS `$PKG_CONFIG --libs gtk+-3.0`" - bx_have_gtk_version=3 + printf "%s\n" "#define BX_HAVE_GTK_VERSION 3" >>confdefs.h + fi fi fi @@ -26568,7 +26571,7 @@ esac ENH_DBG_OBJS="" if test "$gui_debugger" = 1; then - if test "$bx_have_gtk_version" -ge 2; then + if test "$BX_HAVE_GTK_VERSION" -ge 2; then ENH_DBG_OBJS="enh_dbg.o gtk_enh_dbg_osdep.o" printf "%s\n" "#define BX_DEBUGGER_GUI 1" >>confdefs.h diff --git a/bochs/configure.ac b/bochs/configure.ac index 9e85cbd82..bac9393db 100644 --- a/bochs/configure.ac +++ b/bochs/configure.ac @@ -2742,7 +2742,7 @@ if test "$display_libs" = ""; then fi # some display libraries and the enhanced debugger may depend on the GTK+ software package -bx_have_gtk_version=0 +BX_HAVE_GTK_VERSION=0 if test "$needs_gtk2" = 1; then # pkg-config is required to set TOOLKIT_CXXFLAGS and LIBS if test "x$PKG_CONFIG" != x; then @@ -2752,20 +2752,20 @@ if test "$needs_gtk2" = 1; then if test x$? = x0; then TOOLKIT_CXXFLAGS="`$PKG_CONFIG --cflags gtk+-3.0`" LIBS="$LIBS `$PKG_CONFIG --libs gtk+-3.0`" - bx_have_gtk_version=3 + AC_DEFINE(BX_HAVE_GTK_VERSION, 3) fi else $PKG_CONFIG --exists gtk+-2.0 if test x$? = x0; then TOOLKIT_CXXFLAGS="`$PKG_CONFIG --cflags gtk+-2.0`" LIBS="$LIBS `$PKG_CONFIG --libs gtk+-2.0`" - bx_have_gtk_version=2 + AC_DEFINE(BX_HAVE_GTK_VERSION, 2) else $PKG_CONFIG --exists gtk+-3.0 if test x$? = x0; then TOOLKIT_CXXFLAGS="`$PKG_CONFIG --cflags gtk+-3.0`" LIBS="$LIBS `$PKG_CONFIG --libs gtk+-3.0`" - bx_have_gtk_version=3 + AC_DEFINE(BX_HAVE_GTK_VERSION, 3) fi fi fi @@ -2948,7 +2948,7 @@ AC_SUBST(CXXFLAGS_CONSOLE) ENH_DBG_OBJS="" if test "$gui_debugger" = 1; then - if test "$bx_have_gtk_version" -ge 2; then + if test "$BX_HAVE_GTK_VERSION" -ge 2; then ENH_DBG_OBJS="enh_dbg.o gtk_enh_dbg_osdep.o" AC_DEFINE(BX_DEBUGGER_GUI, 1) elif test "$DEFAULT_GUI" = win32 -o "$with_win32" = yes; then diff --git a/bochs/gui/gtk_enh_dbg_osdep.cc b/bochs/gui/gtk_enh_dbg_osdep.cc index 96d182b3d..837ac0118 100644 --- a/bochs/gui/gtk_enh_dbg_osdep.cc +++ b/bochs/gui/gtk_enh_dbg_osdep.cc @@ -17,10 +17,10 @@ #if BX_DEBUGGER && BX_DEBUGGER_GUI -#include -#if GTK_MAJOR_VERSION == (2) +#if BX_HAVE_GTK_VERSION == 2 #define GTK_DISABLE_DEPRECATED #endif + #include #include #include