]> Pileus Git - ~andy/gtk/blob - configure.in
Commented out testthreads from the build process, since we won't have any
[~andy/gtk] / configure.in
1 # Process this file with autoconf to produce a configure script.
2 AC_INIT(gdk/gdktypes.h)
3
4 # Save this value here, since automake will set cflags later
5 cflags_set=${CFLAGS+set}
6
7 # Making releases:
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.
14 #
15 GTK_MAJOR_VERSION=1
16 GTK_MINOR_VERSION=1
17 GTK_MICRO_VERSION=7
18 GTK_INTERFACE_AGE=0
19 GTK_BINARY_AGE=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)
26 AC_SUBST(GTK_VERSION)
27
28 # libtool versioning
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`
33 AC_SUBST(LT_RELEASE)
34 AC_SUBST(LT_CURRENT)
35 AC_SUBST(LT_REVISION)
36 AC_SUBST(LT_AGE)
37
38 # For automake.
39 VERSION=$GTK_VERSION
40 PACKAGE=gtk+
41
42 # Save this value here, since automake will set cflags later
43 cflags_set=${CFLAGS+set}
44
45 dnl Initialize automake stuff
46 AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
47
48 # Specify a configuration file
49 AM_CONFIG_HEADER(config.h)
50
51 dnl Initialize libtool
52 AM_PROG_LIBTOOL
53
54 dnl Initialize maintainer mode
55 AM_MAINTAINER_MODE
56
57 AC_CANONICAL_HOST
58
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]],
63                     , enable_ansi=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                         , enable_xim="yes")
67 AC_ARG_WITH(locale, [  --with-locale=LOCALE    locale name you want to use ])
68
69 AC_ARG_WITH(xinput, [  --with-xinput=[no/gxi/xfree] support XInput ])
70 AC_ARG_WITH(threads, [  --with-threads=[posix] support threading ])
71
72 if test "x$enable_debug" = "xyes"; then
73   test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
74   GTK_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
75 else
76   if test "x$enable_debug" = "xno"; then
77     GTK_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DGTK_NO_CHECK_CASTS"
78   else
79     GTK_DEBUG_FLAGS="-DGTK_NO_CHECK_CASTS"
80   fi
81 fi
82
83 AC_DEFINE_UNQUOTED(GTK_COMPILED_WITH_DEBUGGING, "${enable_debug}")
84
85 # Build time sanity check...
86 AM_SANITY_CHECK
87
88 # Checks for programs.
89 AC_PROG_CC
90 AC_ISC_POSIX
91 AM_PROG_CC_STDC
92 AC_PROG_INSTALL
93 AC_PROG_MAKE_SET
94
95 changequote(,)dnl
96 if test "x$GCC" = "xyes"; then
97   case " $CFLAGS " in
98   *[\ \ ]-Wall[\ \      ]*) ;;
99   *) CFLAGS="$CFLAGS -Wall" ;;
100   esac
101
102   if test "x$enable_ansi" = "xyes"; then
103     case " $CFLAGS " in
104     *[\ \       ]-ansi[\ \      ]*) ;;
105     *) CFLAGS="$CFLAGS -ansi" ;;
106     esac
107
108     case " $CFLAGS " in
109     *[\ \       ]-pedantic[\ \  ]*) ;;
110     *) CFLAGS="$CFLAGS -pedantic" ;;
111     esac
112   fi
113 fi
114 changequote([,])dnl
115
116 # define a MAINT-like variable REBUILD which is set if Perl
117 # and awk are found, so autogenerated sources can be rebuilt
118
119 AC_PROG_AWK
120 AC_CHECK_PROGS(PERL, perl5 perl)
121
122 # We would like indent, but don't require it.
123 AC_CHECK_PROG(INDENT, indent, indent)
124
125 REBUILD=\#
126 if test -n "$PERL" && perl -v | grep 'version 5.' > /dev/null ; then
127   if test -n "$AWK" ; then 
128     REBUILD=
129   fi
130 fi
131 AC_SUBST(REBUILD)
132
133 # i18n stuff
134 ALL_LINGUAS="de pt"
135 AM_GNU_GETTEXT
136 AC_CHECK_FUNC(gettext,
137         ,
138         AC_CHECK_LIB(intl, gettext)
139 )
140
141 dnl The DU4 header files don't provide library prototypes unless 
142 dnl -std1 is given to the native cc.
143 AC_MSG_CHECKING([for extra flags to get ANSI library prototypes])
144
145 gtk_save_LIBS=$LIBS
146 LIBS="$LIBS -lm"
147 AC_TRY_RUN([#include <math.h>
148              int main (void) { return (log(1) != log(1.)); }],
149      AC_MSG_RESULT(none needed),
150      gtk_save_CFLAGS=$CFLAGS
151      CFLAGS="$CFLAGS -std1"
152      AC_TRY_RUN([#include <math.h>
153                  int main (void) { return (log(1) != log(1.)); }],
154          AC_MSG_RESULT(-std1),
155          AC_MSG_RESULT()
156          CFLAGS=$gtk_save_CFLAGS
157          AC_MSG_WARN(
158                 [No ANSI prototypes found in library. (-std1 didn't work.)])
159      )
160 )
161 LIBS=$gtk_save_LIBS
162
163 dnl NeXTStep cc seems to need this
164 AC_MSG_CHECKING([for extra flags for POSIX compliance])
165 AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
166   AC_MSG_RESULT(none needed),
167   gtk_save_CFLAGS=$CFLAGS
168   CFLAGS="$CFLAGS -posix"
169   AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
170     AC_MSG_RESULT(-posix),
171     AC_MSG_RESULT()
172     CFLAGS=$gtk_save_CFLAGS
173     AC_MSG_WARN([Could not determine POSIX flag. (-posix didn't work.)])))
174
175 if test x$with_glib = xyes ; then
176   AC_MSG_ERROR([
177 *** Directory must be specified for --with-glib])
178 fi
179
180 if test x$with_glib = x ; then 
181   # Look for separately installed glib
182
183   AM_PATH_GLIB(1.1.6,,
184     AC_MSG_ERROR([
185 *** GLIB 1.1.6 or better is required. The latest version of GLIB
186 *** is always available from ftp://ftp.gtk.org.]),
187     gmodule gthread)
188
189   glib_cflags=$GLIB_CFLAGS
190   glib_libs=$GLIB_LIBS
191 else
192   # Use uninstalled glib (assume they got the version right)
193
194   GLIB_CONFIG=$with_glib/glib-config
195   if test -x $GLIB_CONFIG ; then 
196     :
197   else
198     AC_MSG_ERROR([GLIB directory ($with_glib) not present or not configured])
199   fi
200
201   # For use in gtk-config
202   glib_cflags=`$GLIB_CONFIG --cflags`
203   glib_libs=`$GLIB_CONFIG --libs`
204
205   glib_release=`$GLIB_CONFIG --version | sed 's%\\.[[0-9]]*$%%'`
206
207   # canonicalize relative paths
208   case $with_glib in 
209     /*)
210       glib_dir=$with_glib
211       ;;
212     *)
213       glib_dir="\$(top_builddir)/$with_glib"
214       ;;
215   esac
216
217   GLIB_CFLAGS="-I$glib_dir"
218   GLIB_LIBS=$glib_dir/libglib-$glib_release.la
219
220   AC_SUBST(GLIB_CFLAGS)
221   AC_SUBST(GLIB_LIBS)
222 fi
223
224 AC_SUBST(glib_cflags)
225 AC_SUBST(glib_libs)
226
227 # Find the X11 include and library directories
228 AC_PATH_X
229 AC_PATH_XTRA
230
231 if test "x$x_includes" = "x"; then
232   x_includes="/usr/include"
233 fi
234
235 saved_cflags="$CFLAGS"
236 saved_ldflags="$LDFLAGS"
237
238 CFLAGS="$CFLAGS $X_CFLAGS"
239 LDFLAGS="$LDFLAGS $X_LDFLAGS $X_LIBS"
240
241 if test "x$no_x" = "xyes"; then 
242   AC_MSG_ERROR([
243 *** X libraries or include files not found. Check 'config.log' for 
244 *** more details.])
245 fi
246
247 # Checks for libraries.
248 # Check for the X11 library
249 AC_CHECK_LIB(X11, XOpenDisplay, x_libs="-lX11 $X_EXTRA_LIBS", 
250   AC_MSG_ERROR([*** libX11 not found. Check 'config.log' for more details.]),
251   $X_EXTRA_LIBS)
252
253 if test "x$enable_shm" = "xyes"; then
254   # Check for the Xext library (needed for XShm extention)
255   AC_CHECK_LIB(Xext, XShmAttach, 
256       x_libs="-lXext $x_libs", 
257       # On AIX, it is in XextSam instead, but we still need -lXext
258       AC_CHECK_LIB(XextSam, XShmAttach, 
259           x_libs="-lXextSam -lXext $x_libs", 
260           no_xext_lib=yes, $x_libs),
261       $x_libs)
262 fi
263
264 # Check for shaped window extension
265
266 AC_CHECK_LIB(Xext, XShapeCombineMask,
267       if test -z "`echo $x_libs | grep "\-lXext" 2> /dev/null`"; then
268            x_libs="-lXext $x_libs"
269       fi
270       AC_DEFINE(HAVE_SHAPE_EXT),
271       ,
272       $x_libs)
273
274 # Check for XConvertCase (X11R6 specific)
275
276 AC_CHECK_LIB(X11, XConvertCase,
277       AC_DEFINE(HAVE_XCONVERTCASE),
278       ,
279       $x_libs)
280
281 # Check for XIM support.
282
283 AC_CHECK_LIB(X11, XUnregisterIMInstantiateCallback,
284             : ,
285             enable_xim=no,
286             $x_libs)
287
288 if test "x$enable_xim" = "xyes"; then
289   GTK_XIM_FLAGS="-DUSE_XIM"
290 fi
291
292 x_cflags="$X_CFLAGS"
293 x_ldflags="$X_LDFLAGS $X_LIBS"
294
295 # set up things for XInput
296
297 if test "x$with_xinput" = "xgxi" || test "x$with_xinput" = "xyes"; then
298   AC_DEFINE(XINPUT_GXI)
299   xinput_progs=gxid
300   x_libs="-lXi $x_libs"
301 elif test "x$with_xinput" = "xxfree"; then
302   AC_DEFINE(XINPUT_XFREE)
303   x_libs="-lXi $x_libs"
304 else
305   AC_DEFINE(XINPUT_NONE)
306 fi
307
308 CFLAGS="$saved_cflags"
309 LDFLAGS="$saved_ldflags"
310
311 AC_SUBST(x_cflags)
312 AC_SUBST(x_includes)
313 AC_SUBST(x_ldflags)
314 AC_SUBST(x_libs)
315 AC_SUBST(xinput_progs)
316
317 if test "x$enable_shm" = "xyes"; then
318   # Check for shared memory
319   AC_CHECK_HEADER(sys/ipc.h, AC_DEFINE(HAVE_IPC_H), no_sys_ipc=yes)
320   AC_CHECK_HEADER(sys/shm.h, AC_DEFINE(HAVE_SHM_H), no_sys_shm=yes)
321
322   # Check for the X shared memory extension header file
323   AC_MSG_CHECKING(X11/extensions/XShm.h)
324   if test "x$no_xext_lib" = "xyes"; then
325     AC_MSG_RESULT(no)
326     no_xshm=yes
327   else
328     if test -f "$x_includes/X11/extensions/XShm.h"; then
329       AC_MSG_RESULT(yes)
330       AC_DEFINE(HAVE_XSHM_H)
331     else
332       AC_MSG_RESULT(no)
333       no_xshm=yes
334     fi
335   fi
336 fi
337
338 # Check if X_LOCALE definition is necessary
339
340 AC_MSG_CHECKING(need -DX_LOCALE)
341
342 AC_TRY_RUN([
343 #include <stdio.h>
344 #include <locale.h>
345
346 int
347 main ()
348 {
349   return setlocale (LC_ALL, "${with_locale}") == NULL;
350 }],
351 need_x_locale=no,
352 need_x_locale=yes)
353 AC_MSG_RESULT($need_x_locale)
354
355 if test $need_x_locale = yes; then
356   GTK_LOCALE_CFLAGS="-DX_LOCALE"
357 fi
358
359 # Checks for header files.
360 AC_HEADER_STDC
361
362 # Checks for typedefs, structures, and compiler characteristics.
363 AC_C_CONST
364
365 # Checks for library functions.
366 AC_TYPE_SIGNAL
367 AC_FUNC_MMAP
368
369 # Check if <sys/select.h> needs to be included for fd_set
370 AC_MSG_CHECKING([for fd_set])
371 AC_TRY_COMPILE([#include <sys/types.h>],
372         [fd_set readMask, writeMask;], gtk_ok=yes, gtk_ok=no)
373 if test $gtk_ok = yes; then
374     AC_MSG_RESULT([yes, found in sys/types.h])
375 else
376     AC_HEADER_EGREP(fd_mask, sys/select.h, gtk_ok=yes)
377     if test $gtk_ok = yes; then
378         AC_DEFINE(HAVE_SYS_SELECT_H)
379         AC_MSG_RESULT([yes, found in sys/select.h])
380     else
381         AC_DEFINE(NO_FD_SET)
382         AC_MSG_RESULT(no)
383     fi
384 fi
385
386 # Duplicate `widechar' tests from `glib'.
387 # Check for wchar.h
388 if test x = y; then
389   # will not be executed
390   # hack so as not to update `acconfig.h'
391   AC_CHECK_HEADERS(wchar.h wctype.h)
392   AC_CHECK_FUNCS(broken_wctype)
393 fi
394
395 AC_MSG_CHECKING(for wchar.h)
396 AC_TRY_CPP([#include <wchar.h>], gtk_ok=yes, gtk_ok=no)
397 if test $gtk_ok = yes; then
398    ac_kludge=HAVE_WCHAR_H
399    AC_DEFINE($ac_kludge)
400 fi
401 AC_MSG_RESULT($gtk_ok)
402
403 # Check for wctype.h (for iswalnum)
404
405 AC_MSG_CHECKING(for wctype.h)
406 AC_TRY_CPP([#include <wctype.h>], gtk_ok=yes, gtk_ok=no)
407 if test $gtk_ok = yes; then
408    ac_kludge=HAVE_WCTYPE_H
409    AC_DEFINE($ac_kludge)
410 fi
411 AC_MSG_RESULT($gtk_ok)
412
413 # in Solaris 2.5, `iswalnum' is in -lw
414 GDK_WLIBS=
415 AC_CHECK_FUNC(iswalnum,,[AC_CHECK_LIB(w,iswalnum,GDK_WLIBS=-lw)])
416
417 # The following is necessary for Linux libc-5.4.38
418 oLIBS="$LIBS"
419 LIBS="$LIBS $GDK_WLIBS"
420 AC_MSG_CHECKING(if iswalnum() and friends are properly defined)
421 AC_TRY_LINK([#include <stdlib.h>],[
422 #if (defined(HAVE_WCTYPE_H) || defined(HAVE_WCHAR_H))
423 #  ifdef HAVE_WCTYPE_H
424 #    include <wctype.h>
425 #  else
426 #    ifdef HAVE_WCHAR_H
427 #      include <wchar.h>
428 #    endif
429 #  endif
430 #else
431 #  define iswalnum(c) ((wchar_t)(c) <= 0xFF && isalnum(c))
432 #endif
433 iswalnum((wchar_t) 0);
434 ], gtk_ok=yes, gtk_ok=no)
435 LIBS="$oLIBS"
436
437 if test $gtk_ok = no; then
438    ac_kludge=HAVE_BROKEN_WCTYPE
439    AC_DEFINE($ac_kludge)
440    GDK_WLIBS=
441 fi
442 AC_MSG_RESULT($gtk_ok)
443 AC_SUBST(GDK_WLIBS)
444
445 AC_SUBST(GTK_DEBUG_FLAGS)
446 AC_SUBST(GTK_XIM_FLAGS)
447 AC_SUBST(GTK_LOCALE_FLAGS)
448 AC_SUBST(GTK_THREAD_FLAGS)
449
450 AC_OUTPUT([
451 Makefile
452 gtk-config
453 intl/Makefile
454 po/Makefile.in
455 docs/Makefile
456 gdk/Makefile
457 gtk/Makefile
458 gtk/gtkfeatures.h
459 ], [chmod +x gtk-config])