This repository has been archived by the owner on Oct 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
201 lines (184 loc) · 5.9 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
# _____ ____ __
# __ ____ _ / _/ |/ / //_/
# / // / ' \_/ // / ,<
# \_,_/_/_/_/___/_/|_/_/|_|
#
# SPDX-License-Identifier: MIT
#
AC_PREREQ([2.68])
AC_INIT([umink],
m4_esyscmd([scripts/git-version-gen .tarball-version]),
[[email protected]], ,
[https://github.com/link-mink/umink])
config_flags="$*"
AC_DEFINE_UNQUOTED([CONFIG_FLAGS],["$config_flags"],[Flags passed to configure])
AC_SUBST(CONFIG_FLAGS, "$config_flags")
AM_INIT_AUTOMAKE([foreign subdir-objects nostdinc 1.14])
AC_CONFIG_SRCDIR([src/services/sysagent/sysagentd.c])
AC_CONFIG_HEADERS([config.h])
AX_PREFIX_CONFIG_H(umink_pkg_config.h)
AC_CONFIG_MACRO_DIR([m4])
AC_LANG([C])
AC_USE_SYSTEM_EXTENSIONS
AC_PROG_CC
AC_PROG_CC_C99
AC_PROG_AWK
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_RANLIB
AC_PROG_SED
AC_CHECK_PROG(GPERF, gperf, gperf)
AS_IF([test -z "$GPERF"], [AC_MSG_ERROR([gperf not found!])])
PKG_PROG_PKG_CONFIG
LT_INIT
# save libs
COMMON_LIBS=$LIBS
# /*********************/
# /* enable DEBUG mode */
# /*********************/
AC_ARG_ENABLE(debug,
[AS_HELP_STRING([--enable-debug], [enable DEBUG mode [default=no]])],,
[enable_debug=no])
AM_CONDITIONAL(ENABLE_DEBUG, test "x$enable_debug" = "xyes")
# /***********************************/
# /* disable RT threads (SCHED_FIFO) */
# /***********************************/
AC_ARG_ENABLE(sched-fifo,
[AS_HELP_STRING([--enable-sched-fifo], [Enable SCHED_FIFO scheduling [default=no]])],,
[enable_sched_fifo=no])
AM_CONDITIONAL(ENABLE_SCHED_FIFO, test "x$enable_sched_fifo" = "xyes")
if test "x$enable_sched_fifo" != "xno"; then
AC_DEFINE([ENABLE_SCHED_FIFO], [1], [Enable SCHED_FIFO scheduling])
fi
# /*******/
# /* Lua */
# /*******/
AC_ARG_ENABLE(lua,
[AS_HELP_STRING([--enable-lua], [Enable Lua [default=no]])],,
[enable_lua=no])
AM_CONDITIONAL(ENABLE_LUA, test "x$enable_lua" = "xyes")
if test "x$enable_lua" != "xno"; then
PKG_CHECK_MODULES([LUA], [lua >= 5.1], [], [AC_MSG_ERROR([Lua not found!])])
AC_DEFINE([ENABLE_LUA], [1], [Enable Lua])
fi
# /********/
# /* MQTT */
# /********/
AC_ARG_ENABLE(mqtt,
[AS_HELP_STRING([--enable-mqtt], [Enable MQTT [default=no]])],,
[enable_mqtt=no])
AM_CONDITIONAL(ENABLE_MQTT, test "x$enable_mqtt" = "xyes")
if test "x$enable_mqtt" != "xno"; then
AC_DEFINE([ENABLE_MQTT], [1], [Enable MQTT])
AC_CHECK_LIB([paho-mqtt3as],
[MQTTAsync_create],
[AC_SUBST([MQTT_LIBS], ["-lpaho-mqtt3as"])],
[AC_MSG_ERROR([paho-mqtt3as library not found!])])
fi
# /*************************/
# /* Mosquitto Auth plugin */
# /*************************/
AC_ARG_ENABLE(mosquitto-auth,
[AS_HELP_STRING([--enable-mosquitto-auth], [Enable Mosquitto Auth [default=no]])],,
[enable_mosquitto_auth=no])
AM_CONDITIONAL(ENABLE_MOSQUITTO_AUTH, test "x$enable_mosquitto_auth" = "xyes")
if test "x$enable_mosquitto_auth" != "xno"; then
AC_DEFINE([ENABLE_MOSQUITTO_AUTH], [1], [Enable Mosquitto Auth])
AC_CHECK_HEADERS([mosquitto.h mosquitto_plugin.h], ,AC_MSG_ERROR([mosquitto headers not found!]))
AC_CHECK_LIB([sqlite3],
[sqlite3_open],
[AC_SUBST([SQLITE_LIBS], ["-lsqlite3"])],
[AC_MSG_ERROR([sqlite3 library not found!])])
fi
# /******/
# /* rt */
# /******/
AC_CHECK_LIB([rt], [clock_gettime], , AC_MSG_ERROR([clock_gettime not found!]))
# /******/
# /* lm */
# /******/
AC_CHECK_LIB([m], [pow], , AC_MSG_ERROR([libm not found!]))
# /***********/
# /* pthread */
# /***********/
AC_CHECK_LIB([pthread],
[pthread_create], ,
AC_MSG_ERROR([pthread library not found!]))
# /**********/
# /* json-c */
# /**********/
PKG_CHECK_MODULES([JSON_C], [json-c], [], [AC_MSG_ERROR([json-c not found!])])
# /****************************/
# /* Checks for header files. */
# /****************************/
AC_CHECK_HEADERS([ arpa/inet.h \
fcntl.h \
inttypes.h \
locale.h \
netdb.h \
netinet/in.h \
stddef.h \
stdint.h \
stdlib.h \
string.h \
strings.h \
sys/ioctl.h \
sys/socket.h \
sys/time.h \
sys/timeb.h \
syslog.h \
pthread.h \
unistd.h], , AC_MSG_ERROR([Header file missing!]))
# /******************************************************************/
# /* Checks for typedefs, structures, and compiler characteristics. */
# /******************************************************************/
AC_C_INLINE
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_INT8_T
AC_TYPE_MODE_T
AC_TYPE_OFF_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T
# /*********************************/
# /* Checks for library functions. */
# /*********************************/
AC_FUNC_ERROR_AT_LINE
AC_FUNC_FORK
AC_FUNC_MALLOC
AC_FUNC_MKTIME
AC_FUNC_STRNLEN
AC_FUNC_STRTOD
AC_CHECK_FUNCS([alarm \
atexit \
bzero \
gethostname \
gettimeofday \
inet_ntoa \
isascii \
localtime_r \
memmove \
memset \
mkdir \
mkfifo \
pow \
select \
poll \
setenv \
socket \
strchr \
strdup \
strerror \
strncasecmp \
strstr \
strtoul \
strtoull \
sysinfo], , AC_MSG_ERROR([System function missing!]))
AC_CONFIG_FILES([Makefile])
AC_OUTPUT