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