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