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