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