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}
8 # GTK_MICRO_VERSION += 1;
9 # GTK_INTERFACE_AGE += 1;
10 # GTK_BINARY_AGE += 1;
11 # if any functions have been added, set GTK_INTERFACE_AGE to 0.
12 # if backwards compatibility has been broken,
13 # set GTK_BINARY_AGE and GTK_INTERFACE_AGE to 0.
20 GTK_VERSION=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION.$GTK_MICRO_VERSION
21 AC_SUBST(GTK_MAJOR_VERSION)
22 AC_SUBST(GTK_MINOR_VERSION)
23 AC_SUBST(GTK_MICRO_VERSION)
27 LT_RELEASE=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION
28 LT_CURRENT=`expr $GTK_MICRO_VERSION - $GTK_INTERFACE_AGE`
29 LT_REVISION=$GTK_INTERFACE_AGE
30 LT_AGE=`expr $GTK_BINARY_AGE - $GTK_INTERFACE_AGE`
42 AC_CONFIG_SUBDIRS(glib)
44 # Save this value here, since automake will set cflags later
45 cflags_set=${CFLAGS+set}
47 dnl Initialize automake stuff
48 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
50 # Specify a configuration file
51 AM_CONFIG_HEADER(config.h)
53 dnl Initialize libtool
56 dnl Initialize maintainer mode
61 AC_ARG_ENABLE(shm, [ --enable-shm support shared memory if available [default=yes]],
62 echo $enable_shm, enable_shm="yes")
63 AC_ARG_ENABLE(debug, [ --enable-debug=[no/minimum/yes] turn on debugging [default=minimum]],,enable_debug=minimum)
64 AC_ARG_ENABLE(ansi, [ --enable-ansi turn on strict ansi [default=no]],
66 AC_ARG_ENABLE(xim, [ --enable-xim support XIM [default=yes]],
67 echo $enable_xim, enable_xim="yes")
68 AC_ARG_WITH(locale, [ --with-locale=LOCALE locale name you want to use ])
70 AC_ARG_WITH(xinput, [ --with-xinput=[no/gxi/xfree] support XInput ])
72 if test "x$enable_debug" = "xyes"; then
73 test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
74 CFLAGS="$CFLAGS -DG_ENABLE_DEBUG"
76 if test "x$enable_debug" = "xno"; then
77 CFLAGS="$CFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DGTK_NO_CHECK_CASTS"
79 CFLAGS="$CFLAGS -DGTK_NO_CHECK_CASTS"
83 # Build time sanity check...
86 # Checks for programs.
92 if test "x$GCC" = "xyes"; then
93 if test -z "`echo "$CFLAGS" | grep "\-Wall" 2> /dev/null`" ; then
94 CFLAGS="$CFLAGS -Wall"
97 if test "x$enable_ansi" = "xyes"; then
98 if test -z "`echo "$CFLAGS" | grep "\-ansi" 2> /dev/null`" ; then
99 CFLAGS="$CFLAGS -ansi"
102 if test -z "`echo "$CFLAGS" | grep "\-pedantic" 2> /dev/null`" ; then
103 CFLAGS="$CFLAGS -pedantic"
108 AC_MSG_CHECKING([For extra flags to get ANSI library prototypes])
109 gtk_save_LDFLAGS=$LDFLAGS
111 AC_TRY_RUN([#include <math.h>
112 int main (void) { return (log(1) != log(1.)); }],
113 AC_MSG_RESULT(none needed),
114 gtk_save_CFLAGS=$CFLAGS
115 CFLAGS="$CFLAGS -std1"
116 AC_TRY_RUN([#include <math.h>
117 int main (void) { return (log(1) != log(1.)); }],
118 AC_MSG_RESULT(-std1),
120 CFLAGS=$gtk_save_CFLAGS
122 [No ANSI prototypes found in library. (-std1 didn't work.)])
127 if test "x$enable_xim" = "xyes"; then
128 CFLAGS="$CFLAGS -DUSE_XIM"
131 # Find the X11 include and library directories
135 if test "x$x_includes" = "x"; then
136 x_includes="/usr/include"
139 saved_cflags="$CFLAGS"
140 saved_ldflags="$LDFLAGS"
143 LDFLAGS="$X_LDFLAGS $X_LIBS"
145 # Checks for libraries.
146 # Check for the X11 library
147 AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", no_x11_lib=yes, $X_EXTRA_LIBS)
149 if test "x$enable_shm" = "xyes"; then
150 # Check for the Xext library (needed for XShm extention)
151 AC_CHECK_LIB(Xext, XShmAttach,
152 x_libs="-lXext $x_libs",
153 # On AIX, it is in XextSam instead, but we still need -lXext
154 AC_CHECK_LIB(XextSam, XShmAttach,
155 x_libs="-lXextSam -lXext $x_libs",
156 no_xext_lib=yes, $x_libs),
160 # Check for shaped window extension
162 AC_CHECK_LIB(Xext, XShapeCombineMask,
163 if test -z "`echo $x_libs | grep "\-lXext" 2> /dev/null`"; then
164 $x_libs="-lXext $x_libs"
166 AC_DEFINE(HAVE_SHAPE_EXT),
171 x_ldflags="$X_LDFLAGS $X_LIBS"
173 # set up things for XInput
175 if test "x$with_xinput" = "xgxi" || test "x$with_xinput" = "xyes"; then
176 AC_DEFINE(XINPUT_GXI)
178 x_libs="-lXi $x_libs"
179 elif test "x$with_xinput" = "xxfree"; then
180 AC_DEFINE(XINPUT_XFREE)
181 x_libs="-lXi $x_libs"
183 AC_DEFINE(XINPUT_NONE)
190 AC_SUBST(xinput_progs)
192 CFLAGS="$saved_cflags"
193 LDFLAGS="$saved_ldflags"
195 if test "x$enable_shm" = "xyes"; then
196 # Check for shared memory
197 AC_CHECK_HEADER(sys/ipc.h, AC_DEFINE(HAVE_IPC_H), no_sys_ipc=yes)
198 AC_CHECK_HEADER(sys/shm.h, AC_DEFINE(HAVE_SHM_H), no_sys_shm=yes)
200 # Check whether shmctl IPC_RMID allowes subsequent attaches
201 if test "$ac_cv_header_sys_shm_h" = "yes"; then
202 AC_MSG_CHECKING(whether shmctl IPC_RMID allowes subsequent attaches)
204 #include <sys/types.h>
211 id = shmget (IPC_PRIVATE, 4, IPC_CREAT | 0777);
214 shmaddr = shmat (id, 0, 0);
215 shmctl (id, IPC_RMID, 0);
216 if ((char*) shmat (id, 0, 0) == (char*) -1)
226 AC_DEFINE(IPC_RMID_DEFERRED_RELEASE)
229 AC_MSG_RESULT(assuming no))
232 # Check for the X shared memory extension header file
233 AC_MSG_CHECKING(X11/extensions/XShm.h)
234 if test "x$no_xext_lib" = "xyes"; then
238 if test -f "$x_includes/X11/extensions/XShm.h"; then
240 AC_DEFINE(HAVE_XSHM_H)
248 # Check for private display resource base variable
249 AC_MSG_CHECKING(resource base field in XDisplay)
250 AC_CACHE_VAL(gtk_cv_display_resource_base,
252 #define XLIB_ILLEGAL_ACCESS
253 #include <X11/Xlib.h>
262 display->resource_base;
264 gtk_cv_display_resource_base="resource_base",
265 gtk_cv_display_resource_base="private3")])
266 AC_MSG_RESULT($gtk_cv_display_resource_base)
267 AC_DEFINE_UNQUOTED(RESOURCE_BASE, gdk_display->$gtk_cv_display_resource_base)
269 # Check if X_LOCALE definition is necessary
271 AC_MSG_CHECKING(need -DX_LOCALE)
280 return setlocale (LC_ALL, "${with_locale}") == NULL;
284 AC_MSG_RESULT($need_x_locale)
286 if test $need_x_locale = yes; then
287 CFLAGS="$CFLAGS -DX_LOCALE"
290 # Checks for header files.
293 # Checks for typedefs, structures, and compiler characteristics.
296 # Checks for library functions.
300 # Check for sys/select.h
302 AC_MSG_CHECKING([fd_set and sys/select])
303 AC_TRY_COMPILE([#include <sys/types.h>],
304 [fd_set readMask, writeMask;], gtk_ok=yes, gtk_ok=no)
305 if test $gtk_ok = no; then
306 AC_HEADER_EGREP(fd_mask, sys/select.h, gtk_ok=yes)
307 if test $gtk_ok = yes; then
308 AC_DEFINE(HAVE_SYS_SELECT_H)
311 AC_MSG_RESULT($gtk_ok)
312 if test $gtk_ok = no; then
323 ], [chmod +x gtk-config])