Setting GTK version number in config.h fixes GTK3 compilation.

GTK3 forbids to include gtkversion.h directly.
This commit is contained in:
Volker Ruppert 2024-03-30 16:59:06 +01:00
parent c91b7bf117
commit ba1a0441ab
4 changed files with 18 additions and 13 deletions

View File

@ -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

13
bochs/configure vendored
View File

@ -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

View File

@ -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

View File

@ -17,10 +17,10 @@
#if BX_DEBUGGER && BX_DEBUGGER_GUI
#include <gtk/gtkversion.h>
#if GTK_MAJOR_VERSION == (2)
#if BX_HAVE_GTK_VERSION == 2
#define GTK_DISABLE_DEPRECATED
#endif
#include <gtk/gtk.h>
#include <glib.h>
#include <pthread.h>