forked from eclipse-paho/paho.mqtt.cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
218 lines (177 loc) · 6.59 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
#*******************************************************************************
# Copyright (c) 2016
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# and Eclipse Distribution License v1.0 which accompany this distribution.
#
# The Eclipse Public License is available at
# http://www.eclipse.org/legal/epl-v10.html
# and the Eclipse Distribution License is available at
# http://www.eclipse.org/org/documents/edl-v10.php.
#
# Contributors:
# Guilherme Maciel Ferreira - initial contribuition
#*******************************************************************************/
###############################################################################
# Autotools setup
###############################################################################
AC_PREREQ([2.65])
AC_INIT([paho.mqtt.cpp], [1.0.1])
AC_CONFIG_AUX_DIR([autotools_build])
AC_CONFIG_MACRO_DIR([m4])
AC_LANG_CPLUSPLUS
AM_INIT_AUTOMAKE([1.11 -Wall -Werror foreign subdir-objects])
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
AM_SILENT_RULES([yes])
LT_INIT([shared static pic-only])
AC_PROG_CC
AC_PROG_CXX([clang++ cxx cc++ c++ g++])
AC_PROG_CXXCPP
AC_PROG_INSTALL
AC_PROG_LIBTOOL
###############################################################################
# Input dependencies
###############################################################################
AC_CHECK_LIB([pthread], [pthread_create], , AC_MSG_ERROR([missing pthread library]))
AC_CHECK_HEADER([pthread.h], , AC_MSG_ERROR([missing pthread.h header]))
AC_SEARCH_LIBS([main], [stdc++], , AC_MSG_ERROR([missing libstdc++]))
AC_CHECK_HEADER([iostream], , AC_MSG_ERROR([missing STL iostream header]))
AC_CHECK_HEADER([list], , AC_MSG_ERROR([missing STL list header]))
AC_CHECK_HEADER([memory], , AC_MSG_ERROR([missing STL memory header]))
AC_CHECK_HEADER([string], , AC_MSG_ERROR([missing STL string header]))
AC_CHECK_HEADER([vector], , AC_MSG_ERROR([missing STL vector header]))
#AC_CHECK_HEADER([chrono], , AC_MSG_ERROR([missing STL chrono header]))
#AC_CHECK_HEADER([condition_variable], , AC_MSG_ERROR([missing STL condition_variable header]))
#AC_CHECK_HEADER([exception], , AC_MSG_ERROR([missing STL exception header]))
#AC_CHECK_HEADER([thread], , AC_MSG_ERROR([missing STL thread header]))
AC_HEADER_STDBOOL
AC_TYPE_SIZE_T
AC_TYPE_UINT32_T
AC_TYPE_UINT8_T
AC_C_INLINE
AC_FUNC_MALLOC
AX_CXX_COMPILE_STDCXX_11([noext], [mandatory])
###############################################################################
# Input options
###############################################################################
# Build samples
AC_ARG_ENABLE(
[samples],
AS_HELP_STRING(
[--enable-samples=@<:@yes/no@:>@],
[build sample programs @<:@default=no@:>@]
),
,
enable_samples=no
)
AM_CONDITIONAL([PAHO_BUILD_SAMPLES], [test "$enable_samples" = yes])
# Build documentation
AC_ARG_ENABLE(
[doc],
AS_HELP_STRING(
[--enable-doc=@<:@yes/no@:>@],
[build documentation @<:@default=no@:>@]
),
,
enable_doc=no
)
AS_IF([test "x$enable_doc" = "xyes"], [
AC_CHECK_PROGS([DOXYGEN], [doxygen])
AS_IF([test -z "$DOXYGEN"], [
AC_MSG_ERROR([Doxygen not found - disabling documentation build])
], [
AC_CONFIG_FILES([doc/Doxyfile])
])
])
AM_CONDITIONAL([PAHO_BUILD_DOC], [test "$enable_doc" = yes && test -n "$DOXYGEN"])
# Peak warnings
AC_ARG_ENABLE(
[peak_warnings],
AS_HELP_STRING(
[--enable-peak-warnings=@<:@yes/no@:>@],
[enable peak warnings level @<:@default=no@:>@]
),
,
enable_peak_warnings=no
)
AS_IF([test "x$enable_peak_warnings" = "xyes"], [
CXXFLAGS+=" -Wabi"
CXXFLAGS+=" -Wall"
CXXFLAGS+=" -Wcast-qual"
CXXFLAGS+=" -Wconversion"
CXXFLAGS+=" -Weffc++"
CXXFLAGS+=" -Wextra"
CXXFLAGS+=" -Wfloat-equal"
CXXFLAGS+=" -Winline"
CXXFLAGS+=" -Wmissing-declarations"
CXXFLAGS+=" -Wmissing-format-attribute"
CXXFLAGS+=" -Wno-deprecated-declarations"
CXXFLAGS+=" -Wno-unused-result"
CXXFLAGS+=" -Woverloaded-virtual"
CXXFLAGS+=" -Wpacked"
CXXFLAGS+=" -Wredundant-decls"
CXXFLAGS+=" -Wshadow"
CXXFLAGS+=" -Wsign-promo"
CXXFLAGS+=" -Wstack-protector -fstack-protector"
CXXFLAGS+=" -Wswitch-default"
CXXFLAGS+=" -fno-common"
])
# Add Paho MQTT C path
AC_ARG_WITH(
[paho-mqtt-c],
AS_HELP_STRING(
[--with-paho-mqtt-c=DIR],
[add a path to paho.mqtt.c library and headers]
),
[
LDFLAGS="$LDFLAGS -L$with_paho_mqtt_c/build/output -L$with_paho_mqtt_c/lib -L$with_paho_mqtt_c/lib64"
CPPFLAGS="$CPPFLAGS -I$with_paho_mqtt_c/src -I$with_paho_mqtt_c/include"
],
)
AC_CHECK_HEADER([MQTTAsync.h], , AC_MSG_ERROR([missing paho.mqtt.c headers]))
# Add OpenSSL support to build secure PAHO libraries
AC_ARG_WITH(
[ssl],
AS_HELP_STRING(
[--with-ssl=@<:@yes/no@:>@],
[with OpenSSL support @<:@default=no@:>@]
),
,
with_ssl=yes
)
AS_IF([test "x$with_ssl" = "xyes"], [
AC_CHECK_HEADER([openssl/crypto.h], , AC_MSG_ERROR([missing openssl/crypto.h header]))
AC_CHECK_LIB([crypto], [CRYPTO_num_locks], , AC_MSG_ERROR([missing crypto library]))
AC_CHECK_HEADER([openssl/ssl.h], , AC_MSG_ERROR([missing openssl/ssl.h header]))
AC_CHECK_LIB([ssl], [SSL_connect], , AC_MSG_ERROR([missing ssl library]))
AC_CHECK_LIB([paho-mqtt3as], [MQTTAsync_create], , AC_MSG_ERROR([missing paho.mqtt.c SSL library]))
AC_DEFINE([OPENSSL], [], [OpenSSL support])
],
[
AC_SEARCH_LIBS([MQTTAsync_create], [mqtt paho-mqtt mqtt3 paho-mqtt3 mqtt3a paho-mqtt3a], , AC_MSG_ERROR([missing paho.mqtt.c library]))
])
AM_CONDITIONAL([PAHO_WITH_SSL], [test "$with_ssl" = yes])
###############################################################################
# Output files
###############################################################################
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
###############################################################################
# Output message
###############################################################################
echo ""
echo "Paho MQTT C++ has been configured with the following options:"
echo " Build as shared library : $enable_shared"
echo " Build as static library : $enable_static"
echo " Build samples : $enable_samples"
echo " Build documentation : $enable_doc"
echo " Enable peak warning level : $enable_peak_warnings"
echo " With Paho MQTT C : $with_paho_mqtt_c"
echo " With OpenSSL library : $with_ssl"
echo " With CPPFLAGS : $CPPFLAGS"
echo " With CFLAGS : $CFLAGS"
echo " With CXXFLAGS : $CXXFLAGS"
echo " With LDFLAGS : $LDFLAGS"
echo " With libraries : $LIBS"