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 ])
71 AC_ARG_WITH(threads, [ --with-threads=[posix] support threading ])
73 if test "x$enable_debug" = "xyes"; then
74 test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
75 CFLAGS="$CFLAGS -DG_ENABLE_DEBUG"
77 if test "x$enable_debug" = "xno"; then
78 CFLAGS="$CFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DGTK_NO_CHECK_CASTS"
80 CFLAGS="$CFLAGS -DGTK_NO_CHECK_CASTS"
84 # Build time sanity check...
87 # Checks for programs.
93 if test "x$GCC" = "xyes"; then
94 if test -z "`echo "$CFLAGS" | grep "\-Wall" 2> /dev/null`" ; then
95 CFLAGS="$CFLAGS -Wall"
98 if test "x$enable_ansi" = "xyes"; then
99 if test -z "`echo "$CFLAGS" | grep "\-ansi" 2> /dev/null`" ; then
100 CFLAGS="$CFLAGS -ansi"
103 if test -z "`echo "$CFLAGS" | grep "\-pedantic" 2> /dev/null`" ; then
104 CFLAGS="$CFLAGS -pedantic"
109 AC_MSG_CHECKING([For extra flags to get ANSI library prototypes])
110 gtk_save_LDFLAGS=$LDFLAGS
112 AC_TRY_RUN([#include <math.h>
113 int main (void) { return (log(1) != log(1.)); }],
114 AC_MSG_RESULT(none needed),
115 gtk_save_CFLAGS=$CFLAGS
116 CFLAGS="$CFLAGS -std1"
117 AC_TRY_RUN([#include <math.h>
118 int main (void) { return (log(1) != log(1.)); }],
119 AC_MSG_RESULT(-std1),
121 CFLAGS=$gtk_save_CFLAGS
123 [No ANSI prototypes found in library. (-std1 didn't work.)])
128 if test "x$enable_xim" = "xyes"; then
129 CFLAGS="$CFLAGS -DUSE_XIM"
132 # Find the X11 include and library directories
136 if test "x$x_includes" = "x"; then
137 x_includes="/usr/include"
140 saved_cflags="$CFLAGS"
141 saved_ldflags="$LDFLAGS"
144 LDFLAGS="$X_LDFLAGS $X_LIBS"
146 if test "x$no_x" = "xyes"; then
148 *** X libraries or include files not found. Check 'config.log' for
152 # Checks for libraries.
153 # Check for the X11 library
154 AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS",
155 AC_MSG_ERROR([*** libX11 not found. Check 'config.log' for more details.]),
158 if test "x$enable_shm" = "xyes"; then
159 # Check for the Xext library (needed for XShm extention)
160 AC_CHECK_LIB(Xext, XShmAttach,
161 x_libs="-lXext $x_libs",
162 # On AIX, it is in XextSam instead, but we still need -lXext
163 AC_CHECK_LIB(XextSam, XShmAttach,
164 x_libs="-lXextSam -lXext $x_libs",
165 no_xext_lib=yes, $x_libs),
169 # Check for shaped window extension
171 AC_CHECK_LIB(Xext, XShapeCombineMask,
172 if test -z "`echo $x_libs | grep "\-lXext" 2> /dev/null`"; then
173 $x_libs="-lXext $x_libs"
175 AC_DEFINE(HAVE_SHAPE_EXT),
180 x_ldflags="$X_LDFLAGS $X_LIBS"
182 # set up things for XInput
184 if test "x$with_xinput" = "xgxi" || test "x$with_xinput" = "xyes"; then
185 AC_DEFINE(XINPUT_GXI)
187 x_libs="-lXi $x_libs"
188 elif test "x$with_xinput" = "xxfree"; then
189 AC_DEFINE(XINPUT_XFREE)
190 x_libs="-lXi $x_libs"
192 AC_DEFINE(XINPUT_NONE)
197 if test "x$with_threads" = "xposix" || test "x$with_threads" = "xyes"; then
198 AC_CHECK_LIB(pthread, pthread_attr_init,
199 AC_DEFINE(USE_PTHREADS)
200 x_libs="$x_libs -lpthread"
201 CFLAGS="$CFLAGS -D_REENTRANT")
208 AC_SUBST(xinput_progs)
210 CFLAGS="$saved_cflags"
211 LDFLAGS="$saved_ldflags"
213 if test "x$enable_shm" = "xyes"; then
214 # Check for shared memory
215 AC_CHECK_HEADER(sys/ipc.h, AC_DEFINE(HAVE_IPC_H), no_sys_ipc=yes)
216 AC_CHECK_HEADER(sys/shm.h, AC_DEFINE(HAVE_SHM_H), no_sys_shm=yes)
218 # Check whether shmctl IPC_RMID allowes subsequent attaches
219 if test "$ac_cv_header_sys_shm_h" = "yes"; then
220 AC_MSG_CHECKING(whether shmctl IPC_RMID allowes subsequent attaches)
222 #include <sys/types.h>
229 id = shmget (IPC_PRIVATE, 4, IPC_CREAT | 0777);
232 shmaddr = shmat (id, 0, 0);
233 shmctl (id, IPC_RMID, 0);
234 if ((char*) shmat (id, 0, 0) == (char*) -1)
244 AC_DEFINE(IPC_RMID_DEFERRED_RELEASE)
247 AC_MSG_RESULT(assuming no))
250 # Check for the X shared memory extension header file
251 AC_MSG_CHECKING(X11/extensions/XShm.h)
252 if test "x$no_xext_lib" = "xyes"; then
256 if test -f "$x_includes/X11/extensions/XShm.h"; then
258 AC_DEFINE(HAVE_XSHM_H)
266 # Check for private display resource base variable
267 AC_MSG_CHECKING(resource base field in XDisplay)
268 AC_CACHE_VAL(gtk_cv_display_resource_base,
270 #define XLIB_ILLEGAL_ACCESS
271 #include <X11/Xlib.h>
280 display->resource_base;
282 gtk_cv_display_resource_base="resource_base",
283 gtk_cv_display_resource_base="private3")])
284 AC_MSG_RESULT($gtk_cv_display_resource_base)
285 AC_DEFINE_UNQUOTED(RESOURCE_BASE, gdk_display->$gtk_cv_display_resource_base)
287 # Check if X_LOCALE definition is necessary
289 AC_MSG_CHECKING(need -DX_LOCALE)
298 return setlocale (LC_ALL, "${with_locale}") == NULL;
302 AC_MSG_RESULT($need_x_locale)
304 if test $need_x_locale = yes; then
305 CFLAGS="$CFLAGS -DX_LOCALE"
308 # Checks for header files.
311 # Checks for typedefs, structures, and compiler characteristics.
314 # Checks for library functions.
318 # Check for sys/select.h
320 AC_MSG_CHECKING([fd_set and sys/select])
321 AC_TRY_COMPILE([#include <sys/types.h>],
322 [fd_set readMask, writeMask;], gtk_ok=yes, gtk_ok=no)
323 if test $gtk_ok = no; then
324 AC_HEADER_EGREP(fd_mask, sys/select.h, gtk_ok=yes)
325 if test $gtk_ok = yes; then
326 AC_DEFINE(HAVE_SYS_SELECT_H)
329 AC_MSG_RESULT($gtk_ok)
330 if test $gtk_ok = no; then
341 ], [chmod +x gtk-config])