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