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)
24 AC_SUBST(GTK_INTERFACE_AGE)
25 AC_SUBST(GTK_BINARY_AGE)
29 LT_RELEASE=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION
30 LT_CURRENT=`expr $GTK_MICRO_VERSION - $GTK_INTERFACE_AGE`
31 LT_REVISION=$GTK_INTERFACE_AGE
32 LT_AGE=`expr $GTK_BINARY_AGE - $GTK_INTERFACE_AGE`
42 # Save this value here, since automake will set cflags later
43 cflags_set=${CFLAGS+set}
45 dnl Initialize automake stuff
46 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
48 # Specify a configuration file
49 AM_CONFIG_HEADER(config.h)
51 dnl Initialize libtool
54 dnl Initialize maintainer mode
59 AC_ARG_ENABLE(shm, [ --enable-shm support shared memory if available [default=yes]],
60 echo $enable_shm, enable_shm="yes")
61 AC_ARG_ENABLE(debug, [ --enable-debug=[no/minimum/yes] turn on debugging [default=minimum]],,enable_debug=minimum)
62 AC_ARG_ENABLE(ansi, [ --enable-ansi turn on strict ansi [default=no]],
64 AC_ARG_WITH(glib, [ --with-glib=DIR Use uninstalled copy of glib])
65 AC_ARG_ENABLE(xim, [ --enable-xim support XIM [default=yes]],
66 echo $enable_xim, enable_xim="yes")
67 AC_ARG_WITH(locale, [ --with-locale=LOCALE locale name you want to use ])
69 AC_ARG_WITH(xinput, [ --with-xinput=[no/gxi/xfree] support XInput ])
70 AC_ARG_WITH(threads, [ --with-threads=[posix] support threading ])
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 AC_DEFINE_UNQUOTED(GTK_COMPILED_WITH_DEBUGGING, "${enable_debug}")
85 # Build time sanity check...
88 # Checks for programs.
94 if test "x$GCC" = "xyes"; then
95 if test -z "`echo "$CFLAGS" | grep "\-Wall" 2> /dev/null`" ; then
96 CFLAGS="$CFLAGS -Wall"
99 if test "x$enable_ansi" = "xyes"; then
100 if test -z "`echo "$CFLAGS" | grep "\-ansi" 2> /dev/null`" ; then
101 CFLAGS="$CFLAGS -ansi"
104 if test -z "`echo "$CFLAGS" | grep "\-pedantic" 2> /dev/null`" ; then
105 CFLAGS="$CFLAGS -pedantic"
110 AC_MSG_CHECKING([for extra flags to get ANSI library prototypes])
111 gtk_save_LDFLAGS=$LDFLAGS
113 AC_TRY_RUN([#include <math.h>
114 int main (void) { return (log(1) != log(1.)); }],
115 AC_MSG_RESULT(none needed),
116 gtk_save_CFLAGS=$CFLAGS
117 CFLAGS="$CFLAGS -std1"
118 AC_TRY_RUN([#include <math.h>
119 int main (void) { return (log(1) != log(1.)); }],
120 AC_MSG_RESULT(-std1),
122 CFLAGS=$gtk_save_CFLAGS
124 [No ANSI prototypes found in library. (-std1 didn't work.)])
129 if test "x$enable_xim" = "xyes"; then
130 CFLAGS="$CFLAGS -DUSE_XIM"
133 if test x$with_glib = xyes ; then
135 *** Directory must be specified for --with-glib])
138 if test x$with_glib = x ; then
139 # Look for separately installed glib
143 *** GLIB 1.1.3 or better is required. The latest version of GLIB
144 *** is always available from ftp://ftp.gtk.org.]),
147 glib_cflags=$GLIB_CFLAGS
150 # Use uninstalled glib (assume they got the version right)
152 if test -x $with_glib/glib-config ; then
155 AC_MSG_ERROR([GLIB directory ($with_glib) not present or not configured])
158 # For use in gtk-config
159 glib_cflags=`$with_glib/glib-config --cflags`
160 glib_libs=`$with_glib/glib-config --libs`
162 glib_release=`$with_glib/glib-config --version | sed 's%\\.[[0-9]]*$%%'`
164 # canonicalize relative paths
170 glib_dir="\$(top_builddir)/$with_glib"
174 GLIB_CFLAGS="-I$glib_dir"
175 GLIB_LIBS=$glib_dir/libglib-$glib_release.la
177 AC_SUBST(GLIB_CFLAGS)
181 AC_SUBST(glib_cflags)
184 # Find the X11 include and library directories
188 if test "x$x_includes" = "x"; then
189 x_includes="/usr/include"
192 saved_cflags="$CFLAGS"
193 saved_ldflags="$LDFLAGS"
195 CFLAGS="$CFLAGS $X_CFLAGS"
196 LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
198 if test "x$no_x" = "xyes"; then
200 *** X libraries or include files not found. Check 'config.log' for
204 # Checks for libraries.
205 # Check for the X11 library
206 AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS",
207 AC_MSG_ERROR([*** libX11 not found. Check 'config.log' for more details.]),
210 if test "x$enable_shm" = "xyes"; then
211 # Check for the Xext library (needed for XShm extention)
212 AC_CHECK_LIB(Xext, XShmAttach,
213 x_libs="-lXext $x_libs",
214 # On AIX, it is in XextSam instead, but we still need -lXext
215 AC_CHECK_LIB(XextSam, XShmAttach,
216 x_libs="-lXextSam -lXext $x_libs",
217 no_xext_lib=yes, $x_libs),
221 # Check for shaped window extension
223 AC_CHECK_LIB(Xext, XShapeCombineMask,
224 if test -z "`echo $x_libs | grep "\-lXext" 2> /dev/null`"; then
225 x_libs="-lXext $x_libs"
227 AC_DEFINE(HAVE_SHAPE_EXT),
231 # Check for XConvertCase (X11R6 specific)
233 AC_CHECK_LIB(X11, XConvertCase,
234 AC_DEFINE(HAVE_XCONVERTCASE),
239 x_ldflags="$X_LDFLAGS $X_LIBS"
241 # set up things for XInput
243 if test "x$with_xinput" = "xgxi" || test "x$with_xinput" = "xyes"; then
244 AC_DEFINE(XINPUT_GXI)
246 x_libs="-lXi $x_libs"
247 elif test "x$with_xinput" = "xxfree"; then
248 AC_DEFINE(XINPUT_XFREE)
249 x_libs="-lXi $x_libs"
251 AC_DEFINE(XINPUT_NONE)
256 if test "x$with_threads" = "xposix" || test "x$with_threads" = "xyes"; then
257 AC_CHECK_LIB(pthread, pthread_attr_init,
258 AC_DEFINE(USE_PTHREADS)
259 x_libs="$x_libs -lpthread"
260 CFLAGS="$CFLAGS -D_REENTRANT")
267 AC_SUBST(xinput_progs)
269 CFLAGS="$saved_cflags"
270 LDFLAGS="$saved_ldflags"
272 if test "x$enable_shm" = "xyes"; then
273 # Check for shared memory
274 AC_CHECK_HEADER(sys/ipc.h, AC_DEFINE(HAVE_IPC_H), no_sys_ipc=yes)
275 AC_CHECK_HEADER(sys/shm.h, AC_DEFINE(HAVE_SHM_H), no_sys_shm=yes)
277 # Check whether shmctl IPC_RMID allowes subsequent attaches
278 if test "$ac_cv_header_sys_shm_h" = "yes"; then
279 AC_MSG_CHECKING(whether shmctl IPC_RMID allowes subsequent attaches)
281 #include <sys/types.h>
288 id = shmget (IPC_PRIVATE, 4, IPC_CREAT | 0777);
291 shmaddr = shmat (id, 0, 0);
292 shmctl (id, IPC_RMID, 0);
293 if ((char*) shmat (id, 0, 0) == (char*) -1)
303 AC_DEFINE(IPC_RMID_DEFERRED_RELEASE)
306 AC_MSG_RESULT(assuming no))
309 # Check for the X shared memory extension header file
310 AC_MSG_CHECKING(X11/extensions/XShm.h)
311 if test "x$no_xext_lib" = "xyes"; then
315 if test -f "$x_includes/X11/extensions/XShm.h"; then
317 AC_DEFINE(HAVE_XSHM_H)
325 # Check for private display resource base variable
326 AC_MSG_CHECKING(resource base field in XDisplay)
327 AC_CACHE_VAL(gtk_cv_display_resource_base,
329 #define XLIB_ILLEGAL_ACCESS
330 #include <X11/Xlib.h>
339 display->resource_base;
341 gtk_cv_display_resource_base="resource_base",
342 gtk_cv_display_resource_base="private3")])
343 AC_MSG_RESULT($gtk_cv_display_resource_base)
344 AC_DEFINE_UNQUOTED(RESOURCE_BASE, gdk_display->$gtk_cv_display_resource_base)
346 # Check if X_LOCALE definition is necessary
348 AC_MSG_CHECKING(need -DX_LOCALE)
357 return setlocale (LC_ALL, "${with_locale}") == NULL;
361 AC_MSG_RESULT($need_x_locale)
363 if test $need_x_locale = yes; then
364 CFLAGS="$CFLAGS -DX_LOCALE"
367 # Checks for header files.
370 # Checks for typedefs, structures, and compiler characteristics.
373 # Checks for endianness (needed by GdkRgb).
376 # Checks for library functions.
380 # Check if <sys/select.h> needs to be included for fd_set
381 AC_MSG_CHECKING([for fd_set])
382 AC_TRY_COMPILE([#include <sys/types.h>],
383 [fd_set readMask, writeMask;], gtk_ok=yes, gtk_ok=no)
384 if test $gtk_ok = yes; then
385 AC_MSG_RESULT([yes, found in sys/types.h])
387 AC_HEADER_EGREP(fd_mask, sys/select.h, gtk_ok=yes)
388 if test $gtk_ok = yes; then
389 AC_DEFINE(HAVE_SYS_SELECT_H)
390 AC_MSG_RESULT([yes, found in sys/select.h])
404 ], [chmod +x gtk-config])