]> Pileus Git - ~andy/gtk/blob - configure.in
Bug 99192 - Add --with-include-input-modules
[~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], [13])
15 m4_define([gtk_micro_version], [1])
16 m4_define([gtk_interface_age], [0])
17 m4_define([gtk_binary_age],
18           [m4_eval(100 * gtk_minor_version + gtk_micro_version)])
19 m4_define([gtk_version],
20           [gtk_major_version.gtk_minor_version.gtk_micro_version])
21 # This is the X.Y used in -lgtk-FOO-X.Y
22 m4_define([gtk_api_version], [2.0])
23
24 # Define a string for the earliest version that this release has
25 # backwards binary compatibility with for all interfaces a module
26 # might. Unless we add module-only API with lower stability
27 # guarantees, this should be unchanged until we break binary compat
28 # for GTK+.
29 #
30 #GTK_BINARY_VERSION=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION.$LT_CURRENT
31 m4_define([gtk_binary_version], [2.10.0])
32
33 # required versions of other packages
34 m4_define([glib_required_version], [2.15.0])
35 m4_define([pango_required_version], [1.19.3])
36 m4_define([atk_required_version], [1.13.0])
37 m4_define([cairo_required_version], [1.2.0])
38
39
40 AC_INIT([gtk+], [gtk_version],
41         [http://bugzilla.gnome.org/enter_bug.cgi?product=gtk%2B],
42         [gtk+])
43
44 AC_CONFIG_SRCDIR([gdk/gdktypes.h])
45
46 # Save this value here, since automake will set cflags later
47 cflags_set=${CFLAGS+set}
48
49 AM_INIT_AUTOMAKE(no-define)
50 AM_CONFIG_HEADER(config.h)
51
52 #
53 # For each of the libraries we build, we define the following
54  
55 # substituted variables:
56 #
57 # foo_PACKAGES:     pkg-config packages this library requires
58 # foo_EXTRA_LIBS:   Libraries this module requires not pulled in by pkg-config
59 # foo_EXTRA_CFLAGS: cflags this module requires not pulled in by pkg-config
60 # foo_DEP_LIBS:     All libraries this module requires
61 # foo_DEP_CFLAGS:   All cflags this module requires
62
63
64 GTK_MAJOR_VERSION=gtk_major_version
65 GTK_MINOR_VERSION=gtk_minor_version
66 GTK_MICRO_VERSION=gtk_micro_version
67 GTK_INTERFACE_AGE=gtk_interface_age
68 GTK_BINARY_AGE=gtk_binary_age
69 GTK_VERSION=gtk_version
70 GTK_API_VERSION=gtk_api_version
71 GTK_BINARY_VERSION=gtk_binary_version
72 AC_SUBST(GTK_MAJOR_VERSION)
73 AC_SUBST(GTK_MINOR_VERSION)
74 AC_SUBST(GTK_MICRO_VERSION)
75 AC_SUBST(GTK_INTERFACE_AGE)
76 AC_SUBST(GTK_BINARY_AGE)
77 AC_SUBST(GTK_API_VERSION)
78 AC_SUBST(GTK_VERSION)
79 AC_SUBST(GTK_BINARY_VERSION)
80
81 # libtool versioning
82 #LT_RELEASE=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION
83 #LT_CURRENT=`expr $GTK_MICRO_VERSION - $GTK_INTERFACE_AGE`
84 #LT_REVISION=$GTK_INTERFACE_AGE
85 #LT_AGE=`expr $GTK_BINARY_AGE - $GTK_INTERFACE_AGE`
86 #LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
87
88 m4_define([lt_current], [m4_eval(100 * gtk_minor_version + gtk_micro_version - gtk_interface_age)])
89 m4_define([lt_revision], [gtk_interface_age])
90 m4_define([lt_age], [m4_eval(gtk_binary_age - gtk_interface_age)])
91 LT_VERSION_INFO="lt_current:lt_revision:lt_age"
92 LT_CURRENT_MINUS_AGE=m4_eval(lt_current - lt_age)
93 AC_SUBST(LT_VERSION_INFO)
94 AC_SUBST(LT_CURRENT_MINUS_AGE)
95
96 m4_define([gail_lt_current],[18])
97 m4_define([gail_lt_revision],[1])
98 m4_define([gail_lt_age],[0])
99 m4_define([gail_lt_version_info],[gail_lt_current:gail_lt_revision:gail_lt_age])
100 m4_define([gail_lt_current_minus_age],[m4_eval(gail_lt_current - gail_lt_age)])
101 AC_SUBST([GAIL_LT_VERSION_INFO],[gail_lt_version_info])
102 AC_SUBST([GAIL_LT_CURRENT_MINUS_AGE],[gail_lt_current_minus_age])
103
104 #
105 # gdk-pixbuf gets versioned separately, and for now, using standard
106 # libtool versioning, not GTK+-style versioning
107 #
108 GDK_PIXBUF_MAJOR=gtk_major_version
109 GDK_PIXBUF_MINOR=gtk_minor_version
110 GDK_PIXBUF_MICRO=gtk_micro_version
111 GDK_PIXBUF_VERSION="${GDK_PIXBUF_MAJOR}.${GDK_PIXBUF_MINOR}.${GDK_PIXBUF_MICRO}"
112 AC_SUBST(GDK_PIXBUF_MAJOR)
113 AC_SUBST(GDK_PIXBUF_MINOR)
114 AC_SUBST(GDK_PIXBUF_MICRO)
115 AC_SUBST(GDK_PIXBUF_VERSION)
116
117 GETTEXT_PACKAGE=gtk20
118 AC_SUBST(GETTEXT_PACKAGE)
119 AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE",
120                    [The prefix for our gettext translation domains.])
121
122 AC_CANONICAL_HOST
123
124 MATH_LIB=-lm
125 AC_MSG_CHECKING([for native Win32])
126 case "$host" in
127   *-*-mingw*)
128     os_win32=yes
129     MATH_LIB=
130     ;;
131   *)
132     os_win32=no
133     ;;
134 esac
135 AC_MSG_RESULT([$os_win32])
136
137 case $host in
138   *-*-linux*)
139     os_linux=yes
140     ;;
141 esac
142 dnl Initialize libtool
143 AC_PROG_CC
144 AM_DISABLE_STATIC
145
146 dnl 
147 dnl Check for a working C++ compiler, but do not bail out, if none is found.
148 dnl We use this for an automated test for C++ header correctness.
149 dnl 
150 AC_CHECK_PROGS(CXX, [$CCC c++ g++ gcc CC cxx cc++ cl], gcc)
151 AC_LANG_SAVE
152 AC_LANG_CPLUSPLUS
153
154 AC_TRY_COMPILE(,[class a { int b; } c;], ,CXX=)
155 AM_CONDITIONAL(HAVE_CXX, test "$CXX" != "")
156
157 gtk_save_cxxflags="$CXXFLAGS"
158 CXXFLAGS="$CXXFLAGS -x objective-c++"
159 AC_TRY_COMPILE([@interface Foo @end],,OBJC=yes,OBJC=no)
160 AM_CONDITIONAL(HAVE_OBJC, test "$OBJC" = "yes")
161 CXXFLAGS="$gtk_save_cxxflags"
162 AC_LANG_RESTORE
163
164 if test "$os_win32" = "yes"; then
165   if test x$enable_static = xyes -o x$enable_static = x; then
166     AC_MSG_WARN([Disabling static library build, must build as DLL on Windows.])
167     enable_static=no
168   fi
169   if test x$enable_shared = xno; then
170     AC_MSG_WARN([Enabling shared library build, must build as DLL on Windows.])
171   fi
172   enable_shared=yes
173 fi
174
175 AC_LIBTOOL_WIN32_DLL
176 AM_PROG_LIBTOOL
177
178 # Make sure we use 64-bit versions of various file stuff.
179 AC_SYS_LARGEFILE
180
181 AM_PROG_AS
182 AC_PATH_PROG(NM, nm, nm)
183
184 dnl Initialize maintainer mode
185 AM_MAINTAINER_MODE
186
187 AC_MSG_CHECKING([for some Win32 platform])
188 case "$host" in
189   *-*-mingw*|*-*-cygwin*)
190     platform_win32=yes
191     ;;
192   *)
193     platform_win32=no
194     ;;
195 esac
196 AC_MSG_RESULT([$platform_win32])
197 AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")
198
199 AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
200 AM_CONDITIONAL(OS_UNIX, test "$os_win32" != "yes")
201 AM_CONDITIONAL(OS_LINUX, test "$os_linux" = "yes")
202
203 if test "$os_win32" = "yes"; then
204   AC_CHECK_TOOL(WINDRES, windres, no)
205   if test "$WINDRES" = no; then
206     AC_MSG_ERROR([*** Could not find an implementation of windres in your PATH.])
207   fi
208   AC_CHECK_PROG(ms_librarian, lib.exe, yes, no)
209 fi
210 AM_CONDITIONAL(MS_LIB_AVAILABLE, test x$ms_librarian = xyes)
211
212 m4_define([debug_default],
213           m4_if(m4_eval(gtk_minor_version % 2), [1], [yes], [minimum]))
214
215 dnl declare --enable-* args and collect ac_help strings
216 AC_ARG_ENABLE(debug,
217               AC_HELP_STRING([--enable-debug=@<:@no/minimum/yes@:>@],
218                              [turn on debugging @<:@default=debug_default@:>@]),,
219               enable_debug=debug_default)
220 AC_ARG_ENABLE(shm,
221               [AC_HELP_STRING([--enable-shm],
222                               [support shared memory if available [default=yes]])],,
223               [enable_shm="yes"])
224 AC_ARG_ENABLE(xkb,
225               [AC_HELP_STRING([--enable-xkb],
226                               [support XKB [default=maybe]])],,
227               [enable_xkb="maybe"])
228 AC_ARG_ENABLE(xinerama,
229               [AC_HELP_STRING([--enable-xinerama],
230                               [support xinerama extension if available [default=yes]])],,
231               [enable_xinerama="no"])
232 AC_ARG_ENABLE(rebuilds,
233               [AC_HELP_STRING([--disable-rebuilds],
234                               [disable all source autogeneration rules])],,
235               [enable_rebuilds=yes])
236 AC_ARG_ENABLE(visibility,
237               [AC_HELP_STRING([--disable-visibility],
238                               [don't use ELF visibility attributes])],,
239               [enable_visibility=yes])
240
241 AC_ARG_WITH(xinput,
242             [AC_HELP_STRING([--with-xinput=@<:@no/yes@:>@], [support XInput])])
243
244 if test "$platform_win32" = yes; then
245   gdktarget=win32
246 else
247   gdktarget=x11
248 fi
249
250 AC_ARG_WITH(gdktarget, [  --with-gdktarget=[[x11/win32/quartz/directfb]] select non-default GDK target],
251         gdktarget=$with_gdktarget)
252
253 AC_SUBST(gdktarget)
254 case $gdktarget in
255   x11|win32|quartz|directfb) ;;
256   *) AC_MSG_ERROR([Invalid target for GDK: use x11, quartz, directfb or win32.]);;
257 esac
258
259 gdktargetlib=libgdk-$gdktarget-$GTK_API_VERSION.la
260 gtktargetlib=libgtk-$gdktarget-$GTK_API_VERSION.la
261
262 AC_SUBST(gdktargetlib)
263 AC_SUBST(gtktargetlib)
264
265 if test "x$enable_debug" = "xyes"; then
266   test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
267   GTK_DEBUG_FLAGS="-DG_ENABLE_DEBUG -DG_ERRORCHECK_MUTEXES" 
268 else
269   if test "x$enable_debug" = "xno"; then
270     GTK_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS"
271   else
272     GTK_DEBUG_FLAGS="-DG_DISABLE_CAST_CHECKS"
273   fi
274 fi
275
276
277 if test "x$enable_visibility" = "xno"; then
278   GTK_DEBUG_FLAGS="$GTK_DEBUG_FLAGS -DDISABLE_VISIBILITY"
279 fi
280
281
282 AC_DEFINE_UNQUOTED(GTK_COMPILED_WITH_DEBUGGING, "${enable_debug}",
283                    [Define if debugging is enabled])
284
285                         
286 # Build time sanity check...
287 AM_SANITY_CHECK
288
289 # Checks for programs.
290 AC_ISC_POSIX
291 AM_PROG_CC_STDC
292 AC_PROG_INSTALL
293 AC_PROG_MAKE_SET
294
295 changequote(,)dnl
296 if test "x$GCC" = "xyes"; then
297   case " $CFLAGS " in
298   *[\ \ ]-Wall[\ \      ]*) ;;
299   *) CFLAGS="$CFLAGS -Wall" ;;
300   esac
301
302   if test "x$enable_ansi" = "xyes"; then
303     case " $CFLAGS " in
304     *[\ \       ]-ansi[\ \      ]*) ;;
305     *) CFLAGS="$CFLAGS -ansi" ;;
306     esac
307
308     case " $CFLAGS " in
309     *[\ \       ]-pedantic[\ \  ]*) ;;
310     *) CFLAGS="$CFLAGS -pedantic" ;;
311     esac
312   fi
313 fi
314 changequote([,])dnl
315
316 # Ensure MSVC-compatible struct packing convention is used when
317 # compiling for Win32 with gcc.
318 # What flag to depends on gcc version: gcc3 uses "-mms-bitfields", while
319 # gcc2 uses "-fnative-struct".
320 if test x"$os_win32" = xyes; then
321   if test x"$GCC" = xyes; then
322     msnative_struct=''
323     AC_MSG_CHECKING([how to get MSVC-compatible struct packing])
324     if test -z "$ac_cv_prog_CC"; then
325       our_gcc="$CC"
326     else
327       our_gcc="$ac_cv_prog_CC"
328     fi
329     case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in
330       2.)
331         if $our_gcc -v --help 2>/dev/null | grep fnative-struct >/dev/null; then
332           msnative_struct='-fnative-struct'
333         fi
334         ;;
335       *)
336         if $our_gcc -v --help 2>/dev/null | grep ms-bitfields >/dev/null; then
337           msnative_struct='-mms-bitfields'
338         fi
339         ;;
340     esac
341     if test x"$msnative_struct" = x ; then
342       AC_MSG_RESULT([no way])
343       AC_MSG_WARN([produced libraries might be incompatible with MSVC-compiled code])
344     else
345       CFLAGS="$CFLAGS $msnative_struct"
346       AC_MSG_RESULT([${msnative_struct}])
347     fi
348   fi
349 fi
350
351 # Honor aclocal flags
352 ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
353
354 ## Initial sanity check, done here so that users get told they 
355 ## have the wrong dependencies as early in the process as possible.
356 ## Later on we actually use the cflags/libs from separate pkg-config
357 ## calls. Oh, also the later pkg-config calls don't include 
358 ## the version requirements since those make the module lists 
359 ## annoying to construct
360 PKG_CHECK_MODULES(BASE_DEPENDENCIES,
361   [glib-2.0 >= glib_required_version dnl
362    atk >= atk_required_version dnl
363    pango >= pango_required_version dnl
364    cairo >= cairo_required_version])
365
366 if test "$os_win32" != yes; then
367     # libtool option to control which symbols are exported
368     # right now, symbols starting with _ are not exported
369     LIBTOOL_EXPORT_OPTIONS='-export-symbols-regex "^[[^_]].*"'
370 else
371     # We currently use .def files on Windows (for gdk-pixbuf, gdk and gtk)
372     LIBTOOL_EXPORT_OPTIONS=
373 fi
374 AC_SUBST(LIBTOOL_EXPORT_OPTIONS)
375
376 dnl ******************************************************
377 dnl * See whether to include shared library dependencies *
378 dnl ******************************************************
379
380 AC_ARG_ENABLE(explicit-deps, 
381               [AC_HELP_STRING([--enable-explicit-deps=@<:@yes/no/auto@:>@],
382                               [use explicit dependencies in .pc files [default=auto]])],,
383               [enable_explicit_deps=auto])
384
385 AC_MSG_CHECKING([Whether to write dependencies into .pc files])
386 case $enable_explicit_deps in
387   auto)
388     export SED
389     deplibs_check_method=`(./libtool --config; echo 'eval echo $deplibs_check_method') | sh`
390     if test "x$deplibs_check_method" '!=' xpass_all || test "x$enable_static" = xyes ; then
391       enable_explicit_deps=yes  
392     else
393       enable_explicit_deps=no  
394     fi
395   ;;
396   yes|no) 
397   ;;
398   *) AC_MSG_ERROR([Value given to --enable-explicit-deps must be one of yes, no or auto])
399   ;;
400 esac
401 AC_MSG_RESULT($enable_explicit_deps)
402
403 AM_CONDITIONAL(DISABLE_EXPLICIT_DEPS, test $enable_explicit_deps = no)
404
405 # define a MAINT-like variable REBUILD which is set if Perl
406 # and awk are found, so autogenerated sources can be rebuilt
407
408 AC_PATH_PROGS(PERL, perl5 perl)
409
410 # We would like indent, but don't require it.
411 AC_CHECK_PROG(INDENT, indent, indent)
412
413 REBUILD=\#
414 if test "x$enable_rebuilds" = "xyes" && \
415      test -n "$PERL" && \
416      $PERL -e 'exit !($] >= 5.002)' > /dev/null 2>&1 ; then
417   REBUILD=
418 fi
419 AC_SUBST(REBUILD)
420
421 AC_CHECK_FUNCS(lstat mkstemp flockfile getc_unlocked)
422 AC_CHECK_FUNCS(localtime_r)
423
424 # _NL_TIME_FIRST_WEEKDAY is an enum and not a define
425 AC_MSG_CHECKING([for _NL_TIME_FIRST_WEEKDAY])
426 AC_TRY_LINK([#include <langinfo.h>], [
427 char c;
428 c = *((unsigned char *)  nl_langinfo(_NL_TIME_FIRST_WEEKDAY));
429 ], gtk_ok=yes, gtk_ok=no)
430 AC_MSG_RESULT($gtk_ok)
431 if test "$gtk_ok" = "yes"; then
432   AC_DEFINE([HAVE__NL_TIME_FIRST_WEEKDAY], [1],
433             [Define if _NL_TIME_FIRST_WEEKDAY is available])
434 fi
435
436 # _NL_MEASUREMENT_MEASUREMENT is an enum and not a define
437 AC_MSG_CHECKING([for _NL_MEASUREMENT_MEASUREMENT])
438 AC_TRY_LINK([#include <langinfo.h>], [
439 char c;
440 c = *((unsigned char *)  nl_langinfo(_NL_MEASUREMENT_MEASUREMENT));
441 ], gtk_ok=yes, gtk_ok=no)
442 AC_MSG_RESULT($gtk_ok)
443 if test "$gtk_ok" = "yes"; then
444   AC_DEFINE([HAVE__NL_MEASUREMENT_MEASUREMENT], [1],
445             [Define if _NL_MEASUREMENT_MEASUREMENT is available])
446 fi
447
448 # _NL_PAPER_HEIGHT is an enum and not a define
449 AC_MSG_CHECKING([for _NL_PAPER_HEIGHT])
450 AC_TRY_LINK([#include <langinfo.h>], [
451 char c;
452 c = *((unsigned char *)  nl_langinfo(_NL_PAPER_HEIGHT));
453 ], gtk_ok=yes, gtk_ok=no)
454 AC_MSG_RESULT($gtk_ok)
455 if test "$gtk_ok" = "yes"; then
456   AC_DEFINE([HAVE__NL_PAPER_HEIGHT], [1],
457             [Define if _NL_PAPER_HEIGHT is available])
458 fi
459
460 # _NL_PAPER_WIDTH is an enum and not a define
461 AC_MSG_CHECKING([for _NL_PAPER_WIDTH])
462 AC_TRY_LINK([#include <langinfo.h>], [
463 char c;
464 c = *((unsigned char *)  nl_langinfo(_NL_PAPER_WIDTH));
465 ], gtk_ok=yes, gtk_ok=no)
466 AC_MSG_RESULT($gtk_ok)
467 if test "$gtk_ok" = "yes"; then
468   AC_DEFINE([HAVE__NL_PAPER_WIDTH], [1],
469             [Define if _NL_PAPER_WIDTH is available])
470 fi
471         
472 # sigsetjmp is a macro on some platforms, so AC_CHECK_FUNCS is not reliable
473 AC_MSG_CHECKING(for sigsetjmp)
474 AC_TRY_LINK([#include <setjmp.h>], [
475 sigjmp_buf env;
476 sigsetjmp(env, 0);
477 ], gtk_ok=yes, gtk_ok=no)
478 AC_MSG_RESULT($gtk_ok)
479 if test "$gtk_ok" = "yes"; then
480   AC_DEFINE(HAVE_SIGSETJMP, 1,
481             [Define to 1 if sigsetjmp is available])
482 fi
483
484 # i18n stuff
485 # TRANSLATORS:  Please note that gtk+ has both po/ and po-properties/
486 # directories.  If you add a new language to ALL_LINGUAS, please make
487 # sure that both po/ and po-properties/ have .po files that correspond
488 # to your language.  If you only add one to po/, the build will break
489 # in po-properties/.
490 ALL_LINGUAS="af am ang ar as az az_IR be be@latin bg bn bn_IN br bs ca ca@valencia cs cy da de dz el en_CA en_GB eo es et eu fa fi fr ga gl gu he hi hr hu hy ia id io is it ja ka kn ko ku li lt lv mi mk ml mn mr ms nb ne nl nn nso oc or pa pl pt pt_BR ro ru rw si sk sl sq sr sr@Latn sr@ije sv ta te th tk tr tt uk ur uz uz@cyrillic vi wa xh yi zh_CN zh_HK zh_TW"
491 AM_GLIB_GNU_GETTEXT
492 LIBS="$LIBS $INTLLIBS"
493 AC_OUTPUT_COMMANDS([case "$CONFIG_FILES" in *po-properties/Makefile.in*)
494         sed -e "/POTFILES =/r po-properties/POTFILES" po-properties/Makefile.in > po-properties/Makefile
495       esac])
496
497 AM_GLIB_DEFINE_LOCALEDIR(GTK_LOCALEDIR)
498
499 dnl The DU4 header files don't provide library prototypes unless 
500 dnl -std1 is given to the native cc.
501 AC_MSG_CHECKING([for extra flags to get ANSI library prototypes])
502
503 gtk_save_LIBS=$LIBS
504 LIBS="$LIBS -lm"
505 AC_TRY_RUN([#include <math.h>
506              int main (void) { return (log(1) != log(1.)); }],
507      AC_MSG_RESULT(none needed),
508      gtk_save_CFLAGS="$CFLAGS"
509      CFLAGS="$CFLAGS -std1"
510      AC_TRY_RUN([#include <math.h>
511                  int main (void) { return (log(1) != log(1.)); }],
512          AC_MSG_RESULT(-std1),
513          AC_MSG_RESULT()
514          CFLAGS="$gtk_save_CFLAGS"
515          AC_MSG_WARN(
516                 [No ANSI prototypes found in library. (-std1 didn't work.)]),
517          true
518      ),
519      AC_MSG_RESULT(none needed)
520 )
521 LIBS=$gtk_save_LIBS
522
523 AC_MSG_CHECKING(for the BeOS)
524 case $host in
525   *-*-beos*)
526     AC_MSG_RESULT(yes)
527     MATH_LIB=
528   ;;
529   *)
530     AC_MSG_RESULT(no)
531   ;;
532 esac
533
534 #
535 # see bug 162979
536 #
537 AC_MSG_CHECKING(for HP-UX)
538 case $host_os in
539   hpux9* | hpux10* | hpux11*)
540     AC_MSG_RESULT(yes)
541     CFLAGS="$CFLAGS -DHPPEX -DSHMLINK"
542   ;;
543   *)
544     AC_MSG_RESULT(no)
545   ;;
546 esac
547
548 dnl NeXTStep cc seems to need this
549 AC_MSG_CHECKING([for extra flags for POSIX compliance])
550 AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
551   AC_MSG_RESULT(none needed),
552   gtk_save_CFLAGS="$CFLAGS"
553   CFLAGS="$CFLAGS -posix"
554   AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
555     AC_MSG_RESULT(-posix),
556     AC_MSG_RESULT()
557     CFLAGS="$gtk_save_CFLAGS"
558     AC_MSG_WARN([Could not determine POSIX flag. (-posix didn't work.)])))
559
560 #
561 # Run AM_PATH_GLIB_2_0 to make sure that GLib is installed and working
562
563
564 GLIB_PACKAGES="gobject-2.0 gmodule-no-export-2.0"
565
566 AM_PATH_GLIB_2_0(glib_required_version, :,
567   AC_MSG_ERROR([
568 *** GLIB glib_required_version or better is required. The latest version of 
569 *** GLIB is always available from ftp://ftp.gtk.org/pub/gtk/.]),
570   gobject gmodule-no-export gthread)
571
572 # See if it's safe to turn G_DISABLE_DEPRECATED on.
573 GLIB_VERSION_MAJOR_MINOR=`$PKG_CONFIG --modversion glib-2.0 | sed "s/\.@<:@^.@:>@*\$//"`
574 GLIB_REQUIRED_VERSION_MAJOR_MINOR=`echo glib_required_version | sed "s/\.@<:@^.@:>@*\$//"`
575 if test "x$GLIB_VERSION_MAJOR_MINOR" = "x$GLIB_REQUIRED_VERSION_MAJOR_MINOR"; then
576   CFLAGS="-DG_DISABLE_DEPRECATED $CFLAGS"
577 fi
578
579
580 dnl
581 dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
582 dnl
583 gtk_save_LIBS=$LIBS
584 LIBS="$LIBS $GLIB_LIBS"
585 AC_CHECK_FUNCS(bind_textdomain_codeset)
586 LIBS=$gtk_save_LIBS
587
588 AC_CHECK_HEADERS(pwd.h,
589                  AC_DEFINE(HAVE_PWD_H, 1,
590                            [Define to 1 if pwd.h is available]))
591 AC_CHECK_HEADERS(sys/time.h,
592                  AC_DEFINE(HAVE_SYS_TIME_H, 1,
593                            [Define to 1 if time.h is available]))
594 AC_CHECK_HEADERS(unistd.h,
595                  AC_DEFINE(HAVE_UNISTD_H, 1,
596                            [Define to 1 if unistd.h is available]))
597 AC_CHECK_HEADERS(ftw.h,
598                  AC_DEFINE(HAVE_FTW_H, 1,
599                            [Define to 1 if ftw.h is available]))
600
601 AC_MSG_CHECKING([for GNU ftw extensions])
602 AC_TRY_COMPILE([#define _XOPEN_SOURCE 500
603 #define _GNU_SOURCE
604 #include <ftw.h>], [int flags = FTW_ACTIONRETVAL;], gtk_ok=yes, gtk_ok=no)
605 if test $gtk_ok = yes; then
606     AC_MSG_RESULT([yes])
607     AC_DEFINE(HAVE_GNU_FTW, 1, [Have GNU ftw])
608 else
609     AC_MSG_RESULT([no])
610 fi
611
612 saved_cflags="$CFLAGS"
613 saved_ldflags="$LDFLAGS"
614
615
616 # Checks for header files.
617 AC_HEADER_STDC
618
619 # Checks for typedefs, structures, and compiler characteristics.
620 AC_C_CONST
621
622 # Checks for library functions.
623 AC_TYPE_SIGNAL
624 AC_FUNC_MMAP
625
626 AC_CHECK_FUNCS(mallinfo)
627 AC_CHECK_FUNCS(getresuid)
628 AC_TYPE_UID_T
629
630 # Check if <sys/select.h> needs to be included for fd_set
631 AC_MSG_CHECKING([for fd_set])
632 AC_TRY_COMPILE([#include <sys/types.h>],
633         [fd_set readMask, writeMask;], gtk_ok=yes, gtk_ok=no)
634 if test $gtk_ok = yes; then
635     AC_MSG_RESULT([yes, found in sys/types.h])
636 else
637     AC_HEADER_EGREP(fd_mask, sys/select.h, gtk_ok=yes)
638     if test $gtk_ok = yes; then
639         AC_DEFINE(HAVE_SYS_SELECT_H, 1,
640                   [Define to 1 if sys/select.h is available])
641         AC_MSG_RESULT([yes, found in sys/select.h])
642     else
643         AC_DEFINE(NO_FD_SET, 1,
644                   [Define to 1 if fd_set is not available])
645         AC_MSG_RESULT(no)
646     fi
647 fi
648
649 # `widechar' tests for gdki18n.h
650 AC_MSG_CHECKING(for wchar.h)
651 AC_TRY_CPP([#include <wchar.h>], gdk_wchar_h=yes, gdk_wchar_h=no)
652 if test $gdk_wchar_h = yes; then
653    AC_DEFINE(HAVE_WCHAR_H, 1, [Have wchar.h include file])
654 fi
655 AC_MSG_RESULT($gdk_wchar_h)
656
657 # Check for wctype.h (for iswalnum)
658 AC_MSG_CHECKING(for wctype.h)
659 AC_TRY_CPP([#include <wctype.h>], gdk_wctype_h=yes, gdk_wctype_h=no)
660 if test $gdk_wctype_h = yes; then
661    AC_DEFINE(HAVE_WCTYPE_H, 1, [Have wctype.h include file])
662 fi
663 AC_MSG_RESULT($gdk_wctype_h)
664
665 # in Solaris 2.5, `iswalnum' is in -lw
666 GDK_WLIBS=
667 AC_CHECK_FUNC(iswalnum,,[AC_CHECK_LIB(w,iswalnum,GDK_WLIBS=-lw)])
668
669 oLIBS="$LIBS"
670 LIBS="$LIBS $GDK_WLIBS"
671 # The following is necessary for Linux libc-5.4.38
672 AC_MSG_CHECKING(if iswalnum() and friends are properly defined)
673 AC_TRY_LINK([#include <stdlib.h>],[
674 #if (defined(HAVE_WCTYPE_H) || defined(HAVE_WCHAR_H))
675 #  ifdef HAVE_WCTYPE_H
676 #    include <wctype.h>
677 #  else
678 #    ifdef HAVE_WCHAR_H
679 #      include <wchar.h>
680 #    endif
681 #  endif
682 #else
683 #  define iswalnum(c) ((wchar_t)(c) <= 0xFF && isalnum(c))
684 #endif
685 iswalnum((wchar_t) 0);
686 ], gdk_working_wctype=yes, gdk_working_wctype=no)
687 LIBS="$oLIBS"
688
689 if test $gdk_working_wctype = no; then
690    AC_DEFINE(HAVE_BROKEN_WCTYPE, 1, [Is the wctype implementation broken])
691    GDK_WLIBS=
692 fi
693 AC_MSG_RESULT($gdk_working_wctype)
694 AC_SUBST(GDK_WLIBS)
695
696 # Check for uxtheme.h (for MS-Windows Engine)
697 AC_MSG_CHECKING(for uxtheme.h)
698 AC_TRY_CPP([#include <uxtheme.h>], gtk_uxtheme_h=yes, gtk_uxtheme_h=no)
699 if test $gtk_uxtheme_h = yes; then
700    AC_DEFINE(HAVE_UXTHEME_H, 1, [Have uxtheme.h include file])
701 fi
702 AC_MSG_RESULT($gtk_uxtheme_h)
703
704 # Checks for gdkspawn
705 AC_CHECK_HEADERS(crt_externs.h)
706 AC_CHECK_FUNCS(_NSGetEnviron)
707
708
709 ##################################################
710 # Checks for gdk-pixbuf
711 ##################################################
712
713 dnl ********************************************************
714 dnl * See whether we need to load our modules as .la files *
715 dnl ********************************************************
716
717 use_la_modules=false
718 case $host in
719   *-aix*) use_la_modules=true
720 esac
721
722 if $use_la_modules ; then
723    AC_DEFINE(USE_LA_MODULES, 1,
724              [Whether to load modules via .la files rather than directly])
725 fi
726
727
728 AC_MSG_CHECKING(whether to build gmodulized gdk-pixbuf)
729
730 AC_ARG_ENABLE(modules,
731               [AC_HELP_STRING([--disable-modules],
732                               [disable dynamic module loading])])
733
734 dynworks=false
735 deps=
736 if test x$enable_modules = xno; then
737     AC_MSG_RESULT(no)
738 else
739     AC_MSG_RESULT(yes)
740     AC_MSG_CHECKING(whether dynamic modules work)
741     ## for loop is to strip newline 
742     tmp=`$PKG_CONFIG --variable=gmodule_supported gmodule-no-export-2.0`
743     for I in $tmp; do
744         dynworks=$I
745     done
746
747     dnl Now we check to see if our libtool supports shared lib deps
748     dnl (in a rather ugly way even)
749     if $dynworks; then
750         pixbuf_libtool_config="${CONFIG_SHELL-/bin/sh} ./libtool --config"
751         pixbuf_deplibs_check=`$pixbuf_libtool_config | \
752             grep '^[[a-z_]]*check[[a-z_]]*_method=[['\''"]]' | \
753             sed 's/.*[['\''"]]\(.*\)[['\''"]]$/\1/'`
754         if test "x$pixbuf_deplibs_check" = "xnone" || \
755            test "x$pixbuf_deplibs_check" = "xunknown" || \
756            test "x$pixbuf_deplibs_check" = "x"; then
757             dynworks=false
758         fi
759     fi
760
761     if $dynworks; then
762         AC_DEFINE(USE_GMODULE, 1,
763                   [Define to 1 if gmodule works and should be used])
764         AC_MSG_RESULT(yes)
765     else
766         AC_MSG_RESULT(no)
767     fi
768 fi
769
770 dnl We allow people to disable image loaders explicitely, but if they don't we error
771 dnl out so that people don't accidentally build without them.
772
773 AC_ARG_WITH(libpng,
774             [AC_HELP_STRING([--without-libpng],
775                             [disable PNG loader for gdk-pixbuf])])
776 AC_ARG_WITH(libjpeg,
777             [AC_HELP_STRING([--without-libjpeg],
778                             [disable JPEG loader for gdk-pixbuf])])
779 AC_ARG_WITH(libtiff,
780             [AC_HELP_STRING([--without-libtiff],
781                             [disable TIFF loader for gdk-pixbuf])])
782 AC_ARG_WITH(libjasper,
783             [AC_HELP_STRING([--without-libjasper],
784                             [disable JPEG2000 loader for gdk-pixbuf])])
785
786 dnl Test for libtiff
787   if test x$with_libtiff != xno && test -z "$LIBTIFF"; then
788     AC_CHECK_LIB(tiff, TIFFReadRGBAImageOriented,
789       [AC_CHECK_HEADER(tiffio.h,
790         TIFF='tiff'; LIBTIFF='-ltiff',
791         AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))],
792       [AC_CHECK_LIB(tiff, TIFFWriteScanline,
793         [AC_CHECK_HEADER(tiffio.h,
794           TIFF='tiff'; LIBTIFF='-ltiff -ljpeg -lz',
795           AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))],
796         [AC_CHECK_LIB(tiff34, TIFFFlushData,
797           [AC_CHECK_HEADER(tiffio.h,
798             TIFF='tiff'; LIBTIFF='-ltiff34 -ljpeg -lz',
799             AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))],
800         AC_MSG_WARN(*** TIFF loader will not be built (TIFF library not found) ***), -ljpeg -lz -lm)], -ljpeg -lz -lm)], -lm)
801   fi
802
803   if test x$with_libtiff != xno && test -z "$LIBTIFF"; then
804      AC_MSG_ERROR([
805 *** Checks for TIFF loader failed. You can build without it by passing 
806 *** --without-libtiff to configure but some programs using GTK+ may
807 *** not work properly])
808   fi
809
810 dnl Test for libjpeg
811   if test x$with_libjpeg != xno && test -z "$LIBJPEG"; then
812     AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
813       jpeg_ok=yes,
814       jpeg_ok=no
815       AC_MSG_WARN(*** JPEG loader will not be built (JPEG library not found) ***))
816     if test "$jpeg_ok" = yes; then
817       AC_MSG_CHECKING([for jpeglib.h])
818       AC_TRY_CPP(
819 [#include <stdio.h>
820 #undef PACKAGE
821 #undef VERSION
822 #undef HAVE_STDLIB_H
823 #include <jpeglib.h>],
824         jpeg_ok=yes,
825         jpeg_ok=no)
826       AC_MSG_RESULT($jpeg_ok)
827       if test "$jpeg_ok" = yes; then
828         LIBJPEG='-ljpeg'
829         AC_CHECK_LIB(jpeg, jpeg_simple_progression,     
830           AC_DEFINE(HAVE_PROGRESSIVE_JPEG, 1,
831                     [Define to 1 is libjpeg supports progressive JPEG]),
832           AC_MSG_WARN(JPEG library does not support progressive saving.))
833       else
834           AC_MSG_WARN(*** JPEG loader will not be built (JPEG header file not found) ***)
835       fi
836     fi
837   fi
838
839   if test x$with_libjpeg != xno && test -z "$LIBJPEG"; then
840      AC_MSG_ERROR([
841 *** Checks for JPEG loader failed. You can build without it by passing 
842 *** --without-libjpeg to configure but some programs using GTK+ may
843 *** not work properly])
844   fi
845
846 dnl Test for libpng
847   if test x$with_libpng != xno && test -z "$LIBPNG"; then
848     AC_MSG_CHECKING(for libpng12)
849     if $PKG_CONFIG --exists libpng12 ; then
850         AC_MSG_RESULT(yes)
851         PNG='png'
852         PNG_DEP_CFLAGS_PACKAGES=libpng12
853         LIBPNG=`$PKG_CONFIG --libs libpng12`
854     else
855       AC_MSG_RESULT(no)
856       AC_CHECK_LIB(png, png_read_info,
857         [AC_CHECK_HEADER(png.h,
858           png_ok=yes,
859           png_ok=no)],
860         AC_MSG_WARN(*** PNG loader will not be built (PNG library not found) ***), -lz -lm)
861       if test "$png_ok" = yes; then
862         AC_MSG_CHECKING([for png_structp in png.h])
863         AC_TRY_COMPILE([#include <png.h>],
864           [png_structp pp; png_infop info; png_colorp cmap; png_create_read_struct;],
865           png_ok=yes,
866           png_ok=no)
867         AC_MSG_RESULT($png_ok)
868         if test "$png_ok" = yes; then
869           PNG='png'; LIBPNG='-lpng -lz'
870         else
871           AC_MSG_WARN(*** PNG loader will not be built (PNG library is too old) ***)
872         fi
873       else
874        AC_MSG_WARN(*** PNG loader will not be built (PNG header file not found) ***)
875       fi
876     fi
877   fi
878
879   if test x$with_libpng != xno && test -z "$LIBPNG"; then
880      AC_MSG_ERROR([
881 *** Checks for PNG loader failed. You can build without it by passing 
882 *** --without-libpng to configure but many programs using GTK+ will
883 *** not work properly. The PNG loader is also needed if you are compiling
884 *** from CVS.])
885   fi
886
887 dnl Test for libjasper
888   if test x$with_libjasper != xno && test -z "$LIBJASPER"; then
889     AC_CHECK_LIB(jasper, jas_init, LIBJASPER=-ljasper, [])
890   fi
891
892   if test x$with_libjasper != xno && test -z "$LIBJASPER"; then
893      AC_MSG_ERROR([
894 *** Checks for JPEG2000 loader failed. You can build without it by passing 
895 *** --without-libjasper to configure])
896   fi
897
898 AC_SUBST(LIBTIFF)
899 AC_SUBST(LIBJPEG)
900 AC_SUBST(LIBPNG)
901 AC_SUBST(LIBJASPER)
902
903 AM_CONDITIONAL(BUILD_DYNAMIC_MODULES, $dynworks)
904
905 #
906 # Allow building some or all gdk-pixbuf loaders included
907 #
908 AC_MSG_CHECKING(pixbuf loaders to build)
909
910 dnl due to an autoconf bug, commas in the first arg to
911 dnl AC_HELP_STRING cause problems.
912 dnl AC_HELP_STRING([--with-included-loaders=LOADER1 LOADER2 ...],
913 dnl                [build the specified loaders into gdk-pixbuf])
914 AC_ARG_WITH(included_loaders,
915 [  --with-included-loaders=LOADER1,LOADER2,...
916                           build the specified loaders into gdk-pixbuf])
917
918 if $dynworks; then 
919    :
920 else
921    ## if the option was specified, leave it; otherwise disable included loaders
922    if test x$with_included_loaders = xno; then
923            with_included_loaders=yes
924    fi
925 fi
926
927 all_loaders="png,bmp,wbmp,gif,ico,ani,jpeg,pnm,ras,tiff,xpm,xbm,tga,pcx,icns"
928 if test x$with_libjasper != xno; then
929   all_loaders="$all_loaders,jasper"
930 fi
931 included_loaders=""
932 # If no loaders specified, include all
933 if test "x$with_included_loaders" = xyes ; then
934   included_loaders="$all_loaders"
935 else
936   included_loaders="$with_included_loaders"
937 fi
938
939 AC_MSG_RESULT($included_loaders)
940
941 INCLUDED_LOADER_OBJ=
942 INCLUDED_LOADER_DEFINE=
943
944 IFS="${IFS=     }"; gtk_save_ifs="$IFS"; IFS=","
945 for loader in $included_loaders; do
946  if echo "$all_loaders" | egrep "(^|,)$loader(\$|,)" > /dev/null; then
947    :
948  else
949    AC_MSG_ERROR([the specified loader $loader does not exist])
950  fi
951
952  INCLUDED_LOADER_OBJ="$INCLUDED_LOADER_OBJ libstatic-pixbufloader-$loader.la"
953  INCLUDED_LOADER_DEFINE="$INCLUDED_LOADER_DEFINE -DINCLUDE_$loader"
954  eval INCLUDE_$loader=yes
955 done
956 IFS="$gtk_save_ifs"
957 AC_SUBST(INCLUDED_LOADER_OBJ)
958 AC_SUBST(INCLUDED_LOADER_DEFINE)
959
960 AM_CONDITIONAL(INCLUDE_PNG, [test x"$INCLUDE_png" = xyes])
961 AM_CONDITIONAL(INCLUDE_BMP, [test x"$INCLUDE_bmp" = xyes])
962 AM_CONDITIONAL(INCLUDE_WBMP, [test x"$INCLUDE_wbmp" = xyes])
963 AM_CONDITIONAL(INCLUDE_GIF, [test x"$INCLUDE_gif" = xyes])
964 AM_CONDITIONAL(INCLUDE_ICO, [test x"$INCLUDE_ico" = xyes])
965 AM_CONDITIONAL(INCLUDE_ANI, [test x"$INCLUDE_ani" = xyes])
966 AM_CONDITIONAL(INCLUDE_JPEG, [test x"$INCLUDE_jpeg" = xyes])
967 AM_CONDITIONAL(INCLUDE_PNM, [test x"$INCLUDE_pnm" = xyes])
968 AM_CONDITIONAL(INCLUDE_RAS, [test x"$INCLUDE_ras" = xyes])
969 AM_CONDITIONAL(INCLUDE_TIFF, [test x"$INCLUDE_tiff" = xyes])
970 AM_CONDITIONAL(INCLUDE_XPM, [test x"$INCLUDE_xpm" = xyes])
971 AM_CONDITIONAL(INCLUDE_XBM, [test x"$INCLUDE_xbm" = xyes])
972 AM_CONDITIONAL(INCLUDE_TGA, [test x"$INCLUDE_tga" = xyes])
973 AM_CONDITIONAL(INCLUDE_PCX, [test x"$INCLUDE_pcx" = xyes])
974 AM_CONDITIONAL(INCLUDE_ICNS, [test x"$INCLUDE_icns" = xyes])
975 AM_CONDITIONAL(INCLUDE_JASPER, [test x"$INCLUDE_jasper" = xyes])
976
977 #
978 # Allow building some or all immodules included
979 #
980 AC_MSG_CHECKING(immodules to build)
981
982 dnl due to an autoconf bug, commas in the first arg to
983 dnl AC_HELP_STRING cause problems.
984 dnl AC_HELP_STRING([--with-included-immodules=MODULE1 MODULE2 ...],
985 dnl                [build the specified input method modules into gtk])
986 AC_ARG_WITH(included_immodules,
987 [  --with-included-immodules=MODULE1,MODULE2,...
988                           build the specified input methods into gtk])
989
990 if $dynworks; then 
991    :
992 else
993    ## if the option was specified, leave it; otherwise disable included immodules
994    if test x$with_included_immodules = xno; then
995            with_included_immodules=yes
996    fi
997 fi
998
999 all_immodules="am-et,cedilla,cyrillic-translit"
1000 if test "$gdktarget" = "win32"; then
1001    all_immodules="${all_immodules},ime"
1002 fi
1003 all_immodules="${all_immodules},inuktitut,ipa,multipress,thai,ti-er,ti-et,viqr"
1004 if test "$gdktarget" = "x11"; then
1005    all_immodules="${all_immodules},xim"
1006 fi
1007
1008 included_immodules=""
1009 # If the switch specified without listing any specific ones, include all
1010 if test "x$with_included_immodules" = xyes ; then
1011   included_immodules="$all_immodules"
1012 else
1013   included_immodules="$with_included_immodules"
1014 fi
1015
1016 AC_MSG_RESULT($included_immodules)
1017 AM_CONDITIONAL(HAVE_INCLUDED_IMMMODULES, test "x$included_immodules" != x)
1018
1019 INCLUDED_IMMODULE_OBJ=
1020 INCLUDED_IMMODULE_DEFINE=
1021
1022 IFS="${IFS=     }"; gtk_save_ifs="$IFS"; IFS=","
1023 for immodule in $included_immodules; do
1024  immodule_underscores=`echo $immodule | sed -e 's/-/_/g'`
1025  if echo "$all_immodules" | egrep "(^|,)$immodule(\$|,)" > /dev/null; then
1026    :
1027  else
1028    AC_MSG_ERROR([the specified input method $immodule does not exist])
1029  fi
1030
1031  INCLUDED_IMMODULE_OBJ="$INCLUDED_IMMODULE_OBJ ../modules/input/libstatic-im-$immodule.la"
1032  INCLUDED_IMMODULE_DEFINE="$INCLUDED_IMMODULE_DEFINE -DINCLUDE_IM_$immodule_underscores"
1033  eval INCLUDE_$immodule_underscores=yes
1034 done
1035 IFS="$gtk_save_ifs"
1036 AC_SUBST(INCLUDED_IMMODULE_OBJ)
1037 AC_SUBST(INCLUDED_IMMODULE_DEFINE)
1038
1039 AM_CONDITIONAL(INCLUDE_IM_AM_ET, [test x"$INCLUDE_am_et" = xyes])
1040 AM_CONDITIONAL(INCLUDE_IM_CEDILLA, [test x"$INCLUDE_cedilla" = xyes])
1041 AM_CONDITIONAL(INCLUDE_IM_CYRILLIC_TRANSLIT, [test x"$INCLUDE_cyrillic_translit" = xyes])
1042 AM_CONDITIONAL(INCLUDE_IM_IME, [test x"$INCLUDE_ime" = xyes])
1043 AM_CONDITIONAL(INCLUDE_IM_INUKTITUT, [test x"$INCLUDE_inuktitut" = xyes])
1044 AM_CONDITIONAL(INCLUDE_IM_IPA, [test x"$INCLUDE_ipa" = xyes])
1045 AM_CONDITIONAL(INCLUDE_IM_MULTIPRESS, [test x"$INCLUDE_multipress" = xyes])
1046 AM_CONDITIONAL(INCLUDE_IM_THAI, [test x"$INCLUDE_thai" = xyes])
1047 AM_CONDITIONAL(INCLUDE_IM_TI_ER, [test x"$INCLUDE_ti_er" = xyes])
1048 AM_CONDITIONAL(INCLUDE_IM_TI_ET, [test x"$INCLUDE_ti_et" = xyes])
1049 AM_CONDITIONAL(INCLUDE_IM_VIQR, [test x"$INCLUDE_viqr" = xyes])
1050 AM_CONDITIONAL(INCLUDE_IM_XIM, [test x"$INCLUDE_xim" = xyes])
1051
1052 AC_HEADER_SYS_WAIT
1053
1054 AC_TYPE_SIGNAL
1055
1056 AM_CONDITIONAL(HAVE_TIFF, test "x$LIBTIFF" != x)
1057 AM_CONDITIONAL(HAVE_PNG, test "x$LIBPNG" != x)
1058 AM_CONDITIONAL(HAVE_JPEG, test "x$LIBJPEG" != x)
1059 AM_CONDITIONAL(HAVE_JASPER, test "x$LIBJASPER" != x)
1060
1061 if $dynworks ; then
1062   STATIC_LIB_DEPS=
1063   if echo "$included_loaders" | egrep '(^|,)tiff($|,)' > /dev/null; then
1064     STATIC_LIB_DEPS="$STATIC_LIB_DEPS $LIBTIFF"
1065   fi
1066   if echo "$included_loaders" | egrep '(^|,)jpeg($|,)' > /dev/null; then
1067     STATIC_LIB_DEPS="$STATIC_LIB_DEPS $LIBJPEG"
1068   fi
1069   if echo "$included_loaders" | egrep '(^|,)png($|,)' > /dev/null; then
1070     STATIC_LIB_DEPS="$STATIC_LIB_DEPS $LIBPNG"
1071   fi
1072 else
1073   STATIC_LIB_DEPS="$LIBTIFF $LIBJPEG $LIBPNG"
1074 fi
1075
1076 # Checks to see whether we should include mediaLib
1077 # support.
1078 #
1079 AC_CHECK_HEADER(sys/systeminfo.h,
1080                 AC_DEFINE(HAVE_SYS_SYSTEMINFO_H, 1, 
1081                           [Define to 1 if sys/systeminfo.h is available]))
1082 AC_CHECK_HEADER(sys/sysinfo.h,
1083                 AC_DEFINE(HAVE_SYS_SYSINFO_H, 1,
1084                           [Define to 1 if sys/sysinfo.h is available]))
1085
1086 AC_MSG_CHECKING(for mediaLib 2.3)
1087 use_mlib25=no
1088 # Check for a mediaLib 2.3 function since that is what the GTK+ mediaLib
1089 # patch requires.
1090 AC_CHECK_LIB(mlib, mlib_ImageSetStruct, use_mlib=yes, use_mlib=no)
1091 if test $use_mlib = yes; then
1092     AC_DEFINE(USE_MEDIALIB, 1,
1093               [Define to 1 if medialib is available and should be used])
1094     MEDIA_LIB=-lmlib
1095
1096     AC_MSG_CHECKING(for mediaLib 2.5)
1097     # Check for a mediaLib 2.5 function since that is what is needed for
1098     # gdk_rgb_convert integration.
1099     AC_CHECK_LIB(mlib, mlib_VideoColorRGBint_to_BGRAint, use_mlib25=yes, use_mlib25=no)
1100     if test $use_mlib25 = yes; then
1101         AC_DEFINE(USE_MEDIALIB25, 1,
1102                   [Define to 1 if medialib 2.5 is available])
1103     fi
1104 fi
1105 AM_CONDITIONAL(USE_MEDIALIB, test $use_mlib = yes)
1106 AM_CONDITIONAL(USE_MEDIALIB25, test $use_mlib25 = yes)
1107
1108 # Checks to see if we should compile in MMX support (there will be
1109 # a runtime test when the code is actually run to see if it should
1110 # be used - this just checks if we can compile it.)
1111 #
1112 # This code is partially taken from Mesa
1113 #
1114 AC_MSG_CHECKING(for x86 platform)
1115 case $host_cpu in
1116   i386|i486|i586|i686|i786|k6|k7)
1117         use_x86_asm=yes
1118         ;;
1119    *)
1120         use_x86_asm=no
1121 esac
1122 AC_MSG_RESULT($use_x86_asm)
1123
1124 use_mmx_asm=no
1125 if test $use_x86_asm = yes; then
1126     save_ac_ext=$ac_ext
1127     ac_ext=S
1128     
1129     AC_MSG_CHECKING(compiler support for MMX)
1130     cp $srcdir/gdk-pixbuf/pixops/scale_line_22_33_mmx.S conftest.S
1131     if AC_TRY_EVAL(ac_compile); then
1132         use_mmx_asm=yes
1133     fi
1134
1135     rm -rf conftest*
1136
1137     ac_ext=$save_ac_ext
1138     if test $use_mmx_asm = yes; then
1139       AC_DEFINE(USE_MMX, 1,
1140                 [Define to 1 if XXM is available and should be used])
1141       AC_MSG_RESULT(yes)
1142     else
1143       AC_MSG_RESULT(no)
1144     fi
1145 fi
1146
1147 AM_CONDITIONAL(USE_MMX, test x$use_mmx_asm = xyes)
1148
1149 REBUILD_PNGS=
1150 if test -z "$LIBPNG"; then
1151   REBUILD_PNGS=#
1152 fi
1153
1154 dnl Look for a host system's gdk-pixbuf-csource if we are cross-compiling
1155
1156 AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
1157
1158 if test $cross_compiling = yes; then
1159   AC_PATH_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource, no)
1160   AC_PATH_PROG(GTK_UPDATE_ICON_CACHE, gtk-update-icon-cache, no)
1161   if test x$GTK_UPDATE_ICON_CACHE = xno; then
1162     REBUILD_PNGS=#
1163   fi
1164 fi
1165
1166 if test ! -f $srcdir/gtk/gtkbuiltincache.h && 
1167    test "x$REBUILD_PNGS" = "x#" ; then
1168      AC_MSG_ERROR([
1169 *** gtkbuiltincache.h is not in the tree, and cannot be built
1170 *** because you don't have libpng, or (when cross-compiling) you 
1171 *** don't have a prebuilt gtk-update-icon-cache on the build system.])
1172 fi
1173
1174 AC_SUBST(REBUILD_PNGS)
1175
1176 GDK_PIXBUF_PACKAGES="gmodule-no-export-2.0 gobject-2.0 gio-2.0"
1177 GDK_PIXBUF_EXTRA_LIBS="$STATIC_LIB_DEPS $MATH_LIB $MEDIA_LIB"
1178 GDK_PIXBUF_EXTRA_CFLAGS= 
1179 GDK_PIXBUF_DEP_LIBS="`$PKG_CONFIG --libs $GDK_PIXBUF_PACKAGES` $GDK_PIXBUF_EXTRA_LIBS"
1180 GDK_PIXBUF_DEP_CFLAGS="`$PKG_CONFIG --cflags  gthread-2.0 $GDK_PIXBUF_PACKAGES $PNG_DEP_CFLAGS_PACKAGES` $GDK_PIXBUF_EXTRA_CFLAGS"
1181
1182 ########################################
1183 # Windowing system checks
1184 ########################################
1185
1186 GDK_PIXBUF_XLIB_PACKAGES=
1187 GDK_PIXBUF_XLIB_EXTRA_CFLAGS=
1188 GDK_PIXBUF_XLIB_EXTRA_LIBS=
1189         
1190 X_PACKAGES=fontconfig
1191 GDK_EXTRA_LIBS="$GDK_WLIBS"
1192 GDK_EXTRA_CFLAGS=
1193         
1194 # GTK+ uses some X calls, so needs to link against X directly
1195 GTK_DEP_PACKAGES_FOR_X=
1196 GTK_DEP_LIBS_FOR_X=
1197
1198 if test "x$gdktarget" = "xx11"; then
1199   #
1200   # We use fontconfig very peripherally when decoding the default
1201   # settings.
1202   #
1203   if $PKG_CONFIG --exists fontconfig; then : ; else
1204     AC_MSG_ERROR([
1205 *** fontconfig (http://www.fontconfig.org) is required by the X11 backend.])
1206   fi
1207
1208   #
1209   # Check for basic X packages; we use pkg-config if available
1210   #
1211   if $PKG_CONFIG --exists x11 xext xrender; then
1212     have_base_x_pc=true
1213     X_PACKAGES="$X_PACKAGES x11 xext xrender"
1214     x_libs="`$PKG_CONFIG --libs x11 xext xrender`"
1215     X_CFLAGS="`$PKG_CONFIG --cflags x11 xext xrender`"
1216     
1217     # Strip out any .la files that pkg-config might give us (this happens
1218     # with -uninstalled.pc files)
1219     x_libs_for_checks=
1220     for I in $x_libs ; do
1221       case $I in 
1222         *.la) ;;
1223         *) x_libs_for_checks="$x_libs_for_checks $I" ;;
1224       esac
1225     done
1226     
1227     GDK_PIXBUF_XLIB_PACKAGES="x11"
1228     GTK_PACKAGES_FOR_X="x11"
1229   else
1230     have_base_x_pc=false
1231     AC_PATH_XTRA
1232     if test x$no_x = xyes ; then
1233       AC_MSG_ERROR([X development libraries not found])
1234     fi
1235     
1236     x_cflags="$X_CFLAGS"
1237     x_libs_for_checks="$X_LIBS -lXext -lXrender -lX11 $X_EXTRA_LIBS"
1238
1239     GDK_PIXBUF_XLIB_EXTRA_CFLAGS="$x_cflags"
1240     GDK_PIXBUF_XLIB_EXTRA_LIBS="$X_LIBS -lX11 $X_EXTRA_LIBS"
1241     GTK_DEP_LIBS_FOR_X="$X_LIBS -lXrender -lX11 $X_EXTRA_LIBS"
1242   fi
1243
1244   # Extra libraries found during checks (-lXinerama, etc), not from pkg-config.
1245   x_extra_libs=
1246
1247   gtk_save_cppflags="$CPPFLAGS"
1248   CPPFLAGS="$CPPFLAGS $X_CFLAGS"
1249
1250   gtk_save_LIBS=$LIBS
1251   LIBS="$x_libs_for_checks $LIBS"
1252   
1253   # Sanity check for the X11 and Xext libraries. While everything we need from
1254   # Xext is optional, the chances a system has *none* of these things is so
1255   # small that we just unconditionally require it.
1256   AC_CHECK_FUNC(XOpenDisplay, :,
1257                 AC_MSG_ERROR([*** libX11 not found. Check 'config.log' for more details.]))
1258   AC_CHECK_FUNC(XextFindDisplay, :,
1259                 AC_MSG_ERROR([*** libXext not found. Check 'config.log' for more details.]))
1260   AC_CHECK_FUNC(XRenderQueryExtension, :,
1261                 AC_MSG_ERROR([*** libXrender not found. Check 'config.log' for more details.]))
1262
1263   # Check for xReply
1264
1265   AC_MSG_CHECKING([if <X11/extensions/XIproto.h> is needed for xReply])
1266   AC_TRY_COMPILE([#include <X11/Xlibint.h>],
1267       [xReply *rep;],
1268       [AC_MSG_RESULT([no])],
1269       [AC_TRY_COMPILE([#include <X11/extensions/XIproto.h>
1270 #include <X11/Xlibint.h>],
1271            [xReply *rep;],
1272            [AC_MSG_RESULT([yes])
1273             AC_DEFINE([NEED_XIPROTO_H_FOR_XREPLY], 1,
1274                       [Define if <X11/extensions/XIproto.h> needed for xReply])],
1275            [AC_MSG_RESULT([unknown])
1276             AC_MSG_ERROR([xReply type unavailable. X11 is too old])])])
1277
1278   # Check for XConvertCase, XInternAtoms (X11R6 specific)
1279
1280   AC_CHECK_FUNCS(XConvertCase XInternAtoms)
1281
1282   # Generic X11R6 check needed for XIM support; we could
1283   # probably use this to replace the above, but we'll
1284   # leave the separate checks for XConvertCase and XInternAtoms 
1285   # for clarity
1286   
1287   have_x11r6=false
1288   AC_CHECK_FUNC(XAddConnectionWatch,
1289       have_x11r6=true)
1290
1291   if $have_x11r6; then
1292     AC_DEFINE(HAVE_X11R6, 1, [Define if we have X11R6])
1293   fi
1294   AM_CONDITIONAL(HAVE_X11R6, $have_x11r6)
1295
1296   # Check for XKB support.
1297
1298   if test "x$enable_xkb" = "xyes"; then
1299         AC_MSG_WARN(XKB support explicitly enabled)
1300         AC_DEFINE(HAVE_XKB, 1, [Define to use XKB extension])
1301   elif test "x$enable_xkb" = "xmaybe"; then
1302         AC_CHECK_FUNC(XkbQueryExtension,
1303                       AC_DEFINE(HAVE_XKB, 1, [Define to use XKB extension]))
1304   else
1305         AC_MSG_WARN(XKB support explicitly disabled)
1306   fi
1307
1308   # Check for shaped window extension
1309
1310   AC_CHECK_FUNC(XShapeCombineMask,
1311       AC_DEFINE(HAVE_SHAPE_EXT, 1,
1312                 [Define to 1 if the XShape extension is available]))
1313
1314   # X SYNC check
1315   gtk_save_CFLAGS="$CFLAGS"
1316   CFLAGS="$CFLAGS $x_cflags"
1317   
1318   AC_CHECK_FUNC(XSyncQueryExtension,
1319       [AC_CHECK_HEADER(X11/extensions/sync.h,
1320           AC_DEFINE(HAVE_XSYNC, 1, [Have the SYNC extension library]),
1321           :, [#include <X11/Xlib.h>])])
1322
1323   CFLAGS="$gtk_save_CFLAGS"
1324
1325   # Xshm checks
1326
1327   if test "x$enable_shm" = "xyes"; then
1328      # Check for the XShm extension, normally in Xext
1329      AC_CHECK_FUNC(XShmAttach,
1330         :,
1331         # On AIX, it is in XextSam instead
1332         [AC_CHECK_LIB(XextSam, XShmAttach, 
1333             [GTK_ADD_LIB(x_extra_libs,XextSam)])])
1334   fi    
1335
1336   if test "x$enable_shm" = "xyes"; then
1337     # Check for shared memory
1338     AC_CHECK_HEADER(sys/ipc.h,
1339                     AC_DEFINE(HAVE_IPC_H, 1,
1340                               [Define to 1 if ipc.h is available]),
1341                     no_sys_ipc=yes)
1342     AC_CHECK_HEADER(sys/shm.h,
1343                     AC_DEFINE(HAVE_SHM_H, 1,
1344                               [Define to 1 if shm.h is available]),
1345                     no_sys_shm=yes)
1346
1347     # Check for the X shared memory extension header file
1348     have_xshm=no 
1349     AC_MSG_CHECKING(X11/extensions/XShm.h)
1350     if test "x$no_xext_lib" = "xyes"; then
1351       :
1352     else
1353       gtk_save_CFLAGS="$CFLAGS"
1354       CFLAGS="$CFLAGS $x_cflags"
1355       AC_TRY_COMPILE([
1356 #include <stdlib.h>
1357 #include <sys/types.h>
1358 #include <sys/ipc.h>
1359 #include <sys/shm.h>
1360 #include <X11/Xlib.h>
1361 #include <X11/Xutil.h>
1362 #include <X11/extensions/XShm.h>
1363 ], [XShmSegmentInfo *x_shm_info;], have_xshm=yes)
1364       CFLAGS="$gtk_save_CFLAGS"
1365     fi
1366     AC_MSG_RESULT($have_xshm)
1367     if test $have_xshm = yes ; then
1368       AC_DEFINE(HAVE_XSHM_H, 1,
1369                 [Define to 1 if xshm.h is available])
1370     fi
1371   fi
1372
1373   if test "x$enable_xinerama" = "xyes"; then
1374     # Check for Xinerama extension (Solaris impl or Xfree impl)
1375     gtk_save_cppflags="$CPPFLAGS"
1376     CPPFLAGS="$CPPFLAGS $x_cflags"
1377   
1378     case "$host" in
1379       *-*-solaris*)
1380           # Check for solaris
1381           AC_MSG_CHECKING(for Xinerama support on Solaris)
1382           
1383           have_solaris_xinerama=false
1384           AC_CHECK_FUNC(XineramaGetInfo,
1385               [AC_CHECK_HEADER(X11/extensions/xinerama.h,
1386                   [have_solaris_xinerama=true], :,
1387                   [#include <X11/Xlib.h>])])
1388                 
1389           if $have_solaris_xinerama ; then
1390             AC_DEFINE(HAVE_SOLARIS_XINERAMA, 1,
1391                       [Define to 1 if solaris xinerama is available])
1392             AC_DEFINE(HAVE_XINERAMA, 1,
1393                       [Define to 1 if xinerama is available])
1394             AC_MSG_RESULT(yes)
1395           else
1396             AC_MSG_RESULT(no)
1397           fi
1398           ;;
1399       *)
1400           # Check for XFree
1401           AC_MSG_CHECKING(for Xinerama support on XFree86)
1402           
1403           have_xfree_xinerama=false
1404           if $PKG_CONFIG --exists xinerama ; then
1405              have_xfree_xinerama=true
1406              X_PACKAGES="$X_PACKAGES xinerama"
1407           else    
1408               AC_CHECK_LIB(Xinerama, XineramaQueryExtension,
1409                   [AC_CHECK_HEADER(X11/extensions/Xinerama.h, 
1410                       [GTK_ADD_LIB(x_extra_libs,Xinerama)
1411                       have_xfree_xinerama=true], :,
1412                       [#include <X11/Xlib.h>])])
1413           fi
1414
1415           if $have_xfree_xinerama ; then
1416             AC_DEFINE(HAVE_XFREE_XINERAMA, 1,
1417                       [Define to 1 if XFree Xinerama is available])
1418             AC_DEFINE(HAVE_XINERAMA, 1,
1419                       [Define to 1 is Xinerama is available])
1420             AC_MSG_RESULT(yes)
1421          else
1422             AC_MSG_RESULT(no)
1423          fi
1424          ;;
1425     esac
1426   fi
1427   
1428   # set up things for XInput
1429
1430   if test "x$with_xinput" = "xxfree" || test "x$with_xinput" = "xyes"; then
1431     AC_DEFINE(XINPUT_XFREE, 1,
1432               [Define to 1 if XFree XInput should be used])
1433     
1434     if $PKG_CONFIG --exists xi ; then
1435       X_PACKAGES="$X_PACKAGES xi"
1436     else
1437       GTK_ADD_LIB(x_extra_libs, Xi)
1438     fi
1439   else
1440     AC_DEFINE(XINPUT_NONE, 1,
1441               [Define to 1 if no XInput should be used])
1442   fi
1443
1444   AM_CONDITIONAL(XINPUT_XFREE, test x$with_xinput = xxfree || test x$with_xinput = xyes)
1445
1446   # Check for the RANDR extension
1447   if $PKG_CONFIG --exists "xrandr >= 1.2" ; then
1448      AC_DEFINE(HAVE_RANDR, 1, [Have the Xrandr extension library])
1449
1450      X_PACKAGES="$X_PACKAGES xrandr"
1451   fi
1452        
1453   # Checks for Xcursor library
1454   
1455   if $PKG_CONFIG --exists xcursor ; then
1456     AC_DEFINE(HAVE_XCURSOR, 1, [Have the Xcursor library])
1457     
1458     X_PACKAGES="$X_PACKAGES xcursor"
1459   fi
1460
1461   # Checks for XFixes extension
1462   
1463   if $PKG_CONFIG --exists xfixes ; then
1464     AC_DEFINE(HAVE_XFIXES, 1, [Have the XFIXES X extension])
1465     
1466     X_PACKAGES="$X_PACKAGES xfixes"
1467     GTK_PACKAGES_FOR_X="$GTK_PACKAGES_FOR_X xfixes"
1468   fi
1469
1470   # Checks for Xcomposite extension
1471
1472   if $PKG_CONFIG --exists xcomposite ; then
1473     AC_DEFINE(HAVE_XCOMPOSITE, 1, [Have the XCOMPOSITE X extension])
1474
1475     X_PACKAGES="$X_PACKAGES xcomposite"
1476     GTK_PACKAGES_FOR_X="$GTK_PACKAGES_FOR_X xcomposite"
1477   fi
1478
1479   # Checks for Xdamage extension
1480
1481   if $PKG_CONFIG --exists xdamage ; then
1482     AC_DEFINE(HAVE_XDAMAGE, 1, [Have the XDAMAGE X extension])
1483
1484     X_PACKAGES="$X_PACKAGES xdamage"
1485     GTK_PACKAGES_FOR_X="$GTK_PACKAGES_FOR_X xdamage"
1486   fi
1487
1488   if $have_base_x_pc ; then
1489     GDK_EXTRA_LIBS="$x_extra_libs"
1490   else
1491     GDK_EXTRA_LIBS="$X_LIBS $x_extra_libs -lXext -lX11 $GDK_EXTRA_LIBS"
1492   fi
1493
1494   CPPFLAGS="$gtk_save_cppflags"
1495   LIBS="$gtk_save_libs"
1496
1497   AM_CONDITIONAL(USE_X11, true)
1498 else
1499   AM_CONDITIONAL(XINPUT_XFREE, false)
1500   AM_CONDITIONAL(USE_X11, false)
1501   AM_CONDITIONAL(HAVE_X11R6, false)
1502 fi
1503
1504 if test "x$gdktarget" = "xwin32"; then
1505   GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -lgdi32 -limm32 -lshell32 -lole32 -Wl,-luuid"
1506   AM_CONDITIONAL(USE_WIN32, true)
1507 else
1508   AM_CONDITIONAL(USE_WIN32, false)
1509 fi
1510
1511 if test "x$gdktarget" = "xquartz"; then
1512   GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -framework Cocoa"
1513   AM_CONDITIONAL(USE_QUARTZ, true)
1514 else
1515   AM_CONDITIONAL(USE_QUARTZ, false)
1516 fi
1517
1518 GDK_PIXBUF_XLIB_DEP_LIBS="`$PKG_CONFIG --libs $GDK_PIXBUF_PACKAGES $GDK_PIXBUF_XLIB_PACKAGES` $GDK_PIXBUF_XLIB_EXTRA_LIBS $GDK_PIXBUF_EXTRA_LIBS"
1519 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"
1520
1521 AC_SUBST(GDK_PIXBUF_XLIB_PACKAGES)
1522 AC_SUBST(GDK_PIXBUF_XLIB_EXTRA_LIBS)
1523 AC_SUBST(GDK_PIXBUF_XLIB_EXTRA_CFLAGS)
1524 AC_SUBST(GDK_PIXBUF_XLIB_DEP_LIBS)
1525 AC_SUBST(GDK_PIXBUF_XLIB_DEP_CFLAGS)
1526
1527 if test "x$gdktarget" = "xdirectfb"; then
1528   DIRECTFB_REQUIRED_VERSION=0.9.24
1529   AC_MSG_CHECKING(for DirectFB)
1530
1531   if $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb && $PKG_CONFIG --exists cairo-directfb ; then
1532       AC_MSG_RESULT(found)
1533       GDK_EXTRA_CFLAGS="`$PKG_CONFIG --cflags cairo-directfb` $GDK_EXTRA_CFLAGS"
1534       GDK_EXTRA_LIBS="`$PKG_CONFIG --libs cairo-directfb` $GDK_EXTRA_LIBS"
1535   else
1536       AC_MSG_ERROR([
1537 *** DirectFB $DIRECTFB_REQUIRED_VERSION or newer and the cairo backend 
1538 *** are required. The latest version of DirectFB is always available 
1539 *** from http://www.directfb.org/.
1540   ])
1541   fi
1542
1543   AM_CONDITIONAL(USE_DIRECTFB, true)
1544 else
1545   AM_CONDITIONAL(USE_DIRECTFB, false)
1546 fi
1547
1548
1549 # Check for Pango flags
1550
1551 if test "x$gdktarget" = "xwin32"; then
1552         PANGO_PACKAGES="pangowin32 pangocairo"
1553 else
1554         PANGO_PACKAGES="pango pangocairo"
1555 fi
1556
1557 AC_MSG_CHECKING(Pango flags)
1558 if $PKG_CONFIG --exists $PANGO_PACKAGES ; then
1559         PANGO_CFLAGS=`$PKG_CONFIG --cflags $PANGO_PACKAGES`
1560         PANGO_LIBS=`$PKG_CONFIG --libs $PANGO_PACKAGES`
1561
1562         AC_MSG_RESULT($PANGO_CFLAGS $PANGO_LIBS)
1563 else
1564         AC_MSG_ERROR([
1565 *** Pango not found. Pango built with Cairo support is required
1566 *** to build GTK+. See http://www.pango.org for Pango information.
1567 ])
1568 fi
1569
1570 CFLAGS="$CFLAGS $PANGO_CFLAGS"
1571
1572 if $PKG_CONFIG --uninstalled $PANGO_PACKAGES; then
1573         :
1574 else
1575         gtk_save_LIBS="$LIBS"
1576         LIBS="$PANGO_LIBS $LIBS"
1577         AC_TRY_LINK_FUNC(pango_context_new, :, AC_MSG_ERROR([
1578 *** Can't link to Pango. Pango is required to build
1579 *** GTK+. For more information see http://www.pango.org]))
1580         LIBS="$gtk_save_LIBS"
1581 fi
1582
1583 CFLAGS="$saved_cflags"
1584 LDFLAGS="$saved_ldflags"
1585
1586 GDK_PACKAGES="$PANGO_PACKAGES gio-2.0"
1587 if test "x$gdktarget" = "xx11"; then
1588   GDK_PACKAGES="$GDK_PACKAGES $X_PACKAGES"
1589 fi
1590 GDK_DEP_LIBS="$GDK_EXTRA_LIBS `$PKG_CONFIG --libs $GDK_PIXBUF_PACKAGES $GDK_PACKAGES` $GDK_PIXBUF_EXTRA_LIBS"
1591 GDK_DEP_CFLAGS="`$PKG_CONFIG --cflags  gthread-2.0 $GDK_PIXBUF_PACKAGES $GDK_PACKAGES` $GDK_PIXBUF_EXTRA_CFLAGS $GDK_EXTRA_CFLAGS"
1592
1593 #
1594 # If we aren't writing explicit dependencies, then don't put the extra libraries we need
1595 # into the pkg-config files
1596 #
1597 if test $enable_explicit_deps != yes ; then
1598   GDK_PACKAGES="$PANGO_PACKAGES"
1599   GDK_EXTRA_LIBS=
1600 fi
1601
1602 AC_SUBST(GDK_PACKAGES)
1603 AC_SUBST(GDK_EXTRA_LIBS)
1604 AC_SUBST(GDK_EXTRA_CFLAGS)
1605 AC_SUBST(GDK_DEP_LIBS)
1606 AC_SUBST(GDK_DEP_CFLAGS)
1607
1608
1609 ########################################
1610 # Check for Accessibility Toolkit flags
1611 ########################################
1612
1613 ATK_PACKAGES=atk
1614 AC_MSG_CHECKING(ATK flags)
1615 if $PKG_CONFIG --exists $ATK_PACKAGES ; then
1616         ATK_CFLAGS=`$PKG_CONFIG --cflags $ATK_PACKAGES`
1617         ATK_LIBS=`$PKG_CONFIG --libs $ATK_PACKAGES`
1618
1619         AC_MSG_RESULT($ATK_CFLAGS $ATK_LIBS)
1620 else
1621         AC_MSG_ERROR([
1622 *** Accessibility Toolkit not found. Accessibility Toolkit is required
1623 *** to build GTK+.
1624 ])
1625 fi
1626
1627 if $PKG_CONFIG --uninstalled $ATK_PACKAGES; then
1628         :
1629 else
1630         gtk_save_LIBS="$LIBS"
1631         LIBS="$ATK_LIBS $LIBS"
1632         AC_TRY_LINK_FUNC(atk_object_get_type, : , AC_MSG_ERROR([
1633                 *** Cannot link to Accessibility Toolkit. Accessibility Toolkit is required
1634                 *** to build GTK+]))
1635         LIBS="$gtk_save_LIBS"
1636 fi
1637
1638 GTK_PACKAGES="atk cairo"
1639 GTK_EXTRA_LIBS=
1640 GTK_EXTRA_CFLAGS= 
1641 GTK_DEP_LIBS="$GDK_EXTRA_LIBS $GTK_DEP_LIBS_FOR_X `$PKG_CONFIG --libs $GDK_PIXBUF_PACKAGES $PANGO_PACKAGES $GTK_PACKAGES_FOR_X $GTK_PACKAGES` $GTK_EXTRA_LIBS $GDK_PIXBUF_EXTRA_LIBS"
1642 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"
1643
1644 if test x"$os_win32" = xyes; then
1645   GTK_EXTRA_CFLAGS="$msnative_struct"
1646 fi
1647
1648 GLIB_PREFIX="`$PKG_CONFIG --variable=prefix glib-2.0`"
1649 ATK_PREFIX="`$PKG_CONFIG --variable=prefix atk`"
1650 PANGO_PREFIX="`$PKG_CONFIG --variable=prefix pango`"
1651 CAIRO_PREFIX="`pkg-config --variable=prefix cairo`"
1652
1653 if test $enable_explicit_deps != yes ; then
1654   GDK_PIXBUF_EXTRA_LIBS=
1655 fi
1656
1657 AC_SUBST(GDK_PIXBUF_PACKAGES)
1658 AC_SUBST(GDK_PIXBUF_EXTRA_LIBS)
1659 AC_SUBST(GDK_PIXBUF_EXTRA_CFLAGS)
1660 AC_SUBST(GDK_PIXBUF_DEP_LIBS)
1661 AC_SUBST(GDK_PIXBUF_DEP_CFLAGS)
1662
1663 AC_SUBST(GTK_PACKAGES)
1664 AC_SUBST(GTK_EXTRA_LIBS)
1665 AC_SUBST(GTK_EXTRA_CFLAGS)
1666 AC_SUBST(GTK_DEP_LIBS)
1667 AC_SUBST(GTK_DEP_CFLAGS)
1668
1669 AC_SUBST(GLIB_PREFIX)
1670 AC_SUBST(ATK_PREFIX)
1671 AC_SUBST(PANGO_PREFIX)
1672 AC_SUBST(CAIRO_PREFIX)
1673
1674 AC_SUBST(GTK_DEBUG_FLAGS)
1675 AC_SUBST(GTK_XIM_FLAGS)
1676
1677 ########################
1678 # Checks needed for gail
1679 ########################
1680
1681 old_LIBS="$LIBS"
1682 dnl Checks for inet libraries:
1683 AC_SEARCH_LIBS(gethostent, nsl)
1684 AC_SEARCH_LIBS(setsockopt, socket)
1685 AC_SEARCH_LIBS(connect, inet)
1686
1687 dnl check for the sockaddr_un.sun_len member
1688 AC_CHECK_MEMBER([struct sockaddr_un.sun_len],
1689                 [struct_sockaddr_un_sun_len=true],
1690                 [struct_sockaddr_un_suin_len=false],
1691                 [#include <sys/types.h>
1692                  #include <sys/un.h>]
1693                 )
1694 case $struct_sockaddr_un_sun_len in 
1695         true)
1696                 AC_DEFINE_UNQUOTED(HAVE_SOCKADDR_UN_SUN_LEN, 1,
1697                                    [Have the sockaddr_un.sun_len member])
1698                 ;;
1699         *)
1700                 ;;
1701 esac
1702
1703 GAIL_INET_LIBS="$LIBS"
1704 AC_SUBST([GAIL_INET_LIBS])
1705
1706 LIBS="$old_LIBS"
1707
1708 ################################################################
1709 # Printing system checks
1710 ################################################################
1711
1712 AC_ARG_ENABLE(cups,
1713               [AC_HELP_STRING([--disable-cups]
1714                               [disable cups print backend])],,
1715               [enable_cups=auto])
1716
1717 if test "x$enable_cups" = "xauto"
1718 then
1719   AC_PATH_PROG(CUPS_CONFIG, cups-config, no)
1720   if test "x$CUPS_CONFIG" != "xno"; then
1721     CUPS_CFLAGS=`$CUPS_CONFIG --cflags | sed 's/-O[0-9]*//' | sed 's/-m[^\t]*//g'`
1722     CUPS_LIBS=`$CUPS_CONFIG --libs`
1723
1724     CUPS_API_VERSION=`$CUPS_CONFIG --api-version`
1725     CUPS_API_MAJOR=`echo $ECHO_N $CUPS_API_VERSION | awk -F. '{print $1}'`
1726     CUPS_API_MINOR=`echo $ECHO_N $CUPS_API_VERSION | awk -F. '{print $2}'`
1727
1728     if test $CUPS_API_MAJOR -gt 1 -o \
1729             $CUPS_API_MAJOR -eq 1 -a $CUPS_API_MINOR -ge 2; then
1730       AC_DEFINE(HAVE_CUPS_API_1_2, 1, 
1731                 [Define to 1 if CUPS 1.2 API is available])
1732     fi
1733
1734     AC_SUBST(CUPS_API_MAJOR)
1735     AC_SUBST(CUPS_API_MINOR)
1736     AC_SUBST(CUPS_CFLAGS)
1737     AC_SUBST(CUPS_LIBS)
1738
1739     AC_CHECK_HEADER(cups/cups.h,,AC_MSG_ERROR([[*** Sorry, cups-config present but cups/cups.h missing.]]))
1740   fi
1741   AM_CONDITIONAL(HAVE_CUPS, test "x$CUPS_CONFIG" != "xno")
1742
1743   gtk_save_cflags="$CFLAGS"
1744   CFLAGS="$CUPS_CFLAGS"
1745   AC_TRY_COMPILE([#include <cups/http.h>],
1746                  [http_t http; char *s = http.authstring;],
1747                  [AC_DEFINE(HAVE_HTTP_AUTHSTRING, [],
1748                             [Define if cups http_t authstring field is accessible])],)
1749   CFLAGS="$gtk_save_cflags"
1750
1751   AC_SUBST(HAVE_HTTP_AUTHSTRING)
1752
1753   gtk_save_libs="$LIBS"
1754   LIBS="$CUPS_LIBS"
1755   AC_CHECK_FUNCS(httpGetAuthString)
1756   LIBS="$gtk_save_libs"
1757
1758 else
1759   AM_CONDITIONAL(HAVE_CUPS, false)
1760 fi
1761
1762 gtk_save_cppflags="$CPPFLAGS"
1763 CPPFLAGS="$CPPFLAGS $GTK_DEP_CFLAGS"
1764                           
1765 AC_CHECK_HEADER(cairo-pdf.h,,AC_MSG_ERROR([
1766 *** Can't find cairo-pdf.h. You must build Cairo with the pdf
1767 *** backend enabled.]))
1768
1769 if test "$os_win32" != "yes"; then
1770   AC_CHECK_HEADER(cairo-ps.h,,AC_MSG_ERROR([
1771 *** Can't find cairo-ps.h. You must build Cairo with the 
1772 *** postscript backend enabled.]))
1773 fi   
1774
1775 CPPFLAGS="$gtk_save_cppflags"
1776      
1777                                 
1778 AC_ARG_ENABLE(test-print-backend,
1779               [AC_HELP_STRING([--enable-test-print-backend],
1780                               [build test print backend])],,
1781               [enable_test_print_backend=no])
1782 AM_CONDITIONAL(TEST_PRINT_BACKEND, test "x$enable_test_print_backend" != "xno")
1783
1784
1785 ################################################################
1786 # Strip -export-dynamic from the link lines of various libraries
1787 ################################################################
1788
1789 #
1790 # pkg-config --libs gmodule includes the "export_dynamic" flag,
1791 #  but this flag is only meaningful for executables. For libraries
1792 #  the effect is undefined; what it causes on Linux is that the
1793 #  export list from -export-symbols-regex is ignored and everything
1794 #  is exported
1795 #
1796 # We are using gmodule-no-export now, but I'm leaving the stripping
1797 # code in place for now, since pango and atk still require gmodule.
1798 export SED
1799 export_dynamic=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh`
1800 if test -n "$export_dynamic"; then
1801   GDK_PIXBUF_DEP_LIBS=`echo $GDK_PIXBUF_DEP_LIBS | sed -e "s/$export_dynamic//"`
1802   GDK_PIXBUF_XLIB_DEP_LIBS=`echo $GDK_PIXBUF_XLIB_DEP_LIBS | sed -e "s/$export_dynamic//"`
1803   GDK_DEP_LIBS=`echo $GDK_DEP_LIBS | sed -e "s/$export_dynamic//"`
1804   GTK_DEP_LIBS=`echo $GTK_DEP_LIBS | sed -e "s/$export_dynamic//"`
1805 fi
1806
1807
1808 ##################################################
1809 # Checks for gtk-doc and docbook-tools
1810 ##################################################
1811
1812 GTK_DOC_CHECK([1.8])
1813
1814 AC_CHECK_PROG(DB2HTML, db2html, true, false)
1815 AM_CONDITIONAL(HAVE_DOCBOOK, $DB2HTML)
1816
1817 AC_ARG_ENABLE(man,
1818               [AC_HELP_STRING([--enable-man],
1819                               [regenerate man pages from Docbook [default=no]])],enable_man=yes,
1820               enable_man=no)
1821
1822 if test "${enable_man}" != no; then
1823   dnl
1824   dnl Check for xsltproc
1825   dnl
1826   AC_PATH_PROG([XSLTPROC], [xsltproc])
1827   if test -z "$XSLTPROC"; then
1828     enable_man=no
1829   fi
1830
1831   dnl check for DocBook DTD and stylesheets in the local catalog.
1832   JH_CHECK_XML_CATALOG([-//OASIS//DTD DocBook XML V4.1.2//EN],
1833      [DocBook XML DTD V4.1.2],,enable_man=no)
1834   JH_CHECK_XML_CATALOG([http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl],
1835      [DocBook XSL Stylesheets],,enable_man=no)
1836 fi
1837
1838 AM_CONDITIONAL(ENABLE_MAN, test x$enable_man != xno)
1839
1840
1841 ##################################################
1842 # Output commands
1843 ##################################################
1844
1845 AC_CONFIG_COMMANDS([gdk/gdkconfig.h], [
1846         outfile=gdkconfig.h-tmp
1847         cat > $outfile <<\_______EOF
1848 /* gdkconfig.h
1849  *
1850  * This is a generated file.  Please modify `configure.in'
1851  */
1852
1853 #ifndef GDKCONFIG_H
1854 #define GDKCONFIG_H
1855
1856 #ifdef __cplusplus
1857 extern "C" {
1858 #endif /* __cplusplus */
1859
1860 _______EOF
1861
1862         cat >>$outfile <<_______EOF
1863 $gdk_windowing
1864 $gdk_wc
1865 _______EOF
1866
1867         cat >>$outfile <<_______EOF
1868
1869 #ifdef __cplusplus
1870 }
1871 #endif /* __cplusplus */
1872
1873 #endif /* GDKCONFIG_H */
1874 _______EOF
1875
1876
1877         if cmp -s $outfile gdk/gdkconfig.h; then
1878           AC_MSG_NOTICE([gdk/gdkconfig.h is unchanged])
1879           rm -f $outfile
1880         else
1881           mv $outfile gdk/gdkconfig.h
1882         fi
1883 ],[
1884 if test "x$gdktarget" = "xx11" ; then
1885   gdk_windowing='
1886 #define GDK_WINDOWING_X11'
1887 elif test "x$gdktarget" = "xwin32" ; then
1888   gdk_windowing='
1889 #define GDK_WINDOWING_WIN32'
1890 elif test "x$gdktarget" = "xquartz" ; then
1891   gdk_windowing='
1892 #define GDK_WINDOWING_QUARTZ'
1893 elif test "x$gdktarget" = "xdirectfb" ; then
1894   gdk_windowing='
1895 #define GDK_WINDOWING_DIRECTFB'
1896 fi
1897
1898 if test x$gdk_wchar_h = xyes; then
1899   gdk_wc='
1900 #define GDK_HAVE_WCHAR_H 1'
1901 fi
1902 if test x$gdk_wctype_h = xyes; then
1903   gdk_wc="\$gdk_wc
1904 #define GDK_HAVE_WCTYPE_H 1"
1905 fi
1906 if test x$gdk_working_wctype = xno; then
1907   gdk_wc="\$gdk_wc
1908 #define GDK_HAVE_BROKEN_WCTYPE 1"
1909 fi
1910
1911
1912 ])
1913
1914 AC_CONFIG_FILES([
1915 config.h.win32
1916 gtk-zip.sh
1917 Makefile
1918 gdk-pixbuf-2.0.pc
1919 gdk-2.0.pc
1920 gtk+-2.0.pc
1921 gtk+-unix-print-2.0.pc
1922 gail.pc
1923 gdk-pixbuf-2.0-uninstalled.pc
1924 gdk-2.0-uninstalled.pc
1925 gtk+-2.0-uninstalled.pc
1926 gail-uninstalled.pc
1927 m4macros/Makefile
1928 po/Makefile.in
1929 po-properties/Makefile.in
1930 demos/Makefile
1931 demos/gtk-demo/Makefile
1932 demos/gtk-demo/geninclude.pl
1933 tests/Makefile
1934 docs/Makefile
1935 docs/reference/Makefile
1936 docs/reference/gdk-pixbuf/Makefile
1937 docs/reference/gdk-pixbuf/version.xml
1938 docs/reference/gdk/Makefile
1939 docs/reference/gdk/version.xml
1940 docs/reference/gtk/Makefile
1941 docs/reference/gtk/version.xml
1942 docs/reference/libgail-util/Makefile
1943 docs/faq/Makefile
1944 docs/tools/Makefile
1945 docs/tutorial/Makefile
1946 gdk-pixbuf/Makefile
1947 gdk-pixbuf/gdk_pixbuf.rc
1948 gdk-pixbuf/gdk-pixbuf-features.h
1949 gdk-pixbuf/pixops/Makefile
1950 gdk/Makefile
1951 gdk/x11/Makefile
1952 gdk/win32/Makefile
1953 gdk/win32/rc/Makefile
1954 gdk/win32/rc/gdk.rc
1955 gdk/quartz/Makefile
1956 gdk/directfb/Makefile
1957 gtk/Makefile
1958 gtk/makefile.msc
1959 gtk/gtkversion.h
1960 gtk/gtk-win32.rc
1961 gtk/theme-bits/Makefile
1962 gtk/tests/Makefile
1963 gtk/xdgmime/Makefile
1964 modules/Makefile
1965 modules/other/Makefile
1966 modules/other/gail/Makefile
1967 modules/other/gail/libgail-util/Makefile
1968 modules/other/gail/tests/Makefile
1969 modules/engines/Makefile
1970 modules/engines/pixbuf/Makefile
1971 modules/engines/ms-windows/Makefile
1972 modules/engines/ms-windows/Theme/Makefile
1973 modules/engines/ms-windows/Theme/gtk-2.0/Makefile
1974 modules/input/Makefile
1975 modules/printbackends/Makefile
1976 modules/printbackends/cups/Makefile
1977 modules/printbackends/lpr/Makefile
1978 modules/printbackends/file/Makefile
1979 modules/printbackends/test/Makefile
1980 perf/Makefile
1981 contrib/Makefile
1982 contrib/gdk-pixbuf-xlib/Makefile
1983 contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlib-2.0.pc
1984 ])
1985
1986 AC_OUTPUT
1987
1988 echo "configuration:
1989         target: $gdktarget"