File: llnl_libxml.m4

package info (click to toggle)
babel 0.10.2-1
  • links: PTS
  • area: contrib
  • in suites: sarge
  • size: 43,932 kB
  • ctags: 29,707
  • sloc: java: 74,695; ansic: 73,142; cpp: 40,649; sh: 18,411; f90: 10,062; fortran: 6,727; python: 6,406; makefile: 3,866; xml: 118; perl: 48
file content (74 lines) | stat: -rw-r--r-- 2,172 bytes parent folder | download
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# LLNL_FIND_LIBXML
#
#
AC_DEFUN([VERSION_TO_NUMBER],
[`$1 | sed -e 's/libxml //' | awk 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}'`])

AC_DEFUN([LLNL_LIBXML_CONFIG],
[LIBXML_REQUIRED_VERSION=2.4.0

 AC_ARG_WITH([libxml2],
	[AS_HELP_STRING(--with-libxml2@<:@=DIR@:>@,use libxml2 in @<:@DIR@:>@ (YES if found))],,[withval=maybe])

dnl if the user explicitly asked for no libxml2 (Babel requires it)
if test "$withval" != "no"; then
    dnl find xml2-config program
    XML2_CONFIG="no"
    if test "$withval" != "yes" && test "$withval" != "maybe" ; then
	XML2_CONFIG_PATH="$withval/bin"
	AC_PATH_PROG(XML2_CONFIG, xml2-config,"no", $XML2_CONFIG_PATH)
    else
	XML2_CONFIG_PATH=$PATH
	AC_PATH_PROG(XML2_CONFIG, xml2-config,"no", $XML2_CONFIG_PATH)
    fi

    dnl we can't do anything without xml2-config
    if test "$XML2_CONFIG" = "no"; then
	withval="no"
    else
	withval=`$XML2_CONFIG --prefix`
    fi

    dnl if withval still maybe then we have failed
    if test "$withval" = "maybe"; then
	withval="no"
    fi
fi

if test "$withval" = "no"; then
    XML2_CONFIG="no"
    AC_MSG_WARN(You need libxml2 $LIBXML_REQUIRED_VERSION (or later) for dynamic loading support in Babel)
else
    AC_SUBST(LIBXML_REQUIRED_VERSION)
    AC_MSG_CHECKING(for libxml libraries >= $LIBXML_REQUIRED_VERSION)


   dnl
   dnl test version and init our variables
   dnl

   vers=VERSION_TO_NUMBER([$XML2_CONFIG --version])
   XML2_VERSION=`$XML2_CONFIG --version`

   if test "$vers" -ge VERSION_TO_NUMBER([echo $LIBXML_REQUIRED_VERSION]); then
	AC_MSG_RESULT(found version $XML2_VERSION)
	if $XML2_CONFIG --libtool-libs | grep "^Usage:" 2>&1 > /dev/null; then
	    LIBXML2_LIB="`$XML2_CONFIG --libs`"
	else
	    LIBXML2_LIB="`$XML2_CONFIG --libtool-libs`"
	fi
	
	LIBXML2_CFLAGS="`$XML2_CONFIG --cflags`"
	AC_DEFINE(HAVE_LIBXML2,[1],[Libxml2 support included])
	AC_DEFINE_UNQUOTED(LIBXML2_VERSION, $vers, [Version of libxml2 installed])

	AC_SUBST(LIBXML2_LIB)
        AC_SUBST(LIBXML2_CFLAGS)
   else
	AC_MSG_WARN(You need libxml2 $LIBXML_REQUIRED_VERSION (or later) for dynamic loading support in Babel)
	XML2_CONFIG="no"
	unset XML2_VERSION
   fi

fi
])