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