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