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