1 # Process this file with autoconf to produce a configure script.
2 AC_INIT(gdk/gdktypes.h)
4 # Save this value here, since automake will set cflags later
5 cflags_set=${CFLAGS+set}
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.
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)
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`
42 # Save this value here, since automake will set cflags later
43 cflags_set=${CFLAGS+set}
45 dnl Initialize automake stuff
46 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
48 # Specify a configuration file
49 AM_CONFIG_HEADER(config.h)
51 dnl Initialize libtool
54 dnl Initialize maintainer mode
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]],
64 AC_ARG_WITH(glib, [ --with-glib=DIR Use uninstalled copy of glib])
65 AC_ARG_ENABLE(xim, [ --enable-xim support XIM [default=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 ])
71 AC_ARG_WITH(xinput, [ --with-xinput=[no/gxi/xfree] support XInput ])
73 if test "x$enable_debug" = "xyes"; then
74 test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
75 GTK_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
77 if test "x$enable_debug" = "xno"; then
78 GTK_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DGTK_NO_CHECK_CASTS"
80 GTK_DEBUG_FLAGS="-DGTK_NO_CHECK_CASTS"
84 AC_DEFINE_UNQUOTED(GTK_COMPILED_WITH_DEBUGGING, "${enable_debug}")
86 # Build time sanity check...
89 # Checks for programs.
97 if test "x$GCC" = "xyes"; then
99 *[\ \ ]-Wall[\ \ ]*) ;;
100 *) CFLAGS="$CFLAGS -Wall" ;;
103 if test "x$enable_ansi" = "xyes"; then
105 *[\ \ ]-ansi[\ \ ]*) ;;
106 *) CFLAGS="$CFLAGS -ansi" ;;
110 *[\ \ ]-pedantic[\ \ ]*) ;;
111 *) CFLAGS="$CFLAGS -pedantic" ;;
117 # define a MAINT-like variable REBUILD which is set if Perl
118 # and awk are found, so autogenerated sources can be rebuilt
121 AC_CHECK_PROGS(PERL, perl5 perl)
123 # We would like indent, but don't require it.
124 AC_CHECK_PROG(INDENT, indent, indent)
127 if test -n "$PERL" && perl -v | grep 'version 5.' > /dev/null ; then
128 if test -n "$AWK" ; then
135 ALL_LINGUAS="cs de es fr it ja ko nl no pl pt ru sv"
137 AC_CHECK_FUNC(gettext,
139 AC_CHECK_LIB(intl, gettext)
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)
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])
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),
161 CFLAGS=$gtk_save_CFLAGS
163 [No ANSI prototypes found in library. (-std1 didn't work.)])
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),
177 CFLAGS=$gtk_save_CFLAGS
178 AC_MSG_WARN([Could not determine POSIX flag. (-posix didn't work.)])))
180 if test x$with_glib = xyes ; then
182 *** Directory must be specified for --with-glib])
185 if test x$with_glib = x ; then
186 # Look for separately installed glib
188 AM_PATH_GLIB(1.1.14,,
190 *** GLIB 1.1.14 or better is required. The latest version of GLIB
191 *** is always available from ftp://ftp.gtk.org.]),
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"
200 # Use uninstalled glib (assume they got the version right)
202 GLIB_CONFIG=$with_glib/glib-config
203 if test -x $GLIB_CONFIG ; then
206 AC_MSG_ERROR([GLIB directory ($with_glib) not present or not configured])
209 # For use in gtk-config
210 glib_cflags=`$GLIB_CONFIG --cflags gmodule`
211 glib_libs=`$GLIB_CONFIG --libs gmodule`
213 glib_release=`$GLIB_CONFIG --version | sed 's%\\.[[0-9]]*$%%'`
215 # canonicalize relative paths
221 glib_dir="\$(top_builddir)/$with_glib"
225 GLIB_CFLAGS="-I$glib_dir -I$glib_dir/gmodule"
226 GLIB_LIBS="$glib_dir/libglib.la $glib_dir/gmodule.la"
229 AC_SUBST(GLIB_CFLAGS)
233 AC_SUBST(glib_cflags)
235 AC_SUBST(GLIB_DEPLIBS)
237 # Find the X11 include and library directories
241 if test "x$x_includes" = "x"; then
242 x_includes="/usr/include"
245 saved_cflags="$CFLAGS"
246 saved_ldflags="$LDFLAGS"
248 CFLAGS="$CFLAGS $X_CFLAGS"
249 LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
251 if test "x$no_x" = "xyes"; then
253 *** X libraries or include files not found. Check 'config.log' for
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.]),
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),
274 # Check for shaped window extension
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"
280 AC_DEFINE(HAVE_SHAPE_EXT),
284 # Check for XConvertCase (X11R6 specific)
286 AC_CHECK_LIB(X11, XConvertCase,
287 AC_DEFINE(HAVE_XCONVERTCASE),
291 # Check for XIM support.
293 AC_CHECK_LIB(X11, XUnregisterIMInstantiateCallback,
295 enable_xim_inst="no",
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.
302 if test x$enable_xim_inst = xmaybe ; then
308 enable_xim_inst="yes"
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)
321 x_ldflags="$X_LDFLAGS $X_LIBS"
323 # set up things for XInput
325 if test "x$with_xinput" = "xgxi" || test "x$with_xinput" = "xyes"; then
326 AC_DEFINE(XINPUT_GXI)
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"
333 AC_DEFINE(XINPUT_NONE)
336 CFLAGS="$saved_cflags"
337 LDFLAGS="$saved_ldflags"
343 AC_SUBST(xinput_progs)
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)
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
356 if test -f "$x_includes/X11/extensions/XShm.h"; then
358 AC_DEFINE(HAVE_XSHM_H)
366 # Check if X_LOCALE definition is necessary
368 AC_MSG_CHECKING(need -DX_LOCALE)
377 return setlocale (LC_ALL, "${with_locale}") == NULL;
381 AC_MSG_RESULT($need_x_locale)
383 if test $need_x_locale = yes; then
384 GTK_LOCALE_CFLAGS="-DX_LOCALE"
387 # Checks for header files.
390 # Checks for typedefs, structures, and compiler characteristics.
393 # Checks for library functions.
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])
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])
414 # Duplicate `widechar' tests from `glib'.
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)
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)
429 AC_MSG_RESULT($gtk_ok)
431 # Check for wctype.h (for iswalnum)
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)
439 AC_MSG_RESULT($gtk_ok)
441 # in Solaris 2.5, `iswalnum' is in -lw
443 AC_CHECK_FUNC(iswalnum,,[AC_CHECK_LIB(w,iswalnum,GDK_WLIBS=-lw)])
445 # The following is necessary for Linux libc-5.4.38
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
459 # define iswalnum(c) ((wchar_t)(c) <= 0xFF && isalnum(c))
461 iswalnum((wchar_t) 0);
462 ], gtk_ok=yes, gtk_ok=no)
465 if test $gtk_ok = no; then
466 ac_kludge=HAVE_BROKEN_WCTYPE
467 AC_DEFINE($ac_kludge)
470 AC_MSG_RESULT($gtk_ok)
473 AC_SUBST(GTK_DEBUG_FLAGS)
474 AC_SUBST(GTK_XIM_FLAGS)
475 AC_SUBST(GTK_LOCALE_FLAGS)
485 ], [chmod +x gtk-config])