]> Pileus Git - ~andy/gtk/blob - configure.ac
3.7.10
[~andy/gtk] / configure.ac
1 # Process this file with autoconf to produce a configure script.
2
3 # Making releases:
4 #   GTK_MICRO_VERSION += 1;
5 #   GTK_INTERFACE_AGE += 1;
6 #   GTK_BINARY_AGE += 1;
7 # if any functions have been added, set GTK_INTERFACE_AGE to 0.
8 # if backwards compatibility has been broken,
9 # set GTK_BINARY_AGE and GTK_INTERFACE_AGE to 0.
10
11 m4_define([gtk_major_version], [3])
12 m4_define([gtk_minor_version], [7])
13 m4_define([gtk_micro_version], [10])
14 m4_define([gtk_interface_age], [0])
15 m4_define([gtk_binary_age],
16           [m4_eval(100 * gtk_minor_version + gtk_micro_version)])
17 m4_define([gtk_version],
18           [gtk_major_version.gtk_minor_version.gtk_micro_version])
19 # This is the X.Y used in -lgtk-FOO-X.Y
20 m4_define([gtk_api_version], [3.0])
21
22 AC_PREREQ([2.62])
23 AC_INIT([gtk+], [gtk_version],
24         [http://bugzilla.gnome.org/enter_bug.cgi?product=gtk%2B],
25         [gtk+])
26
27 AC_CONFIG_HEADERS([config.h])
28 AC_CONFIG_SRCDIR([gdk/gdktypes.h])
29 AC_CONFIG_MACRO_DIR([m4])
30 AC_CONFIG_AUX_DIR([build-aux])
31
32 AC_CANONICAL_HOST
33 AC_CANONICAL_TARGET
34
35 # Define a string for the earliest version that this release has
36 # backwards binary compatibility with for all interfaces a module
37 # might. Unless we add module-only API with lower stability
38 # guarantees, this should be unchanged until we break binary compat
39 # for GTK+.
40 #
41 #GTK_BINARY_VERSION=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION.$LT_CURRENT
42 m4_define([gtk_binary_version], [3.0.0])
43
44 # required versions of other packages
45 m4_define([glib_required_version], [2.35.3])
46 m4_define([pango_required_version], [1.32.4])
47 m4_define([atk_required_version], [2.7.5])
48 m4_define([cairo_required_version], [1.10.0])
49 m4_define([gdk_pixbuf_required_version], [2.27.1])
50 m4_define([introspection_required_version], [1.32.0])
51 GLIB_REQUIRED_VERSION=glib_required_version
52 PANGO_REQUIRED_VERSION=pango_required_version
53 ATK_REQUIRED_VERSION=atk_required_version
54 CAIRO_REQUIRED_VERSION=cairo_required_version
55 GDK_PIXBUF_REQUIRED_VERSION=gdk_pixbuf_required_version
56 INTROSPECTION_REQUIRED_VERSION=introspection_required_version
57
58 AC_SUBST(GLIB_REQUIRED_VERSION)
59 AC_SUBST(PANGO_REQUIRED_VERSION)
60 AC_SUBST(ATK_REQUIRED_VERSION)
61 AC_SUBST(CAIRO_REQUIRED_VERSION)
62 AC_SUBST(GDK_PIXBUF_REQUIRED_VERSION)
63 AC_SUBST(INTROSPECTION_REQUIRED_VERSION)
64
65 # Save this value here, since automake will set cflags later
66 cflags_set=${CFLAGS+set}
67
68 AM_INIT_AUTOMAKE([1.11 -Wall no-define -Wno-portability tar-ustar no-dist-gzip dist-xz])
69 AM_MAINTAINER_MODE([enable])
70
71 # Support silent build rules. Disable
72 # by either passing --disable-silent-rules to configure or passing V=1
73 # to make
74 AM_SILENT_RULES([yes])
75
76 #
77 # For each of the libraries we build, we define the following
78 # substituted variables:
79 #
80 # foo_PACKAGES:     pkg-config packages this library requires
81 # foo_EXTRA_LIBS:   Libraries this module requires not pulled in by pkg-config
82 # foo_EXTRA_CFLAGS: cflags this module requires not pulled in by pkg-config
83 # foo_DEP_LIBS:     All libraries this module requires
84 # foo_DEP_CFLAGS:   All cflags this module requires
85
86
87 GTK_MAJOR_VERSION=gtk_major_version
88 GTK_MINOR_VERSION=gtk_minor_version
89 GTK_MICRO_VERSION=gtk_micro_version
90 GTK_INTERFACE_AGE=gtk_interface_age
91 GTK_BINARY_AGE=gtk_binary_age
92 GTK_VERSION=gtk_version
93 GTK_API_VERSION=gtk_api_version
94 GTK_BINARY_VERSION=gtk_binary_version
95 AC_SUBST(GTK_MAJOR_VERSION)
96 AC_SUBST(GTK_MINOR_VERSION)
97 AC_SUBST(GTK_MICRO_VERSION)
98 AC_SUBST(GTK_INTERFACE_AGE)
99 AC_SUBST(GTK_BINARY_AGE)
100 AC_SUBST(GTK_API_VERSION)
101 AC_SUBST(GTK_VERSION)
102 AC_SUBST(GTK_BINARY_VERSION)
103
104 # libtool versioning
105 #LT_RELEASE=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION
106 #LT_CURRENT=`expr $GTK_MICRO_VERSION - $GTK_INTERFACE_AGE`
107 #LT_REVISION=$GTK_INTERFACE_AGE
108 #LT_AGE=`expr $GTK_BINARY_AGE - $GTK_INTERFACE_AGE`
109 #LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
110
111 m4_define([lt_current], [m4_eval(100 * gtk_minor_version + gtk_micro_version - gtk_interface_age)])
112 m4_define([lt_revision], [gtk_interface_age])
113 m4_define([lt_age], [m4_eval(gtk_binary_age - gtk_interface_age)])
114 LT_VERSION_INFO="lt_current:lt_revision:lt_age"
115 LT_CURRENT_MINUS_AGE=m4_eval(lt_current - lt_age)
116 AC_SUBST(LT_VERSION_INFO)
117 AC_SUBST(LT_CURRENT_MINUS_AGE)
118
119 m4_define([gail_lt_current],[0])
120 m4_define([gail_lt_revision],[0])
121 m4_define([gail_lt_age],[0])
122 m4_define([gail_lt_version_info],[gail_lt_current:gail_lt_revision:gail_lt_age])
123 m4_define([gail_lt_current_minus_age],[m4_eval(gail_lt_current - gail_lt_age)])
124 AC_SUBST([GAIL_LT_VERSION_INFO],[gail_lt_version_info])
125 AC_SUBST([GAIL_LT_CURRENT_MINUS_AGE],[gail_lt_current_minus_age])
126
127 # Checks for programs.
128 AC_PROG_CC
129 AX_PROG_CC_FOR_BUILD
130 AC_PROG_CC_C_O
131 AC_PROG_MKDIR_P
132 AC_PROG_INSTALL
133 AC_PROG_MAKE_SET
134
135
136 GETTEXT_PACKAGE=gtk30
137 AC_SUBST(GETTEXT_PACKAGE)
138 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
139                    [The prefix for our gettext translation domains.])
140
141 MATH_LIB=-lm
142 AC_MSG_CHECKING([for native Win32])
143 LIB_EXE_MACHINE_FLAG=X86
144 EXE_MANIFEST_ARCHITECTURE=X86
145 DISABLE_ON_W32=''
146 case "$host" in
147   *-*-mingw*)
148     dnl Comment-out certain gtk3.types.in lines
149     DISABLE_ON_W32='%'
150     os_win32=yes
151     gio_can_sniff=no
152     MATH_LIB=
153     case "$host" in
154     x86_64-*-*)
155       LIB_EXE_MACHINE_FLAG=X64
156       EXE_MANIFEST_ARCHITECTURE=AMD64
157       ;;
158     esac
159     ;;
160   *)
161     os_win32=no
162     ;;
163 esac
164 AC_MSG_RESULT([$os_win32])
165
166 AC_SUBST(DISABLE_ON_W32)
167 AC_SUBST(LIB_EXE_MACHINE_FLAG)
168 AC_SUBST(EXE_MANIFEST_ARCHITECTURE)
169
170 case $host in
171   *-*-linux*)
172     os_linux=yes
173     ;;
174 esac
175
176 dnl
177 dnl Check for a working C++ compiler, but do not bail out, if none is found.
178 dnl We use this for an automated test for C++ header correctness.
179 dnl
180 AC_CHECK_TOOLS(CXX, [$CCC c++ g++ gcc CC cxx cc++ cl], gcc)
181 AC_LANG_PUSH([C++])
182
183 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],
184                                    [[class a { int b; } c;]])],
185                   [],[CXX=])
186 AM_CONDITIONAL(HAVE_CXX, test "$CXX" != "")
187
188 gtk_save_cxxflags="$CXXFLAGS"
189 CXXFLAGS="$CXXFLAGS -x objective-c++"
190 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[@interface Foo @end]],
191                                    [[]])],
192                   [OBJC=yes],[OBJC=no])
193 AM_CONDITIONAL(HAVE_OBJC, test "$OBJC" = "yes")
194 CXXFLAGS="$gtk_save_cxxflags"
195 AC_LANG_POP([C++])
196
197 if test "$os_win32" = "yes"; then
198   if test x$enable_static = xyes -o x$enable_static = x; then
199     AC_MSG_WARN([Disabling static library build, must build as DLL on Windows.])
200     enable_static=no
201   fi
202   if test x$enable_shared = xno; then
203     AC_MSG_WARN([Enabling shared library build, must build as DLL on Windows.])
204   fi
205   enable_shared=yes
206 fi
207
208 dnl Initialize libtool
209 LT_PREREQ([2.2.6])
210 LT_INIT([disable-static win32-dll])
211 # Create libtool early, because it's used in configure
212 LT_OUTPUT
213
214 # Make sure we use 64-bit versions of various file stuff.
215 AC_SYS_LARGEFILE
216
217 AM_PROG_AS
218 AC_PATH_PROG(NM, nm, nm)
219
220 AC_MSG_CHECKING([for some Win32 platform])
221 case "$host" in
222   *-*-mingw*|*-*-cygwin*)
223     platform_win32=yes
224     ;;
225   *)
226     platform_win32=no
227     ;;
228 esac
229 AC_MSG_RESULT([$platform_win32])
230 AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")
231
232 AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
233 AM_CONDITIONAL(OS_UNIX, test "$os_win32" != "yes")
234 AM_CONDITIONAL(OS_LINUX, test "$os_linux" = "yes")
235
236 if test "$os_win32" = "yes"; then
237   AC_CHECK_TOOL(WINDRES, windres, no)
238   if test "$WINDRES" = no; then
239     AC_MSG_ERROR([*** Could not find an implementation of windres in your PATH.])
240   fi
241   AC_CHECK_PROG(ms_librarian, lib.exe, yes, no)
242 fi
243 AM_CONDITIONAL(MS_LIB_AVAILABLE, test x$ms_librarian = xyes)
244
245 m4_define([debug_default],
246           m4_if(m4_eval(gtk_minor_version % 2), [1], [yes], [minimum]))
247
248 dnl declare --enable-* args and collect ac_help strings
249 AC_ARG_ENABLE(debug,
250               [AS_HELP_STRING([--enable-debug=@<:@no/minimum/yes@:>@],
251                               [turn on debugging @<:@default=debug_default@:>@])],,
252               [enable_debug=debug_default])
253
254 AC_ARG_ENABLE(rebuilds,
255               [AS_HELP_STRING([--disable-rebuilds],
256                               [disable all source autogeneration rules])],,
257               [enable_rebuilds=yes])
258
259 AC_ARG_ENABLE(gtk2-dependency,
260               [AS_HELP_STRING([--enable-gtk2-dependency],
261                               [Do not build gtk-update-icon-cache and other shared tools])],,
262               [enable_gtk2_dependency=no])
263
264 AM_CONDITIONAL(BUILD_ICON_CACHE, [test "x$enable_gtk2_dependency" = xno])
265
266 AC_ARG_ENABLE(xkb,
267               [AS_HELP_STRING([--enable-xkb],
268                               [support XKB extension [default=maybe]])],,
269               [enable_xkb="maybe"])
270 AC_ARG_ENABLE(xinerama,
271               [AS_HELP_STRING([--enable-xinerama],
272                               [support Xinerama extension [default=maybe]])],,
273               [enable_xinerama="maybe"])
274 AC_ARG_ENABLE(xrandr,
275               [AS_HELP_STRING([--enable-xrandr],
276                               [support XRandR extension [default=maybe]])],,
277               [enable_xrandr="maybe"])
278 AC_ARG_ENABLE(xfixes,
279               [AS_HELP_STRING([--enable-xfixes],
280                               [support XFixes extension [default=maybe]])],,
281               [enable_xfixes="maybe"])
282 AC_ARG_ENABLE(xcomposite,
283               [AS_HELP_STRING([--enable-xcomposite],
284                               [support X Composite extension [default=maybe]])],,
285               [enable_xcomposite="maybe"])
286 AC_ARG_ENABLE(xdamage,
287               [AS_HELP_STRING([--enable-xdamage],
288                               [support X Damage extension [default=maybe]])],,
289               [enable_xdamage="maybe"])
290
291 AC_ARG_ENABLE(x11-backend,
292               [AS_HELP_STRING([--enable-x11-backend],
293                               [enable the X11 gdk backend])],
294                               [backend_set=yes])
295 AC_ARG_ENABLE(win32-backend,
296               [AS_HELP_STRING([--enable-win32-backend],
297                               [enable the Win32 gdk backend])],
298                               [backend_set=yes])
299 AC_ARG_ENABLE(quartz-backend,
300               [AS_HELP_STRING([--enable-quartz-backend],
301                               [enable the quartz gdk backend])],
302                               [backend_set=yes])
303 AC_ARG_ENABLE(broadway-backend,
304               [AS_HELP_STRING([--enable-broadway-backend],
305                               [enable the broadway (HTML5) gdk backend])],
306                               [backend_set=yes])
307 AC_ARG_ENABLE(wayland-backend,
308               [AS_HELP_STRING([--enable-wayland-backend],
309                               [enable the wayland gdk backend])],
310                               [backend_set=yes])
311
312 if test -z "$backend_set"; then
313   if test "$platform_win32" = yes; then
314     enable_win32_backend=yes
315   else
316     enable_x11_backend=yes
317   fi
318 fi
319
320 AC_ARG_ENABLE(quartz-relocation,
321               [AS_HELP_STRING([--enable-quartz-relocation],
322                               [enable bundle-based relocation functions])],
323                               [quartz_relocation=yes])
324
325 cairo_backends=
326 backend_immodules=
327 have_gio_unix=no
328 GDK_BACKENDS=
329 GDK_EXTRA_LIBS=
330 GDK_EXTRA_CFLAGS=
331 GDK_WINDOWING=
332 PANGO_PACKAGES="pango pangocairo"
333
334 if test "$enable_x11_backend" = "yes"; then
335   # GDK calls the xlib backend "x11," cairo calls it "xlib." Other
336   # backend names are identical.
337   cairo_backends="$cairo_backends cairo-xlib"
338   GDK_BACKENDS="$GDK_BACKENDS x11"
339   # Pull in gio-unix for GDesktopAppInfo usage, see at least
340   # gdkapplaunchcontext-x11.c
341   have_gio_unix=yes
342   backend_immodules="$backend_immodules,xim"
343   GDK_WINDOWING="$GDK_WINDOWING
344 #define GDK_WINDOWING_X11"
345 fi
346
347 if test "$enable_win32_backend" = "yes"; then
348   cairo_backends="$cairo_backends cairo-win32"
349   GDK_BACKENDS="$GDK_BACKENDS win32"
350   backend_immodules="$backend_immodules,ime"
351   GDK_WINDOWING="$GDK_WINDOWING
352 #define GDK_WINDOWING_WIN32"
353   GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -lgdi32 -limm32 -lshell32 -lole32 -Wl,-luuid"
354   AM_CONDITIONAL(USE_WIN32, true)
355   PANGO_PACKAGES="pangowin32 pangocairo"
356 else
357   AM_CONDITIONAL(USE_WIN32, false)
358 fi
359
360 DISABLE_ON_QUARTZ=''
361 if test "x$enable_quartz_backend" = xyes; then
362   cairo_backends="$cairo_backends cairo-quartz"
363   GDK_BACKENDS="$GDK_BACKENDS quartz"
364   GDK_WINDOWING="$GDK_WINDOWING
365 #define GDK_WINDOWING_QUARTZ"
366   GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -framework Cocoa"
367   DISABLE_ON_QUARTZ='%'
368   AM_CONDITIONAL(USE_QUARTZ, true)
369   if test "x$quartz_relocation" = xyes; then
370     AC_DEFINE([QUARTZ_RELOCATION], [1], [Use NSBundle functions to determine load paths for libraries, translations, etc.])
371   fi
372   # Pull in gio-unix for GDesktopAppInfo usage, see at least
373   # gdkapplaunchcontext-x11.c
374   have_gio_unix=yes
375
376 else
377   AM_CONDITIONAL(USE_QUARTZ, false)
378 fi
379 AC_SUBST(DISABLE_ON_QUARTZ)
380
381 if test "x$enable_broadway_backend" = xyes; then
382   GDK_BACKENDS="$GDK_BACKENDS broadway"
383   cairo_backends="$cairo_backends cairo"
384   have_gio_unix=yes
385   GDK_WINDOWING="$GDK_WINDOWING
386 #define GDK_WINDOWING_BROADWAY"
387   GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -lz"
388   AM_CONDITIONAL(USE_BROADWAY, true)
389 else
390   AM_CONDITIONAL(USE_BROADWAY, false)
391 fi
392
393 if test "x$enable_wayland_backend" = "xyes"; then
394   # For the cairo image backend
395   cairo_backends="$cairo_backends cairo"
396   GDK_BACKENDS="$GDK_BACKENDS wayland"
397   have_gio_unix=yes
398   GDK_WINDOWING="$GDK_WINDOWING
399 #define GDK_WINDOWING_WAYLAND"
400   WAYLAND_PACKAGES="wayland-client >= 1.0.0 xkbcommon >= 0.2.0 wayland-cursor"
401   AM_CONDITIONAL(USE_WAYLAND, true)
402 else
403   AM_CONDITIONAL(USE_WAYLAND, false)
404 fi
405
406 # strip leading space
407 GDK_BACKENDS=${GDK_BACKENDS#* }
408
409 AC_SUBST(GDK_BACKENDS)
410
411 if test -z "$GDK_BACKENDS"; then
412   AC_MSG_ERROR([No GDK backends selected.])
413 fi
414
415 if test "x$enable_debug" = "xyes"; then
416   test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
417   GTK_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
418 else
419   if test "x$enable_debug" = "xno"; then
420     GTK_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS"
421   else
422     GTK_DEBUG_FLAGS="-DG_ENABLE_DEBUG -DG_DISABLE_CAST_CHECKS"
423   fi
424 fi
425
426
427 AC_DEFINE_UNQUOTED(GTK_COMPILED_WITH_DEBUGGING, "${enable_debug}",
428                    [Define if debugging is enabled])
429
430
431 # Build time sanity check...
432 AM_SANITY_CHECK
433
434 changequote(,)dnl
435 if test "x$GCC" = "xyes"; then
436   case " $CFLAGS " in
437   *[\ \ ]-Wall[\ \      ]*) ;;
438   *) CFLAGS="$CFLAGS -Wall" ;;
439   esac
440
441   if test "x$enable_ansi" = "xyes"; then
442     case " $CFLAGS " in
443     *[\ \       ]-ansi[\ \      ]*) ;;
444     *) CFLAGS="$CFLAGS -ansi" ;;
445     esac
446
447     case " $CFLAGS " in
448     *[\ \       ]-pedantic[\ \  ]*) ;;
449     *) CFLAGS="$CFLAGS -pedantic" ;;
450     esac
451   fi
452 fi
453 changequote([,])dnl
454
455 # Ensure MSVC-compatible struct packing convention is used when
456 # compiling for Win32 with gcc.
457 # What flag to depends on gcc version: gcc3 uses "-mms-bitfields", while
458 # gcc2 uses "-fnative-struct".
459 if test x"$os_win32" = xyes; then
460   if test x"$GCC" = xyes; then
461     msnative_struct=''
462     AC_MSG_CHECKING([how to get MSVC-compatible struct packing])
463     if test -z "$ac_cv_prog_CC"; then
464       our_gcc="$CC"
465     else
466       our_gcc="$ac_cv_prog_CC"
467     fi
468     case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in
469       2.)
470         if $our_gcc -v --help 2>/dev/null | grep fnative-struct >/dev/null; then
471           msnative_struct='-fnative-struct'
472         fi
473         ;;
474       *)
475         if $our_gcc -v --help 2>/dev/null | grep ms-bitfields >/dev/null; then
476           msnative_struct='-mms-bitfields'
477         fi
478         ;;
479     esac
480     if test x"$msnative_struct" = x ; then
481       AC_MSG_RESULT([no way])
482       AC_MSG_WARN([produced libraries might be incompatible with MSVC-compiled code])
483     else
484       CFLAGS="$CFLAGS $msnative_struct"
485       AC_MSG_RESULT([${msnative_struct}])
486     fi
487   fi
488 fi
489
490 ## Initial sanity check, done here so that users get told they
491 ## have the wrong dependencies as early in the process as possible.
492 ## Later on we actually use the cflags/libs from separate pkg-config
493 ## calls. Oh, also the later pkg-config calls don't include
494 ## the version requirements since those make the module lists
495 ## annoying to construct
496 PKG_CHECK_MODULES(BASE_DEPENDENCIES,
497   [glib-2.0 >= glib_required_version dnl
498    atk >= atk_required_version dnl
499    pango >= pango_required_version dnl
500    cairo >= cairo_required_version dnl
501    cairo-gobject >= cairo_required_version dnl
502    gdk-pixbuf-2.0 >= gdk_pixbuf_required_version])
503
504 PKG_CHECK_MODULES(CAIRO_BACKEND, [$cairo_backends])
505
506 PKG_CHECK_MODULES(GMODULE, [gmodule-2.0])
507
508 if test "$os_win32" != yes; then
509     # libtool option to control which symbols are exported
510     # right now, symbols starting with _ are not exported
511     LIBTOOL_EXPORT_OPTIONS='-export-symbols-regex "^[[^_]].*"'
512 else
513     # We currently use .def files on Windows (for gdk and gtk)
514     LIBTOOL_EXPORT_OPTIONS=
515 fi
516 AC_SUBST(LIBTOOL_EXPORT_OPTIONS)
517
518 dnl ******************************************************
519 dnl * See whether to include shared library dependencies *
520 dnl ******************************************************
521
522 AC_ARG_ENABLE(explicit-deps,
523               [AS_HELP_STRING([--enable-explicit-deps=@<:@yes/no/auto@:>@],
524                               [use explicit dependencies in .pc files [default=auto]])],,
525               [enable_explicit_deps=auto])
526
527 AC_MSG_CHECKING([Whether to write dependencies into .pc files])
528 case $enable_explicit_deps in
529   auto)
530     export SED
531     deplibs_check_method=`(./libtool --config; echo 'eval echo \"$deplibs_check_method\"') | sh`
532     if test "x$deplibs_check_method" != xpass_all || test "x$enable_static" = xyes ; then
533       enable_explicit_deps=yes
534     else
535       enable_explicit_deps=no
536     fi
537   ;;
538   yes|no)
539   ;;
540   *) AC_MSG_ERROR([Value given to --enable-explicit-deps must be one of yes, no or auto])
541   ;;
542 esac
543 AC_MSG_RESULT($enable_explicit_deps)
544
545 AM_CONDITIONAL(DISABLE_EXPLICIT_DEPS, test $enable_explicit_deps = no)
546
547 # define a MAINT-like variable REBUILD which is set if Perl
548 # and awk are found, so autogenerated sources can be rebuilt
549
550 AC_PATH_PROGS(PERL, perl5 perl)
551
552 # We would like indent, but don't require it.
553 AC_CHECK_PROG(INDENT, indent, indent)
554
555 REBUILD=\#
556 if test "x$enable_rebuilds" = "xyes" && \
557      test -n "$PERL" && \
558      $PERL -e 'exit !($] >= 5.002)' > /dev/null 2>&1 ; then
559   REBUILD=
560 fi
561 AC_SUBST(REBUILD)
562
563 AC_CHECK_FUNCS(lstat mkstemp)
564 AC_CHECK_FUNCS(localtime_r)
565
566 # _NL_TIME_FIRST_WEEKDAY is an enum and not a define
567 AC_MSG_CHECKING([for _NL_TIME_FIRST_WEEKDAY])
568 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]],
569                                 [[char c;
570                                   c = *((unsigned char *)  nl_langinfo(_NL_TIME_FIRST_WEEKDAY));]])],
571                [gtk_ok=yes], [gtk_ok=no])
572 AC_MSG_RESULT($gtk_ok)
573 if test "$gtk_ok" = "yes"; then
574   AC_DEFINE([HAVE__NL_TIME_FIRST_WEEKDAY], [1],
575             [Define if _NL_TIME_FIRST_WEEKDAY is available])
576 fi
577
578 # _NL_MEASUREMENT_MEASUREMENT is an enum and not a define
579 AC_MSG_CHECKING([for _NL_MEASUREMENT_MEASUREMENT])
580 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]],
581                                 [[char c;
582                                   c = *((unsigned char *)  nl_langinfo(_NL_MEASUREMENT_MEASUREMENT));]])],
583                [gtk_ok=yes], [gtk_ok=no])
584 AC_MSG_RESULT($gtk_ok)
585 if test "$gtk_ok" = "yes"; then
586   AC_DEFINE([HAVE__NL_MEASUREMENT_MEASUREMENT], [1],
587             [Define if _NL_MEASUREMENT_MEASUREMENT is available])
588 fi
589
590 # _NL_PAPER_HEIGHT is an enum and not a define
591 AC_MSG_CHECKING([for _NL_PAPER_HEIGHT])
592 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]],
593                                 [[char c;
594                                   c = *((unsigned char *)  nl_langinfo(_NL_PAPER_HEIGHT));]])],
595                [gtk_ok=yes], [gtk_ok=no])
596 AC_MSG_RESULT($gtk_ok)
597 if test "$gtk_ok" = "yes"; then
598   AC_DEFINE([HAVE__NL_PAPER_HEIGHT], [1],
599             [Define if _NL_PAPER_HEIGHT is available])
600 fi
601
602 # _NL_PAPER_WIDTH is an enum and not a define
603 AC_MSG_CHECKING([for _NL_PAPER_WIDTH])
604 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]],
605                                 [[char c;
606                                   c = *((unsigned char *)  nl_langinfo(_NL_PAPER_WIDTH));]])],
607                [gtk_ok=yes], [gtk_ok=no])
608 AC_MSG_RESULT($gtk_ok)
609 if test "$gtk_ok" = "yes"; then
610   AC_DEFINE([HAVE__NL_PAPER_WIDTH], [1],
611             [Define if _NL_PAPER_WIDTH is available])
612 fi
613
614 # i18n stuff
615 ALL_LINGUAS="`grep -v '^#' "$srcdir/po/LINGUAS" | tr '\n' ' '`"
616 AM_GLIB_GNU_GETTEXT
617 LIBS="$LIBS $INTLLIBS"
618 AC_CONFIG_COMMANDS([po-properties],
619                    [[case "$CONFIG_FILES" in *po-properties/Makefile.in*)
620                        sed -e "/POTFILES =/r po-properties/POTFILES" po-properties/Makefile.in > po-properties/Makefile
621                      esac]],
622                    [[]])
623
624 dnl Snippet below is copied from AM_GLIB_GNU_GETTEXT to generate a first
625 dnl po-properties/POTFILES during configure; see GNOME #573515.
626 dnl
627 dnl Generate list of files to be processed by xgettext which will
628 dnl be included in po-properties/Makefile.
629 test -d po-properties || mkdir po-properties
630 if test "x$srcdir" != "x."; then
631   if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then
632     popropsrcprefix="$srcdir/"
633   else
634     popropsrcprefix="../$srcdir/"
635   fi
636 else
637   popropsrcprefix="../"
638 fi
639 rm -f po-properties/POTFILES
640 sed -e "/^#/d" -e "/^\$/d" -e "s,.*,    $popropsrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \
641 < $srcdir/po-properties/POTFILES.in > po-properties/POTFILES
642 dnl (End of adapted AM_GLIB_GNU_GETTEXT snippet.)
643
644 AM_GLIB_DEFINE_LOCALEDIR(GTK_LOCALEDIR)
645
646 dnl The DU4 header files don't provide library prototypes unless
647 dnl -std1 is given to the native cc.
648 AC_MSG_CHECKING([for extra flags to get ANSI library prototypes])
649
650 gtk_save_LIBS=$LIBS
651 LIBS="$LIBS -lm"
652 AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <math.h>
653                                 int main (void) { return (log(1) != log(1.)); }]])],
654               [AC_MSG_RESULT(none needed)],
655               [gtk_save_CFLAGS="$CFLAGS"
656                CFLAGS="$CFLAGS -std1"
657                AC_RUN_IFELSE([AC_LANG_SOURCE([[#include <math.h>
658                                                int main (void) { return (log(1) != log(1.)); }]])],
659                              [AC_MSG_RESULT(-std1)],
660                              [AC_MSG_RESULT()
661                               CFLAGS="$gtk_save_CFLAGS"
662                               AC_MSG_WARN([No ANSI prototypes found in library. (-std1 did not work.)])],
663                              [true])],
664               [AC_MSG_RESULT(none needed)])
665
666 LIBS=$gtk_save_LIBS
667
668 AC_MSG_CHECKING(for the BeOS)
669 case $host in
670   *-*-beos*)
671     AC_MSG_RESULT(yes)
672     MATH_LIB=
673   ;;
674   *)
675     AC_MSG_RESULT(no)
676   ;;
677 esac
678
679 AC_SUBST(MATH_LIB)
680 #
681 # see bug 162979
682 #
683 AC_MSG_CHECKING(for HP-UX)
684 case $host_os in
685   hpux9* | hpux10* | hpux11*)
686     AC_MSG_RESULT(yes)
687     CFLAGS="$CFLAGS -DHPPEX -DSHMLINK"
688   ;;
689   *)
690     AC_MSG_RESULT(no)
691   ;;
692 esac
693
694 #
695 # Run AM_PATH_GLIB_2_0 to make sure that GLib is installed and working
696 #
697
698 AM_PATH_GLIB_2_0(glib_required_version, :,
699   AC_MSG_ERROR([
700 *** GLIB glib_required_version or better is required. The latest version of
701 *** GLIB is always available from ftp://ftp.gtk.org/pub/gtk/.]),
702   gobject gmodule-no-export)
703
704 dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
705 dnl
706 gtk_save_LIBS=$LIBS
707 LIBS="$LIBS $GLIB_LIBS"
708 AC_CHECK_FUNCS(bind_textdomain_codeset)
709 LIBS=$gtk_save_LIBS
710
711 AC_CHECK_HEADERS(pwd.h,
712                  AC_DEFINE(HAVE_PWD_H, 1,
713                            [Define to 1 if pwd.h is available]))
714 AC_CHECK_HEADERS(sys/time.h,
715                  AC_DEFINE(HAVE_SYS_TIME_H, 1,
716                            [Define to 1 if time.h is available]))
717 AC_CHECK_HEADERS(unistd.h,
718                  AC_DEFINE(HAVE_UNISTD_H, 1,
719                            [Define to 1 if unistd.h is available]))
720 AC_CHECK_HEADERS(ftw.h,
721                  AC_DEFINE(HAVE_FTW_H, 1,
722                            [Define to 1 if ftw.h is available]))
723
724 AC_MSG_CHECKING([for GNU ftw extensions])
725 AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#define _XOPEN_SOURCE 500
726                                      #define _GNU_SOURCE
727                                      #include <ftw.h>]],
728                                    [[int flags = FTW_ACTIONRETVAL;]])],
729                   [gtk_ok=yes],[gtk_ok=no])
730 if test $gtk_ok = yes; then
731     AC_MSG_RESULT([yes])
732     AC_DEFINE(HAVE_GNU_FTW, 1, [Have GNU ftw])
733 else
734     AC_MSG_RESULT([no])
735 fi
736
737 #
738 # Disable deprecation checks for all libraries we depend on on stable branches.
739 # This is so newer versions of those libraries don't cause more warnings with
740 # a stable GTK version.
741 # We don't ever want to turn off deprecation warnings for master however, because
742 # that's where we get rid of deprecated API we use.
743 #
744 if test m4_eval(gtk_minor_version % 2) = 0 ; then
745   AC_DEFINE_UNQUOTED(GLIB_DISABLE_DEPRECATION_WARNINGS, 1,
746                      [Disable deprecation warnings from glib])
747 fi
748
749 dnl
750 saved_cflags="$CFLAGS"
751 saved_ldflags="$LDFLAGS"
752
753
754 # Checks for library functions.
755 AC_FUNC_MMAP
756
757 AC_CHECK_FUNCS(mallinfo)
758 AC_CHECK_FUNCS(getresuid)
759 AC_TYPE_UID_T
760
761 # Check for round(), rint(), isnan(), isinf() and nearbyint()
762 AC_CHECK_LIB(m,round,,)
763 AC_CHECK_FUNCS(round rint nearbyint)
764 AC_CHECK_DECLS([isnan, isinf], [], [], [[#include <math.h>]])
765
766 # Checks for gdkspawn
767 AC_CHECK_HEADERS(crt_externs.h)
768 AC_CHECK_FUNCS(_NSGetEnviron)
769
770 AC_MSG_CHECKING(whether to build dynamic modules)
771
772 AC_ARG_ENABLE(modules,
773               [AS_HELP_STRING([--disable-modules],
774                               [disable dynamic module loading])])
775
776 dynworks=false
777 build_dynamic_modules=no
778 deps=
779 if test x$enable_modules = xno; then
780     AC_MSG_RESULT(no)
781 else
782     AC_MSG_RESULT(yes)
783     AC_MSG_CHECKING(whether dynamic modules work)
784     ## for loop is to strip newline
785     tmp=`$PKG_CONFIG --variable=gmodule_supported gmodule-no-export-2.0`
786     for I in $tmp; do
787         dynworks=$I
788     done
789
790     dnl Now we check to see if our libtool supports shared lib deps
791     dnl (in a rather ugly way even)
792     if $dynworks; then
793         module_libtool_config="${CONFIG_SHELL-/bin/sh} ./libtool --config"
794         module_deplibs_check=`$module_libtool_config | \
795             grep '^[[a-z_]]*check[[a-z_]]*_method=[['\''"]]' | \
796             sed 's/.*[['\''"]]\(.*\)[['\''"]]$/\1/'`
797         if test "x$module_deplibs_check" = "xnone" || \
798            test "x$module_deplibs_check" = "xunknown" || \
799            test "x$module_deplibs_check" = "x"; then
800             dynworks=false
801         fi
802     fi
803
804     if $dynworks; then
805         build_dynamic_modules=yes
806         AC_DEFINE(USE_GMODULE, 1,
807                   [Define to 1 if gmodule works and should be used])
808         AC_MSG_RESULT(yes)
809     else
810         build_dynamic_modules=no
811         AC_MSG_RESULT(no)
812     fi
813 fi
814
815 AM_CONDITIONAL(BUILD_DYNAMIC_MODULES, $dynworks)
816
817 #
818 # Allow building some or all immodules included
819 #
820 AC_MSG_CHECKING(immodules to build)
821
822 AC_ARG_WITH(included_immodules,
823             [AS_HELP_STRING([--with-included-immodules=MODULE1,MODULE2,...],
824                             [build the specified input methods into gtk])])
825
826 if $dynworks; then
827    :
828 else
829    ## if the option was specified, leave it; otherwise disable included immodules
830    if test x$with_included_immodules = xno; then
831            with_included_immodules=yes
832    fi
833 fi
834
835 all_immodules="am-et,cedilla,cyrillic-translit,inuktitut,ipa,multipress,thai,ti-er,ti-et,viqr$backend_immodules"
836
837 included_immodules=""
838 # If the switch specified without listing any specific ones, include all
839 if test "x$with_included_immodules" = xyes ; then
840   included_immodules="$all_immodules"
841 else
842   included_immodules="$with_included_immodules"
843 fi
844
845 AC_MSG_RESULT($included_immodules)
846 AM_CONDITIONAL(HAVE_INCLUDED_IMMMODULES, test "x$included_immodules" != x)
847
848 INCLUDED_IMMODULE_OBJ=
849 INCLUDED_IMMODULE_DEFINE=
850
851 IFS="${IFS=     }"; gtk_save_ifs="$IFS"; IFS=","
852 for immodule in $included_immodules; do
853  immodule_underscores=`echo $immodule | sed -e 's/-/_/g'`
854  if echo "$all_immodules" | egrep "(^|,)$immodule(\$|,)" > /dev/null; then
855    :
856  else
857    AC_MSG_ERROR([the specified input method $immodule does not exist])
858  fi
859
860  INCLUDED_IMMODULE_OBJ="$INCLUDED_IMMODULE_OBJ ../modules/input/libstatic-im-$immodule.la"
861  INCLUDED_IMMODULE_DEFINE="$INCLUDED_IMMODULE_DEFINE -DINCLUDE_IM_$immodule_underscores"
862  eval INCLUDE_$immodule_underscores=yes
863 done
864 IFS="$gtk_save_ifs"
865 AC_SUBST(INCLUDED_IMMODULE_OBJ)
866 AC_SUBST(INCLUDED_IMMODULE_DEFINE)
867
868 AM_CONDITIONAL(INCLUDE_IM_AM_ET, [test x"$INCLUDE_am_et" = xyes])
869 AM_CONDITIONAL(INCLUDE_IM_CEDILLA, [test x"$INCLUDE_cedilla" = xyes])
870 AM_CONDITIONAL(INCLUDE_IM_CYRILLIC_TRANSLIT, [test x"$INCLUDE_cyrillic_translit" = xyes])
871 AM_CONDITIONAL(INCLUDE_IM_IME, [test x"$INCLUDE_ime" = xyes])
872 AM_CONDITIONAL(INCLUDE_IM_INUKTITUT, [test x"$INCLUDE_inuktitut" = xyes])
873 AM_CONDITIONAL(INCLUDE_IM_IPA, [test x"$INCLUDE_ipa" = xyes])
874 AM_CONDITIONAL(INCLUDE_IM_MULTIPRESS, [test x"$INCLUDE_multipress" = xyes])
875 AM_CONDITIONAL(INCLUDE_IM_THAI, [test x"$INCLUDE_thai" = xyes])
876 AM_CONDITIONAL(INCLUDE_IM_TI_ER, [test x"$INCLUDE_ti_er" = xyes])
877 AM_CONDITIONAL(INCLUDE_IM_TI_ET, [test x"$INCLUDE_ti_et" = xyes])
878 AM_CONDITIONAL(INCLUDE_IM_VIQR, [test x"$INCLUDE_viqr" = xyes])
879 AM_CONDITIONAL(INCLUDE_IM_XIM, [test x"$INCLUDE_xim" = xyes])
880
881 # Checks to see whether we should include mediaLib
882 # support.
883 #
884 AC_CHECK_HEADER(sys/systeminfo.h,
885                 AC_DEFINE(HAVE_SYS_SYSTEMINFO_H, 1,
886                           [Define to 1 if sys/systeminfo.h is available]))
887 AC_CHECK_HEADER(sys/sysinfo.h,
888                 AC_DEFINE(HAVE_SYS_SYSINFO_H, 1,
889                           [Define to 1 if sys/sysinfo.h is available]))
890
891 dnl Look for a host system's gdk-pixbuf-csource if we are cross-compiling
892
893 AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
894
895 AS_IF([test "x$enable_gtk2_dependency" = xyes],
896       [AC_PATH_PROG(GTK_UPDATE_ICON_CACHE, gtk-update-icon-cache, no)
897        if test x$GTK_UPDATE_ICON_CACHE = xno; then
898          REBUILD_PNGS=#
899        fi],
900
901       [test "x$cross_compiling" = xyes],
902       [# If no GTK+2 dependency and cross compiling, we need to find a host gdk-pixbuf.
903        # pkg.m4 blocks all variable starting with PKG, so allow this one
904        m4_pattern_allow([PKG_CONFIG_FOR_BUILD])
905
906        AS_IF([test x$PKG_CONFIG_FOR_BUILD = x],
907              [AC_MSG_ERROR([You must define PKG_CONFIG_FOR_BUILD when cross compiling])])
908
909        AC_MSG_CHECKING([for native gdk-pixbuf])
910        AS_IF([AC_RUN_LOG([$PKG_CONFIG_FOR_BUILD --exists --print-errors gdk-pixbuf-2.0])],
911              [AC_MSG_RESULT([yes])],
912              [AC_MSG_ERROR([native gdk-pixbuf not found])])
913
914        NATIVE_GDKPIXBUF_CFLAGS=`$PKG_CONFIG_FOR_BUILD --cflags gdk-pixbuf-2.0`
915        NATIVE_GDKPIXBUF_LIBS=`$PKG_CONFIG_FOR_BUILD --libs gdk-pixbuf-2.0`
916        AC_SUBST(NATIVE_GDKPIXBUF_CFLAGS)
917        AC_SUBST(NATIVE_GDKPIXBUF_LIBS)]
918 )
919
920 AM_CONDITIONAL(USE_EXTERNAL_ICON_CACHE, [test "x$enable_gtk2_dependency" = xyes])
921
922 AC_PATH_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource, no)
923
924 if test ! -f $srcdir/gtk/gtkbuiltincache.h &&
925    test "x$REBUILD_PNGS" = "x#" ; then
926      AC_MSG_ERROR([
927 *** gtkbuiltincache.h is not in the tree, and cannot be built
928 *** because you don't have libpng, or (when cross-compiling) you
929 *** don't have a prebuilt gtk-update-icon-cache on the build system.])
930 fi
931
932 ########################################
933 # Windowing system checks
934 ########################################
935
936 # GTK+ uses some X calls, so needs to link against X directly
937 GTK_DEP_PACKAGES_FOR_X=
938 GTK_DEP_LIBS_FOR_X=
939 X_EXTENSIONS=
940
941 if test "x$enable_x11_backend" = xyes; then
942   X_PACKAGES=fontconfig
943
944   #
945   # We use fontconfig very peripherally when decoding the default
946   # settings.
947   #
948   if $PKG_CONFIG --exists fontconfig; then : ; else
949     AC_MSG_ERROR([
950 *** fontconfig (http://www.fontconfig.org) is required by the X11 backend.])
951   fi
952
953   #
954   # Check for basic X packages; we use pkg-config if available
955   #
956   if $PKG_CONFIG --exists x11 xext; then
957     have_base_x_pc=true
958     X_PACKAGES="$X_PACKAGES x11 xext"
959     x_libs="`$PKG_CONFIG --libs x11 xext`"
960     X_CFLAGS="`$PKG_CONFIG --cflags x11 xext`"
961
962     # Strip out any .la files that pkg-config might give us (this happens
963     # with -uninstalled.pc files)
964     x_libs_for_checks=
965     for I in $x_libs ; do
966       case $I in
967         *.la) ;;
968         *) x_libs_for_checks="$x_libs_for_checks $I" ;;
969       esac
970     done
971
972     GTK_PACKAGES_FOR_X="x11"
973   else
974     have_base_x_pc=false
975     AC_PATH_XTRA
976     if test x$no_x = xyes ; then
977       AC_MSG_ERROR([X development libraries not found])
978     fi
979
980     x_cflags="$X_CFLAGS"
981     x_libs_for_checks="$X_LIBS -lXext -lX11 $X_EXTRA_LIBS"
982
983     GTK_DEP_LIBS_FOR_X="$X_LIBS -lX11 $X_EXTRA_LIBS"
984   fi
985
986   # Extra libraries found during checks (-lXinerama, etc), not from pkg-config.
987   x_extra_libs=
988
989   gtk_save_cppflags="$CPPFLAGS"
990   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
991
992   gtk_save_LIBS=$LIBS
993   LIBS="$x_libs_for_checks $LIBS"
994
995   # Sanity check for the X11 and Xext libraries. While everything we need from
996   # Xext is optional, the chances a system has *none* of these things is so
997   # small that we just unconditionally require it.
998   AC_CHECK_FUNC(XOpenDisplay, :,
999                 AC_MSG_ERROR([*** libX11 and libXext not found. Check 'config.log' for more details.]))
1000   AC_CHECK_FUNC(XextFindDisplay, :,
1001                 AC_MSG_ERROR([*** libX11 and libXext not found. Check 'config.log' for more details.]))
1002
1003   # Check for xReply
1004
1005   AC_MSG_CHECKING([if <X11/extensions/XIproto.h> is needed for xReply])
1006   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/Xlibint.h>]],
1007                                      [[xReply *rep = NULL;
1008                                        rep = rep;]])],
1009                     [AC_MSG_RESULT([no])],
1010                     [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <X11/extensions/XIproto.h>
1011                                                           #include <X11/Xlibint.h>]],
1012                                                         [[xReply *rep = NULL;
1013                                                           rep = rep;]])],
1014                                        [AC_MSG_RESULT([yes])
1015                                         AC_DEFINE([NEED_XIPROTO_H_FOR_XREPLY], [1],
1016                                                   [Define if <X11/extensions/XIproto.h> needed for xReply])],
1017                                        [AC_MSG_RESULT([unknown])
1018                                         AC_MSG_ERROR([xReply type unavailable. X11 is too old])])])
1019
1020   # Check for XKB support.
1021
1022   if test "x$enable_xkb" = "xyes"; then
1023         AC_CHECK_FUNC(XkbQueryExtension,
1024                       X_EXTENSIONS="$X_EXTENSIONS XKB"
1025                       AC_DEFINE(HAVE_XKB, 1, [Define to use XKB extension]),
1026                       AC_MSG_ERROR([*** XKB extension not found. Check 'config.log' for more details.]))
1027   elif test "x$enable_xkb" = "xmaybe"; then
1028         AC_CHECK_FUNC(XkbQueryExtension,
1029                       X_EXTENSIONS="$X_EXTENSIONS XKB"
1030                       AC_DEFINE(HAVE_XKB, 1, [Define to use XKB extension]))
1031   else
1032         AC_MSG_WARN(XKB support explicitly disabled)
1033   fi
1034
1035   # Check for shaped window extension
1036
1037   AC_CHECK_FUNC(XShapeCombineMask, :,
1038      [AC_MSG_ERROR([Shape extension not found, check your development headers])])
1039
1040   # X SYNC check
1041   gtk_save_CFLAGS="$CFLAGS"
1042   CFLAGS="$CFLAGS $x_cflags"
1043
1044   AC_CHECK_FUNC(XSyncQueryExtension,
1045       [AC_CHECK_HEADER(X11/extensions/sync.h,
1046           AC_DEFINE(HAVE_XSYNC, 1, [Have the SYNC extension library]),
1047           :, [#include <X11/Xlib.h>])])
1048
1049   CFLAGS="$gtk_save_CFLAGS"
1050
1051   if test "x$enable_xinerama" != "xno"; then
1052     # Check for Xinerama extension (Solaris impl or Xfree impl)
1053     have_xfree_xinerama=false
1054     have_solaris_xinerama=false
1055
1056     gtk_save_cppflags="$CPPFLAGS"
1057     CPPFLAGS="$CPPFLAGS $x_cflags"
1058
1059     # Check for XFree
1060     AC_MSG_CHECKING(for Xinerama packages)
1061
1062     if $PKG_CONFIG --exists xinerama ; then
1063        AC_MSG_RESULT(yes)
1064        have_xfree_xinerama=true
1065        X_PACKAGES="$X_PACKAGES xinerama"
1066     else
1067        AC_MSG_RESULT(no)
1068        AC_CHECK_LIB(Xinerama, XineramaQueryExtension,
1069            [AC_CHECK_HEADER(X11/extensions/Xinerama.h,
1070            [GTK_ADD_LIB(x_extra_libs,Xinerama)
1071            have_xfree_xinerama=true], :,
1072            [#include <X11/Xlib.h>])])
1073     fi
1074
1075     if $have_xfree_xinerama ; then
1076       X_EXTENSIONS="$X_EXTENSIONS Xinerama"
1077       AC_DEFINE(HAVE_XFREE_XINERAMA, 1,
1078                 [Define to 1 if XFree Xinerama is available])
1079       AC_DEFINE(HAVE_XINERAMA, 1,
1080                 [Define to 1 is Xinerama is available])
1081     else
1082       case "$host" in
1083         *-*-solaris*)
1084             # Check for solaris
1085             AC_MSG_CHECKING(for Xinerama support on Solaris)
1086
1087             have_solaris_xinerama=false
1088             AC_CHECK_FUNC(XineramaGetInfo,
1089                 [AC_CHECK_HEADER(X11/extensions/xinerama.h,
1090                     [have_solaris_xinerama=true], :,
1091                     [#include <X11/Xlib.h>])])
1092
1093             if $have_solaris_xinerama ; then
1094               X_EXTENSIONS="$X_EXTENSIONS Xinerama"
1095               AC_DEFINE(HAVE_SOLARIS_XINERAMA, 1,
1096                         [Define to 1 if solaris xinerama is available])
1097               AC_DEFINE(HAVE_XINERAMA, 1,
1098                         [Define to 1 if xinerama is available])
1099               AC_MSG_RESULT(yes)
1100             else
1101               AC_MSG_RESULT(no)
1102             fi
1103             ;;
1104         *)
1105             ;;
1106       esac
1107     fi
1108   fi
1109   if test "x$enable_xinerama" = "xyes" ; then
1110     if test "x$have_xfree_xinerama" != "xtrue" -a "x$have_solaris_xinerama" != "xtrue" ; then
1111       AC_MSG_ERROR([*** Xinerama extension not found. Check 'config.log' for more details.])
1112     fi
1113   fi
1114
1115   # Check for XGetEventData for GenericEvents
1116   AC_CHECK_FUNC(XGetEventData,
1117                 AC_DEFINE(HAVE_XGENERICEVENTS, 1, [Have XGenericEvent]))
1118
1119   # set up things for XInput
1120   if $PKG_CONFIG --exists "xi" ; then
1121
1122     X_PACKAGES="$X_PACKAGES xi"
1123     GTK_PACKAGES_FOR_X="$GTK_PACKAGES_FOR_X xi"
1124
1125     AC_CHECK_HEADER(X11/extensions/XInput2.h,
1126                     have_xinput2=yes
1127                     AC_DEFINE(XINPUT_2, 1, [Define to 1 if XInput 2.0 is available]))
1128
1129     gtk_save_LIBS="$LIBS"
1130     LIBS="$LIBS -lXi"
1131
1132     # Note that we also check that the XIScrollClassInfo struct is defined,
1133     # because at least Ubuntu Oneiric seems to have XIAllowTouchEvents(), but not the XIScrollClassInfo struct.
1134     AC_CHECK_FUNC([XIAllowTouchEvents],
1135       [AC_CHECK_MEMBER([XIScrollClassInfo.number],
1136                        have_xinput2_2=yes
1137                        AC_DEFINE(XINPUT_2_2, 1, [Define to 1 if XInput 2.2 is available]),
1138                        have_xinput2_2=no,
1139                        [[#include <X11/extensions/XInput2.h>]])])
1140     LIBS="$gtk_save_LIBS"
1141
1142     if test "x$have_xinput2_2" = "xyes"; then
1143       X_EXTENSIONS="$X_EXTENSIONS XI2.2"
1144     else
1145       X_EXTENSIONS="$X_EXTENSIONS XI2"
1146     fi
1147   fi
1148
1149   AS_IF([test "x$have_xinput2" != "xyes"],
1150         [AC_MSG_ERROR([*** XInput2 extension not found. Check 'config.log' for more details.])])
1151
1152   # Check for the RANDR extension
1153   if test x"$enable_xrandr" != xno; then
1154     if $PKG_CONFIG --exists "xrandr >= 1.2.99" ; then
1155       AC_DEFINE(HAVE_RANDR, 1, [Have the Xrandr extension library])
1156
1157       X_PACKAGES="$X_PACKAGES xrandr"
1158       X_EXTENSIONS="$X_EXTENSIONS XRANDR"
1159     elif test x"$enable_xrandr" = xyes; then
1160       AC_MSG_ERROR([RANDR support requested but xrandr not found])
1161     fi
1162   fi
1163
1164   # Checks for Xcursor library
1165
1166   if $PKG_CONFIG --exists xcursor ; then
1167     AC_DEFINE(HAVE_XCURSOR, 1, [Have the Xcursor library])
1168
1169     X_PACKAGES="$X_PACKAGES xcursor"
1170   fi
1171
1172   # Checks for XFixes extension
1173
1174   if test x"$enable_xfixes" != xno; then
1175     if $PKG_CONFIG --exists xfixes ; then
1176       AC_DEFINE(HAVE_XFIXES, 1, [Have the XFIXES X extension])
1177
1178       X_PACKAGES="$X_PACKAGES xfixes"
1179       X_EXTENSIONS="$X_EXTENSIONS XFIXES"
1180       GTK_PACKAGES_FOR_X="$GTK_PACKAGES_FOR_X xfixes"
1181     elif test x"$enable_xfixes" = xyes; then
1182       AC_MSG_ERROR([XFixes support requested but xfixes not found])
1183     fi
1184   fi
1185
1186   # Checks for Xcomposite extension
1187
1188   if test x"$enable_xcomposite" != xno; then
1189     if $PKG_CONFIG --exists xcomposite ; then
1190       AC_DEFINE(HAVE_XCOMPOSITE, 1, [Have the XCOMPOSITE X extension])
1191
1192       X_PACKAGES="$X_PACKAGES xcomposite"
1193       X_EXTENSIONS="$X_EXTENSIONS Composite"
1194       GTK_PACKAGES_FOR_X="$GTK_PACKAGES_FOR_X xcomposite"
1195     elif test x"$enable_xcomposite" = xyes; then
1196       AC_MSG_ERROR([Xcomposite support requested but xcomposite not found])
1197     fi
1198   fi
1199
1200   # Checks for Xdamage extension
1201
1202   if test x"$enable_xdamage" != xno; then
1203     if $PKG_CONFIG --exists xdamage ; then
1204       AC_DEFINE(HAVE_XDAMAGE, 1, [Have the XDAMAGE X extension])
1205
1206       X_PACKAGES="$X_PACKAGES xdamage"
1207       X_EXTENSIONS="$X_EXTENSIONS DAMAGE"
1208       GTK_PACKAGES_FOR_X="$GTK_PACKAGES_FOR_X xdamage"
1209     elif test x"$enable_xdamage" = xyes; then
1210       AC_MSG_ERROR([Xdamage support requested but xdamage not found])
1211     fi
1212   fi
1213
1214   if $have_base_x_pc ; then
1215     GDK_EXTRA_LIBS="$x_extra_libs"
1216   else
1217     GDK_EXTRA_LIBS="$X_LIBS $x_extra_libs -lXext -lX11 $GDK_EXTRA_LIBS"
1218   fi
1219
1220   CPPFLAGS="$gtk_save_cppflags"
1221   LIBS="$gtk_save_libs"
1222
1223   AM_CONDITIONAL(USE_X11, true)
1224
1225   # strip leading space
1226   X_EXTENSIONS=${X_EXTENSIONS#* }
1227
1228 else
1229   XPACKAGES=
1230
1231   AM_CONDITIONAL(USE_X11, false)
1232 fi
1233
1234 # Check for gio-unix
1235 if test "$have_gio_unix" = "yes"; then
1236   GDK_GIO_PACKAGE=gio-unix-2.0
1237   AC_DEFINE([HAVE_GIO_UNIX], [1],
1238             [Define if gio-unix is available])
1239 else
1240   GDK_GIO_PACKAGE=gio-2.0
1241 fi
1242 AM_CONDITIONAL(HAVE_GIO_UNIX, test "$have_gio_unix" = "yes")
1243
1244 # Check for Pango flags
1245
1246 AC_MSG_CHECKING(Pango flags)
1247 if $PKG_CONFIG --exists $PANGO_PACKAGES ; then
1248         PANGO_CFLAGS=`$PKG_CONFIG --cflags $PANGO_PACKAGES`
1249         PANGO_LIBS=`$PKG_CONFIG --libs $PANGO_PACKAGES`
1250
1251         AC_MSG_RESULT($PANGO_CFLAGS $PANGO_LIBS)
1252 else
1253         AC_MSG_ERROR([
1254 *** Pango not found. Pango built with Cairo support is required
1255 *** to build GTK+. See http://www.pango.org for Pango information.
1256 ])
1257 fi
1258
1259 CFLAGS="$CFLAGS $PANGO_CFLAGS"
1260
1261 if $PKG_CONFIG --uninstalled $PANGO_PACKAGES; then
1262         :
1263 else
1264         gtk_save_LIBS="$LIBS"
1265         LIBS="$PANGO_LIBS $LIBS"
1266         AC_TRY_LINK_FUNC(pango_context_new, :, AC_MSG_ERROR([
1267 *** Can't link to Pango. Pango is required to build
1268 *** GTK+. For more information see http://www.pango.org]))
1269         LIBS="$gtk_save_LIBS"
1270 fi
1271
1272 CFLAGS="$saved_cflags"
1273 LDFLAGS="$saved_ldflags"
1274
1275 GDK_PACKAGES="$PANGO_PACKAGES gdk-pixbuf-2.0 cairo cairo-gobject"
1276 GDK_PRIVATE_PACKAGES="$GDK_GIO_PACKAGE $X_PACKAGES $WAYLAND_PACKAGES $cairo_backends"
1277 if test "x$enable_x11_backend" = xyes; then
1278   GDK_PRIVATE_PACKAGES="$GDK_PRIVATE_PACKAGES pangoft2"
1279 fi
1280
1281 PKG_CHECK_MODULES(GDK_DEP, $GDK_PACKAGES $GDK_PRIVATE_PACKAGES)
1282 GDK_DEP_LIBS="$GDK_EXTRA_LIBS $GDK_DEP_LIBS $MATH_LIB"
1283 GDK_DEP_CFLAGS="$GDK_DEP_CFLAGS $GDK_EXTRA_CFLAGS"
1284 #
1285 # If we aren't writing explicit dependencies, then don't put the extra libraries we need
1286 # into the pkg-config files
1287 #
1288 if test $enable_explicit_deps != yes ; then
1289   GDK_EXTRA_LIBS=
1290 fi
1291
1292 AC_SUBST(GDK_PACKAGES)
1293 AC_SUBST(GDK_PRIVATE_PACKAGES)
1294 AC_SUBST(GDK_EXTRA_LIBS)
1295 AC_SUBST(GDK_EXTRA_CFLAGS)
1296 AC_SUBST(GDK_DEP_LIBS)
1297 AC_SUBST(GDK_DEP_CFLAGS)
1298
1299
1300 ########################################
1301 # Check for Accessibility Toolkit flags
1302 ########################################
1303
1304 if test x$enable_x11_backend = xyes; then
1305    ATK_PACKAGES="atk atk-bridge-2.0"
1306 else
1307    ATK_PACKAGES="atk"
1308 fi
1309
1310 PKG_CHECK_MODULES(ATK, $ATK_PACKAGES)
1311
1312 GTK_PACKAGES="atk cairo cairo-gobject gdk-pixbuf-2.0 gio-2.0"
1313 GTK_PRIVATE_PACKAGES="$ATK_PACKAGES"
1314 if test "x$enable_x11_backend" = xyes; then
1315   GTK_PRIVATE_PACKAGES="$GTK_PRIVATE_PACKAGES pangoft2"
1316 fi
1317 if test "$have_gio_unix" = "yes"; then
1318   GTK_PRIVATE_PACKAGES="$GTK_PRIVATE_PACKAGES gio-unix-2.0"
1319 fi
1320 GTK_EXTRA_LIBS=
1321
1322 GTK_EXTRA_CFLAGS=
1323 PKG_CHECK_MODULES(GTK_DEP, $PANGO_PACKAGES $GTK_PACKAGES_FOR_X $GTK_PACKAGES $GTK_PRIVATE_PACKAGES)
1324 GTK_DEP_LIBS="$GDK_EXTRA_LIBS $GTK_DEP_LIBS_FOR_X $GTK_DEP_LIBS $GTK_EXTRA_LIBS $MATH_LIB"
1325 GTK_DEP_CFLAGS="$GTK_DEP_CFLAGS $GDK_EXTRA_CFLAGS $GTK_EXTRA_CFLAGS"
1326
1327 if test x"$os_win32" = xyes; then
1328   GTK_EXTRA_CFLAGS="$msnative_struct"
1329 fi
1330
1331 GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`"
1332 ATK_PREFIX="`$PKG_CONFIG --variable=prefix atk`"
1333 PANGO_PREFIX="`$PKG_CONFIG --variable=prefix pango`"
1334 CAIRO_PREFIX="`$PKG_CONFIG --variable=prefix cairo`"
1335
1336 AC_SUBST(GTK_PACKAGES)
1337 AC_SUBST(GTK_PRIVATE_PACKAGES)
1338 AC_SUBST(GTK_EXTRA_LIBS)
1339 AC_SUBST(GTK_EXTRA_CFLAGS)
1340 AC_SUBST(GTK_DEP_LIBS)
1341 AC_SUBST(GTK_DEP_CFLAGS)
1342
1343 AC_SUBST(GLIB_PREFIX)
1344 AC_SUBST(ATK_PREFIX)
1345 AC_SUBST(PANGO_PREFIX)
1346 AC_SUBST(CAIRO_PREFIX)
1347
1348 AC_SUBST(GTK_DEBUG_FLAGS)
1349 AC_SUBST(GTK_XIM_FLAGS)
1350
1351 GDK_PIXBUF_LIBS=`$PKG_CONFIG --libs gdk-pixbuf-2.0`
1352 AC_SUBST(GDK_PIXBUF_LIBS)
1353
1354 ########################
1355 # Checks needed for gail
1356 ########################
1357
1358 old_LIBS="$LIBS"
1359 dnl Checks for inet libraries:
1360 AC_SEARCH_LIBS(gethostent, nsl)
1361 AC_SEARCH_LIBS(setsockopt, socket)
1362 AC_SEARCH_LIBS(connect, inet)
1363
1364 dnl check for the sockaddr_un.sun_len member
1365 AC_CHECK_MEMBER([struct sockaddr_un.sun_len],
1366                 [struct_sockaddr_un_sun_len=true],
1367                 [struct_sockaddr_un_suin_len=false],
1368                 [#include <sys/types.h>
1369                  #include <sys/un.h>]
1370                 )
1371 case $struct_sockaddr_un_sun_len in
1372         true)
1373                 AC_DEFINE_UNQUOTED(HAVE_SOCKADDR_UN_SUN_LEN, 1,
1374                                    [Have the sockaddr_un.sun_len member])
1375                 ;;
1376         *)
1377                 ;;
1378 esac
1379
1380 GAIL_INET_LIBS="$LIBS"
1381 AC_SUBST([GAIL_INET_LIBS])
1382
1383 LIBS="$old_LIBS"
1384
1385 ################################################################
1386 # Printing system checks
1387 ################################################################
1388
1389 PRINT_BACKENDS="file lpr"
1390
1391 AC_ARG_ENABLE(cups,
1392               [AS_HELP_STRING([--disable-cups],
1393                               [disable cups print backend])],,
1394               [enable_cups=auto])
1395
1396 if test "x$enable_cups" = "xno"; then
1397   AM_CONDITIONAL(HAVE_CUPS, false)
1398 else
1399   AC_PATH_PROG(CUPS_CONFIG, cups-config, no)
1400   if test "x$CUPS_CONFIG" = "xno"; then
1401     if test "x$enable_cups" = "xauto"; then
1402       AM_CONDITIONAL(HAVE_CUPS, false)
1403     else
1404       AC_MSG_ERROR([
1405 *** cups not found.
1406 ])
1407     fi
1408   else
1409     CUPS_CFLAGS=`$CUPS_CONFIG --cflags | sed 's/-O[0-9]*//' | sed 's/-m[^\t]*//g'`
1410     CUPS_LIBS=`$CUPS_CONFIG --libs`
1411
1412     CUPS_API_VERSION=`$CUPS_CONFIG --api-version`
1413     CUPS_API_MAJOR=`echo $ECHO_N $CUPS_API_VERSION | awk -F. '{print $1}'`
1414     CUPS_API_MINOR=`echo $ECHO_N $CUPS_API_VERSION | awk -F. '{print $2}'`
1415
1416     if test $CUPS_API_MAJOR -gt 1 -o \
1417             $CUPS_API_MAJOR -eq 1 -a $CUPS_API_MINOR -lt 2; then
1418       AC_MSG_ERROR([CUPS >= 1.2 not found])
1419     fi
1420     if test $CUPS_API_MAJOR -gt 1 -o \
1421             $CUPS_API_MAJOR -eq 1 -a $CUPS_API_MINOR -ge 6; then
1422       AC_DEFINE(HAVE_CUPS_API_1_6, 1,
1423                 [Define to 1 if CUPS 1.6 API is available])
1424
1425     fi
1426
1427     AC_SUBST(CUPS_API_MAJOR)
1428     AC_SUBST(CUPS_API_MINOR)
1429     AC_SUBST(CUPS_CFLAGS)
1430     AC_SUBST(CUPS_LIBS)
1431
1432     AC_CHECK_HEADER(cups/cups.h,,AC_MSG_ERROR([[*** Sorry, cups-config present but cups/cups.h missing.]]))
1433
1434     PRINT_BACKENDS="$PRINT_BACKENDS cups"
1435     AM_CONDITIONAL(HAVE_CUPS, true)
1436
1437     gtk_save_cflags="$CFLAGS"
1438     CFLAGS="$CUPS_CFLAGS"
1439     AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <cups/http.h>]],
1440                                        [[http_t http; char *s = http.authstring;]])],
1441                       [AC_DEFINE([HAVE_HTTP_AUTHSTRING], [],
1442                                  [Define if cups http_t authstring field is accessible])],
1443                       [])
1444     CFLAGS="$gtk_save_cflags"
1445
1446     AC_SUBST(HAVE_HTTP_AUTHSTRING)
1447
1448     gtk_save_libs="$LIBS"
1449     LIBS="$CUPS_LIBS"
1450     AC_CHECK_FUNCS(httpGetAuthString)
1451     LIBS="$gtk_save_libs"
1452   fi
1453 fi
1454
1455 # Checks to see if we should compile with PAPI backend for GTK+
1456 #
1457
1458 AC_ARG_ENABLE(papi,
1459               [AS_HELP_STRING([--disable-papi],
1460                               [disable papi print backend])],,
1461               [enable_papi=auto])
1462
1463 if test "x$enable_papi" = "xno"; then
1464   AM_CONDITIONAL(HAVE_PAPI, false)
1465 else
1466   AC_MSG_CHECKING(libpapi)
1467   AC_CHECK_LIB(papi, papiServiceCreate, have_papi=yes, have_papi=no)
1468   if test $have_papi = yes; then
1469     PRINT_BACKENDS="$PRINT_BACKENDS papi"
1470     AC_DEFINE([HAVE_PAPI], [], [Define to 1 if libpapi available])
1471   fi
1472   AM_CONDITIONAL(HAVE_PAPI, test $have_papi = yes)
1473   if test "x$enable_papi" = "xyes" -a "x$have_papi" = "xno"; then
1474     AC_MSG_ERROR([
1475 *** papi not found.
1476 ])
1477   fi
1478 fi
1479
1480 AM_CONDITIONAL(HAVE_PAPI_CUPS, test "x$have_papi" = "xyes" -a "x$CUPS_CONFIG" != "xno")
1481
1482 gtk_save_cppflags="$CPPFLAGS"
1483 CPPFLAGS="$CPPFLAGS $GTK_DEP_CFLAGS $GDK_DEP_CFLAGS"
1484
1485 AC_CHECK_HEADER(cairo-pdf.h,,AC_MSG_ERROR([
1486 *** Can't find cairo-pdf.h. You must build Cairo with the pdf
1487 *** backend enabled.]))
1488
1489 if test "$os_win32" != "yes"; then
1490   AC_CHECK_HEADER(cairo-ps.h,,AC_MSG_ERROR([
1491 *** Can't find cairo-ps.h. You must build Cairo with the
1492 *** postscript backend enabled.]))
1493
1494   AC_CHECK_HEADER(cairo-svg.h,,AC_MSG_ERROR([
1495 *** Cannot find cairo-svg.h. You must build Cairo with the
1496 *** svg backend enabled.]))
1497 fi
1498
1499 CPPFLAGS="$gtk_save_cppflags"
1500
1501
1502 AC_ARG_ENABLE(test-print-backend,
1503               [AS_HELP_STRING([--enable-test-print-backend],
1504                               [build test print backend])],,
1505               [enable_test_print_backend=no])
1506 if test "x$enable_test_print_backend" != "xno" ; then
1507   PRINT_BACKENDS="$PRINT_BACKENDS test"
1508 fi
1509 AM_CONDITIONAL(TEST_PRINT_BACKEND, test "x$enable_test_print_backend" != "xno")
1510
1511 if test "$os_win32" = "yes"; then
1512   AC_CHECK_TYPES([IPrintDialogCallback],[],[],[[#include <windows.h>]])
1513 fi
1514
1515 ################################################################
1516 # Strip -export-dynamic from the link lines of various libraries
1517 ################################################################
1518
1519 #
1520 # pkg-config --libs gmodule includes the "export_dynamic" flag,
1521 #  but this flag is only meaningful for executables. For libraries
1522 #  the effect is undefined; what it causes on Linux is that the
1523 #  export list from -export-symbols-regex is ignored and everything
1524 #  is exported
1525 #
1526 # We are using gmodule-no-export now, but I'm leaving the stripping
1527 # code in place for now, since pango and atk still require gmodule.
1528 export SED
1529 export_dynamic=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh`
1530 if test -n "$export_dynamic"; then
1531   GDK_DEP_LIBS=`echo $GDK_DEP_LIBS | sed -e "s/$export_dynamic//"`
1532   GTK_DEP_LIBS=`echo $GTK_DEP_LIBS | sed -e "s/$export_dynamic//"`
1533 fi
1534
1535 #############
1536 # GSettings #
1537 #############
1538
1539 GLIB_GSETTINGS
1540
1541 ##################################################
1542 # GObject introspection
1543 ##################################################
1544
1545 GOBJECT_INTROSPECTION_CHECK(introspection_required_version)
1546
1547 ##################################################
1548 # Packagekit module
1549 #################################################
1550
1551 AC_ARG_ENABLE(packagekit,
1552               [AS_HELP_STRING([--enable-packagekit=@<:@yes/no/auto@:>@],
1553                               [build PackageKit open-with module [default=auto]])],
1554               [enable_packagekit="$enableval"],
1555               [enable_packagekit=auto])
1556 if test "$enable_packagekit" = "auto"; then
1557   if test "$os_win32" = "yes"; then
1558     enable_packagekit=no
1559   else
1560     enable_packagekit=yes
1561   fi
1562 fi
1563
1564 AC_MSG_CHECKING([whether to use PackageKit])
1565 build_packagekit=no
1566 if test "x$enable_packagekit" != "xno"; then
1567   if test "$os_win32" != "yes"; then
1568     build_packagekit=yes
1569     AC_DEFINE(ENABLE_PACKAGEKIT, 1, [define to enable packagekit])
1570   else
1571     AC_MSG_ERROR([packagekit support is not available on win32])
1572   fi
1573 fi
1574 AC_MSG_RESULT([$build_packagekit])
1575
1576 AM_CONDITIONAL(ENABLE_PACKAGEKIT, test "x$build_packagekit" = "xyes")
1577
1578 ##################################################
1579 # colord module
1580 #################################################
1581
1582 AC_ARG_ENABLE(colord,
1583               [AS_HELP_STRING([--enable-colord=@<:@yes/no/auto@:>@],
1584                               [build colord support code [default=auto]])],
1585               [enable_colord="$enableval"],
1586               [enable_colord=auto])
1587
1588 AC_MSG_CHECKING([whether to use colord])
1589 if test "$enable_colord" = "auto"; then
1590   if test "$os_win32" = "yes"; then
1591     enable_colord=no
1592   fi
1593 fi
1594 if test "$enable_colord" != "no"; then
1595   AC_MSG_RESULT([yes])
1596 else
1597   AC_MSG_RESULT([no])
1598 fi
1599
1600 have_colord=no
1601 if test "$enable_colord" != "no"; then
1602         if test "$os_win32" != "yes"; then
1603                 PKG_CHECK_MODULES(COLORD, colord >= 0.1.9,
1604                                   have_colord=yes, have_colord=no)
1605                 if test "$enable_colord" = "yes"; then
1606                         if test "$have_colord" = "no"; then
1607                                 AC_MSG_ERROR([--enable-colord specified, but not available])
1608                         fi
1609                 fi
1610         else
1611                 AC_MSG_ERROR([colord support is not available on win32])
1612         fi
1613 fi
1614
1615 if test "$have_colord" = "yes"; then
1616         AC_DEFINE(HAVE_COLORD, 1, [define if we have colord])
1617 fi
1618 AM_CONDITIONAL(HAVE_COLORD, test "x$have_colord" = "xyes")
1619
1620 ##################################################
1621 # Checks for gtk-doc and docbook-tools
1622 ##################################################
1623
1624 GTK_DOC_CHECK([1.11],[--flavour no-tmpl])
1625
1626 AC_ARG_ENABLE(man,
1627               [AS_HELP_STRING([--enable-man],
1628                               [generate man pages [default=auto]])],,
1629               enable_man=maybe)
1630
1631 if test "$enable_man" != no; then
1632   AC_PATH_PROG([XSLTPROC], [xsltproc])
1633   if test -z "$XSLTPROC"; then
1634     if test "$enable_man" = yes ; then
1635       AC_MSG_ERROR([xsltproc is required for --enable-man])
1636     fi
1637     enable_man=no
1638   fi
1639 fi
1640
1641 if test "$enable_man" != no; then
1642   dnl check for DocBook DTD in the local catalog
1643   JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.1.2//EN],
1644      [DocBook XML DTD V4.1.2], [have_docbook_dtd=yes], [have_docbook_dtd=no])
1645   if test "$have_docbook_dtd" != yes; then
1646     if test "$enable_man" = yes ; then
1647       AC_MSG_ERROR([DocBook DTD is required for --enable-man])
1648     fi
1649     enable_man=no
1650   fi
1651 fi
1652
1653 if test "$enable_man" != no; then
1654   dnl check for DocBook XSL stylesheets in the local catalog
1655   JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl],
1656      [DocBook XSL Stylesheets], [have_docbook_style=yes],[have_docbook_style=no])
1657   if test "$have_docbook_dtd" != yes; then
1658     if test "$enable_man" = yes ; then
1659       AC_MSG_ERROR([DocBook XSL Stylesheets are required for --enable-man])
1660     fi
1661     enable_man=no
1662   fi
1663 fi
1664
1665 AM_CONDITIONAL(ENABLE_MAN, test "$enable_man" != no)
1666
1667 AC_MSG_CHECKING([whether to generate man pages])
1668 if test "$enable_man" != no; then
1669   AC_MSG_RESULT([yes])
1670 else
1671   AC_MSG_RESULT([no])
1672 fi
1673
1674 ##################################################
1675 # Output commands
1676 ##################################################
1677
1678 AC_CONFIG_COMMANDS([gdk/gdkconfig.h], [
1679         outfile=gdkconfig.h-tmp
1680         cat > $outfile <<\_______EOF
1681 /* gdkconfig.h
1682  *
1683  * This is a generated file.  Please modify `configure.ac'
1684  */
1685
1686 #ifndef __GDKCONFIG_H__
1687 #define __GDKCONFIG_H__
1688
1689 #if !defined (__GDK_H_INSIDE__) && !defined (GDK_COMPILATION)
1690 #error "Only <gdk/gdk.h> can be included directly."
1691 #endif
1692
1693 #include <glib.h>
1694
1695 G_BEGIN_DECLS
1696
1697 _______EOF
1698
1699         cat >>$outfile <<_______EOF
1700 $gdk_windowing
1701 _______EOF
1702
1703         cat >>$outfile <<_______EOF
1704
1705 G_END_DECLS
1706
1707 #endif  /* __GDKCONFIG_H__ */
1708 _______EOF
1709
1710
1711         if cmp -s $outfile gdk/gdkconfig.h; then
1712           AC_MSG_NOTICE([gdk/gdkconfig.h is unchanged])
1713           rm -f $outfile
1714         else
1715           mv $outfile gdk/gdkconfig.h
1716         fi
1717 ],[
1718 gdk_windowing='$GDK_WINDOWING'
1719 ])
1720
1721 dnl
1722 dnl Check for -Bsymbolic-functions linker flag used to avoid
1723 dnl intra-library PLT jumps, if available.
1724 dnl
1725 AC_ARG_ENABLE(Bsymbolic,
1726               [AS_HELP_STRING([--disable-Bsymbolic],
1727                               [avoid linking with -Bsymbolic])],,
1728               [SAVED_LDFLAGS="${LDFLAGS}"
1729                AC_MSG_CHECKING([for -Bsymbolic-functions linker flag])
1730                LDFLAGS=-Wl,-Bsymbolic-functions
1731                AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],
1732                                                [[int main (void) { return 0; }]])],
1733                               [AC_MSG_RESULT(yes)
1734                                enable_Bsymbolic=yes],
1735                               [AC_MSG_RESULT(no)
1736                                enable_Bsymbolic=no])
1737                LDFLAGS="${SAVED_LDFLAGS}"])
1738
1739 if test "x${enable_Bsymbolic}" = "xyes" ; then
1740   GTK_LINK_FLAGS=-Wl,-Bsymbolic-functions
1741 fi
1742 AC_SUBST(GTK_LINK_FLAGS)
1743
1744 AC_CONFIG_FILES([
1745 config.h.win32
1746 gtk-zip.sh
1747 Makefile
1748 gdk-3.0.pc
1749 gtk+-3.0.pc
1750 gtk+-unix-print-3.0.pc
1751 gail-3.0.pc
1752 m4macros/Makefile
1753 po/Makefile.in
1754 po-properties/Makefile.in
1755 demos/Makefile
1756 demos/gtk-demo/Makefile
1757 demos/gtk-demo/geninclude.pl
1758 demos/pixbuf-demo/Makefile
1759 demos/widget-factory/Makefile
1760 examples/Makefile
1761 tests/Makefile
1762 tests/a11y/Makefile
1763 tests/css/Makefile
1764 tests/css/parser/Makefile
1765 tests/reftests/Makefile
1766 tests/visuals/Makefile
1767 docs/Makefile
1768 docs/reference/Makefile
1769 docs/reference/gdk/Makefile
1770 docs/reference/gdk/version.xml
1771 docs/reference/gtk/Makefile
1772 docs/reference/gtk/gtk3.types
1773 docs/reference/gtk/version.xml
1774 docs/reference/libgail-util/Makefile
1775 docs/reference/libgail-util/version.xml
1776 docs/tools/Makefile
1777 build/Makefile
1778 build/win32/Makefile
1779 build/win32/vs9/Makefile
1780 build/win32/vs10/Makefile
1781 gdk/Makefile
1782 gdk/broadway/Makefile
1783 gdk/x11/Makefile
1784 gdk/win32/Makefile
1785 gdk/win32/rc/Makefile
1786 gdk/win32/rc/gdk.rc
1787 gdk/quartz/Makefile
1788 gdk/wayland/Makefile
1789 gdk/tests/Makefile
1790 gdk/gdkversionmacros.h
1791 gtk/Makefile
1792 gtk/makefile.msc
1793 gtk/gtkversion.h
1794 gtk/gtk-win32.rc
1795 gtk/a11y/Makefile
1796 gtk/native/Makefile
1797 gtk/tests/Makefile
1798 libgail-util/Makefile
1799 modules/Makefile
1800 modules/engines/Makefile
1801 modules/engines/pixbuf/Makefile
1802 modules/input/Makefile
1803 modules/printbackends/Makefile
1804 modules/printbackends/cups/Makefile
1805 modules/printbackends/lpr/Makefile
1806 modules/printbackends/file/Makefile
1807 modules/printbackends/papi/Makefile
1808 modules/printbackends/test/Makefile
1809 perf/Makefile
1810 ])
1811
1812 AC_OUTPUT
1813
1814 # beautify the immodule list a bit
1815 included_immodules=$(echo "${included_immodules}" | $SED 's/,/ /g')
1816 if test -z "${included_immodules}"; then included_immodules="none"; fi
1817
1818 echo ""
1819 echo "        GTK+ $GTK_VERSION"
1820 echo "        ==========="
1821 echo ""
1822 echo "        GDK backends:         $GDK_BACKENDS"
1823 if test "$enable_x11_backend" = "yes"; then
1824 echo "        X11 extensions:       $X_EXTENSIONS"
1825 fi
1826 echo "        Print backends:       $PRINT_BACKENDS"
1827 echo "        Dynamic modules:      $build_dynamic_modules"
1828 echo "        Included immodules:   $included_immodules"
1829 echo "        PackageKit support:   $build_packagekit"
1830 echo "        colord support:       $have_colord"
1831 echo "        Introspection:        $found_introspection"
1832 echo "        Debugging:            $enable_debug"
1833 echo "        Documentation:        $enable_gtk_doc"