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