2 # Configure paths for xmlsec1
3 # H. Ronsdorf 2006-02-03
6 dnl AM_PATH_XMLSEC1([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]])
7 dnl Test for libxmlsec1, and define XMLSEC1_CFLAGS and XMLSEC1_LIBS
9 AC_DEFUN([AM_PATH_XMLSEC1],[
11 AC_ARG_WITH(xmlsec1-prefix,
13 [--with-xmlsec1-prefix=PFX],
14 [Prefix where libxmlsec1 is installed (optional)]
16 xmlsec1_config_prefix="$withval", xmlsec1_config_prefix=""
19 AC_ARG_WITH(xmlsec1-exec-prefix,
21 [--with-xmlsec1-exec-prefix=PFX],
22 [Exec prefix where libxmlsec1 is installed (optional)]
24 xmlsec1_config_exec_prefix="$withval", xmlsec1_config_exec_prefix=""
27 AC_ARG_ENABLE(xmlsec1test,
29 [--disable-xmlsec1test],
30 [Do not try to compile and run a test cSOAP program]
32 enable_xmlsec1test=yes
35 if test x$xmlsec1_config_exec_prefix != x ; then
36 xmlsec1_config_args="$xmlsec1_config_args --exec-prefix=$xmlsec1_config_exec_prefix"
37 if test x${XMLSEC1_CONFIG+set} != xset ; then
38 XMLSEC1_CONFIG=$xmlsec1_config_exec_prefix/bin/xmlsec1-config
41 if test x$xmlsec1_config_prefix != x ; then
42 xmlsec1_config_args="$xmlsec1_config_args --prefix=$xmlsec1_config_prefix"
43 if test x${XMLSEC1_CONFIG+set} != xset ; then
44 XMLSEC1_CONFIG=$xmlsec1_config_prefix/bin/xmlsec1-config
49 AC_PATH_PROG(XMLSEC1_CONFIG, xmlsec1-config, no)
50 min_xmlsec1_version=ifelse([$1], ,1.0.0,[$1])
51 AC_MSG_CHECKING(for libxmlsec1 - version >= $min_xmlsec1_version)
53 if test "$XMLSEC1_CONFIG" = "no" ; then
56 XMLSEC1_CFLAGS=`$XMLSEC1_CONFIG $xmlsec1_config_args --cflags`
57 XMLSEC1_LIBS=`$XMLSEC1_CONFIG $xmlsec1_config_args --libs`
58 xmlsec1_config_major_version=`$XMLSEC1_CONFIG $xmlsec1_config_args --version | \
59 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
60 xmlsec1_config_minor_version=`$XMLSEC1_CONFIG $xmlsec1_config_args --version | \
61 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
62 xmlsec1_config_micro_version=`$XMLSEC1_CONFIG $xmlsec1_config_args --version | \
63 sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
64 if test "x$enable_xmlsec1test" = "xyes" ; then
65 ac_save_CFLAGS="$CFLAGS"
67 CFLAGS="$CFLAGS $XMLSEC1_CFLAGS"
68 LIBS="$XMLSEC1_LIBS $LIBS"
70 dnl Now check if the installed libxmlsec1 is sufficiently new.
71 dnl (Also sanity checks the results of xmlsec1-config to some extent)
73 rm -f conf.xmlsec1test
78 #include <libxml/tree.h>
79 #include <xmlsec/xmlsec.h>
81 int main(int argc, char **argv) {
83 int major, minor, micro;
86 system("touch conf.xmlsec1test");
88 /* Capture xmlsec1-config output via autoconf/configure variables */
89 /* HP/UX 9 (%@#!) writes to sscanf strings */
90 tmp_version = (char *)strdup("$min_xmlsec1_version");
91 if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
93 printf("%s, bad version string from xmlsec1-config\n", "$min_xmlsec1_version");
98 /* Test that the library is greater than our minimum version */
99 if (($xmlsec1_config_major_version < major) ||
100 (($xmlsec1_config_major_version == major) && ($xmlsec1_config_minor_version < minor)) ||
101 (($xmlsec1_config_major_version == major) && ($xmlsec1_config_minor_version == minor) && ($xmlsec1_config_micro_version < micro))) {
103 printf("\n*** An old version of libxmlsec1 (%d.%d.%d) was found.\n", $xmlsec1_config_major_version, $xmlsec1_config_minor_version, $xmlsec1_config_micro_version);
104 printf("*** You need a version of libxmlsec1 newer than %d.%d.%d. The latest version of\n", major, minor, micro);
105 printf("*** libxmlsec1 is always available from http://xmlsec1.sf.net.\n\n");
106 printf("*** If you have already installed a sufficiently new version, this error\n");
107 printf("*** probably means that the wrong copy of the xmlsec1-config shell script is\n");
108 printf("*** being found. The easiest way to fix this is to remove the old version\n");
109 printf("*** of libxmlsec1, but you can also set the XMLSEC1_CONFIG environment to point to the\n");
110 printf("*** correct copy of xmlsec1-config. (In this case, you will have to\n");
111 printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
112 printf("*** so that the correct libraries are found at run-time))\n");
120 ],, no_xmlsec1=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
121 CFLAGS="$ac_save_CFLAGS"
126 if test "x$no_xmlsec1" = x ; then
127 AC_MSG_RESULT(yes (version $xmlsec1_config_major_version.$xmlsec1_config_minor_version.$xmlsec1_config_micro_version))
128 ifelse([$2], , :, [$2])
131 if test "$XMLSEC1_CONFIG" = "no" ; then
132 echo "*** The xmlsec1-config script installed by LIBXMLSEC1 could not be found"
133 echo "*** If libxmlsec1 was installed in PREFIX, make sure PREFIX/bin is in"
134 echo "*** your path, or set the XMLSEC1_CONFIG environment variable to the"
135 echo "*** full path to xmlsec1-config."
137 if test -f conf.xmlsec1test ; then
140 echo "*** Could not run libxmlsec1 test program, checking why..."
141 CFLAGS="$CFLAGS $XMLSEC1_CFLAGS"
142 LIBS="$LIBS $XMLSEC1_LIBS"
144 #include <libxmlsec1/version.h>
146 ], [ soap_client_destroy(); return 0;],
147 [ echo "*** The test program compiled, but did not run. This usually means"
148 echo "*** that the run-time linker is not finding LIBXMLSEC1 or finding the wrong"
149 echo "*** version of LIBXMLSEC1. If it is not finding LIBXMLSEC1, you'll need to set your"
150 echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
151 echo "*** to the installed location Also, make sure you have run ldconfig if that"
152 echo "*** is required on your system"
154 echo "*** If you have an old version installed, it is best to remove it, although"
155 echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
156 [ echo "*** The test program failed to compile or link. See the file config.log for the"
157 echo "*** exact error that occured. This usually means LIBXMLSEC1 was incorrectly installed"
158 echo "*** or that you have moved LIBXMLSEC1 since it was installed. In the latter case, you"
159 echo "*** may want to edit the xmlsec1-config script: $XMLSEC1_CONFIG" ])
160 CFLAGS="$ac_save_CFLAGS"
167 ifelse([$3], , :, [$3])
169 AC_SUBST(XMLSEC1_CFLAGS)
170 AC_SUBST(XMLSEC1_LIBS)
171 rm -f conf.xmlsec1test