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}
10 GTK_VERSION=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION.$GTK_MICRO_VERSION
17 AC_CONFIG_SUBDIRS(glib)
19 # Save this value here, since automake will set cflags later
20 cflags_set=${CFLAGS+set}
22 dnl Initialize automake stuff
23 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
25 # Specify a configuration file
26 AM_CONFIG_HEADER(config.h)
28 dnl Initialize libtool
31 dnl Initialize maintainer mode
36 AC_ARG_ENABLE(shm, [ --enable-shm support shared memory if available [default=yes]],
37 echo $enable_shm, enable_shm="yes")
38 AC_ARG_ENABLE(debug, [ --enable-debug=[no/minimum/yes] turn on debugging [default=minimum]],,enable_debug=minimum)
39 AC_ARG_ENABLE(ansi, [ --enable-ansi turn on strict ansi [default=no]],
41 AC_ARG_ENABLE(xim, [ --enable-xim support XIM [default=yes]],
42 echo $enable_xim, enable_xim="yes")
43 AC_ARG_WITH(locale, [ --with-locale=LOCALE locale name you want to use ])
45 AC_ARG_WITH(xinput, [ --with-xinput=[no/gxi/xfree] support XInput ])
47 if test "x$enable_debug" = "xyes"; then
48 test "$cflags_set" = set || CFLAGS="-g"
49 CFLAGS="$CFLAGS -DG_ENABLE_DEBUG"
51 if test "x$enable_debug" = "xno"; then
52 CFLAGS="$CFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DGTK_NO_CHECK_CASTS"
54 CFLAGS="$CFLAGS -DGTK_NO_CHECK_CASTS"
58 # Build time sanity check...
61 # Checks for programs.
67 if test "x$GCC" = "xyes"; then
68 if test -z "`echo "$CFLAGS" | grep "\-Wall" 2> /dev/null`" ; then
69 CFLAGS="$CFLAGS -Wall"
72 if test "x$enable_ansi" = "xyes"; then
73 if test -z "`echo "$CFLAGS" | grep "\-ansi" 2> /dev/null`" ; then
74 CFLAGS="$CFLAGS -ansi"
77 if test -z "`echo "$CFLAGS" | grep "\-pedantic" 2> /dev/null`" ; then
78 CFLAGS="$CFLAGS -pedantic"
83 if test "x$enable_xim" = "xyes"; then
84 CFLAGS="$CFLAGS -DUSE_XIM"
87 AC_DEFINE_UNQUOTED(GTK_MAJOR_VERSION, $GTK_MAJOR_VERSION)
88 AC_DEFINE_UNQUOTED(GTK_MINOR_VERSION, $GTK_MINOR_VERSION)
89 AC_DEFINE_UNQUOTED(GTK_MICRO_VERSION, $GTK_MICRO_VERSION)
90 AC_DEFINE_UNQUOTED(GTK_VERSION, "$GTK_VERSION")
92 # Find the X11 include and library directories
96 if test "x$x_includes" = "x"; then
97 x_includes="/usr/include"
100 saved_cflags="$CFLAGS"
101 saved_ldflags="$LDFLAGS"
104 LDFLAGS="$X_LDFLAGS $X_LIBS"
106 # Checks for libraries.
107 # Check for the X11 library
108 AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", no_x11_lib=yes, $X_EXTRA_LIBS)
110 if test "x$enable_shm" = "xyes"; then
111 # Check for the Xext library (needed for XShm extention)
112 AC_CHECK_LIB(Xext, XShmAttach, x_libs="-lXext $x_libs", no_xext_lib=yes, $x_libs)
116 x_ldflags="$X_LDFLAGS $X_LIBS"
118 # set up things for XInput
120 if test "x$with_xinput" = "xgxi" || test "x$with_xinput" = "xyes"; then
121 AC_DEFINE(XINPUT_GXI)
123 x_libs="-lXi $x_libs"
124 elif test "x$with_xinput" = "xxfree"; then
125 AC_DEFINE(XINPUT_XFREE)
126 x_libs="-lXi $x_libs"
128 AC_DEFINE(XINPUT_NONE)
135 AC_SUBST(xinput_progs)
136 AC_SUBST(GTK_VERSION)
138 CFLAGS="$saved_cflags"
139 LDFLAGS="$saved_ldflags"
141 if test "x$enable_shm" = "xyes"; then
142 # Check for shared memory
143 AC_CHECK_HEADER(sys/ipc.h, AC_DEFINE(HAVE_IPC_H), no_sys_ipc=yes)
144 AC_CHECK_HEADER(sys/shm.h, AC_DEFINE(HAVE_SHM_H), no_sys_shm=yes)
146 # Check whether shmctl IPC_RMID allowes subsequent attaches
147 if test "$ac_cv_header_sys_shm_h" = "yes"; then
148 AC_MSG_CHECKING(whether shmctl IPC_RMID allowes subsequent attaches)
150 #include <sys/types.h>
157 id = shmget (IPC_PRIVATE, 4, IPC_CREAT | 0777);
160 shmaddr = shmat (id, 0, 0);
161 shmctl (id, IPC_RMID, 0);
162 if ((char*) shmat (id, 0, 0) == (char*) -1)
172 AC_DEFINE(IPC_RMID_DEFERRED_RELEASE)
175 AC_MSG_RESULT(assuming no))
178 # Check for the X shared memory extension header file
179 AC_MSG_CHECKING(X11/extensions/XShm.h)
180 if test "x$no_xext_lib" = "xyes"; then
184 if test -f "$x_includes/X11/extensions/XShm.h"; then
186 AC_DEFINE(HAVE_XSHM_H)
194 # Check for private display resource base variable
195 AC_MSG_CHECKING(resource base field in XDisplay)
196 AC_CACHE_VAL(gtk_cv_display_resource_base,
198 #define XLIB_ILLEGAL_ACCESS
199 #include <X11/Xlib.h>
208 display->resource_base;
210 gtk_cv_display_resource_base="resource_base",
211 gtk_cv_display_resource_base="private3")])
212 AC_MSG_RESULT($gtk_cv_display_resource_base)
213 AC_DEFINE_UNQUOTED(RESOURCE_BASE, gdk_display->$gtk_cv_display_resource_base)
215 # Check if X_LOCALE definition is necessary
217 AC_MSG_CHECKING(need -DX_LOCALE)
226 return setlocale (LC_ALL, "${with_locale}") == NULL;
230 AC_MSG_RESULT($need_x_locale)
232 if test $need_x_locale = yes; then
233 CFLAGS="$CFLAGS -DX_LOCALE"
236 # Checks for header files.
239 # Checks for typedefs, structures, and compiler characteristics.
243 # Checks for library functions.
247 # Check for sys/select.h
249 AC_MSG_CHECKING([fd_set and sys/select])
250 AC_TRY_COMPILE([#include <sys/types.h>],
251 [fd_set readMask, writeMask;], gtk_ok=yes, gtk_ok=no)
252 if test $gtk_ok = no; then
253 AC_HEADER_EGREP(fd_mask, sys/select.h, gtk_ok=yes)
254 if test $gtk_ok = yes; then
255 AC_DEFINE(HAVE_SYS_SELECT_H)
258 AC_MSG_RESULT($gtk_ok)
259 if test $gtk_ok = no; then
263 AC_OUTPUT([Makefile gtk-config docs/Makefile gdk/Makefile gtk/Makefile],
264 [chmod +x gtk-config])