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