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,
113 x_libs="-lXext $x_libs",
114 # On AIX, it is in XextSam instead, but we still need -lXext
115 AC_CHECK_LIB(XextSam, XShmAttach,
116 x_libs="-lXextSam -lXext $x_libs",
117 no_xext_lib=yes, $x_libs),
122 x_ldflags="$X_LDFLAGS $X_LIBS"
124 # set up things for XInput
126 if test "x$with_xinput" = "xgxi" || test "x$with_xinput" = "xyes"; then
127 AC_DEFINE(XINPUT_GXI)
129 x_libs="-lXi $x_libs"
130 elif test "x$with_xinput" = "xxfree"; then
131 AC_DEFINE(XINPUT_XFREE)
132 x_libs="-lXi $x_libs"
134 AC_DEFINE(XINPUT_NONE)
141 AC_SUBST(xinput_progs)
142 AC_SUBST(GTK_VERSION)
144 CFLAGS="$saved_cflags"
145 LDFLAGS="$saved_ldflags"
147 if test "x$enable_shm" = "xyes"; then
148 # Check for shared memory
149 AC_CHECK_HEADER(sys/ipc.h, AC_DEFINE(HAVE_IPC_H), no_sys_ipc=yes)
150 AC_CHECK_HEADER(sys/shm.h, AC_DEFINE(HAVE_SHM_H), no_sys_shm=yes)
152 # Check whether shmctl IPC_RMID allowes subsequent attaches
153 if test "$ac_cv_header_sys_shm_h" = "yes"; then
154 AC_MSG_CHECKING(whether shmctl IPC_RMID allowes subsequent attaches)
156 #include <sys/types.h>
163 id = shmget (IPC_PRIVATE, 4, IPC_CREAT | 0777);
166 shmaddr = shmat (id, 0, 0);
167 shmctl (id, IPC_RMID, 0);
168 if ((char*) shmat (id, 0, 0) == (char*) -1)
178 AC_DEFINE(IPC_RMID_DEFERRED_RELEASE)
181 AC_MSG_RESULT(assuming no))
184 # Check for the X shared memory extension header file
185 AC_MSG_CHECKING(X11/extensions/XShm.h)
186 if test "x$no_xext_lib" = "xyes"; then
190 if test -f "$x_includes/X11/extensions/XShm.h"; then
192 AC_DEFINE(HAVE_XSHM_H)
200 # Check for private display resource base variable
201 AC_MSG_CHECKING(resource base field in XDisplay)
202 AC_CACHE_VAL(gtk_cv_display_resource_base,
204 #define XLIB_ILLEGAL_ACCESS
205 #include <X11/Xlib.h>
214 display->resource_base;
216 gtk_cv_display_resource_base="resource_base",
217 gtk_cv_display_resource_base="private3")])
218 AC_MSG_RESULT($gtk_cv_display_resource_base)
219 AC_DEFINE_UNQUOTED(RESOURCE_BASE, gdk_display->$gtk_cv_display_resource_base)
221 # Check if X_LOCALE definition is necessary
223 AC_MSG_CHECKING(need -DX_LOCALE)
232 return setlocale (LC_ALL, "${with_locale}") == NULL;
236 AC_MSG_RESULT($need_x_locale)
238 if test $need_x_locale = yes; then
239 CFLAGS="$CFLAGS -DX_LOCALE"
242 # Checks for header files.
245 # Checks for typedefs, structures, and compiler characteristics.
248 # Checks for library functions.
252 # Check for sys/select.h
254 AC_MSG_CHECKING([fd_set and sys/select])
255 AC_TRY_COMPILE([#include <sys/types.h>],
256 [fd_set readMask, writeMask;], gtk_ok=yes, gtk_ok=no)
257 if test $gtk_ok = no; then
258 AC_HEADER_EGREP(fd_mask, sys/select.h, gtk_ok=yes)
259 if test $gtk_ok = yes; then
260 AC_DEFINE(HAVE_SYS_SELECT_H)
263 AC_MSG_RESULT($gtk_ok)
264 if test $gtk_ok = no; then
268 AC_OUTPUT([Makefile gtk-config docs/Makefile gdk/Makefile gtk/Makefile],
269 [chmod +x gtk-config])