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,
14 [ --with-expat=PREFIX Use system Expat library],
17 AM_CONDITIONAL(EXPAT_INSTALLED, test $with_expat != no)
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"
26 AC_CHECK_LIB(expat, XML_ParserCreate,
27 [ EXPAT_LIBS="$EXPAT_LIBS -lexpat"
31 if test $expat_found = no; then
32 AC_MSG_ERROR([Could not find the Expat library])
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])
40 CFLAGS="$expat_save_CFLAGS"
43 AC_SUBST(EXPAT_CFLAGS)