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}
18 dnl we to AC_DIVERT_PUSH/AC_DIVERT_POP these variable definitions so they
19 dnl are available for $ac_help expansion (don't we all *love* autoconf?)
20 AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
23 # GTK_MICRO_VERSION += 1;
24 # GTK_INTERFACE_AGE += 1;
25 # GTK_BINARY_AGE += 1;
26 # if any functions have been added, set GTK_INTERFACE_AGE to 0.
27 # if backwards compatibility has been broken,
28 # set GTK_BINARY_AGE and GTK_INTERFACE_AGE to 0.
35 GTK_VERSION=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION.$GTK_MICRO_VERSION
39 AC_SUBST(GTK_MAJOR_VERSION)
40 AC_SUBST(GTK_MINOR_VERSION)
41 AC_SUBST(GTK_MICRO_VERSION)
42 AC_SUBST(GTK_INTERFACE_AGE)
43 AC_SUBST(GTK_BINARY_AGE)
47 LT_RELEASE=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION
48 LT_CURRENT=`expr $GTK_MICRO_VERSION - $GTK_INTERFACE_AGE`
49 LT_REVISION=$GTK_INTERFACE_AGE
50 LT_AGE=`expr $GTK_BINARY_AGE - $GTK_INTERFACE_AGE`
60 # Save this value here, since automake will set cflags later
61 cflags_set=${CFLAGS+set}
63 dnl Initialize automake stuff
64 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
66 # Specify a configuration file
67 AM_CONFIG_HEADER(config.h)
69 dnl Initialize libtool
72 dnl Initialize maintainer mode
77 dnl figure debugging default, prior to $ac_help setup
79 AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
80 if test `expr $GTK_MINOR_VERSION \% 2` = 1 ; then
87 dnl declare --enable-* args and collect ac_help strings
88 AC_ARG_ENABLE(debug, [ --enable-debug=[no/minimum/yes] turn on debugging [default=$debug_default]],,enable_debug=$debug_default)
89 AC_ARG_ENABLE(shm, [ --enable-shm support shared memory if available [default=yes]],
90 echo $enable_shm, enable_shm="yes")
91 AC_ARG_ENABLE(ansi, [ --enable-ansi turn on strict ansi [default=no]],
93 AC_ARG_WITH(glib, [ --with-glib=DIR Use uninstalled copy of glib])
94 AC_ARG_ENABLE(xim, [ --enable-xim support XIM [default=yes]],
96 AC_ARG_ENABLE(xim_inst, [ --disable-xim-inst does not use xim instantiate callback],
97 , enable_xim_inst="maybe")
98 AC_ARG_WITH(locale, [ --with-locale=LOCALE locale name you want to use ])
100 AC_ARG_WITH(xinput, [ --with-xinput=[no/gxi/xfree] support XInput ])
102 if test "x$enable_debug" = "xyes"; then
103 test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
104 GTK_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
106 if test "x$enable_debug" = "xno"; then
107 GTK_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DGTK_NO_CHECK_CASTS"
109 GTK_DEBUG_FLAGS="-DGTK_NO_CHECK_CASTS"
113 AC_DEFINE_UNQUOTED(GTK_COMPILED_WITH_DEBUGGING, "${enable_debug}")
115 # Build time sanity check...
118 # Checks for programs.
126 if test "x$GCC" = "xyes"; then
128 *[\ \ ]-Wall[\ \ ]*) ;;
129 *) CFLAGS="$CFLAGS -Wall" ;;
132 if test "x$enable_ansi" = "xyes"; then
134 *[\ \ ]-ansi[\ \ ]*) ;;
135 *) CFLAGS="$CFLAGS -ansi" ;;
139 *[\ \ ]-pedantic[\ \ ]*) ;;
140 *) CFLAGS="$CFLAGS -pedantic" ;;
146 # define a MAINT-like variable REBUILD which is set if Perl
147 # and awk are found, so autogenerated sources can be rebuilt
150 AC_CHECK_PROGS(PERL, perl5 perl)
152 # We would like indent, but don't require it.
153 AC_CHECK_PROG(INDENT, indent, indent)
156 if test -n "$PERL" && perl -v | grep 'version 5.' > /dev/null ; then
157 if test -n "$AWK" ; then
164 ALL_LINGUAS="cs de es fr hu it ja ko nl no pl pt ru sv"
166 AC_CHECK_FUNC(gettext,
168 AC_CHECK_LIB(intl, gettext)
170 # AM_GTK_GNU_GETTEXT above substs $DATADIRNAME
171 # this is the directory where the *.{mo,gmo} files are installed
172 gtklocaledir='${prefix}/${DATADIRNAME}/locale'
173 AC_SUBST(gtklocaledir)
175 dnl The DU4 header files don't provide library prototypes unless
176 dnl -std1 is given to the native cc.
177 AC_MSG_CHECKING([for extra flags to get ANSI library prototypes])
181 AC_TRY_RUN([#include <math.h>
182 int main (void) { return (log(1) != log(1.)); }],
183 AC_MSG_RESULT(none needed),
184 gtk_save_CFLAGS=$CFLAGS
185 CFLAGS="$CFLAGS -std1"
186 AC_TRY_RUN([#include <math.h>
187 int main (void) { return (log(1) != log(1.)); }],
188 AC_MSG_RESULT(-std1),
190 CFLAGS=$gtk_save_CFLAGS
192 [No ANSI prototypes found in library. (-std1 didn't work.)])
197 dnl NeXTStep cc seems to need this
198 AC_MSG_CHECKING([for extra flags for POSIX compliance])
199 AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
200 AC_MSG_RESULT(none needed),
201 gtk_save_CFLAGS=$CFLAGS
202 CFLAGS="$CFLAGS -posix"
203 AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
204 AC_MSG_RESULT(-posix),
206 CFLAGS=$gtk_save_CFLAGS
207 AC_MSG_WARN([Could not determine POSIX flag. (-posix didn't work.)])))
209 if test x$with_glib = xyes ; then
211 *** Directory must be specified for --with-glib])
214 if test x$with_glib = x ; then
215 # Look for separately installed glib
219 *** GLIB 1.2.0 or better is required. The latest version of GLIB
220 *** is always available from ftp://ftp.gtk.org/.]),
223 # we do not want to make all gtk progs to link to thread libraries.
224 glib_cflags=`$GLIB_CONFIG glib gmodule --cflags`
225 glib_thread_cflags="$GLIB_CFLAGS"
226 glib_libs=`$GLIB_CONFIG glib gmodule --libs`
227 glib_thread_libs="$GLIB_LIBS"
228 GLIB_LIBS="$glib_libs"
229 GLIB_DEPLIBS="$glib_libs"
231 # Use uninstalled glib (assume they got the version right)
233 GLIB_CONFIG=$with_glib/glib-config
234 if test -x $GLIB_CONFIG ; then
237 AC_MSG_ERROR([GLIB directory ($with_glib) not present or not configured])
240 # For use in gtk-config
241 glib_cflags=`$GLIB_CONFIG --cflags gmodule`
242 glib_thread_cflags=`$GLIB_CONFIG --cflags gmodule gthread`
243 glib_libs=`$GLIB_CONFIG --libs gmodule`
244 glib_thread_libs=`$GLIB_CONFIG --libs gmodule gthread`
246 glib_release=`$GLIB_CONFIG --version | sed 's%\\.[[0-9]]*$%%'`
248 # canonicalize relative paths
254 glib_dir="\$(top_builddir)/$with_glib"
258 GLIB_CFLAGS="-I$glib_dir -I$glib_dir/gmodule"
259 GLIB_LIBS="$glib_dir/libglib.la $glib_dir/gmodule.la"
262 AC_SUBST(GLIB_CFLAGS)
266 AC_SUBST(glib_cflags)
268 AC_SUBST(glib_thread_cflags)
269 AC_SUBST(glib_thread_libs)
270 AC_SUBST(GLIB_DEPLIBS)
272 # Find the X11 include and library directories
276 if test "x$x_includes" = "x"; then
277 x_includes="/usr/include"
280 saved_cflags="$CFLAGS"
281 saved_ldflags="$LDFLAGS"
283 CFLAGS="$CFLAGS $X_CFLAGS"
284 LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
286 if test "x$no_x" = "xyes"; then
288 *** X libraries or include files not found. Check 'config.log' for
292 # Checks for libraries.
293 # Check for the X11 library
294 AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS",
295 AC_MSG_ERROR([*** libX11 not found. Check 'config.log' for more details.]),
298 if test "x$enable_shm" = "xyes"; then
299 # Check for the Xext library (needed for XShm extention)
300 AC_CHECK_LIB(Xext, XShmAttach,
301 x_libs="-lXext $x_libs",
302 # On AIX, it is in XextSam instead, but we still need -lXext
303 AC_CHECK_LIB(XextSam, XShmAttach,
304 x_libs="-lXextSam -lXext $x_libs",
305 no_xext_lib=yes, $x_libs),
309 # Check for shaped window extension
311 AC_CHECK_LIB(Xext, XShapeCombineMask,
312 if test -z "`echo $x_libs | grep "\-lXext" 2> /dev/null`"; then
313 x_libs="-lXext $x_libs"
315 AC_DEFINE(HAVE_SHAPE_EXT),
319 # Check for XConvertCase (X11R6 specific)
321 AC_CHECK_LIB(X11, XConvertCase,
322 AC_DEFINE(HAVE_XCONVERTCASE),
326 # Check for XIM support.
328 AC_CHECK_LIB(X11, XUnregisterIMInstantiateCallback,
330 enable_xim_inst="no",
333 # On Solaris, calling XRegisterIMInstantiateCallback seems to
334 # cause an immediate segfault, so we disable it, unless
335 # the user specifically forces it to be on.
337 if test x$enable_xim_inst = xmaybe ; then
343 enable_xim_inst="yes"
348 if test "x$enable_xim" = "xyes"; then
349 GTK_XIM_FLAGS="-DUSE_XIM"
350 if test "x$enable_xim_inst" = "xyes"; then
351 AC_DEFINE(USE_X11R6_XIM)
356 x_ldflags="$X_LDFLAGS $X_LIBS"
358 # set up things for XInput
360 if test "x$with_xinput" = "xgxi" || test "x$with_xinput" = "xyes"; then
361 AC_DEFINE(XINPUT_GXI)
363 x_libs="-lXi $x_libs"
364 elif test "x$with_xinput" = "xxfree"; then
365 AC_DEFINE(XINPUT_XFREE)
366 x_libs="-lXi $x_libs"
368 AC_DEFINE(XINPUT_NONE)
371 CFLAGS="$saved_cflags"
372 LDFLAGS="$saved_ldflags"
378 AC_SUBST(xinput_progs)
380 if test "x$enable_shm" = "xyes"; then
381 # Check for shared memory
382 AC_CHECK_HEADER(sys/ipc.h, AC_DEFINE(HAVE_IPC_H), no_sys_ipc=yes)
383 AC_CHECK_HEADER(sys/shm.h, AC_DEFINE(HAVE_SHM_H), no_sys_shm=yes)
385 # Check for the X shared memory extension header file
386 AC_MSG_CHECKING(X11/extensions/XShm.h)
387 if test "x$no_xext_lib" = "xyes"; then
391 if test -f "$x_includes/X11/extensions/XShm.h"; then
393 AC_DEFINE(HAVE_XSHM_H)
401 # Check if X_LOCALE definition is necessary
403 AC_MSG_CHECKING(need -DX_LOCALE)
412 return setlocale (LC_ALL, "${with_locale}") == NULL;
416 AC_MSG_RESULT($need_x_locale)
418 if test $need_x_locale = yes; then
419 GTK_LOCALE_CFLAGS="-DX_LOCALE"
422 # Checks for header files.
425 # Checks for typedefs, structures, and compiler characteristics.
428 # Checks for library functions.
432 # Check if <sys/select.h> needs to be included for fd_set
433 AC_MSG_CHECKING([for fd_set])
434 AC_TRY_COMPILE([#include <sys/types.h>],
435 [fd_set readMask, writeMask;], gtk_ok=yes, gtk_ok=no)
436 if test $gtk_ok = yes; then
437 AC_MSG_RESULT([yes, found in sys/types.h])
439 AC_HEADER_EGREP(fd_mask, sys/select.h, gtk_ok=yes)
440 if test $gtk_ok = yes; then
441 AC_DEFINE(HAVE_SYS_SELECT_H)
442 AC_MSG_RESULT([yes, found in sys/select.h])
449 # Duplicate `widechar' tests from `glib'.
452 # will not be executed
453 # hack so as not to update `acconfig.h'
454 AC_CHECK_HEADERS(wchar.h wctype.h)
455 AC_CHECK_FUNCS(broken_wctype)
458 AC_MSG_CHECKING(for wchar.h)
459 AC_TRY_CPP([#include <wchar.h>], gtk_ok=yes, gtk_ok=no)
460 if test $gtk_ok = yes; then
461 ac_kludge=HAVE_WCHAR_H
462 AC_DEFINE($ac_kludge)
464 AC_MSG_RESULT($gtk_ok)
466 # Check for wctype.h (for iswalnum)
468 AC_MSG_CHECKING(for wctype.h)
469 AC_TRY_CPP([#include <wctype.h>], gtk_ok=yes, gtk_ok=no)
470 if test $gtk_ok = yes; then
471 ac_kludge=HAVE_WCTYPE_H
472 AC_DEFINE($ac_kludge)
474 AC_MSG_RESULT($gtk_ok)
476 # in Solaris 2.5, `iswalnum' is in -lw
478 AC_CHECK_FUNC(iswalnum,,[AC_CHECK_LIB(w,iswalnum,GDK_WLIBS=-lw)])
480 # The following is necessary for Linux libc-5.4.38
482 LIBS="$LIBS $GDK_WLIBS"
483 AC_MSG_CHECKING(if iswalnum() and friends are properly defined)
484 AC_TRY_LINK([#include <stdlib.h>],[
485 #if (defined(HAVE_WCTYPE_H) || defined(HAVE_WCHAR_H))
486 # ifdef HAVE_WCTYPE_H
494 # define iswalnum(c) ((wchar_t)(c) <= 0xFF && isalnum(c))
496 iswalnum((wchar_t) 0);
497 ], gtk_ok=yes, gtk_ok=no)
500 if test $gtk_ok = no; then
501 ac_kludge=HAVE_BROKEN_WCTYPE
502 AC_DEFINE($ac_kludge)
505 AC_MSG_RESULT($gtk_ok)
508 AC_SUBST(GTK_DEBUG_FLAGS)
509 AC_SUBST(GTK_XIM_FLAGS)
510 AC_SUBST(GTK_LOCALE_FLAGS)
521 ], [chmod +x gtk-config])