]> Pileus Git - ~andy/gtk/blob - configure.in
Requires glib-2.3.0, pango-1.2.0.
[~andy/gtk] / configure.in
1 # Process this file with autoconf to produce a configure script.
2 # require autoconf 2.54
3 AC_PREREQ(2.54)
4
5 # Making releases:
6 #   GTK_MICRO_VERSION += 1;
7 #   GTK_INTERFACE_AGE += 1;
8 #   GTK_BINARY_AGE += 1;
9 # if any functions have been added, set GTK_INTERFACE_AGE to 0.
10 # if backwards compatibility has been broken,
11 # set GTK_BINARY_AGE and GTK_INTERFACE_AGE to 0.
12
13 m4_define([gtk_major_version], [2])
14 m4_define([gtk_minor_version], [3])
15 m4_define([gtk_micro_version], [0])
16 m4_define([gtk_version],
17           [gtk_major_version.gtk_minor_version.gtk_micro_version])
18 m4_define([gtk_interface_age], [0])
19 m4_define([gtk_binary_age], [300])
20 # This is the X.Y used in -lgtk-FOO-X.Y
21 m4_define([gtk_api_version], [2.0])
22
23 # Define a string for the earliest version that this release has
24 # forward/backwards binary compatibility with. This is used for module
25 # locations. (Should this be backwards-compat instead?)
26 #
27 #GTK_BINARY_VERSION=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION.$LT_CURRENT
28 m4_define([gtk_binary_version], [2.2.0])
29
30 # required versions of other packages
31 m4_define([glib_required_version], [2.3.0])
32 m4_define([pango_required_version], [1.2.0])
33 m4_define([atk_required_version], [1.0.1])
34
35
36 AC_INIT([gtk+], [gtk_version],
37         [http://bugzilla.gnome.org/enter_bug.cgi?product=gtk+],
38         [gtk+])
39
40 AC_CONFIG_SRCDIR([gdk/gdktypes.h])
41
42 # Save this value here, since automake will set cflags later
43 cflags_set=${CFLAGS+set}
44
45 AM_INIT_AUTOMAKE(no-define)
46 AM_CONFIG_HEADER(config.h)
47
48 #
49 # For each of the libraries we build, we define the following
50 # substituted variables:
51 #
52 # foo_PACKAGES:     pkg-config packages this library requires
53 # foo_EXTRA_LIBS:   Libraries this module requires not pulled in by pkg-config
54 # foo_EXTRA_CFLAGS: cflags this module requires not pulled in by pkg-config
55 # foo_DEP_LIBS:     All libraries this module requires
56 # foo_DEP_CFLAGS:   All cflags this module requires
57
58
59 GTK_MAJOR_VERSION=gtk_major_version
60 GTK_MINOR_VERSION=gtk_minor_version
61 GTK_MICRO_VERSION=gtk_micro_version
62 GTK_INTERFACE_AGE=gtk_interface_age
63 GTK_BINARY_AGE=gtk_binary_age
64 GTK_VERSION=gtk_version
65 GTK_API_VERSION=gtk_api_version
66 GTK_BINARY_VERSION=gtk_binary_version
67 AC_SUBST(GTK_MAJOR_VERSION)
68 AC_SUBST(GTK_MINOR_VERSION)
69 AC_SUBST(GTK_MICRO_VERSION)
70 AC_SUBST(GTK_INTERFACE_AGE)
71 AC_SUBST(GTK_BINARY_AGE)
72 AC_SUBST(GTK_API_VERSION)
73 AC_SUBST(GTK_VERSION)
74 AC_SUBST(GTK_BINARY_VERSION)
75
76 # libtool versioning
77 #LT_RELEASE=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION
78 #LT_CURRENT=`expr $GTK_MICRO_VERSION - $GTK_INTERFACE_AGE`
79 #LT_REVISION=$GTK_INTERFACE_AGE
80 #LT_AGE=`expr $GTK_BINARY_AGE - $GTK_INTERFACE_AGE`
81 #LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
82
83 m4_define([lt_current], [m4_eval(100 * gtk_minor_version + gtk_micro_version - gtk_interface_age)])
84 m4_define([lt_revision], [gtk_interface_age])
85 m4_define([lt_age], [m4_eval(gtk_binary_age - gtk_interface_age)])
86 LT_VERSION_INFO="lt_current:lt_revision:lt_age"
87 LT_CURRENT_MINUS_AGE=m4_eval(lt_current - lt_age)
88 AC_SUBST(LT_VERSION_INFO)
89 AC_SUBST(LT_CURRENT_MINUS_AGE)
90
91
92 #
93 # gdk-pixbuf gets versioned separately, and for now, using standard
94 # libtool versioning, not GTK+-style versioning
95 #
96 GDK_PIXBUF_MAJOR=gtk_major_version
97 GDK_PIXBUF_MINOR=gtk_minor_version
98 GDK_PIXBUF_MICRO=gtk_micro_version
99 GDK_PIXBUF_VERSION="${GDK_PIXBUF_MAJOR}.${GDK_PIXBUF_MINOR}.${GDK_PIXBUF_MICRO}"
100 AC_SUBST(GDK_PIXBUF_MAJOR)
101 AC_SUBST(GDK_PIXBUF_MINOR)
102 AC_SUBST(GDK_PIXBUF_MICRO)
103 AC_SUBST(GDK_PIXBUF_VERSION)
104
105 GETTEXT_PACKAGE=gtk20
106 AC_SUBST(GETTEXT_PACKAGE)
107 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE")
108
109
110 dnl Initialize libtool
111 AC_PROG_CC
112 AM_DISABLE_STATIC
113 AC_LIBTOOL_WIN32_DLL
114 AM_PROG_LIBTOOL
115
116 AM_PROG_AS
117
118 dnl Initialize maintainer mode
119 AM_MAINTAINER_MODE
120
121 AC_CANONICAL_HOST
122
123 AC_MSG_CHECKING([for some Win32 platform])
124 case "$host" in
125   *-*-mingw*|*-*-cygwin*)
126     platform_win32=yes
127     ;;
128   *)
129     platform_win32=no
130     ;;
131 esac
132 AC_MSG_RESULT([$platform_win32])
133 AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")
134
135 MATH_LIB=-lm
136 AC_MSG_CHECKING([for native Win32])
137 case "$host" in
138   *-*-mingw*)
139     os_win32=yes
140     MATH_LIB=
141     ;;
142   *)
143     os_win32=no
144     ;;
145 esac
146 AC_MSG_RESULT([$os_win32])
147 AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
148
149 if test "$os_win32" = "yes"; then
150   AC_CHECK_PROG(ms_librarian, lib.exe, yes, no)
151 fi
152 AM_CONDITIONAL(MS_LIB_AVAILABLE, test x$ms_librarian = xyes)
153
154 m4_define([debug_default],
155           m4_if(m4_eval(gtk_minor_version % 2), [1], [yes], [minimum]))
156
157 dnl declare --enable-* args and collect ac_help strings
158 AC_ARG_ENABLE(debug,
159               AC_HELP_STRING([--enable-debug=@<:@no/minimum/yes@:>@],
160                              [turn on debugging @<:@default=debug_default@:>@]),,
161               enable_debug=debug_default)
162 AC_ARG_ENABLE(shm,
163               [AC_HELP_STRING([--enable-shm],
164                               [support shared memory if available [default=yes]])],,
165               [enable_shm="yes"])
166 AC_ARG_ENABLE(ansi,
167               [AC_HELP_STRING([--enable-ansi],
168                               [turn on strict ansi [default=no]])],,
169               [enable_ansi=no])
170 AC_ARG_ENABLE(xkb,
171               [AC_HELP_STRING([--enable-xkb],
172                               [support XKB [default=maybe]])],,
173               [enable_xkb="maybe"])
174 AC_ARG_ENABLE(rebuilds,
175               [AC_HELP_STRING([--disable-rebuilds],
176                               [disable all source autogeneration rules])],,
177               [enable_rebuilds=yes])
178
179 AC_ARG_WITH(xinput,
180             [AC_HELP_STRING([--with-xinput=@<:@no/yes@:>@], [support XInput])])
181
182 AC_ARG_WITH(wintab,
183             [AC_HELP_STRING([--with-wintab=DIRECTORY],
184                             [use Wintab API with win32 backend])])
185 AC_ARG_WITH(ie55,
186             [AC_HELP_STRING([--with-ie55=DIRECTORY],
187                             [IE5.5 libs and headers (for Active IMM)])])
188
189 GLIB_AC_DIVERT_BEFORE_HELP([
190 if test "$platform_win32" = yes; then
191   gdktarget=win32
192 else
193   gdktarget=x11
194 fi
195 ])
196
197 AC_ARG_WITH(gdktarget, [  --with-gdktarget=[[x11/linux-fb/win32]] select GDK target [default=$gdktarget]],
198         gdktarget=$with_gdktarget)
199
200 AC_SUBST(gdktarget)
201 case $gdktarget in
202   x11|linux-fb|win32) ;;
203   *) AC_MSG_ERROR([Invalid target for GDK: use x11, linux-fb or win32.]);;
204 esac
205
206 gdktargetlib=libgdk-$gdktarget-$GTK_API_VERSION.la
207 gtktargetlib=libgtk-$gdktarget-$GTK_API_VERSION.la
208
209 AC_SUBST(gdktargetlib)
210 AC_SUBST(gtktargetlib)
211
212 AC_ARG_ENABLE(shadowfb,
213               [AC_HELP_STRING([--disable-shadowfb],
214                               [disable shadowfb support for linux-fb])],,
215               [enable_shadowfb=yes])
216
217 AC_ARG_ENABLE(fbmanager,
218               [AC_HELP_STRING([--enable-fbmanager],
219                               [enable framebuffer manager support (GtkFB)])],,
220               enable_fbmanager=no)
221         
222 if test "x$enable_debug" = "xyes"; then
223   test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
224   GTK_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
225 else
226   if test "x$enable_debug" = "xno"; then
227     GTK_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS"
228   else
229     GTK_DEBUG_FLAGS="-DG_DISABLE_CAST_CHECKS"
230   fi
231 fi
232
233 AC_DEFINE_UNQUOTED(GTK_COMPILED_WITH_DEBUGGING, "${enable_debug}")
234
235                         
236 # Build time sanity check...
237 AM_SANITY_CHECK
238
239 # Checks for programs.
240 AC_ISC_POSIX
241 AM_PROG_CC_STDC
242 AC_PROG_INSTALL
243 AC_PROG_MAKE_SET
244
245 changequote(,)dnl
246 if test "x$GCC" = "xyes"; then
247   case " $CFLAGS " in
248   *[\ \ ]-Wall[\ \      ]*) ;;
249   *) CFLAGS="$CFLAGS -Wall" ;;
250   esac
251
252   if test "x$enable_ansi" = "xyes"; then
253     case " $CFLAGS " in
254     *[\ \       ]-ansi[\ \      ]*) ;;
255     *) CFLAGS="$CFLAGS -ansi" ;;
256     esac
257
258     case " $CFLAGS " in
259     *[\ \       ]-pedantic[\ \  ]*) ;;
260     *) CFLAGS="$CFLAGS -pedantic" ;;
261     esac
262   fi
263 fi
264 changequote([,])dnl
265
266 # Ensure MSVC-compatible struct packing convention is used when
267 # compiling for Win32 with gcc.
268 # What flag to depends on gcc version: gcc3 uses "-mms-bitfields", while
269 # gcc2 uses "-fnative-struct".
270 if test x"$os_win32" = xyes; then
271   if test x"$GCC" = xyes; then
272     msnative_struct=''
273     AC_MSG_CHECKING([how to get MSVC-compatible struct packing])
274     if test -z "$ac_cv_prog_CC"; then
275       our_gcc="$CC"
276     else
277       our_gcc="$ac_cv_prog_CC"
278     fi
279     case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in
280       2.)
281         if $our_gcc -v --help 2>/dev/null | grep fnative-struct >/dev/null; then
282           msnative_struct='-fnative-struct'
283         fi
284         ;;
285       *)
286         if $our_gcc -v --help 2>/dev/null | grep ms-bitfields >/dev/null; then
287           msnative_struct='-mms-bitfields'
288         fi
289         ;;
290     esac
291     if test x"$msnative_struct" = x ; then
292       AC_MSG_RESULT([no way])
293       AC_MSG_WARN([produced libraries might be incompatible with MSVC-compiled code])
294     else
295       CFLAGS="$CFLAGS $msnative_struct"
296       AC_MSG_RESULT([${msnative_struct}])
297     fi
298   fi
299 fi
300
301 # Honor aclocal flags
302 ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
303
304 ## Initial sanity check, done here so that users get told they 
305 ## have the wrong dependencies as early in the process as possible.
306 ## Later on we actually use the cflags/libs from separate pkg-config
307 ## calls. Oh, also the later pkg-config calls don't include 
308 ## the version requirements since those make the module lists 
309 ## annoying to construct
310 PKG_CHECK_MODULES(BASE_DEPENDENCIES,
311   [glib-2.0 >= glib_required_version dnl
312    atk >= atk_required_version dnl
313    pango >= pango_required_version])
314
315 if test "$os_win32" != yes; then
316     # libtool option to control which symbols are exported
317     # right now, symbols starting with _ are not exported
318     LIBTOOL_EXPORT_OPTIONS='-export-symbols-regex "^[[^_]].*"'
319 else
320     # We currently use .def files on Windows (for gdk-pixbuf, gdk and gtk)
321     LIBTOOL_EXPORT_OPTIONS=
322 fi
323 AC_SUBST(LIBTOOL_EXPORT_OPTIONS)
324
325 dnl ******************************************************
326 dnl * See whether to include shared library dependencies *
327 dnl ******************************************************
328
329 AC_ARG_ENABLE(explicit-deps, 
330               [AC_HELP_STRING([--enable-explicit-deps=@<:@yes/no/auto@:>@],
331                               [use explicit dependencies in .pc files [default=auto]])],,
332               [enable_explicit_deps=auto])
333
334 AC_MSG_CHECKING([Whether to write dependencies into .pc files])
335 case $enable_explicit_deps in
336   auto)
337     deplib_check_method=`(./libtool --config; echo eval echo \\$deplib_check_method) | sh`
338     if test "X$deplib_check_method" = Xnone || test "x$enable_static" = xyes ; then
339       enable_explicit_deps=yes  
340     else
341       enable_explicit_deps=no  
342     fi
343   ;;
344   yes|no) 
345   ;;
346   *) AC_MSG_ERROR([Value given to --enable-explicit-deps must be one of yes, no or auto])
347   ;;
348 esac
349 AC_MSG_RESULT($enable_explicit_deps)
350
351 AM_CONDITIONAL(DISABLE_EXPLICIT_DEPS, test $enable_explicit_deps = no)
352
353 # define a MAINT-like variable REBUILD which is set if Perl
354 # and awk are found, so autogenerated sources can be rebuilt
355
356 AC_PATH_PROGS(PERL, perl5 perl)
357
358 # We would like indent, but don't require it.
359 AC_CHECK_PROG(INDENT, indent, indent)
360
361 REBUILD=\#
362 if test "x$enable_rebuilds" = "xyes" && \
363      test -n "$PERL" && \
364      $PERL -e 'exit !($] >= 5.002)' > /dev/null 2>&1 ; then
365   REBUILD=
366 fi
367 AC_SUBST(REBUILD)
368
369 AC_CHECK_FUNCS(lstat mkstemp flockfile)
370
371 # sigsetjmp is a macro on some platforms, so AC_CHECK_FUNCS is not reliable
372 AC_MSG_CHECKING(for sigsetjmp)
373 AC_TRY_LINK([#include <setjmp.h>], [
374 sigjmp_buf env;
375 sigsetjmp(env, 0);
376 ], gtk_ok=yes, gtk_ok=no)
377 AC_MSG_RESULT($gtk_ok)
378 if test "$gtk_ok" = "yes"; then
379   AC_DEFINE(HAVE_SIGSETJMP)
380 fi
381
382 AC_MSG_CHECKING(whether make is GNU Make)
383 STRIP_BEGIN=
384 STRIP_END=
385 if $ac_make --version 2>/dev/null | grep '^GNU Make ' >/dev/null ; then
386         STRIP_BEGIN='$(strip $(STRIP_DUMMY)'
387         STRIP_END=')'
388         AC_MSG_RESULT(yes)
389 else
390         AC_MSG_RESULT(no)
391 fi
392 STRIP_DUMMY=
393 AC_SUBST(STRIP_DUMMY)
394 AC_SUBST(STRIP_BEGIN)
395 AC_SUBST(STRIP_END)
396
397 # i18n stuff
398 ALL_LINGUAS="am ar az be bg ca cs cy da de el en_GB es et eu fa fi fr ga gl he hi hr hu ia id it ja ko li lt lv mk ml mn ms nl nn no pl pt pt_BR ro ru sk sl sr sr@Latn sv ta tr uk vi wa yi zh_CN zh_TW"
399 AM_GLIB_GNU_GETTEXT
400 LIBS="$LIBS $INTLLIBS"
401
402 AM_GLIB_DEFINE_LOCALEDIR(GTK_LOCALEDIR)
403
404 dnl The DU4 header files don't provide library prototypes unless 
405 dnl -std1 is given to the native cc.
406 AC_MSG_CHECKING([for extra flags to get ANSI library prototypes])
407
408 gtk_save_LIBS=$LIBS
409 LIBS="$LIBS -lm"
410 AC_TRY_RUN([#include <math.h>
411              int main (void) { return (log(1) != log(1.)); }],
412      AC_MSG_RESULT(none needed),
413      gtk_save_CFLAGS="$CFLAGS"
414      CFLAGS="$CFLAGS -std1"
415      AC_TRY_RUN([#include <math.h>
416                  int main (void) { return (log(1) != log(1.)); }],
417          AC_MSG_RESULT(-std1),
418          AC_MSG_RESULT()
419          CFLAGS="$gtk_save_CFLAGS"
420          AC_MSG_WARN(
421                 [No ANSI prototypes found in library. (-std1 didn't work.)]),
422          true
423      ),
424      AC_MSG_RESULT(none needed)
425 )
426 LIBS=$gtk_save_LIBS
427
428 AC_MSG_CHECKING(for the BeOS)
429 case $host in
430   *-*-beos*)
431     AC_MSG_RESULT(yes)
432     MATH_LIB=
433   ;;
434   *)
435     AC_MSG_RESULT(no)
436   ;;
437 esac
438
439 dnl NeXTStep cc seems to need this
440 AC_MSG_CHECKING([for extra flags for POSIX compliance])
441 AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
442   AC_MSG_RESULT(none needed),
443   gtk_save_CFLAGS="$CFLAGS"
444   CFLAGS="$CFLAGS -posix"
445   AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
446     AC_MSG_RESULT(-posix),
447     AC_MSG_RESULT()
448     CFLAGS="$gtk_save_CFLAGS"
449     AC_MSG_WARN([Could not determine POSIX flag. (-posix didn't work.)])))
450
451 #
452 # Run AM_PATH_GLIB_2_0 to make sure that GLib is installed and working
453
454
455 GLIB_PACKAGES="gobject-2.0 gmodule-2.0"
456
457 AM_PATH_GLIB_2_0(glib_required_version, :,
458   AC_MSG_ERROR([
459 *** GLIB glib_required_version or better is required. The latest version of 
460 *** GLIB is always available from ftp://ftp.gtk.org/pub/gtk/.]),
461   gobject gmodule gthread)
462
463 dnl
464 dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
465 dnl
466 gtk_save_LIBS=$LIBS
467 LIBS="$LIBS $GLIB_LIBS"
468 AC_CHECK_FUNCS(bind_textdomain_codeset)
469 LIBS=$gtk_save_LIBS
470
471 AC_CHECK_HEADERS(pwd.h, AC_DEFINE(HAVE_PWD_H))
472 AC_CHECK_HEADERS(sys/time.h, AC_DEFINE(HAVE_SYS_TIME_H))
473 AC_CHECK_HEADERS(unistd.h, AC_DEFINE(HAVE_UNISTD_H))
474
475 if test "${with_ie55+set}" = set && test $with_ie55 != no; then
476   AC_MSG_CHECKING([for dimm.h])
477   saved_CFLAGS="$CFLAGS"
478   CFLAGS="$CFLAGS -idirafter $with_ie55/Include"
479   AC_TRY_COMPILE([/* The w32api imm.h clashes a bit with the IE5.5 dimm.h */
480 #ifdef __GNUC__
481 #define IMEMENUITEMINFOA hidden_IMEMENUITEMINFOA
482 #define IMEMENUITEMINFOW hidden_IMEMENUITEMINFOW
483 #endif
484 #include <windows.h>
485 #include <objbase.h>
486 #include <imm.h>
487 #ifdef __GNUC__
488 #undef IMEMENUITEMINFOA
489 #undef IMEMENUITEMINFOW
490 #endif
491 #include <dimm.h>
492 ],
493    [],
494    [AC_MSG_RESULT(yes)
495     AC_MSG_CHECKING([for IE55 uuid.lib])
496     if test -f $with_ie55/Lib/uuid.lib ; then
497       AC_MSG_RESULT(yes)
498       have_ie55=yes
499       AC_DEFINE(HAVE_DIMM_H)
500       IE55_UUID_LIB="$with_ie55/Lib/uuid.lib"
501       AC_SUBST(IE55_UUID_LIB)
502     else
503       AC_MSG_RESULT(no)
504       CFLAGS="$saved_CFLAGS"
505       have_ie55=no
506     fi
507     ],
508    [AC_MSG_RESULT(no)
509     CFLAGS="$saved_CFLAGS"
510     have_ie55=no])
511 fi
512 AM_CONDITIONAL(HAVE_IE55, test x$have_ie55 = xyes)
513
514 if test "${with_wintab+set}" = set && test $with_wintab != no; then
515   AC_MSG_CHECKING([for wintab.h])
516   saved_CFLAGS="$CFLAGS"
517   CFLAGS="$CFLAGS -I$with_wintab/include"
518   AC_TRY_COMPILE([#include <windows.h>
519 #include <wintab.h>], 
520    [],
521    [AC_MSG_RESULT(yes)
522     AC_MSG_CHECKING([for wntab32x.lib])
523     if test -f $with_wintab/lib/i386/wntab32x.lib ; then
524       AC_MSG_RESULT(yes)
525       have_wintab=yes
526       AC_DEFINE(HAVE_WINTAB)
527       WINTAB_LIB="$with_wintab/lib/i386/wntab32x.lib"
528       AC_SUBST(WINTAB_LIB)
529     else
530       AC_MSG_RESULT(no)
531       CFLAGS="$saved_cflags"
532       have_wintab=no
533     fi
534     ],
535    [AC_MSG_RESULT(no)
536     CFLAGS="$saved_cflags"
537     have_wintab=no])
538 fi
539 AM_CONDITIONAL(HAVE_WINTAB, test x$have_wintab = xyes)
540
541 saved_cflags="$CFLAGS"
542 saved_ldflags="$LDFLAGS"
543
544
545 # Checks for header files.
546 AC_HEADER_STDC
547
548 # Checks for typedefs, structures, and compiler characteristics.
549 AC_C_CONST
550
551 # Checks for library functions.
552 AC_TYPE_SIGNAL
553 AC_FUNC_MMAP
554
555 AC_CHECK_FUNCS(getresuid)
556 AC_TYPE_UID_T
557
558 # Check if <sys/select.h> needs to be included for fd_set
559 AC_MSG_CHECKING([for fd_set])
560 AC_TRY_COMPILE([#include <sys/types.h>],
561         [fd_set readMask, writeMask;], gtk_ok=yes, gtk_ok=no)
562 if test $gtk_ok = yes; then
563     AC_MSG_RESULT([yes, found in sys/types.h])
564 else
565     AC_HEADER_EGREP(fd_mask, sys/select.h, gtk_ok=yes)
566     if test $gtk_ok = yes; then
567         AC_DEFINE(HAVE_SYS_SELECT_H)
568         AC_MSG_RESULT([yes, found in sys/select.h])
569     else
570         AC_DEFINE(NO_FD_SET)
571         AC_MSG_RESULT(no)
572     fi
573 fi
574
575 # `widechar' tests for gdki18n.h
576 AC_MSG_CHECKING(for wchar.h)
577 AC_TRY_CPP([#include <wchar.h>], gdk_wchar_h=yes, gdk_wchar_h=no)
578 if test $gdk_wchar_h = yes; then
579    AC_DEFINE(HAVE_WCHAR_H,1,[Have wchar.h include file])
580 fi
581 AC_MSG_RESULT($gdk_wchar_h)
582
583 # Check for wctype.h (for iswalnum)
584 AC_MSG_CHECKING(for wctype.h)
585 AC_TRY_CPP([#include <wctype.h>], gdk_wctype_h=yes, gdk_wctype_h=no)
586 if test $gdk_wctype_h = yes; then
587    AC_DEFINE(HAVE_WCTYPE_H,1,[Have wctype.h include file])
588 fi
589 AC_MSG_RESULT($gdk_wctype_h)
590
591 # in Solaris 2.5, `iswalnum' is in -lw
592 GDK_WLIBS=
593 AC_CHECK_FUNC(iswalnum,,[AC_CHECK_LIB(w,iswalnum,GDK_WLIBS=-lw)])
594
595 oLIBS="$LIBS"
596 LIBS="$LIBS $GDK_WLIBS"
597 # The following is necessary for Linux libc-5.4.38
598 AC_MSG_CHECKING(if iswalnum() and friends are properly defined)
599 AC_TRY_LINK([#include <stdlib.h>],[
600 #if (defined(HAVE_WCTYPE_H) || defined(HAVE_WCHAR_H))
601 #  ifdef HAVE_WCTYPE_H
602 #    include <wctype.h>
603 #  else
604 #    ifdef HAVE_WCHAR_H
605 #      include <wchar.h>
606 #    endif
607 #  endif
608 #else
609 #  define iswalnum(c) ((wchar_t)(c) <= 0xFF && isalnum(c))
610 #endif
611 iswalnum((wchar_t) 0);
612 ], gdk_working_wctype=yes, gdk_working_wctype=no)
613 LIBS="$oLIBS"
614
615 if test $gdk_working_wctype = no; then
616    AC_DEFINE(HAVE_BROKEN_WCTYPE,1,[Is the wctype implementation broken])
617    GDK_WLIBS=
618 fi
619 AC_MSG_RESULT($gdk_working_wctype)
620 AC_SUBST(GDK_WLIBS)
621
622
623 ##################################################
624 # Checks for gdk-pixbuf
625 ##################################################
626
627 dnl ********************************************************
628 dnl * See whether we need to load our modules as .la files *
629 dnl ********************************************************
630
631 use_la_modules=false
632 case $host in
633   *-aix*) use_la_modules=true
634 esac
635
636 if $use_la_modules ; then
637    AC_DEFINE(USE_LA_MODULES, 1, [Whether to load modules via .la files rather than directly])
638 fi
639
640
641 AC_MSG_CHECKING(whether to build gmodulized gdk-pixbuf)
642
643 AC_ARG_ENABLE(modules,
644               [AC_HELP_STRING([--disable-modules],
645                               [disable dynamic module loading])])
646
647 dynworks=false
648 deps=
649 if test x$enable_modules = xno; then
650     AC_MSG_RESULT(no)
651 else
652     AC_MSG_RESULT(yes)
653     AC_MSG_CHECKING(whether dynamic modules work)
654     ## for loop is to strip newline 
655     tmp=`$PKG_CONFIG --variable=gmodule_supported gmodule-2.0`
656     for I in $tmp; do
657         dynworks=$I
658     done
659
660     dnl Now we check to see if our libtool supports shared lib deps
661     dnl (in a rather ugly way even)
662     if $dynworks; then
663         pixbuf_libtool_config="${CONFIG_SHELL-/bin/sh} ./libtool --config"
664         pixbuf_deplibs_check=`$pixbuf_libtool_config | \
665             grep '^[[a-z_]]*check[[a-z_]]*_method=[['\''"]]' | \
666             sed 's/.*[['\''"]]\(.*\)[['\''"]]$/\1/'`
667         if test "x$pixbuf_deplibs_check" = "xnone" || \
668            test "x$pixbuf_deplibs_check" = "xunknown" || \
669            test "x$pixbuf_deplibs_check" = "x"; then
670             dynworks=false
671         fi
672     fi
673
674     if $dynworks; then
675         AC_DEFINE(USE_GMODULE)
676         AC_MSG_RESULT(yes)
677     else
678         AC_MSG_RESULT(no)
679     fi
680 fi
681
682 dnl We allow people to disable image loaders explicitely, but if they don't we error
683 dnl out so that people don't accidentally build without them.
684
685 AC_ARG_WITH(libpng,
686             [AC_HELP_STRING([--without-libpng],
687                             [disable PNG loader for gdk-pixbuf])])
688 AC_ARG_WITH(libjpeg,
689             [AC_HELP_STRING([--without-libjpeg],
690                             [disable JPEG loader for gdk-pixbuf])])
691 AC_ARG_WITH(libtiff,
692             [AC_HELP_STRING([--without-libtiff],
693                             [disable TIFF loader for gdk-pixbuf])])
694
695 dnl Test for libtiff
696   if test x$with_libtiff != xno && test -z "$LIBTIFF"; then
697     AC_CHECK_LIB(tiff, TIFFReadScanline,
698       [AC_CHECK_HEADER(tiffio.h,
699         TIFF='tiff'; LIBTIFF='-ltiff',
700         AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))],
701       [AC_CHECK_LIB(tiff, TIFFWriteScanline,
702         [AC_CHECK_HEADER(tiffio.h,
703           TIFF='tiff'; LIBTIFF='-ltiff -ljpeg -lz',
704           AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))],
705         [AC_CHECK_LIB(tiff34, TIFFFlushData,
706           [AC_CHECK_HEADER(tiffio.h,
707             TIFF='tiff'; LIBTIFF='-ltiff34 -ljpeg -lz',
708             AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))],
709         AC_MSG_WARN(*** TIFF plug-in will not be built (TIFF library not found) ***), -ljpeg -lz -lm)], -ljpeg -lz -lm)], -lm)
710   fi
711
712   if test x$with_libtiff != xno && test -z "$LIBTIFF"; then
713      AC_MSG_ERROR([
714 *** Checks for TIFF loader failed. You can build without it by passing 
715 *** --without-libtiff to configure but some programs using GTK+ may
716 *** not work properly])
717   fi
718
719 dnl Test for libjpeg
720   if test x$with_libjpeg != xno && test -z "$LIBJPEG"; then
721     AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
722       jpeg_ok=yes,
723       jpeg_ok=no
724       AC_MSG_WARN(*** JPEG loader will not be built (JPEG library not found) ***))
725     if test "$jpeg_ok" = yes; then
726       AC_MSG_CHECKING([for jpeglib.h])
727       AC_TRY_CPP(
728 [#include <stdio.h>
729 #undef PACKAGE
730 #undef VERSION
731 #undef HAVE_STDLIB_H
732 #include <jpeglib.h>],
733         jpeg_ok=yes,
734         jpeg_ok=no)
735       AC_MSG_RESULT($jpeg_ok)
736       if test "$jpeg_ok" = yes; then
737         LIBJPEG='-ljpeg'
738         AC_CHECK_LIB(jpeg, jpeg_simple_progression,     
739           AC_DEFINE(HAVE_PROGRESSIVE_JPEG),
740           AC_MSG_WARN(JPEG library does not support progressive saving.))
741       else
742           AC_MSG_WARN(*** JPEG loader will not be built (JPEG header file not found) ***)
743       fi
744     fi
745   fi
746
747   if test x$with_libjpeg != xno && test -z "$LIBJPEG"; then
748      AC_MSG_ERROR([
749 *** Checks for JPEG loader failed. You can build without it by passing 
750 *** --without-libjpeg to configure but some programs using GTK+ may
751 *** not work properly])
752   fi
753
754 dnl Test for libpng
755   if test x$with_libpng != xno && test -z "$LIBPNG"; then
756     AC_MSG_CHECKING(for libpng12)
757     if $PKG_CONFIG --exists libpng12 ; then
758         AC_MSG_RESULT(yes)
759         PNG='png'
760         PNG_DEP_CFLAGS_PACKAGES=libpng12
761         LIBPNG=`$PKG_CONFIG --libs libpng12`
762     else
763       AC_MSG_RESULT(no)
764       AC_CHECK_LIB(png, png_read_info,
765         [AC_CHECK_HEADER(png.h,
766           png_ok=yes,
767           png_ok=no)],
768         AC_MSG_WARN(*** PNG loader will not be built (PNG library not found) ***), -lz -lm)
769       if test "$png_ok" = yes; then
770         AC_MSG_CHECKING([for png_structp in png.h])
771         AC_TRY_COMPILE([#include <png.h>],
772           [png_structp pp; png_infop info; png_colorp cmap; png_create_read_struct;],
773           png_ok=yes,
774           png_ok=no)
775         AC_MSG_RESULT($png_ok)
776         if test "$png_ok" = yes; then
777           PNG='png'; LIBPNG='-lpng -lz'
778         else
779           AC_MSG_WARN(*** PNG loader will not be built (PNG library is too old) ***)
780         fi
781       else
782        AC_MSG_WARN(*** PNG loader will not be built (PNG header file not found) ***)
783       fi
784     fi
785   fi
786
787   if test x$with_libpng != xno && test -z "$LIBPNG"; then
788      AC_MSG_ERROR([
789 *** Checks for PNG loader failed. You can build without it by passing 
790 *** --without-libpng to configure but many programs using GTK+ will
791 *** not work properly. The PNG loader is also needed if you are compiling
792 *** from CVS.])
793   fi
794
795   REBUILD_PNGS=\#
796   if test -z "$LIBPNG"; then
797      REBUILD_PNGS=
798   fi
799   AC_SUBST(REBUILD_PNGS)
800
801 AC_SUBST(LIBTIFF)
802 AC_SUBST(LIBJPEG)
803 AC_SUBST(LIBPNG)
804
805 AM_CONDITIONAL(BUILD_DYNAMIC_MODULES, $dynworks)
806
807 #
808 # Allow building some or all gdk-pixbuf loaders included
809 #
810 AC_MSG_CHECKING(pixbuf loaders to build)
811
812 dnl due to an autoconf bug, commas in the first arg to
813 dnl AC_HELP_STRING cause problems.
814 dnl AC_HELP_STRING([--with-included-loaders=LOADER1 LOADER2 ...],
815 dnl                [build the specified loaders into gdk-pixbuf (only used if module loading disabled)])
816 AC_ARG_WITH(included_loaders,
817 [  --with-included-loaders=LOADER1,LOADER2,...
818                           build the specified loaders into gdk-pixbuf (only
819                           used if module loading disabled)])
820
821 if $dynworks; then 
822         :
823 else
824    ## if the option was specified, leave it; otherwise disable included loaders
825    if test x$with_included_loaders = xno; then
826            with_included_loaders=yes
827    fi
828 fi
829
830 all_loaders="png,bmp,wbmp,gif,ico,ani,jpeg,pnm,ras,tiff,xpm,tga,pcx"
831 included_loaders=""
832 # If no loaders specified, include all
833 if test "x$with_included_loaders" = xyes ; then
834   included_loaders="$all_loaders"
835 else
836   included_loaders="$with_included_loaders"
837 fi
838
839 AC_MSG_RESULT($included_loaders)
840
841 INCLUDED_LOADER_OBJ=
842 INCLUDED_LOADER_DEFINE=
843
844 IFS="${IFS=     }"; gtk_save_ifs="$IFS"; IFS=","
845 for loader in $included_loaders; do
846  if echo "$all_loaders" | egrep "(^|,)$loader(\$|,)" > /dev/null; then
847    :
848  else
849    AC_MSG_ERROR([the specified loader $loader does not exist])
850  fi
851
852  INCLUDED_LOADER_OBJ="$INCLUDED_LOADER_OBJ libpixbufloader-static-$loader.la"
853  INCLUDED_LOADER_DEFINE="$INCLUDED_LOADER_DEFINE -DINCLUDE_$loader"
854 done
855 IFS="$gtk_save_ifs"
856 AC_SUBST(INCLUDED_LOADER_OBJ)
857 AC_SUBST(INCLUDED_LOADER_DEFINE)
858
859 AC_HEADER_SYS_WAIT
860
861 AC_TYPE_SIGNAL
862
863 AM_CONDITIONAL(HAVE_TIFF, test "x$LIBTIFF" != x)
864 AM_CONDITIONAL(HAVE_PNG, test "x$LIBPNG" != x)
865 AM_CONDITIONAL(HAVE_JPEG, test "x$LIBJPEG" != x)
866
867 if $dynworks ; then
868   STATIC_LIB_DEPS=
869   if echo "$included_loaders" | egrep '(^|,)tiff($|,)' > /dev/null; then
870     STATIC_LIB_DEPS="$STATIC_LIB_DEPS $LIBTIFF"
871   fi
872   if echo "$included_loaders" | egrep '(^|,)jpeg($|,)' > /dev/null; then
873     STATIC_LIB_DEPS="$STATIC_LIB_DEPS $LIBJPEG"
874   fi
875   if echo "$included_loaders" | egrep '(^|,)png($|,)' > /dev/null; then
876     STATIC_LIB_DEPS="$STATIC_LIB_DEPS $LIBPNG"
877   fi
878 else
879   STATIC_LIB_DEPS="$LIBTIFF $LIBJPEG $LIBPNG"
880 fi
881
882 # Checks to see if we should compile in MMX support (there will be
883 # a runtime test when the code is actually run to see if it should
884 # be used - this just checks if we can compile it.)
885 #
886 # This code is partially taken from Mesa
887 #
888 AC_MSG_CHECKING(for x86 platform)
889 case $host_cpu in
890   i386|i486|i586|i686|i786|k6|k7)
891         use_x86_asm=yes
892         ;;
893    *)
894         use_x86_asm=no
895 esac
896 AC_MSG_RESULT($use_x86_asm)
897
898 use_mmx_asm=no
899 if test $use_x86_asm = yes; then
900     save_ac_ext=$ac_ext
901     ac_ext=S
902     
903     AC_MSG_CHECKING(compiler support for MMX)
904     cp $srcdir/gdk-pixbuf/pixops/scale_line_22_33_mmx.S conftest.S
905     if AC_TRY_EVAL(ac_compile); then
906         use_mmx_asm=yes
907     fi
908
909     rm -rf conftest*
910
911     ac_ext=$save_ac_ext
912     if test $use_mmx_asm = yes; then
913       AC_DEFINE(USE_MMX)
914       AC_MSG_RESULT(yes)
915     else
916       AC_MSG_RESULT(no)
917     fi
918 fi
919
920 AM_CONDITIONAL(USE_MMX, test x$use_mmx_asm = xyes)
921
922 dnl Look for a host system's gdk-pixbuf-csource if we are cross-compiling
923
924 AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
925
926 if test $cross_compiling = yes; then
927   AC_PATH_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource, no)
928   if test x$GDK_PIXBUF_CSOURCE = xno; then
929     AC_MSG_ERROR(Could not find a gdk-pixbuf-csource in your PATH)
930   fi
931 fi
932
933 GDK_PIXBUF_PACKAGES="gmodule-2.0 gobject-2.0"
934 GDK_PIXBUF_EXTRA_LIBS="$STATIC_LIB_DEPS $MATH_LIB"
935 GDK_PIXBUF_EXTRA_CFLAGS= 
936 GDK_PIXBUF_DEP_LIBS="`$PKG_CONFIG --libs $GDK_PIXBUF_PACKAGES` $GDK_PIXBUF_EXTRA_LIBS"
937 GDK_PIXBUF_DEP_CFLAGS="`$PKG_CONFIG --cflags  gthread-2.0 $GDK_PIXBUF_PACKAGES $PNG_DEP_CFLAGS_PACKAGES` $GDK_PIXBUF_EXTRA_CFLAGS"
938
939 AC_SUBST(GDK_PIXBUF_PACKAGES)
940 AC_SUBST(GDK_PIXBUF_EXTRA_LIBS)
941 AC_SUBST(GDK_PIXBUF_EXTRA_CFLAGS)
942 AC_SUBST(GDK_PIXBUF_DEP_LIBS)
943 AC_SUBST(GDK_PIXBUF_DEP_CFLAGS)
944
945
946 ########################################
947 # Windowing system checks
948 ########################################
949
950 GDK_EXTRA_LIBS=$GDK_WLIBS
951 GDK_EXTRA_CFLAGS= 
952
953 FREETYPE_LIBS=
954 FREETYPE_CFLAGS=
955 if test "x$gdktarget" = "xlinux-fb" || test "x$gdktarget" = "xx11" ; then
956   #
957   # Checks for FreeType
958   #
959   have_freetype=false
960   AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
961   if test "x$FREETYPE_CONFIG" != "xno" ; then
962     FREETYPE_CFLAGS=`$FREETYPE_CONFIG --cflags`
963     FREETYPE_LIBS=`$FREETYPE_CONFIG --libs`
964
965     gtk_save_LIBS="$LIBS"
966     LIBS="$FREETYPE_LIBS $LIBS"
967     AC_TRY_LINK_FUNC(FT_New_Face, have_freetype=true,:)
968     LIBS="$gtk_save_LIBS"
969
970     if $have_freetype ; then
971       gtk_save_cppflags="$CPPFLAGS"
972       CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS"
973
974       AC_MSG_CHECKING([For sufficiently new FreeType (at least 2.0.1)])
975       AC_TRY_COMPILE([
976 #include <freetype/freetype.h>
977 #include FT_ERRORS_H
978     ],
979                      [(void)1;],:,have_freetype=false)
980       if $have_freetype ; then
981         AC_MSG_RESULT(yes)
982       else
983         AC_MSG_RESULT(no)
984       fi
985
986       CPPFLAGS="$gtk_save_cppflags"
987     fi
988   fi
989   AC_SUBST(FREETYPE_LIBS)
990   AC_SUBST(FREETYPE_CFLAGS)
991 fi
992
993 if test "x$gdktarget" = "xx11"; then
994   # We start off with the libraries from Pango
995
996   ## be sure we also have Pango built with Xft2 support
997   if $PKG_CONFIG --exists 'pangoxft >= 1.2.0' ; then
998     if $have_freetype ; then
999       :
1000     else
1001       AC_MSG_ERROR([Xft Pango backend found but did not find freetype libraries])
1002     fi
1003   else
1004     AC_MSG_ERROR([Pango 1.2.0 and Xft backend is required for x11 target])
1005   fi
1006
1007   if $PKG_CONFIG --exists xft ; then : ; else
1008     AC_MSG_ERROR([Xft version 2 is required for x11 target])
1009   fi
1010
1011   #
1012   # If Pango included the shared library dependencies from X11 in
1013   # the pkg-config output, then we use that (to avoid duplicates).
1014   # but if they were omitted to avoid binary compatibility problems,
1015   # then we need to repeat the checks.
1016   #
1017   x_libs="`$PKG_CONFIG --libs pangoxft`"
1018   case "$x_libs" in
1019     *-lX11*) pango_omitted_x_deps=no ;;
1020     *)       pango_omitted_x_deps=yes ;;
1021   esac
1022
1023   x_cflags="`$PKG_CONFIG --cflags pangoxft`"
1024   x_extra_libs=
1025
1026   AC_PATH_XTRA
1027   if test x$no_x = xyes ; then
1028     AC_MSG_ERROR([X development libraries not found])
1029   fi
1030   
1031   if test $pango_omitted_x_deps = yes ; then
1032     # Old versions of Xft didn't necessarily include -lX11 in the output
1033     x_libs="`pkg-config --libs xft` -lX11 $X_EXTRA_LIBS"
1034   fi            
1035
1036   ## Strip the .la files
1037  
1038   x_libs_for_checks=""
1039   for I in $x_libs ; do
1040     case $I in 
1041       *.la) ;;
1042       *) x_libs_for_checks="$x_libs_for_checks $I" ;;
1043     esac
1044   done
1045
1046   # Sanity check for the X11 library
1047   AC_CHECK_LIB(X11, XOpenDisplay, :,
1048             AC_MSG_ERROR([*** libX11 not found. Check 'config.log' for more details.]),
1049             $x_libs_for_checks)
1050
1051   if test "x$enable_shm" = "xyes"; then
1052     # Check for the Xext library (needed for XShm extention)
1053     AC_CHECK_LIB(Xext, XShmAttach,
1054         [GTK_ADD_LIB(x_extra_libs,Xext)],
1055         # On AIX, it is in XextSam instead, but we still need -lXext
1056         [AC_CHECK_LIB(XextSam, XShmAttach, 
1057             [GTK_ADD_LIB(x_extra_libs,Xext)
1058              GTK_ADD_LIB(x_extra_libs,XextSam)
1059             ], , -lXext $x_libs_for_checks)],
1060         $x_libs_for_checks)
1061   fi
1062
1063   GDK_PIXBUF_XLIB_EXTRA_CFLAGS="$x_cflags"
1064   # Don't ever pull in the pangoxft libraries for gdk-pixbuf-x11
1065   GDK_PIXBUF_XLIB_EXTRA_LIBS="$X_LIBS -lX11 $x_extra_libs $X_EXTRA_LIBS"
1066
1067   # Check for Xinerama extension (Solaris impl or Xfree impl)
1068
1069   gtk_save_cppflags="$CPPFLAGS"
1070   CPPFLAGS="$CPPFLAGS $x_cflags"
1071
1072   case "$host" in
1073       *-*-solaris*)
1074           # Check for solaris
1075           use_solaris_xinerama=yes
1076           AC_CHECK_LIB(Xext, XineramaGetInfo,
1077                         use_solaris_xinerama=yes, use_solaris_xinerama=no)
1078           if test "x$use_solaris_xinerama" = "xyes"; then
1079               AC_CHECK_HEADER(X11/extensions/xinerama.h,
1080                 [GTK_ADD_LIB(x_extra_libs,Xext)
1081                 AC_DEFINE(HAVE_SOLARIS_XINERAMA)
1082                 AC_DEFINE(HAVE_XINERAMA)], use_solaris_xinerama=no, -lXext $x_libs_for_checks)
1083           fi    
1084           AC_MSG_CHECKING(for Xinerama support on Solaris)
1085           AC_MSG_RESULT($use_solaris_xinerama);
1086           ;;
1087       *)
1088           # Check for XFree
1089           use_xfree_xinerama=yes
1090           AC_CHECK_LIB(Xinerama, XineramaQueryExtension,
1091               [AC_CHECK_HEADER(X11/extensions/Xinerama.h, 
1092                   [GTK_ADD_LIB(x_extra_libs,Xext)
1093                   GTK_ADD_LIB(x_extra_libs,Xinerama)
1094                   AC_DEFINE(HAVE_XFREE_XINERAMA)
1095                   AC_DEFINE(HAVE_XINERAMA)], 
1096                   use_xfree_xinerama=no,
1097                   [#include <X11/Xlib.h>])],
1098               use_xfree_xinerama=no, -lXext $x_libs_for_checks)
1099           AC_MSG_CHECKING(for Xinerama support on XFree86)
1100           AC_MSG_RESULT($use_xfree_xinerama);       
1101           ;;
1102   esac
1103
1104   CPPFLAGS="$gtk_save_cppflags"
1105
1106   # Check for shaped window extension
1107
1108   AC_CHECK_LIB(Xext, XShapeCombineMask,
1109       [GTK_ADD_LIB(x_extra_libs,Xext),
1110        AC_DEFINE(HAVE_SHAPE_EXT)],
1111       ,
1112       $x_libs_for_checks)
1113
1114   # Check for XConvertCase (X11R6 specific)
1115
1116   AC_CHECK_LIB(X11, XConvertCase,
1117       AC_DEFINE(HAVE_XCONVERTCASE),
1118       ,
1119       $x_libs_for_checks)
1120
1121   # Generic X11R6 check needed for XIM support; we could
1122   # probably use this to replace the above, but we'll
1123   # leave the separate XConvertCase check for clarity
1124
1125   have_x11r6=false
1126   AC_CHECK_LIB(X11, XAddConnectionWatch,
1127       have_x11r6=true,
1128       ,
1129       $x_libs_for_checks)
1130
1131   if $have_x11r6; then
1132     AC_DEFINE(HAVE_X11R6,1,[Define if we have X11R6])
1133   fi
1134   AM_CONDITIONAL(HAVE_X11R6, $have_x11r6)
1135
1136   # Check for XKB support.
1137
1138   if test "x$enable_xkb" = "xyes"; then
1139         AC_MSG_WARN(XKB support explicitly enabled)
1140         AC_DEFINE(HAVE_XKB)
1141   elif test "x$enable_xkb" = "xmaybe"; then
1142         AC_CHECK_LIB(X11, XkbQueryExtension,
1143                      AC_DEFINE(HAVE_XKB),
1144                      ,
1145                      $x_libs_for_checks)
1146   else
1147         AC_MSG_WARN(XKB support explicitly disabled)
1148   fi
1149
1150   x_cflags="$X_CFLAGS"
1151   x_ldflags="$X_LDFLAGS"
1152
1153   # set up things for XInput
1154
1155   if test "x$with_xinput" = "xxfree" || test "x$with_xinput" = "xyes"; then
1156     AC_DEFINE(XINPUT_XFREE)
1157     GTK_ADD_LIB(x_extra_libs, Xi)
1158   else
1159     AC_DEFINE(XINPUT_NONE)
1160   fi
1161
1162   AM_CONDITIONAL(XINPUT_XFREE, test x$with_xinput = xxfree || test x$with_xinput = xyes)
1163
1164   # Check for the RANDR extension
1165
1166   AC_CHECK_LIB(Xrandr, XRRUpdateConfiguration,
1167       [AC_CHECK_HEADER(X11/extensions/Xrandr.h,
1168           # RANDR requires RENDER
1169           [GTK_ADD_LIB(x_extra_libs, Xrender)
1170           GTK_ADD_LIB(x_extra_libs, Xrandr)
1171           AC_DEFINE(HAVE_RANDR, 1, Have the Xrandr extension library)],
1172           :, [#include <X11/Xlib.h>])], : ,
1173        $X_LIBS -lXrandr -lXrender -lX11 $X_EXTRA_LIBS)
1174
1175   # Checks for Xcursor library
1176   
1177   have_xcursor=false
1178   PKG_CHECK_MODULES(XCURSOR, xcursor, have_xcursor=true, :)
1179
1180   if $have_xcursor ; then
1181     AC_DEFINE(HAVE_XCURSOR, 1, Have the Xcursor library)
1182     XCURSOR_PACKAGES="xcursor"
1183   else
1184     XCURSOR_PACKAGES=
1185   fi
1186     
1187   # Xshm checks
1188
1189   if test "x$enable_shm" = "xyes"; then
1190     # Check for shared memory
1191     AC_CHECK_HEADER(sys/ipc.h, AC_DEFINE(HAVE_IPC_H), no_sys_ipc=yes)
1192     AC_CHECK_HEADER(sys/shm.h, AC_DEFINE(HAVE_SHM_H), no_sys_shm=yes)
1193
1194     # Check for the X shared memory extension header file
1195     have_xshm=no 
1196     AC_MSG_CHECKING(X11/extensions/XShm.h)
1197     if test "x$no_xext_lib" = "xyes"; then
1198       :
1199     else
1200       gtk_save_CFLAGS="$CFLAGS"
1201       CFLAGS="$CFLAGS $x_cflags"
1202       AC_TRY_COMPILE([
1203 #include <stdlib.h>
1204 #include <sys/types.h>
1205 #include <sys/ipc.h>
1206 #include <sys/shm.h>
1207 #include <X11/Xlib.h>
1208 #include <X11/Xutil.h>
1209 #include <X11/extensions/XShm.h>
1210 ], [XShmSegmentInfo *x_shm_info;], have_xshm=yes)
1211       CFLAGS="$gtk_save_CFLAGS"
1212     fi
1213     AC_MSG_RESULT($have_xshm)
1214     if test $have_xshm = yes ; then
1215       AC_DEFINE(HAVE_XSHM_H)
1216     fi
1217   fi
1218
1219   GDK_EXTRA_CFLAGS=
1220   if test $pango_omitted_x_deps = yes ; then
1221     GDK_EXTRA_LIBS="$X_LIBS $x_extra_libs $x_libs $GDK_EXTRA_LIBS"
1222   else
1223     GDK_EXTRA_LIBS="$X_LIBS $x_extra_libs $GDK_EXTRA_LIBS"
1224   fi
1225
1226   AM_CONDITIONAL(USE_X11, true)
1227 else
1228   AM_CONDITIONAL(XINPUT_XFREE, false)
1229   AM_CONDITIONAL(USE_X11, false)
1230   AM_CONDITIONAL(HAVE_X11R6, false)
1231 fi
1232
1233 if test "x$gdktarget" = "xwin32"; then
1234   # We start off with the libraries from Pango
1235
1236   if test x$have_wintab = xyes; then
1237     GDK_WIN32_EXTRA_CFLAGS="-I $with_wintab/include"
1238     AC_SUBST(GDK_WIN32_EXTRA_CFLAGS)
1239   fi
1240
1241   GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -lgdi32 -user32 -limm32 -lshell32 -lole32 -luuid"
1242   AM_CONDITIONAL(USE_WIN32, true)
1243 else
1244   AM_CONDITIONAL(USE_WIN32, false)
1245 fi
1246
1247 GDK_PIXBUF_XLIB_PACKAGES=
1248 GDK_PIXBUF_XLIB_DEP_LIBS="`$PKG_CONFIG --libs $GDK_PIXBUF_PACKAGES $GDK_PIXBUF_XLIB_PACKAGES` $GDK_PIXBUF_XLIB_EXTRA_LIBS $GDK_PIXBUF_EXTRA_LIBS"
1249 GDK_PIXBUF_XLIB_DEP_CFLAGS="`$PKG_CONFIG --cflags  gthread-2.0 $GDK_PIXBUF_PACKAGES $GDK_PIXBUF_XLIB_PACKAGES` $GDK_PIXBUF_EXTRA_CFLAGS $GDK_PIXBUF_XLIB_EXTRA_CFLAGS"
1250
1251 AC_SUBST(GDK_PIXBUF_XLIB_PACKAGES)
1252 AC_SUBST(GDK_PIXBUF_XLIB_EXTRA_LIBS)
1253 AC_SUBST(GDK_PIXBUF_XLIB_EXTRA_CFLAGS)
1254 AC_SUBST(GDK_PIXBUF_XLIB_DEP_LIBS)
1255 AC_SUBST(GDK_PIXBUF_XLIB_DEP_CFLAGS)
1256
1257 if test "x$gdktarget" = "xlinux-fb"; then
1258   if $have_freetype ; then
1259     :
1260   else
1261     AC_MSG_ERROR([Using linux-fb backend but freetype was not found])
1262   fi
1263
1264   ft2_libs="`$PKG_CONFIG --libs pangoft2`"
1265   case "$ft2_libs" in
1266     *-lfreetype*) pango_omitted_ft2_deps=no ;;
1267     *)            pango_omitted_ft2_deps=yes ;;
1268   esac
1269
1270   CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
1271
1272   if test x$enable_shadowfb = xyes ; then
1273     AC_DEFINE(ENABLE_SHADOW_FB)
1274   fi
1275
1276   if test x$enable_fbmanager = xyes ; then
1277     AC_DEFINE(ENABLE_FB_MANAGER)
1278     AM_CONDITIONAL(ENABLE_FB_MANAGER, true)
1279   else
1280     AM_CONDITIONAL(ENABLE_FB_MANAGER, false)
1281   fi
1282   
1283   GDK_EXTRA_CFLAGS=""
1284   if test $pango_omitted_ft2_deps = yes ; then
1285     GDK_EXTRA_LIBS="$FREETYPE_LIBS $GDK_EXTRA_LIBS"
1286   fi
1287
1288   AM_CONDITIONAL(USE_LINUX_FB, true)
1289 else
1290   AM_CONDITIONAL(USE_LINUX_FB, false)
1291   AM_CONDITIONAL(ENABLE_FB_MANAGER, false)
1292 fi
1293
1294 #
1295 # Pick correct Pango packages to use
1296 #
1297
1298 if test "x$gdktarget" = "xx11"; then
1299         PANGO_PACKAGES=pangoxft
1300         
1301         # We no longer use pangox, but if we find it, we link to it 
1302         # for binary compatibility.
1303         if $PKG_CONFIG --exists pangox ; then
1304                 PANGO_PACKAGES="$PANGO_PACKAGES pangox"
1305         fi
1306 elif test "x$gdktarget" = "xwin32"; then
1307         PANGO_PACKAGES=pangowin32
1308 elif test "x$gdktarget" = "xlinux-fb"; then
1309         PANGO_PACKAGES=pangoft2
1310 else
1311         PANGO_PACKAGES=pango
1312 fi
1313
1314 # Check for Pango flags
1315
1316 AC_MSG_CHECKING(Pango flags)
1317 if $PKG_CONFIG --exists $PANGO_PACKAGES ; then
1318         PANGO_CFLAGS=`$PKG_CONFIG --cflags $PANGO_PACKAGES`
1319         PANGO_LIBS=`$PKG_CONFIG --libs $PANGO_PACKAGES`
1320
1321         AC_MSG_RESULT($PANGO_CFLAGS $PANGO_LIBS)
1322 else
1323         AC_MSG_ERROR([
1324 *** Pango not found. Pango is required to build GTK+.
1325 *** See http://www.pango.org for Pango information.
1326 *** For the framebuffer target, you will need to build 
1327 *** Pango with freetype support.
1328 ])
1329 fi
1330
1331 CFLAGS="$CFLAGS $PANGO_CFLAGS"
1332
1333 if $PKG_CONFIG --uninstalled $PANGO_PACKAGES; then
1334         :
1335 else
1336         gtk_save_LIBS="$LIBS"
1337         LIBS="$PANGO_LIBS $LIBS"
1338         AC_TRY_LINK_FUNC(pango_context_new, :, AC_MSG_ERROR([
1339 *** Can't link to Pango. Pango is required to build
1340 *** GTK+. For more information see http://www.pango.org]))
1341         LIBS="$gtk_save_LIBS"
1342 fi
1343
1344 CFLAGS="$saved_cflags"
1345 LDFLAGS="$saved_ldflags"
1346
1347 GDK_PACKAGES="$XCURSOR_PACKAGES $PANGO_PACKAGES"
1348 GDK_DEP_LIBS="$GDK_EXTRA_LIBS `$PKG_CONFIG --libs $GDK_PIXBUF_PACKAGES $GDK_PACKAGES` $GDK_PIXBUF_EXTRA_LIBS"
1349 GDK_DEP_CFLAGS="`$PKG_CONFIG --cflags  gthread-2.0 $GDK_PIXBUF_PACKAGES $GDK_PACKAGES` $GDK_PIXBUF_EXTRA_CFLAGS $GDK_EXTRA_CFLAGS"
1350
1351 #
1352 # If we aren't writing explicit dependencies, then don't put the extra libraries we need
1353 # into the pkg-config files
1354 #
1355 if test $enable_explicit_deps != yes ; then
1356   GDK_EXTRA_LIBS=
1357 fi
1358
1359 AC_SUBST(GDK_PACKAGES)
1360 AC_SUBST(GDK_EXTRA_LIBS)
1361 AC_SUBST(GDK_EXTRA_CFLAGS)
1362 AC_SUBST(GDK_DEP_LIBS)
1363 AC_SUBST(GDK_DEP_CFLAGS)
1364
1365
1366 ########################################
1367 # Check for Accessibility Toolkit flags
1368 ########################################
1369
1370 ATK_PACKAGES=atk
1371 AC_MSG_CHECKING(ATK flags)
1372 if $PKG_CONFIG --exists $ATK_PACKAGES ; then
1373         ATK_CFLAGS=`$PKG_CONFIG --cflags $ATK_PACKAGES`
1374         ATK_LIBS=`$PKG_CONFIG --libs $ATK_PACKAGES`
1375
1376         AC_MSG_RESULT($ATK_CFLAGS $ATK_LIBS)
1377 else
1378         AC_MSG_ERROR([
1379 *** Accessibility Toolkit not found. Accessibility Toolkit is required
1380 *** to build GTK+.
1381 ])
1382 fi
1383
1384 if $PKG_CONFIG --uninstalled $ATK_PACKAGES; then
1385         :
1386 else
1387         gtk_save_LIBS="$LIBS"
1388         LIBS="$ATK_LIBS $LIBS"
1389         AC_TRY_LINK_FUNC(atk_object_get_type, : , AC_MSG_ERROR([
1390                 *** Cannot link to Accessibility Toolkit. Accessibility Toolkit is required
1391                 *** to build GTK+]))
1392         LIBS="$gtk_save_LIBS"
1393 fi
1394
1395 GTK_PACKAGES=atk
1396 GTK_EXTRA_LIBS=
1397 GTK_EXTRA_CFLAGS= 
1398 GTK_DEP_LIBS="$GDK_EXTRA_LIBS `$PKG_CONFIG --libs $GDK_PIXBUF_PACKAGES $GDK_PACKAGES $GTK_PACKAGES` $GTK_EXTRA_LIBS $GDK_PIXBUF_EXTRA_LIBS"
1399 GTK_DEP_CFLAGS="`$PKG_CONFIG --cflags  gthread-2.0 $GDK_PIXBUF_PACKAGES $GDK_PACKAGES $GTK_PACKAGES` $GDK_PIXBUF_EXTRA_CFLAGS $GDK_EXTRA_CFLAGS $GTK_EXTRA_CFLAGS"
1400
1401 AC_SUBST(GTK_PACKAGES)
1402 AC_SUBST(GTK_EXTRA_LIBS)
1403 AC_SUBST(GTK_EXTRA_CFLAGS)
1404 AC_SUBST(GTK_DEP_LIBS)
1405 AC_SUBST(GTK_DEP_CFLAGS)
1406
1407
1408 AC_SUBST(GTK_DEBUG_FLAGS)
1409 AC_SUBST(GTK_XIM_FLAGS)
1410
1411 ##################################################
1412 # Checks for gtk-doc and docbook-tools
1413 ##################################################
1414
1415 GTK_DOC_CHECK([1.0])
1416
1417 AC_CHECK_PROG(DB2HTML, db2html, true, false)
1418 AM_CONDITIONAL(HAVE_DOCBOOK, $DB2HTML)
1419
1420 AC_ARG_ENABLE(man,
1421               [AC_HELP_STRING([--enable-man],
1422                               [regenerate man pages from Docbook [default=no]])],enable_man=yes,
1423               enable_man=no)
1424
1425 dnl
1426 dnl Check for xsltproc
1427 dnl
1428 AC_PATH_PROG([XSLTPROC], [xsltproc])
1429 if test -z "$XSLTPROC"; then
1430   enable_man=no
1431 fi
1432
1433 dnl check for DocBook DTD and stylesheets in the local catalog.
1434 JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.1.2//EN],
1435    [DocBook XML DTD V4.1.2],,enable_man=no)
1436 JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl],
1437    [DocBook XSL Stylesheets],,enable_man=no)
1438 AM_CONDITIONAL(ENABLE_MAN, test x$enable_man != xno)
1439
1440 ##################################################
1441 # Output commands
1442 ##################################################
1443
1444 AC_CONFIG_COMMANDS([gdk/gdkconfig.h], [
1445         outfile=gdkconfig.h-tmp
1446         cat > $outfile <<\_______EOF
1447 /* gdkconfig.h
1448  *
1449  * This is a generated file.  Please modify `configure.in'
1450  */
1451
1452 #ifndef GDKCONFIG_H
1453 #define GDKCONFIG_H
1454
1455 #ifdef __cplusplus
1456 extern "C" {
1457 #endif /* __cplusplus */
1458
1459 _______EOF
1460
1461         cat >>$outfile <<_______EOF
1462 $gdk_windowing
1463 $gdk_wc
1464 _______EOF
1465
1466         cat >>$outfile <<_______EOF
1467
1468 #ifdef __cplusplus
1469 }
1470 #endif /* __cplusplus */
1471
1472 #endif /* GDKCONFIG_H */
1473 _______EOF
1474
1475
1476         if cmp -s $outfile gdk/gdkconfig.h; then
1477           AC_MSG_NOTICE([gdk/gdkconfig.h is unchanged])
1478           rm -f $outfile
1479         else
1480           mv $outfile gdk/gdkconfig.h
1481         fi
1482 ],[
1483 if test "x$gdktarget" = "xx11" ; then
1484   gdk_windowing='
1485 #define GDK_WINDOWING_X11'
1486 elif test "x$gdktarget" = "xwin32" ; then
1487   gdk_windowing='
1488 #define GDK_WINDOWING_WIN32'
1489 elif test "x$gdktarget" = "xlinux-fb" ; then
1490   gdk_windowing='
1491 #define GDK_WINDOWING_FB
1492 #define GDK_NATIVE_WINDOW_POINTER'
1493 fi
1494
1495 if test x$gdk_wchar_h = xyes; then
1496   gdk_wc='
1497 #define GDK_HAVE_WCHAR_H 1'
1498 fi
1499 if test x$gdk_wctype_h = xyes; then
1500   gdk_wc="\$gdk_wc
1501 #define GDK_HAVE_WCTYPE_H 1"
1502 fi
1503 if test x$gdk_working_wctype = xno; then
1504   gdk_wc="\$gdk_wc
1505 #define GDK_HAVE_BROKEN_WCTYPE 1"
1506 fi
1507
1508
1509 ])
1510
1511 AC_PATH_PROG(SGML2HTML, sgml2html, no)
1512 AM_CONDITIONAL(HAVE_SGML2HTML, test x$SGML2HTML != xno)
1513
1514 AC_CONFIG_FILES([
1515 config.h.win32
1516 gtk-zip.sh
1517 Makefile
1518 gdk-pixbuf-2.0.pc
1519 gdk-2.0.pc
1520 gtk+-2.0.pc
1521 gdk-pixbuf-2.0-uninstalled.pc
1522 gdk-2.0-uninstalled.pc
1523 gtk+-2.0-uninstalled.pc
1524 m4macros/Makefile
1525 po/Makefile.in
1526 build/Makefile
1527 build/win32/Makefile
1528 build/win32/dirent/Makefile
1529 demos/Makefile
1530 demos/gtk-demo/Makefile
1531 demos/gtk-demo/geninclude.pl
1532 tests/Makefile
1533 docs/Makefile
1534 docs/reference/Makefile
1535 docs/reference/gdk-pixbuf/Makefile
1536 docs/reference/gdk-pixbuf/version.xml
1537 docs/reference/gdk/Makefile
1538 docs/reference/gdk/version.xml
1539 docs/reference/gtk/Makefile
1540 docs/reference/gtk/version.xml
1541 docs/faq/Makefile
1542 docs/tutorial/Makefile
1543 gdk-pixbuf/Makefile
1544 gdk-pixbuf/gdk_pixbuf.rc
1545 gdk-pixbuf/gdk-pixbuf-features.h
1546 gdk-pixbuf/pixops/Makefile
1547 gdk/Makefile
1548 gdk/x11/Makefile
1549 gdk/win32/Makefile
1550 gdk/win32/rc/Makefile
1551 gdk/win32/rc/gdk.rc
1552 gdk/linux-fb/Makefile
1553 gtk/Makefile
1554 gtk/makefile.msc
1555 gtk/gtkversion.h
1556 gtk/gtk-win32.rc
1557 gtk/stock-icons/Makefile
1558 gtk/theme-bits/Makefile
1559 modules/Makefile
1560 modules/input/Makefile
1561 contrib/Makefile
1562 contrib/gdk-pixbuf-xlib/Makefile
1563 contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlib-2.0.pc
1564 ])
1565
1566 AC_OUTPUT