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