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