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 # Find the X11 include and library directories
91 if test "x$x_includes" = "x"; then
92 x_includes="/usr/include"
95 saved_cflags="$CFLAGS"
96 saved_ldflags="$LDFLAGS"
99 LDFLAGS="$X_LDFLAGS $X_LIBS"
101 # Checks for libraries.
102 # Check for the X11 library
103 AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", no_x11_lib=yes, $X_EXTRA_LIBS)
105 if test "x$enable_shm" = "xyes"; then
106 # Check for the Xext library (needed for XShm extention)
107 AC_CHECK_LIB(Xext, XShmAttach, x_libs="-lXext $x_libs", no_xext_lib=yes, $x_libs)
111 x_ldflags="$X_LDFLAGS $X_LIBS"
113 # set up things for XInput
115 if test "x$with_xinput" = "xgxi" || test "x$with_xinput" = "xyes"; then
116 AC_DEFINE(XINPUT_GXI)
118 x_libs="-lXi $x_libs"
119 elif test "x$with_xinput" = "xxfree"; then
120 AC_DEFINE(XINPUT_XFREE)
121 x_libs="-lXi $x_libs"
123 AC_DEFINE(XINPUT_NONE)
131 AC_SUBST(xinput_progs)
133 CFLAGS="$saved_cflags"
134 LDFLAGS="$saved_ldflags"
136 if test "x$enable_shm" = "xyes"; then
137 # Check for shared memory
138 AC_CHECK_HEADER(sys/ipc.h, AC_DEFINE(HAVE_IPC_H), no_sys_ipc=yes)
139 AC_CHECK_HEADER(sys/shm.h, AC_DEFINE(HAVE_SHM_H), no_sys_shm=yes)
141 # Check whether shmctl IPC_RMID allowes subsequent attaches
142 if test "$ac_cv_header_sys_shm_h" = "yes"; then
143 AC_MSG_CHECKING(whether shmctl IPC_RMID allowes subsequent attaches)
145 #include <sys/types.h>
152 id = shmget (IPC_PRIVATE, 4, IPC_CREAT | 0777);
155 shmaddr = shmat (id, 0, 0);
156 shmctl (id, IPC_RMID, 0);
157 if ((char*) shmat (id, 0, 0) == (char*) -1)
167 AC_DEFINE(IPC_RMID_DEFERRED_RELEASE)
170 AC_MSG_RESULT(assuming no))
173 # Check for the X shared memory extension header file
174 AC_MSG_CHECKING(X11/extensions/XShm.h)
175 if test "x$no_xext_lib" = "xyes"; then
179 if test -f "$x_includes/X11/extensions/XShm.h"; then
181 AC_DEFINE(HAVE_XSHM_H)
189 # Check for private display resource base variable
190 AC_MSG_CHECKING(resource base field in XDisplay)
191 AC_CACHE_VAL(gtk_cv_display_resource_base,
193 #define XLIB_ILLEGAL_ACCESS
194 #include <X11/Xlib.h>
203 display->resource_base;
205 gtk_cv_display_resource_base="resource_base",
206 gtk_cv_display_resource_base="private3")])
207 AC_MSG_RESULT($gtk_cv_display_resource_base)
208 AC_DEFINE_UNQUOTED(RESOURCE_BASE, gdk_display->$gtk_cv_display_resource_base)
210 # Check if X_LOCALE definition is necessary
212 AC_MSG_CHECKING(need -DX_LOCALE)
221 return setlocale (LC_ALL, "${with_locale}") == NULL;
225 AC_MSG_RESULT($need_x_locale)
227 if test $need_x_locale = yes; then
228 CFLAGS="$CFLAGS -DX_LOCALE"
231 # Checks for header files.
234 # Checks for typedefs, structures, and compiler characteristics.
238 # Checks for library functions.
242 # Check for sys/select.h
244 AC_MSG_CHECKING([fd_set and sys/select])
245 AC_TRY_COMPILE([#include <sys/types.h>],
246 [fd_set readMask, writeMask;], gtk_ok=yes, gtk_ok=no)
247 if test $gtk_ok = no; then
248 AC_HEADER_EGREP(fd_mask, sys/select.h, gtk_ok=yes)
249 if test $gtk_ok = yes; then
250 AC_DEFINE(HAVE_SYS_SELECT_H)
253 AC_MSG_RESULT($gtk_ok)
254 if test $gtk_ok = no; then
258 AC_OUTPUT(Makefile gtk+.xconfig docs/Makefile gdk/Makefile gtk/Makefile)