-
-
Notifications
You must be signed in to change notification settings - Fork 136
/
configure.ac
executable file
·175 lines (157 loc) · 6.42 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
# Support for older autoconf without m4_esyscmd_s
m4_ifndef([m4_esyscmd_s], [m4_define([m4_chomp_all], [m4_format([[%.*s]], m4_bregexp(m4_translit([[$1]], [/], [/ ]), [/*$]), [$1])])])
m4_ifndef([m4_esyscmd_s], [m4_define([m4_esyscmd_s], [m4_chomp_all(m4_esyscmd([$1]))])])
AC_PREREQ([2.63])
AC_INIT([ebusd], m4_esyscmd_s([cat VERSION]), [[email protected]], [ebusd], [https://github.com/john30/ebusd])
AC_CONFIG_AUX_DIR([build])
AC_CONFIG_MACRO_DIR([m4])
AC_GNU_SOURCE
if test -z "${CXXFLAGS}"; then
CXXFLAGS="-fpic -Wall -Wno-unused-function -Wextra -g -O2"
fi
AC_PROG_CXX([g++-6 g++-5 g++-4.9 g++-4.8 g++])
AX_CXX_COMPILE_STDCXX([11], [ext], [mandatory])
AC_CHECK_HEADERS([arpa/inet.h \
dirent.h \
fcntl.h \
netdb.h \
poll.h \
pthread.h \
sys/ioctl.h \
sys/select.h \
sys/time.h \
syslog.h \
time.h \
termios.h])
AC_CHECK_FUNC([timegm], [AC_DEFINE(HAVE_TIMEGM, [1], [Defined if timegm() is available.])])
AC_CHECK_FUNC([cfsetspeed], [AC_DEFINE(HAVE_CFSETSPEED, [1], [Defined if cfsetspeed() is available.])])
AC_CHECK_LIB([pthread], [pthread_setname_np],
AC_DEFINE([HAVE_PTHREAD_SETNAME_NP], [1], [Defined if pthread_setname_np is available.]),
AC_MSG_RESULT([Could not find pthread_setname_np in pthread.]))
EXTRA_LIBS=
AC_CHECK_LIB([rt], [clock_gettime], [EXTRA_LIBS+="-lrt"])
AC_SUBST(EXTRA_LIBS)
AC_CHECK_FUNC([pselect], [AC_DEFINE(HAVE_PSELECT, [1], [Defined if pselect() is available.])])
AC_CHECK_FUNC([ppoll], [AC_DEFINE(HAVE_PPOLL, [1], [Defined if ppoll() is available.])])
AC_CHECK_HEADER([linux/serial.h], [AC_DEFINE(HAVE_LINUX_SERIAL, [1], [Defined if linux/serial.h is available.])])
AC_CHECK_HEADER([dev/usb/uftdiio.h], [AC_DEFINE(HAVE_FREEBSD_UFTDI, [1], [Defined if dev/usb/uftdiio.h is available.])])
AC_ARG_ENABLE(coverage, AS_HELP_STRING([--enable-coverage], [enable code coverage tracking]), [CXXFLAGS+=" -coverage -O0"], [])
AC_ARG_WITH(contrib, AS_HELP_STRING([--without-contrib], [disable inclusion of contributed sources]), [], [with_contrib=yes])
if test "x$with_contrib" != "xno"; then
AC_DEFINE_UNQUOTED(HAVE_CONTRIB, [1], [Defined if contributed sources are enabled.])
fi
AC_ARG_WITH(docs, AS_HELP_STRING([--with-docs], [generate documentation]), [
AC_CHECK_PROGS([HAVE_DOXYGEN], [doxygen], [])
if test -z "$HAVE_DOXYGEN"; then
AC_MSG_ERROR([Could not find doxygen.])
fi
], [])
AC_ARG_WITH(mqtt, AS_HELP_STRING([--without-mqtt], [disable support for MQTT handling]), [], [with_mqtt=yes])
if test "x$with_mqtt" != "xno"; then
AC_CHECK_LIB([mosquitto], [mosquitto_lib_init],
[AC_DEFINE_UNQUOTED(HAVE_MQTT, [1], [Defined if MQTT handling is enabled.])],
[AC_MSG_RESULT([Could not find mosquitto_lib_init in libmosquitto.])
with_mqtt="no"])
fi
AM_CONDITIONAL([MQTT], [test "x$with_mqtt" != "xno"])
AC_ARG_WITH(knx, AS_HELP_STRING([--without-knx], [disable support for KNX handling]), [], [with_knx=yes])
if test "x$with_knx" != "xno"; then
AC_DEFINE_UNQUOTED(HAVE_KNX, [1], [Defined if KNX handling is enabled.])
AC_ARG_WITH(knxd, AS_HELP_STRING([--with-knxd], [enable support for KNX handling via knxd]), [
AS_IF([test "x$with_knxd" == "xyes"],
[AC_CHECK_LIB([eibclient], [EIBSocketURL],
[AC_DEFINE_UNQUOTED(HAVE_KNXD, [1], [Defined if KNX handling via knxd is enabled.])],
[AC_MSG_RESULT([Could not find EIBSocketURL in libeibclient.])
with_knxd="no"])
])
], [])
fi
AM_CONDITIONAL([KNX], [test "x$with_knx" != "xno"])
AM_CONDITIONAL([KNXD], [test "x$with_knxd" == "xyes"])
AC_ARG_WITH(ssl, AS_HELP_STRING([--without-ssl], [disable support for SSL]), [], [with_ssl=yes])
if test "x$with_ssl" != "xno"; then
AC_CHECK_LIB([ssl], [OPENSSL_init_ssl],
[AC_CHECK_LIB([crypto], [CRYPTO_new_ex_data],
[AC_DEFINE_UNQUOTED(HAVE_SSL, [1], [Defined if SSL is enabled.])],
[AC_MSG_RESULT([Could not find CRYPTO_new_ex_data in libcrypto.])
with_ssl="no"])],
[AC_MSG_RESULT([Could not find SSL_library_init in libssl.])
with_ssl="no"])
fi
AM_CONDITIONAL([SSL], [test "x$with_ssl" != "xno"])
AC_MSG_CHECKING([for direct float format conversion])
AC_TRY_RUN(
[
#include <stdint.h>
int main() {
union {
uint32_t i;
float f;
} test;
test.f = 0.15;
return test.i == 0x3e19999a ? 0 : 1;
}
],
[direct_float=1],
[direct_float=],
[direct_float=no],
)
if [[ "x$direct_float" == "x" ]]; then
AC_TRY_RUN(
[
#include <stdint.h>
int main() {
union {
uint32_t i;
float f;
} test;
test.f = 0.15;
return test.i == 0x9a99193e ? 0 : 1;
}
],
[direct_float=2],
[direct_float=no],
[direct_float=no],
)
fi
if [[ "x$direct_float" == "xno" ]]; then
AC_MSG_RESULT([no])
else
AC_MSG_RESULT([yes])
AC_DEFINE_UNQUOTED([HAVE_DIRECT_FLOAT_FORMAT], $direct_float, [Defined if direct conversion from float to int is available (2 for swapped byte order).])
fi
AC_CONFIG_SRCDIR([src/ebusd/main.cpp])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile
docs/Makefile
src/lib/utils/Makefile
src/lib/ebus/Makefile
src/lib/ebus/test/Makefile
src/ebusd/Makefile
src/tools/Makefile])
AM_CONDITIONAL([CONTRIB], [test "x$with_contrib" != "xno"])
AM_COND_IF([CONTRIB], [AC_CONFIG_FILES([
src/lib/ebus/contrib/Makefile
src/lib/ebus/contrib/test/Makefile
])])
AM_COND_IF([KNX], [AC_CONFIG_FILES([
src/lib/knx/Makefile
])])
AC_DEFINE_UNQUOTED(PACKAGE_PIDFILE, "${localstatedir}/run/${PACKAGE_NAME}.pid", [The path and name of the PID file.])
AC_DEFINE_UNQUOTED(PACKAGE_LOGFILE, "${localstatedir}/log/${PACKAGE_NAME}.log", [The path and name of the log file.])
AC_DEFINE(SCAN_VERSION, "[m4_esyscmd_s([sed -e 's#^\([0-9]*\.[0-9]*\).*#\1#' -e 's#\.\([0-9]\)$#0\1#' -e 's#\.##' VERSION])]", [The version of the package formatted for the scan result.])
AC_DEFINE(PACKAGE_VERSION_MAJOR, [m4_esyscmd_s([sed -e 's#^\([0-9]*\)\..*$#\1#' VERSION])], [The major version of the package.])
AC_DEFINE(PACKAGE_VERSION_MINOR, [m4_esyscmd_s([sed -e 's#^.*\.\([0-9]*\)$#\1#' VERSION])], [The minor version of the package.])
AC_ARG_VAR(GIT_REVISION, [Predefined value to use for revision instead of running git describe.])
if test -n "$GIT_REVISION"; then
AC_DEFINE(REVISION, "[m4_esyscmd_s([echo "$GIT_REVISION"])]", [The revision of the package.])
else
AC_DEFINE(REVISION, "[m4_esyscmd_s([git describe --always 2>/dev/null || (date +p%Y%m%d)])]", [The revision of the package.])
fi
AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$HAVE_DOXYGEN"])
AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([docs/Doxyfile])])
AM_INIT_AUTOMAKE([1.11 -Wall -Werror foreign subdir-objects])
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
AC_PROG_RANLIB
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
AC_OUTPUT