From 54a52b5ebad0eaa04c7b402539cd51d119c84738 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sun, 16 Aug 2015 14:53:15 +0100 Subject: [PATCH] GTK3 port: add '--with-gtk=3' to the configure script. After the last few changes, the whole codebase now compiles and links successfully against GTK3, and I can run an experimental pterm. The config box and font selector look ugly, but the basics all seem to work. In order to compile at all, I had to manually bodge in the extra compile flag -Wno-deprecated-declarations. My plan is to fix all the uses of deprecated things, and then remove that flag. I've made GTK3 the second choice, after GTK2 but before GTK1. GTK2 is the only GTK version that produces a completely sensible build (partly because the GTK3 port is visibly unfinished, and mostly because its server-side font handling is just too slow), so it remains the first choice. --- configure.ac | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/configure.ac b/configure.ac index 5818e032..b6e43164 100644 --- a/configure.ac +++ b/configure.ac @@ -54,14 +54,14 @@ AS_IF([test "x$with_gssapi" != xno], AC_ARG_WITH([gtk], [AS_HELP_STRING([--with-gtk=VER], - [specify GTK version to use (`1' or `2')]) + [specify GTK version to use (`1', `2' or `3')]) AS_HELP_STRING([--without-gtk], [do not use GTK (build command-line tools only)])], [gtk_version_desired="$withval"], [gtk_version_desired="any"]) case "$gtk_version_desired" in - 1 | 2 | any | no) ;; + 1 | 2 | 3 | any | no) ;; yes) gtk_version_desired="any" ;; *) AC_ERROR([Invalid GTK version specified]) esac @@ -70,8 +70,15 @@ AC_CHECK_HEADERS([utmpx.h sys/select.h],,,[ #include #include ]) -# Look for both GTK 2 and GTK 1, in descending order of preference. If -# we can't find either, have the makefile only build the CLI programs. +# Look for GTK 2, GTK 3 and GTK 1, in descending order of preference. +# +# (I like GTK 2 for its faster support for X server-side fonts due to +# not being required to do all its drawing via Cairo; GTK 3 is +# tolerable if GTK 2 can't be had, and GTK 1 is an extreme fallback +# for platforms - of which I've heard of at least one - to which +# nothing newer has ever been ported.) +# +# If we can't find any, have the makefile only build the CLI programs. gtk=none @@ -83,6 +90,17 @@ case "$gtk_version_desired:$gtk" in ;; esac +case "$gtk_version_desired:$gtk" in + 3:none | any:none) + ifdef([AM_PATH_GTK_3_0],[ + AM_PATH_GTK_3_0([3.0.0], [ + gtk=3 + GTK_CFLAGS="$GTK_CFLAGS -Wno-deprecated-declarations" + ], []) + ],[AC_WARNING([generating configure script without GTK 3 autodetection])]) + ;; +esac + case "$gtk_version_desired:$gtk" in 1:none | any:none) ifdef([AM_PATH_GTK],[ @@ -101,7 +119,7 @@ esac AM_CONDITIONAL(HAVE_GTK, [test "$gtk" != "none"]) -if test "$gtk" = "2"; then +if test "$gtk" = "2" -o "$gtk" = "3"; then ac_save_CFLAGS="$CFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $GTK_CFLAGS" @@ -174,11 +192,18 @@ psftp will be built. EOF elif test "$gtk" = "none"; then cat <