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.
95 if test "x$GCC" = "xyes"; then
97 *[\ \ ]-Wall[\ \ ]*) ;;
98 *) CFLAGS="$CFLAGS -Wall" ;;
101 if test "x$enable_ansi" = "xyes"; then
103 *[\ \ ]-ansi[\ \ ]*) ;;
104 *) CFLAGS="$CFLAGS -ansi" ;;
108 *[\ \ ]-pedantic[\ \ ]*) ;;
109 *) CFLAGS="$CFLAGS -pedantic" ;;
115 # define a MAINT-like variable REBUILD which is set if Perl
116 # and awk are found, so autogenerated sources can be rebuilt
119 AC_CHECK_PROGS(PERL, perl5 perl)
121 # We would like indent, but don't require it.
122 AC_CHECK_PROG(INDENT, indent, indent)
125 if test -n "$PERL" && perl -v | grep 'version 5.' > /dev/null ; then
126 if test -n "$AWK" ; then
132 dnl The DU4 header files don't provide library prototypes unless
133 dnl -std1 is given to the native cc.
134 AC_MSG_CHECKING([for extra flags to get ANSI library prototypes])
138 AC_TRY_RUN([#include <math.h>
139 int main (void) { return (log(1) != log(1.)); }],
140 AC_MSG_RESULT(none needed),
141 gtk_save_CFLAGS=$CFLAGS
142 CFLAGS="$CFLAGS -std1"
143 AC_TRY_RUN([#include <math.h>
144 int main (void) { return (log(1) != log(1.)); }],
145 AC_MSG_RESULT(-std1),
147 CFLAGS=$gtk_save_CFLAGS
149 [No ANSI prototypes found in library. (-std1 didn't work.)])
154 dnl NeXTStep cc seems to need this
155 AC_MSG_CHECKING([for extra flags for POSIX compliance])
156 AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
157 AC_MSG_RESULT(none needed),
158 gtk_save_CFLAGS=$CFLAGS
159 CFLAGS="$CFLAGS -posix"
160 AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
161 AC_MSG_RESULT(-posix),
163 CFLAGS=$gtk_save_CFLAGS
164 AC_MSG_WARN([Could not determine POSIX flag. (-posix didn't work.)])))
166 if test x$with_glib = xyes ; then
168 *** Directory must be specified for --with-glib])
171 if test x$with_glib = x ; then
172 # Look for separately installed glib
176 *** GLIB 1.1.6 or better is required. The latest version of GLIB
177 *** is always available from ftp://ftp.gtk.org.]),
180 glib_cflags=$GLIB_CFLAGS
183 # Use uninstalled glib (assume they got the version right)
185 GLIB_CONFIG=$with_glib/glib-config
186 if test -x $GLIB_CONFIG ; then
189 AC_MSG_ERROR([GLIB directory ($with_glib) not present or not configured])
192 # For use in gtk-config
193 glib_cflags=`$GLIB_CONFIG --cflags`
194 glib_libs=`$GLIB_CONFIG --libs`
196 glib_release=`$GLIB_CONFIG --version | sed 's%\\.[[0-9]]*$%%'`
198 # canonicalize relative paths
204 glib_dir="\$(top_builddir)/$with_glib"
208 GLIB_CFLAGS="-I$glib_dir"
209 GLIB_LIBS=$glib_dir/libglib-$glib_release.la
211 AC_SUBST(GLIB_CFLAGS)
215 AC_SUBST(glib_cflags)
218 # Find the X11 include and library directories
222 if test "x$x_includes" = "x"; then
223 x_includes="/usr/include"
226 saved_cflags="$CFLAGS"
227 saved_ldflags="$LDFLAGS"
229 CFLAGS="$CFLAGS $X_CFLAGS"
230 LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
232 if test "x$no_x" = "xyes"; then
234 *** X libraries or include files not found. Check 'config.log' for
238 # Checks for libraries.
239 # Check for the X11 library
240 AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS",
241 AC_MSG_ERROR([*** libX11 not found. Check 'config.log' for more details.]),
244 if test "x$enable_shm" = "xyes"; then
245 # Check for the Xext library (needed for XShm extention)
246 AC_CHECK_LIB(Xext, XShmAttach,
247 x_libs="-lXext $x_libs",
248 # On AIX, it is in XextSam instead, but we still need -lXext
249 AC_CHECK_LIB(XextSam, XShmAttach,
250 x_libs="-lXextSam -lXext $x_libs",
251 no_xext_lib=yes, $x_libs),
255 # Check for shaped window extension
257 AC_CHECK_LIB(Xext, XShapeCombineMask,
258 if test -z "`echo $x_libs | grep "\-lXext" 2> /dev/null`"; then
259 x_libs="-lXext $x_libs"
261 AC_DEFINE(HAVE_SHAPE_EXT),
265 # Check for XConvertCase (X11R6 specific)
267 AC_CHECK_LIB(X11, XConvertCase,
268 AC_DEFINE(HAVE_XCONVERTCASE),
272 # Check for XIM support.
274 AC_CHECK_LIB(X11, XUnregisterIMInstantiateCallback,
279 if test "x$enable_xim" = "xyes"; then
280 GTK_XIM_FLAGS="-DUSE_XIM"
284 x_ldflags="$X_LDFLAGS $X_LIBS"
286 # set up things for XInput
288 if test "x$with_xinput" = "xgxi" || test "x$with_xinput" = "xyes"; then
289 AC_DEFINE(XINPUT_GXI)
291 x_libs="-lXi $x_libs"
292 elif test "x$with_xinput" = "xxfree"; then
293 AC_DEFINE(XINPUT_XFREE)
294 x_libs="-lXi $x_libs"
296 AC_DEFINE(XINPUT_NONE)
301 if test "x$with_threads" = "xposix" || test "x$with_threads" = "xyes"; then
302 AC_CHECK_LIB(pthread, pthread_attr_init,
303 [AC_DEFINE(USE_PTHREADS)
304 x_libs="$x_libs -lpthread"
305 GTK_THREAD_FLAGS="-D_REENTRANT"],
306 # AIX has libpthreads, cause they're special. Special friends (TM)
307 AC_CHECK_LIB(pthreads, pthread_attr_init,
308 [AC_DEFINE(USE_PTHREADS)
309 x_libs="$x_libs -lpthreads"
310 GTK_THREAD_FLAGS="-D_REENTRANT -D_THREAD_SAFE"]))
313 CFLAGS="$saved_cflags"
314 LDFLAGS="$saved_ldflags"
320 AC_SUBST(xinput_progs)
322 if test "x$enable_shm" = "xyes"; then
323 # Check for shared memory
324 AC_CHECK_HEADER(sys/ipc.h, AC_DEFINE(HAVE_IPC_H), no_sys_ipc=yes)
325 AC_CHECK_HEADER(sys/shm.h, AC_DEFINE(HAVE_SHM_H), no_sys_shm=yes)
327 # Check whether shmctl IPC_RMID allowes subsequent attaches
328 if test "$ac_cv_header_sys_shm_h" = "yes"; then
329 AC_MSG_CHECKING(whether shmctl IPC_RMID allowes subsequent attaches)
331 #include <sys/types.h>
338 id = shmget (IPC_PRIVATE, 4, IPC_CREAT | 0777);
341 shmaddr = shmat (id, 0, 0);
342 shmctl (id, IPC_RMID, 0);
343 if ((char*) shmat (id, 0, 0) == (char*) -1)
353 AC_DEFINE(IPC_RMID_DEFERRED_RELEASE)
356 AC_MSG_RESULT(assuming no))
359 # Check for the X shared memory extension header file
360 AC_MSG_CHECKING(X11/extensions/XShm.h)
361 if test "x$no_xext_lib" = "xyes"; then
365 if test -f "$x_includes/X11/extensions/XShm.h"; then
367 AC_DEFINE(HAVE_XSHM_H)
375 # Check for private display resource base variable
376 AC_MSG_CHECKING(resource base field in XDisplay)
377 AC_CACHE_VAL(gtk_cv_display_resource_base,
379 #define XLIB_ILLEGAL_ACCESS
380 #include <X11/Xlib.h>
389 display->resource_base;
391 gtk_cv_display_resource_base="resource_base",
392 gtk_cv_display_resource_base="private3")])
393 AC_MSG_RESULT($gtk_cv_display_resource_base)
394 AC_DEFINE_UNQUOTED(RESOURCE_BASE, gdk_display->$gtk_cv_display_resource_base)
396 # Check if X_LOCALE definition is necessary
398 AC_MSG_CHECKING(need -DX_LOCALE)
407 return setlocale (LC_ALL, "${with_locale}") == NULL;
411 AC_MSG_RESULT($need_x_locale)
413 if test $need_x_locale = yes; then
414 GTK_LOCALE_CFLAGS="-DX_LOCALE"
417 # Checks for header files.
420 # Checks for typedefs, structures, and compiler characteristics.
423 # Checks for library functions.
427 # Check if <sys/select.h> needs to be included for fd_set
428 AC_MSG_CHECKING([for fd_set])
429 AC_TRY_COMPILE([#include <sys/types.h>],
430 [fd_set readMask, writeMask;], gtk_ok=yes, gtk_ok=no)
431 if test $gtk_ok = yes; then
432 AC_MSG_RESULT([yes, found in sys/types.h])
434 AC_HEADER_EGREP(fd_mask, sys/select.h, gtk_ok=yes)
435 if test $gtk_ok = yes; then
436 AC_DEFINE(HAVE_SYS_SELECT_H)
437 AC_MSG_RESULT([yes, found in sys/select.h])
444 # Duplicate `widechar' tests from `glib'.
447 # will not be executed
448 # hack so as not to update `acconfig.h'
449 AC_CHECK_HEADERS(wchar.h wctype.h)
450 AC_CHECK_FUNCS(broken_wctype)
453 AC_MSG_CHECKING(for wchar.h)
454 AC_TRY_CPP([#include <wchar.h>], gtk_ok=yes, gtk_ok=no)
455 if test $gtk_ok = yes; then
456 ac_kludge=HAVE_WCHAR_H
457 AC_DEFINE($ac_kludge)
459 AC_MSG_RESULT($gtk_ok)
461 # Check for wctype.h (for iswalnum)
463 AC_MSG_CHECKING(for wctype.h)
464 AC_TRY_CPP([#include <wctype.h>], gtk_ok=yes, gtk_ok=no)
465 if test $gtk_ok = yes; then
466 ac_kludge=HAVE_WCTYPE_H
467 AC_DEFINE($ac_kludge)
469 AC_MSG_RESULT($gtk_ok)
471 # in Solaris 2.5, `iswalnum' is in -lw
473 AC_CHECK_FUNC(iswalnum,,[AC_CHECK_LIB(w,iswalnum,GDK_WLIBS=-lw)])
475 # The following is necessary for Linux libc-5.4.38
477 LIBS="$LIBS $GDK_WLIBS"
478 AC_MSG_CHECKING(if iswalnum() and friends are properly defined)
479 AC_TRY_LINK([#include <stdlib.h>],[
480 #if (defined(HAVE_WCTYPE_H) || defined(HAVE_WCHAR_H))
481 # ifdef HAVE_WCTYPE_H
489 # define iswalnum(c) ((wchar_t)(c) <= 0xFF && isalnum(c))
491 iswalnum((wchar_t) 0);
492 ], gtk_ok=yes, gtk_ok=no)
495 if test $gtk_ok = no; then
496 ac_kludge=HAVE_BROKEN_WCTYPE
497 AC_DEFINE($ac_kludge)
500 AC_MSG_RESULT($gtk_ok)
503 AC_SUBST(GTK_DEBUG_FLAGS)
504 AC_SUBST(GTK_XIM_FLAGS)
505 AC_SUBST(GTK_LOCALE_FLAGS)
506 AC_SUBST(GTK_THREAD_FLAGS)
515 ], [chmod +x gtk-config])