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