tRemove support for old GLIB1 and GTK+1 libraries. - vaccinewars - be a doctor … | |
git clone git://src.adamsgaard.dk/vaccinewars | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 3f3575734ebe3ef2ceb01027ecab93c414608022 | |
parent 3f979d0e6d32d62c7194f5603e329a7e7f5ec1a1 | |
Author: Ben Webb <[email protected]> | |
Date: Mon, 2 Jan 2006 19:52:56 +0000 | |
Remove support for old GLIB1 and GTK+1 libraries. | |
Diffstat: | |
M ChangeLog | 4 ++++ | |
M configure.in | 81 +++++------------------------… | |
D m4/glib.m4 | 196 -----------------------------… | |
D m4/gtk.m4 | 194 ------------------------------ | |
M src/convert.c | 16 ---------------- | |
M src/error.c | 4 ---- | |
M src/gtkport/gtkport.c | 50 ++---------------------------… | |
M src/gtkport/gtkport.h | 9 +-------- | |
M src/gui_client/gtk_client.c | 20 ++------------------ | |
M src/gui_client/newgamedia.c | 3 --- | |
M src/gui_client/optdialog.c | 2 -- | |
M src/message.c | 4 ---- | |
M src/network.c | 20 +++----------------- | |
13 files changed, 23 insertions(+), 580 deletions(-) | |
--- | |
diff --git a/ChangeLog b/ChangeLog | |
t@@ -1,3 +1,7 @@ | |
+CVS | |
+ - Support for old GTK1 and GLIB1 libraries removed - we now need version 2 | |
+ of these libraries to build dopewars. | |
+ | |
1.5.12 30-12-2005 | |
- Really fix a potential exploit against the Win32 server when running as | |
an NT service (user data was being used as a format string in some cases… | |
diff --git a/configure.in b/configure.in | |
t@@ -31,8 +31,6 @@ case "$host_os" in darwin*) | |
CPPFLAGS="$CPPFLAGS -no-cpp-precomp" | |
esac | |
-HAVE_FIXED_GTK="no" | |
- | |
dnl Process client options | |
AC_ARG_ENABLE(gui-client, | |
[ --enable-gui-client include graphical client (GTK+/Win32)], | |
t@@ -46,10 +44,6 @@ AC_ARG_ENABLE(gui-server, | |
[ --enable-gui-server use a simple GTK+/Win32 GUI for the server], | |
[ GUI_SERVER="$enableval" ],[ GUI_SERVER="probe" ]) | |
-AC_ARG_ENABLE(glib2, | |
-[ --disable-glib2 use GLib/GTK+ 1.x, even if 2.x is found], | |
-[ USE_GLIB2="$enableval" ],[ USE_GLIB2="yes" ]) | |
- | |
AC_ARG_WITH(esd, | |
[ --without-esd do not support ESD sound output], | |
[ USE_ESD="$withval" ], [ USE_ESD="probe" ]) | |
t@@ -92,7 +86,6 @@ if test "$CYGWIN" = "yes" ; then | |
LDFLAGS="$LDFLAGS -mno-cygwin" | |
AM_PATH_GLIB_2_0(2.0.0, , [AC_MSG_ERROR(GLib is required)]) | |
- AC_DEFINE(HAVE_GLIB2, 1, [Do we have GLIB 2.0 ?]) | |
dnl We need to compile and then link in the Windows resources | |
WNDRES="dopewars.res" | |
t@@ -103,10 +96,6 @@ if test "$CYGWIN" = "yes" ; then | |
PLUGOBJS="$PLUGOBJS plugins/sound_winmm.o" | |
AC_DEFINE(HAVE_WINMM, 1, [Do we have the Windows multimedia system?]) | |
- dnl The gtkport implementation works just fine | |
- dnl for gtk_entry_set_visibility() | |
- HAVE_FIXED_GTK="yes" | |
- | |
dnl Use graphical server by default | |
if test "$GUI_SERVER" = "probe"; then | |
GUI_SERVER="yes" | |
t@@ -139,51 +128,20 @@ else | |
gtk2_found="probe" | |
if test "$GUI_CLIENT" != "no" -o "$GUI_SERVER" != "no"; then | |
- if test "$USE_GLIB2" = "yes" ; then | |
- AM_PATH_GTK_2_0(2.0.0,gtk2_found="yes",gtk2_found="no") | |
+ AM_PATH_GTK_2_0(2.0.0,gtk2_found="yes",gtk2_found="no") | |
+ if test "$gtk2_found" = "no" ; then | |
+ if test "$GUI_CLIENT" = "yes" -o "$GUI_SERVER" = "yes" ; then | |
+ AC_MSG_ERROR(Cannot find GTK+) | |
+ else | |
+ AC_MSG_WARN(Cannot find GTK+; not building GUI client or server) | |
+ GUI_CLIENT="no" | |
+ GUI_SERVER="no" | |
+ fi | |
fi | |
- if test "$gtk2_found" = "yes" ; then | |
- HAVE_FIXED_GTK="yes" | |
- else | |
- gtk_found="no" | |
- AM_PATH_GTK(1.2.0,gtk_found="yes") | |
- if test "$gtk_found" = "no" ; then | |
- if test "$GUI_CLIENT" = "yes" -o "$GUI_SERVER" = "yes" ; then | |
- AC_MSG_ERROR(Cannot find GTK+) | |
- else | |
- AC_MSG_WARN(Cannot find GTK+) | |
- GUI_CLIENT="no" | |
- GUI_SERVER="no" | |
- fi | |
- else | |
- AC_MSG_CHECKING([for non-buggy GTK+ ( >= 1.2.10 )]) | |
- dnl Versions older than 1.2.10 are buggy | |
- if test "$gtk_config_major_version" -gt 1 ; then | |
- HAVE_FIXED_GTK="yes" | |
- elif test "$gtk_config_major_version" -eq 1 ; then | |
- if test "$gtk_config_minor_version" -gt 2 ; then | |
- dnl We assume all 1.3.x releases are OK | |
- HAVE_FIXED_GTK="yes" | |
- elif test "$gtk_config_minor_version" -eq 2 -a \ | |
- "$gtk_config_micro_version" -ge 10 ; then | |
- HAVE_FIXED_GTK="yes" | |
- fi | |
- fi | |
- AC_MSG_RESULT([$HAVE_FIXED_GTK]) | |
- fi | |
- fi | |
fi | |
- dnl We NEED glib; N.B. don't link against glib2 if we're using GTK+1 | |
- glib2_found="no" | |
- if test "$USE_GLIB2" = "yes" -a "$gtk2_found" != "no"; then | |
- AM_PATH_GLIB_2_0(2.0.0, glib2_found="yes") | |
- fi | |
- if test "$glib2_found" = "no" ; then | |
- AM_PATH_GLIB(1.2.0, , [AC_MSG_ERROR(Cannot find glib - aborting)]) | |
- else | |
- AC_DEFINE(HAVE_GLIB2, 1, [Do we have GLIB 2.0 ?]) | |
- fi | |
+ dnl We NEED glib | |
+ AM_PATH_GLIB_2_0(2.0.0, , [AC_MSG_ERROR(GLib is required)]) | |
dnl Add esound support if available | |
if test "$USE_ESD" != "no"; then | |
t@@ -272,12 +230,6 @@ if test "$GUI_SERVER" = "yes" ; then | |
AC_DEFINE(GUI_SERVER, 1, [Use a graphical server?]) | |
fi | |
-if test "$HAVE_FIXED_GTK" = "yes" ; then | |
- AC_DEFINE(HAVE_FIXED_GTK, 1, | |
- [Do we have GTK+ with a non-buggy gtk_entry_set_visibility() ? | |
- (i.e. >= 1.2.10)]) | |
-fi | |
- | |
dnl Can we use a long long datatype for price_t ? | |
AC_CHECK_SIZEOF(long long) | |
t@@ -461,15 +413,4 @@ else | |
echo "Networking support DISABLED; single-player mode only" | |
fi | |
-if test "$GUI_SERVER" = "yes" -o "$GUI_CLIENT" = "yes" ; then | |
- if test "$HAVE_FIXED_GTK" = "no" ; then | |
- cat <<FGTKEND | |
- | |
-WARNING: You have an old version of GTK+, which has bugs in the | |
-gtk_entry_set_visibility function (used for password-entry boxes). Thus, for | |
-stability reasons, this function will not be used, and all passwords entered | |
-will be visible. To fix this, upgrade GTK+ to version 1.2.10 or later. | |
-FGTKEND | |
- fi | |
-fi | |
echo | |
diff --git a/m4/glib.m4 b/m4/glib.m4 | |
t@@ -1,196 +0,0 @@ | |
-# Configure paths for GLIB | |
-# Owen Taylor 97-11-3 | |
- | |
-dnl AM_PATH_GLIB([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, … | |
-dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if "gmodule" or | |
-dnl gthread is specified in MODULES, pass to glib-config | |
-dnl | |
-AC_DEFUN([AM_PATH_GLIB], | |
-[dnl | |
-dnl Get the cflags and libraries from the glib-config script | |
-dnl | |
-AC_ARG_WITH(glib-prefix,[ --with-glib-prefix=PFX Prefix where GLIB is insta… | |
- glib_config_prefix="$withval", glib_config_prefix="") | |
-AC_ARG_WITH(glib-exec-prefix,[ --with-glib-exec-prefix=PFX Exec prefix where … | |
- glib_config_exec_prefix="$withval", glib_config_exec_prefix="") | |
-AC_ARG_ENABLE(glibtest, [ --disable-glibtest Do not try to compile and … | |
- , enable_glibtest=yes) | |
- | |
- if test x$glib_config_exec_prefix != x ; then | |
- glib_config_args="$glib_config_args --exec-prefix=$glib_config_exec_prefi… | |
- if test x${GLIB_CONFIG+set} != xset ; then | |
- GLIB_CONFIG=$glib_config_exec_prefix/bin/glib-config | |
- fi | |
- fi | |
- if test x$glib_config_prefix != x ; then | |
- glib_config_args="$glib_config_args --prefix=$glib_config_prefix" | |
- if test x${GLIB_CONFIG+set} != xset ; then | |
- GLIB_CONFIG=$glib_config_prefix/bin/glib-config | |
- fi | |
- fi | |
- | |
- for module in . $4 | |
- do | |
- case "$module" in | |
- gmodule) | |
- glib_config_args="$glib_config_args gmodule" | |
- ;; | |
- gthread) | |
- glib_config_args="$glib_config_args gthread" | |
- ;; | |
- esac | |
- done | |
- | |
- AC_PATH_PROG(GLIB_CONFIG, glib-config, no) | |
- min_glib_version=ifelse([$1], ,0.99.7,$1) | |
- AC_MSG_CHECKING(for GLIB - version >= $min_glib_version) | |
- no_glib="" | |
- if test "$GLIB_CONFIG" = "no" ; then | |
- no_glib=yes | |
- else | |
- GLIB_CFLAGS=`$GLIB_CONFIG $glib_config_args --cflags` | |
- GLIB_LIBS=`$GLIB_CONFIG $glib_config_args --libs` | |
- glib_config_major_version=`$GLIB_CONFIG $glib_config_args --version | \ | |
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | |
- glib_config_minor_version=`$GLIB_CONFIG $glib_config_args --version | \ | |
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | |
- glib_config_micro_version=`$GLIB_CONFIG $glib_config_args --version | \ | |
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | |
- if test "x$enable_glibtest" = "xyes" ; then | |
- ac_save_CFLAGS="$CFLAGS" | |
- ac_save_LIBS="$LIBS" | |
- CFLAGS="$CFLAGS $GLIB_CFLAGS" | |
- LIBS="$GLIB_LIBS $LIBS" | |
-dnl | |
-dnl Now check if the installed GLIB is sufficiently new. (Also sanity | |
-dnl checks the results of glib-config to some extent | |
-dnl | |
- rm -f conf.glibtest | |
- AC_TRY_RUN([ | |
-#include <glib.h> | |
-#include <stdio.h> | |
-#include <stdlib.h> | |
- | |
-int | |
-main () | |
-{ | |
- int major, minor, micro; | |
- char *tmp_version; | |
- | |
- system ("touch conf.glibtest"); | |
- | |
- /* HP/UX 9 (%@#!) writes to sscanf strings */ | |
- tmp_version = g_strdup("$min_glib_version"); | |
- if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { | |
- printf("%s, bad version string\n", "$min_glib_version"); | |
- exit(1); | |
- } | |
- | |
- if ((glib_major_version != $glib_config_major_version) || | |
- (glib_minor_version != $glib_config_minor_version) || | |
- (glib_micro_version != $glib_config_micro_version)) | |
- { | |
- printf("\n*** 'glib-config --version' returned %d.%d.%d, but GLIB (%d.%d… | |
- $glib_config_major_version, $glib_config_minor_version, $glib_con… | |
- glib_major_version, glib_minor_version, glib_micro_version); | |
- printf ("*** was found! If glib-config was correct, then it is best\n"); | |
- printf ("*** to remove the old version of GLIB. You may also be able to … | |
- printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by… | |
- printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\… | |
- printf("*** required on your system.\n"); | |
- printf("*** If glib-config was wrong, set the environment variable GLIB_… | |
- printf("*** to point to the correct copy of glib-config, and remove the … | |
- printf("*** before re-running configure\n"); | |
- } | |
- else if ((glib_major_version != GLIB_MAJOR_VERSION) || | |
- (glib_minor_version != GLIB_MINOR_VERSION) || | |
- (glib_micro_version != GLIB_MICRO_VERSION)) | |
- { | |
- printf("*** GLIB header files (version %d.%d.%d) do not match\n", | |
- GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION); | |
- printf("*** library (version %d.%d.%d)\n", | |
- glib_major_version, glib_minor_version, glib_micro_version); | |
- } | |
- else | |
- { | |
- if ((glib_major_version > major) || | |
- ((glib_major_version == major) && (glib_minor_version > minor)) || | |
- ((glib_major_version == major) && (glib_minor_version == minor) && (gl… | |
- { | |
- return 0; | |
- } | |
- else | |
- { | |
- printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n", | |
- glib_major_version, glib_minor_version, glib_micro_version); | |
- printf("*** You need a version of GLIB newer than %d.%d.%d. The latest… | |
- major, minor, micro); | |
- printf("*** GLIB is always available from ftp://ftp.gtk.org.\n"); | |
- printf("***\n"); | |
- printf("*** If you have already installed a sufficiently new version, … | |
- printf("*** probably means that the wrong copy of the glib-config shel… | |
- printf("*** being found. The easiest way to fix this is to remove the … | |
- printf("*** of GLIB, but you can also set the GLIB_CONFIG environment … | |
- printf("*** correct copy of glib-config. (In this case, you will have … | |
- printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /… | |
- printf("*** so that the correct libraries are found at run-time))\n"); | |
- } | |
- } | |
- return 1; | |
-} | |
-],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) | |
- CFLAGS="$ac_save_CFLAGS" | |
- LIBS="$ac_save_LIBS" | |
- fi | |
- fi | |
- if test "x$no_glib" = x ; then | |
- AC_MSG_RESULT(yes) | |
- ifelse([$2], , :, [$2]) | |
- else | |
- AC_MSG_RESULT(no) | |
- if test "$GLIB_CONFIG" = "no" ; then | |
- echo "*** The glib-config script installed by GLIB could not be found" | |
- echo "*** If GLIB was installed in PREFIX, make sure PREFIX/bin is in" | |
- echo "*** your path, or set the GLIB_CONFIG environment variable to the" | |
- echo "*** full path to glib-config." | |
- else | |
- if test -f conf.glibtest ; then | |
- : | |
- else | |
- echo "*** Could not run GLIB test program, checking why..." | |
- CFLAGS="$CFLAGS $GLIB_CFLAGS" | |
- LIBS="$LIBS $GLIB_LIBS" | |
- AC_TRY_LINK([ | |
-#include <glib.h> | |
-#include <stdio.h> | |
-], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_… | |
- [ echo "*** The test program compiled, but did not run. This usually m… | |
- echo "*** that the run-time linker is not finding GLIB or finding th… | |
- echo "*** version of GLIB. If it is not finding GLIB, you'll need to… | |
- echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.c… | |
- echo "*** to the installed location Also, make sure you have run ld… | |
- echo "*** is required on your system" | |
- echo "***" | |
- echo "*** If you have an old version installed, it is best to remove… | |
- echo "*** you may also be able to get things to work by modifying LD… | |
- echo "***" | |
- echo "*** If you have a RedHat 5.0 system, you should remove the GTK… | |
- echo "*** came with the system with the command" | |
- echo "***" | |
- echo "*** rpm --erase --nodeps gtk gtk-devel" ], | |
- [ echo "*** The test program failed to compile or link. See the file c… | |
- echo "*** exact error that occured. This usually means GLIB was inco… | |
- echo "*** or that you have moved GLIB since it was installed. In the… | |
- echo "*** may want to edit the glib-config script: $GLIB_CONFIG" ]) | |
- CFLAGS="$ac_save_CFLAGS" | |
- LIBS="$ac_save_LIBS" | |
- fi | |
- fi | |
- GLIB_CFLAGS="" | |
- GLIB_LIBS="" | |
- ifelse([$3], , :, [$3]) | |
- fi | |
- AC_SUBST(GLIB_CFLAGS) | |
- AC_SUBST(GLIB_LIBS) | |
- rm -f conf.glibtest | |
-]) | |
diff --git a/m4/gtk.m4 b/m4/gtk.m4 | |
t@@ -1,194 +0,0 @@ | |
-# Configure paths for GTK+ | |
-# Owen Taylor 97-11-3 | |
- | |
-dnl AM_PATH_GTK([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, M… | |
-dnl Test for GTK, and define GTK_CFLAGS and GTK_LIBS | |
-dnl | |
-AC_DEFUN([AM_PATH_GTK], | |
-[dnl | |
-dnl Get the cflags and libraries from the gtk-config script | |
-dnl | |
-AC_ARG_WITH(gtk-prefix,[ --with-gtk-prefix=PFX Prefix where GTK is installe… | |
- gtk_config_prefix="$withval", gtk_config_prefix="") | |
-AC_ARG_WITH(gtk-exec-prefix,[ --with-gtk-exec-prefix=PFX Exec prefix where GT… | |
- gtk_config_exec_prefix="$withval", gtk_config_exec_prefix="") | |
-AC_ARG_ENABLE(gtktest, [ --disable-gtktest Do not try to compile and ru… | |
- , enable_gtktest=yes) | |
- | |
- for module in . $4 | |
- do | |
- case "$module" in | |
- gthread) | |
- gtk_config_args="$gtk_config_args gthread" | |
- ;; | |
- esac | |
- done | |
- | |
- if test x$gtk_config_exec_prefix != x ; then | |
- gtk_config_args="$gtk_config_args --exec-prefix=$gtk_config_exec_prefix" | |
- if test x${GTK_CONFIG+set} != xset ; then | |
- GTK_CONFIG=$gtk_config_exec_prefix/bin/gtk-config | |
- fi | |
- fi | |
- if test x$gtk_config_prefix != x ; then | |
- gtk_config_args="$gtk_config_args --prefix=$gtk_config_prefix" | |
- if test x${GTK_CONFIG+set} != xset ; then | |
- GTK_CONFIG=$gtk_config_prefix/bin/gtk-config | |
- fi | |
- fi | |
- | |
- AC_PATH_PROG(GTK_CONFIG, gtk-config, no) | |
- min_gtk_version=ifelse([$1], ,0.99.7,$1) | |
- AC_MSG_CHECKING(for GTK - version >= $min_gtk_version) | |
- no_gtk="" | |
- if test "$GTK_CONFIG" = "no" ; then | |
- no_gtk=yes | |
- else | |
- GTK_CFLAGS=`$GTK_CONFIG $gtk_config_args --cflags` | |
- GTK_LIBS=`$GTK_CONFIG $gtk_config_args --libs` | |
- gtk_config_major_version=`$GTK_CONFIG $gtk_config_args --version | \ | |
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` | |
- gtk_config_minor_version=`$GTK_CONFIG $gtk_config_args --version | \ | |
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` | |
- gtk_config_micro_version=`$GTK_CONFIG $gtk_config_args --version | \ | |
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` | |
- if test "x$enable_gtktest" = "xyes" ; then | |
- ac_save_CFLAGS="$CFLAGS" | |
- ac_save_LIBS="$LIBS" | |
- CFLAGS="$CFLAGS $GTK_CFLAGS" | |
- LIBS="$GTK_LIBS $LIBS" | |
-dnl | |
-dnl Now check if the installed GTK is sufficiently new. (Also sanity | |
-dnl checks the results of gtk-config to some extent | |
-dnl | |
- rm -f conf.gtktest | |
- AC_TRY_RUN([ | |
-#include <gtk/gtk.h> | |
-#include <stdio.h> | |
-#include <stdlib.h> | |
- | |
-int | |
-main () | |
-{ | |
- int major, minor, micro; | |
- char *tmp_version; | |
- | |
- system ("touch conf.gtktest"); | |
- | |
- /* HP/UX 9 (%@#!) writes to sscanf strings */ | |
- tmp_version = g_strdup("$min_gtk_version"); | |
- if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { | |
- printf("%s, bad version string\n", "$min_gtk_version"); | |
- exit(1); | |
- } | |
- | |
- if ((gtk_major_version != $gtk_config_major_version) || | |
- (gtk_minor_version != $gtk_config_minor_version) || | |
- (gtk_micro_version != $gtk_config_micro_version)) | |
- { | |
- printf("\n*** 'gtk-config --version' returned %d.%d.%d, but GTK+ (%d.%d.… | |
- $gtk_config_major_version, $gtk_config_minor_version, $gtk_config… | |
- gtk_major_version, gtk_minor_version, gtk_micro_version); | |
- printf ("*** was found! If gtk-config was correct, then it is best\n"); | |
- printf ("*** to remove the old version of GTK+. You may also be able to … | |
- printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by… | |
- printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\… | |
- printf("*** required on your system.\n"); | |
- printf("*** If gtk-config was wrong, set the environment variable GTK_CO… | |
- printf("*** to point to the correct copy of gtk-config, and remove the f… | |
- printf("*** before re-running configure\n"); | |
- } | |
-#if defined (GTK_MAJOR_VERSION) && defined (GTK_MINOR_VERSION) && defined (GTK… | |
- else if ((gtk_major_version != GTK_MAJOR_VERSION) || | |
- (gtk_minor_version != GTK_MINOR_VERSION) || | |
- (gtk_micro_version != GTK_MICRO_VERSION)) | |
- { | |
- printf("*** GTK+ header files (version %d.%d.%d) do not match\n", | |
- GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION); | |
- printf("*** library (version %d.%d.%d)\n", | |
- gtk_major_version, gtk_minor_version, gtk_micro_version); | |
- } | |
-#endif /* defined (GTK_MAJOR_VERSION) ... */ | |
- else | |
- { | |
- if ((gtk_major_version > major) || | |
- ((gtk_major_version == major) && (gtk_minor_version > minor)) || | |
- ((gtk_major_version == major) && (gtk_minor_version == minor) && (gtk_… | |
- { | |
- return 0; | |
- } | |
- else | |
- { | |
- printf("\n*** An old version of GTK+ (%d.%d.%d) was found.\n", | |
- gtk_major_version, gtk_minor_version, gtk_micro_version); | |
- printf("*** You need a version of GTK+ newer than %d.%d.%d. The latest… | |
- major, minor, micro); | |
- printf("*** GTK+ is always available from ftp://ftp.gtk.org.\n"); | |
- printf("***\n"); | |
- printf("*** If you have already installed a sufficiently new version, … | |
- printf("*** probably means that the wrong copy of the gtk-config shell… | |
- printf("*** being found. The easiest way to fix this is to remove the … | |
- printf("*** of GTK+, but you can also set the GTK_CONFIG environment t… | |
- printf("*** correct copy of gtk-config. (In this case, you will have t… | |
- printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /… | |
- printf("*** so that the correct libraries are found at run-time))\n"); | |
- } | |
- } | |
- return 1; | |
-} | |
-],, no_gtk=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) | |
- CFLAGS="$ac_save_CFLAGS" | |
- LIBS="$ac_save_LIBS" | |
- fi | |
- fi | |
- if test "x$no_gtk" = x ; then | |
- AC_MSG_RESULT(yes) | |
- ifelse([$2], , :, [$2]) | |
- else | |
- AC_MSG_RESULT(no) | |
- if test "$GTK_CONFIG" = "no" ; then | |
- echo "*** The gtk-config script installed by GTK could not be found" | |
- echo "*** If GTK was installed in PREFIX, make sure PREFIX/bin is in" | |
- echo "*** your path, or set the GTK_CONFIG environment variable to the" | |
- echo "*** full path to gtk-config." | |
- else | |
- if test -f conf.gtktest ; then | |
- : | |
- else | |
- echo "*** Could not run GTK test program, checking why..." | |
- CFLAGS="$CFLAGS $GTK_CFLAGS" | |
- LIBS="$LIBS $GTK_LIBS" | |
- AC_TRY_LINK([ | |
-#include <gtk/gtk.h> | |
-#include <stdio.h> | |
-], [ return ((gtk_major_version) || (gtk_minor_version) || (gtk_micro_ver… | |
- [ echo "*** The test program compiled, but did not run. This usually m… | |
- echo "*** that the run-time linker is not finding GTK or finding the… | |
- echo "*** version of GTK. If it is not finding GTK, you'll need to s… | |
- echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.c… | |
- echo "*** to the installed location Also, make sure you have run ld… | |
- echo "*** is required on your system" | |
- echo "***" | |
- echo "*** If you have an old version installed, it is best to remove… | |
- echo "*** you may also be able to get things to work by modifying LD… | |
- echo "***" | |
- echo "*** If you have a RedHat 5.0 system, you should remove the GTK… | |
- echo "*** came with the system with the command" | |
- echo "***" | |
- echo "*** rpm --erase --nodeps gtk gtk-devel" ], | |
- [ echo "*** The test program failed to compile or link. See the file c… | |
- echo "*** exact error that occured. This usually means GTK was incor… | |
- echo "*** or that you have moved GTK since it was installed. In the … | |
- echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ]) | |
- CFLAGS="$ac_save_CFLAGS" | |
- LIBS="$ac_save_LIBS" | |
- fi | |
- fi | |
- GTK_CFLAGS="" | |
- GTK_LIBS="" | |
- ifelse([$3], , :, [$3]) | |
- fi | |
- AC_SUBST(GTK_CFLAGS) | |
- AC_SUBST(GTK_LIBS) | |
- rm -f conf.gtktest | |
-]) | |
diff --git a/src/convert.c b/src/convert.c | |
t@@ -49,14 +49,10 @@ void Conv_SetInternalCodeset(const gchar *codeset) | |
static const gchar *GetLocaleCodeset(void) | |
{ | |
-#ifdef HAVE_GLIB2 | |
const gchar *codeset; | |
g_get_charset(&codeset); | |
return FixedCodeset(codeset); | |
-#else | |
- return "ISO-8859-1"; | |
-#endif | |
} | |
Converter *Conv_New(void) | |
t@@ -85,18 +81,13 @@ void Conv_SetCodeset(Converter *conv, const gchar *codeset) | |
gboolean Conv_Needed(Converter *conv) | |
{ | |
-#ifdef HAVE_GLIB2 | |
return (strcmp(conv->ext_codeset, int_codeset) != 0 | |
|| strcmp(int_codeset, "UTF-8") == 0); | |
-#else | |
- return FALSE; | |
-#endif | |
} | |
static gchar *do_convert(const gchar *from_codeset, const gchar *to_codeset, | |
const gchar *from_str, int from_len) | |
{ | |
-#ifdef HAVE_GLIB2 | |
gchar *to_str; | |
if (strcmp(to_codeset, "UTF-8") == 0 && strcmp(from_codeset, "UTF-8") == 0) { | |
t@@ -123,13 +114,6 @@ static gchar *do_convert(const gchar *from_codeset, const… | |
return g_strdup("[?]"); | |
} | |
} | |
-#else | |
- if (from_len == -1) { | |
- return g_strdup(from_str); | |
- } else { | |
- return g_strndup(from_str, from_len); | |
- } | |
-#endif | |
} | |
gchar *Conv_ToExternal(Converter *conv, const gchar *int_str, int len) | |
diff --git a/src/error.c b/src/error.c | |
t@@ -57,7 +57,6 @@ gchar *ErrStrFromErrno(int errcode) | |
{ | |
gchar *untran = strerror(errcode); | |
-#ifdef HAVE_GLIB2 | |
if (err_utf8_encoding) { | |
gchar *utf8str; | |
t@@ -70,9 +69,6 @@ gchar *ErrStrFromErrno(int errcode) | |
} else { | |
return g_strdup(untran); | |
} | |
-#else | |
- return g_strdup(untran); | |
-#endif | |
} | |
void FreeError(LastError *error) | |
diff --git a/src/gtkport/gtkport.c b/src/gtkport/gtkport.c | |
t@@ -41,7 +41,7 @@ | |
#include "gtkport.h" | |
#include "nls.h" | |
-#if CYGWIN || !HAVE_GLIB2 | |
+#if CYGWIN | |
#include "unicodewrap.h" | |
const gchar *GTK_STOCK_OK = N_("_OK"); | |
const gchar *GTK_STOCK_CLOSE = N_("_Close"); | |
t@@ -5469,8 +5469,6 @@ guint SetAccelerator(GtkWidget *labelparent, gchar *Text, | |
return AccelKey; | |
} | |
-#ifdef HAVE_GLIB2 | |
- | |
GtkWidget *gtk_scrolled_text_view_new(GtkWidget **pack_widg) | |
{ | |
GtkWidget *textview, *scrollwin, *frame; | |
t@@ -5516,25 +5514,6 @@ void TextViewClear(GtkTextView *textview) | |
gtk_text_buffer_set_text(buffer, "", -1); | |
} | |
-#else | |
- | |
-GtkWidget *gtk_scrolled_text_view_new(GtkWidget **pack_widg) | |
-{ | |
- GtkWidget *hbox, *text, *vscroll; | |
- GtkAdjustment *adj; | |
- | |
- hbox = gtk_hbox_new(FALSE, 0); | |
- adj = (GtkAdjustment *)gtk_adjustment_new(0.0, 0.0, 100.0, 1.0, 10.0, 10.0); | |
- text = gtk_text_new(NULL, adj); | |
- gtk_box_pack_start(GTK_BOX(hbox), text, TRUE, TRUE, 0); | |
- vscroll = gtk_vscrollbar_new(adj); | |
- gtk_box_pack_start(GTK_BOX(hbox), vscroll, FALSE, FALSE, 0); | |
- *pack_widg = hbox; | |
- return text; | |
-} | |
- | |
-#endif | |
- | |
static void DestroyGtkMessageBox(GtkWidget *widget, gpointer data) | |
{ | |
gtk_main_quit(); | |
t@@ -5612,8 +5591,6 @@ gint OldGtkMessageBox(GtkWidget *parent, const gchar *Te… | |
return retval; | |
} | |
-#ifdef HAVE_GLIB2 | |
- | |
GtkWidget *NewStockButton(const gchar *label, GtkAccelGroup *accel_group) | |
{ | |
return gtk_button_new_from_stock(label); | |
t@@ -5644,25 +5621,6 @@ gint GtkMessageBox(GtkWidget *parent, const gchar *Text, | |
return retval; | |
} | |
-#else | |
- | |
-gint GtkMessageBox(GtkWidget *parent, const gchar *Text, | |
- const gchar *Title, GtkMessageType type, gint Options) | |
-{ | |
- return OldGtkMessageBox(parent, Text, Title, Options); | |
-} | |
- | |
-GtkWidget *NewStockButton(const gchar *label, GtkAccelGroup *accel_group) | |
-{ | |
- GtkWidget *button; | |
- | |
- button = gtk_button_new_with_label(""); | |
- SetAccelerator(button, _(label), button, "clicked", accel_group, FALSE); | |
- return button; | |
-} | |
- | |
-#endif | |
- | |
static void gtk_url_set_cursor(GtkWidget *widget, GtkWidget *label) | |
{ | |
GdkCursor *cursor; | |
t@@ -5804,16 +5762,12 @@ gchar *GtkGetFile(const GtkWidget *parent, const gchar… | |
gboolean HaveUnicodeSupport(void) | |
{ | |
-#ifdef HAVE_GLIB2 | |
return TRUE; | |
-#else | |
- return FALSE; | |
-#endif | |
} | |
#endif /* CYGWIN */ | |
-#if CYGWIN || !HAVE_GLIB2 | |
+#if CYGWIN | |
void TextViewAppend(GtkTextView *textview, const gchar *text, | |
const gchar *tagname, gboolean scroll) | |
{ | |
diff --git a/src/gtkport/gtkport.h b/src/gtkport/gtkport.h | |
t@@ -741,17 +741,10 @@ void MapWidgetOrigin(GtkWidget *widget, POINT *pt); | |
#define MB_MAX 4 | |
#define MB_YESNO (MB_YES|MB_NO) | |
-#ifdef HAVE_GLIB2 | |
#define IDOK GTK_RESPONSE_OK | |
#define IDCANCEL GTK_RESPONSE_CANCEL | |
#define IDYES GTK_RESPONSE_YES | |
#define IDNO GTK_RESPONSE_NO | |
-#else | |
-#define IDOK 1 | |
-#define IDCANCEL 2 | |
-#define IDYES 4 | |
-#define IDNO 8 | |
-#endif | |
/* Other flags */ | |
#define MB_IMMRETURN 16 | |
t@@ -765,7 +758,7 @@ struct _GtkUrl { | |
#endif /* CYGWIN */ | |
-#if CYGWIN || !HAVE_GLIB2 | |
+#if CYGWIN | |
extern const gchar *GTK_STOCK_OK, *GTK_STOCK_CLOSE, *GTK_STOCK_CANCEL, | |
*GTK_STOCK_REFRESH, *GTK_STOCK_YES, *GTK_STOCK_NO, | |
*GTK_STOCK_HELP; | |
diff --git a/src/gui_client/gtk_client.c b/src/gui_client/gtk_client.c | |
t@@ -206,7 +206,7 @@ GtkWidget *my_hbbox_new(void) | |
{ | |
GtkWidget *hbbox = gtk_hbutton_box_new(); | |
-#if HAVE_GLIB2 && !CYGWIN | |
+#if !CYGWIN | |
gtk_box_set_spacing(GTK_BOX(hbbox), 8); | |
#endif | |
return hbbox; | |
t@@ -217,10 +217,8 @@ GtkWidget *my_hbbox_new(void) | |
*/ | |
void my_set_dialog_position(GtkWindow *dialog) | |
{ | |
-#ifdef HAVE_GLIB2 | |
gtk_window_set_type_hint(dialog, GDK_WINDOW_TYPE_HINT_DIALOG); | |
gtk_window_set_position(dialog, GTK_WIN_POS_CENTER_ON_PARENT); | |
-#endif | |
} | |
void QuitGame(GtkWidget *widget, gpointer data) | |
t@@ -664,11 +662,7 @@ void AddScoreToDialog(char *Data) | |
g_strchug(cp); | |
/* Get the first word - the score */ | |
-#ifdef HAVE_GLIB2 | |
spl1 = g_strsplit(cp, " ", 2); | |
-#else | |
- spl1 = g_strsplit(cp, " ", 1); | |
-#endif | |
if (!spl1 || !spl1[0] || !spl1[1]) { | |
/* Error - the high score from the server is invalid */ | |
g_warning(_("Corrupt high score!")); | |
t@@ -697,11 +691,7 @@ void AddScoreToDialog(char *Data) | |
g_strchug(spl1[1]); | |
/* Get the second word - the date */ | |
-#ifdef HAVE_GLIB2 | |
spl2 = g_strsplit(spl1[1], " ", 2); | |
-#else | |
- spl2 = g_strsplit(spl1[1], " ", 1); | |
-#endif | |
if (!spl2 || !spl2[0] || !spl2[1]) { | |
g_warning(_("Corrupt high score!")); | |
g_strfreev(spl2); | |
t@@ -1888,11 +1878,7 @@ void QuestionDialog(char *Data, Player *From) | |
guint numWords = sizeof(Words) / sizeof(Words[0]); | |
guint i, j; | |
-#ifdef HAVE_GLIB2 | |
split = g_strsplit(Data, "^", 2); | |
-#else | |
- split = g_strsplit(Data, "^", 1); | |
-#endif | |
if (!split[0] || !split[1]) { | |
g_warning("Bad QUESTION message %s", Data); | |
return; | |
t@@ -2184,7 +2170,6 @@ static void SetIcon(GtkWidget *window, gchar **xpmdata) | |
static void make_tags(GtkTextView *textview) | |
{ | |
-#if HAVE_GLIB2 | |
GtkTextBuffer *buffer = gtk_text_view_get_buffer(textview); | |
gtk_text_buffer_create_tag(buffer, "jet", "foreground", | |
t@@ -2197,7 +2182,6 @@ static void make_tags(GtkTextView *textview) | |
"#000000008B8B", NULL); | |
gtk_text_buffer_create_tag(buffer, "leave", "foreground", | |
"#8B8B00000000", NULL); | |
-#endif | |
} | |
#ifdef CYGWIN | |
t@@ -2260,7 +2244,7 @@ gboolean GtkLoop(int *argc, char **argv[], | |
gtk_hbutton_box_set_layout_default(GTK_BUTTONBOX_END); | |
gtk_vbutton_box_set_layout_default(GTK_BUTTONBOX_SPREAD); | |
-#if CYGWIN || !HAVE_GLIB2 | |
+#if CYGWIN | |
gtk_hbutton_box_set_spacing_default(8); | |
#endif | |
diff --git a/src/gui_client/newgamedia.c b/src/gui_client/newgamedia.c | |
t@@ -751,10 +751,7 @@ void AuthDialog(HttpConnection *conn, gboolean proxy, gch… | |
entry = gtk_entry_new(); | |
gtk_object_set_data(GTK_OBJECT(window), "password", (gpointer)entry); | |
-#ifdef HAVE_FIXED_GTK | |
- /* GTK+ versions earlier than 1.2.10 do bad things with this */ | |
gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); | |
-#endif | |
gtk_table_attach_defaults(GTK_TABLE(table), entry, 1, 2, 2, 3); | |
diff --git a/src/gui_client/optdialog.c b/src/gui_client/optdialog.c | |
t@@ -802,12 +802,10 @@ void OptDialog(GtkWidget *widget, gpointer data) | |
check = NewConfigCheck("Sanitized", _("Remove drug references")); | |
gtk_table_attach_defaults(GTK_TABLE(table), check, 0, 1, 0, 1); | |
-#ifdef HAVE_GLIB2 | |
check = gtk_check_button_new_with_label(_("Unicode config file")); | |
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check), IsConfigFileUTF8()); | |
gtk_table_attach_defaults(GTK_TABLE(table), check, 1, 3, 0, 1); | |
gtk_object_set_data(GTK_OBJECT(dialog), "unicode_check", check); | |
-#endif | |
label = gtk_label_new(_("Game length (turns)")); | |
gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2, | |
diff --git a/src/message.c b/src/message.c | |
t@@ -251,11 +251,7 @@ void InitAbilities(Player *Play) | |
Play->Abil.Local[A_DRUGVALUE] = (DrugValue ? TRUE : FALSE); | |
Play->Abil.Local[A_TSTRING] = TRUE; | |
Play->Abil.Local[A_DONEFIGHT] = TRUE; | |
-#ifdef HAVE_GLIB2 | |
Play->Abil.Local[A_UTF8] = TRUE; | |
-#else | |
- Play->Abil.Local[A_UTF8] = FALSE; | |
-#endif | |
Play->Abil.Local[A_DATE] = TRUE; | |
if (!Network) { | |
diff --git a/src/network.c b/src/network.c | |
t@@ -74,20 +74,6 @@ static gboolean StartConnect(int *fd, const gchar *bindaddr… | |
unsigned RemotePort, gboolean *doneOK, | |
LastError **error); | |
-/* | |
- * g_strsplit from GLIB1 behaves differently to GLIB2, so we use this | |
- * wrapper function to give the GLIB2 behaviour in all circumstances. | |
- */ | |
-static gchar **my_strsplit(const gchar *string, const gchar *delim, | |
- gint max_tokens) | |
-{ | |
-#ifdef HAVE_GLIB2 | |
- return g_strsplit(string, delim, max_tokens); | |
-#else | |
- return g_strsplit(string, delim, max_tokens - 1); | |
-#endif | |
-} | |
- | |
#ifdef CYGWIN | |
void StartNetworking() | |
t@@ -1354,7 +1340,7 @@ static void StartHttpAuth(HttpConnection *conn, gboolean… | |
if (!conn->authfunc) | |
return; | |
- split = my_strsplit(header, " ", 2); | |
+ split = g_strsplit(header, " ", 2); | |
if (split[0] && split[1] && g_strcasecmp(split[0], "Basic") == 0 && | |
g_strncasecmp(split[1], "realm=", 6) == 0 && strlen(split[1]) > 6) { | |
t@@ -1375,7 +1361,7 @@ static void ParseHtmlHeader(gchar *line, HttpConnection … | |
gchar **split, *host, *query; | |
unsigned port; | |
- split = my_strsplit(line, " ", 2); | |
+ split = g_strsplit(line, " ", 2); | |
if (split[0] && split[1]) { | |
if (g_strcasecmp(split[0], "Location:") == 0 && | |
(conn->StatusCode == HEC_MOVETEMP | |
t@@ -1413,7 +1399,7 @@ gchar *ReadHttpResponse(HttpConnection *conn, gboolean *… | |
switch (conn->Status) { | |
case HS_CONNECTING: /* OK, we should have the HTTP status line */ | |
conn->Status = HS_READHEADERS; | |
- split = my_strsplit(msg, " ", 3); | |
+ split = g_strsplit(msg, " ", 3); | |
if (split[0] && split[1]) { | |
conn->StatusCode = atoi(split[1]); | |
} else { |