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