This repository has been archived by the owner on Nov 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
283 lines (246 loc) · 9.29 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
# Process this file with autoreconf
AC_PREREQ([2.50])
AC_INIT([mysqlattributeresolver],[1.0],[[email protected]],[mysqlattributeresolver])
AC_CONFIG_SRCDIR(src)
AC_CONFIG_AUX_DIR(build-aux)
AC_CONFIG_MACRO_DIR(m4)
AM_INIT_AUTOMAKE
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
AC_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug],[Have GCC compile with symbols (Default = no)]),
enable_debug=$enableval, enable_debug=no)
if test "$enable_debug" = "yes" ; then
GCC_CFLAGS="$CFLAGS -g -D_DEBUG"
GCC_CXXFLAGS="$CXXFLAGS -g -D_DEBUG"
else
GCC_CFLAGS="$CFLAGS -O2 -DNDEBUG"
GCC_CXXFLAGS="$CXXFLAGS -O2 -DNDEBUG"
fi
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([mysqlattributeresolver.spec])
AC_CONFIG_FILES([Makefile doc/Makefile src/Makefile])
AC_PROG_CC([gcc gcc3 cc])
AC_PROG_CXX([g++ g++3 c++ CC])
AC_CANONICAL_HOST
if test "$GCC" = "yes" ; then
# AC_HAVE_GCC_VERSION(4,0,0,0,
# [
# AC_DEFINE(GCC_HASCLASSVISIBILITY,1,
# [Define to enable class visibility control in gcc.])
# GCC_CFLAGS="$GCC_CFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
# GCC_CXXFLAGS="$GCC_CXXFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
# ])
CFLAGS="-Wall $GCC_CFLAGS"
CXXFLAGS="-Wall $GCC_CXXFLAGS"
fi
# Fix for Sun Workshop compiler in debug mode, may be Sun case #6360993
case "${host_cpu}-${host_os}" in
*solaris*)
CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS"
CXXFLAGS="$CXXFLAGS -D_POSIX_PTHREAD_SEMANTICS"
if test "$CXX" = "CC" ; then
CXXFLAGS="$CXXFLAGS -Qoption ccfe -stabs=no%dfltlit+no%dflthlp"
fi
;;
*osf*)
CXXFLAGS="$CXXFLAGS -D_POSIX_PII_SOCKET"
;;
esac
AC_LANG(C)
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_STRUCT_TM
# Checks for library functions.
AC_CHECK_FUNCS([strcasecmp])
AX_CHECK_COMPILE_FLAG([-std=c11], [
CFLAGS+=" -std=c11"
], [
echo "C compiler cannot compile C11 code"
exit -1
])
# checks for pthreads
ACX_PTHREAD([enable_threads="pthread"],[enable_threads="no"])
if test $enable_threads != "pthread"; then
AC_MSG_ERROR([unable to find pthreads, currently this is required])
else
AC_DEFINE([HAVE_PTHREAD],[1],[Define if you have POSIX threads libraries and header files.])
LIBS="$PTHREAD_LIBS $LIBS"
CFLAGS="$PTHREAD_CFLAGS $CFLAGS"
CXXFLAGS="$PTHREAD_CFLAGS $CXXFLAGS"
fi
AC_LANG(C++)
# C++ requirements
AC_CXX_NAMESPACES
AC_CXX_REQUIRE_STL
AX_CHECK_COMPILE_FLAG([-std=c++11], [
CXXFLAGS+=" -std=c++11"
], [
echo "C++ compiler cannot compile C++11 code"
exit -1
])
# are covariant methods allowed?
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[]],
[[
class base { public: virtual base *GetPtr( void ) { return this; } };
class derived: virtual public base { public: virtual derived *GetPtr( void ) { return this; } };
]])],
[AC_DEFINE([HAVE_COVARIANT_RETURNS],[1],[Define to 1 if C++ compiler supports covariant virtual methods.])])
# is nullptr supported?
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([[]],[[const char* ptr = nullptr;]])],
[AC_DEFINE([HAVE_NULLPTR],[1],[Define to 1 if C++ compiler supports nullptr keyword.])])
# log4shib settings (favor this version over the log4cpp code)
AC_PATH_PROG(LOG4SHIB_CONFIG,log4shib-config)
AC_ARG_WITH(log4shib,
AS_HELP_STRING([--with-log4shib=PATH],[where log4shib-config is installed]),
[
LOG4SHIB_CONFIG="${with_log4shib}"
if ! test -f "${LOG4SHIB_CONFIG}" ; then
LOG4SHIB_CONFIG="${with_log4shib}/bin/log4shib-config"
fi
])
if test -f "${LOG4SHIB_CONFIG}"; then
LIBS="`${LOG4SHIB_CONFIG} --libs` $LIBS"
CPPFLAGS="`${LOG4SHIB_CONFIG} --cflags` $CPPFLAGS"
AC_CHECK_HEADER([log4shib/CategoryStream.hh],,AC_MSG_ERROR([unable to find log4shib header files]))
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include <log4shib/Category.hh>
#include <log4shib/CategoryStream.hh>]],
[[log4shib::Category::getInstance("foo").errorStream() << log4shib::eol]])],
[AC_DEFINE([MYSQLATTRIBUTERESOLVER_LOG4SHIB],[1],[Define to 1 if log4shib library is used.])],
[AC_MSG_ERROR([unable to link with log4shib])])
else
AC_MSG_WARN([log4shib-config not found, may need to use --with-log4shib option])
AC_MSG_WARN([will look for original log4cpp library])
# log4cpp settings
AC_PATH_PROG(LOG4CPP_CONFIG,log4cpp-config)
AC_ARG_WITH(log4cpp,
AS_HELP_STRING([--with-log4cpp=PATH],[where log4cpp-config is installed]),
[
LOG4CPP_CONFIG="${with_log4cpp}"
if ! test -f "${LOG4CPP_CONFIG}" ; then
LOG4CPP_CONFIG="${with_log4cpp}/bin/log4cpp-config"
fi
])
if test -f "${LOG4CPP_CONFIG}"; then
AC_MSG_WARN([will try to use log4cpp, note that most non-Internet2 supplied versions are not thread-safe])
LIBS="`${LOG4CPP_CONFIG} --libs` $LIBS"
CPPFLAGS="`${LOG4CPP_CONFIG} --cflags` $CPPFLAGS"
AC_CHECK_HEADER([log4cpp/CategoryStream.hh],,AC_MSG_ERROR([unable to find log4cpp header files]))
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include <log4cpp/Category.hh>
#include <log4cpp/CategoryStream.hh>]],
[[log4cpp::Category::getInstance("foo").errorStream() << log4cpp::eol]])],
[AC_DEFINE([MYSQLATTRIBUTERESOLVER_LOG4CPP],[1],[Define to 1 if log4cpp library is used.])],
[AC_MSG_ERROR([unable to link with log4cpp, need version 1.0 or later])])
else
AC_MSG_ERROR([log4cpp-config not found, may need to use --with-log4cpp option])
fi
fi
# Xerces settings
AC_ARG_WITH(xerces,
AS_HELP_STRING([--with-xerces=PATH], [where xerces-c is installed]),
[if test x_$with_xerces != x_/usr; then
LDFLAGS="-L${with_xerces}/lib $LDFLAGS"
CPPFLAGS="-I${with_xerces}/include $CPPFLAGS"
fi])
LIBS="-lxerces-c $LIBS"
AC_CHECK_HEADER([xercesc/dom/DOM.hpp],,AC_MSG_ERROR([unable to find xerces header files]))
AC_MSG_CHECKING([Xerces version])
AC_PREPROC_IFELSE(
[AC_LANG_PROGRAM([#include <xercesc/util/XercesVersion.hpp>],
[#if _XERCES_VERSION != 20600
int i = 0;
#else
#error cannot use version 2.6.0
#endif])],
[AC_MSG_RESULT(OK)],
[AC_MSG_FAILURE([Xerces-C v2.6.0 has bugs that inhibit use with signed XML, please use a newer version])])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include <xercesc/util/PlatformUtils.hpp>]],
[[xercesc::XMLPlatformUtils::Initialize()]])],
,[AC_MSG_ERROR([unable to link with Xerces])])
#XML-Tooling settings
AC_ARG_WITH(xmltooling,
AS_HELP_STRING([--with-xmltooling=PATH],[where xmltooling-c is installed]),
[if test x_$with_xmltooling != x_/usr; then
LDFLAGS="-L${with_xmltooling}/lib $LDFLAGS"
CPPFLAGS="-I${with_xmltooling}/include $CPPFLAGS"
fi])
LITE_LIBS="-lxmltooling-lite"
XMLSEC_LIBS="-lxmltooling"
AC_CHECK_HEADER([xmltooling/base.h],,AC_MSG_ERROR([unable to find xmltooling header files]))
# XML-Security settings
AC_ARG_WITH(xmlsec,
AS_HELP_STRING([--with-xmlsec=PATH], [where xmlsec is installed]),,
[with_xmlsec=/usr])
if test x_$with_xmlsec != x_/usr; then
LDFLAGS="-L${with_xmlsec}/lib $LDFLAGS"
CPPFLAGS="-I${with_xmlsec}/include $CPPFLAGS"
fi
XMLSEC_LIBS="-lxml-security-c $XMLSEC_LIBS"
# save and append master libs
save_LIBS="$LIBS"
LIBS="$XMLSEC_LIBS $LIBS"
AC_CHECK_HEADER([xsec/utils/XSECPlatformUtils.hpp],,AC_MSG_ERROR([unable to find XML-Security header files]))
AC_MSG_CHECKING([XML-Security version])
AC_PREPROC_IFELSE(
[AC_LANG_PROGRAM([#include <xsec/utils/XSECPlatformUtils.hpp>],
[#if XSEC_VERSION_MAJOR > 1 || (XSEC_VERSION_MAJOR == 1 && XSEC_VERSION_MEDIUM > 3)
int i = 0;
#else
#error need version 1.4.0 or later
#endif])],
[AC_MSG_RESULT(OK)],
[AC_MSG_FAILURE([XML-Security version 1.4.0 or greater is required.])])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include <xsec/utils/XSECPlatformUtils.hpp>]],
[[XSECPlatformUtils::Initialise()]])],,
[AC_MSG_ERROR([unable to link with XML-Security])])
# restore master libs
LIBS="$save_LIBS"
# OpenSAML settings
AC_ARG_WITH(saml,
AS_HELP_STRING([--with-saml=PATH],[where saml is installed]),
[if test x_$with_saml != x_/usr; then
LDFLAGS="-L${with_saml}/lib $LDFLAGS"
CPPFLAGS="-I${with_saml}/include $CPPFLAGS"
fi])
XMLSEC_LIBS="-lsaml $XMLSEC_LIBS"
# save and append master libs
save_LIBS="$LIBS"
LIBS="$XMLSEC_LIBS $LIBS"
AC_CHECK_HEADER([saml/saml2/metadata/Metadata.h],,AC_MSG_ERROR([unable to find OpenSAML header files]))
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include <saml/SAMLConfig.h>]],
[[opensaml::SAMLConfig::getConfig()]])],
,[AC_MSG_ERROR([unable to link with OpenSAML])])
# restore master libs
LIBS="$save_LIBS"
# Shibboleth SP settings
AC_ARG_WITH(shibsp,
AS_HELP_STRING([--with-shibsp=PATH],[where Shibboleth SP is installed]),
[if test x_$with_shibsp != x_/usr; then
LDFLAGS="-L${with_shibsp}/lib $LDFLAGS"
CPPFLAGS="-I${with_shibsp}/include $CPPFLAGS"
fi])
LITE_LIBS="-lshibsp-lite $LITE_LIBS"
XMLSEC_LIBS="-lshibsp $XMLSEC_LIBS"
# save and append master libs
save_LIBS="$LIBS"
LIBS="$XMLSEC_LIBS $LIBS"
AC_CHECK_HEADER([shibsp/SPConfig.h],,AC_MSG_ERROR([unable to find Shibboleth SP header files]))
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include <shibsp/SPConfig.h>]],
[[shibsp::SPConfig::getConfig()]])],
,[AC_MSG_ERROR([unable to link with Shibboleth SP])])
# restore master libs
LIBS="$save_LIBS"
AC_SUBST(LITE_LIBS)
AC_SUBST(XMLSEC_LIBS)
LIBTOOL="$LIBTOOL --silent"
WITH_MYSQL()
AC_OUTPUT