-
Notifications
You must be signed in to change notification settings - Fork 31
/
configure.ac
162 lines (143 loc) · 4.35 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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([clboss], [0.14.1], [[email protected]])
AC_CONFIG_AUX_DIR([auxdir])
AM_INIT_AUTOMAKE([subdir-objects tar-ustar])
AC_CONFIG_SRCDIR([main.cpp])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIRS([m4])
LT_INIT([disable-shared])
m4_pattern_forbid([^PKG_])
# Enable exception backtrace option
AC_ARG_ENABLE([exception-backtrace],
[AS_HELP_STRING([--disable-exception-backtrace],
[Disable exception backtrace in exceptions (enabled by default)])],
[case "${enable_exception_backtrace}" in
yes|no) ;;
*) AC_MSG_ERROR([invalid value for --enable-exception-backtrace: ${enable_exception_backtrace}]) ;;
esac],
[enable_exception_backtrace=yes]) # Default to "yes"
AM_CONDITIONAL([ENABLE_EXCEPTION_BACKTRACE], [test "x$enable_exception_backtrace" = "xyes"])
AC_SUBST([ENABLE_EXCEPTION_BACKTRACE], [$enable_exception_backtrace])
# Define a macro in config.h
if test "x$enable_exception_backtrace" = "xyes"; then
AC_DEFINE([ENABLE_EXCEPTION_BACKTRACE], [1], [Define if exception backtraces are enabled])
else
AC_DEFINE([ENABLE_EXCEPTION_BACKTRACE], [0], [Define if exception backtraces are enabled])
fi
# Checks for programs.
# If CXXFLAGS is unset, remove the -g
# that AC_PROG_CXX adds to it.
clboss_set_CXXFLAGS=${CXXFLAGS+y}
AC_PROG_CXX
AS_IF([test ${clboss_set_CXXFLAGS}], [
# AC_PROG_CXX will respect the user-given CXXFLAGS
:
],[
# AC_PROG_CXX will default to `-g -O2` if g++,
# or `-g` otherwise.
AS_IF([test x"$GXX" = x"yes"], [
CXXFLAGS="-O2"
], [
CXXFLAGS=""
])
])
AX_CXX_COMPILE_STDCXX([17])
AC_LANG([C++])
AC_PROG_AWK
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AX_VALGRIND_CHECK()
AM_CONDITIONAL([USE_VALGRIND], [test x"$enable_valgrind" = xyes])
# Checks for libraries.
AX_PTHREAD([:],[
AC_MSG_ERROR([Need pthread.])
])
AX_LIB_EV
PKG_CHECK_MODULES([SQLITE3], [sqlite3 >= 3.0.0])
AX_LIB_CURL(,[:],[
AC_MSG_ERROR([Need libcurl.])
])
# Check for libunwind
PKG_CHECK_MODULES([LIBUNWIND], [libunwind], [
AC_DEFINE([HAVE_LIBUNWIND], [1], [Define if libunwind is available])
], [
AC_MSG_ERROR([libunwind is required but not found])
])
# https://github.com/ZmnSCPxj/clboss/issues/245
case "$host_os" in
*alpine*)
LDFLAGS="$LDFLAGS -lexecinfo"
;;
esac
AC_SUBST(LDFLAGS)
# Checks for header files.
# Checks for typedefs, structures, and compiler characteristics.
CLBOSS_CXXFLAGS=''
AC_SUBST([CLBOSS_CXXFLAGS])
# Determine if compiling ev.h succeeds with -Wno-noexcept-type
# On FreeBSD ev.h compilation fails without this flag.
AC_MSG_CHECKING([if compiler compiles ev.h with -Wno-noexcept-type])
saved_CXXFLAGS="${CXXFLAGS}"
CXXFLAGS="${CXXFLAGS} ${libev_CFLAGS} -Wno-noexcept-type"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
#include<ev.h>
]])], [ # then
CLBOSS_CXXFLAGS="${CLBOSS_CXXFLAGS} -Wno-noexcept-type"
AC_MSG_RESULT([yes])
], [ # else
AC_MSG_RESULT([no])
])
CXXFLAGS="${saved_CXXFLAGS}"
# Determine if the compiler supports __attribute__((format (printf, 2, 3)))
AC_MSG_CHECKING([[if compiler supports __attribute__((format))]])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
int fake_printf(void* dummy, char const* fmt, ...)
__attribute__((format (printf, 2, 3)));
]])], [# then
AC_DEFINE([HAVE_ATTRIBUTE_FORMAT], [1], [Define if understands gcc __attribute__((format))])
AC_MSG_RESULT([yes])
], [ # else
AC_MSG_RESULT([no])
])
# Checks for library functions.
# Check for Posix gmtime_r.
AC_MSG_CHECKING([for gmtime_r])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include<time.h>
]], [[
time_t timeval = 0;
struct tm split;
struct tm* psplit;
psplit = gmtime_r (&timeval, &split);
]])], [ #then
AC_DEFINE([HAVE_GMTIME_R], [1],
[Define to 1 if you have a gmtime_r function.])
AC_MSG_RESULT([yes])
], [ #else
AC_MSG_RESULT([no])
])
# Check for getprogname()
AC_MSG_CHECKING([for getprogname])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include<stdlib.h>
]], [[
const char* p = getprogname();
(void)p; // avoid warning about set but unused variable
]])], [ #then
AC_DEFINE([HAVE_GETPROGNAME], [1],
[Define to 1 if you have a getprogname function.])
AC_MSG_RESULT([yes])
], [ #else
AC_MSG_RESULT([no])
])
AC_CONFIG_FILES([Makefile
external/bitcoin-ripemd160/Makefile
external/bitcoin-sha256/Makefile
])
AC_CONFIG_SUBDIRS([external/basicsecure
external/secp256k1
])
AC_OUTPUT