source: trunk/third/gtk2/configure.in @ 18785

Revision 18785, 45.0 KB checked in by ghudson, 21 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r18784, which included commits to RCS files with non-trunk default branches.
Line 
1# require autoconf 2.52
2AC_PREREQ(2.52)
3
4# Process this file with autoconf to produce a configure script.
5AC_INIT(gdk/gdktypes.h)
6
7#
8# For each of the libraries we build, we define the following
9# substituted variables:
10#
11# foo_PACKAGES:     pkg-config packages this library requires
12# foo_EXTRA_LIBS:   Libraries this module requires not pulled in by pkg-config
13# foo_EXTRA_CFLAGS: cflags this module requires not pulled in by pkg-config
14# foo_DEP_LIBS:     All libraries this module requires
15# foo_DEP_CFLAGS:   All cflags this module requires
16
17
18# Save this value here, since automake will set cflags later
19cflags_set=${CFLAGS+set}
20
21dnl we to AC_DIVERT_PUSH/AC_DIVERT_POP these variable definitions so they
22dnl are available for $ac_help expansion (don't we all *love* autoconf?)
23GLIB_AC_DIVERT_BEFORE_HELP([
24#
25# Making releases:
26#   GTK_MICRO_VERSION += 1;
27#   GTK_INTERFACE_AGE += 1;
28#   GTK_BINARY_AGE += 1;
29# if any functions have been added, set GTK_INTERFACE_AGE to 0.
30# if backwards compatibility has been broken,
31# set GTK_BINARY_AGE and GTK_INTERFACE_AGE to 0.
32#
33GTK_MAJOR_VERSION=2
34GTK_MINOR_VERSION=2
35GTK_MICRO_VERSION=1
36GTK_INTERFACE_AGE=1
37GTK_BINARY_AGE=201
38GTK_VERSION=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION.$GTK_MICRO_VERSION
39dnl This is the X.Y used in -lgtk-FOO-X.Y
40GTK_API_VERSION=2.0
41])dnl
42
43AC_SUBST(GTK_MAJOR_VERSION)
44AC_SUBST(GTK_MINOR_VERSION)
45AC_SUBST(GTK_MICRO_VERSION)
46AC_SUBST(GTK_INTERFACE_AGE)
47AC_SUBST(GTK_BINARY_AGE)
48AC_SUBST(GTK_API_VERSION)
49AC_SUBST(GTK_VERSION)
50
51# libtool versioning
52#LT_RELEASE=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION
53#LT_CURRENT=`expr $GTK_MICRO_VERSION - $GTK_INTERFACE_AGE`
54#LT_REVISION=$GTK_INTERFACE_AGE
55#LT_AGE=`expr $GTK_BINARY_AGE - $GTK_INTERFACE_AGE`
56#LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
57
58LT_RELEASE=$GTK_MAJOR_VERSION.0
59LT_CURRENT=`expr 100 '*' $GTK_MINOR_VERSION + $GTK_MICRO_VERSION - $GTK_INTERFACE_AGE`
60LT_REVISION=$GTK_INTERFACE_AGE
61LT_AGE=`expr $GTK_BINARY_AGE - $GTK_INTERFACE_AGE`
62LT_CURRENT_MINUS_AGE=`expr $LT_CURRENT - $LT_AGE`
63AC_SUBST(LT_RELEASE)
64AC_SUBST(LT_CURRENT)
65AC_SUBST(LT_REVISION)
66AC_SUBST(LT_AGE)
67AC_SUBST(LT_CURRENT_MINUS_AGE)
68
69# Define a string for the earliest version that this release has
70# forward/backwards binary compatibility with. This is used for module
71# locations. (Should this be backwards-compat instead?)
72#
73#GTK_BINARY_VERSION=$GTK_MAJOR_VERSION.$GTK_MINOR_VERSION.$LT_CURRENT
74GTK_BINARY_VERSION=2.2.0
75AC_SUBST(GTK_BINARY_VERSION)
76
77#
78# gdk-pixbuf gets versioned separately, and for now, using standard
79# libtool versioning, not GTK+-style versioning
80#
81GDK_PIXBUF_MAJOR=$GTK_MAJOR_VERSION
82GDK_PIXBUF_MINOR=$GTK_MINOR_VERSION
83GDK_PIXBUF_MICRO=$GTK_MICRO_VERSION
84GDK_PIXBUF_VERSION="${GDK_PIXBUF_MAJOR}.${GDK_PIXBUF_MINOR}.${GDK_PIXBUF_MICRO}"
85AC_SUBST(GDK_PIXBUF_MAJOR)
86AC_SUBST(GDK_PIXBUF_MINOR)
87AC_SUBST(GDK_PIXBUF_MICRO)
88AC_SUBST(GDK_PIXBUF_VERSION)
89
90## Versions of dependencies
91GLIB_REQUIRED_VERSION=2.1.4
92PANGO_REQUIRED_VERSION=1.0.1
93ATK_REQUIRED_VERSION=1.0.1
94
95# For automake.
96VERSION=$GTK_VERSION
97PACKAGE=gtk+
98
99GETTEXT_PACKAGE=gtk20
100AC_SUBST(GETTEXT_PACKAGE)
101AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE")
102
103# Save this value here, since automake will set cflags later
104cflags_set=${CFLAGS+set}
105
106dnl Initialize automake stuff
107AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
108
109# Specify a configuration file
110AM_CONFIG_HEADER(config.h)
111
112dnl Initialize libtool
113AC_PROG_CC
114AM_DISABLE_STATIC
115AC_LIBTOOL_WIN32_DLL
116AM_PROG_LIBTOOL
117
118dnl XXXX Hack: Set AS and ASFLAGS so that automake 1.5 will be happy
119AS="\${CC}"
120ASFLAGS="\${CFLAGS}"
121AC_SUBST(AS)
122AC_SUBST(ASFLAGS)
123dnl XXXX Hack: Set CCAS and CCASFLAGS so that automake 1.6 will be happy
124CCAS="\${CC}"
125CCASFLAGS="\${CFLAGS}"
126AC_SUBST(CCAS)
127AC_SUBST(CCASFLAGS)
128
129dnl Initialize maintainer mode
130AM_MAINTAINER_MODE
131
132AC_CANONICAL_HOST
133
134AC_MSG_CHECKING([for some Win32 platform])
135case "$host" in
136  *-*-mingw*|*-*-cygwin*)
137    platform_win32=yes
138    ;;
139  *)
140    platform_win32=no
141    ;;
142esac
143AC_MSG_RESULT([$platform_win32])
144AM_CONDITIONAL(PLATFORM_WIN32, test "$platform_win32" = "yes")
145
146MATH_LIB=-lm
147AC_MSG_CHECKING([for native Win32])
148case "$host" in
149  *-*-mingw*)
150    os_win32=yes
151    MATH_LIB=
152    ;;
153  *)
154    os_win32=no
155    ;;
156esac
157AC_MSG_RESULT([$os_win32])
158AM_CONDITIONAL(OS_WIN32, test "$os_win32" = "yes")
159
160if test "$os_win32" = "yes"; then
161  AC_CHECK_PROG(ms_librarian, lib.exe, yes, no)
162fi
163AM_CONDITIONAL(MS_LIB_AVAILABLE, test x$ms_librarian = xyes)
164
165dnl figure debugging default, prior to $ac_help setup
166dnl
167GLIB_AC_DIVERT_BEFORE_HELP([
168if test `expr $GTK_MINOR_VERSION \% 2` = 1 ; then
169        debug_default=yes
170else
171        debug_default=minimum
172fi
173])dnl
174
175dnl declare --enable-* args and collect ac_help strings
176AC_ARG_ENABLE(debug, [  --enable-debug=[no/minimum/yes] turn on debugging [default=$debug_default]],,enable_debug=$debug_default)
177AC_ARG_ENABLE(shm, [  --enable-shm            support shared memory if available [default=yes]],
178                   echo $enable_shm, enable_shm="yes")
179AC_ARG_ENABLE(ansi, [  --enable-ansi           turn on strict ansi [default=no]],
180                    , enable_ansi=no)
181AC_ARG_ENABLE(xim, [  --enable-xim            support XIM [default=yes]],
182                        , enable_xim="yes")
183AC_ARG_ENABLE(xkb, [  --enable-xkb            support XKB [default=maybe]],
184                        , enable_xkb="maybe")
185AC_ARG_ENABLE(rebuilds, [  --disable-rebuilds      disable all source autogeneration rules],,enable_rebuilds=yes)
186
187AC_ARG_WITH(xinput, [  --with-xinput=[no/yes]  support XInput ])
188
189AC_ARG_WITH(wintab, [  --with-wintab=DIRECTORY use Wintab API with win32 backend])
190AC_ARG_WITH(ie55, [  --with-ie55=DIRECTORY IE5.5 libs and headers (for Active IMM)])
191
192GLIB_AC_DIVERT_BEFORE_HELP([
193if test "$platform_win32" = yes; then
194  gdktarget=win32
195else
196  gdktarget=x11
197fi
198])
199
200AC_ARG_WITH(gdktarget, [  --with-gdktarget=[[x11/linux-fb/win32]] select GDK target [default=$gdktarget]],
201        gdktarget=$with_gdktarget)
202
203AC_SUBST(gdktarget)
204case $gdktarget in
205  x11|linux-fb|win32) ;;
206  *) AC_MSG_ERROR([Invalid target for GDK: use x11, linux-fb or win32.]);;
207esac
208
209gdktargetlib=libgdk-$gdktarget-$GTK_API_VERSION.la
210gtktargetlib=libgtk-$gdktarget-$GTK_API_VERSION.la
211
212AC_SUBST(gdktargetlib)
213AC_SUBST(gtktargetlib)
214
215AC_ARG_ENABLE(shadowfb, [  --disable-shadowfb      disable shadowfb support for linux-fb],,enable_shadowfb=yes)
216
217AC_ARG_ENABLE(fbmanager, [  --enable-fbmanager      enable framebuffer manager support (GtkFB)],enable_fbmanager=yes,enable_fbmanager=no)
218       
219if test "x$enable_debug" = "xyes"; then
220  test "$cflags_set" = set || CFLAGS="$CFLAGS -g"
221  GTK_DEBUG_FLAGS="-DG_ENABLE_DEBUG"
222else
223  if test "x$enable_debug" = "xno"; then
224    GTK_DEBUG_FLAGS="-DG_DISABLE_ASSERT -DG_DISABLE_CHECKS -DG_DISABLE_CAST_CHECKS"
225  else
226    GTK_DEBUG_FLAGS="-DG_DISABLE_CAST_CHECKS"
227  fi
228fi
229
230AC_DEFINE_UNQUOTED(GTK_COMPILED_WITH_DEBUGGING, "${enable_debug}")
231
232                       
233# Build time sanity check...
234AM_SANITY_CHECK
235
236# Checks for programs.
237AC_ISC_POSIX
238AM_PROG_CC_STDC
239AC_PROG_INSTALL
240AC_PROG_MAKE_SET
241
242changequote(,)dnl
243if test "x$GCC" = "xyes"; then
244  case " $CFLAGS " in
245  *[\ \ ]-Wall[\ \      ]*) ;;
246  *) CFLAGS="$CFLAGS -Wall" ;;
247  esac
248
249  if test "x$enable_ansi" = "xyes"; then
250    case " $CFLAGS " in
251    *[\ \       ]-ansi[\ \      ]*) ;;
252    *) CFLAGS="$CFLAGS -ansi" ;;
253    esac
254
255    case " $CFLAGS " in
256    *[\ \       ]-pedantic[\ \  ]*) ;;
257    *) CFLAGS="$CFLAGS -pedantic" ;;
258    esac
259  fi
260fi
261changequote([,])dnl
262
263# Ensure MSVC-compatible struct packing convention is used when
264# compiling for Win32 with gcc.
265# What flag to depends on gcc version: gcc3 uses "-mms-bitfields", while
266# gcc2 uses "-fnative-struct".
267if test x"$os_win32" = xyes; then
268  if test x"$GCC" = xyes; then
269    msnative_struct=''
270    AC_MSG_CHECKING([how to get MSVC-compatible struct packing])
271    if test -z "$ac_cv_prog_CC"; then
272      our_gcc="$CC"
273    else
274      our_gcc="$ac_cv_prog_CC"
275    fi
276    case `$our_gcc --version | sed -e 's,\..*,.,' -e q` in
277      2.)
278        if $our_gcc -v --help 2>/dev/null | grep fnative-struct >/dev/null; then
279          msnative_struct='-fnative-struct'
280        fi
281        ;;
282      *)
283        if $our_gcc -v --help 2>/dev/null | grep ms-bitfields >/dev/null; then
284          msnative_struct='-mms-bitfields'
285        fi
286        ;;
287    esac
288    if test x"$msnative_struct" = x ; then
289      AC_MSG_RESULT([no way])
290      AC_MSG_WARN([produced libraries might be incompatible with MSVC-compiled code])
291    else
292      CFLAGS="$CFLAGS $msnative_struct"
293      AC_MSG_RESULT([${msnative_struct}])
294    fi
295  fi
296fi
297
298# Honor aclocal flags
299ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
300
301## Initial sanity check, done here so that users get told they
302## have the wrong dependencies as early in the process as possible.
303## Later on we actually use the cflags/libs from separate pkg-config
304## calls. Oh, also the later pkg-config calls don't include
305## the version requirements since those make the module lists
306## annoying to construct
307PKG_CHECK_MODULES(BASE_DEPENDENCIES, glib-2.0 >= $GLIB_REQUIRED_VERSION atk >= $ATK_REQUIRED_VERSION pango >= $PANGO_REQUIRED_VERSION)
308
309if test "$os_win32" != yes; then
310    # libtool option to control which symbols are exported
311    # right now, symbols starting with _ are not exported
312    LIBTOOL_EXPORT_OPTIONS='-export-symbols-regex "^[[^_]].*"'
313else
314    # We currently use .def files on Windows (for gdk-pixbuf, gdk and gtk)
315    LIBTOOL_EXPORT_OPTIONS=
316fi
317AC_SUBST(LIBTOOL_EXPORT_OPTIONS)
318
319dnl ******************************************************
320dnl * See whether to include shared library dependencies *
321dnl ******************************************************
322
323AC_ARG_ENABLE(explicit-deps,
324              [  --enable-explicit-deps=[yes/no/auto]    use explicit dependencies in .pc files [default=auto]],
325              enable_explicit_deps="$enableval",
326              enable_explicit_deps=auto)
327
328AC_MSG_CHECKING([Whether to write dependencies into .pc files])
329case $enable_explicit_deps in
330  auto)
331    deplib_check_method=`(./libtool --config; echo eval echo \\$deplib_check_method) | sh`
332    if test "X$deplib_check_method" = Xnone || test "x$enable_static" = xyes ; then
333      enable_explicit_deps=yes 
334    else
335      enable_explicit_deps=no 
336    fi
337  ;;
338  yes|no)
339  ;;
340  *) AC_MSG_ERROR([Value given to --enable-explicit-deps must be one of yes, no or auto])
341  ;;
342esac
343AC_MSG_RESULT($enable_explicit_deps)
344
345AM_CONDITIONAL(DISABLE_EXPLICIT_DEPS, test $enable_explicit_deps = no)
346
347# define a MAINT-like variable REBUILD which is set if Perl
348# and awk are found, so autogenerated sources can be rebuilt
349
350AC_PATH_PROGS(PERL, perl5 perl)
351
352# We would like indent, but don't require it.
353AC_CHECK_PROG(INDENT, indent, indent)
354
355REBUILD=\#
356if test "x$enable_rebuilds" = "xyes" && \
357     test -n "$PERL" && \
358     $PERL -e 'exit !($] >= 5.002)' > /dev/null 2>&1 ; then
359  REBUILD=
360fi
361AC_SUBST(REBUILD)
362
363AC_CHECK_FUNCS(lstat mkstemp flockfile)
364
365# sigsetjmp is a macro on some platforms, so AC_CHECK_FUNCS is not reliable
366AC_MSG_CHECKING(for sigsetjmp)
367AC_TRY_LINK([#include <setjmp.h>], [
368sigjmp_buf env;
369sigsetjmp(env, 0);
370], gtk_ok=yes, gtk_ok=no)
371AC_MSG_RESULT($gtk_ok)
372if test "$gtk_ok" = "yes"; then
373  AC_DEFINE(HAVE_SIGSETJMP)
374fi
375
376AC_MSG_CHECKING(whether make is GNU Make)
377STRIP_BEGIN=
378STRIP_END=
379if $ac_make --version 2>/dev/null | grep '^GNU Make ' >/dev/null ; then
380        STRIP_BEGIN='$(strip $(STRIP_DUMMY)'
381        STRIP_END=')'
382        AC_MSG_RESULT(yes)
383else
384        AC_MSG_RESULT(no)
385fi
386STRIP_DUMMY=
387AC_SUBST(STRIP_DUMMY)
388AC_SUBST(STRIP_BEGIN)
389AC_SUBST(STRIP_END)
390
391# i18n stuff
392ALL_LINGUAS="am az be bg ca cs cy da de el en_GB en@IPA es et eu fa fi fr ga gl he hi hr hu ia it ja ko lt lv mk mn ms nl nn no pl pt pt_BR ro ru sk sl sp sr sv ta tr uk vi wa zh_TW zh_CN"
393AM_GLIB_GNU_GETTEXT
394LIBS="$LIBS $INTLLIBS"
395
396AM_GLIB_DEFINE_LOCALEDIR(GTK_LOCALEDIR)
397
398dnl The DU4 header files don't provide library prototypes unless
399dnl -std1 is given to the native cc.
400AC_MSG_CHECKING([for extra flags to get ANSI library prototypes])
401
402gtk_save_LIBS=$LIBS
403LIBS="$LIBS -lm"
404AC_TRY_RUN([#include <math.h>
405             int main (void) { return (log(1) != log(1.)); }],
406     AC_MSG_RESULT(none needed),
407     gtk_save_CFLAGS="$CFLAGS"
408     CFLAGS="$CFLAGS -std1"
409     AC_TRY_RUN([#include <math.h>
410                 int main (void) { return (log(1) != log(1.)); }],
411         AC_MSG_RESULT(-std1),
412         AC_MSG_RESULT()
413         CFLAGS="$gtk_save_CFLAGS"
414         AC_MSG_WARN(
415                [No ANSI prototypes found in library. (-std1 didn't work.)]),
416         true
417     ),
418     AC_MSG_RESULT(none needed)
419)
420LIBS=$gtk_save_LIBS
421
422AC_MSG_CHECKING(for the BeOS)
423case $host in
424  *-*-beos*)
425    AC_MSG_RESULT(yes)
426    MATH_LIB=
427  ;;
428  *)
429    AC_MSG_RESULT(no)
430  ;;
431esac
432
433dnl NeXTStep cc seems to need this
434AC_MSG_CHECKING([for extra flags for POSIX compliance])
435AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
436  AC_MSG_RESULT(none needed),
437  gtk_save_CFLAGS="$CFLAGS"
438  CFLAGS="$CFLAGS -posix"
439  AC_TRY_COMPILE([#include <dirent.h>], [DIR *dir;],
440    AC_MSG_RESULT(-posix),
441    AC_MSG_RESULT()
442    CFLAGS="$gtk_save_CFLAGS"
443    AC_MSG_WARN([Could not determine POSIX flag. (-posix didn't work.)])))
444
445#
446# Run AM_PATH_GLIB_2_0 to make sure that GLib is installed and working
447#
448
449GLIB_PACKAGES="gobject-2.0 gmodule-2.0"
450
451AM_PATH_GLIB_2_0($GLIB_REQUIRED_VERSION, :,
452  AC_MSG_ERROR([
453*** GLIB $GLIB_REQUIRED_VERSION or better is required. The latest version of
454*** GLIB is always available from ftp://ftp.gtk.org/.]),
455  gobject gmodule gthread)
456
457dnl
458dnl Check for bind_textdomain_codeset, including -lintl if GLib brings it in.
459dnl
460gtk_save_LIBS=$LIBS
461LIBS="$LIBS $GLIB_LIBS"
462AC_CHECK_FUNCS(bind_textdomain_codeset)
463LIBS=$gtk_save_LIBS
464
465AC_CHECK_HEADERS(pwd.h, AC_DEFINE(HAVE_PWD_H))
466AC_CHECK_HEADERS(sys/time.h, AC_DEFINE(HAVE_SYS_TIME_H))
467AC_CHECK_HEADERS(unistd.h, AC_DEFINE(HAVE_UNISTD_H))
468
469if test "${with_ie55+set}" = set && test $with_ie55 != no; then
470  AC_MSG_CHECKING([for dimm.h])
471  saved_CFLAGS="$CFLAGS"
472  CFLAGS="$CFLAGS -idirafter $with_ie55/Include"
473  AC_TRY_COMPILE([/* The w32api imm.h clashes a bit with the IE5.5 dimm.h */
474#ifdef __GNUC__
475#define IMEMENUITEMINFOA hidden_IMEMENUITEMINFOA
476#define IMEMENUITEMINFOW hidden_IMEMENUITEMINFOW
477#endif
478#include <windows.h>
479#include <objbase.h>
480#include <imm.h>
481#ifdef __GNUC__
482#undef IMEMENUITEMINFOA
483#undef IMEMENUITEMINFOW
484#endif
485#include <dimm.h>
486],
487   [],
488   [AC_MSG_RESULT(yes)
489    AC_MSG_CHECKING([for IE55 uuid.lib])
490    if test -f $with_ie55/Lib/uuid.lib ; then
491      AC_MSG_RESULT(yes)
492      have_ie55=yes
493      AC_DEFINE(HAVE_DIMM_H)
494      IE55_UUID_LIB="$with_ie55/Lib/uuid.lib"
495      AC_SUBST(IE55_UUID_LIB)
496    else
497      AC_MSG_RESULT(no)
498      CFLAGS="$saved_CFLAGS"
499      have_ie55=no
500    fi
501    ],
502   [AC_MSG_RESULT(no)
503    CFLAGS="$saved_CFLAGS"
504    have_ie55=no])
505fi
506AM_CONDITIONAL(HAVE_IE55, test x$have_ie55 = xyes)
507
508if test "${with_wintab+set}" = set && test $with_wintab != no; then
509  AC_MSG_CHECKING([for wintab.h])
510  saved_CFLAGS="$CFLAGS"
511  CFLAGS="$CFLAGS -I$with_wintab/include"
512  AC_TRY_COMPILE([#include <windows.h>
513#include <wintab.h>],
514   [],
515   [AC_MSG_RESULT(yes)
516    AC_MSG_CHECKING([for wntab32x.lib])
517    if test -f $with_wintab/lib/i386/wntab32x.lib ; then
518      AC_MSG_RESULT(yes)
519      have_wintab=yes
520      AC_DEFINE(HAVE_WINTAB)
521      WINTAB_LIB="$with_wintab/lib/i386/wntab32x.lib"
522      AC_SUBST(WINTAB_LIB)
523    else
524      AC_MSG_RESULT(no)
525      CFLAGS="$saved_cflags"
526      have_wintab=no
527    fi
528    ],
529   [AC_MSG_RESULT(no)
530    CFLAGS="$saved_cflags"
531    have_wintab=no])
532fi
533AM_CONDITIONAL(HAVE_WINTAB, test x$have_wintab = xyes)
534
535saved_cflags="$CFLAGS"
536saved_ldflags="$LDFLAGS"
537
538
539# Checks for header files.
540AC_HEADER_STDC
541
542# Checks for typedefs, structures, and compiler characteristics.
543AC_C_CONST
544
545# Checks for library functions.
546AC_TYPE_SIGNAL
547AC_FUNC_MMAP
548
549AC_CHECK_FUNCS(getresuid)
550AC_TYPE_UID_T
551
552# Check if <sys/select.h> needs to be included for fd_set
553AC_MSG_CHECKING([for fd_set])
554AC_TRY_COMPILE([#include <sys/types.h>],
555        [fd_set readMask, writeMask;], gtk_ok=yes, gtk_ok=no)
556if test $gtk_ok = yes; then
557    AC_MSG_RESULT([yes, found in sys/types.h])
558else
559    AC_HEADER_EGREP(fd_mask, sys/select.h, gtk_ok=yes)
560    if test $gtk_ok = yes; then
561        AC_DEFINE(HAVE_SYS_SELECT_H)
562        AC_MSG_RESULT([yes, found in sys/select.h])
563    else
564        AC_DEFINE(NO_FD_SET)
565        AC_MSG_RESULT(no)
566    fi
567fi
568
569# `widechar' tests for gdki18n.h
570AC_MSG_CHECKING(for wchar.h)
571AC_TRY_CPP([#include <wchar.h>], gdk_wchar_h=yes, gdk_wchar_h=no)
572if test $gdk_wchar_h = yes; then
573   AC_DEFINE(HAVE_WCHAR_H,1,[Have wchar.h include file])
574fi
575AC_MSG_RESULT($gdk_wchar_h)
576
577# Check for wctype.h (for iswalnum)
578AC_MSG_CHECKING(for wctype.h)
579AC_TRY_CPP([#include <wctype.h>], gdk_wctype_h=yes, gdk_wctype_h=no)
580if test $gdk_wctype_h = yes; then
581   AC_DEFINE(HAVE_WCTYPE_H,1,[Have wctype.h include file])
582fi
583AC_MSG_RESULT($gdk_wctype_h)
584
585# in Solaris 2.5, `iswalnum' is in -lw
586GDK_WLIBS=
587AC_CHECK_FUNC(iswalnum,,[AC_CHECK_LIB(w,iswalnum,GDK_WLIBS=-lw)])
588
589oLIBS="$LIBS"
590LIBS="$LIBS $GDK_WLIBS"
591# The following is necessary for Linux libc-5.4.38
592AC_MSG_CHECKING(if iswalnum() and friends are properly defined)
593AC_TRY_LINK([#include <stdlib.h>],[
594#if (defined(HAVE_WCTYPE_H) || defined(HAVE_WCHAR_H))
595#  ifdef HAVE_WCTYPE_H
596#    include <wctype.h>
597#  else
598#    ifdef HAVE_WCHAR_H
599#      include <wchar.h>
600#    endif
601#  endif
602#else
603#  define iswalnum(c) ((wchar_t)(c) <= 0xFF && isalnum(c))
604#endif
605iswalnum((wchar_t) 0);
606], gdk_working_wctype=yes, gdk_working_wctype=no)
607LIBS="$oLIBS"
608
609if test $gdk_working_wctype = no; then
610   AC_DEFINE(HAVE_BROKEN_WCTYPE,1,[Is the wctype implementation broken])
611   GDK_WLIBS=
612fi
613AC_MSG_RESULT($gdk_working_wctype)
614AC_SUBST(GDK_WLIBS)
615
616
617##################################################
618# Checks for gdk-pixbuf
619##################################################
620
621dnl ********************************************************
622dnl * See whether we need to load our modules as .la files *
623dnl ********************************************************
624
625use_la_modules=false
626case $host in
627  *-aix*) use_la_modules=true
628esac
629
630if $use_la_modules ; then
631   AC_DEFINE(USE_LA_MODULES, 1, [Whether to load modules via .la files rather than directly])
632fi
633
634
635AC_MSG_CHECKING(whether to build gmodulized gdk-pixbuf)
636
637AC_ARG_ENABLE(modules, [  --disable-modules       disable dynamic module loading])
638
639dynworks=false
640deps=
641if test x$enable_modules = xno; then
642    AC_MSG_RESULT(no)
643else
644    AC_MSG_RESULT(yes)
645    AC_MSG_CHECKING(whether dynamic modules work)
646    ## for loop is to strip newline
647    tmp=`$PKG_CONFIG --variable=gmodule_supported gmodule-2.0`
648    for I in $tmp; do
649        dynworks=$I
650    done
651
652    dnl Now we check to see if our libtool supports shared lib deps
653    dnl (in a rather ugly way even)
654    if $dynworks; then
655        pixbuf_libtool_config="${CONFIG_SHELL-/bin/sh} ./libtool --config"
656        pixbuf_deplibs_check=`$pixbuf_libtool_config | \
657            grep '^[[a-z_]]*check[[a-z_]]*_method=[['\''"]]' | \
658            sed 's/.*[['\''"]]\(.*\)[['\''"]]$/\1/'`
659        if test "x$pixbuf_deplibs_check" = "xnone" || \
660           test "x$pixbuf_deplibs_check" = "xunknown" || \
661           test "x$pixbuf_deplibs_check" = "x"; then
662            dynworks=false
663        fi
664    fi
665
666    if $dynworks; then
667        AC_DEFINE(USE_GMODULE)
668        AC_MSG_RESULT(yes)
669    else
670        AC_MSG_RESULT(no)
671    fi
672fi
673
674dnl We allow people to disable image loaders explicitely, but if they don't we error
675dnl out so that people don't accidentally build without them.
676
677AC_ARG_WITH(libpng,  [  --without-libpng          disable PNG loader for gdk-pixbuf])
678AC_ARG_WITH(libjpeg, [  --without-libjpeg         disable JPEG loader for gdk-pixbuf])
679AC_ARG_WITH(libtiff, [  --without-libtiff         disable TIFF loader for gdk-pixbuf])
680
681dnl Test for libtiff
682  if test x$with_libtiff != xno && test -z "$LIBTIFF"; then
683    AC_CHECK_LIB(tiff, TIFFReadScanline,
684      [AC_CHECK_HEADER(tiffio.h,
685        TIFF='tiff'; LIBTIFF='-ltiff',
686        AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))],
687      [AC_CHECK_LIB(tiff, TIFFWriteScanline,
688        [AC_CHECK_HEADER(tiffio.h,
689          TIFF='tiff'; LIBTIFF='-ltiff -ljpeg -lz',
690          AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))],
691        [AC_CHECK_LIB(tiff34, TIFFFlushData,
692          [AC_CHECK_HEADER(tiffio.h,
693            TIFF='tiff'; LIBTIFF='-ltiff34 -ljpeg -lz',
694            AC_MSG_WARN(*** TIFF loader will not be built (TIFF header files not found) ***))],
695        AC_MSG_WARN(*** TIFF plug-in will not be built (TIFF library not found) ***), -ljpeg -lz -lm)], -ljpeg -lz -lm)], -lm)
696  fi
697
698  if test x$with_libtiff != xno && test -z "$LIBTIFF"; then
699     AC_MSG_ERROR([
700*** Checks for TIFF loader failed. You can build without it by passing
701*** --without-libtiff to configure but some programs using GTK+ may
702*** not work properly])
703  fi
704
705dnl Test for libjpeg
706  if test x$with_libjpeg != xno && test -z "$LIBJPEG"; then
707    AC_CHECK_LIB(jpeg, jpeg_destroy_decompress,
708      jpeg_ok=yes,
709      jpeg_ok=no
710      AC_MSG_WARN(*** JPEG loader will not be built (JPEG library not found) ***))
711    if test "$jpeg_ok" = yes; then
712      AC_MSG_CHECKING([for jpeglib.h])
713      AC_TRY_CPP(
714[#include <stdio.h>
715#undef PACKAGE
716#undef VERSION
717#undef HAVE_STDLIB_H
718#include <jpeglib.h>],
719        jpeg_ok=yes,
720        jpeg_ok=no)
721      AC_MSG_RESULT($jpeg_ok)
722      if test "$jpeg_ok" = yes; then
723        LIBJPEG='-ljpeg'
724        AC_CHECK_LIB(jpeg, jpeg_simple_progression,     
725          AC_DEFINE(HAVE_PROGRESSIVE_JPEG),
726          AC_MSG_WARN(JPEG library does not support progressive saving.))
727      else
728          AC_MSG_WARN(*** JPEG loader will not be built (JPEG header file not found) ***)
729      fi
730    fi
731  fi
732
733  if test x$with_libjpeg != xno && test -z "$LIBJPEG"; then
734     AC_MSG_ERROR([
735*** Checks for JPEG loader failed. You can build without it by passing
736*** --without-libjpeg to configure but some programs using GTK+ may
737*** not work properly])
738  fi
739
740dnl Test for libpng
741  if test x$with_libpng != xno && test -z "$LIBPNG"; then
742    AC_MSG_CHECKING(for libpng12)
743    if $PKG_CONFIG --exists libpng12 ; then
744        AC_MSG_RESULT(yes)
745        PNG='png'
746        PNG_DEP_CFLAGS_PACKAGES=libpng12
747        LIBPNG=`$PKG_CONFIG --libs libpng12`
748    else
749      AC_MSG_RESULT(no)
750      AC_CHECK_LIB(png, png_read_info,
751        [AC_CHECK_HEADER(png.h,
752          png_ok=yes,
753          png_ok=no)],
754        AC_MSG_WARN(*** PNG loader will not be built (PNG library not found) ***), -lz -lm)
755      if test "$png_ok" = yes; then
756        AC_MSG_CHECKING([for png_structp in png.h])
757        AC_TRY_COMPILE([#include <png.h>],
758          [png_structp pp; png_infop info; png_colorp cmap; png_create_read_struct;],
759          png_ok=yes,
760          png_ok=no)
761        AC_MSG_RESULT($png_ok)
762        if test "$png_ok" = yes; then
763          PNG='png'; LIBPNG='-lpng -lz'
764        else
765          AC_MSG_WARN(*** PNG loader will not be built (PNG library is too old) ***)
766        fi
767      else
768       AC_MSG_WARN(*** PNG loader will not be built (PNG header file not found) ***)
769      fi
770    fi
771  fi
772
773  if test x$with_libpng != xno && test -z "$LIBPNG"; then
774     AC_MSG_ERROR([
775*** Checks for PNG loader failed. You can build without it by passing
776*** --without-libpng to configure but many programs using GTK+ will
777*** not work properly. The PNG loader is also needed if you are compiling
778*** from CVS.])
779  fi
780
781  REBUILD_PNGS=\#
782  if test -z "$LIBPNG"; then
783     REBUILD_PNGS=
784  fi
785  AC_SUBST(REBUILD_PNGS)
786
787AC_SUBST(LIBTIFF)
788AC_SUBST(LIBJPEG)
789AC_SUBST(LIBPNG)
790
791AM_CONDITIONAL(BUILD_DYNAMIC_MODULES, $dynworks)
792
793#
794# Allow building some or all gdk-pixbuf loaders included
795#
796AC_MSG_CHECKING(pixbuf loaders to build)
797
798AC_ARG_WITH(included_loaders, [  --with-included-loaders=LOADER1,LOADER2,...  build the specified loaders into gdk-pixbuf (only used if module loading disabled)])
799
800if $dynworks; then
801        :
802else
803   ## if the option was specified, leave it; otherwise disable included loaders
804   if test x$with_included_loaders = xno; then
805           with_included_loaders=yes
806   fi
807fi
808
809all_loaders="png,bmp,wbmp,gif,ico,ani,jpeg,pnm,ras,tiff,xpm,tga"
810included_loaders=""
811# If no loaders specified, include all
812if test "x$with_included_loaders" = xyes ; then
813  included_loaders="$all_loaders"
814else
815  included_loaders="$with_included_loaders"
816fi
817
818AC_MSG_RESULT($included_loaders)
819
820INCLUDED_LOADER_OBJ=
821INCLUDED_LOADER_DEFINE=
822
823IFS="${IFS=     }"; gtk_save_ifs="$IFS"; IFS=","
824for loader in $included_loaders; do
825 if echo "$all_loaders" | egrep "(^|,)$loader(\$|,)" > /dev/null; then
826   :
827 else
828   AC_MSG_ERROR([the specified loader $loader does not exist])
829 fi
830
831 INCLUDED_LOADER_OBJ="$INCLUDED_LOADER_OBJ libpixbufloader-static-$loader.la"
832 INCLUDED_LOADER_DEFINE="$INCLUDED_LOADER_DEFINE -DINCLUDE_$loader"
833done
834IFS="$gtk_save_ifs"
835AC_SUBST(INCLUDED_LOADER_OBJ)
836AC_SUBST(INCLUDED_LOADER_DEFINE)
837
838AC_HEADER_SYS_WAIT
839
840AC_TYPE_SIGNAL
841
842AM_CONDITIONAL(HAVE_TIFF, test "x$LIBTIFF" != x)
843AM_CONDITIONAL(HAVE_PNG, test "x$LIBPNG" != x)
844AM_CONDITIONAL(HAVE_JPEG, test "x$LIBJPEG" != x)
845
846if $dynworks ; then
847  STATIC_LIB_DEPS=
848  if echo "$included_loaders" | egrep '(^|,)tiff($|,)' > /dev/null; then
849    STATIC_LIB_DEPS="$STATIC_LIB_DEPS $LIBTIFF"
850  fi
851  if echo "$included_loaders" | egrep '(^|,)jpeg($|,)' > /dev/null; then
852    STATIC_LIB_DEPS="$STATIC_LIB_DEPS $LIBJPEG"
853  fi
854  if echo "$included_loaders" | egrep '(^|,)png($|,)' > /dev/null; then
855    STATIC_LIB_DEPS="$STATIC_LIB_DEPS $LIBPNG"
856  fi
857else
858  STATIC_LIB_DEPS="$LIBTIFF $LIBJPEG $LIBPNG"
859fi
860
861# Checks to see if we should compile in MMX support (there will be
862# a runtime test when the code is actually run to see if it should
863# be used - this just checks if we can compile it.)
864#
865# This code is partially taken from Mesa
866#
867AC_MSG_CHECKING(for x86 platform)
868case $host_cpu in
869  i386|i486|i586|i686|i786|k6|k7)
870        use_x86_asm=yes
871        ;;
872   *)
873        use_x86_asm=no
874esac
875AC_MSG_RESULT($use_x86_asm)
876
877use_mmx_asm=no
878if test $use_x86_asm = yes; then
879    save_ac_ext=$ac_ext
880    ac_ext=S
881   
882    AC_MSG_CHECKING(compiler support for MMX)
883    cp $srcdir/gdk-pixbuf/pixops/scale_line_22_33_mmx.S conftest.S
884    if AC_TRY_EVAL(ac_compile); then
885        use_mmx_asm=yes
886    fi
887
888    rm -rf conftest*
889
890    ac_ext=$save_ac_ext
891    if test $use_mmx_asm = yes; then
892      AC_DEFINE(USE_MMX)
893      AC_MSG_RESULT(yes)
894    else
895      AC_MSG_RESULT(no)
896    fi
897fi
898
899AM_CONDITIONAL(USE_MMX, test x$use_mmx_asm = xyes)
900
901dnl Look for a host system's gdk-pixbuf-csource if we are cross-compiling
902
903AM_CONDITIONAL(CROSS_COMPILING, test $cross_compiling = yes)
904
905if test $cross_compiling = yes; then
906  AC_PATH_PROG(GDK_PIXBUF_CSOURCE, gdk-pixbuf-csource, no)
907  if test x$GDK_PIXBUF_CSOURCE = xno; then
908    AC_MSG_ERROR(Could not find a gdk-pixbuf-csource in your PATH)
909  fi
910fi
911
912GDK_PIXBUF_PACKAGES="gmodule-2.0 gobject-2.0"
913GDK_PIXBUF_EXTRA_LIBS="$STATIC_LIB_DEPS $MATH_LIB"
914GDK_PIXBUF_EXTRA_CFLAGS=
915GDK_PIXBUF_DEP_LIBS="`$PKG_CONFIG --libs $GDK_PIXBUF_PACKAGES` $GDK_PIXBUF_EXTRA_LIBS"
916GDK_PIXBUF_DEP_CFLAGS="`$PKG_CONFIG --cflags  gthread-2.0 $GDK_PIXBUF_PACKAGES $PNG_DEP_CFLAGS_PACKAGES` $GDK_PIXBUF_EXTRA_CFLAGS"
917
918AC_SUBST(GDK_PIXBUF_PACKAGES)
919AC_SUBST(GDK_PIXBUF_EXTRA_LIBS)
920AC_SUBST(GDK_PIXBUF_EXTRA_CFLAGS)
921AC_SUBST(GDK_PIXBUF_DEP_LIBS)
922AC_SUBST(GDK_PIXBUF_DEP_CFLAGS)
923
924
925########################################
926# Windowing system checks
927########################################
928
929GDK_EXTRA_LIBS=$GDK_WLIBS
930GDK_EXTRA_CFLAGS=
931
932FREETYPE_LIBS=
933FREETYPE_CFLAGS=
934if test "x$gdktarget" = "xlinux-fb" || test "x$gdktarget" = "xx11" ; then
935  #
936  # Checks for FreeType
937  #
938  have_freetype=false
939  AC_PATH_PROG(FREETYPE_CONFIG, freetype-config, no)
940  if test "x$FREETYPE_CONFIG" != "xno" ; then
941    FREETYPE_CFLAGS=`$FREETYPE_CONFIG --cflags`
942    FREETYPE_LIBS=`$FREETYPE_CONFIG --libs`
943
944    gtk_save_LIBS="$LIBS"
945    LIBS="$FREETYPE_LIBS $LIBS"
946    AC_TRY_LINK_FUNC(FT_New_Face, have_freetype=true,:)
947    LIBS="$gtk_save_LIBS"
948
949    if $have_freetype ; then
950      gtk_save_cppflags="$CPPFLAGS"
951      CPPFLAGS="$CPPFLAGS $FREETYPE_CFLAGS"
952
953      AC_MSG_CHECKING([For sufficiently new FreeType (at least 2.0.1)])
954      AC_TRY_COMPILE([
955#include <freetype/freetype.h>
956#include FT_ERRORS_H
957    ],
958                     [(void)1;],:,have_freetype=false)
959      if $have_freetype ; then
960        AC_MSG_RESULT(yes)
961      else
962        AC_MSG_RESULT(no)
963      fi
964
965      CPPFLAGS="$gtk_save_cppflags"
966    fi
967  fi
968  AC_SUBST(FREETYPE_LIBS)
969  AC_SUBST(FREETYPE_CFLAGS)
970fi
971
972if test "x$gdktarget" = "xx11"; then
973  # We start off with the libraries from Pango
974
975  if $PKG_CONFIG --exists pangox ; then : ; else
976    AC_MSG_ERROR([pangox Pango backend is required for x11 target])
977  fi
978   
979  ## be sure we also have Pango built with xft support
980  if $PKG_CONFIG --exists pangoxft ; then
981    PANGO_PACKAGES="pangoxft pangox"
982    have_xft=true
983    AC_DEFINE(HAVE_XFT)
984    if $have_freetype ; then
985      :
986    else
987      AC_MSG_ERROR([pangoxft Pango backend found but did not find freetype libraries])
988    fi
989  else
990    PANGO_PACKAGES="pangox"
991    have_xft=false
992  fi
993
994  AM_CONDITIONAL(HAVE_XFT, $have_xft)
995
996  if $PKG_CONFIG --exists xft ; then
997    AC_DEFINE(HAVE_XFT2, 1, [Define if we have Xft, version 2])
998  fi
999
1000  #
1001  # If Pango included the shared library dependencies from X11 in
1002  # the pkg-config output, then we use that (to avoid duplicates).
1003  # but if they were omitted to avoid binary compatibility problems
1004  # then we need to repeat the checks.
1005  #
1006  x_libs="`$PKG_CONFIG --libs $PANGO_PACKAGES`"
1007  case "$x_libs" in
1008    *-lX11*) pango_omitted_x_deps=no ;;
1009    *)       pango_omitted_x_deps=yes ;;
1010  esac
1011
1012  x_cflags="`$PKG_CONFIG --cflags $PANGO_PACKAGES`"
1013  x_extra_libs=
1014
1015  if test $pango_omitted_x_deps = yes ; then
1016    AC_PATH_XTRA
1017
1018    if test x$no_x = xyes ; then
1019      AC_MSG_ERROR([X development libraries not found])
1020    fi
1021
1022    x_libs="$X_LIBS -lX11 $X_EXTRA_LIBS"
1023
1024    #
1025    # Checks for Xft/XRender
1026    #
1027    if test $have_xft = true ; then
1028      have_xft=false
1029
1030      if pkg-config --exists pangoxft '>=' 1.1.0 ; then
1031        x_libs="`pkg-config --libs xft` -lX11 $FREETYPE_LIBS $X_EXTRA_LIBS"
1032        have_xft=true
1033      else
1034        gtk_save_cppflags="$CPPFLAGS"
1035        CPPFLAGS="$CPPFLAGS $x_cflags"
1036     
1037        AC_CHECK_LIB(Xrender, XRenderFindFormat,
1038          [AC_CHECK_LIB(Xft, XftFontOpen,
1039            [AC_CHECK_HEADER(X11/Xft/XftFreetype.h,
1040              have_xft=true,:)],
1041            :,-lXrender -lXext $x_libs $FREETYPE_LIBS)]
1042          ,:,-lXext $x_libs)
1043         
1044        if $have_xft ; then
1045          x_libs="$X_LIBS -lXft -lXrender -lXext -lX11 $FREETYPE_LIBS $X_EXTRA_LIBS"
1046        fi
1047
1048        CPPFLAGS="$gtk_save_cppflags"
1049      fi
1050
1051      if $have_xft ; then
1052        :
1053      else
1054        AC_MSG_ERROR([pangoxft Pango backend found, but Xft not found])
1055      fi
1056    fi
1057  fi           
1058
1059  ## Strip the .la files
1060 
1061  x_libs_for_checks=""
1062  for I in $x_libs ; do
1063    case $I in
1064      *.la) ;;
1065      *) x_libs_for_checks="$x_libs_for_checks $I" ;;
1066    esac
1067  done
1068
1069  # Sanity check for the X11 library
1070  AC_CHECK_LIB(X11, XOpenDisplay, :,
1071            AC_MSG_ERROR([*** libX11 not found. Check 'config.log' for more details.]),
1072            $x_libs_for_checks)
1073
1074  if test "x$enable_shm" = "xyes"; then
1075    # Check for the Xext library (needed for XShm extention)
1076    AC_CHECK_LIB(Xext, XShmAttach,
1077        if test -z "`echo $x_libs | grep "\-lXext" 2> /dev/null`"; then
1078          x_extra_libs="-lXext"
1079        fi,
1080        # On AIX, it is in XextSam instead, but we still need -lXext
1081        AC_CHECK_LIB(XextSam, XShmAttach,
1082            if test -z "`echo $x_libs | grep "\-lXext" 2> /dev/null`"; then
1083               x_extra_libs="-lXextSam -lXext"
1084            else
1085               x_extra_libs="-lXextSam"
1086            fi, , $x_libs_for_checks),
1087        $x_libs_for_checks)
1088  fi
1089
1090  GDK_PIXBUF_XLIB_EXTRA_CFLAGS="$x_cflags"
1091  # Don't ever pull in the pangoxft libraries for gdk-pixbuf-x11
1092  GDK_PIXBUF_XLIB_EXTRA_LIBS="$x_extra_libs $x_libs"
1093
1094  # Check for Xinerama extension (Solaris impl or Xfree impl)
1095
1096  gtk_save_cppflags="$CPPFLAGS"
1097  CPPFLAGS="$CPPFLAGS $x_cflags"
1098
1099  case "$host" in
1100      *-*-solaris*)
1101          # Check for solaris
1102          use_solaris_xinerama=yes
1103          AC_CHECK_LIB(Xext, XineramaGetInfo,
1104                        use_solaris_xinerama=yes, use_solaris_xinerama=no)
1105          if test "x$use_solaris_xinerama" = "xyes"; then
1106              AC_CHECK_HEADER(X11/extensions/xinerama.h,
1107                if test -z "`echo $x_extra_libs $x_libs | grep "\-lXext" 2> /dev/null`"; then
1108                    x_extra_libs="-lXext $x_extra_libs"
1109                fi
1110                AC_DEFINE(HAVE_SOLARIS_XINERAMA)
1111                AC_DEFINE(HAVE_XINERAMA), use_solaris_xinerama=no, -lXext $x_libs_for_checks)
1112          fi   
1113          AC_MSG_CHECKING(for Xinerama support on Solaris)
1114          AC_MSG_RESULT($use_solaris_xinerama);
1115          ;;
1116      *)
1117          # Check for XFree
1118          use_xfree_xinerama=yes
1119          AC_CHECK_LIB(Xinerama, XineramaQueryExtension,
1120              [AC_CHECK_HEADER(X11/extensions/Xinerama.h,
1121                  x_extra_libs="-lXinerama $x_extra_libs"   
1122                  if test -z "`echo $x_extra_libs $x_libs | grep "\-lXext" 2> /dev/null`"; then
1123                      x_extra_libs="-lXext $x_extra_libs"
1124                  fi
1125                  AC_DEFINE(HAVE_XFREE_XINERAMA)
1126                  AC_DEFINE(HAVE_XINERAMA),
1127                  use_xfree_xinerama=no,
1128                  [#include <X11/Xlib.h>])],
1129              use_xfree_xinerama=no, -lXext $x_libs_for_checks)
1130          AC_MSG_CHECKING(for Xinerama support on XFree86)
1131          AC_MSG_RESULT($use_xfree_xinerama);       
1132          ;;
1133  esac
1134
1135  CPPFLAGS="$gtk_save_cppflags"
1136
1137  # Check for shaped window extension
1138
1139  AC_CHECK_LIB(Xext, XShapeCombineMask,
1140      if test -z "`echo $x_extra_libs $x_libs | grep "\-lXext" 2> /dev/null`"; then
1141           x_extra_libs="-lXext $x_extra_libs"
1142      fi
1143      AC_DEFINE(HAVE_SHAPE_EXT),
1144      ,
1145      $x_libs_for_checks)
1146
1147  # Check for XConvertCase (X11R6 specific)
1148
1149  AC_CHECK_LIB(X11, XConvertCase,
1150      AC_DEFINE(HAVE_XCONVERTCASE),
1151      ,
1152      $x_libs_for_checks)
1153
1154  # Check for XIM support.
1155
1156  if test "x$enable_xim" = "xyes"; then
1157    GTK_XIM_FLAGS="-DUSE_XIM"
1158  fi
1159
1160  # Check for XKB support.
1161
1162  if test "x$enable_xkb" = "xyes"; then
1163        AC_MSG_WARN(XKB support explicitly enabled)
1164        AC_DEFINE(HAVE_XKB)
1165  elif test "x$enable_xkb" = "xmaybe"; then
1166        AC_CHECK_LIB(X11, XkbQueryExtension,
1167                     AC_DEFINE(HAVE_XKB),
1168                     ,
1169                     $x_libs_for_checks)
1170  else
1171        AC_MSG_WARN(XKB support explicitly disabled)
1172  fi
1173
1174  x_cflags="$X_CFLAGS"
1175  x_ldflags="$X_LDFLAGS"
1176
1177  # set up things for XInput
1178
1179  if test "x$with_xinput" = "xxfree" || test "x$with_xinput" = "xyes"; then
1180    AC_DEFINE(XINPUT_XFREE)
1181    x_extra_libs="-lXi $x_extra_libs"
1182  else
1183    AC_DEFINE(XINPUT_NONE)
1184  fi
1185
1186  AM_CONDITIONAL(XINPUT_XFREE, test x$with_xinput = xxfree || test x$with_xinput = xyes)
1187
1188  # Check for the RANDR extension
1189
1190  AC_CHECK_LIB(Xrandr, XRRUpdateConfiguration,
1191      [AC_CHECK_HEADER(X11/extensions/Xrandr.h,
1192          # RANDR requires RENDER
1193          if test -z "`echo $x_extra_libs $x_libs | grep "\-lXrender" 2> /dev/null`"; then
1194              x_extra_libs="-lXrender $x_extra_libs"
1195          fi
1196          x_extra_libs="-lXrandr $x_extra_libs"
1197          AC_DEFINE(HAVE_RANDR, 1, Have the Xrandr extension library),
1198          :, [#include <X11/Xlib.h>])], : ,
1199       $X_LIBS -lXrandr -lXrender -lX11 $X_EXTRA_LIBS)
1200
1201  # Xshm checks
1202
1203  if test "x$enable_shm" = "xyes"; then
1204    # Check for shared memory
1205    AC_CHECK_HEADER(sys/ipc.h, AC_DEFINE(HAVE_IPC_H), no_sys_ipc=yes)
1206    AC_CHECK_HEADER(sys/shm.h, AC_DEFINE(HAVE_SHM_H), no_sys_shm=yes)
1207
1208    # Check for the X shared memory extension header file
1209    have_xshm=no
1210    AC_MSG_CHECKING(X11/extensions/XShm.h)
1211    if test "x$no_xext_lib" = "xyes"; then
1212      :
1213    else
1214      gtk_save_CFLAGS="$CFLAGS"
1215      CFLAGS="$CFLAGS $x_cflags"
1216      AC_TRY_COMPILE([
1217#include <stdlib.h>
1218#include <sys/types.h>
1219#include <sys/ipc.h>
1220#include <sys/shm.h>
1221#include <X11/Xlib.h>
1222#include <X11/Xutil.h>
1223#include <X11/extensions/XShm.h>
1224], [XShmSegmentInfo *x_shm_info;], have_xshm=yes)
1225      CFLAGS="$gtk_save_CFLAGS"
1226    fi
1227    AC_MSG_RESULT($have_xshm)
1228    if test $have_xshm = yes ; then
1229      AC_DEFINE(HAVE_XSHM_H)
1230    fi
1231  fi
1232
1233  GDK_EXTRA_CFLAGS=
1234  if test $pango_omitted_x_deps = yes ; then
1235    GDK_EXTRA_LIBS="$x_extra_libs $x_libs $GDK_EXTRA_LIBS"
1236  else
1237    GDK_EXTRA_LIBS="$x_extra_libs $GDK_EXTRA_LIBS"
1238  fi
1239
1240  AM_CONDITIONAL(USE_X11, true)
1241else
1242  AM_CONDITIONAL(HAVE_XFT, false)
1243  AM_CONDITIONAL(XINPUT_XFREE, false)
1244  AM_CONDITIONAL(USE_X11, false)
1245fi
1246
1247if test "x$gdktarget" = "xwin32"; then
1248  # We start off with the libraries from Pango
1249
1250  ## be sure we also have Pango built with win32 support
1251  PANGO_PACKAGES="pangowin32"
1252
1253  if test x$have_wintab = xyes; then
1254    GDK_WIN32_EXTRA_CFLAGS="-I $with_wintab/include"
1255    AC_SUBST(GDK_WIN32_EXTRA_CFLAGS)
1256  fi
1257
1258  GDK_EXTRA_LIBS="$GDK_EXTRA_LIBS -lgdi32 -user32 -limm32 -lshell32 -lole32 -luuid"
1259  AM_CONDITIONAL(USE_WIN32, true)
1260else
1261  AM_CONDITIONAL(USE_WIN32, false)
1262fi
1263
1264AC_SUBST(xinput_progs)
1265
1266GDK_PIXBUF_XLIB_PACKAGES=
1267GDK_PIXBUF_XLIB_DEP_LIBS="`$PKG_CONFIG --libs $GDK_PIXBUF_PACKAGES $GDK_PIXBUF_XLIB_PACKAGES` $GDK_PIXBUF_XLIB_EXTRA_LIBS $GDK_PIXBUF_EXTRA_LIBS"
1268GDK_PIXBUF_XLIB_DEP_CFLAGS="`$PKG_CONFIG --cflags  gthread-2.0 $GDK_PIXBUF_PACKAGES $GDK_PIXBUF_XLIB_PACKAGES` $GDK_PIXBUF_EXTRA_CFLAGS $GDK_PIXBUF_XLIB_EXTRA_CFLAGS"
1269
1270AC_SUBST(GDK_PIXBUF_XLIB_PACKAGES)
1271AC_SUBST(GDK_PIXBUF_XLIB_EXTRA_LIBS)
1272AC_SUBST(GDK_PIXBUF_XLIB_EXTRA_CFLAGS)
1273AC_SUBST(GDK_PIXBUF_XLIB_DEP_LIBS)
1274AC_SUBST(GDK_PIXBUF_XLIB_DEP_CFLAGS)
1275
1276if test "x$gdktarget" = "xlinux-fb"; then
1277  if $have_freetype ; then
1278    :
1279  else
1280    AC_MSG_ERROR([Using linux-fb backend but freetype was not found])
1281  fi
1282
1283  ft2_libs="`$PKG_CONFIG --libs pangoft2`"
1284  case "$ft2_libs" in
1285    *-lfreetype*) pango_omitted_ft2_deps=no ;;
1286    *)            pango_omitted_ft2_deps=yes ;;
1287  esac
1288
1289  CFLAGS="$CFLAGS $FREETYPE_CFLAGS"
1290
1291  if test x$enable_shadowfb = xyes ; then
1292    AC_DEFINE(ENABLE_SHADOW_FB)
1293  fi
1294
1295  if test x$enable_fbmanager = xyes ; then
1296    AC_DEFINE(ENABLE_FB_MANAGER)
1297    AM_CONDITIONAL(ENABLE_FB_MANAGER, true)
1298  else
1299    AM_CONDITIONAL(ENABLE_FB_MANAGER, false)
1300  fi
1301 
1302  GDK_EXTRA_CFLAGS=""
1303  if test $pango_omitted_ft2_deps = yes ; then
1304    GDK_EXTRA_LIBS="$FREETYPE_LIBS $GDK_EXTRA_LIBS"
1305  fi
1306
1307  AM_CONDITIONAL(USE_LINUX_FB, true)
1308else
1309  AM_CONDITIONAL(USE_LINUX_FB, false)
1310  AM_CONDITIONAL(ENABLE_FB_MANAGER, false)
1311fi
1312
1313#
1314# Pick correct Pango packages to use
1315#
1316
1317if test "x$gdktarget" = "xx11"; then
1318        if $have_xft = true ; then
1319            PANGO_PACKAGES="pangoxft pangox"
1320        else
1321            PANGO_PACKAGES=pangox
1322        fi
1323elif test "x$gdktarget" = "xwin32"; then
1324        PANGO_PACKAGES=pangowin32
1325elif test "x$gdktarget" = "xlinux-fb"; then
1326        PANGO_PACKAGES=pangoft2
1327else
1328        PANGO_PACKAGES=pango
1329fi
1330
1331# Check for Pango flags
1332
1333AC_MSG_CHECKING(Pango flags)
1334if $PKG_CONFIG --exists $PANGO_PACKAGES ; then
1335        PANGO_CFLAGS=`$PKG_CONFIG --cflags $PANGO_PACKAGES`
1336        PANGO_LIBS=`$PKG_CONFIG --libs $PANGO_PACKAGES`
1337
1338        AC_MSG_RESULT($PANGO_CFLAGS $PANGO_LIBS)
1339else
1340        AC_MSG_ERROR([
1341*** Pango not found. Pango is required to build GTK+.
1342*** See http://www.pango.org for Pango information.
1343*** For the framebuffer target, you will need to build
1344*** Pango with freetype support.
1345])
1346fi
1347
1348CFLAGS="$CFLAGS $PANGO_CFLAGS"
1349
1350if $PKG_CONFIG --uninstalled $PANGO_PACKAGES; then
1351        :
1352else
1353        gtk_save_LIBS="$LIBS"
1354        LIBS="$PANGO_LIBS $LIBS"
1355        AC_TRY_LINK_FUNC(pango_context_new, :, AC_MSG_ERROR([
1356*** Can't link to Pango. Pango is required to build
1357*** GTK+. For more information see http://www.pango.org]))
1358        LIBS="$gtk_save_LIBS"
1359fi
1360
1361CFLAGS="$saved_cflags"
1362LDFLAGS="$saved_ldflags"
1363
1364GDK_PACKAGES=$PANGO_PACKAGES
1365GDK_DEP_LIBS="$GDK_EXTRA_LIBS `$PKG_CONFIG --libs $GDK_PIXBUF_PACKAGES $GDK_PACKAGES` $GDK_PIXBUF_EXTRA_LIBS"
1366GDK_DEP_CFLAGS="`$PKG_CONFIG --cflags  gthread-2.0 $GDK_PIXBUF_PACKAGES $GDK_PACKAGES` $GDK_PIXBUF_EXTRA_CFLAGS $GDK_EXTRA_CFLAGS"
1367
1368#
1369# If we aren't writing explicit dependencies, then don't put the extra libraries we need
1370# into the pkg-config files
1371#
1372if test $enable_explicit_deps != yes ; then
1373  GDK_EXTRA_LIBS=
1374fi
1375
1376AC_SUBST(GDK_PACKAGES)
1377AC_SUBST(GDK_EXTRA_LIBS)
1378AC_SUBST(GDK_EXTRA_CFLAGS)
1379AC_SUBST(GDK_DEP_LIBS)
1380AC_SUBST(GDK_DEP_CFLAGS)
1381
1382
1383########################################
1384# Check for Accessibility Toolkit flags
1385########################################
1386
1387ATK_PACKAGES=atk
1388AC_MSG_CHECKING(ATK flags)
1389if $PKG_CONFIG --exists $ATK_PACKAGES ; then
1390        ATK_CFLAGS=`$PKG_CONFIG --cflags $ATK_PACKAGES`
1391        ATK_LIBS=`$PKG_CONFIG --libs $ATK_PACKAGES`
1392
1393        AC_MSG_RESULT($ATK_CFLAGS $ATK_LIBS)
1394else
1395        AC_MSG_ERROR([
1396*** Accessibility Toolkit not found. Accessibility Toolkit is required
1397*** to build GTK+.
1398])
1399fi
1400
1401if $PKG_CONFIG --uninstalled $ATK_PACKAGES; then
1402        :
1403else
1404        gtk_save_LIBS="$LIBS"
1405        LIBS="$ATK_LIBS $LIBS"
1406        AC_TRY_LINK_FUNC(atk_object_get_type, : , AC_MSG_ERROR([
1407                *** Cannot link to Accessibility Toolkit. Accessibility Toolkit is required
1408                *** to build GTK+]))
1409        LIBS="$gtk_save_LIBS"
1410fi
1411
1412GTK_PACKAGES=atk
1413GTK_EXTRA_LIBS=
1414GTK_EXTRA_CFLAGS=
1415GTK_DEP_LIBS="$GDK_EXTRA_LIBS `$PKG_CONFIG --libs $GDK_PIXBUF_PACKAGES $GDK_PACKAGES $GTK_PACKAGES` $GTK_EXTRA_LIBS $GDK_PIXBUF_EXTRA_LIBS"
1416GTK_DEP_CFLAGS="`$PKG_CONFIG --cflags  gthread-2.0 $GDK_PIXBUF_PACKAGES $GDK_PACKAGES $GTK_PACKAGES` $GDK_PIXBUF_EXTRA_CFLAGS $GDK_EXTRA_CFLAGS $GTK_EXTRA_CFLAGS"
1417
1418AC_SUBST(GTK_PACKAGES)
1419AC_SUBST(GTK_EXTRA_LIBS)
1420AC_SUBST(GTK_EXTRA_CFLAGS)
1421AC_SUBST(GTK_DEP_LIBS)
1422AC_SUBST(GTK_DEP_CFLAGS)
1423
1424
1425AC_SUBST(GTK_DEBUG_FLAGS)
1426AC_SUBST(GTK_XIM_FLAGS)
1427
1428##################################################
1429# Checks for gtk-doc and docbook-tools
1430##################################################
1431
1432AC_ARG_WITH(html-dir, [  --with-html-dir=PATH    path to installed docs ])
1433
1434if test "x$with_html_dir" = "x" ; then
1435  HTML_DIR='${datadir}/gtk-doc/html'
1436else
1437  HTML_DIR=$with_html_dir
1438fi
1439
1440AC_SUBST(HTML_DIR)
1441
1442AC_CHECK_PROG(GTKDOC, gtkdoc-mkdb, true, false)
1443
1444gtk_doc_min_version=0.10
1445if $GTKDOC ; then
1446    gtk_doc_version=`gtkdoc-mkdb --version`
1447    AC_MSG_CHECKING([gtk-doc version ($gtk_doc_version) >= $gtk_doc_min_version])
1448
1449    IFS="${IFS=         }"; gtk_save_IFS="$IFS"; IFS="."
1450    set $gtk_doc_version
1451    for min in $gtk_doc_min_version ; do
1452        cur=$1; shift
1453        if test -z $min ; then break; fi
1454        if test -z $cur ; then GTKDOC=false; break; fi
1455        if test $cur -gt $min ; then break ; fi
1456        if test $cur -lt $min ; then GTKDOC=false; break ; fi
1457    done
1458    IFS="$gtk_save_IFS"
1459
1460    if $GTKDOC ; then
1461      AC_MSG_RESULT(yes)
1462    else
1463      AC_MSG_RESULT(no)
1464    fi
1465fi
1466
1467AC_CHECK_PROG(DB2HTML, db2html, true, false)
1468AM_CONDITIONAL(HAVE_DOCBOOK, $DB2HTML)
1469
1470dnl Make people enable the gtk-doc stuff explicitely.
1471AC_ARG_ENABLE(gtk-doc, [  --enable-gtk-doc        use gtk-doc to build documentation [default=no]], enable_gtk_doc="$enableval", enable_gtk_doc=auto)
1472
1473if test x$enable_gtk_doc = xyes ; then
1474  if test x$GTKDOC != xtrue ; then
1475    enable_gtk_doc=no
1476  fi
1477fi
1478
1479dnl NOTE: We need to use a separate automake conditional for this
1480dnl       to make this work with the tarballs.
1481AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
1482
1483
1484##################################################
1485# Output commands
1486##################################################
1487
1488AC_OUTPUT_COMMANDS([
1489
1490## Generate `gdk/gdkconfig.h' in two cases
1491## 1. `config.status' is run either explicitly, or via configure.
1492##     Esp. not when it is run in `Makefile' to generate makefiles and
1493##     config.h
1494## 2. CONFIG_OTHER is set explicitly
1495##
1496## Case 1 is difficult.  We know that `automake' sets one of
1497## CONFIG_FILES or CONFIG_HEADERS to empty.  This heuristic works
1498## only when AM_CONFIG_HEADER is set, however.
1499
1500if test -n "${CONFIG_FILES}" && test -n "${CONFIG_HEADERS}"; then
1501  # Both CONFIG_FILES and CONFIG_HEADERS are non-empty ==> Case 1
1502  CONFIG_OTHER=${CONFIG_OTHER:-gdk/gdkconfig.h}
1503fi
1504case "$CONFIG_OTHER" in
1505*gdk/gdkconfig.h*)
1506        echo creating gdk/gdkconfig.h
1507        outfile=gdkconfig.h-tmp
1508        cat > $outfile <<\_______EOF
1509/* gdkconfig.h
1510 *
1511 * This is a generated file.  Please modify `configure.in'
1512 */
1513
1514#ifndef GDKCONFIG_H
1515#define GDKCONFIG_H
1516
1517#ifdef __cplusplus
1518extern "C" {
1519#endif /* __cplusplus */
1520
1521_______EOF
1522
1523        cat >>$outfile <<_______EOF
1524$gdk_windowing
1525$gdk_wc
1526_______EOF
1527
1528        cat >>$outfile <<_______EOF
1529
1530#ifdef __cplusplus
1531}
1532#endif /* __cplusplus */
1533
1534#endif /* GDKCONFIG_H */
1535_______EOF
1536
1537
1538        if cmp -s $outfile gdk/gdkconfig.h; then
1539          echo gdk/gdkconfig.h is unchanged
1540          rm -f $outfile
1541        else
1542          mv $outfile gdk/gdkconfig.h
1543        fi ;;
1544esac
1545],[
1546if test "x$gdktarget" = "xx11" ; then
1547  gdk_windowing='
1548#define GDK_WINDOWING_X11'
1549elif test "x$gdktarget" = "xwin32" ; then
1550  gdk_windowing='
1551#define GDK_WINDOWING_WIN32'
1552elif test "x$gdktarget" = "xlinux-fb" ; then
1553  gdk_windowing='
1554#define GDK_WINDOWING_FB
1555#define GDK_NATIVE_WINDOW_POINTER'
1556fi
1557
1558if test x$gdk_wchar_h = xyes; then
1559  gdk_wc='
1560#define GDK_HAVE_WCHAR_H 1'
1561fi
1562if test x$gdk_wctype_h = xyes; then
1563  gdk_wc="\$gdk_wc
1564#define GDK_HAVE_WCTYPE_H 1"
1565fi
1566if test x$gdk_working_wctype = xno; then
1567  gdk_wc="\$gdk_wc
1568#define GDK_HAVE_BROKEN_WCTYPE 1"
1569fi
1570
1571
1572])
1573
1574AC_PATH_PROG(SGML2HTML, sgml2html, no)
1575AM_CONDITIONAL(HAVE_SGML2HTML, test x$SGML2HTML != xno)
1576
1577AC_OUTPUT([
1578config.h.win32
1579gtk-zip.sh
1580Makefile
1581gdk-pixbuf-2.0.pc
1582gdk-2.0.pc
1583gtk+-2.0.pc
1584gdk-pixbuf-2.0-uninstalled.pc
1585gdk-2.0-uninstalled.pc
1586gtk+-2.0-uninstalled.pc
1587m4macros/Makefile
1588po/Makefile.in
1589build/Makefile
1590build/win32/Makefile
1591build/win32/dirent/Makefile
1592demos/Makefile
1593demos/gtk-demo/Makefile
1594demos/gtk-demo/geninclude.pl
1595tests/Makefile
1596docs/Makefile
1597docs/reference/Makefile
1598docs/reference/gdk-pixbuf/Makefile
1599docs/reference/gdk-pixbuf/version.xml
1600docs/reference/gdk/Makefile
1601docs/reference/gdk/version.xml
1602docs/reference/gtk/Makefile
1603docs/reference/gtk/version.xml
1604docs/faq/Makefile
1605docs/tutorial/Makefile
1606gdk-pixbuf/Makefile
1607gdk-pixbuf/gdk_pixbuf.rc
1608gdk-pixbuf/gdk-pixbuf-features.h
1609gdk-pixbuf/pixops/Makefile
1610gdk/Makefile
1611gdk/x11/Makefile
1612gdk/win32/Makefile
1613gdk/win32/rc/Makefile
1614gdk/win32/rc/gdk.rc
1615gdk/linux-fb/Makefile
1616gtk/Makefile
1617gtk/makefile.msc
1618gtk/gtkversion.h
1619gtk/gtk-win32.rc
1620gtk/stock-icons/Makefile
1621gtk/theme-bits/Makefile
1622modules/Makefile
1623modules/input/Makefile
1624contrib/Makefile
1625contrib/gdk-pixbuf-xlib/Makefile
1626contrib/gdk-pixbuf-xlib/gdk-pixbuf-xlib-2.0.pc
1627])
Note: See TracBrowser for help on using the repository browser.