From cacee7e7a380ac9009fc1339a860f563ebe4dc4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Mon, 3 Jan 2011 10:45:37 -0500 Subject: [PATCH] configure.ac: Support multiple GDK backends in one build --- Makefile.am | 4 +- Makefile.decl | 10 ++- README.win32 | 2 +- configure.ac | 116 ++++++++++++++++++------------- docs/reference/gtk/building.sgml | 28 +++++--- gdk-3.0.pc.in | 2 +- gdk/Makefile.am | 5 +- gtk+-3.0-uninstalled.pc.in | 6 +- gtk+-3.0.pc.in | 2 +- gtk+-unix-print-3.0.pc.in | 2 +- gtk/Makefile.am | 2 - 11 files changed, 107 insertions(+), 72 deletions(-) diff --git a/Makefile.am b/Makefile.am index 107985ab0f..1063b9fb2f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -71,8 +71,8 @@ gtk+-*-3.0-uninstalled.pc: gtk+-3.0-uninstalled.pc pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = gdk-3.0.pc gtk+-3.0.pc gail-3.0.pc -pkgconfig_DATA += $(patsubst %,gtk+-%-3.0.pc,@gdktarget@) -pkgconfig_DATA += $(patsubst %,gdk-%-3.0.pc,@gdktarget@) +pkgconfig_DATA += ${GDK_BACKENDS:%=gtk+-%-3.0.pc} +pkgconfig_DATA += ${GDK_BACKENDS:%=gdk-%-3.0.pc} if OS_UNIX pkgconfig_DATA += gtk+-unix-print-3.0.pc diff --git a/Makefile.decl b/Makefile.decl index 2f6c579d2d..1ecbc61fe5 100644 --- a/Makefile.decl +++ b/Makefile.decl @@ -17,9 +17,15 @@ XIDS = 101 102 103 104 105 106 107 197 199 211 223 227 293 307 308 309 310 311 \ 1008 1009 4703 4721 4723 4729 4733 4751 9973 9974 9975 9976 9977 9978 9979 \ 9980 9981 9982 9983 9984 9985 9986 9987 9988 9989 9990 9991 9992 9993 9994 \ 9995 9996 9997 9998 9999 + +if USE_X11 SKIP_GDKTARGET = \ - test "$(gdktarget)" != "x11" \ - && echo "Gtk+Tests:INFO: Skipping GUI tests for non-X11 target." + false +else +SKIP_GDKTARGET = \ + echo "Gtk+Tests:INFO: Skipping GUI tests for non-X11 target." +endif + XVFB_START = \ ${XVFB} -help 2>/dev/null 1>&2 \ && XID=`for id in $(XIDS) ; do test -e /tmp/.X$$id-lock || { echo $$id; exit 0; }; done; exit 1` \ diff --git a/README.win32 b/README.win32 index f7c8ca6307..fbbd691f92 100644 --- a/README.win32 +++ b/README.win32 @@ -85,7 +85,7 @@ LDFLAGS="-L/devel/dist/${ARCH}/${LIBPNG}/lib \ LIBS=-lintl \ CFLAGS=-O2 \ ./configure \ ---with-gdktarget=win32 \ +--enable-win32-backend \ --disable-gdiplus \ --with-included-immodules \ --without-libjasper \ diff --git a/configure.ac b/configure.ac index 522bf69f8b..d163ca2a24 100644 --- a/configure.ac +++ b/configure.ac @@ -255,22 +255,57 @@ AC_ARG_ENABLE(xinput, [support XInput extension if available [default=yes]])],, [enable_xinput="yes"]) -if test "$platform_win32" = yes; then - gdktarget=win32 -else - gdktarget=x11 +AC_ARG_ENABLE(x11-backend, + [AC_HELP_STRING([--enable-x11-backend], + [enable the X11 gdk backend])], + [backend_set=yes]) +AC_ARG_ENABLE(win32-backend, + [AC_HELP_STRING([--enable-win32-backend], + [enable the Win32 gdk backend])], + [backend_set=yes]) +AC_ARG_ENABLE(quartz-backend, + [AC_HELP_STRING([--enable-quartz-backend], + [enable the quartz gdk backend])], + [backend_set=yes]) + +if test -z "$backend_set"; then + if test "$platform_win32" = yes; then + enable_win32_backend=yes + else + enable_x11_backend=yes + fi fi -AC_ARG_WITH(gdktarget, - AC_HELP_STRING([--with-gdktarget=@<:@x11/win32/quartz@:>@], - [select non-default GDK target]), - gdktarget=$with_gdktarget) +cairo_backends= +GDK_BACKENDS= -AC_SUBST(gdktarget) -case $gdktarget in - x11|win32|quartz) ;; - *) AC_MSG_ERROR([Invalid target for GDK: use x11, quartz or win32.]);; -esac +if test "x$enable_x11_backend" == xyes; then + # GDK calls the xlib backend "x11," cairo calls it "xlib." Other + # backend names are identical. + cairo_backends="$cairo_backends cairo-xlib" + GDK_BACKENDS="$GDK_BACKENDS x11" + # Pull in gio-unix for GDesktopAppInfo usage, see at least + # gdkapplaunchcontext-x11.c + GIO_PACKAGE=gio-unix-2.0 +fi + +if test "x$enable_win32_backend" == xyes; then + cairo_backends="$cairo_backends cairo-win32" + GDK_BACKENDS="$GDK_BACKENDS win32" + GIO_PACKAGE=gio-2.0 +fi + +if test "x$enable_quartz_backend" == xyes; then + cairo_backends="$cairo_backends cairo-quartz" + GDK_BACKENDS="$GDK_BACKENDS quartz" + GIO_PACKAGE=gio-2.0 +fi + +AC_SUBST(GDK_BACKENDS) + +if test -z "$GDK_BACKENDS"; then + AC_MSG_ERROR([No GDK backends selected.]) +fi if test "x$enable_debug" = "xyes"; then test "$cflags_set" = set || CFLAGS="$CFLAGS -g" @@ -363,18 +398,7 @@ PKG_CHECK_MODULES(BASE_DEPENDENCIES, cairo-gobject >= cairo_required_version dnl gdk-pixbuf-2.0 >= gdk_pixbuf_required_version]) -## In addition to checking that cairo is present, we also need to -## check that the correct cairo backend is there. E.g. if the GDK -## target is win32 we need the cairo-win32 backend and so on. -cairo_backend=$gdktarget - -# GDK calls the xlib backend "x11," cairo calls it "xlib." Other -# backend names are identical. -if test "x$cairo_backend" = "xx11"; then - cairo_backend=xlib -fi -PKG_CHECK_MODULES(CAIRO_BACKEND, - [cairo-$cairo_backend >= cairo_required_version]) +PKG_CHECK_MODULES(CAIRO_BACKEND, [$cairo_backends]) if test "$os_win32" != yes; then # libtool option to control which symbols are exported @@ -744,11 +768,11 @@ else fi all_immodules="am-et,cedilla,cyrillic-translit" -if test "$gdktarget" = "win32"; then +if test "x$enable_win32_backend" == xyes; then all_immodules="${all_immodules},ime" fi all_immodules="${all_immodules},inuktitut,ipa,multipress,thai,ti-er,ti-et,viqr" -if test "$gdktarget" = "x11"; then +if test "x$enable_x11_backend" == xyes; then all_immodules="${all_immodules},xim" fi @@ -842,7 +866,7 @@ GDK_EXTRA_CFLAGS= GTK_DEP_PACKAGES_FOR_X= GTK_DEP_LIBS_FOR_X= -if test "x$gdktarget" = "xx11"; then +if test "x$enable_x11_backend" == xyes; then X_PACKAGES=fontconfig # @@ -1101,14 +1125,15 @@ else AM_CONDITIONAL(HAVE_X11R6, false) fi -if test "x$gdktarget" = "xwin32"; then + +if test "x$enable_win32_backend" == xyes; then GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -lgdi32 -limm32 -lshell32 -lole32 -Wl,-luuid" AM_CONDITIONAL(USE_WIN32, true) else AM_CONDITIONAL(USE_WIN32, false) fi -if test "x$gdktarget" = "xquartz"; then +if test "x$enable_quartz_backend" == xyes; then GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -framework Cocoa" AM_CONDITIONAL(USE_QUARTZ, true) else @@ -1117,7 +1142,7 @@ fi # Check for Pango flags -if test "x$gdktarget" = "xwin32"; then +if test "x$enable_win32_backend" == xyes; then PANGO_PACKAGES="pangowin32 pangocairo" else PANGO_PACKAGES="pango pangocairo" @@ -1152,12 +1177,7 @@ fi CFLAGS="$saved_cflags" LDFLAGS="$saved_ldflags" -# Pull in gio-unix for GDesktopAppInfo usage, see at least gdkapplaunchcontext-x11.c -if test "x$gdktarget" = "xx11"; then - GDK_PACKAGES="$PANGO_PACKAGES gio-unix-2.0 $X_PACKAGES gdk-pixbuf-2.0 cairo-$cairo_backend cairo-gobject" -else - GDK_PACKAGES="$PANGO_PACKAGES gio-2.0 gdk-pixbuf-2.0 cairo-$cairo_backend cairo-gobject" -fi +GDK_PACKAGES="$PANGO_PACKAGES $GIO_PACKAGE $X_PACKAGES gdk-pixbuf-2.0 $cairo_backends cairo-gobject" GDK_DEP_LIBS="$GDK_EXTRA_LIBS `$PKG_CONFIG --libs $GDK_PACKAGES`" GDK_DEP_CFLAGS="`$PKG_CONFIG --cflags gthread-2.0 $GDK_PACKAGES` $GDK_EXTRA_CFLAGS" @@ -1207,7 +1227,7 @@ else fi GTK_PACKAGES="atk cairo cairo-gobject gdk-pixbuf-2.0 gio-2.0" -if test "x$gdktarget" = "xx11"; then +if test "x$enable_x11_backend" == xyes; then GTK_PACKAGES="$GTK_PACKAGES pangoft2" fi GTK_EXTRA_LIBS= @@ -1524,18 +1544,18 @@ _______EOF fi ],[ gdk_windowing='' -if expr "$gdktarget" : ".*x11.*" > /dev/null ; then - gdk_windowing='$gdk_windowing -#define GDK_WINDOWING_X11' +if test "x$enable_x11_backend" == xyes; then + gdk_windowing="\$gdk_windowing +#define GDK_WINDOWING_X11" fi -if expr "$gdktarget" : ".*win32.*" > /dev/null ; then - gdk_windowing='$gdk_windowing +if test "x$enable_win32_backend" == xyes; then + gdk_windowing="\$gdk_windowing #define GDK_NATIVE_WINDOW_POINTER -#define GDK_WINDOWING_WIN32' +#define GDK_WINDOWING_WIN32" fi -if expr "$gdktarget" : ".*quartz.*" > /dev/null ; then - gdk_windowing='$gdk_windowing -#define GDK_WINDOWING_QUARTZ' +if test "x$enable_quartz_backend" == xyes; then + gdk_windowing="\$gdk_windowing +#define GDK_WINDOWING_QUARTZ" fi ]) @@ -1626,4 +1646,4 @@ perf/Makefile AC_OUTPUT echo "configuration: - target: $gdktarget" + backends: $GDK_BACKENDS" diff --git a/docs/reference/gtk/building.sgml b/docs/reference/gtk/building.sgml index 9b538d77f2..c02cf82f61 100644 --- a/docs/reference/gtk/building.sgml +++ b/docs/reference/gtk/building.sgml @@ -360,9 +360,14 @@ How to compile GTK+ itself --enable-packagekit --disable-packagekit - - - --with-gdktarget=[x11/win32/quartz] + + + --enable-x11-backend + --disable-x11-backend + --enable-win32-backend + --disable-win32-backend + --enable-quartz-backend + --disable-quartz-backend --enable-introspection=[no/auto/yes] @@ -545,13 +550,20 @@ How to compile GTK+ itself - <systemitem>--with-gdktarget</systemitem> + <systemitem>--enable-x11-backend</systemitem>, + <systemitem>--disable-x11-backend</systemitem>, + <systemitem>--enable-win32-backend</systemitem>, + <systemitem>--disable-win32-backend</systemitem>, + <systemitem>--enable-quartz-backend</systemitem>, + and <systemitem>--disable-quartz-backend</systemitem> - Toggles between the supported backends for GDK. - The default is x11, unless the platform is Windows, in which - case the default is win32. Other supported backends are - the quartz backend for OS X. + Enables specific backends for GDK. If none of these options + are given, the x11 backend will be enabled by default, + unless the platform is Windows, in which case the default is + win32. If any backend is explicitly enabled or disabled, no + other platform will be enabled automatically. Other + supported backends are the quartz backend for OS X. diff --git a/gdk-3.0.pc.in b/gdk-3.0.pc.in index 796938d937..5c7d27e51b 100644 --- a/gdk-3.0.pc.in +++ b/gdk-3.0.pc.in @@ -2,7 +2,7 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ -target=@gdktarget@ +targets=@GDK_BACKENDS@ Name: GDK Description: GTK+ Drawing Kit diff --git a/gdk/Makefile.am b/gdk/Makefile.am index 4d3a92ea5e..c28a07f51a 100644 --- a/gdk/Makefile.am +++ b/gdk/Makefile.am @@ -8,7 +8,8 @@ INTROSPECTION_COMPILER_ARGS = \ --includedir=$(srcdir) \ --includedir=. -SUBDIRS = $(gdktarget) . tests +SUBDIRS = $(GDK_BACKENDS) . tests + DIST_SUBDIRS = win32 x11 quartz tests CLEANFILES = @@ -38,8 +39,6 @@ INCLUDES = \ $(GTK_DEBUG_FLAGS) \ $(GDK_DEP_CFLAGS) -gtarget=$(gdktarget) - if PLATFORM_WIN32 no_undefined = -no-undefined endif diff --git a/gtk+-3.0-uninstalled.pc.in b/gtk+-3.0-uninstalled.pc.in index 238ad6ff9e..dbccc16111 100644 --- a/gtk+-3.0-uninstalled.pc.in +++ b/gtk+-3.0-uninstalled.pc.in @@ -1,10 +1,10 @@ -target=@gdktarget@ +targets=@GDK_BACKENDS@ gtk_binary_version=@GTK_BINARY_VERSION@ Name: GTK+ Uninstalled Description: GTK+ Graphical UI Library (${target} target), Not Installed Version: @VERSION@ -Requires: gdk-${target}-@GTK_API_VERSION@-uninstalled @GTK_PACKAGES@ -Libs: ${pc_top_builddir}/${pcfiledir}/gtk/libgtk-${target}-@GTK_API_VERSION@.la @GTK_EXTRA_LIBS@ +Requires: gdk-@GTK_API_VERSION@-uninstalled @GTK_PACKAGES@ +Libs: ${pc_top_builddir}/${pcfiledir}/gtk/libgtk-@GTK_API_VERSION@.la @GTK_EXTRA_LIBS@ Cflags: -I${pc_top_builddir}/${pcfiledir}/@srcdir@ -I${pc_top_builddir}/${pcfiledir} @GTK_EXTRA_CFLAGS@ diff --git a/gtk+-3.0.pc.in b/gtk+-3.0.pc.in index b11c4a1791..cc318822a8 100644 --- a/gtk+-3.0.pc.in +++ b/gtk+-3.0.pc.in @@ -2,7 +2,7 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ -target=@gdktarget@ +targets=@GDK_BACKENDS@ gtk_binary_version=@GTK_BINARY_VERSION@ gtk_host=@host@ diff --git a/gtk+-unix-print-3.0.pc.in b/gtk+-unix-print-3.0.pc.in index cbace1af49..8c0f32326c 100644 --- a/gtk+-unix-print-3.0.pc.in +++ b/gtk+-unix-print-3.0.pc.in @@ -2,7 +2,7 @@ prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ -target=@gdktarget@ +targets=@GDK_BACKENDS@ gtk_binary_version=@GTK_BINARY_VERSION@ gtk_host=@host@ diff --git a/gtk/Makefile.am b/gtk/Makefile.am index aab506e7e8..bc76c15775 100644 --- a/gtk/Makefile.am +++ b/gtk/Makefile.am @@ -57,8 +57,6 @@ INCLUDES = \ $(gtk_clipboard_dnd_c_sources_CFLAGS) \ $(INCLUDED_IMMODULE_DEFINE) -gtarget=$(gdktarget) - if PLATFORM_WIN32 no_undefined = -no-undefined endif