source: m4/ax_check_xml2.m4 @ 461541a

abac0-leakabac0-meimei-idmei-rt0-nmei_rt0tvf-new-xml
Last change on this file since 461541a was 461541a, checked in by Mei <mei@…>, 11 years ago

1) updated original rt0 to remove libstrongswan dependency

a) identity credential being made/accessed with openssl api calls

(X509/EVP_PKEY pem)

b) attribute credential being made/access via xmlsec1 (custom XML

structure)

2) refactored libcreddy into libabac and now one ABAC namespace for

libabac

3) added attribute_rule suboption to creddy's attribute as another way

to insert access rule

4) added some regression tests into example directory
5) updated some docs.

  • Property mode set to 100644
File size: 3.9 KB
Line 
1# ===========================================================================
2#     ax_check_xml2.m4
3# ===========================================================================
4#
5# SYNOPSIS
6#
7#   AX_CHECK_XML2([action-if-found[, action-if-not-found]])
8#
9# DESCRIPTION
10#
11#   Look for xml2in a number of default spots, or in a user-selected
12#   spot (via --with-xml2).  Sets
13#
14#     XML2_INCLUDES to the include directives required
15#     XML2_LIBS to the -l directives required
16#     XML2_LDFLAGS to the -L or -R flags required
17#
18#   and calls ACTION-IF-FOUND or ACTION-IF-NOT-FOUND appropriately
19#
20#   This macro sets XML2_INCLUDES such that source files should use the
21#   libxml2/ directory in include directives:
22#    ... <libxml/tree.h>
23#
24AU_ALIAS([CHECK_XML2], [AX_CHECK_XML2])
25AC_DEFUN([AX_CHECK_XML2], [
26    found=false
27    AC_ARG_WITH([xml2],
28        [AS_HELP_STRING([--with-xml2=DIR],
29            [root of the XML2 directory])],
30        [
31            case "$withval" in
32            "" | y | ye | yes | n | no)
33            AC_MSG_ERROR([Invalid --with-xml2 value])
34              ;;
35            *) xml2dirs="$withval"
36              ;;
37            esac
38        ], [
39            # if pkg-config is installed and xml2 has installed a .pc file,
40            # then use that information and don't search xml2dirs
41            AC_PATH_PROG([PKG_CONFIG], [pkg-config])
42            if test x"$PKG_CONFIG" != x""; then
43                XML2_LDFLAGS=`$PKG_CONFIG xml2 --libs-only-L 2>/dev/null`
44                if test $? = 0; then
45                    XML2_LIBS=`$PKG_CONFIG xml2 --libs-only-l 2>/dev/null`
46                    XML2_INCLUDES=`$PKG_CONFIG xml2 --cflags-only-I 2>/dev/null`
47#                    found=true
48                fi
49            fi
50
51            # no such luck; use some default xml2dirs
52            if ! $found; then
53                xml2dirs="/usr/local /usr"
54            fi
55        ]
56        )
57
58
59    # XML2 headers have to be in libxml and xml2dir subdirectories
60    # CFLAGS =-g -Wall `xmlsec1-config --cflags --crypto=default` `xml2-config --cflags`
61    # LDFLAGS += `xml2-config --libs` `xmlsec1-config --libs --crypto=default`
62
63    if ! $found; then
64        AC_PATH_PROG([XML2_CONFIG], [xml2-config])
65        if test x"$XML2_CONFIG" != x""; then
66            for xml2dir in $xml2dirs; do
67                AC_MSG_CHECKING([for libxml/tree.h in $xml2dir])
68                if test -f "$xml2dir/include/libxml2/libxml/tree.h"; then
69                    XML2_INCLUDES=`$XML2_CONFIG --cflags 2>/dev/null`
70                    XML2_LDFLAGS=`$XML2_CONFIG --libs 2>/dev/null`
71                    found=true
72                    AC_MSG_RESULT([yes])
73                    break
74                else
75                    AC_MSG_RESULT([no])
76                fi
77            done
78        else
79            # cannot even find the xml2-config
80            AC_MSG_ERROR([Cannot find xml2-config in your system path])
81        fi
82
83        # if the file wasn't found, well, go ahead and try the link anyway -- maybe
84        # it will just work!
85    fi
86
87    # try the preprocessor and linker with our new flags,
88    # being careful not to pollute the global LIBS, LDFLAGS, and CPPFLAGS
89
90    AC_MSG_CHECKING([whether compiling and linking against XML2 works])
91    echo "Trying link with XML2_LDFLAGS=$XML2_LDFLAGS;" \
92        "XML2_LIBS=$XML2_LIBS; XML2_INCLUDES=$XML2_INCLUDES" >&AS_MESSAGE_LOG_FD
93
94    save_LIBS="$LIBS"
95    save_LDFLAGS="$LDFLAGS"
96    save_CPPFLAGS="$CPPFLAGS"
97    LDFLAGS="$LDFLAGS $XML2_LDFLAGS"
98    LIBS="$XML2_LIBS $LIBS"
99    CPPFLAGS="$XML2_INCLUDES $CPPFLAGS"
100    AC_LINK_IFELSE(
101        [AC_LANG_PROGRAM([#include <libxml/tree.h>], [xmlMalloc(1)])],
102        [
103            AC_MSG_RESULT([yes])
104            $1
105        ], [
106            AC_MSG_RESULT([no])
107            $2
108        ])
109    CPPFLAGS="$save_CPPFLAGS"
110    LDFLAGS="$save_LDFLAGS"
111    LIBS="$save_LIBS"
112
113    AC_SUBST([XML2_INCLUDES])
114    AC_SUBST([XML2_LIBS])
115    AC_SUBST([XML2_LDFLAGS])
116])
117
Note: See TracBrowser for help on using the repository browser.