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