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