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