1 # Process this file with autoconf to produce a configure script.
2 AC_INIT(gdk/gdktypes.h)
5 AC_CONFIG_SUBDIRS(glib)
7 dnl Initialize automake stuff
8 AM_INIT_AUTOMAKE(gtk+, 971201)
10 # Specify a configuration file
11 AM_CONFIG_HEADER(config.h)
13 dnl Initialize libtool
16 dnl Initialize maintainer mode
21 AC_ARG_ENABLE(shm, [ --enable-shm support shared memory if available [default=yes]],
22 echo $enable_shm, enable_shm="yes")
23 AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]],
24 if eval "test x$enable_debug = xyes"; then
27 AC_ARG_ENABLE(ansi, [ --enable-ansi turn on strict ansi [default=no]],
29 AC_ARG_ENABLE(xim, [ --enable-xim support XIM [default=yes]],
30 echo $enable_xim, enable_xim="yes")
31 AC_ARG_WITH(locale, [ --with-locale=LOCALE locale name you want to use ])
33 AC_ARG_WITH(xinput, [ --with-xinput[=no/gxi/xfree] support XInput ])
35 if test -n "$DEBUGFLAG"; then
38 CFLAGS="$CFLAGS -DNDEBUG"
41 # Build time sanity check...
44 # Checks for programs.
50 if eval "test x$GCC = xyes"; then
51 test `echo "$CFLAGS" | grep "\-Wall" > /dev/null 2> /dev/null`
53 CFLAGS="$CFLAGS -Wall"
56 if eval "test x$enable_ansi = xyes"; then
57 test `echo "$CFLAGS" | grep "\-ansi" > /dev/null 2> /dev/null`
59 CFLAGS="$CFLAGS -ansi"
62 test `echo "$CFLAGS" | grep "\-pedantic" > /dev/null 2> /dev/null`
64 CFLAGS="$CFLAGS -pedantic"
69 if eval "test x$enable_xim = xyes"; then
70 CFLAGS="$CFLAGS -DUSE_XIM"
73 # Find the X11 include and library directories
77 if test "x$x_includes" = "x"; then
78 x_includes="/usr/include"
81 saved_cflags="$CFLAGS"
82 saved_ldflags="$LDFLAGS"
85 LDFLAGS="$X_LDFLAGS $X_LIBS"
87 # Checks for libraries.
88 # Check for the X11 library
89 AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", no_x11_lib=yes, $X_EXTRA_LIBS)
91 if eval "test x$enable_shm = xyes"; then
92 # Check for the Xext library (needed for XShm extention)
93 AC_CHECK_LIB(Xext, XShmAttach, x_libs="-lXext $x_libs", no_xext_lib=yes, $x_libs)
97 x_ldflags="$X_LDFLAGS $X_LIBS"
99 # set up things for XInput
101 if eval "test x$with_xinput = xgxi -o x$with_xinput = xyes"; then
102 AC_DEFINE(XINPUT_GXI)
104 x_libs="-lXi $x_libs"
105 elif eval "test x$with_xinput = xxfree"; then
106 AC_DEFINE(XINPUT_XFREE)
107 x_libs="-lXi $x_libs"
109 AC_DEFINE(XINPUT_NONE)
117 AC_SUBST(xinput_progs)
119 CFLAGS="$saved_cflags"
120 LDFLAGS="$saved_ldflags"
122 if eval "test x$enable_shm = xyes"; then
123 # Check for shared memory
124 AC_CHECK_HEADER(sys/ipc.h, AC_DEFINE(HAVE_IPC_H), no_sys_ipc=yes)
125 AC_CHECK_HEADER(sys/shm.h, AC_DEFINE(HAVE_SHM_H), no_sys_shm=yes)
127 # Check whether shmctl IPC_RMID allowes subsequent attaches
128 if test "$ac_cv_header_sys_shm_h" = "yes"; then
129 AC_MSG_CHECKING(whether shmctl IPC_RMID allowes subsequent attaches)
131 #include <sys/types.h>
138 id = shmget (IPC_PRIVATE, 4, IPC_CREAT | 0777);
141 shmaddr = shmat (id, 0, 0);
142 shmctl (id, IPC_RMID, 0);
143 if ((char*) shmat (id, 0, 0) == (char*) -1)
153 AC_DEFINE(IPC_RMID_DEFERRED_RELEASE)
156 AC_MSG_RESULT(assuming no))
159 # Check for the X shared memory extension header file
160 AC_MSG_CHECKING(X11/extensions/XShm.h)
161 if eval "test x$no_ext_lib = xyes"; then
165 if eval "test -f $x_includes/X11/extensions/XShm.h"; then
167 AC_DEFINE(HAVE_XSHM_H)
175 # Check for private display resource base variable
176 AC_MSG_CHECKING(resource base field in XDisplay)
177 AC_CACHE_VAL(gtk_cv_display_resource_base,
179 #define XLIB_ILLEGAL_ACCESS
180 #include <X11/Xlib.h>
189 display->resource_base;
191 gtk_cv_display_resource_base="resource_base",
192 gtk_cv_display_resource_base="private3")])
193 AC_MSG_RESULT($gtk_cv_display_resource_base)
194 AC_DEFINE_UNQUOTED(RESOURCE_BASE, gdk_display->$gtk_cv_display_resource_base)
196 # Check if X_LOCALE definition is necessary
198 AC_MSG_CHECKING(need -DX_LOCALE)
206 return setlocale (LC_ALL, "${with_locale}") == NULL;
210 AC_MSG_RESULT($gtk_cv_x_locale)
211 if test $gtk_cv_x_locale = yes; then
212 CFLAGS="$CFLAGS -DX_LOCALE"
215 # Checks for header files.
218 # Checks for typedefs, structures, and compiler characteristics.
221 # Checks for library functions.
224 # Check for sys/select.h
226 AC_MSG_CHECKING([fd_set and sys/select])
227 AC_TRY_COMPILE([#include <sys/types.h>],
228 [fd_set readMask, writeMask;], gtk_ok=yes, gtk_ok=no)
229 if test $gtk_ok = no; then
230 AC_HEADER_EGREP(fd_mask, sys/select.h, gtk_ok=yes)
231 if test $gtk_ok = yes; then
232 AC_DEFINE(HAVE_SYS_SELECT_H)
235 AC_MSG_RESULT($gtk_ok)
236 if test $gtk_ok = no; then
240 AC_OUTPUT(Makefile gtk+.xconfig docs/Makefile gdk/Makefile gtk/Makefile)