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