source: m4/ax_check_xmlsec1.m4 @ c75b2c2

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

1) added couple of new m4 for setting up configure for xmlsec1 and xml2 and openssl

  • Property mode set to 100644
File size: 3.4 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            xmlsec1dirs="/usr/local /usr"
41        ]
42        )
43
44
45    # XMLSEC1 headers have to be in libxml and xmlsec subdirectories
46    # CFLAGS =-g -Wall `xmlsec1-config --cflags --crypto=default` `xml2-config --cflags`
47    # LDFLAGS += `xml2-config --libs` `xmlsec1-config --libs --crypto=default`
48
49    if ! $found; then
50        AC_PATH_PROG([XMLSEC1_CONFIG], [xmlsec1-config])
51        if test x"$XMLSEC1_CONFIG" != x""; then
52            for xmlsec1dir in $xmlsec1dirs; do
53                AC_MSG_CHECKING([for xmlsec/xmlsec.h in $xmlsec1dir])
54                if test -f "$xmlsec1dir/include/xmlsec1/xmlsec/xmlsec.h"; then
55                    XMLSEC1_INCLUDES="-g -Wall "
56                    XMLSEC1_INCLUDES+=`$XMLSEC1_CONFIG --cflags --crypto=default 2>/dev/null`
57                    XMLSEC1_LDFLAGS=`$XMLSEC1_CONFIG --libs --crypto=default 2>/dev/null`
58                    found=true
59                    AC_MSG_RESULT([yes])
60                    break;
61                else
62                    AC_MSG_RESULT([no])
63                fi
64            done
65        else
66            # cannot even find the xmlsec-config
67            AC_MSG_ERROR([Cannot find xmlsec-config in your system path])
68        fi
69
70        # if the file wasn't found, well, go ahead and try the link anyway -- maybe
71        # it will just work!
72    fi
73
74    # try the preprocessor and linker with our new flags,
75    # being careful not to pollute the global LIBS, LDFLAGS, and CPPFLAGS
76
77    AC_MSG_CHECKING([whether compiling and linking against XMLSEC1 works])
78    echo "Trying link with XMLSEC1_LDFLAGS=$XMLSEC1_LDFLAGS;" \
79        "XMLSEC1_LIBS=$XMLSEC1_LIBS; XMLSEC1_INCLUDES=$XMLSEC1_INCLUDES" >&AS_MESSAGE_LOG_FD
80
81    save_LIBS="$LIBS"
82    save_LDFLAGS="$LDFLAGS"
83    save_CPPFLAGS="$CPPFLAGS"
84    LDFLAGS="$LDFLAGS $XMLSEC1_LDFLAGS"
85    LIBS="$XMLSEC1_LIBS $LIBS"
86    CPPFLAGS="$XMLSEC1_INCLUDES $CPPFLAGS"
87    AC_LINK_IFELSE(
88        [AC_LANG_PROGRAM([#include <xmlsec/xmlsec.h>], [xmlSecInit()])],
89        [
90            AC_MSG_RESULT([yes])
91            $1
92        ], [
93            AC_MSG_RESULT([no])
94            $2
95        ])
96    CPPFLAGS="$save_CPPFLAGS"
97    LDFLAGS="$save_LDFLAGS"
98    LIBS="$save_LIBS"
99
100    AC_SUBST([XMLSEC1_INCLUDES])
101    AC_SUBST([XMLSEC1_LIBS])
102    AC_SUBST([XMLSEC1_LDFLAGS])
103])
104
Note: See TracBrowser for help on using the repository browser.