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