Merged trust engines back into a unified version, made metadata roles a "KeyInfoSource".
[shibboleth/cpp-opensaml.git] / configure.ac
1 AC_PREREQ([2.50])
2 AC_INIT([opensaml], [2.0], [mace-opensaml-users@internet2.edu], [saml])
3 AM_CONFIG_HEADER(config.h)
4 #AM_CONFIG_HEADER(saml/config_pub.h)
5 AM_INIT_AUTOMAKE([opensaml], [2.0])
6
7 sinclude(doxygen.m4)
8
9 # Docygen features
10 DX_HTML_FEATURE(ON)
11 DX_CHM_FEATURE(OFF)
12 DX_CHI_FEATURE(OFF)
13 DX_MAN_FEATURE(OFF)
14 DX_RTF_FEATURE(OFF)
15 DX_XML_FEATURE(OFF)
16 DX_PDF_FEATURE(OFF)
17 DX_PS_FEATURE(OFF)
18 DX_INIT_DOXYGEN(opensaml, doxygen.cfg, doc/api)
19 DX_INCLUDE=
20
21 AC_ARG_ENABLE(debug,
22     AC_HELP_STRING(--enable-debug, [Have GCC compile with symbols (Default = no)]),
23     enable_debug=$enableval, enable_debug=no)
24
25 if test "$enable_debug" = "yes" ; then
26     GCC_CFLAGS="$CFLAGS -Wall -g -D_DEBUG"
27     GCC_CXXFLAGS="$CXXFLAGS -Wall -g -D_DEBUG"
28 else
29     GCC_CFLAGS="$CFLAGS -Wall -O2 -DNDEBUG"
30     GCC_CXXFLAGS="$CXXFLAGS -Wall -O2 -DNDEBUG"
31 fi
32
33 AC_PROG_CC([gcc gcc3 cc])
34 AC_PROG_CXX([g++ g++3 c++ CC])
35
36 if test "$GCC" = "yes" ; then
37 #    AC_HAVE_GCC_VERSION(4,0,0,0,
38 #        [
39 #        AC_DEFINE(GCC_HASCLASSVISIBILITY,1,
40 #            [Define to enable class visibility control in gcc.])
41 #        GCC_CFLAGS="$GCC_CFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
42 #        GCC_CXXFLAGS="$GCC_CXXFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
43 #        ])
44     CFLAGS="$GCC_CFLAGS"
45     CXXFLAGS="$GCC_CXXFLAGS"
46 fi
47
48 AC_DISABLE_STATIC
49 AC_PROG_LIBTOOL
50
51 # Checks for typedefs, structures, and compiler characteristics.
52 AC_C_CONST
53 AC_TYPE_SIZE_T
54
55 # Checks for library functions.
56 AC_CHECK_FUNCS([strchr strdup strstr])
57
58 AC_CHECK_SIZEOF(time_t)
59
60 # zlib settings
61 AC_ARG_WITH(zlib,
62         AC_HELP_STRING([--with-zlib=PATH], [where zlib is installed]),
63         [
64                 if test -d "$withval"; then
65                         CPPFLAGS="${CPPFLAGS} -I$withval/include"
66                         LDFLAGS="${LDFLAGS} -L$withval/lib"
67                 fi
68         ]
69 )
70 AC_CHECK_HEADER([zlib.h],,AC_MSG_ERROR([unable to find zlib header files]))
71 AC_CHECK_LIB([z],[deflateInit2_],,AC_MSG_ERROR([unable to link with zlib library]))
72
73 AC_LANG(C++)
74
75 # C++ requirements
76 AC_CXX_REQUIRE_STL
77 AC_CXX_NAMESPACES
78
79 # log4cpp settings
80 AC_PATH_PROG(LOG4CPP_CONFIG,log4cpp-config)
81 AC_ARG_WITH(log4cpp,
82     AC_HELP_STRING([--with-log4cpp=PATH], [where log4cpp-config is installed]),
83     [
84     LOG4CPP_CONFIG="${with_log4cpp}"
85     if ! test -f "${LOG4CPP_CONFIG}" ; then
86         LOG4CPP_CONFIG="${with_log4cpp}/bin/log4cpp-config"
87     fi
88     ])
89 if test -f "${LOG4CPP_CONFIG}"; then
90     LDFLAGS="`${LOG4CPP_CONFIG} --libs` $LDFLAGS"
91     CPPFLAGS="`${LOG4CPP_CONFIG} --cflags` $CPPFLAGS"
92 else
93     AC_MSG_ERROR([log4cpp-config not found, may need to use --with-log4cpp option])
94     LIBS="-llog4cpp $LIBS"
95 fi
96 AC_CHECK_HEADER([log4cpp/Category.hh],,AC_MSG_ERROR([unable to find log4cpp header files]))
97 AC_CHECK_HEADER([log4cpp/PropertyConfigurator.hh],,AC_MSG_ERROR([you need at least log4cpp 0.3.x]))
98 AC_TRY_LINK(
99         [#include <log4cpp/Category.hh>],
100         [log4cpp::Category::getInstance("foo")],
101         [AC_DEFINE(HAVE_LIBLOG4CPP,1,[Define if log4cpp library was found])],
102         [AC_MSG_ERROR([unable to link with log4cpp])])
103
104 # Xerces settings
105 AC_ARG_WITH(xerces, 
106             AC_HELP_STRING([--with-xerces=PATH], [where xerces-c is installed]),
107             [if test x_$with_xerces != x_/usr; then
108                 LDFLAGS="-L${with_xerces}/lib $LDFLAGS"
109                 CPPFLAGS="-I${with_xerces}/include $CPPFLAGS"
110             fi])
111 LIBS="-lxerces-c $LIBS"
112 AC_CHECK_HEADER([xercesc/dom/DOM.hpp],,AC_MSG_ERROR([unable to find xerces header files]))
113 AC_MSG_CHECKING([Xerces version])
114 AC_PREPROC_IFELSE(
115     [AC_LANG_PROGRAM([#include <xercesc/util/XercesVersion.hpp>],
116 [#if  _XERCES_VERSION != 20600
117 int i = 0;
118 #else
119 #error cannot use version 2.6.0
120 #endif])],
121     [AC_MSG_RESULT(OK)],
122     [AC_MSG_FAILURE([Xerces-C v2.6.0 has bugs that inhibit use with signed XML, please use special 2.6.1 tarball provided by Shibboleth Project])])
123 AC_TRY_LINK(
124     [#include <xercesc/util/PlatformUtils.hpp>],
125     [xercesc::XMLPlatformUtils::Initialize()],
126     [AC_DEFINE(HAVE_LIBXERCESC,1,[Define if Xerces-C library was found])],
127     [AC_MSG_ERROR([unable to link with Xerces])])
128
129
130 # XML-Security settings
131 AC_ARG_WITH(xmlsec,
132     AC_HELP_STRING([--with-xmlsec=PATH], [where xmlsec is installed]),
133     [if test x_$with_xmlsec != x_/usr; then
134         LDFLAGS="-L${with_xmlsec}/lib $LDFLAGS"
135         CPPFLAGS="-I${with_xmlsec}/include $CPPFLAGS"
136     fi])
137 LIBS="-lxml-security-c $LIBS"
138 AC_CHECK_HEADER([xsec/utils/XSECPlatformUtils.hpp],,AC_MSG_ERROR([unable to find xmlsec header files]))
139 AC_TRY_LINK(
140     [#include <xsec/utils/XSECPlatformUtils.hpp>],
141     [XSECPlatformUtils::Initialise()],
142     [AC_DEFINE(HAVE_LIBXSEC,1,[Define if XML-Sec library was found])],
143     [AC_MSG_ERROR([unable to link with xmlsec library])]
144     )
145
146 # XML-Tooling settings
147 AC_ARG_WITH(xmltooling,
148     AC_HELP_STRING([--with-xmltooling=PATH], [where xmltooling is installed]),
149     [if test x_$with_xmltooling != x_/usr; then
150         LDFLAGS="-L${with_xmltooling}/lib $LDFLAGS"
151         CPPFLAGS="-I${with_xmltooling}/include $CPPFLAGS"
152         DX_INCLUDE="${with_xmltooling}/include"
153     fi])
154 LIBS="-lxmltooling $LIBS"
155 AC_CHECK_HEADER([xmltooling/XMLToolingConfig.h],,AC_MSG_ERROR([unable to find xmltooling header files]))
156 AC_TRY_LINK(
157     [#include <xmltooling/XMLToolingConfig.h>],
158     [xmltooling::XMLToolingConfig::getConfig().init()],
159     [AC_DEFINE(HAVE_LIBXMLTOOLING,1,[Define if XML-Tooling library was found])],
160     [AC_MSG_ERROR([unable to link with xmltooling library])]
161     )
162
163 # Does the STL in use help or screw us?
164 AC_TRY_LINK(
165     [#include <string>],
166     [std::basic_string<unsigned short> foo; foo=foo+(unsigned short)65],
167     [AC_DEFINE(HAVE_GOOD_STL,1,
168         [Define if you have an STL implementation that supports useful string specialization.])],
169     )
170
171 # Check for unit test support
172 CXXTEST="/usr/bin/cxxtestgen.pl"
173 CXXTESTFLAGS=""
174 AC_ARG_WITH(cxxtest,
175             AC_HELP_STRING([--with-cxxtest=PATH], [where cxxtest is installed]),
176             [if test x_$with_cxxtest != x_/usr; then
177                 CXXTEST="${with_cxxtest}/cxxtestgen.pl"
178                 CXXTESTFLAGS="-I${with_cxxtest}"
179             fi])
180 if ! test -f "${CXXTEST}"; then
181     AC_MSG_WARN([cxxtestgen not found, won't build unit tests])
182 fi
183
184 AC_SUBST(CXXTEST)
185 AC_SUBST(CXXTESTFLAGS)
186 AM_CONDITIONAL(BUILD_UNITTEST,test -f ${CXXTEST})
187
188 AC_SUBST(DX_INCLUDE)
189 LIBTOOL="$LIBTOOL --silent"
190
191 # output makefiles
192 AC_OUTPUT(Makefile saml/Makefile samltest/Makefile schemas/Makefile)