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