configure.ac: Support multiple GDK backends in one build

This commit is contained in:
Kristian Høgsberg 2011-01-03 10:45:37 -05:00
parent ae7e5fc2d1
commit cacee7e7a3
11 changed files with 107 additions and 72 deletions

View File

@ -71,8 +71,8 @@ gtk+-*-3.0-uninstalled.pc: gtk+-3.0-uninstalled.pc
pkgconfigdir = $(libdir)/pkgconfig pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = gdk-3.0.pc gtk+-3.0.pc gail-3.0.pc pkgconfig_DATA = gdk-3.0.pc gtk+-3.0.pc gail-3.0.pc
pkgconfig_DATA += $(patsubst %,gtk+-%-3.0.pc,@gdktarget@) pkgconfig_DATA += ${GDK_BACKENDS:%=gtk+-%-3.0.pc}
pkgconfig_DATA += $(patsubst %,gdk-%-3.0.pc,@gdktarget@) pkgconfig_DATA += ${GDK_BACKENDS:%=gdk-%-3.0.pc}
if OS_UNIX if OS_UNIX
pkgconfig_DATA += gtk+-unix-print-3.0.pc pkgconfig_DATA += gtk+-unix-print-3.0.pc

View File

@ -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 \ 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 \ 9980 9981 9982 9983 9984 9985 9986 9987 9988 9989 9990 9991 9992 9993 9994 \
9995 9996 9997 9998 9999 9995 9996 9997 9998 9999
if USE_X11
SKIP_GDKTARGET = \ SKIP_GDKTARGET = \
test "$(gdktarget)" != "x11" \ false
&& echo "Gtk+Tests:INFO: Skipping GUI tests for non-X11 target." else
SKIP_GDKTARGET = \
echo "Gtk+Tests:INFO: Skipping GUI tests for non-X11 target."
endif
XVFB_START = \ XVFB_START = \
${XVFB} -help 2>/dev/null 1>&2 \ ${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` \ && XID=`for id in $(XIDS) ; do test -e /tmp/.X$$id-lock || { echo $$id; exit 0; }; done; exit 1` \

View File

@ -85,7 +85,7 @@ LDFLAGS="-L/devel/dist/${ARCH}/${LIBPNG}/lib \
LIBS=-lintl \ LIBS=-lintl \
CFLAGS=-O2 \ CFLAGS=-O2 \
./configure \ ./configure \
--with-gdktarget=win32 \ --enable-win32-backend \
--disable-gdiplus \ --disable-gdiplus \
--with-included-immodules \ --with-included-immodules \
--without-libjasper \ --without-libjasper \

View File

@ -255,22 +255,57 @@ AC_ARG_ENABLE(xinput,
[support XInput extension if available [default=yes]])],, [support XInput extension if available [default=yes]])],,
[enable_xinput="yes"]) [enable_xinput="yes"])
if test "$platform_win32" = yes; then AC_ARG_ENABLE(x11-backend,
gdktarget=win32 [AC_HELP_STRING([--enable-x11-backend],
else [enable the X11 gdk backend])],
gdktarget=x11 [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 fi
AC_ARG_WITH(gdktarget, cairo_backends=
AC_HELP_STRING([--with-gdktarget=@<:@x11/win32/quartz@:>@], GDK_BACKENDS=
[select non-default GDK target]),
gdktarget=$with_gdktarget)
AC_SUBST(gdktarget) if test "x$enable_x11_backend" == xyes; then
case $gdktarget in # GDK calls the xlib backend "x11," cairo calls it "xlib." Other
x11|win32|quartz) ;; # backend names are identical.
*) AC_MSG_ERROR([Invalid target for GDK: use x11, quartz or win32.]);; cairo_backends="$cairo_backends cairo-xlib"
esac 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 if test "x$enable_debug" = "xyes"; then
test "$cflags_set" = set || CFLAGS="$CFLAGS -g" test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
@ -363,18 +398,7 @@ PKG_CHECK_MODULES(BASE_DEPENDENCIES,
cairo-gobject >= cairo_required_version dnl cairo-gobject >= cairo_required_version dnl
gdk-pixbuf-2.0 >= gdk_pixbuf_required_version]) gdk-pixbuf-2.0 >= gdk_pixbuf_required_version])
## In addition to checking that cairo is present, we also need to PKG_CHECK_MODULES(CAIRO_BACKEND, [$cairo_backends])
## 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])
if test "$os_win32" != yes; then if test "$os_win32" != yes; then
# libtool option to control which symbols are exported # libtool option to control which symbols are exported
@ -744,11 +768,11 @@ else
fi fi
all_immodules="am-et,cedilla,cyrillic-translit" 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" all_immodules="${all_immodules},ime"
fi fi
all_immodules="${all_immodules},inuktitut,ipa,multipress,thai,ti-er,ti-et,viqr" 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" all_immodules="${all_immodules},xim"
fi fi
@ -842,7 +866,7 @@ GDK_EXTRA_CFLAGS=
GTK_DEP_PACKAGES_FOR_X= GTK_DEP_PACKAGES_FOR_X=
GTK_DEP_LIBS_FOR_X= GTK_DEP_LIBS_FOR_X=
if test "x$gdktarget" = "xx11"; then if test "x$enable_x11_backend" == xyes; then
X_PACKAGES=fontconfig X_PACKAGES=fontconfig
# #
@ -1101,14 +1125,15 @@ else
AM_CONDITIONAL(HAVE_X11R6, false) AM_CONDITIONAL(HAVE_X11R6, false)
fi 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" GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -lgdi32 -limm32 -lshell32 -lole32 -Wl,-luuid"
AM_CONDITIONAL(USE_WIN32, true) AM_CONDITIONAL(USE_WIN32, true)
else else
AM_CONDITIONAL(USE_WIN32, false) AM_CONDITIONAL(USE_WIN32, false)
fi fi
if test "x$gdktarget" = "xquartz"; then if test "x$enable_quartz_backend" == xyes; then
GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -framework Cocoa" GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -framework Cocoa"
AM_CONDITIONAL(USE_QUARTZ, true) AM_CONDITIONAL(USE_QUARTZ, true)
else else
@ -1117,7 +1142,7 @@ fi
# Check for Pango flags # Check for Pango flags
if test "x$gdktarget" = "xwin32"; then if test "x$enable_win32_backend" == xyes; then
PANGO_PACKAGES="pangowin32 pangocairo" PANGO_PACKAGES="pangowin32 pangocairo"
else else
PANGO_PACKAGES="pango pangocairo" PANGO_PACKAGES="pango pangocairo"
@ -1152,12 +1177,7 @@ fi
CFLAGS="$saved_cflags" CFLAGS="$saved_cflags"
LDFLAGS="$saved_ldflags" LDFLAGS="$saved_ldflags"
# Pull in gio-unix for GDesktopAppInfo usage, see at least gdkapplaunchcontext-x11.c GDK_PACKAGES="$PANGO_PACKAGES $GIO_PACKAGE $X_PACKAGES gdk-pixbuf-2.0 $cairo_backends cairo-gobject"
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_DEP_LIBS="$GDK_EXTRA_LIBS `$PKG_CONFIG --libs $GDK_PACKAGES`" 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" GDK_DEP_CFLAGS="`$PKG_CONFIG --cflags gthread-2.0 $GDK_PACKAGES` $GDK_EXTRA_CFLAGS"
@ -1207,7 +1227,7 @@ else
fi fi
GTK_PACKAGES="atk cairo cairo-gobject gdk-pixbuf-2.0 gio-2.0" 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" GTK_PACKAGES="$GTK_PACKAGES pangoft2"
fi fi
GTK_EXTRA_LIBS= GTK_EXTRA_LIBS=
@ -1524,18 +1544,18 @@ _______EOF
fi fi
],[ ],[
gdk_windowing='' gdk_windowing=''
if expr "$gdktarget" : ".*x11.*" > /dev/null ; then if test "x$enable_x11_backend" == xyes; then
gdk_windowing='$gdk_windowing gdk_windowing="\$gdk_windowing
#define GDK_WINDOWING_X11' #define GDK_WINDOWING_X11"
fi fi
if expr "$gdktarget" : ".*win32.*" > /dev/null ; then if test "x$enable_win32_backend" == xyes; then
gdk_windowing='$gdk_windowing gdk_windowing="\$gdk_windowing
#define GDK_NATIVE_WINDOW_POINTER #define GDK_NATIVE_WINDOW_POINTER
#define GDK_WINDOWING_WIN32' #define GDK_WINDOWING_WIN32"
fi fi
if expr "$gdktarget" : ".*quartz.*" > /dev/null ; then if test "x$enable_quartz_backend" == xyes; then
gdk_windowing='$gdk_windowing gdk_windowing="\$gdk_windowing
#define GDK_WINDOWING_QUARTZ' #define GDK_WINDOWING_QUARTZ"
fi fi
]) ])
@ -1626,4 +1646,4 @@ perf/Makefile
AC_OUTPUT AC_OUTPUT
echo "configuration: echo "configuration:
target: $gdktarget" backends: $GDK_BACKENDS"

View File

@ -360,9 +360,14 @@ How to compile GTK+ itself
<group> <group>
<arg>--enable-packagekit</arg> <arg>--enable-packagekit</arg>
<arg>--disable-packagekit</arg> <arg>--disable-packagekit</arg>
</group> </group>
<group> <group>
<arg>--with-gdktarget=[x11/win32/quartz]</arg> <arg>--enable-x11-backend</arg>
<arg>--disable-x11-backend</arg>
<arg>--enable-win32-backend</arg>
<arg>--disable-win32-backend</arg>
<arg>--enable-quartz-backend</arg>
<arg>--disable-quartz-backend</arg>
</group> </group>
<group> <group>
<arg>--enable-introspection=[no/auto/yes]</arg> <arg>--enable-introspection=[no/auto/yes]</arg>
@ -545,13 +550,20 @@ How to compile GTK+ itself
</formalpara> </formalpara>
<formalpara> <formalpara>
<title><systemitem>--with-gdktarget</systemitem></title> <title><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></title>
<para> <para>
Toggles between the supported backends for GDK. Enables specific backends for GDK. If none of these options
The default is x11, unless the platform is Windows, in which are given, the x11 backend will be enabled by default,
case the default is win32. Other supported backends are unless the platform is Windows, in which case the default is
the quartz backend for OS X. 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.
</para> </para>
</formalpara> </formalpara>
<formalpara> <formalpara>

View File

@ -2,7 +2,7 @@ prefix=@prefix@
exec_prefix=@exec_prefix@ exec_prefix=@exec_prefix@
libdir=@libdir@ libdir=@libdir@
includedir=@includedir@ includedir=@includedir@
target=@gdktarget@ targets=@GDK_BACKENDS@
Name: GDK Name: GDK
Description: GTK+ Drawing Kit Description: GTK+ Drawing Kit

View File

@ -8,7 +8,8 @@ INTROSPECTION_COMPILER_ARGS = \
--includedir=$(srcdir) \ --includedir=$(srcdir) \
--includedir=. --includedir=.
SUBDIRS = $(gdktarget) . tests SUBDIRS = $(GDK_BACKENDS) . tests
DIST_SUBDIRS = win32 x11 quartz tests DIST_SUBDIRS = win32 x11 quartz tests
CLEANFILES = CLEANFILES =
@ -38,8 +39,6 @@ INCLUDES = \
$(GTK_DEBUG_FLAGS) \ $(GTK_DEBUG_FLAGS) \
$(GDK_DEP_CFLAGS) $(GDK_DEP_CFLAGS)
gtarget=$(gdktarget)
if PLATFORM_WIN32 if PLATFORM_WIN32
no_undefined = -no-undefined no_undefined = -no-undefined
endif endif

View File

@ -1,10 +1,10 @@
target=@gdktarget@ targets=@GDK_BACKENDS@
gtk_binary_version=@GTK_BINARY_VERSION@ gtk_binary_version=@GTK_BINARY_VERSION@
Name: GTK+ Uninstalled Name: GTK+ Uninstalled
Description: GTK+ Graphical UI Library (${target} target), Not Installed Description: GTK+ Graphical UI Library (${target} target), Not Installed
Version: @VERSION@ Version: @VERSION@
Requires: gdk-${target}-@GTK_API_VERSION@-uninstalled @GTK_PACKAGES@ Requires: gdk-@GTK_API_VERSION@-uninstalled @GTK_PACKAGES@
Libs: ${pc_top_builddir}/${pcfiledir}/gtk/libgtk-${target}-@GTK_API_VERSION@.la @GTK_EXTRA_LIBS@ 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@ Cflags: -I${pc_top_builddir}/${pcfiledir}/@srcdir@ -I${pc_top_builddir}/${pcfiledir} @GTK_EXTRA_CFLAGS@

View File

@ -2,7 +2,7 @@ prefix=@prefix@
exec_prefix=@exec_prefix@ exec_prefix=@exec_prefix@
libdir=@libdir@ libdir=@libdir@
includedir=@includedir@ includedir=@includedir@
target=@gdktarget@ targets=@GDK_BACKENDS@
gtk_binary_version=@GTK_BINARY_VERSION@ gtk_binary_version=@GTK_BINARY_VERSION@
gtk_host=@host@ gtk_host=@host@

View File

@ -2,7 +2,7 @@ prefix=@prefix@
exec_prefix=@exec_prefix@ exec_prefix=@exec_prefix@
libdir=@libdir@ libdir=@libdir@
includedir=@includedir@ includedir=@includedir@
target=@gdktarget@ targets=@GDK_BACKENDS@
gtk_binary_version=@GTK_BINARY_VERSION@ gtk_binary_version=@GTK_BINARY_VERSION@
gtk_host=@host@ gtk_host=@host@

View File

@ -57,8 +57,6 @@ INCLUDES = \
$(gtk_clipboard_dnd_c_sources_CFLAGS) \ $(gtk_clipboard_dnd_c_sources_CFLAGS) \
$(INCLUDED_IMMODULE_DEFINE) $(INCLUDED_IMMODULE_DEFINE)
gtarget=$(gdktarget)
if PLATFORM_WIN32 if PLATFORM_WIN32
no_undefined = -no-undefined no_undefined = -no-undefined
endif endif