]> Pileus Git - ~andy/gtk/blob - configure.in
version=1.1.15
[~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 # Making releases:
19 #   GTK_MICRO_VERSION += 1;
20 #   GTK_INTERFACE_AGE += 1;
21 #   GTK_BINARY_AGE += 1;
22 # if any functions have been added, set GTK_INTERFACE_AGE to 0.
23 # if backwards compatibility has been broken,
24 # set GTK_BINARY_AGE and GTK_INTERFACE_AGE to 0.
25 #
26 GTK_MAJOR_VERSION=1
27 GTK_MINOR_VERSION=1
28 GTK_MICRO_VERSION=15
29 GTK_INTERFACE_AGE=1
30 GTK_BINARY_AGE=1
31 GTK_VERSION=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION.$GTK_MICRO_VERSION
32 AC_SUBST(GTK_MAJOR_VERSION)
33 AC_SUBST(GTK_MINOR_VERSION)
34 AC_SUBST(GTK_MICRO_VERSION)
35 AC_SUBST(GTK_INTERFACE_AGE)
36 AC_SUBST(GTK_BINARY_AGE)
37 AC_SUBST(GTK_VERSION)
38
39 # libtool versioning
40 LT_RELEASE=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION
41 LT_CURRENT=`expr $GTK_MICRO_VERSION - $GTK_INTERFACE_AGE`
42 LT_REVISION=$GTK_INTERFACE_AGE
43 LT_AGE=`expr $GTK_BINARY_AGE - $GTK_INTERFACE_AGE`
44 AC_SUBST(LT_RELEASE)
45 AC_SUBST(LT_CURRENT)
46 AC_SUBST(LT_REVISION)
47 AC_SUBST(LT_AGE)
48
49 # For automake.
50 VERSION=$GTK_VERSION
51 PACKAGE=gtk+
52
53 # Save this value here, since automake will set cflags later
54 cflags_set=${CFLAGS+set}
55
56 dnl Initialize automake stuff
57 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
58
59 # Specify a configuration file
60 AM_CONFIG_HEADER(config.h)
61
62 dnl Initialize libtool
63 AM_PROG_LIBTOOL
64
65 dnl Initialize maintainer mode
66 AM_MAINTAINER_MODE
67
68 AC_CANONICAL_HOST
69
70 AC_ARG_ENABLE(shm, [  --enable-shm            support shared memory if available [default=yes]],
71                    echo $enable_shm, enable_shm="yes")
72 AC_ARG_ENABLE(debug, [  --enable-debug=[no/minimum/yes] turn on debugging [default=minimum]],,enable_debug=minimum)
73 AC_ARG_ENABLE(ansi, [  --enable-ansi           turn on strict ansi [default=no]],
74                     , enable_ansi=no)
75 AC_ARG_WITH(glib, [  --with-glib=DIR         Use uninstalled copy of glib])
76 AC_ARG_ENABLE(xim, [  --enable-xim            support XIM [default=yes]],
77                         , enable_xim="yes")
78 AC_ARG_ENABLE(xim_inst, [  --disable-xim-inst      does not use xim instantiate callback],
79                         , enable_xim_inst="maybe")
80 AC_ARG_WITH(locale, [  --with-locale=LOCALE    locale name you want to use ])
81
82 AC_ARG_WITH(xinput, [  --with-xinput=[no/gxi/xfree] support XInput ])
83
84 if test "x$enable_debug" = "xyes"; then
85   test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
86   GTK_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
87 else
88   if test "x$enable_debug" = "xno"; then
89     GTK_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DGTK_NO_CHECK_CASTS"
90   else
91     GTK_DEBUG_FLAGS="-DGTK_NO_CHECK_CASTS"
92   fi
93 fi
94
95 AC_DEFINE_UNQUOTED(GTK_COMPILED_WITH_DEBUGGING, "${enable_debug}")
96
97 # Build time sanity check...
98 AM_SANITY_CHECK
99
100 # Checks for programs.
101 AC_PROG_CC
102 AC_ISC_POSIX
103 AM_PROG_CC_STDC
104 AC_PROG_INSTALL
105 AC_PROG_MAKE_SET
106
107 changequote(,)dnl
108 if test "x$GCC" = "xyes"; then
109   case " $CFLAGS " in
110   *[\ \ ]-Wall[\ \      ]*) ;;
111   *) CFLAGS="$CFLAGS -Wall" ;;
112   esac
113
114   if test "x$enable_ansi" = "xyes"; then
115     case " $CFLAGS " in
116     *[\ \       ]-ansi[\ \      ]*) ;;
117     *) CFLAGS="$CFLAGS -ansi" ;;
118     esac
119
120     case " $CFLAGS " in
121     *[\ \       ]-pedantic[\ \  ]*) ;;
122     *) CFLAGS="$CFLAGS -pedantic" ;;
123     esac
124   fi
125 fi
126 changequote([,])dnl
127
128 # define a MAINT-like variable REBUILD which is set if Perl
129 # and awk are found, so autogenerated sources can be rebuilt
130
131 AC_PROG_AWK
132 AC_CHECK_PROGS(PERL, perl5 perl)
133
134 # We would like indent, but don't require it.
135 AC_CHECK_PROG(INDENT, indent, indent)
136
137 REBUILD=\#
138 if test -n "$PERL" && perl -v | grep 'version 5.' > /dev/null ; then
139   if test -n "$AWK" ; then 
140     REBUILD=
141   fi
142 fi
143 AC_SUBST(REBUILD)
144
145 # i18n stuff
146 ALL_LINGUAS="cs de es fr it ja ko nl no pl pt ru sv"
147 AM_GTK_GNU_GETTEXT
148 AC_CHECK_FUNC(gettext,
149         ,
150         AC_CHECK_LIB(intl, gettext)
151 )
152 # AM_GTK_GNU_GETTEXT above substs $DATADIRNAME
153 # this is the directory where the *.{mo,gmo} files are installed
154 gtklocaledir='${prefix}/${DATADIRNAME}/locale'
155 AC_SUBST(gtklocaledir)
156
157 dnl The DU4 header files don't provide library prototypes unless 
158 dnl -std1 is given to the native cc.
159 AC_MSG_CHECKING([for extra flags to get ANSI library prototypes])
160
161 gtk_save_LIBS=$LIBS
162 LIBS="$LIBS -lm"
163 AC_TRY_RUN([#include <math.h>
164              int main (void) { return (log(1) != log(1.)); }],
165      AC_MSG_RESULT(none needed),
166      gtk_save_CFLAGS=$CFLAGS
167      CFLAGS="$CFLAGS -std1"
168      AC_TRY_RUN([#include <math.h>
169                  int main (void) { return (log(1) != log(1.)); }],
170          AC_MSG_RESULT(-std1),
171          AC_MSG_RESULT()
172          CFLAGS=$gtk_save_CFLAGS
173          AC_MSG_WARN(
174                 [No ANSI prototypes found in library. (-std1 didn't work.)])
175      )
176 )
177 LIBS=$gtk_save_LIBS
178
179 dnl NeXTStep cc seems to need this
180 AC_MSG_CHECKING([for extra flags for POSIX compliance])
181 AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
182   AC_MSG_RESULT(none needed),
183   gtk_save_CFLAGS=$CFLAGS
184   CFLAGS="$CFLAGS -posix"
185   AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
186     AC_MSG_RESULT(-posix),
187     AC_MSG_RESULT()
188     CFLAGS=$gtk_save_CFLAGS
189     AC_MSG_WARN([Could not determine POSIX flag. (-posix didn't work.)])))
190
191 if test x$with_glib = xyes ; then
192   AC_MSG_ERROR([
193 *** Directory must be specified for --with-glib])
194 fi
195
196 if test x$with_glib = x ; then 
197   # Look for separately installed glib
198
199   AM_PATH_GLIB(1.1.15,,
200     AC_MSG_ERROR([
201 *** GLIB 1.1.15 or better is required. The latest version of GLIB
202 *** is always available from ftp://ftp.gtk.org.]),
203     gmodule gthread)
204
205   # we do not want to make all gtk progs to link to thread libraries.
206   glib_cflags=`$GLIB_CONFIG glib gmodule --cflags`
207   glib_thread_cflags="$GLIB_CFLAGS"
208   glib_libs=`$GLIB_CONFIG glib gmodule --libs`
209   glib_thread_libs="$GLIB_LIBS"
210   GLIB_LIBS="$glib_libs"
211   GLIB_DEPLIBS="$glib_libs"
212 else
213   # Use uninstalled glib (assume they got the version right)
214
215   GLIB_CONFIG=$with_glib/glib-config
216   if test -x $GLIB_CONFIG ; then 
217     :
218   else
219     AC_MSG_ERROR([GLIB directory ($with_glib) not present or not configured])
220   fi
221
222   # For use in gtk-config
223   glib_cflags=`$GLIB_CONFIG --cflags gmodule`
224   glib_thread_cflags=`$GLIB_CONFIG --cflags gmodule gthread`
225   glib_libs=`$GLIB_CONFIG --libs gmodule`
226   glib_thread_libs=`$GLIB_CONFIG --libs gmodule gthread`
227
228   glib_release=`$GLIB_CONFIG --version | sed 's%\\.[[0-9]]*$%%'`
229
230   # canonicalize relative paths
231   case $with_glib in 
232     /*)
233       glib_dir=$with_glib
234       ;;
235     *)
236       glib_dir="\$(top_builddir)/$with_glib"
237       ;;
238   esac
239
240   GLIB_CFLAGS="-I$glib_dir -I$glib_dir/gmodule"
241   GLIB_LIBS="$glib_dir/libglib.la $glib_dir/gmodule.la"
242   GLIB_DEPLIBS=
243
244   AC_SUBST(GLIB_CFLAGS)
245   AC_SUBST(GLIB_LIBS)
246 fi
247
248 AC_SUBST(glib_cflags)
249 AC_SUBST(glib_libs)
250 AC_SUBST(glib_thread_cflags)
251 AC_SUBST(glib_thread_libs)
252 AC_SUBST(GLIB_DEPLIBS)
253
254 # Find the X11 include and library directories
255 AC_PATH_X
256 AC_PATH_XTRA
257
258 if test "x$x_includes" = "x"; then
259   x_includes="/usr/include"
260 fi
261
262 saved_cflags="$CFLAGS"
263 saved_ldflags="$LDFLAGS"
264
265 CFLAGS="$CFLAGS $X_CFLAGS"
266 LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
267
268 if test "x$no_x" = "xyes"; then 
269   AC_MSG_ERROR([
270 *** X libraries or include files not found. Check 'config.log' for 
271 *** more details.])
272 fi
273
274 # Checks for libraries.
275 # Check for the X11 library
276 AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", 
277   AC_MSG_ERROR([*** libX11 not found. Check 'config.log' for more details.]),
278   $X_EXTRA_LIBS)
279
280 if test "x$enable_shm" = "xyes"; then
281   # Check for the Xext library (needed for XShm extention)
282   AC_CHECK_LIB(Xext, XShmAttach, 
283       x_libs="-lXext $x_libs", 
284       # On AIX, it is in XextSam instead, but we still need -lXext
285       AC_CHECK_LIB(XextSam, XShmAttach, 
286           x_libs="-lXextSam -lXext $x_libs", 
287           no_xext_lib=yes, $x_libs),
288       $x_libs)
289 fi
290
291 # Check for shaped window extension
292
293 AC_CHECK_LIB(Xext, XShapeCombineMask,
294       if test -z "`echo $x_libs | grep "\-lXext" 2> /dev/null`"; then
295            x_libs="-lXext $x_libs"
296       fi
297       AC_DEFINE(HAVE_SHAPE_EXT),
298       ,
299       $x_libs)
300
301 # Check for XConvertCase (X11R6 specific)
302
303 AC_CHECK_LIB(X11, XConvertCase,
304       AC_DEFINE(HAVE_XCONVERTCASE),
305       ,
306       $x_libs)
307
308 # Check for XIM support.
309
310 AC_CHECK_LIB(X11, XUnregisterIMInstantiateCallback,
311             : ,
312             enable_xim_inst="no",
313             $x_libs)
314
315 # On Solaris, calling XRegisterIMInstantiateCallback seems to
316 # cause an immediate segfault, so we disable it, unless
317 # the user specifically forces it to be on.
318
319 if test x$enable_xim_inst = xmaybe ; then
320   case host in
321         *-*-solaris*)
322             enable_xim_inst="no"
323             ;;
324         *)
325             enable_xim_inst="yes"
326             ;;
327   esac
328 fi
329
330 if test "x$enable_xim" = "xyes"; then
331   GTK_XIM_FLAGS="-DUSE_XIM"
332   if test "x$enable_xim_inst" = "xno"; then
333     AC_DEFINE(XIM_INST_IS_MISSING_OR_STRANGE)
334   fi
335 fi
336
337 x_cflags="$X_CFLAGS"
338 x_ldflags="$X_LDFLAGS $X_LIBS"
339
340 # set up things for XInput
341
342 if test "x$with_xinput" = "xgxi" || test "x$with_xinput" = "xyes"; then
343   AC_DEFINE(XINPUT_GXI)
344   xinput_progs=gxid
345   x_libs="-lXi $x_libs"
346 elif test "x$with_xinput" = "xxfree"; then
347   AC_DEFINE(XINPUT_XFREE)
348   x_libs="-lXi $x_libs"
349 else
350   AC_DEFINE(XINPUT_NONE)
351 fi
352
353 CFLAGS="$saved_cflags"
354 LDFLAGS="$saved_ldflags"
355
356 AC_SUBST(x_cflags)
357 AC_SUBST(x_includes)
358 AC_SUBST(x_ldflags)
359 AC_SUBST(x_libs)
360 AC_SUBST(xinput_progs)
361
362 if test "x$enable_shm" = "xyes"; then
363   # Check for shared memory
364   AC_CHECK_HEADER(sys/ipc.h, AC_DEFINE(HAVE_IPC_H), no_sys_ipc=yes)
365   AC_CHECK_HEADER(sys/shm.h, AC_DEFINE(HAVE_SHM_H), no_sys_shm=yes)
366
367   # Check for the X shared memory extension header file
368   AC_MSG_CHECKING(X11/extensions/XShm.h)
369   if test "x$no_xext_lib" = "xyes"; then
370     AC_MSG_RESULT(no)
371     no_xshm=yes
372   else
373     if test -f "$x_includes/X11/extensions/XShm.h"; then
374       AC_MSG_RESULT(yes)
375       AC_DEFINE(HAVE_XSHM_H)
376     else
377       AC_MSG_RESULT(no)
378       no_xshm=yes
379     fi
380   fi
381 fi
382
383 # Check if X_LOCALE definition is necessary
384
385 AC_MSG_CHECKING(need -DX_LOCALE)
386
387 AC_TRY_RUN([
388 #include <stdio.h>
389 #include <locale.h>
390
391 int
392 main ()
393 {
394   return setlocale (LC_ALL, "${with_locale}") == NULL;
395 }],
396 need_x_locale=no,
397 need_x_locale=yes)
398 AC_MSG_RESULT($need_x_locale)
399
400 if test $need_x_locale = yes; then
401   GTK_LOCALE_CFLAGS="-DX_LOCALE"
402 fi
403
404 # Checks for header files.
405 AC_HEADER_STDC
406
407 # Checks for typedefs, structures, and compiler characteristics.
408 AC_C_CONST
409
410 # Checks for library functions.
411 AC_TYPE_SIGNAL
412 AC_FUNC_MMAP
413
414 # Check if <sys/select.h> needs to be included for fd_set
415 AC_MSG_CHECKING([for fd_set])
416 AC_TRY_COMPILE([#include <sys/types.h>],
417         [fd_set readMask, writeMask;], gtk_ok=yes, gtk_ok=no)
418 if test $gtk_ok = yes; then
419     AC_MSG_RESULT([yes, found in sys/types.h])
420 else
421     AC_HEADER_EGREP(fd_mask, sys/select.h, gtk_ok=yes)
422     if test $gtk_ok = yes; then
423         AC_DEFINE(HAVE_SYS_SELECT_H)
424         AC_MSG_RESULT([yes, found in sys/select.h])
425     else
426         AC_DEFINE(NO_FD_SET)
427         AC_MSG_RESULT(no)
428     fi
429 fi
430
431 # Duplicate `widechar' tests from `glib'.
432 # Check for wchar.h
433 if test x = y; then
434   # will not be executed
435   # hack so as not to update `acconfig.h'
436   AC_CHECK_HEADERS(wchar.h wctype.h)
437   AC_CHECK_FUNCS(broken_wctype)
438 fi
439
440 AC_MSG_CHECKING(for wchar.h)
441 AC_TRY_CPP([#include <wchar.h>], gtk_ok=yes, gtk_ok=no)
442 if test $gtk_ok = yes; then
443    ac_kludge=HAVE_WCHAR_H
444    AC_DEFINE($ac_kludge)
445 fi
446 AC_MSG_RESULT($gtk_ok)
447
448 # Check for wctype.h (for iswalnum)
449
450 AC_MSG_CHECKING(for wctype.h)
451 AC_TRY_CPP([#include <wctype.h>], gtk_ok=yes, gtk_ok=no)
452 if test $gtk_ok = yes; then
453    ac_kludge=HAVE_WCTYPE_H
454    AC_DEFINE($ac_kludge)
455 fi
456 AC_MSG_RESULT($gtk_ok)
457
458 # in Solaris 2.5, `iswalnum' is in -lw
459 GDK_WLIBS=
460 AC_CHECK_FUNC(iswalnum,,[AC_CHECK_LIB(w,iswalnum,GDK_WLIBS=-lw)])
461
462 # The following is necessary for Linux libc-5.4.38
463 oLIBS="$LIBS"
464 LIBS="$LIBS $GDK_WLIBS"
465 AC_MSG_CHECKING(if iswalnum() and friends are properly defined)
466 AC_TRY_LINK([#include <stdlib.h>],[
467 #if (defined(HAVE_WCTYPE_H) || defined(HAVE_WCHAR_H))
468 #  ifdef HAVE_WCTYPE_H
469 #    include <wctype.h>
470 #  else
471 #    ifdef HAVE_WCHAR_H
472 #      include <wchar.h>
473 #    endif
474 #  endif
475 #else
476 #  define iswalnum(c) ((wchar_t)(c) <= 0xFF && isalnum(c))
477 #endif
478 iswalnum((wchar_t) 0);
479 ], gtk_ok=yes, gtk_ok=no)
480 LIBS="$oLIBS"
481
482 if test $gtk_ok = no; then
483    ac_kludge=HAVE_BROKEN_WCTYPE
484    AC_DEFINE($ac_kludge)
485    GDK_WLIBS=
486 fi
487 AC_MSG_RESULT($gtk_ok)
488 AC_SUBST(GDK_WLIBS)
489
490 AC_SUBST(GTK_DEBUG_FLAGS)
491 AC_SUBST(GTK_XIM_FLAGS)
492 AC_SUBST(GTK_LOCALE_FLAGS)
493
494 AC_OUTPUT([
495 Makefile
496 gtk-config
497 po/Makefile.in
498 docs/Makefile
499 gdk/Makefile
500 gtk/Makefile
501 gtk/gtkfeatures.h
502 ], [chmod +x gtk-config])