-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
217 lines (174 loc) · 5.75 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
AC_INIT([r3], 2.0.0)
AC_PREREQ([2.64])
AC_USE_SYSTEM_EXTENSIONS
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_MACRO_DIR([m4])
AM_SILENT_RULES([yes])
AM_INIT_AUTOMAKE([foreign subdir-objects])
LT_INIT
AC_PROG_CC
AC_PROG_CC_STDC
AC_PROG_CXX
AC_PROG_INSTALL
AC_HEADER_STDBOOL
# older debian
AC_PROG_LIBTOOL
AM_PROG_CC_C_O
AC_CHECK_HEADERS([stdlib.h string.h sys/time.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_INLINE
AC_TYPE_SIZE_T
# Checks for library functions.
AC_CHECK_FUNCS([gettimeofday memset strchr strdup strndup strstr])
PKG_PROG_PKG_CONFIG
AC_ARG_ENABLE([gcov],
[AS_HELP_STRING([--enable-gcov],
[use Gcov to test the test suite])],
[],
[enable_gcov=no])
AM_CONDITIONAL([COND_GCOV],[test '!' "$enable_gcov" = no])
AC_ARG_WITH([malloc],
AS_HELP_STRING([--without-malloc], [Use the default malloc]))
AS_IF([test "x$with_malloc" == "xjemalloc"],
[AC_CHECK_HEADERS([jemalloc/jemalloc.h], [
found_jemalloc=yes; break
])])
if test "x$found_jemalloc" == "xyes" ; then
AC_MSG_CHECKING([Checking jemalloc version])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <jemalloc/jemalloc.h>]],
[[
#ifdef JEMALLOC_VERSION_MAJOR > 2
return 0;
#endif
return 1;
]])],
[
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED([USE_JEMALLOC], 1, [Define to 1 if you have the PATH_MAX macro.])
have_jemalloc=yes
],
[
AC_MSG_RESULT([no])
AC_DEFINE_UNQUOTED([USE_JEMALLOC], 0, [Define to 1 if you have the PATH_MAX macro.])
have_jemalloc=no
]
)
fi
AM_CONDITIONAL(USE_JEMALLOC, test "x$have_jemalloc" = "xyes")
# AM_CONDITIONAL(USE_JEMALLOC, test "x$found_jemalloc" = "xyes")
# AC_DEFINE(USE_JEMALLOC, test "x$found_jemalloc" = "xyes" , "use jemalloc")
AC_ARG_WITH(cc-opt, [
--with-cc-opt= cc set additional C compiler options
],[
R3_CC_OPT="$withval"
],[
R3_CC_OPT=""
])
AC_ARG_WITH(ld-opt, [
--with-ld-opt= cc set additional C link options
],[
R3_LD_OPT="$withval"
],[
R3_LD_OPT=""
])
AC_SUBST(R3_CC_OPT)
AC_SUBST(R3_LD_OPT)
AC_ARG_WITH(pcre, [
--with-pcre=PATH Enable pcre support. PATH is location of pcre-config.
Default is to enable and look for pcre-config in your
$PATH
--without-pcre Don't enable pcre support
],[
],[
pcre_config="check"
])
AS_ECHO(["with_pcre=$with_pcre, withval=$withval"])
# --with-pcre
if test "x$with_pcre" != "x" -a "x$withval" != "xyes" ; then
pcre_config=$withval
fi
# --without-pcre
if test "x$with_pcre" == "xno" ; then
pcre_config="no"
fi
AS_ECHO(["pcre_config=$pcre_config"])
if test "x$pcre_config" != "xno" ; then
AS_ECHO(["pcre_config=$pcre_config"])
if test "$pcre_config" = "check"; then
AC_PATH_PROG(PCRE_CONFIG_PATH, pcre-config, false)
dnl If --with-pcre was specified but pcre-config not found, fail hard now.
if test "$pcre_config" = "yes" -a "$PCRE_CONFIG_PATH" = "false"; then
AC_MSG_FAILURE([--with-pcre was given, but pcre-config not found in PATH])
fi
else
PCRE_CONFIG_PATH="$pcre_config"
fi
AC_MSG_CHECKING(for PCRE using $PCRE_CONFIG_PATH)
pcre_version=`"$PCRE_CONFIG_PATH" --version 2>/dev/null`
if test $? -ne 0; then
AC_MSG_RESULT(failed)
else
AC_MSG_RESULT($pcre_version)
fi
if test -n "$pcre_version"; then
DEPS_LIBS=`$PCRE_CONFIG_PATH --libs`
DEPS_CFLAGS=`$PCRE_CONFIG_PATH --cflags`
AC_SUBST(DEPS_LIBS)
AC_SUBST(DEPS_CFLAGS)
AC_CHECK_HEADERS(pcre.h, [], [
if test "$pcre_config" != "check"; then
AC_MSG_FAILURE([--with-pcre was given, but pcre not found:
pcre-config --libs=$PCRE_LIBS
pcre-config --cflags=$PCRE_CFLAGS])
fi
])
elif test "$pcre_config" != "check"; then
AC_MSG_FAILURE([$PCRE_CONFIG_PATH failed to run, could not check for PCRE])
fi
fi
#AS_ECHO(["DEPS_LIBS = $DEPS_LIBS"])
AC_ARG_ENABLE(debug,AS_HELP_STRING([--enable-debug],[enable debug]))
if test "x$enable_debug" = "xyes"; then
AC_DEFINE(DEBUG, 1, "debug")
fi
AM_CONDITIONAL(ENABLE_DEBUG, test "x$enable_debug" = "xyes")
AC_ARG_ENABLE(graphviz, AS_HELP_STRING([--enable-graphviz],[enable graphviz support]))
if test "x$enable_graphviz" = "xyes" ; then
PKG_CHECK_MODULES(GVC_DEPS, [libgvc])
AC_SUBST(GVC_DEPS_CFLAGS)
AC_SUBST(GVC_DEPS_LIBS)
AC_DEFINE(ENABLE_GRAPHVIZ, 1, "whether graphviz is enable")
fi
AM_CONDITIONAL(ENABLE_GRAPHVIZ, test "x$enable_graphviz" = "xyes")
AC_ARG_ENABLE(json, AS_HELP_STRING([--enable-json],[enable json encoder]))
if test "x$enable_json" = "xyes"; then
PKG_CHECK_MODULES(JSONC, [json-c])
AC_SUBST(JSONC_CFLAGS)
AC_SUBST(JSONC_LIBS)
AC_DEFINE(ENABLE_JSON, 1, [enable json])
fi
AM_CONDITIONAL(ENABLE_JSON, test "x$enable_json" = "xyes")
# This does not work because configure does not look into /opt/local/include...
# AC_CHECK_HEADERS([check.h],[ enable_check=yes ],[ enable_check=unset ])
AC_ARG_ENABLE(check,
AS_HELP_STRING([--enable-check],
[enable unit testing]),
, enable_check=unset)
if test "x$enable_check" != "xunset" ; then
PKG_CHECK_MODULES(CHECK,[check >= 0.9.4],:,[
ifdef([AM_PATH_CHECK],
[AM_PATH_CHECK(,[have_check="yes"])],
AC_MSG_WARN([Check not found; cannot run unit tests!])
[have_check="no"]
)]
])
fi
AM_CONDITIONAL(ENABLE_CHECK, test "x$enable_check" = "xyes")
AC_CONFIG_FILES([
r3.pc
Makefile
src/Makefile
tests/Makefile
examples/Makefile
])
AC_OUTPUT