aboutsummaryrefslogtreecommitdiffstats
path: root/macros/xerces.m4
blob: bea87e2669a9efb4029f5ff79af96ed060db3e10 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
dnl - Determine where and which version of xerces is installed on the system
dnl - Author: Andrew Chatham

AC_DEFUN([AC_CHECK_XERCES],[
    has_xerces=false

    CFLAGS=${CFLAGS--O}

    AC_ARG_WITH(xerces,
      [  --with-xerces=dir       Specify the Xerces directory],[
      if test x$withval != x; then
        XERCES_INCLUDE_DIR="$withval/include"
        XERCES_LIB_DIR=$withval/lib
      fi
    ])

    AC_MSG_CHECKING(for xerces)
    if test x$XERCES_INCLUDE_DIR = x; then
        if test x$XERCESCROOT = x; then
            if test "x$prefix" != "xNONE"; then
                        XERCESCROOT="$prefix"
                    fi
        fi
        XERCES_INCLUDE_DIR=$XERCESCROOT/include
    fi

    if test x$XERCES_LIB_DIR = x; then
        XERCES_LIB_DIR=$XERCESCROOT/lib
    fi

    XERCES_VER=`ls $XERCES_LIB_DIR/libxerces*.so | 
            perl $srcdir/macros/xerces-version.pl`

    if test "x$XERCES_VER" = "x0_0"; then
        AC_MSG_ERROR("You must have Xerces installed and set XERCESCROOT or use --with-xerces")
    else
        AC_MSG_RESULT(found)
    fi

    XERCES_LIBNAME=xerces-c
    XERCES_LIBRARY_NAMES=-l${XERCES_LIBNAME}${XERCES_VER}
    XERCES_LIBRARY_SEARCH_PATHS=-L${XERCES_LIB_DIR}
    XERCES_INCLUDE=-I${XERCES_INCLUDE_DIR}

    AC_SUBST(XERCES_LIBRARY_NAMES)
    AC_SUBST(XERCES_LIBNAME)
    AC_SUBST(XERCES_INCLUDE)
    AC_SUBST(XERCES_INCLUDE_DIR)
    AC_SUBST(XERCES_VER)
    AC_SUBST(XERCES_LIBRARY_SEARCH_PATHS)

    if test -f "${XERCES_INCLUDE_DIR}/util/XMLUniDefs.hpp"; then
        AC_DEFINE(HAVE_XMLUNIDEFS)
    fi
])