]> Pileus Git - ~andy/gtk/blob - configure.in
Add check for db2html
[~andy/gtk] / configure.in
1 # Process this file with autoconf to produce a configure script.
2 AC_INIT(gdk/gdktypes.h)
3
4 # In the following, there are a the following variants
5 # of GLib cflags and libs variables
6 #
7 # GLIB_CFLAGS:  cflags for compiling libraries and example progs
8 # GLIB_LIBS:    libraries for linking example programs
9 # GLIB_DEPLIBS: libraries for linking libraries against
10 # glib_cflags:  cflags to store in gtk-config
11 # glib_libs:    libs to store in gtk-config
12 # glib_thread_cflags: cflags to store in gtk-config for gtk-config gthread
13 # glib_thread_libs:   libs to store in gtk-config for gtk-config gthread
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 AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
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=1
31 GTK_MINOR_VERSION=3
32 GTK_MICRO_VERSION=1
33 GTK_INTERFACE_AGE=0
34 GTK_BINARY_AGE=0
35 GTK_VERSION=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION.$GTK_MICRO_VERSION
36 dnl
37 AC_DIVERT_POP()dnl
38
39 AC_SUBST(GTK_MAJOR_VERSION)
40 AC_SUBST(GTK_MINOR_VERSION)
41 AC_SUBST(GTK_MICRO_VERSION)
42 AC_SUBST(GTK_INTERFACE_AGE)
43 AC_SUBST(GTK_BINARY_AGE)
44 AC_SUBST(GTK_VERSION)
45
46 # libtool versioning
47 LT_RELEASE=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION
48 LT_CURRENT=`expr $GTK_MICRO_VERSION - $GTK_INTERFACE_AGE`
49 LT_REVISION=$GTK_INTERFACE_AGE
50 LT_AGE=`expr $GTK_BINARY_AGE - $GTK_INTERFACE_AGE`
51 AC_SUBST(LT_RELEASE)
52 AC_SUBST(LT_CURRENT)
53 AC_SUBST(LT_REVISION)
54 AC_SUBST(LT_AGE)
55
56 #
57 # gdk-pixbuf gets versioned separately, and for now, using standard
58 # libtool versioning, not GTK+-style versioning
59 #
60 GDK_PIXBUF_MAJOR=0
61 GDK_PIXBUF_MINOR=8
62 GDK_PIXBUF_MICRO=0
63 GDK_PIXBUF_VERSION="${GDK_PIXBUF_MAJOR}.${GDK_PIXBUF_MINOR}.${GDK_PIXBUF_MICRO}"
64 AC_SUBST(GDK_PIXBUF_MAJOR)
65 AC_SUBST(GDK_PIXBUF_MINOR)
66 AC_SUBST(GDK_PIXBUF_MICRO)
67 AC_SUBST(GDK_PIXBUF_VERSION)
68
69 # For automake.
70 VERSION=$GTK_VERSION
71 PACKAGE=gtk+
72
73 # Save this value here, since automake will set cflags later
74 cflags_set=${CFLAGS+set}
75
76 dnl Initialize automake stuff
77 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
78
79 # Specify a configuration file
80 AM_CONFIG_HEADER(config.h)
81
82 dnl Initialize libtool
83 AM_PROG_LIBTOOL
84
85 dnl Initialize maintainer mode
86 AM_MAINTAINER_MODE
87
88 AC_CANONICAL_HOST
89
90 dnl figure debugging default, prior to $ac_help setup
91 dnl
92 AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
93 if test `expr $GTK_MINOR_VERSION \% 2` = 1 ; then
94         debug_default=yes
95 else
96         debug_default=minimum
97 fi
98 AC_DIVERT_POP()dnl
99
100 dnl declare --enable-* args and collect ac_help strings
101 AC_ARG_ENABLE(debug, [  --enable-debug=[no/minimum/yes] turn on debugging [default=$debug_default]],,enable_debug=$debug_default)
102 AC_ARG_ENABLE(shm, [  --enable-shm            support shared memory if available [default=yes]],
103                    echo $enable_shm, enable_shm="yes")
104 AC_ARG_ENABLE(ansi, [  --enable-ansi           turn on strict ansi [default=no]],
105                     , enable_ansi=no)
106 AC_ARG_WITH(glib, [  --with-glib=DIR         Use uninstalled copy of glib])
107 AC_ARG_ENABLE(xim, [  --enable-xim            support XIM [default=yes]],
108                         , enable_xim="yes")
109 AC_ARG_ENABLE(xim_inst, [  --disable-xim-inst      does not use xim instantiate callback],
110                         , enable_xim_inst="maybe")
111 AC_ARG_ENABLE(rebuilds, [  --disable-rebuilds      disable all source autogeneration rules],,enable_rebuilds=yes)
112 AC_ARG_WITH(locale, [  --with-locale=LOCALE    locale name you want to use ])
113
114 AC_ARG_WITH(xinput, [  --with-xinput=[no/gxi/xfree] support XInput ])
115
116 gdktarget=x11
117 gdktargetlib=libgdk-x11.la
118 gtktargetlib=libgtk-x11.la
119 AC_ARG_WITH(gdktarget, [  --with-gdktarget=[x11/nanox/linux-fb] select GDK target [default=x11] ],
120         gdktarget=$with_gdktarget)
121
122 AC_SUBST(gdktarget)
123 case $gdktarget in
124   x11|nanox|linux-fb) ;;
125   *) AC_MSG_ERROR([Invalid target for GDK: use x11, nanox or linux-fb.]);;
126 esac
127
128 if test "x$enable_debug" = "xyes"; then
129   test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
130   GTK_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
131 else
132   if test "x$enable_debug" = "xno"; then
133     GTK_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DGTK_NO_CHECK_CASTS"
134   else
135     GTK_DEBUG_FLAGS="-DGTK_NO_CHECK_CASTS"
136   fi
137 fi
138
139 AC_DEFINE_UNQUOTED(GTK_COMPILED_WITH_DEBUGGING, "${enable_debug}")
140
141 # Build time sanity check...
142 AM_SANITY_CHECK
143
144 # Checks for programs.
145 AC_PROG_CC
146 AC_ISC_POSIX
147 AM_PROG_CC_STDC
148 AC_PROG_INSTALL
149 AC_PROG_MAKE_SET
150
151 changequote(,)dnl
152 if test "x$GCC" = "xyes"; then
153   case " $CFLAGS " in
154   *[\ \ ]-Wall[\ \      ]*) ;;
155   *) CFLAGS="$CFLAGS -Wall" ;;
156   esac
157
158   if test "x$enable_ansi" = "xyes"; then
159     case " $CFLAGS " in
160     *[\ \       ]-ansi[\ \      ]*) ;;
161     *) CFLAGS="$CFLAGS -ansi" ;;
162     esac
163
164     case " $CFLAGS " in
165     *[\ \       ]-pedantic[\ \  ]*) ;;
166     *) CFLAGS="$CFLAGS -pedantic" ;;
167     esac
168   fi
169 fi
170 changequote([,])dnl
171
172 # Honor aclocal flags
173 ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
174
175 # define a MAINT-like variable REBUILD which is set if Perl
176 # and awk are found, so autogenerated sources can be rebuilt
177
178 AC_PROG_AWK
179 AC_CHECK_PROGS(PERL, perl5 perl)
180
181 # We would like indent, but don't require it.
182 AC_CHECK_PROG(INDENT, indent, indent)
183
184 REBUILD=\#
185 if test "x$enable_rebuilds" = "xyes" && \
186      test -n "$PERL" && \
187      $PERL -e 'exit !($] >= 5.002)' > /dev/null 2>&1 && \
188      test -n "$AWK" ; then
189   REBUILD=
190 fi
191 AC_SUBST(REBUILD)
192
193 AC_CHECK_FUNCS(lstat)
194
195 AC_MSG_CHECKING(whether make is GNU Make)
196 STRIP_BEGIN=
197 STRIP_END=
198 if $ac_make --version 2>/dev/null | grep '^GNU Make ' >/dev/null ; then
199         STRIP_BEGIN='$(strip $(STRIP_DUMMY)'
200         STRIP_END=')'
201         AC_MSG_RESULT(yes)
202 else
203         AC_MSG_RESULT(no)
204 fi
205 STRIP_DUMMY=
206 AC_SUBST(STRIP_DUMMY)
207 AC_SUBST(STRIP_BEGIN)
208 AC_SUBST(STRIP_END)
209
210 # i18n stuff
211 ALL_LINGUAS="ca cs da de el es et eu fi fr ga gl hr hu it ja ko lt nl no pl pt pt_BR ro ru sk sl sv tr uk wa zh_TW.Big5 zh_CN.GB2312"
212 AM_GTK_GNU_GETTEXT
213 LIBS="$LIBS $INTLLIBS"
214
215 # AM_GTK_GNU_GETTEXT above substs $DATADIRNAME
216 # this is the directory where the *.{mo,gmo} files are installed
217 gtklocaledir='${prefix}/${DATADIRNAME}/locale'
218 AC_SUBST(gtklocaledir)
219
220 dnl The DU4 header files don't provide library prototypes unless 
221 dnl -std1 is given to the native cc.
222 AC_MSG_CHECKING([for extra flags to get ANSI library prototypes])
223
224 gtk_save_LIBS=$LIBS
225 LIBS="$LIBS -lm"
226 AC_TRY_RUN([#include <math.h>
227              int main (void) { return (log(1) != log(1.)); }],
228      AC_MSG_RESULT(none needed),
229      gtk_save_CFLAGS="$CFLAGS"
230      CFLAGS="$CFLAGS -std1"
231      AC_TRY_RUN([#include <math.h>
232                  int main (void) { return (log(1) != log(1.)); }],
233          AC_MSG_RESULT(-std1),
234          AC_MSG_RESULT()
235          CFLAGS="$gtk_save_CFLAGS"
236          AC_MSG_WARN(
237                 [No ANSI prototypes found in library. (-std1 didn't work.)]),
238          true
239      ),
240      AC_MSG_RESULT(none needed)
241 )
242 LIBS=$gtk_save_LIBS
243
244 MATH_LIB=-lm
245 GTK_LIBS_EXTRA=
246 AC_MSG_CHECKING(for the BeOS)
247 case $host in
248   *-*-beos*)
249     AC_MSG_RESULT(yes)
250     GTK_LIBS_EXTRA="-L\$(top_builddir_full)/gdk/.libs -lgdk"
251     MATH_LIB=
252   ;;
253   *)
254     AC_MSG_RESULT(no)
255   ;;
256 esac
257 AC_SUBST(MATH_LIB)
258 AC_SUBST(GTK_LIBS_EXTRA)
259
260 dnl NeXTStep cc seems to need this
261 AC_MSG_CHECKING([for extra flags for POSIX compliance])
262 AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
263   AC_MSG_RESULT(none needed),
264   gtk_save_CFLAGS="$CFLAGS"
265   CFLAGS="$CFLAGS -posix"
266   AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
267     AC_MSG_RESULT(-posix),
268     AC_MSG_RESULT()
269     CFLAGS="$gtk_save_CFLAGS"
270     AC_MSG_WARN([Could not determine POSIX flag. (-posix didn't work.)])))
271
272 if test x$with_glib = xyes ; then
273   AC_MSG_ERROR([
274 *** Directory must be specified for --with-glib])
275 fi
276
277 if test x$with_glib = x ; then 
278   # Look for separately installed glib
279
280   AM_PATH_GLIB(1.3.1,,
281     AC_MSG_ERROR([
282 *** GLIB 1.3.1 or better is required. The latest version of GLIB
283 *** is always available from ftp://ftp.gtk.org/.]),
284     gobject gmodule gthread)
285
286   # we do not want to make all gtk progs to link to thread libraries.
287   glib_cflags=`$GLIB_CONFIG glib gobject gmodule --cflags`
288   glib_thread_cflags="$GLIB_CFLAGS"
289   glib_libs=`$GLIB_CONFIG glib gobject gmodule --libs`
290   glib_thread_libs="$GLIB_LIBS"
291   GLIB_LIBS="$glib_libs"
292   GLIB_DEPLIBS="$glib_libs"
293 else
294   # Use uninstalled glib (assume they got the version right)
295
296   GLIB_CONFIG=$with_glib/glib-config
297   if test -x $GLIB_CONFIG ; then 
298     :
299   else
300     AC_MSG_ERROR([GLIB directory ($with_glib) not present or not configured])
301   fi
302
303   # For use in gtk-config
304   glib_cflags=`$GLIB_CONFIG --cflags gmodule`
305   glib_thread_cflags=`$GLIB_CONFIG --cflags gmodule gthread`
306   glib_libs=`$GLIB_CONFIG --libs gmodule`
307   glib_thread_libs=`$GLIB_CONFIG --libs gmodule gthread`
308
309   glib_release=`$GLIB_CONFIG --version | sed 's%\\.[[0-9]]*$%%'`
310
311   # canonicalize relative paths
312   case $with_glib in 
313     /*)
314       glib_dir=$with_glib
315       ;;
316     *)
317       glib_dir="\$(top_builddir)/$with_glib"
318       ;;
319   esac
320
321   GLIB_CFLAGS="-I$glib_dir -I$glib_dir/gmodule"
322   GLIB_LIBS="$glib_dir/libglib.la $glib_dir/gmodule/libgmodule.la"
323   GLIB_DEPLIBS=
324
325   AC_SUBST(GLIB_CFLAGS)
326   AC_SUBST(GLIB_LIBS)
327 fi
328
329 AC_SUBST(glib_cflags)
330 AC_SUBST(glib_libs)
331 AC_SUBST(glib_thread_cflags)
332 AC_SUBST(glib_thread_libs)
333 AC_SUBST(GLIB_DEPLIBS)
334
335 AC_CHECK_HEADERS(dirent.h, AC_DEFINE(HAVE_DIRENT_H))
336 AC_CHECK_HEADERS(pwd.h, AC_DEFINE(HAVE_PWD_H))
337 AC_CHECK_HEADERS(sys/time.h, AC_DEFINE(HAVE_SYS_TIME_H))
338
339 saved_cflags="$CFLAGS"
340 saved_ldflags="$LDFLAGS"
341
342 if test "x$gdktarget" = "xx11"; then
343   # Find the X11 include and library directories
344   AC_PATH_X
345   AC_PATH_XTRA
346
347   if test "x$x_includes" = "x"; then
348     x_includes="/usr/include"
349   fi
350
351   CFLAGS="$CFLAGS $X_CFLAGS"
352   LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
353
354   if test "x$no_x" = "xyes"; then 
355     AC_MSG_ERROR([
356 *** X libraries or include files not found. Check 'config.log' for 
357 *** more details.])
358   fi
359
360   # Checks for libraries.
361   # Check for the X11 library
362   AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", 
363     AC_MSG_ERROR([*** libX11 not found. Check 'config.log' for more details.]),
364     $X_EXTRA_LIBS)
365
366   if test "x$enable_shm" = "xyes"; then
367     # Check for the Xext library (needed for XShm extention)
368     AC_CHECK_LIB(Xext, XShmAttach, 
369         x_libs="-lXext $x_libs", 
370         # On AIX, it is in XextSam instead, but we still need -lXext
371         AC_CHECK_LIB(XextSam, XShmAttach, 
372             x_libs="-lXextSam -lXext $x_libs", 
373             no_xext_lib=yes, $x_libs),
374         $x_libs)
375   fi
376
377   # Check for shaped window extension
378
379   AC_CHECK_LIB(Xext, XShapeCombineMask,
380       if test -z "`echo $x_libs | grep "\-lXext" 2> /dev/null`"; then
381            x_libs="-lXext $x_libs"
382       fi
383       AC_DEFINE(HAVE_SHAPE_EXT),
384       ,
385       $x_libs)
386
387   # Check for XConvertCase (X11R6 specific)
388
389   AC_CHECK_LIB(X11, XConvertCase,
390       AC_DEFINE(HAVE_XCONVERTCASE),
391       ,
392       $x_libs)
393
394   # Check for XIM support.
395
396   AC_CHECK_LIB(X11, XUnregisterIMInstantiateCallback,
397             : ,
398             enable_xim_inst="no",
399             $x_libs)
400
401   # On Solaris, calling XRegisterIMInstantiateCallback seems to
402   # cause an immediate segfault, so we disable it, unless
403   # the user specifically forces it to be on.
404
405   if test x$enable_xim_inst = xmaybe ; then
406     case host in
407           *-*-solaris*)
408             enable_xim_inst="no"
409             ;;
410           *)
411             enable_xim_inst="yes"
412             ;;
413     esac
414   fi
415
416   if test "x$enable_xim" = "xyes"; then
417     GTK_XIM_FLAGS="-DUSE_XIM"
418     if test "x$enable_xim_inst" = "xyes"; then
419       AC_DEFINE(USE_X11R6_XIM)
420     fi
421   fi
422
423   x_cflags="$X_CFLAGS"
424   x_ldflags="$X_LDFLAGS $X_LIBS"
425
426   # set up things for XInput
427
428   if test "x$with_xinput" = "xgxi" || test "x$with_xinput" = "xyes"; then
429     AC_DEFINE(XINPUT_GXI)
430     xinput_progs=gxid
431     x_libs="-lXi $x_libs"
432   elif test "x$with_xinput" = "xxfree"; then
433     AC_DEFINE(XINPUT_XFREE)
434     x_libs="-lXi $x_libs"
435   else
436     AC_DEFINE(XINPUT_NONE)
437   fi
438
439   AM_CONDITIONAL(XINPUT_GXI, test x$with_xinput = xgxi)
440   AM_CONDITIONAL(XINPUT_XFREE, test x$with_xinput = xxfree)
441
442   if test "x$enable_shm" = "xyes"; then
443     # Check for shared memory
444     AC_CHECK_HEADER(sys/ipc.h, AC_DEFINE(HAVE_IPC_H), no_sys_ipc=yes)
445     AC_CHECK_HEADER(sys/shm.h, AC_DEFINE(HAVE_SHM_H), no_sys_shm=yes)
446
447     # Check for the X shared memory extension header file
448     AC_MSG_CHECKING(X11/extensions/XShm.h)
449     if test "x$no_xext_lib" = "xyes"; then
450       AC_MSG_RESULT(no)
451       no_xshm=yes
452     else
453       if test -f "$x_includes/X11/extensions/XShm.h"; then
454         AC_MSG_RESULT(yes)
455         AC_DEFINE(HAVE_XSHM_H)
456       else
457         AC_MSG_RESULT(no)
458         no_xshm=yes
459       fi
460     fi
461   fi
462
463   more_cflags="$x_cflags"
464   more_ldflags="$x_ldflags"
465   more_libs="$x_libs"
466   more_includes="$x_includes"
467
468   # these are already defined above
469   #gdktargetlib = "libgdk-x11.la"
470   #gtktargetlib = "libgtk-x11.la"
471
472   AM_CONDITIONAL(USE_X11, true)
473 else
474   AM_CONDITIONAL(USE_X11, false)
475 fi
476
477 if test "x$gdktarget" = "xnanox"; then
478   AC_CHECK_LIB(nano-X, GrOpen,,AC_MSG_ERROR([nano-X libraries not found.]))
479   # nano-X may require additional libraries
480   more_cflags=
481   more_ldflags=
482   more_libs="-lnano-X"
483   more_includes=
484
485   gdktargetlib="libgdk-nanox.la"
486   gtktargetlib="libgtk-nanox.la"
487
488   with_xinput=no
489   AC_DEFINE(XINPUT_NONE)
490   x_cflags=
491   x_includes=
492   x_ldflags=
493   x_libs=
494   xinput_progs=
495   AM_CONDITIONAL(USE_NANOX, true)
496 else
497   AM_CONDITIONAL(USE_NANOX, false)
498 fi
499
500 if test "x$gdktarget" = "xlinux-fb"; then
501   more_cflags=
502   more_ldflags=
503   more_libs=
504   more_includes=
505
506   gdktargetlib="libgdk-linux-fb.la"
507   gtktargetlib="libgtk-linux-fb.la"
508
509   with_xinput=no
510   AC_DEFINE(XINPUT_NONE)
511   x_cflags=
512   x_includes=
513   x_ldflags=
514   x_libs=
515   xinput_progs=
516   
517   AM_CONDITIONAL(USE_LINUX_FB, true)
518 else
519   AM_CONDITIONAL(USE_LINUX_FB, false)
520 fi
521
522 #
523 # Check for Pango
524 #
525 AC_PATH_PROG(PANGO_CONFIG, pango-config, no)
526 if test x$PANGO_CONFIG = xno ; then
527   AC_MSG_ERROR([*** pango-config not found])
528 fi
529
530 if test "x$gdktarget" = "xx11"; then
531         PANGO_CFLAGS="`$PANGO_CONFIG --cflags pangox`"
532         PANGO_LIBS="`$PANGO_CONFIG --libs pangox`"
533 else
534         PANGO_CFLAGS="`$PANGO_CONFIG --cflags pango`"
535         PANGO_LIBS="`$PANGO_CONFIG --libs pango`"
536 fi
537 CFLAGS="$CFLAGS $PANGO_CFLAGS"
538 AC_SUBST(PANGO_LIBS)
539 AC_SUBST(PANGO_CFLAGS)
540
541 AC_CHECK_LIB(pango, pango_context_new, :, AC_MSG_ERROR([
542 *** Pango not found. Pango is required to build
543 *** GTK+. For more information see http://www.pango.org]), $PANGO_LIBS $x_ldflags $x_libs)
544
545 CFLAGS="$saved_cflags"
546 LDFLAGS="$saved_ldflags"
547
548 AC_SUBST(x_cflags)
549 AC_SUBST(x_includes)
550 AC_SUBST(x_ldflags)
551 AC_SUBST(x_libs)
552 AC_SUBST(xinput_progs)
553
554 AC_SUBST(more_cflags)
555 AC_SUBST(more_includes)
556 AC_SUBST(more_ldflags)
557 AC_SUBST(more_libs)
558 AC_SUBST(gdktargetlib)
559 AC_SUBST(gtktargetlib)
560
561
562 # Check if X_LOCALE definition is necessary
563
564 AC_MSG_CHECKING(need -DX_LOCALE)
565
566 AC_TRY_RUN([
567 #include <stdio.h>
568 #include <locale.h>
569
570 int
571 main ()
572 {
573   return setlocale (LC_ALL, "${with_locale}") == NULL;
574 }],
575 need_x_locale=no,
576 need_x_locale=yes,
577 need_x_locale=no)
578 AC_MSG_RESULT($need_x_locale)
579
580 if test $need_x_locale = yes; then
581   GTK_LOCALE_FLAGS="-DX_LOCALE"
582 fi
583
584 # Checks for header files.
585 AC_HEADER_STDC
586
587 # Checks for typedefs, structures, and compiler characteristics.
588 AC_C_CONST
589
590 # Checks for library functions.
591 AC_TYPE_SIGNAL
592 AC_FUNC_MMAP
593
594 # Check if <sys/select.h> needs to be included for fd_set
595 AC_MSG_CHECKING([for fd_set])
596 AC_TRY_COMPILE([#include <sys/types.h>],
597         [fd_set readMask, writeMask;], gtk_ok=yes, gtk_ok=no)
598 if test $gtk_ok = yes; then
599     AC_MSG_RESULT([yes, found in sys/types.h])
600 else
601     AC_HEADER_EGREP(fd_mask, sys/select.h, gtk_ok=yes)
602     if test $gtk_ok = yes; then
603         AC_DEFINE(HAVE_SYS_SELECT_H)
604         AC_MSG_RESULT([yes, found in sys/select.h])
605     else
606         AC_DEFINE(NO_FD_SET)
607         AC_MSG_RESULT(no)
608     fi
609 fi
610
611 # `widechar' tests for gdki18n.h
612 AC_MSG_CHECKING(for wchar.h)
613 AC_TRY_CPP([#include <wchar.h>], gdk_wchar_h=yes, gdk_wchar_h=no)
614 if test $gdk_wchar_h = yes; then
615    AC_DEFINE(HAVE_WCHAR_H,1,[Have wchar.h include file])
616 fi
617 AC_MSG_RESULT($gdk_wchar_h)
618
619 # Check for wctype.h (for iswalnum)
620 AC_MSG_CHECKING(for wctype.h)
621 AC_TRY_CPP([#include <wctype.h>], gdk_wctype_h=yes, gdk_wctype_h=no)
622 if test $gdk_wctype_h = yes; then
623    AC_DEFINE(HAVE_WCTYPE_H,1,[Have wctype.h include file])
624 fi
625 AC_MSG_RESULT($gdk_wctype_h)
626
627 # in Solaris 2.5, `iswalnum' is in -lw
628 GDK_WLIBS=
629 AC_CHECK_FUNC(iswalnum,,[AC_CHECK_LIB(w,iswalnum,GDK_WLIBS=-lw)])
630
631 oLIBS="$LIBS"
632 LIBS="$LIBS $GDK_WLIBS"
633 # The following is necessary for Linux libc-5.4.38
634 AC_MSG_CHECKING(if iswalnum() and friends are properly defined)
635 AC_TRY_LINK([#include <stdlib.h>],[
636 #if (defined(HAVE_WCTYPE_H) || defined(HAVE_WCHAR_H))
637 #  ifdef HAVE_WCTYPE_H
638 #    include <wctype.h>
639 #  else
640 #    ifdef HAVE_WCHAR_H
641 #      include <wchar.h>
642 #    endif
643 #  endif
644 #else
645 #  define iswalnum(c) ((wchar_t)(c) <= 0xFF && isalnum(c))
646 #endif
647 iswalnum((wchar_t) 0);
648 ], gdk_working_wctype=yes, gdk_working_wctype=no)
649 LIBS="$oLIBS"
650
651 if test $gdk_working_wctype = no; then
652    AC_DEFINE(HAVE_BROKEN_WCTYPE,1,[Is the wctype implementation broken])
653    GDK_WLIBS=
654 fi
655 AC_MSG_RESULT($gdk_working_wctype)
656 AC_SUBST(GDK_WLIBS)
657
658 AC_SUBST(GTK_DEBUG_FLAGS)
659 AC_SUBST(GTK_XIM_FLAGS)
660 AC_SUBST(GTK_LOCALE_FLAGS)
661
662 ##################################################
663 # Checks for gdk-pixbuf
664 ##################################################
665
666 AC_MSG_CHECKING(whether to build gmodulized gdk-pixbuf)
667
668 AC_ARG_ENABLE(modules, [  --disable-modules       Disables dynamic module loading],[
669         if test x$withval = xyes; then 
670             with_modules=yes
671         else
672             with_modules=no
673         fi
674 ])
675
676 dynworks=false
677 deps=
678 if test x$with_modules = xno; then
679     AC_MSG_RESULT(no)
680 else
681     AC_MSG_RESULT(yes)
682     AC_MSG_CHECKING(whether dynamic modules work)
683     oLIBS="$LIBS"
684     oCFLAGS="$CFLAGS"
685     CFLAGS="$GLIB_CFLAGS"
686     LIBS="$GLIB_LIBS"
687     AC_TRY_RUN([
688     #include <glib.h>
689     #include <gmodule.h>
690     main ()
691     {
692         if (g_module_supported ())
693             exit (0);
694         else
695             exit (1);
696     }
697     ], dynworks=true)
698     LIBS="$oLIBS"
699     CFLAGS="$oCFLAGS"
700 fi
701
702 dnl Now we check to see if our libtool supports shared lib deps
703 dnl (in a rather ugly way even)
704 if $dynworks; then
705    pixbuf_libtool_config="${CONFIG_SHELL-/bin/sh} libtool --config"
706    pixbuf_deplibs_check=`$pixbuf_libtool_config | \
707       grep '^[[a-z_]]*check[[a-z_]]*_method=[['\''"]]' | \
708       sed 's/.*[['\''"]]\(.*\)[['\''"]]$/\1/'`
709    if test "x$pixbuf_deplibs_check" = "xnone" || \
710       test "x$pixbuf_deplibs_check" = "xunknown" || \
711       test "x$pixbuf_deplibs_check" = "x"; then
712       dynworks=false
713    fi
714 fi
715
716 if $dynworks; then
717    AC_DEFINE(USE_GMODULE)
718    GMODULE_LIBS="`glib-config --libs gmodule`"
719    GMODULE_FLAGS="`glib-config --cflags gmodule`"
720    AC_SUBST(GMODULE_LIBS)
721    AC_SUBST(GMODULE_FLAGS)
722    AC_MSG_RESULT(yes)
723 else
724    AC_MSG_RESULT(no)
725 fi
726
727 dnl Test for libtiff
728   if test -z "$LIBTIFF"; then
729     AC_CHECK_LIB(tiff, TIFFReadScanline,
730       AC_CHECK_HEADER(tiffio.h,
731         TIFF='tiff'; LIBTIFF='-ltiff',
732         AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***)),
733       AC_CHECK_LIB(tiff, TIFFWriteScanline,
734         AC_CHECK_HEADER(tiffio.h,
735           TIFF='tiff'; LIBTIFF='-ltiff -ljpeg -lz',
736           AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***)),
737         AC_CHECK_LIB(tiff34, TIFFFlushData,
738           AC_CHECK_HEADER(tiffio.h,
739             TIFF='tiff'; LIBTIFF='-ltiff34 -ljpeg -lz',
740             AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***)),
741         AC_MSG_WARN(*** TIFF plug-in will not be built (TIFF library not found) ***), -ljpeg -lz -lm), -ljpeg -lz -lm), -lm)
742   fi
743
744 dnl Test for libjpeg
745   if test -z "$LIBJPEG"; then
746     AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
747       jpeg_ok=yes,
748       jpeg_ok=no
749       AC_MSG_WARN(*** JPEG loader will not be built (JPEG library not found) ***))
750     if test "$jpeg_ok" = yes; then
751       AC_MSG_CHECKING([for jpeglib.h])
752       AC_TRY_CPP(
753 [#include <stdio.h>
754 #undef PACKAGE
755 #undef VERSION
756 #include <jpeglib.h>],
757         jpeg_ok=yes,
758         jpeg_ok=no)
759       AC_MSG_RESULT($jpeg_ok)
760       if test "$jpeg_ok" = yes; then
761         LIBJPEG='-ljpeg'
762         AC_CHECK_LIB(jpeg, jpeg_simple_progression,     
763           AC_DEFINE(HAVE_PROGRESSIVE_JPEG),
764           AC_MSG_WARN(JPEG library does not support progressive saving.))
765       else
766           AC_MSG_WARN(*** JPEG loader will not be built (JPEG header file not found) ***)
767       fi
768     fi
769   fi
770
771 dnl Test for libpng
772   if test -z "$LIBPNG"; then
773     AC_CHECK_LIB(png, png_read_info,
774       AC_CHECK_HEADER(png.h,
775         png_ok=yes,
776         png_ok=no),
777       AC_MSG_WARN(*** PNG loader will not be built (PNG library not found) ***), -lz -lm)
778     if test "$png_ok" = yes; then
779       AC_MSG_CHECKING([for png_structp in png.h])
780       AC_TRY_COMPILE([#include <png.h>],
781         [png_structp pp; png_infop info; png_colorp cmap; png_create_read_struct;],
782         png_ok=yes,
783         png_ok=no)
784       AC_MSG_RESULT($png_ok)
785       if test "$png_ok" = yes; then
786         PNG='png'; LIBPNG='-lpng -lz'
787       else
788         AC_MSG_WARN(*** PNG loader will not be built (PNG library is too old) ***)
789       fi
790     else
791      AC_MSG_WARN(*** PNG loader will not be built (PNG header file not found) ***)
792     fi
793   fi
794
795 deps="$LIBTIFF $LIBJPEG $LIBPNG"
796
797 AC_SUBST(LIBTIFF)
798 AC_SUBST(LIBJPEG)
799 AC_SUBST(LIBPNG)
800
801 AM_CONDITIONAL(BUILD_DYNAMIC_MODULES, $dynworks)
802
803 AC_HEADER_STDC
804 AC_HEADER_DIRENT
805 AC_HEADER_SYS_WAIT
806
807 AC_TYPE_SIGNAL
808
809 AM_CONDITIONAL(HAVE_TIFF, test "x$LIBTIFF" != x)
810 AM_CONDITIONAL(HAVE_PNG, test "x$LIBPNG" != x)
811 AM_CONDITIONAL(HAVE_JPEG, test "x$LIBJPEG" != x)
812
813 GDK_PIXBUF_LIBDIR='-L${libdir}'
814 GDK_PIXBUF_INCLUDEDIR="-I${includedir} $GTK_CFLAGS"
815 GDK_PIXBUF_LIBS="$GLIB_LIBS -lgdk_pixbuf $deps $GTK_LIBS"
816 AC_SUBST(STATIC_LIB_DEPS)
817 STATIC_LIB_DEPS="$deps"
818
819 AC_SUBST(GDK_PIXBUF_LIBDIR)
820 AC_SUBST(GDK_PIXBUF_INCLUDEDIR)
821 AC_SUBST(GDK_PIXBUF_LIBS)
822
823 # Checks to see if we should compile in MMX support (there will be
824 # a runtime test when the code is actually run to see if it should
825 # be used - this just checks if we can compile it.)
826 #
827 # This code is partially taken from Mesa
828 #
829 AC_MSG_CHECKING(for x86 platform)
830 case $host_cpu in
831   i386|i486|i586|i686|i786|k6|k7)
832         use_x86_asm=yes
833         ;;
834    *)
835         use_x86_asm=no
836 esac
837 AC_MSG_RESULT($use_x86_asm)
838
839 use_mmx_asm=no
840 if test $use_x86_asm = yes; then
841     save_ac_ext=$ac_ext
842     ac_ext=S
843     
844     AC_MSG_CHECKING(compiler support for MMX)
845     cp $srcdir/gdk-pixbuf/pixops/scale_line_22_33_mmx.S conftest.S
846     if AC_TRY_EVAL(ac_compile); then
847         use_mmx_asm=yes
848     fi
849
850     ac_ext=$save_ac_ext
851     if test $use_mmx_asm = yes; then
852       AC_DEFINE(USE_MMX)
853       AC_MSG_RESULT(yes)
854     else
855       AC_MSG_RESULT(no)
856     fi
857 fi
858
859 AM_CONDITIONAL(USE_MMX, test x$use_mmx_asm = xyes)
860
861
862 ##################################################
863 # Checks for gtk-doc and docbook-tools
864 ##################################################
865
866 AC_CHECK_PROG(GTKDOC, gtkdoc-mkdb, true, false)
867 AM_CONDITIONAL(HAVE_GTK_DOC, $GTKDOC)
868 AC_SUBST(HAVE_GTK_DOC)
869
870 AC_CHECK_PROG(DB2HTML, db2html, true, false)
871 AM_CONDITIONAL(HAVE_DOCBOOK, $DB2HTML)
872
873 dnl Let people disable the gtk-doc stuff.
874 AC_ARG_ENABLE(gtk-doc, [  --enable-gtk-doc  Use gtk-doc to build documentation [default=auto]], enable_gtk_doc="$enableval", enable_gtk_doc=auto)
875
876 if test x$enable_gtk_doc = xauto ; then
877   if test x$GTKDOC = xtrue ; then
878     enable_gtk_doc=yes
879   else
880     enable_gtk_doc=no 
881   fi
882 fi
883
884 dnl NOTE: We need to use a separate automake conditional for this
885 dnl       to make this work with the tarballs.
886 AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
887
888 GDK_PIXBUF_DIR=`(cd $srcdir; pwd)`
889 AC_SUBST(GDK_PIXBUF_DIR)
890
891
892 ##################################################
893 # Output commands
894 ##################################################
895
896 AC_OUTPUT_COMMANDS([
897
898 ## Generate `gdk/gdkconfig.h' in two cases
899 ## 1. `config.status' is run either explicitly, or via configure.
900 ##     Esp. not when it is run in `Makefile' to generate makefiles and
901 ##     config.h
902 ## 2. CONFIG_OTHER is set explicitly
903 ##
904 ## Case 1 is difficult.  We know that `automake' sets one of
905 ## CONFIG_FILES or CONFIG_HEADERS to empty.  This heuristic works
906 ## only when AM_CONFIG_HEADER is set, however.
907
908 if test -n "${CONFIG_FILES}" && test -n "${CONFIG_HEADERS}"; then
909   # Both CONFIG_FILES and CONFIG_HEADERS are non-empty ==> Case 1
910   CONFIG_OTHER=${CONFIG_OTHER:-gdk/gdkconfig.h}
911 fi
912 case "$CONFIG_OTHER" in
913 *gdk/gdkconfig.h*)
914         echo creating gdk/gdkconfig.h
915         outfile=gdkconfig.h-tmp
916         cat > $outfile <<\_______EOF
917 /* gdkconfig.h
918  *
919  * This is a generated file.  Please modify `configure.in'
920  */
921
922 #ifndef GDKCONFIG_H
923 #define GDKCONFIG_H
924
925 #ifdef __cplusplus
926 extern "C" {
927 #endif /* __cplusplus */
928
929 _______EOF
930
931         cat >>$outfile <<_______EOF
932 $gdk_windowing
933 $gdk_wc
934 _______EOF
935
936         cat >>$outfile <<_______EOF
937
938 #ifdef __cplusplus
939 }
940 #endif /* __cplusplus */
941
942 #endif /* GDKCONFIG_H */
943 _______EOF
944
945
946         if cmp -s $outfile gdk/gdkconfig.h; then
947           echo gdk/gdkconfig.h is unchanged
948           rm -f $outfile
949         else
950           mv $outfile gdk/gdkconfig.h
951         fi ;;
952 esac
953 ],[
954 # Currently we always use X11 on those systems where we run configure...
955 if test "x$gdktarget" = "xx11" ; then
956   gdk_windowing='
957 #define GDK_WINDOWING_X11'
958 elif test "x$gdktarget" = "xnanox" ; then
959   gdk_windowing='
960 #define GDK_WINDOWING_NANOX'
961 elif test "x$gdktarget" = "xlinux-fb" ; then
962   gdk_windowing='
963 #define GDK_WINDOWING_FB
964 #define GDK_NATIVE_WINDOW_POINTER'
965 fi
966
967 if test x$gdk_wchar_h = xyes; then
968   gdk_wc='
969 #define GDK_HAVE_WCHAR_H 1'
970 fi
971 if test x$gdk_wctype_h = xyes; then
972   gdk_wc="\$gdk_wc
973 #define GDK_HAVE_WCTYPE_H 1"
974 fi
975 if test x$gdk_working_wctype = xno; then
976   gdk_wc="\$gdk_wc
977 #define GDK_HAVE_BROKEN_WCTYPE 1"
978 fi
979
980
981 ])
982
983 AC_PATH_PROG(SGML2HTML, sgml2html, no)
984 AM_CONDITIONAL(HAVE_SGML2HTML, ! test x$SGML2HTML = xno)
985
986 AC_OUTPUT([
987 gtk+.spec
988 docs/gtk-config.1
989 Makefile
990 gtk-config
991 po/Makefile.in
992 demos/Makefile
993 docs/Makefile
994 docs/reference/Makefile
995 docs/reference/gdk-pixbuf/Makefile
996 docs/faq/Makefile
997 docs/tutorial/Makefile
998 gdk-pixbuf/Makefile
999 gdk-pixbuf/gdk-pixbuf-features.h
1000 gdk-pixbuf/pixops/Makefile
1001 gdk/Makefile
1002 gdk/x11/Makefile
1003 gdk/win32/Makefile
1004 gdk/nanox/Makefile
1005 gdk/linux-fb/Makefile
1006 gtk/Makefile
1007 gtk/gtkcompat.h
1008 modules/Makefile
1009 modules/linux-fb/Makefile
1010 ], [chmod +x gtk-config])