1 # Process this file with autoconf to produce a configure script.
2 AC_INIT(gdk/gdktypes.h)
4 # In the following, there are a the following variants
5 # of GLib cflags and libs variables
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
15 # Save this value here, since automake will set cflags later
16 cflags_set=${CFLAGS+set}
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.
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)
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`
53 # Save this value here, since automake will set cflags later
54 cflags_set=${CFLAGS+set}
56 dnl Initialize automake stuff
57 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
59 # Specify a configuration file
60 AM_CONFIG_HEADER(config.h)
62 dnl Initialize libtool
65 dnl Initialize maintainer mode
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]],
75 AC_ARG_WITH(glib, [ --with-glib=DIR Use uninstalled copy of glib])
76 AC_ARG_ENABLE(xim, [ --enable-xim support XIM [default=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 ])
82 AC_ARG_WITH(xinput, [ --with-xinput=[no/gxi/xfree] support XInput ])
84 if test "x$enable_debug" = "xyes"; then
85 test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
86 GTK_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
88 if test "x$enable_debug" = "xno"; then
89 GTK_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DGTK_NO_CHECK_CASTS"
91 GTK_DEBUG_FLAGS="-DGTK_NO_CHECK_CASTS"
95 AC_DEFINE_UNQUOTED(GTK_COMPILED_WITH_DEBUGGING, "${enable_debug}")
97 # Build time sanity check...
100 # Checks for programs.
108 if test "x$GCC" = "xyes"; then
110 *[\ \ ]-Wall[\ \ ]*) ;;
111 *) CFLAGS="$CFLAGS -Wall" ;;
114 if test "x$enable_ansi" = "xyes"; then
116 *[\ \ ]-ansi[\ \ ]*) ;;
117 *) CFLAGS="$CFLAGS -ansi" ;;
121 *[\ \ ]-pedantic[\ \ ]*) ;;
122 *) CFLAGS="$CFLAGS -pedantic" ;;
128 # define a MAINT-like variable REBUILD which is set if Perl
129 # and awk are found, so autogenerated sources can be rebuilt
132 AC_CHECK_PROGS(PERL, perl5 perl)
134 # We would like indent, but don't require it.
135 AC_CHECK_PROG(INDENT, indent, indent)
138 if test -n "$PERL" && perl -v | grep 'version 5.' > /dev/null ; then
139 if test -n "$AWK" ; then
146 ALL_LINGUAS="cs de es fr it ja ko nl no pl pt ru sv"
148 AC_CHECK_FUNC(gettext,
150 AC_CHECK_LIB(intl, gettext)
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)
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])
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),
172 CFLAGS=$gtk_save_CFLAGS
174 [No ANSI prototypes found in library. (-std1 didn't work.)])
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),
188 CFLAGS=$gtk_save_CFLAGS
189 AC_MSG_WARN([Could not determine POSIX flag. (-posix didn't work.)])))
191 if test x$with_glib = xyes ; then
193 *** Directory must be specified for --with-glib])
196 if test x$with_glib = x ; then
197 # Look for separately installed glib
199 AM_PATH_GLIB(1.1.15,,
201 *** GLIB 1.1.15 or better is required. The latest version of GLIB
202 *** is always available from ftp://ftp.gtk.org.]),
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"
213 # Use uninstalled glib (assume they got the version right)
215 GLIB_CONFIG=$with_glib/glib-config
216 if test -x $GLIB_CONFIG ; then
219 AC_MSG_ERROR([GLIB directory ($with_glib) not present or not configured])
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`
228 glib_release=`$GLIB_CONFIG --version | sed 's%\\.[[0-9]]*$%%'`
230 # canonicalize relative paths
236 glib_dir="\$(top_builddir)/$with_glib"
240 GLIB_CFLAGS="-I$glib_dir -I$glib_dir/gmodule"
241 GLIB_LIBS="$glib_dir/libglib.la $glib_dir/gmodule.la"
244 AC_SUBST(GLIB_CFLAGS)
248 AC_SUBST(glib_cflags)
250 AC_SUBST(glib_thread_cflags)
251 AC_SUBST(glib_thread_libs)
252 AC_SUBST(GLIB_DEPLIBS)
254 # Find the X11 include and library directories
258 if test "x$x_includes" = "x"; then
259 x_includes="/usr/include"
262 saved_cflags="$CFLAGS"
263 saved_ldflags="$LDFLAGS"
265 CFLAGS="$CFLAGS $X_CFLAGS"
266 LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
268 if test "x$no_x" = "xyes"; then
270 *** X libraries or include files not found. Check 'config.log' for
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.]),
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),
291 # Check for shaped window extension
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"
297 AC_DEFINE(HAVE_SHAPE_EXT),
301 # Check for XConvertCase (X11R6 specific)
303 AC_CHECK_LIB(X11, XConvertCase,
304 AC_DEFINE(HAVE_XCONVERTCASE),
308 # Check for XIM support.
310 AC_CHECK_LIB(X11, XUnregisterIMInstantiateCallback,
312 enable_xim_inst="no",
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.
319 if test x$enable_xim_inst = xmaybe ; then
325 enable_xim_inst="yes"
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)
338 x_ldflags="$X_LDFLAGS $X_LIBS"
340 # set up things for XInput
342 if test "x$with_xinput" = "xgxi" || test "x$with_xinput" = "xyes"; then
343 AC_DEFINE(XINPUT_GXI)
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"
350 AC_DEFINE(XINPUT_NONE)
353 CFLAGS="$saved_cflags"
354 LDFLAGS="$saved_ldflags"
360 AC_SUBST(xinput_progs)
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)
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
373 if test -f "$x_includes/X11/extensions/XShm.h"; then
375 AC_DEFINE(HAVE_XSHM_H)
383 # Check if X_LOCALE definition is necessary
385 AC_MSG_CHECKING(need -DX_LOCALE)
394 return setlocale (LC_ALL, "${with_locale}") == NULL;
398 AC_MSG_RESULT($need_x_locale)
400 if test $need_x_locale = yes; then
401 GTK_LOCALE_CFLAGS="-DX_LOCALE"
404 # Checks for header files.
407 # Checks for typedefs, structures, and compiler characteristics.
410 # Checks for library functions.
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])
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])
431 # Duplicate `widechar' tests from `glib'.
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)
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)
446 AC_MSG_RESULT($gtk_ok)
448 # Check for wctype.h (for iswalnum)
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)
456 AC_MSG_RESULT($gtk_ok)
458 # in Solaris 2.5, `iswalnum' is in -lw
460 AC_CHECK_FUNC(iswalnum,,[AC_CHECK_LIB(w,iswalnum,GDK_WLIBS=-lw)])
462 # The following is necessary for Linux libc-5.4.38
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
476 # define iswalnum(c) ((wchar_t)(c) <= 0xFF && isalnum(c))
478 iswalnum((wchar_t) 0);
479 ], gtk_ok=yes, gtk_ok=no)
482 if test $gtk_ok = no; then
483 ac_kludge=HAVE_BROKEN_WCTYPE
484 AC_DEFINE($ac_kludge)
487 AC_MSG_RESULT($gtk_ok)
490 AC_SUBST(GTK_DEBUG_FLAGS)
491 AC_SUBST(GTK_XIM_FLAGS)
492 AC_SUBST(GTK_LOCALE_FLAGS)
502 ], [chmod +x gtk-config])