1 # libcroco.m4 serial 2 (gettext-0.17)
2 dnl Copyright (C) 2006 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
9 AC_DEFUN([gl_LIBCROCO],
11 dnl libcroco depends on libglib.
12 AC_REQUIRE([gl_LIBGLIB])
14 AC_MSG_CHECKING([whether included libcroco is requested])
15 AC_ARG_WITH([included-libcroco],
16 [ --with-included-libcroco use the libcroco included here],
17 [gl_cv_libcroco_force_included=$withval],
18 [gl_cv_libcroco_force_included=no])
19 AC_MSG_RESULT([$gl_cv_libcroco_force_included])
21 gl_cv_libcroco_use_included="$gl_cv_libcroco_force_included"
25 if test "$gl_cv_libcroco_use_included" != yes; then
26 dnl Figure out whether we can use a preinstalled libcroco-0.6, or have to
27 dnl use the included one.
28 AC_CACHE_VAL([gl_cv_libcroco], [
34 dnl Search for libcroco and define LIBCROCO_0_6, LTLIBCROCO_0_6 and
35 dnl INCCROCO_0_6 accordingly.
36 dnl Don't use croco-0.6-config nor pkg-config, since it doesn't work when
37 dnl cross-compiling or when the C compiler in use is different from the
38 dnl one that built the library.
39 AC_LIB_LINKFLAGS_BODY([croco-0.6], [glib-2.0])
40 LIBS="$gl_save_LIBS $LIBCROCO_0_6"
41 AC_TRY_LINK([#include <libcroco-config.h>],
42 [const char *version = LIBCROCO_VERSION; return !version;],
44 gl_cv_LIBCROCO="$LIBCROCO_0_6"
45 gl_cv_LTLIBCROCO="$LTLIBCROCO_0_6"
47 if test "$gl_cv_libcroco" != yes; then
48 gl_save_CPPFLAGS="$CPPFLAGS"
49 CPPFLAGS="$CPPFLAGS $INCCROCO_0_6"
50 AC_TRY_LINK([#include <libcroco-config.h>],
51 [const char *version = LIBCROCO_VERSION; return !version;],
53 gl_cv_LIBCROCO="$LIBCROCO_0_6"
54 gl_cv_LTLIBCROCO="$LTLIBCROCO_0_6"
55 gl_cv_INCCROCO="$INCCROCO_0_6"
57 if test "$gl_cv_libcroco" != yes; then
58 dnl Often the include files are installed in
59 dnl /usr/include/libcroco-0.6/libcroco.
60 AC_TRY_LINK([#include <libcroco-0.6/libcroco/libcroco-config.h>],
61 [const char *version = LIBCROCO_VERSION; return !version;],
62 [gl_ABSOLUTE_HEADER([libcroco-0.6/libcroco/libcroco-config.h])
63 libcroco_include_dir=`echo "$gl_cv_absolute_libcroco_0_6_libcroco_libcroco_config_h" | sed -e 's,.libcroco-config\.h$,,'`
64 if test -d "$libcroco_include_dir"; then
66 gl_cv_LIBCROCO="$LIBCROCO_0_6"
67 gl_cv_LTLIBCROCO="$LTLIBCROCO_0_6"
68 gl_cv_INCCROCO="-I$libcroco_include_dir"
72 CPPFLAGS="$gl_save_CPPFLAGS"
76 AC_MSG_CHECKING([for libcroco])
77 AC_MSG_RESULT([$gl_cv_libcroco])
78 if test $gl_cv_libcroco = yes; then
79 LIBCROCO="$gl_cv_LIBCROCO"
80 LTLIBCROCO="$gl_cv_LTLIBCROCO"
81 INCCROCO="$gl_cv_INCCROCO"
83 gl_cv_libcroco_use_included=yes
87 AC_SUBST([LTLIBCROCO])
89 AC_MSG_CHECKING([whether to use the included libcroco])
90 AC_MSG_RESULT([$gl_cv_libcroco_use_included])
92 AM_CONDITIONAL([INCLUDED_LIBCROCO],
93 [test "$gl_cv_libcroco_use_included" = yes])