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_WITH(locale, [ --with-locale=LOCALE locale name you want to use ])
69 AC_ARG_WITH(xinput, [ --with-xinput=[no/gxi/xfree] support XInput ])
70 AC_ARG_WITH(threads, [ --with-threads=[posix] support threading ])
72 if test "x$enable_debug" = "xyes"; then
73 test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
74 GTK_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
76 if test "x$enable_debug" = "xno"; then
77 GTK_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DGTK_NO_CHECK_CASTS"
79 GTK_DEBUG_FLAGS="-DGTK_NO_CHECK_CASTS"
83 AC_DEFINE_UNQUOTED(GTK_COMPILED_WITH_DEBUGGING, "${enable_debug}")
85 # Build time sanity check...
88 # Checks for programs.
96 if test "x$GCC" = "xyes"; then
98 *[\ \ ]-Wall[\ \ ]*) ;;
99 *) CFLAGS="$CFLAGS -Wall" ;;
102 if test "x$enable_ansi" = "xyes"; then
104 *[\ \ ]-ansi[\ \ ]*) ;;
105 *) CFLAGS="$CFLAGS -ansi" ;;
109 *[\ \ ]-pedantic[\ \ ]*) ;;
110 *) CFLAGS="$CFLAGS -pedantic" ;;
116 # define a MAINT-like variable REBUILD which is set if Perl
117 # and awk are found, so autogenerated sources can be rebuilt
120 AC_CHECK_PROGS(PERL, perl5 perl)
122 # We would like indent, but don't require it.
123 AC_CHECK_PROG(INDENT, indent, indent)
126 if test -n "$PERL" && perl -v | grep 'version 5.' > /dev/null ; then
127 if test -n "$AWK" ; then
136 AC_CHECK_FUNC(gettext,
138 AC_CHECK_LIB(intl, gettext)
141 dnl The DU4 header files don't provide library prototypes unless
142 dnl -std1 is given to the native cc.
143 AC_MSG_CHECKING([for extra flags to get ANSI library prototypes])
147 AC_TRY_RUN([#include <math.h>
148 int main (void) { return (log(1) != log(1.)); }],
149 AC_MSG_RESULT(none needed),
150 gtk_save_CFLAGS=$CFLAGS
151 CFLAGS="$CFLAGS -std1"
152 AC_TRY_RUN([#include <math.h>
153 int main (void) { return (log(1) != log(1.)); }],
154 AC_MSG_RESULT(-std1),
156 CFLAGS=$gtk_save_CFLAGS
158 [No ANSI prototypes found in library. (-std1 didn't work.)])
163 dnl NeXTStep cc seems to need this
164 AC_MSG_CHECKING([for extra flags for POSIX compliance])
165 AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
166 AC_MSG_RESULT(none needed),
167 gtk_save_CFLAGS=$CFLAGS
168 CFLAGS="$CFLAGS -posix"
169 AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
170 AC_MSG_RESULT(-posix),
172 CFLAGS=$gtk_save_CFLAGS
173 AC_MSG_WARN([Could not determine POSIX flag. (-posix didn't work.)])))
175 if test x$with_glib = xyes ; then
177 *** Directory must be specified for --with-glib])
180 if test x$with_glib = x ; then
181 # Look for separately installed glib
185 *** GLIB 1.1.6 or better is required. The latest version of GLIB
186 *** is always available from ftp://ftp.gtk.org.]),
189 glib_cflags=$GLIB_CFLAGS
192 # Use uninstalled glib (assume they got the version right)
194 GLIB_CONFIG=$with_glib/glib-config
195 if test -x $GLIB_CONFIG ; then
198 AC_MSG_ERROR([GLIB directory ($with_glib) not present or not configured])
201 # For use in gtk-config
202 glib_cflags=`$GLIB_CONFIG --cflags`
203 glib_libs=`$GLIB_CONFIG --libs`
205 glib_release=`$GLIB_CONFIG --version | sed 's%\\.[[0-9]]*$%%'`
207 # canonicalize relative paths
213 glib_dir="\$(top_builddir)/$with_glib"
217 GLIB_CFLAGS="-I$glib_dir"
218 GLIB_LIBS=$glib_dir/libglib-$glib_release.la
220 AC_SUBST(GLIB_CFLAGS)
224 AC_SUBST(glib_cflags)
227 # Find the X11 include and library directories
231 if test "x$x_includes" = "x"; then
232 x_includes="/usr/include"
235 saved_cflags="$CFLAGS"
236 saved_ldflags="$LDFLAGS"
238 CFLAGS="$CFLAGS $X_CFLAGS"
239 LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
241 if test "x$no_x" = "xyes"; then
243 *** X libraries or include files not found. Check 'config.log' for
247 # Checks for libraries.
248 # Check for the X11 library
249 AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS",
250 AC_MSG_ERROR([*** libX11 not found. Check 'config.log' for more details.]),
253 if test "x$enable_shm" = "xyes"; then
254 # Check for the Xext library (needed for XShm extention)
255 AC_CHECK_LIB(Xext, XShmAttach,
256 x_libs="-lXext $x_libs",
257 # On AIX, it is in XextSam instead, but we still need -lXext
258 AC_CHECK_LIB(XextSam, XShmAttach,
259 x_libs="-lXextSam -lXext $x_libs",
260 no_xext_lib=yes, $x_libs),
264 # Check for shaped window extension
266 AC_CHECK_LIB(Xext, XShapeCombineMask,
267 if test -z "`echo $x_libs | grep "\-lXext" 2> /dev/null`"; then
268 x_libs="-lXext $x_libs"
270 AC_DEFINE(HAVE_SHAPE_EXT),
274 # Check for XConvertCase (X11R6 specific)
276 AC_CHECK_LIB(X11, XConvertCase,
277 AC_DEFINE(HAVE_XCONVERTCASE),
281 # Check for XIM support.
283 AC_CHECK_LIB(X11, XUnregisterIMInstantiateCallback,
288 if test "x$enable_xim" = "xyes"; then
289 GTK_XIM_FLAGS="-DUSE_XIM"
293 x_ldflags="$X_LDFLAGS $X_LIBS"
295 # set up things for XInput
297 if test "x$with_xinput" = "xgxi" || test "x$with_xinput" = "xyes"; then
298 AC_DEFINE(XINPUT_GXI)
300 x_libs="-lXi $x_libs"
301 elif test "x$with_xinput" = "xxfree"; then
302 AC_DEFINE(XINPUT_XFREE)
303 x_libs="-lXi $x_libs"
305 AC_DEFINE(XINPUT_NONE)
308 CFLAGS="$saved_cflags"
309 LDFLAGS="$saved_ldflags"
315 AC_SUBST(xinput_progs)
317 if test "x$enable_shm" = "xyes"; then
318 # Check for shared memory
319 AC_CHECK_HEADER(sys/ipc.h, AC_DEFINE(HAVE_IPC_H), no_sys_ipc=yes)
320 AC_CHECK_HEADER(sys/shm.h, AC_DEFINE(HAVE_SHM_H), no_sys_shm=yes)
322 # Check for the X shared memory extension header file
323 AC_MSG_CHECKING(X11/extensions/XShm.h)
324 if test "x$no_xext_lib" = "xyes"; then
328 if test -f "$x_includes/X11/extensions/XShm.h"; then
330 AC_DEFINE(HAVE_XSHM_H)
338 # Check if X_LOCALE definition is necessary
340 AC_MSG_CHECKING(need -DX_LOCALE)
349 return setlocale (LC_ALL, "${with_locale}") == NULL;
353 AC_MSG_RESULT($need_x_locale)
355 if test $need_x_locale = yes; then
356 GTK_LOCALE_CFLAGS="-DX_LOCALE"
359 # Checks for header files.
362 # Checks for typedefs, structures, and compiler characteristics.
365 # Checks for library functions.
369 # Check if <sys/select.h> needs to be included for fd_set
370 AC_MSG_CHECKING([for fd_set])
371 AC_TRY_COMPILE([#include <sys/types.h>],
372 [fd_set readMask, writeMask;], gtk_ok=yes, gtk_ok=no)
373 if test $gtk_ok = yes; then
374 AC_MSG_RESULT([yes, found in sys/types.h])
376 AC_HEADER_EGREP(fd_mask, sys/select.h, gtk_ok=yes)
377 if test $gtk_ok = yes; then
378 AC_DEFINE(HAVE_SYS_SELECT_H)
379 AC_MSG_RESULT([yes, found in sys/select.h])
386 # Duplicate `widechar' tests from `glib'.
389 # will not be executed
390 # hack so as not to update `acconfig.h'
391 AC_CHECK_HEADERS(wchar.h wctype.h)
392 AC_CHECK_FUNCS(broken_wctype)
395 AC_MSG_CHECKING(for wchar.h)
396 AC_TRY_CPP([#include <wchar.h>], gtk_ok=yes, gtk_ok=no)
397 if test $gtk_ok = yes; then
398 ac_kludge=HAVE_WCHAR_H
399 AC_DEFINE($ac_kludge)
401 AC_MSG_RESULT($gtk_ok)
403 # Check for wctype.h (for iswalnum)
405 AC_MSG_CHECKING(for wctype.h)
406 AC_TRY_CPP([#include <wctype.h>], gtk_ok=yes, gtk_ok=no)
407 if test $gtk_ok = yes; then
408 ac_kludge=HAVE_WCTYPE_H
409 AC_DEFINE($ac_kludge)
411 AC_MSG_RESULT($gtk_ok)
413 # in Solaris 2.5, `iswalnum' is in -lw
415 AC_CHECK_FUNC(iswalnum,,[AC_CHECK_LIB(w,iswalnum,GDK_WLIBS=-lw)])
417 # The following is necessary for Linux libc-5.4.38
419 LIBS="$LIBS $GDK_WLIBS"
420 AC_MSG_CHECKING(if iswalnum() and friends are properly defined)
421 AC_TRY_LINK([#include <stdlib.h>],[
422 #if (defined(HAVE_WCTYPE_H) || defined(HAVE_WCHAR_H))
423 # ifdef HAVE_WCTYPE_H
431 # define iswalnum(c) ((wchar_t)(c) <= 0xFF && isalnum(c))
433 iswalnum((wchar_t) 0);
434 ], gtk_ok=yes, gtk_ok=no)
437 if test $gtk_ok = no; then
438 ac_kludge=HAVE_BROKEN_WCTYPE
439 AC_DEFINE($ac_kludge)
442 AC_MSG_RESULT($gtk_ok)
445 AC_SUBST(GTK_DEBUG_FLAGS)
446 AC_SUBST(GTK_XIM_FLAGS)
447 AC_SUBST(GTK_LOCALE_FLAGS)
448 AC_SUBST(GTK_THREAD_FLAGS)
459 ], [chmod +x gtk-config])