forked from FellowTraveler/Open-Transactions-old
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
420 lines (315 loc) · 9.59 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
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
####### AC-AM Package Preliminaries #######
AC_PREREQ([2.61])
AC_INIT([opentxs],m4_esyscmd(tr -d '\n' <VERSION),[Fellow-Traveler],[opentxs],[https://github.com/FellowTraveler/Open-Transactions])
AC_CONFIG_SRCDIR([src/otd/main.cpp])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_MACRO_DIR([build-aux/m4])
AM_INIT_AUTOMAKE([1.10 foreign])
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
## special prelims
AC_FUNC_STRNLEN
## libtool prelims
LT_PREREQ([2.2.4])
LT_INIT([dlopen])
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_CPP
: ${CXXFLAGS=""}
: ${CFLAGS=""}
: ${CPPFLAGS=""}
PKG_PROG_PKG_CONFIG([0.25])
# Checks for header files.
AC_CHECK_HEADERS([arpa/inet.h float.h limits.h malloc.h memory.h netinet/in.h stddef.h stdint.h stdlib.h string.h sys/time.h sys/timeb.h unistd.h wchar.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_INT32_T
AC_C_RESTRICT
AC_TYPE_SIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
AC_CHECK_TYPES([ptrdiff_t])
# Checks for library functions.
AC_FUNC_ALLOCA
AC_FUNC_ERROR_AT_LINE
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_FUNC_STRERROR_R
AC_FUNC_STRTOD
AC_CHECK_FUNCS([getpass gettimeofday mkdir socket strtol strtoul])
### GCC AND CLANG DETECTION ###
### (from mesa's configure.ac file) ###
dnl clang is mostly GCC-compatible, but its version is much lower,
dnl so we have to check for it.
AC_MSG_CHECKING([if compiling with clang])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM([], [[
#ifndef __clang__
not clang
#endif
]])],
[acv_mesa_CLANG=yes], [acv_mesa_CLANG=no])
AC_MSG_RESULT([$acv_mesa_CLANG])
dnl If we're using GCC, make sure that it is at least version 4.2.0. Older
dnl versions are explictly not supported.
if test "x$GCC" = xyes -a "x$acv_mesa_CLANG" = xno; then
AC_MSG_CHECKING([whether gcc version is sufficient])
major=0
minor=0
GCC_VERSION=`$CC -dumpversion`
if test $? -eq 0; then
major=`echo $GCC_VERSION | cut -d. -f1`
minor=`echo $GCC_VERSION | cut -d. -f2`
fi
if test $major -lt 4 -o $major -eq 4 -a $minor -lt 2 ; then
AC_MSG_RESULT([no])
AC_MSG_ERROR([If using GCC, version 4.2.0 or later is required.])
else
AC_MSG_RESULT([yes])
fi
fi
######## Prelims end, Custom checks begin #######
##### Dependencies, packages, libs ####
#
## Main packages deps ##
PKG_CHECK_MODULES([PKGS],[protobuf >= 2.4.1 chaiscript >= 3.1.0])
AC_ARG_WITH([protoc],
[AS_HELP_STRING([--with-protoc=PATH],
[location of the protoc protocol buffer compiler binary, defaults to protoc])],
[PROTOC="$withval"],
[PROTOC='protoc'])
AC_SUBST([PROTOC])
## OpenSSL
# "--with-openssl=DIR" point to optional openssl package headers (for devs)
PKG_CHECK_MODULES([OPENSSL],[openssl >= 1.0.0],
[AX_CHECK_OPENSSL],
[AC_MSG_RESULT([Warning: openssl version >= 1.0.0 not found!])]
)
## BOOST ##
AX_BOOST_BASE([1.25.0])
AX_BOOST_THREAD
AX_BOOST_DATE_TIME
AX_BOOST_SYSTEM
AC_SUBST([BOOST_LIB_INCLUDE],["$BOOST_LDFLAGS $BOOST_THREAD_LIB $BOOST_DATE_TIME_LIB $BOOST_SYSTEM_LIB"])
## MsgPack ##
AC_CHECK_LIB([msgpack],[msgpack_unpack],
[MSG_LIBS="-lmsgpack"
AC_CHECK_HEADERS([msgpack.h],[],
[AC_MSG_ERROR([No header files for libmsgpack found!])]
)
],
[AC_MSG_RESULT([Warning: libmsgpack not found!])]
)
## pthread lib ##
AX_PTHREAD
## Transport Options (ZMQ defaut) ##
AC_ARG_WITH( [transport],
[AS_HELP_STRING([--with-transport@<:@=zmq@:>@],
[Choose a transport backend (available: zmq, testclient)])],
[case "${withval}" in
zmq) true ;;
testclient) true ;;
*) AC_MSG_ERROR([bad value ${withval} for --with-transport]) ;;
esac],
[with_transport=zmq])
AM_CONDITIONAL( [TRANSPORT_ZMQ], [test "$with_transport" == zmq])
AM_CONDITIONAL( [TRANSPORT_TESTCLIENT], [test "$with_transport" == testclient])
AS_IF( [test "$with_transport" == zmq],
[PKG_CHECK_MODULES([ZMQ],[libzmq >= 2.1.4],
[AC_LANG_PUSH([C++])
AC_CHECK_HEADERS([zmq.hpp],
[],
[AC_MSG_ERROR([Header files for libzmq not found or incompatible.])],
[])
AC_LANG_POP],
[AC_MSG_RESULT([Warning: libzmq version >= 2.1.4 not found!])]
)
])
## Keyring Options ##
AC_ARG_WITH( [keyring],
[AS_HELP_STRING([--with-keyring@<:@=ARG@:>@],
[Choose one keyring ARG from: windows, mac, gnome, kwallet])],
[case "${withval}" in
## windows) true ;;
mac) true ;;
gnome) true ;;
kwallet) true ;;
*) AC_MSG_ERROR([bad value ${withval} for --with-keyring]) ;;
esac],
[])
AM_CONDITIONAL([KEYRING_WINDOWS], [test "$with_keyring" == windows])
AM_CONDITIONAL([KEYRING_MAC], [test "$with_keyring" == mac])
AM_CONDITIONAL([KEYRING_GNOME], [test "$with_keyring" == gnome])
AM_CONDITIONAL([KEYRING_KWALLET], [test "$with_keyring" == kwallet])
AS_IF( [test "$with_keyring" == windows],
[
AC_SUBST(KRG_CFLAGS,[""])
AC_SUBST(KRG_LIBS,[""])
])
## WINDOWS build flags needed here #
AS_IF( [test "$with_keyring" == mac],
[
AC_SUBST(KRG_CFLAGS,["-isysroot /Developer/SDKs/MacOSX10.6.sdk -arch ppc -arch i386"])
AC_SUBST(KRG_LIBS,["-syslibroot /Developer/SDKs/MacOSX10.6.sdk -arch ppc -arch i386"])
])
AS_IF( [test "$with_keyring" == gnome],
[
PKG_CHECK_MODULES([KRG],[glib-2.0 >= 2.28.6 gnome-keyring-1])
])
AS_IF( [test "$with_keyring" == kwallet],
[
AC_SUBST(KRG_CFLAGS, ["-I/usr/include/kde"])
AC_SUBST(KRG_LIBS, ["-L/usr/lib -lkwalletclient"])
])
#### More Configure Options ####
## (Option) Signal Handler ##
AC_ARG_ENABLE(
sighandler,
AS_HELP_STRING(
[--enable-sighandler],
[enable sighandler, default: no]),
[case "${enableval}" in
yes) sighandler=true ;;
no) sighandler=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --disable-sighandler]) ;;
esac],
[sighandler=false])
AM_CONDITIONAL(OT_SIGNAL_HANDLING, test x"$sighandler" = x"true")
## (Option) Warnings ##
AC_ARG_ENABLE(
warnings,
AS_HELP_STRING(
[--enable-warnings],
[enable warnings, default: no]),
[case "${enableval}" in
yes) warnings=true ;;
no) warnings=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-warnings]) ;;
esac],
[warnings=false])
AM_CONDITIONAL(WARNINGS, test x"$warnings" = x"true")
if (test "x$warnings" == x"true"); then
AC_SUBST([WARN_CXXFLAGS],
["-Waddress -Woverloaded-virtual -Wshadow -Wconversion"])
fi
## (Option) Build In Release Mode ##
AC_ARG_ENABLE(
release,
AS_HELP_STRING(
[--enable-release],
[enable releasemode, default: no]),
[case "${enableval}" in
yes) release=true ;;
no) release=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-release]) ;;
esac],
[release=false])
AM_CONDITIONAL(RELEASE, test x"$release" = x"true")
if (test "x$release" == x"true"); then
AC_SUBST([REL_CXXFLAGS],
["-Wall -D_FORTIFY_SOURCE=2 -fstack-protector-all -fstack-check -Wstack-protector"])
fi
## (Option) Add SWIG JAVA ##
AC_ARG_WITH(
[java],
[AS_HELP_STRING([--with-java], [build Java SWIG wrapper])],
[])
AM_CONDITIONAL([WANT_JAVA], [test "x$with_java" == "xyes"])
if (test "x$with_java" == "xyes"); then
AX_PROG_JAVAC
AX_JNI_INCLUDE_DIR
for JNI_INCLUDE_DIR in $JNI_INCLUDE_DIRS
do
JNI_CPPFLAGS="$JNI_CPPFLAGS -I$JNI_INCLUDE_DIR"
done
AC_SUBST([JNI_CPPFLAGS],[$JNI_CPPFLAGS])
fi
## (Option) Add SWIG PERL5 ##
AC_ARG_WITH(
[perl5],
[AS_HELP_STRING([--with-perl5], [build Perl5 SWIG wrapper])],
[])
AM_CONDITIONAL([WANT_PERL5], [test "x$with_perl5" == "xyes"])
if (test "x$with_perl5" == "xyes"); then
AX_PERL_EXT
fi
## (Option) Add SWIG PHP ##
AC_ARG_WITH(
[php],
[AS_HELP_STRING([--with-php], [build PHP SWIG wrapper])],
[])
AM_CONDITIONAL([WANT_PHP], [test "x$with_php" == "xyes"])
if (test "x$with_php" == "xyes"); then
AX_PHP_DEVEL
fi
## (Option) Add SWIG PYTHON ##
AC_ARG_WITH(
[python],
[AS_HELP_STRING([--with-python], [build Python SWIG wrapper])],
[])
AM_CONDITIONAL([WANT_PYTHON], [test "x$with_python" == "xyes"])
if (test "x$with_python" == "xyes"); then
AX_PYTHON_DEVEL([>= '2.1.0'])
fi
## (Option) Add SWIG RUBY ##
AC_ARG_WITH(
[ruby],
[AS_HELP_STRING([--with-ruby], [build Ruby SWIG wrapper])],
[])
AM_CONDITIONAL([WANT_RUBY], [test "x$with_ruby" == "xyes"])
if (test "x$with_ruby" == "xyes"); then
AC_PATH_PROG([RUBY],[ruby])
AX_RUBY_DEVEL([1.8.7])
fi
## (Option) Add SWIG TCL ##
AC_ARG_WITH(
[tcl],
[AS_HELP_STRING([--with-tcl], [build TCL SWIG wrapper])],
[])
AM_CONDITIONAL([WANT_TCL], [test "x$with_tcl" == "xyes"])
if (test "x$with_tcl" == "xyes"); then
AX_PROG_TCL([8.0])
fi
## (Option) Add SWIG CSHARP ##
AC_ARG_WITH(
[csharp],
[AS_HELP_STRING([--with-csharp], [build Csharp SWIG wrapper])],
[])
AM_CONDITIONAL([WANT_CSHARP], [test "x$with_csharp" == "xyes"])
if (test "x$with_csharp" == "xyes"); then
AX_PROG_CSC
fi
## (Option) Add SWIG D ##
AC_ARG_WITH(
[d],
[AS_HELP_STRING([--with-d], [build D SWIG wrapper])],
[])
AM_CONDITIONAL([WANT_D], [test "x$with_d" == "xyes"])
if (test "x$with_d" == "xyes"); then
AC_PATH_PROG([GDC_PATH],[gdc])
fi
##### Output to AM #####
if (test "x$acv_mesa_CLANG" == "xyes"); then
AC_SUBST([AC_CXXFLAGS],["-g3 -O0 $WARN_CXXFLAGS $REL_CXXFLAGS"])
else
AC_SUBST([AC_CXXFLAGS],["-g3 -ggdb -O0 --param ssp-buffer-size=4 $WARN_CXXFLAGS $REL_CXXFLAGS"])
fi
AC_SUBST( [DEPS_CFLAGS],
["$PKGS_CFLAGS $ZMQ_CFLAGS $KRG_CFLAGS $OPENSSL_CFLAGS $BOOST_CPPFLAGS $PTHREAD_CFLAGS"])
AC_SUBST( [DEPS_LIBS],
["$PKGS_LIBS $ZMQ_LIBS $MSG_LIBS $KRG_LIBS $OPENSSL_LDFLAGS $OPENSSL_LIBS -ldl $BOOST_LIB_INCLUDE $PTHREAD_LIBS"])
AC_CONFIG_FILES([Makefile
src/otlib/bigint/Makefile
src/otlib/irrxml/Makefile
src/otlib/lucre/Makefile
src/otlib/protobOT/Makefile
src/otlib/Makefile
src/otapi/Makefile
src/Makefile
src/opentxs.pc])
AC_OUTPUT