Fix a google version number change
[viking/guyou.git] / acinclude.m4
blob7c41102d6cd5b97fe1559890147beaa155cf10f4
1 dnl Expat macro retrived on the Expat CVS
3 dnl Check if --with-expat[=PREFIX] is specified and
4 dnl Expat >= 1.95.0 is installed in the system.
5 dnl If yes, substitute EXPAT_CFLAGS, EXPAT_LIBS with regard to
6 dnl the specified PREFIX and set with_expat to PREFIX, or 'yes' if PREFIX
7 dnl has not been specified. Also HAVE_LIBEXPAT, HAVE_EXPAT_H are defined.
8 dnl If --with-expat has not been specified, set with_expat to 'no'.
9 dnl In addition, an Automake conditional EXPAT_INSTALLED is set accordingly.
10 dnl This is necessary to adapt a whole lot of packages that have expat
11 dnl bundled as a static library.
12 AC_DEFUN(AM_WITH_EXPAT,
13 [ AC_ARG_WITH(expat,
14               [  --with-expat=PREFIX     Use system Expat library],
15               , with_expat=yes)
17   AM_CONDITIONAL(EXPAT_INSTALLED, test $with_expat != no)
19   EXPAT_CFLAGS=
20   EXPAT_LIBS=
21   if test $with_expat != no; then
22         if test $with_expat != yes; then
23                 EXPAT_CFLAGS="-I$with_expat/include"
24                 EXPAT_LIBS="-L$with_expat/lib"
25         fi
26         AC_CHECK_LIB(expat, XML_ParserCreate,
27                      [ EXPAT_LIBS="$EXPAT_LIBS -lexpat"
28                        expat_found=yes ],
29                      [ expat_found=no ],
30                      "$EXPAT_LIBS")
31         if test $expat_found = no; then
32                 AC_MSG_ERROR([Could not find the Expat library])
33         fi
34         expat_save_CFLAGS="$CFLAGS"
35         CFLAGS="$CFLAGS $EXPAT_CFLAGS"
36         AC_CHECK_HEADERS(expat.h, , expat_found=no)
37         if test $expat_found = no; then
38                 AC_MSG_ERROR([Could not find expat.h])
39         fi
40         CFLAGS="$expat_save_CFLAGS"
41   fi
43   AC_SUBST(EXPAT_CFLAGS)
44   AC_SUBST(EXPAT_LIBS)