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