This repository has been archived by the owner on May 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
configure.ac
382 lines (354 loc) · 13.9 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
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
# To build using autotools, see the Development section of the file INSTALL.
AC_PREREQ([2.59])
AC_INIT([ndn-ind], [1.0], [[email protected]], [ndn-ind], [https://github.com/operantnetworks/ndn-ind])
AM_INIT_AUTOMAKE([1.10 -Wall no-define foreign])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([configure.ac])
# Create config.h without prefixes. Put it in the include directory so CFLAGS will have -I./include .
AC_CONFIG_HEADERS(include/config.h)
# Add prefixes and output to a unique file name which will go into the ndn-ind include install directory.
AX_PREFIX_CONFIG_H(include/ndn-ind/ndn-ind-config.h)
AM_MAINTAINER_MODE
AM_PROG_AR
AC_PROG_LIBTOOL
LT_PREREQ([2.2])
LT_INIT()
AC_PROG_CXX
AM_PROG_CC_C_O
AC_PROG_OBJCXX
AC_LANG([C++])
# Special case.
case "$host" in
*-darwin* | *-macos10*)
if test -d /opt/local ; then
CFLAGS="$CFLAGS -I/opt/local/include"
CXXFLAGS="$CXXFLAGS -I/opt/local/include"
CPPFLAGS="$CPPFLAGS -I/opt/local/include"
LDFLAGS="$LDFLAGS -L/opt/local/lib"
elif test -d /sw ; then
CFLAGS="$CFLAGS -I/sw/include"
CXXFLAGS="$CXXFLAGS -I/sw/include"
CPPFLAGS="$CPPFLAGS -I/sw/include"
LDFLAGS="$LDFLAGS -L/sw/lib"
fi
;;
esac
AC_ARG_VAR(ADD_CFLAGS, [Append this to CFLAGS])
CFLAGS="$CFLAGS $ADD_CFLAGS"
AC_ARG_VAR(ADD_CXXFLAGS, [Append this to CXXFLAGS])
CXXFLAGS="$CXXFLAGS $ADD_CXXFLAGS"
AC_ARG_VAR(ADD_CPPFLAGS, [Append this to CPPFLAGS])
CPPFLAGS="$CPPFLAGS $ADD_CPPFLAGS"
AC_ARG_VAR(ADD_LDFLAGS, [Append this to LDFLAGS])
LDFLAGS="$LDFLAGS $ADD_LDFLAGS"
AC_TYPE_SIZE_T
AC_TYPE_INT8_T
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_UINT8_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_CHECK_FUNCS([memcmp] [memcpy] [memset])
AC_CHECK_FUNCS([strchr], :, AC_MSG_ERROR([*** strchr not found. Check 'config.log' for more details.]))
AC_CHECK_FUNCS([sscanf], :, AC_MSG_ERROR([*** sscanf not found. Check 'config.log' for more details.]))
AC_CHECK_HEADERS([time.h], :, AC_MSG_ERROR([*** time.h not found. Check 'config.log' for more details.]))
AC_CHECK_HEADERS([sys/time.h], :, AC_MSG_ERROR([*** sys/time.h not found. Check 'config.log' for more details.]))
AC_CHECK_FUNCS([gettimeofday], :, AC_MSG_ERROR([*** gettimeofday not found. processEvents requires it. Check 'config.log' for more details.]))
AC_CHECK_FUNCS([round])
AX_CXX_COMPILE_STDCXX_17(, optional)
AX_CXX_COMPILE_STDCXX_14(, optional)
AX_CXX_COMPILE_STDCXX_11(, mandatory)
AC_C_INLINE
# Use the minimum boost version from NFD.
AX_BOOST_BASE([1.48])
AX_BOOST_ASIO
AX_BOOST_CHRONO
AX_BOOST_FILESYSTEM
AC_MSG_CHECKING([for std::filesystem])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[#include <filesystem>]]
[[bool result = std::filesystem::create_directories("");]])
], [
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED([HAVE_STD_FILESYSTEM], 1, [1 if have std::filesystem .])
], [
AC_MSG_RESULT([no])
AC_DEFINE_UNQUOTED([HAVE_STD_FILESYSTEM], 0, [1 if have std::filesystem .])
])
AC_MSG_CHECKING([for std::shared_ptr])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[#include <memory>]]
[[std::shared_ptr<int> have_shared_ptr;]])
], [
AC_MSG_RESULT([yes])
HAVE_STD_SHARED_PTR=1
], [
AC_MSG_RESULT([no])
HAVE_STD_SHARED_PTR=0
])
AC_DEFINE_UNQUOTED([HAVE_STD_SHARED_PTR], $HAVE_STD_SHARED_PTR, [1 if have the `std::shared_ptr' class.])
AC_MSG_CHECKING([for boost::shared_ptr])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[#include <boost/shared_ptr.hpp>]]
[[boost::shared_ptr<int> have_shared_ptr;]])
], [
AC_MSG_RESULT([yes])
HAVE_BOOST_SHARED_PTR=1
], [
AC_MSG_RESULT([no])
HAVE_BOOST_SHARED_PTR=0
])
AC_DEFINE_UNQUOTED([HAVE_BOOST_SHARED_PTR], $HAVE_BOOST_SHARED_PTR, [1 if have the `boost::shared_ptr' class.])
# Conditionally use std::shared_ptr or boost::shared_ptr.
if test "$HAVE_STD_SHARED_PTR" == "1" ; then
AC_ARG_WITH([std-shared-ptr],
[AS_HELP_STRING([--with-std-shared-ptr], [ptr_lib should use std::shared_ptr, etc. if available@<:@default: yes@:>@])],
[std_shared_ptr=${withval}], [std_shared_ptr=yes])
if test "x${std_shared_ptr}" = xyes; then
AC_DEFINE([WITH_STD_SHARED_PTR], 1, [Define to 1 if ptr_lib should use std::shared_ptr, etc. if available])
else
AC_DEFINE([WITH_STD_SHARED_PTR], 0, [Define to 1 if ptr_lib should use std::shared_ptr, etc. if available])
fi
else
AC_DEFINE([WITH_STD_SHARED_PTR], 0, [Define to 1 if ptr_lib should use std::shared_ptr, etc. if available])
fi
if test "$HAVE_BOOST_SHARED_PTR" == "1" ; then
AC_ARG_WITH([boost-shared-ptr],
[AS_HELP_STRING([--with-boost-shared-ptr], [ptr_lib should use boost::shared_ptr, etc. if available. (--with-std-shared-ptr=yes overrides this.) @<:@default: yes@:>@])],
[boost_shared_ptr=${withval}], [boost_shared_ptr=yes])
if test "x${boost_shared_ptr}" = xyes; then
AC_DEFINE([WITH_BOOST_SHARED_PTR], 1, [Define to 1 if ptr_lib should use boost::shared_ptr, etc. if available])
else
AC_DEFINE([WITH_BOOST_SHARED_PTR], 0, [Define to 1 if ptr_lib should use boost::shared_ptr, etc. if available])
fi
else
AC_DEFINE([WITH_BOOST_SHARED_PTR], 0, [Define to 1 if ptr_lib should use boost::shared_ptr, etc. if available])
fi
AC_MSG_CHECKING([for std::function])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[#include <functional>]]
[[typedef std::function<void(int)> MyFunction;]]
[[void myFunction(int x) {}]]
[[MyFunction functionObject = std::bind(&myFunction, std::placeholders::_1);]])
], [
AC_MSG_RESULT([yes])
HAVE_STD_FUNCTION=1
], [
AC_MSG_RESULT([no])
HAVE_STD_FUNCTION=0
])
AC_DEFINE_UNQUOTED([HAVE_STD_FUNCTION], $HAVE_STD_FUNCTION, [1 if have the `std::function' class.])
AC_MSG_CHECKING([for boost::function])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[#include <boost/function.hpp>]]
[[#include <boost/bind.hpp>]]
[[typedef boost::function<void(int)> MyFunction;]]
[[void myFunction(int x) {}]]
[[MyFunction functionObject = boost::bind(&myFunction, _1);]])
], [
AC_MSG_RESULT([yes])
HAVE_BOOST_FUNCTION=1
], [
AC_MSG_RESULT([no])
HAVE_BOOST_FUNCTION=0
])
AC_DEFINE_UNQUOTED([HAVE_BOOST_FUNCTION], $HAVE_BOOST_FUNCTION, [1 if have the `boost::function' class.])
# Conditionally use std::function or boost::function.
if test "$HAVE_STD_FUNCTION" == "1" ; then
AC_ARG_WITH([std-function],
[AS_HELP_STRING([--with-std-function], [func_lib should use std::function, etc. if available @<:@default: yes@:>@])],
[std_function=${withval}], [std_function=yes])
if test "x${std_function}" = xyes; then
AC_DEFINE([WITH_STD_FUNCTION], 1, [Define to 1 if func_lib should use std::function, etc. if available])
else
AC_DEFINE([WITH_STD_FUNCTION], 0, [Define to 1 if func_lib should use std::function, etc. if available])
fi
else
AC_DEFINE([WITH_STD_FUNCTION], 0, [Define to 1 if func_lib should use std::function, etc. if available])
fi
if test "$HAVE_BOOST_FUNCTION" == "1" ; then
AC_ARG_WITH([boost-function],
[AS_HELP_STRING([--with-boost-function], [func_lib should use boost::function, etc. if available (--with-std-function=yes overrides this.) @<:@default: yes@:>@])],
[boost_function=${withval}], [boost_function=yes])
if test "x${boost_function}" = xyes; then
AC_DEFINE([WITH_BOOST_FUNCTION], 1, [Define to 1 if func_lib should use boost::function, etc. if available])
else
AC_DEFINE([WITH_BOOST_FUNCTION], 0, [Define to 1 if func_lib should use boost::function, etc. if available])
fi
else
AC_DEFINE([WITH_BOOST_FUNCTION], 0, [Define to 1 if func_lib should use boost::function, etc. if available])
fi
AC_MSG_CHECKING([for std::regex support])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[#include <string>]]
[[#include <regex>]]
[[std::string result = std::regex_replace(std::string("Hello"), std::regex("H"), "h");]])
], [
AC_MSG_RESULT([yes])
HAVE_STD_REGEX=1
], [
AC_MSG_RESULT([no])
HAVE_STD_REGEX=0
])
AC_DEFINE_UNQUOTED([HAVE_STD_REGEX], $HAVE_STD_REGEX, [1 if have std::regex.])
if test "$HAVE_STD_REGEX" == "0" ; then
# Only check for Boost regex if we don't have std regex so that we only link to its library if necessary.
AX_BOOST_REGEX
fi
AC_MSG_CHECKING([for boost/atomic.hpp])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[#include <boost/atomic.hpp>]]
[[boost::atomic_uint64_t have_boost_atomic;]])
], [
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED([HAVE_BOOST_ATOMIC], 1, [1 if have boost/atomic.hpp.])
], [
AC_MSG_RESULT([no])
AC_DEFINE_UNQUOTED([HAVE_BOOST_ATOMIC], 0, [1 if have boost/atomic.hpp.])
])
AC_MSG_CHECKING([for gmtime support])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[#include <time.h>]]
[[#include <sys/time.h>]]
[[struct timeval tv;]]
[[int result1 = gettimeofday(&tv, 0);]]
[[time_t time1 = time(0);]]
[[struct tm* tm1 = gmtime(&time1);]]
[[time_t time2 = timegm(tm1);]])
], [
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED([HAVE_GMTIME_SUPPORT], 1, [1 if have sys/time gmtime support including timegm.])
], [
AC_MSG_RESULT([no])
AC_DEFINE_UNQUOTED([HAVE_GMTIME_SUPPORT], 0, [1 if have sys/time gmtime support including timegm.])
])
# Try libcrypto 1.1+. If not found, require libcrypto 1.0+.
AC_SEARCH_LIBS([EVP_chacha20_poly1305], [crypto crypto1_1],
[AC_DEFINE_UNQUOTED([HAVE_LIBCRYPTO], 1, [1 if have OpenSSL crypto lib version 1.0+.])
AC_DEFINE_UNQUOTED([HAVE_LIBCRYPTO_1_1], 1, [1 if have OpenSSL crypto lib version 1.1+.])],
# libcrypto 1.1 not found. Try libcrypto 1.0.
[AC_SEARCH_LIBS([EVP_EncryptInit], [crypto],
[AC_DEFINE_UNQUOTED([HAVE_LIBCRYPTO], 1, [1 if have OpenSSL crypto lib version 1.0+.])
AC_DEFINE_UNQUOTED([HAVE_LIBCRYPTO_1_1], 0, [1 if have OpenSSL crypto lib version 1.1+.])],
[AC_MSG_FAILURE([can't find OpenSSL crypto lib version 1.0+.])],
[-lpthread -ldl])],
[-lpthread -ldl])
# Conditionally use libsqlite3. AX_LIB_SQLITE3 defines HAVE_SQLITE3 in confdefs.h .
AX_LIB_SQLITE3()
if grep -q "#define HAVE_SQLITE3" confdefs.h ; then
AC_CHECK_LIB([sqlite3], [sqlite3_open], [],
[AC_MSG_FAILURE([have sqlite3 headers but no libsqlite3])])
fi
# Conditionally use the OSX Security framework .
AC_MSG_CHECKING([for OSX Security framework])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[#include <CoreFoundation/CoreFoundation.h>]]
[[#include <Security/Security.h>]]
[[#include <CoreServices/CoreServices.h>]]
[[void test() { SecKeychainRef x; }]])
], [
AC_MSG_RESULT([yes])
HAVE_OSX_SECURITY=1
], [
AC_MSG_RESULT([no])
HAVE_OSX_SECURITY=0
])
AC_DEFINE_UNQUOTED([HAVE_OSX_SECURITY], $HAVE_OSX_SECURITY, [1 if have the OSX framework.])
if test "$HAVE_OSX_SECURITY" == "1" ; then
LIBS="$LIBS -framework Security -framework Cocoa"
AC_ARG_WITH([osx-keychain],
[AS_HELP_STRING([--with-osx-keychain], [use the OS X Keychain as the default private key store @<:@default: yes@:>@])],
[osx_keychain=${withval}], [osx_keychain=yes])
if test "x${osx_keychain}" = xyes; then
AC_DEFINE([WITH_OSX_KEYCHAIN], 1, [Define to 1 if the OS X Keychain should be the default private key store.])
else
AC_DEFINE([WITH_OSX_KEYCHAIN], 0, [Define to 1 if the OS X Keychain should be the default private key store.])
fi
else
AC_DEFINE([WITH_OSX_KEYCHAIN], 0, [Define to 1 if the OS X Keychain should be the default private key store.])
fi
AC_MSG_CHECKING([for __attribute__((deprecated))])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[void func(int); __attribute__((deprecated))]])
], [
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_DEPRECATED], 1, [1 if have `__attribute__((deprecated))'.])
], [
AC_MSG_RESULT([no])
AC_DEFINE_UNQUOTED([HAVE_ATTRIBUTE_DEPRECATED], 0, [1 if have `__attribute__((deprecated))'.])
])
# htonll is supported on Windows 8 but not earlier Windows.
AC_MSG_CHECKING([for htonll])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[#include <WinSock2.h>]]
[[htonll(1);]])
], [
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED([HAVE_HTONLL], 1, [1 if have WinSock2 `htonll'.])
], [
AC_MSG_RESULT([no])
AC_DEFINE_UNQUOTED([HAVE_HTONLL], 0, [1 if have WinSock2 `htonll'.])
])
AC_MSG_CHECKING([for log4cxx])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[#include <log4cxx/logger.h>]]
[[log4cxx::LoggerPtr staticModuleLogger;]])
], [
AC_MSG_RESULT([yes])
HAVE_LOG4CXX=1
], [
AC_MSG_RESULT([no])
HAVE_LOG4CXX=0
])
AC_DEFINE_UNQUOTED([HAVE_LOG4CXX], $HAVE_LOG4CXX, [1 if have log4cxx.])
if test "$HAVE_LOG4CXX" == "1" ; then
AC_CHECK_LIB([log4cxx], [main], [],
[AC_MSG_FAILURE([have log4cxx headers but no liblog4cxx])])
fi
AC_MSG_CHECKING([for Protobuf])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
[[#include <google/protobuf/message.h>]]
[[google::protobuf::Message *message;]])
], [
AC_MSG_RESULT([yes])
HAVE_PROTOBUF=1
], [
AC_MSG_RESULT([no])
HAVE_PROTOBUF=0
])
AC_DEFINE_UNQUOTED([HAVE_PROTOBUF], $HAVE_PROTOBUF, [1 if have Google Protobuf.])
if test "$HAVE_PROTOBUF" == "1" ; then
AC_CHECK_LIB([protobuf], [main], [],
[AC_MSG_FAILURE([have protobuf headers but no libprotobuf])])
# libprotobuf needs libpthread.
AC_CHECK_LIB([pthread], [main], [],
[AC_MSG_FAILURE([have libprotobuf but no libpthread])])
# See https://stackoverflow.com/questions/13939904/how-to-use-protocol-buffers-with-autoconf-automake
AC_ARG_WITH([protoc],
[AS_HELP_STRING([--with-protoc=/path/of/protoc],
[Location of the protocol buffers compiler protoc. Defaults to looking on path.])],
[PROTOC="$withval"],
[ AS_IF([test "x${PROTOC}" == "x"],
[AC_PATH_PROG([PROTOC], [protoc], [no])])
]
)
AS_IF([test "${PROTOC}" == "no"], [AC_MSG_ERROR([ProtoBuf compiler "protoc" not found.])])
fi
AX_CHECK_ZLIB([], [AC_DEFINE([HAVE_LIBZ], 0, [Define to 1 if you have `z' library (-lz)])])
# This defines PTHREAD_CFLAGS and PTHREAD_LIBS.
ACX_PTHREAD
DX_HTML_FEATURE(ON)
DX_CHM_FEATURE(OFF)
DX_CHI_FEATURE(OFF)
DX_MAN_FEATURE(OFF)
DX_RTF_FEATURE(OFF)
DX_XML_FEATURE(OFF)
DX_PDF_FEATURE(OFF)
DX_PS_FEATURE(OFF)
DX_INIT_DOXYGEN([$PACKAGE_NAME],[Doxyfile])
AC_CONFIG_FILES([Makefile
include/Makefile
libndn-ind.pc])
AC_OUTPUT