-
Notifications
You must be signed in to change notification settings - Fork 37
/
configure.ac
218 lines (182 loc) · 5.81 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
CALAOS_VERSION
AC_INIT([calaos],[calaos_version],[[email protected]])
AC_PREREQ([2.71])
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE([tar-ustar 1.6 dist-xz subdir-objects foreign])
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_USE_SYSTEM_EXTENSIONS
AC_SYS_LARGEFILE
LT_PREREQ([2.2])
LT_INIT([win32-dll])
AM_GNU_GETTEXT_VERSION([0.19])
m4_ifdef([AM_GNU_GETTEXT], [
AM_GNU_GETTEXT([external])
po_makefile_in=po/Makefile.in
have_po="yes"
],[
have_po="no"
])
AC_SUBST(LTLIBINTL)
if test "x${POSUB}" = "x" ; then
have_po="no"
fi
AM_CONDITIONAL([HAVE_PO], [test "x${have_po}" = "xyes"])
### Needed information
AC_CANONICAL_BUILD
AC_CANONICAL_HOST
### Checks for programs
AC_PROG_CXX
AC_PROG_CC
AM_PROG_CC_C_O
AX_CXX_COMPILE_STDCXX_14([noext],[mandatory])
# pkg-config
PKG_PROG_PKG_CONFIG
### Checks for libraries
requirements_calaos_common="libuv >= 1.19.0 sigc++-2.0 >= 2.4.1 jansson >= 2.5 libcurl >= 7.20.0 luajit sqlite3"
PKG_CHECK_MODULES([CALAOS_COMMON], [${requirements_calaos_common}])
AC_SUBST([requirements_calaos_common])
requirements_calaos_server="libuv >= 1.19.0 libcurl"
PKG_CHECK_MODULES([CALAOS_SERVER], [${requirements_calaos_server}])
AC_SUBST([requirements_calaos_server])
CALAOS_COMMON_LIBS="${CALAOS_COMMON_LIBS} ${LUA_LIBS} ${lua_libs}"
CALAOS_COMMON_CFLAGS="${CALAOS_COMMON_CFLAGS} ${LUA_CFLAGS}"
### Checks for compiler characteristics
AC_C_BIGENDIAN
AC_C_INLINE
### Checks for linker characteristics
lt_enable_auto_import=""
case "${host_os}" in
mingw*)
lt_enable_auto_import="-Wl,--enable-auto-import"
;;
esac
AC_SUBST([lt_enable_auto_import])
EFL_CHECK_COMPILER_FLAGS([CALAOS_COMMON], [-Wall -Wextra -Wno-unused-parameter -Wshadow -Wpointer-arith -Wno-missing-field-initializers -fvisibility=hidden -fdata-sections -ffunction-sections])
### Checks for header files
AC_HEADER_ASSERT
AC_CHECK_HEADERS([unistd.h])
have_owcapi="no"
AC_CHECK_HEADERS([owcapi.h], [have_owcapi="yes"])
AM_CONDITIONAL([HAVE_OWCAPI], [test "x${have_owcapi}" = "xyes"])
if test "x${have_owcapi}" == "xyes"
then
AC_CHECK_LIB([owcapi], [OW_init],, AC_MSG_ERROR(Missing owfs library))
fi
have_libola="no"
PKG_CHECK_MODULES([LIBOLA], [libola], [have_libola="yes"], [have_libola="no"])
AM_CONDITIONAL([HAVE_LIBOLA], [test "x${have_libola}" = "xyes"])
if test "x${have_libola}" == "xyes"
then
AC_DEFINE([HAVE_LIBOLA], [1], [libola])
fi
have_libknx="no"
AC_CHECK_HEADERS([eibclient.h], [have_libknx="yes"])
AM_CONDITIONAL([HAVE_LIBKNX], [test "x${have_libknx}" = "xyes"])
if test "x${have_libknx}" == "xyes"
then
AC_CHECK_LIB([eibclient], [EIBSocketLocal],, AC_MSG_ERROR(Missing eibclient library))
AC_DEFINE([HAVE_LIBKNX], [1], [libknx])
fi
AC_CHECK_PROG(HAVE_CURLBIN, [curl], ["yes"])
if test "x${HAVE_CURLBIN}" == "xyes"
then
CURLBIN_INFO="yes"
else
CURLBIN_INFO="No, install curl binary before running calaos_server"
fi
AC_CHECK_PROG(HAVE_CONVERT, [convert], ["yes"])
if test "x${HAVE_CONVERT}" == "xyes"
then
CONVERT_INFO="yes"
else
CONVERT_INFO="No, install imagemagick convert tool"
fi
have_mosquitto="no"
AC_CHECK_HEADERS([mosquitto.h], [have_mosquitto="yes"])
AM_CONDITIONAL([HAVE_LIBMOSQUITTO], [test "x${have_mosquitto}" = "xyes"])
if test "x${have_mosquitto}" == "xyes"
then
AC_CHECK_LIB([mosquitto], [mosquitto_lib_init],, AC_MSG_ERROR(Missing mosquitto library))
AC_DEFINE([HAVE_LIBMOSQUITTO], [1], [libmosquitto])
fi
# Configure pthreads.
ACX_PTHREAD([have_pthread=yes])
#check for gtest
AC_LANG_PUSH([C++])
AC_CHECK_HEADERS([gtest/gtest.h], [have_gtest="yes"])
AM_CONDITIONAL([HAVE_GTEST], [test "x${have_gtest}" = "xyes"])
AC_LANG_POP([C++])
if test "x${have_gtest}" == "xyes"
then
GTEST_INFO="make check"
else
GTEST_INFO="install gtest to run this test"
fi
#check for autobahn test suite
AC_CHECK_PROG(HAVE_AUTOBAHN, wstest, yes)
AM_CONDITIONAL([HAVE_AUTOBAHN], [test "x${HAVE_AUTOBAHN}" = "xyes"])
if test "x${HAVE_AUTOBAHN}" == "xyes"
then
WS_INFO="make check"
else
WS_INFO="install autobahn testsuite to run this test"
fi
AC_CONFIG_FILES([
Makefile
tests/Makefile
src/Makefile
src/lib/Makefile
src/bin/Makefile
src/bin/calaos_server/Makefile
src/bin/tools/Makefile
data/Makefile
data/debug/Makefile
data/debug/dist/Makefile
$po_makefile_in
])
AC_OUTPUT
#####################################################################
## Info
function colorOut()
{
if test "x${1}" == "xyes"
then
echo -n $(tput setaf 2)${1}$(tput sgr0)
else
echo -n $(tput setaf 1)$@$(tput sgr0)
fi
}
echo
echo
echo "------------------------------------------------------------------------"
echo "$PACKAGE $VERSION"
echo "------------------------------------------------------------------------"
echo
echo
echo "Configuration Options Summary:"
echo
echo "Compilation............................: make (or gmake)"
echo " CPPFLAGS.............................: $CPPFLAGS"
echo " CFLAGS...............................: $CFLAGS"
echo " CXXFLAGS.............................: $CXXFLAGS"
echo " LDFLAGS..............................: $LDFLAGS"
echo
echo "Test Suite:"
echo " gtest library........................: $GTEST_INFO"
echo " Autobahn Websocket test suite........: $WS_INFO"
echo
echo "Installation...........................: make install (as root if needed, with 'su' or 'sudo')"
echo " prefix...............................: $prefix"
echo
echo "Dependencies:"
echo " UrlDownloader curl support...........: $(colorOut $CURLBIN_INFO)"
echo " UrlDownloader picture resizing.......: $(colorOut $CONVERT_INFO)"
echo
echo "Hardware support:"
echo " One Wire support.....................: $(colorOut $have_owcapi)"
echo " Open Lightning Architecture support..: $(colorOut $have_libola)"
echo " Eib/KNX support (eibd or knxd).......: $(colorOut $have_libknx)"
echo " MQTT support (libmosquittopp)........: $(colorOut $have_mosquitto)"
echo