forked from project-hatohol/hatohol
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
284 lines (239 loc) · 8.93 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
AC_PREREQ(2.63)
AC_INIT(hatohol, 15.06_dev)
AM_INIT_AUTOMAKE([1.9 foreign no-dist-gzip dist-bzip2 tar-pax])
AC_CONFIG_HEADER(config.h)
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
AC_PROG_CXX
AC_CONFIG_MACRO_DIR([m4])
AM_SILENT_RULES([yes])
if test x"$prefix" = x"NONE"; then
prefix=$ac_default_prefix
fi
AC_DEFINE_UNQUOTED(PREFIX, "$prefix", "Prefix for install directory")
if test x"$sysconfdir" = x"NONE"; then
sysconfdir=$ac_default_sysconfdir
fi
expanded_sysconfdir="`eval echo $sysconfdir`"
AC_DEFINE_UNQUOTED(SYSCONFDIR, "$expanded_sysconfdir", "Data directory.")
AC_SUBST(expanded_sysconfdir)
if test x"$localstatedir" = x"NONE"; then
runstatedir=$ac_default_localstatedir
fi
expanded_localstatedir="`eval echo $localstatedir`"
AC_DEFINE_UNQUOTED(LOCALSTATEDIR, "$expanded_localstatedir", "Local state directory.")
expanded_pkglocaldatadir="$expanded_localstatedir/lib/$PACKAGE"
AC_SUBST(expanded_pkglocaldatadir)
if test x"$exec_prefix" = x"NONE"; then
exec_prefix=$prefix
fi
AC_DEFINE_UNQUOTED(LIBEXECDIR, "`eval echo $libexecdir`", "Prefix for libexec directory")
dnl **************************************************************
dnl Optional C++ compiler flags
dnl **************************************************************
OPT_CXXFLAGS="-Wall -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"
enable_debug_default=no
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],
[Enable debug build (default is $enable_debug_default)])],
[],
[enable_debug=$enable_debug_default])
if test "$enable_debug" = "yes"; then
CXXFLAGS="$CXXFLAGS -O0 -g3"
else
CXXFLAGS="$CXXFLAGS -O2 -g3"
fi
dnl **************************************************************
dnl Checks for GLib
dnl **************************************************************
GLIB_REQUIRED=2.22
PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_REQUIRED)
PKG_CHECK_MODULES(GIO, gio-2.0 >= $GLIB_REQUIRED)
GTHREAD_REQUIRED=2.22
PKG_CHECK_MODULES(GTHREAD, gthread-2.0 >= $GTHREAD_REQUIRED)
dnl **************************************************************
dnl Checks for libsoup
dnl **************************************************************
LIBSOUP_REQUIRED=2.22
PKG_CHECK_MODULES(LIBSOUP, libsoup-2.4 >= $LIBSOUP_REQUIRED)
dnl **************************************************************
dnl Checks for libjson-glib
dnl **************************************************************
JSON_GLIB_REQUIRED=0.12.0
PKG_CHECK_MODULES(JSON_GLIB, json-glib-1.0 >= $JSON_GLIB_REQUIRED)
dnl **************************************************************
dnl Checks for SQLite3
dnl **************************************************************
SQLITE3_REQUIRED=3.6.0
PKG_CHECK_MODULES(SQLITE3, sqlite3 >= $SQLITE3_REQUIRED)
dnl **************************************************************
dnl Checks for uuid
dnl **************************************************************
UUID_REQUIRED=2.17
PKG_CHECK_MODULES(UUID, uuid >= $UUID_REQUIRED)
dnl **************************************************************
dnl Checks for librabbitmq
dnl **************************************************************
LIBRABBITMQ_REQUIRED=0.4.1
PKG_CHECK_MODULES(LIBRABBITMQ,
librabbitmq >= $LIBRABBITMQ_REQUIRED,
[have_librabbitmq=yes],
[have_librabbitmq=no])
if test "$have_librabbitmq" = "yes"; then
AC_DEFINE(HAVE_LIBRABBITMQ, 1, [Define to 1 if you have librabbitmq])
fi
AM_CONDITIONAL([HAVE_LIBRABBITMQ], [test "$have_librabbitmq" = "yes"])
dnl **************************************************************
dnl Checks for libdl
dnl **************************************************************
DL_FUNCTIONS="[dlopen, dlclose, dlerror, dlsym]"
AC_CHECK_LIB([dl], $DL_FUNCTIONS, [],
[AC_MSG_ERROR([Could not found '$DL_FUNCTIONS' in dlfcn.h.])])
dnl **************************************************************
dnl Checks for MySQL
dnl **************************************************************
AC_CHECK_PROGS(MYSQL_CONFIG, mysql_config)
MYSQL_CFLAGS=`$MYSQL_CONFIG --cflags`
MYSQL_LIBS=`$MYSQL_CONFIG --libs`
hatohol_save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS $MYSQL_CFLAGS"
AC_TRY_COMPILE([#include <mysql_version.h>],
[int version = MYSQL_VERSION_ID;], [],
[AC_MSG_ERROR([You don't have mysql_version.h. Please install development package of MySQL.])])
CFLAGS=$hatohol_save_CFLAGS
AC_SUBST(MYSQL_CFLAGS)
AC_SUBST(MYSQL_LIBS)
dnl **************************************************************
dnl Check libraries for C++
dnl **************************************************************
AC_LANG_PUSH([C++])
dnl **************************************************************
dnl Flag setting for MLPL
dnl **************************************************************
MLPL_CFLAGS=-I\${abs_top_srcdir}/server/mlpl/src
MLPL_LIBS=\${top_builddir}/server/mlpl/src/libmlpl.la
AC_SUBST(MLPL_CFLAGS)
AC_SUBST(MLPL_LIBS)
dnl **************************************************************
dnl Check for Apache Qpid
dnl **************************************************************
dnl The Qpid's functions are C++ mangled (such as
dnl _ZN4qpid9messaging10Connection4openEv) in the library. So enumeration of
dnl them degrades portability. We just pass '_init' in the following macro.
AC_CHECK_LIB(qpidmessaging, _init, [],
[AC_MSG_ERROR(libqpidmessage was not found.)])
AC_CHECK_HEADERS(qpid/ImportExport.h,
[], [AC_MSG_ERROR([qpid/ImportExport.h was not found. The file is contained in libqpidcommon2-dev on Ubuntu.])])
AC_CHECK_HEADERS(qpid/types/Exception.h,
[], [AC_MSG_ERROR([qpid/types/Exception.h was not found. The file is contained in libqpidtypes1-dev on Ubuntu.])])
AC_LANG_POP([C++])
dnl **************************************************************
dnl Checks for Cutter
dnl **************************************************************
CUTTER_REQUIRED=1.2.3
have_cutter=no
m4_ifdef([AC_CHECK_GCUTTER], [
AC_CHECK_GCUTTER(>= $CUTTER_REQUIRED)
],
[ac_cv_use_cutter="no"])
if test "$ac_cv_use_cutter" != "no"; then
m4_ifdef([AC_CHECK_CPPCUTTER], [
AC_CHECK_CPPCUTTER(>= $CUTTER_REQUIRED)
],
[ac_cv_use_cutter="no"])
fi
AM_CONDITIONAL([WITH_CUTTER], [test "$ac_cv_use_cutter" != "no"])
if test "$ac_cv_use_cutter" != "no"; then
AC_CHECK_PROG([have_sqlite3], [sqlite3], [yes], [no])
if test "$have_sqlite3" = "no"; then
AC_MSG_ERROR([You don't have sqlite3 command. It's required to generate test data.])
fi
AC_DEFINE(WITH_CUTTER, 1, [Define to 1 if you use Cutter])
have_cutter=yes
fi
m4_ifdef([AC_CHECK_COVERAGE], [AC_CHECK_COVERAGE])
if test "$cutter_enable_coverage" = "yes" -a -z "$COVERAGE_LIBS"; then
# old cutter doesn't have it
COVERAGE_LIBS="-lgcov"
fi
AC_SUBST(COVERAGE_LIBS)
dnl **************************************************************
dnl enable C++11
dnl **************************************************************
AC_ARG_ENABLE([cpp11],
[AS_HELP_STRING([--enable-cpp11], [Enable C++11 features (default is yes)])],
[],
[enable_cpp11=yes])
if test "$enable_cpp11" == "yes"; then
AC_DEFINE(USE_CPP11, 1, [Define to 1 if you use C++11])
OPT_CXXFLAGS+=" -std=c++11"
AC_SUBST(OPT_CXXFLAGS)
fi
dnl **************************************************************
dnl Mocha, expect.js, and npm (indirectly node.js)
dnl **************************************************************
have_js_test_tools=yes
AC_CHECK_PROG([have_mocha], [mocha], [yes], [no])
AC_CHECK_PROG([have_npm], [npm], [yes], [no])
have_expect_js=no
if test "$have_npm" = "yes"; then
expect_js_ver=`npm ls -g | grep expect.js | awk '{ print $2 }' FS=@`
if test x"$expect_js_ver" != x; then
have_expect_js=yes
fi
mocha_ver=`npm ls -g | grep mocha | awk '{ print $2 }' FS=@`
fi
if test "$have_mocha" = "no"; then
have_js_test_tools=no
fi
if test "$have_npm" = "no"; then
have_js_test_tools=no
fi
if test "$have_expect_js" = "no"; then
have_js_test_tools=no
fi
AM_CONDITIONAL([WITH_JS_TEST], [test "$have_js_test_tools" = "yes"])
dnl **************************************************************
dnl Results
dnl **************************************************************
AC_OUTPUT([
Makefile
hatohol.spec
client/static/js/hatohol_version.js
data/Makefile
data/init.d/Makefile
data/init.d/debian/hatohol.debian
data/init.d/debian/Makefile
data/init.d/centos/hatohol.centos
data/init.d/centos/Makefile
data/systemd/Makefile
data/systemd/generate_service_file.sh
data/test/Makefile
server/Makefile
server/mlpl/Makefile
server/mlpl/src/Makefile
server/mlpl/test/Makefile
server/mlpl/mlpl.pc
server/common/Makefile
server/src/Makefile
server/hap/Makefile
server/data/Makefile
server/tools/Makefile
server/tools/hatohol-db-initiator
server/tools/hatohol/Makefile
server/tools/tls/Makefile
server/tools/tls/hatohol-ca-initialize
server/tools/tls/hatohol-ca-sign-client-certificate
server/tools/tls/hatohol-ca-sign-server-certificate
server/test/Makefile
server/test/fixtures/Makefile
server/benchmark/Makefile
client/Makefile
client/test/Makefile
])
echo
echo "Configure Result:"
echo
echo " C Unit test (cutter) : ${have_cutter}"
echo " JS Unit test : ${have_js_test_tools}"
echo