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 turn on debugging [default=no]],
39 if test "x$enable_debug" = "xyes"; then
42 AC_ARG_ENABLE(ansi, [ --enable-ansi turn on strict ansi [default=no]],
44 AC_ARG_ENABLE(xim, [ --enable-xim support XIM [default=yes]],
45 echo $enable_xim, enable_xim="yes")
46 AC_ARG_WITH(locale, [ --with-locale=LOCALE locale name you want to use ])
48 AC_ARG_WITH(xinput, [ --with-xinput[=no/gxi/xfree] support XInput ])
50 if test -n "$DEBUGFLAG"; then
51 test "$cflags_set" = set || CFLAGS="$DEBUGFLAG"
53 CFLAGS="$CFLAGS -DNDEBUG"
56 # Build time sanity check...
59 # Checks for programs.
65 if test "x$GCC" = "xyes"; then
66 if test -z "`echo "$CFLAGS" | grep "\-Wall" 2> /dev/null`" ; then
67 CFLAGS="$CFLAGS -Wall"
70 if test "x$enable_ansi" = "xyes"; then
71 if test -z "`echo "$CFLAGS" | grep "\-ansi" 2> /dev/null`" ; then
72 CFLAGS="$CFLAGS -ansi"
75 if test -z "`echo "$CFLAGS" | grep "\-pedantic" 2> /dev/null`" ; then
76 CFLAGS="$CFLAGS -pedantic"
81 if test "x$enable_xim" = "xyes"; then
82 CFLAGS="$CFLAGS -DUSE_XIM"
85 # Find the X11 include and library directories
89 if test "x$x_includes" = "x"; then
90 x_includes="/usr/include"
93 saved_cflags="$CFLAGS"
94 saved_ldflags="$LDFLAGS"
97 LDFLAGS="$X_LDFLAGS $X_LIBS"
99 # Checks for libraries.
100 # Check for the X11 library
101 AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", no_x11_lib=yes, $X_EXTRA_LIBS)
103 if test "x$enable_shm" = "xyes"; then
104 # Check for the Xext library (needed for XShm extention)
105 AC_CHECK_LIB(Xext, XShmAttach, x_libs="-lXext $x_libs", no_xext_lib=yes, $x_libs)
109 x_ldflags="$X_LDFLAGS $X_LIBS"
111 # set up things for XInput
113 if test "x$with_xinput" = "xgxi" || test "x$with_xinput" = "xyes"; then
114 AC_DEFINE(XINPUT_GXI)
116 x_libs="-lXi $x_libs"
117 elif test "x$with_xinput" = "xxfree"; then
118 AC_DEFINE(XINPUT_XFREE)
119 x_libs="-lXi $x_libs"
121 AC_DEFINE(XINPUT_NONE)
129 AC_SUBST(xinput_progs)
131 CFLAGS="$saved_cflags"
132 LDFLAGS="$saved_ldflags"
134 if test "x$enable_shm" = "xyes"; then
135 # Check for shared memory
136 AC_CHECK_HEADER(sys/ipc.h, AC_DEFINE(HAVE_IPC_H), no_sys_ipc=yes)
137 AC_CHECK_HEADER(sys/shm.h, AC_DEFINE(HAVE_SHM_H), no_sys_shm=yes)
139 # Check whether shmctl IPC_RMID allowes subsequent attaches
140 if test "$ac_cv_header_sys_shm_h" = "yes"; then
141 AC_MSG_CHECKING(whether shmctl IPC_RMID allowes subsequent attaches)
143 #include <sys/types.h>
150 id = shmget (IPC_PRIVATE, 4, IPC_CREAT | 0777);
153 shmaddr = shmat (id, 0, 0);
154 shmctl (id, IPC_RMID, 0);
155 if ((char*) shmat (id, 0, 0) == (char*) -1)
165 AC_DEFINE(IPC_RMID_DEFERRED_RELEASE)
168 AC_MSG_RESULT(assuming no))
171 # Check for the X shared memory extension header file
172 AC_MSG_CHECKING(X11/extensions/XShm.h)
173 if test "x$no_ext_lib" = "xyes"; then
177 if test -f "$x_includes/X11/extensions/XShm.h"; then
179 AC_DEFINE(HAVE_XSHM_H)
187 # Check for private display resource base variable
188 AC_MSG_CHECKING(resource base field in XDisplay)
189 AC_CACHE_VAL(gtk_cv_display_resource_base,
191 #define XLIB_ILLEGAL_ACCESS
192 #include <X11/Xlib.h>
201 display->resource_base;
203 gtk_cv_display_resource_base="resource_base",
204 gtk_cv_display_resource_base="private3")])
205 AC_MSG_RESULT($gtk_cv_display_resource_base)
206 AC_DEFINE_UNQUOTED(RESOURCE_BASE, gdk_display->$gtk_cv_display_resource_base)
208 # Check if X_LOCALE definition is necessary
210 AC_MSG_CHECKING(need -DX_LOCALE)
219 return setlocale (LC_ALL, "${with_locale}") == NULL;
223 AC_MSG_RESULT($need_x_locale)
225 if test $need_x_locale = yes; then
226 CFLAGS="$CFLAGS -DX_LOCALE"
229 # Checks for header files.
232 # Checks for typedefs, structures, and compiler characteristics.
235 # Checks for library functions.
238 # Check for sys/select.h
240 AC_MSG_CHECKING([fd_set and sys/select])
241 AC_TRY_COMPILE([#include <sys/types.h>],
242 [fd_set readMask, writeMask;], gtk_ok=yes, gtk_ok=no)
243 if test $gtk_ok = no; then
244 AC_HEADER_EGREP(fd_mask, sys/select.h, gtk_ok=yes)
245 if test $gtk_ok = yes; then
246 AC_DEFINE(HAVE_SYS_SELECT_H)
249 AC_MSG_RESULT($gtk_ok)
250 if test $gtk_ok = no; then
254 AC_OUTPUT(Makefile gtk+.xconfig docs/Makefile gdk/Makefile gtk/Makefile)