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