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
163 AC_CHECK_FUNCS(lstat)
166 ALL_LINGUAS="ca cs de es fr hr hu it ja ko nl no pl pt ru sv wa"
168 AC_CHECK_FUNC(gettext,
170 AC_CHECK_LIB(intl, gettext)
172 # AM_GTK_GNU_GETTEXT above substs $DATADIRNAME
173 # this is the directory where the *.{mo,gmo} files are installed
174 gtklocaledir='${prefix}/${DATADIRNAME}/locale'
175 AC_SUBST(gtklocaledir)
177 dnl The DU4 header files don't provide library prototypes unless
178 dnl -std1 is given to the native cc.
179 AC_MSG_CHECKING([for extra flags to get ANSI library prototypes])
183 AC_TRY_RUN([#include <math.h>
184 int main (void) { return (log(1) != log(1.)); }],
185 AC_MSG_RESULT(none needed),
186 gtk_save_CFLAGS=$CFLAGS
187 CFLAGS="$CFLAGS -std1"
188 AC_TRY_RUN([#include <math.h>
189 int main (void) { return (log(1) != log(1.)); }],
190 AC_MSG_RESULT(-std1),
192 CFLAGS=$gtk_save_CFLAGS
194 [No ANSI prototypes found in library. (-std1 didn't work.)])
201 AC_MSG_CHECKING(for the BeOS)
204 GTK_LIBS_EXTRA="-L\$(top_builddir_full)/gdk/.libs -lgdk"
211 AC_SUBST(GTK_LIBS_EXTRA)
213 dnl NeXTStep cc seems to need this
214 AC_MSG_CHECKING([for extra flags for POSIX compliance])
215 AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
216 AC_MSG_RESULT(none needed),
217 gtk_save_CFLAGS=$CFLAGS
218 CFLAGS="$CFLAGS -posix"
219 AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
220 AC_MSG_RESULT(-posix),
222 CFLAGS=$gtk_save_CFLAGS
223 AC_MSG_WARN([Could not determine POSIX flag. (-posix didn't work.)])))
225 if test x$with_glib = xyes ; then
227 *** Directory must be specified for --with-glib])
230 if test x$with_glib = x ; then
231 # Look for separately installed glib
235 *** GLIB 1.3.0 or better is required. The latest version of GLIB
236 *** is always available from ftp://ftp.gtk.org/.]),
239 # we do not want to make all gtk progs to link to thread libraries.
240 glib_cflags=`$GLIB_CONFIG glib gmodule --cflags`
241 glib_thread_cflags="$GLIB_CFLAGS"
242 glib_libs=`$GLIB_CONFIG glib gmodule --libs`
243 glib_thread_libs="$GLIB_LIBS"
244 GLIB_LIBS="$glib_libs"
245 GLIB_DEPLIBS="$glib_libs"
247 # Use uninstalled glib (assume they got the version right)
249 GLIB_CONFIG=$with_glib/glib-config
250 if test -x $GLIB_CONFIG ; then
253 AC_MSG_ERROR([GLIB directory ($with_glib) not present or not configured])
256 # For use in gtk-config
257 glib_cflags=`$GLIB_CONFIG --cflags gmodule`
258 glib_thread_cflags=`$GLIB_CONFIG --cflags gmodule gthread`
259 glib_libs=`$GLIB_CONFIG --libs gmodule`
260 glib_thread_libs=`$GLIB_CONFIG --libs gmodule gthread`
262 glib_release=`$GLIB_CONFIG --version | sed 's%\\.[[0-9]]*$%%'`
264 # canonicalize relative paths
270 glib_dir="\$(top_builddir)/$with_glib"
274 GLIB_CFLAGS="-I$glib_dir -I$glib_dir/gmodule"
275 GLIB_LIBS="$glib_dir/libglib.la $glib_dir/gmodule/libgmodule.la"
278 AC_SUBST(GLIB_CFLAGS)
282 AC_SUBST(glib_cflags)
284 AC_SUBST(glib_thread_cflags)
285 AC_SUBST(glib_thread_libs)
286 AC_SUBST(GLIB_DEPLIBS)
288 AC_CHECK_HEADERS(dirent.h, AC_DEFINE(HAVE_DIRENT_H))
289 AC_CHECK_HEADERS(pwd.h, AC_DEFINE(HAVE_PWD_H))
290 AC_CHECK_HEADERS(sys/time.h, AC_DEFINE(HAVE_SYS_TIME_H))
292 # Find the X11 include and library directories
296 if test "x$x_includes" = "x"; then
297 x_includes="/usr/include"
300 saved_cflags="$CFLAGS"
301 saved_ldflags="$LDFLAGS"
303 CFLAGS="$CFLAGS $X_CFLAGS"
304 LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
306 if test "x$no_x" = "xyes"; then
308 *** X libraries or include files not found. Check 'config.log' for
312 # Checks for libraries.
313 # Check for the X11 library
314 AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS",
315 AC_MSG_ERROR([*** libX11 not found. Check 'config.log' for more details.]),
318 if test "x$enable_shm" = "xyes"; then
319 # Check for the Xext library (needed for XShm extention)
320 AC_CHECK_LIB(Xext, XShmAttach,
321 x_libs="-lXext $x_libs",
322 # On AIX, it is in XextSam instead, but we still need -lXext
323 AC_CHECK_LIB(XextSam, XShmAttach,
324 x_libs="-lXextSam -lXext $x_libs",
325 no_xext_lib=yes, $x_libs),
329 # Check for shaped window extension
331 AC_CHECK_LIB(Xext, XShapeCombineMask,
332 if test -z "`echo $x_libs | grep "\-lXext" 2> /dev/null`"; then
333 x_libs="-lXext $x_libs"
335 AC_DEFINE(HAVE_SHAPE_EXT),
339 # Check for XConvertCase (X11R6 specific)
341 AC_CHECK_LIB(X11, XConvertCase,
342 AC_DEFINE(HAVE_XCONVERTCASE),
346 # Check for XIM support.
348 AC_CHECK_LIB(X11, XUnregisterIMInstantiateCallback,
350 enable_xim_inst="no",
353 # On Solaris, calling XRegisterIMInstantiateCallback seems to
354 # cause an immediate segfault, so we disable it, unless
355 # the user specifically forces it to be on.
357 if test x$enable_xim_inst = xmaybe ; then
363 enable_xim_inst="yes"
368 if test "x$enable_xim" = "xyes"; then
369 GTK_XIM_FLAGS="-DUSE_XIM"
370 if test "x$enable_xim_inst" = "xyes"; then
371 AC_DEFINE(USE_X11R6_XIM)
376 x_ldflags="$X_LDFLAGS $X_LIBS"
378 # set up things for XInput
380 if test "x$with_xinput" = "xgxi" || test "x$with_xinput" = "xyes"; then
381 AC_DEFINE(XINPUT_GXI)
383 x_libs="-lXi $x_libs"
384 elif test "x$with_xinput" = "xxfree"; then
385 AC_DEFINE(XINPUT_XFREE)
386 x_libs="-lXi $x_libs"
388 AC_DEFINE(XINPUT_NONE)
391 CFLAGS="$saved_cflags"
392 LDFLAGS="$saved_ldflags"
398 AC_SUBST(xinput_progs)
400 if test "x$enable_shm" = "xyes"; then
401 # Check for shared memory
402 AC_CHECK_HEADER(sys/ipc.h, AC_DEFINE(HAVE_IPC_H), no_sys_ipc=yes)
403 AC_CHECK_HEADER(sys/shm.h, AC_DEFINE(HAVE_SHM_H), no_sys_shm=yes)
405 # Check for the X shared memory extension header file
406 AC_MSG_CHECKING(X11/extensions/XShm.h)
407 if test "x$no_xext_lib" = "xyes"; then
411 if test -f "$x_includes/X11/extensions/XShm.h"; then
413 AC_DEFINE(HAVE_XSHM_H)
421 # Check if X_LOCALE definition is necessary
423 AC_MSG_CHECKING(need -DX_LOCALE)
432 return setlocale (LC_ALL, "${with_locale}") == NULL;
436 AC_MSG_RESULT($need_x_locale)
438 if test $need_x_locale = yes; then
439 GTK_LOCALE_CFLAGS="-DX_LOCALE"
442 # Checks for header files.
445 # Checks for typedefs, structures, and compiler characteristics.
448 # Checks for library functions.
452 # Check if <sys/select.h> needs to be included for fd_set
453 AC_MSG_CHECKING([for fd_set])
454 AC_TRY_COMPILE([#include <sys/types.h>],
455 [fd_set readMask, writeMask;], gtk_ok=yes, gtk_ok=no)
456 if test $gtk_ok = yes; then
457 AC_MSG_RESULT([yes, found in sys/types.h])
459 AC_HEADER_EGREP(fd_mask, sys/select.h, gtk_ok=yes)
460 if test $gtk_ok = yes; then
461 AC_DEFINE(HAVE_SYS_SELECT_H)
462 AC_MSG_RESULT([yes, found in sys/select.h])
469 # `widechar' tests for gdki18n.h
470 AC_MSG_CHECKING(for wchar.h)
471 AC_TRY_CPP([#include <wchar.h>], gdk_wchar_h=yes, gdk_wchar_h=no)
472 if test $gdk_wchar_h = yes; then
473 AC_DEFINE(HAVE_WCHAR_H,1,[Have wchar.h include file])
475 AC_MSG_RESULT($gdk_wchar_h)
477 # Check for wctype.h (for iswalnum)
478 AC_MSG_CHECKING(for wctype.h)
479 AC_TRY_CPP([#include <wctype.h>], gdk_wctype_h=yes, gdk_wctype_h=no)
480 if test $gdk_wctype_h = yes; then
481 AC_DEFINE(HAVE_WCTYPE_H,1,[Have wctype.h include file])
483 AC_MSG_RESULT($gdk_wctype_h)
485 # in Solaris 2.5, `iswalnum' is in -lw
487 AC_CHECK_FUNC(iswalnum,,[AC_CHECK_LIB(w,iswalnum,GDK_WLIBS=-lw)])
490 LIBS="$LIBS $GDK_WLIBS"
491 # The following is necessary for Linux libc-5.4.38
492 AC_MSG_CHECKING(if iswalnum() and friends are properly defined)
493 AC_TRY_LINK([#include <stdlib.h>],[
494 #if (defined(HAVE_WCTYPE_H) || defined(HAVE_WCHAR_H))
495 # ifdef HAVE_WCTYPE_H
503 # define iswalnum(c) ((wchar_t)(c) <= 0xFF && isalnum(c))
505 iswalnum((wchar_t) 0);
506 ], gdk_working_wctype=yes, gdk_working_wctype=no)
509 if test $gdk_working_wctype = no; then
510 AC_DEFINE(HAVE_BROKEN_WCTYPE,1,[Is the wctype implementation broken])
513 AC_MSG_RESULT($gdk_working_wctype)
516 AC_SUBST(GTK_DEBUG_FLAGS)
517 AC_SUBST(GTK_XIM_FLAGS)
518 AC_SUBST(GTK_LOCALE_FLAGS)
522 ## Generate `gdk/gdkconfig.h' in two cases
523 ## 1. `config.status' is run either explicitly, or via configure.
524 ## Esp. not when it is run in `Makefile' to generate makefiles and
526 ## 2. CONFIG_OTHER is set explicitly
528 ## Case 1 is difficult. We know that `automake' sets one of
529 ## CONFIG_FILES or CONFIG_HEADERS to empty. This heuristic works
530 ## only when AM_CONFIG_HEADER is set, however.
532 if test -n "${CONFIG_FILES}" && test -n "${CONFIG_HEADERS}"; then
533 # Both CONFIG_FILES and CONFIG_HEADERS are non-empty ==> Case 1
534 CONFIG_OTHER=${CONFIG_OTHER:-gdk/gdkconfig.h}
536 case "$CONFIG_OTHER" in
538 echo creating gdk/gdkconfig.h
539 outfile=gdkconfig.h-tmp
540 cat > $outfile <<\_______EOF
543 * This is a generated file. Please modify `configure.in'
551 #endif /* __cplusplus */
555 cat >>$outfile <<_______EOF
560 cat >>$outfile <<_______EOF
564 #endif /* __cplusplus */
566 #endif /* GDKCONFIG_H */
570 if cmp -s $outfile gdk/gdkconfig.h; then
571 echo gdk/gdkconfig.h is unchanged
574 mv $outfile gdk/gdkconfig.h
578 # Currently we always use X11 on those systems where we run configure...
580 #define GDK_WINDOWING GDK_WINDOWING_X11'
581 if test x$gdk_wchar_h = xyes; then
583 #define GDK_HAVE_WCHAR_H 1'
585 if test x$gdk_wctype_h = xyes; then
587 #define GDK_HAVE_WCTYPE_H 1"
589 if test x$gdk_working_wctype = xno; then
591 #define GDK_HAVE_BROKEN_WCTYPE 1"
606 ], [chmod +x gtk-config])