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_ENABLE(rebuilds, [ --disable-rebuilds disable all source autogeneration rules],,enable_rebuilds=yes)
99 AC_ARG_WITH(locale, [ --with-locale=LOCALE locale name you want to use ])
101 AC_ARG_WITH(xinput, [ --with-xinput=[no/gxi/xfree] support XInput ])
103 if test "x$enable_debug" = "xyes"; then
104 test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
105 GTK_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
107 if test "x$enable_debug" = "xno"; then
108 GTK_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DGTK_NO_CHECK_CASTS"
110 GTK_DEBUG_FLAGS="-DGTK_NO_CHECK_CASTS"
114 AC_DEFINE_UNQUOTED(GTK_COMPILED_WITH_DEBUGGING, "${enable_debug}")
116 # Build time sanity check...
119 # Checks for programs.
127 if test "x$GCC" = "xyes"; then
129 *[\ \ ]-Wall[\ \ ]*) ;;
130 *) CFLAGS="$CFLAGS -Wall" ;;
133 if test "x$enable_ansi" = "xyes"; then
135 *[\ \ ]-ansi[\ \ ]*) ;;
136 *) CFLAGS="$CFLAGS -ansi" ;;
140 *[\ \ ]-pedantic[\ \ ]*) ;;
141 *) CFLAGS="$CFLAGS -pedantic" ;;
147 # Honor aclocal flags
148 ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
150 # define a MAINT-like variable REBUILD which is set if Perl
151 # and awk are found, so autogenerated sources can be rebuilt
154 AC_CHECK_PROGS(PERL, perl5 perl)
156 # We would like indent, but don't require it.
157 AC_CHECK_PROG(INDENT, indent, indent)
160 if test "x$enable_rebuilds" = "xyes" && \
162 $PERL -e 'exit !($] >= 5.002)' > /dev/null 2>&1 && \
163 test -n "$AWK" ; then
168 AC_CHECK_FUNCS(lstat)
170 AC_MSG_CHECKING(whether make is GNU Make)
173 if $ac_make --version 2>/dev/null | grep '^GNU Make ' >/dev/null ; then
174 STRIP_BEGIN='$(strip'
180 AC_SUBST(STRIP_BEGIN)
184 ALL_LINGUAS="ca cs da de el es et eu fi fr ga hr hu it ja ko nl no pl pt pt_BR ru sk sl sv wa zh_TW.Big5"
186 LIBS="$LIBS $INTLLIBS"
188 # AM_GTK_GNU_GETTEXT above substs $DATADIRNAME
189 # this is the directory where the *.{mo,gmo} files are installed
190 gtklocaledir='${prefix}/${DATADIRNAME}/locale'
191 AC_SUBST(gtklocaledir)
193 dnl The DU4 header files don't provide library prototypes unless
194 dnl -std1 is given to the native cc.
195 AC_MSG_CHECKING([for extra flags to get ANSI library prototypes])
199 AC_TRY_RUN([#include <math.h>
200 int main (void) { return (log(1) != log(1.)); }],
201 AC_MSG_RESULT(none needed),
202 gtk_save_CFLAGS=$CFLAGS
203 CFLAGS="$CFLAGS -std1"
204 AC_TRY_RUN([#include <math.h>
205 int main (void) { return (log(1) != log(1.)); }],
206 AC_MSG_RESULT(-std1),
208 CFLAGS=$gtk_save_CFLAGS
210 [No ANSI prototypes found in library. (-std1 didn't work.)])
217 AC_MSG_CHECKING(for the BeOS)
220 GTK_LIBS_EXTRA="-L\$(top_builddir_full)/gdk/.libs -lgdk"
227 AC_SUBST(GTK_LIBS_EXTRA)
229 dnl NeXTStep cc seems to need this
230 AC_MSG_CHECKING([for extra flags for POSIX compliance])
231 AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
232 AC_MSG_RESULT(none needed),
233 gtk_save_CFLAGS=$CFLAGS
234 CFLAGS="$CFLAGS -posix"
235 AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
236 AC_MSG_RESULT(-posix),
238 CFLAGS=$gtk_save_CFLAGS
239 AC_MSG_WARN([Could not determine POSIX flag. (-posix didn't work.)])))
241 if test x$with_glib = xyes ; then
243 *** Directory must be specified for --with-glib])
246 if test x$with_glib = x ; then
247 # Look for separately installed glib
251 *** GLIB 1.3.0 or better is required. The latest version of GLIB
252 *** is always available from ftp://ftp.gtk.org/.]),
255 # we do not want to make all gtk progs to link to thread libraries.
256 glib_cflags=`$GLIB_CONFIG glib gmodule --cflags`
257 glib_thread_cflags="$GLIB_CFLAGS"
258 glib_libs=`$GLIB_CONFIG glib gmodule --libs`
259 glib_thread_libs="$GLIB_LIBS"
260 GLIB_LIBS="$glib_libs"
261 GLIB_DEPLIBS="$glib_libs"
263 # Use uninstalled glib (assume they got the version right)
265 GLIB_CONFIG=$with_glib/glib-config
266 if test -x $GLIB_CONFIG ; then
269 AC_MSG_ERROR([GLIB directory ($with_glib) not present or not configured])
272 # For use in gtk-config
273 glib_cflags=`$GLIB_CONFIG --cflags gmodule`
274 glib_thread_cflags=`$GLIB_CONFIG --cflags gmodule gthread`
275 glib_libs=`$GLIB_CONFIG --libs gmodule`
276 glib_thread_libs=`$GLIB_CONFIG --libs gmodule gthread`
278 glib_release=`$GLIB_CONFIG --version | sed 's%\\.[[0-9]]*$%%'`
280 # canonicalize relative paths
286 glib_dir="\$(top_builddir)/$with_glib"
290 GLIB_CFLAGS="-I$glib_dir -I$glib_dir/gmodule"
291 GLIB_LIBS="$glib_dir/libglib.la $glib_dir/gmodule/libgmodule.la"
294 AC_SUBST(GLIB_CFLAGS)
298 AC_SUBST(glib_cflags)
300 AC_SUBST(glib_thread_cflags)
301 AC_SUBST(glib_thread_libs)
302 AC_SUBST(GLIB_DEPLIBS)
304 AC_CHECK_HEADERS(dirent.h, AC_DEFINE(HAVE_DIRENT_H))
305 AC_CHECK_HEADERS(pwd.h, AC_DEFINE(HAVE_PWD_H))
306 AC_CHECK_HEADERS(sys/time.h, AC_DEFINE(HAVE_SYS_TIME_H))
308 # Find the X11 include and library directories
312 if test "x$x_includes" = "x"; then
313 x_includes="/usr/include"
316 saved_cflags="$CFLAGS"
317 saved_ldflags="$LDFLAGS"
319 CFLAGS="$CFLAGS $X_CFLAGS"
320 LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
322 if test "x$no_x" = "xyes"; then
324 *** X libraries or include files not found. Check 'config.log' for
328 # Checks for libraries.
329 # Check for the X11 library
330 AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS",
331 AC_MSG_ERROR([*** libX11 not found. Check 'config.log' for more details.]),
334 if test "x$enable_shm" = "xyes"; then
335 # Check for the Xext library (needed for XShm extention)
336 AC_CHECK_LIB(Xext, XShmAttach,
337 x_libs="-lXext $x_libs",
338 # On AIX, it is in XextSam instead, but we still need -lXext
339 AC_CHECK_LIB(XextSam, XShmAttach,
340 x_libs="-lXextSam -lXext $x_libs",
341 no_xext_lib=yes, $x_libs),
345 # Check for shaped window extension
347 AC_CHECK_LIB(Xext, XShapeCombineMask,
348 if test -z "`echo $x_libs | grep "\-lXext" 2> /dev/null`"; then
349 x_libs="-lXext $x_libs"
351 AC_DEFINE(HAVE_SHAPE_EXT),
355 # Check for XConvertCase (X11R6 specific)
357 AC_CHECK_LIB(X11, XConvertCase,
358 AC_DEFINE(HAVE_XCONVERTCASE),
362 # Check for XIM support.
364 AC_CHECK_LIB(X11, XUnregisterIMInstantiateCallback,
366 enable_xim_inst="no",
369 # On Solaris, calling XRegisterIMInstantiateCallback seems to
370 # cause an immediate segfault, so we disable it, unless
371 # the user specifically forces it to be on.
373 if test x$enable_xim_inst = xmaybe ; then
379 enable_xim_inst="yes"
384 if test "x$enable_xim" = "xyes"; then
385 GTK_XIM_FLAGS="-DUSE_XIM"
386 if test "x$enable_xim_inst" = "xyes"; then
387 AC_DEFINE(USE_X11R6_XIM)
392 x_ldflags="$X_LDFLAGS $X_LIBS"
394 # set up things for XInput
396 if test "x$with_xinput" = "xgxi" || test "x$with_xinput" = "xyes"; then
397 AC_DEFINE(XINPUT_GXI)
399 x_libs="-lXi $x_libs"
400 elif test "x$with_xinput" = "xxfree"; then
401 AC_DEFINE(XINPUT_XFREE)
402 x_libs="-lXi $x_libs"
404 AC_DEFINE(XINPUT_NONE)
407 CFLAGS="$saved_cflags"
408 LDFLAGS="$saved_ldflags"
414 AC_SUBST(xinput_progs)
416 if test "x$enable_shm" = "xyes"; then
417 # Check for shared memory
418 AC_CHECK_HEADER(sys/ipc.h, AC_DEFINE(HAVE_IPC_H), no_sys_ipc=yes)
419 AC_CHECK_HEADER(sys/shm.h, AC_DEFINE(HAVE_SHM_H), no_sys_shm=yes)
421 # Check for the X shared memory extension header file
422 AC_MSG_CHECKING(X11/extensions/XShm.h)
423 if test "x$no_xext_lib" = "xyes"; then
427 if test -f "$x_includes/X11/extensions/XShm.h"; then
429 AC_DEFINE(HAVE_XSHM_H)
437 # Check if X_LOCALE definition is necessary
439 AC_MSG_CHECKING(need -DX_LOCALE)
448 return setlocale (LC_ALL, "${with_locale}") == NULL;
452 AC_MSG_RESULT($need_x_locale)
454 if test $need_x_locale = yes; then
455 GTK_LOCALE_CFLAGS="-DX_LOCALE"
458 # Checks for header files.
461 # Checks for typedefs, structures, and compiler characteristics.
464 # Checks for library functions.
468 # Check if <sys/select.h> needs to be included for fd_set
469 AC_MSG_CHECKING([for fd_set])
470 AC_TRY_COMPILE([#include <sys/types.h>],
471 [fd_set readMask, writeMask;], gtk_ok=yes, gtk_ok=no)
472 if test $gtk_ok = yes; then
473 AC_MSG_RESULT([yes, found in sys/types.h])
475 AC_HEADER_EGREP(fd_mask, sys/select.h, gtk_ok=yes)
476 if test $gtk_ok = yes; then
477 AC_DEFINE(HAVE_SYS_SELECT_H)
478 AC_MSG_RESULT([yes, found in sys/select.h])
485 # `widechar' tests for gdki18n.h
486 AC_MSG_CHECKING(for wchar.h)
487 AC_TRY_CPP([#include <wchar.h>], gdk_wchar_h=yes, gdk_wchar_h=no)
488 if test $gdk_wchar_h = yes; then
489 AC_DEFINE(HAVE_WCHAR_H,1,[Have wchar.h include file])
491 AC_MSG_RESULT($gdk_wchar_h)
493 # Check for wctype.h (for iswalnum)
494 AC_MSG_CHECKING(for wctype.h)
495 AC_TRY_CPP([#include <wctype.h>], gdk_wctype_h=yes, gdk_wctype_h=no)
496 if test $gdk_wctype_h = yes; then
497 AC_DEFINE(HAVE_WCTYPE_H,1,[Have wctype.h include file])
499 AC_MSG_RESULT($gdk_wctype_h)
501 # in Solaris 2.5, `iswalnum' is in -lw
503 AC_CHECK_FUNC(iswalnum,,[AC_CHECK_LIB(w,iswalnum,GDK_WLIBS=-lw)])
506 LIBS="$LIBS $GDK_WLIBS"
507 # The following is necessary for Linux libc-5.4.38
508 AC_MSG_CHECKING(if iswalnum() and friends are properly defined)
509 AC_TRY_LINK([#include <stdlib.h>],[
510 #if (defined(HAVE_WCTYPE_H) || defined(HAVE_WCHAR_H))
511 # ifdef HAVE_WCTYPE_H
519 # define iswalnum(c) ((wchar_t)(c) <= 0xFF && isalnum(c))
521 iswalnum((wchar_t) 0);
522 ], gdk_working_wctype=yes, gdk_working_wctype=no)
525 if test $gdk_working_wctype = no; then
526 AC_DEFINE(HAVE_BROKEN_WCTYPE,1,[Is the wctype implementation broken])
529 AC_MSG_RESULT($gdk_working_wctype)
532 AC_SUBST(GTK_DEBUG_FLAGS)
533 AC_SUBST(GTK_XIM_FLAGS)
534 AC_SUBST(GTK_LOCALE_FLAGS)
538 ## Generate `gdk/gdkconfig.h' in two cases
539 ## 1. `config.status' is run either explicitly, or via configure.
540 ## Esp. not when it is run in `Makefile' to generate makefiles and
542 ## 2. CONFIG_OTHER is set explicitly
544 ## Case 1 is difficult. We know that `automake' sets one of
545 ## CONFIG_FILES or CONFIG_HEADERS to empty. This heuristic works
546 ## only when AM_CONFIG_HEADER is set, however.
548 if test -n "${CONFIG_FILES}" && test -n "${CONFIG_HEADERS}"; then
549 # Both CONFIG_FILES and CONFIG_HEADERS are non-empty ==> Case 1
550 CONFIG_OTHER=${CONFIG_OTHER:-gdk/gdkconfig.h}
552 case "$CONFIG_OTHER" in
554 echo creating gdk/gdkconfig.h
555 outfile=gdkconfig.h-tmp
556 cat > $outfile <<\_______EOF
559 * This is a generated file. Please modify `configure.in'
567 #endif /* __cplusplus */
571 cat >>$outfile <<_______EOF
576 cat >>$outfile <<_______EOF
580 #endif /* __cplusplus */
582 #endif /* GDKCONFIG_H */
586 if cmp -s $outfile gdk/gdkconfig.h; then
587 echo gdk/gdkconfig.h is unchanged
590 mv $outfile gdk/gdkconfig.h
594 # Currently we always use X11 on those systems where we run configure...
596 #define GDK_WINDOWING_X11'
597 if test x$gdk_wchar_h = xyes; then
599 #define GDK_HAVE_WCHAR_H 1'
601 if test x$gdk_wctype_h = xyes; then
603 #define GDK_HAVE_WCTYPE_H 1"
605 if test x$gdk_working_wctype = xno; then
607 #define GDK_HAVE_BROKEN_WCTYPE 1"
625 ], [chmod +x gtk-config])