-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.in
executable file
·328 lines (292 loc) · 10.1 KB
/
configure.in
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
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.61)
#
# Change the version number below after doing a public release.
# The version in git should reflect the *next* version planned.
# Version must be MAJOR.MINOR.PATCH otherwise things will break.
#
AC_INIT([liblsd],[0.0.1],[[email protected]])
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_MACRO_DIR(config)
AM_CONFIG_HEADER(src/platform.h)
AM_INIT_AUTOMAKE(tar-ustar)
# This defines PACKAGE_VERSION_... in src/platform.h
PV_MAJOR=`echo $PACKAGE_VERSION | cut -d . -f 1`
PV_MINOR=`echo $PACKAGE_VERSION | cut -d . -f 2`
PV_PATCH=`echo $PACKAGE_VERSION | cut -d . -f 3`
AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],[$PV_MAJOR],
[LIBLSD major version])
AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MINOR],[$PV_MINOR],
[LIBLSD minor version])
AC_DEFINE_UNQUOTED([PACKAGE_VERSION_PATCH],[$PV_PATCH],
[LIBLSD patchlevel])
# This lets us use PACKAGE_VERSION in Makefiles
AC_SUBST(PACKAGE_VERSION)
#
# Libtool -version-info (ABI version)
#
# Currently 0.0.1 ("prealpha"). Don't change this unless you
# know exactly what you're doing and have read and understand
# http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
#
# liblsd -version-info
LTVER="0:2:0"
AC_SUBST(LTVER)
# Checks for programs.
AC_PROG_CC
AC_PROG_CC_C99
AM_PROG_CC_C_O
AC_PROG_CXX
AC_PROG_LIBTOOL
AC_PROG_SED
AC_PROG_AWK
AC_SUBST(LIBTOOL_DEPS)
AC_LTDL_DLLIB
CFLAGS="${CFLAGS}"
# Gives the ability to suppress the version number : useful for Android bundling
AC_ARG_ENABLE([version],
[AS_HELP_STRING([--disable-version], [removes version info from the library [default=no]])],
[],
[enable_version=yes])
AM_CONDITIONAL(DISABLE_VERSION, test "x$enable_version" = "xno")
# Enables the bundling of czmq, uuid, zyre statically in the .so .
AC_ARG_ENABLE([embedded],
[AS_HELP_STRING([--enable-embedded],[embeds zyre, crypto, fmq, uuid and czmq in the lib [default=no]])],
[],
[enable_embedded=no])
AC_ARG_ENABLE([python],
[AS_HELP_STRING([--enable-python], [enables Python bindings [default=no]])],
[],
[enable_python=no])
# libuuid
AC_ARG_WITH([libuuid],
[AS_HELP_STRING([--with-libuuid],
[Specify libuuid prefix])],
[lsd_search_libuuid="yes"],
[])
if test "x$lsd_search_libuuid" = "xyes"; then
if test -r "${with_libuuid}/include/uuid/uuid.h"; then
CFLAGS="-I${with_libuuid}/include ${CFLAGS}"
LDFLAGS="-L${with_libuuid}/lib ${LDFLAGS}"
else
AC_MSG_ERROR([${with_libuuid}/include/uuid/uuid.h not found. Please check libuuid prefix])
fi
fi
# libzmq
AC_ARG_WITH([libzmq],
[AS_HELP_STRING([--with-libzmq],
[Specify libzmq prefix])],
[lsd_search_libzmq="yes"],
[])
if test "x$lsd_search_libzmq" = "xyes"; then
if test -r "${with_libzmq}/include/zmq.h"; then
CFLAGS="-I${with_libzmq}/include ${CFLAGS}"
LDFLAGS="-L${with_libzmq}/lib ${LDFLAGS}"
else
AC_MSG_ERROR([${with_libzmq}/include/zmq.h not found. Please check libzmq prefix])
fi
fi
# libczmq
AC_ARG_WITH([libczmq],
[AS_HELP_STRING([--with-libczmq],
[Specify libczmq prefix])],
[lsd_search_libczmq="yes"],
[])
if test "x$lsd_search_libczmq" = "xyes"; then
if test -r "${with_libczmq}/include/czmq.h"; then
CFLAGS="-I${with_libczmq}/include ${CFLAGS}"
LDFLAGS="-L${with_libczmq}/lib ${LDFLAGS}"
else
AC_MSG_ERROR([${with_libczmq}/include/czmq.h not found. Please check libczmq prefix])
fi
fi
# libcrypto
AC_ARG_WITH([libcrypto],
[AS_HELP_STRING([--with-libcrypto],
[Specify libcrypto prefix])],
[lsd_search_libcrypto="yes"],
[])
if test "x$lsd_search_libcrypto" = "xyes"; then
if test -r "${with_libcrypto}/include/openssl/crypto.h"; then
CFLAGS="-I${with_libcrypto}/include ${CFLAGS}"
LDFLAGS="-L${with_libcrypto}/lib ${LDFLAGS}"
else
AC_MSG_ERROR([${with_libcrypto}/include/openssl/crypto.h not found. Please check libcrypto prefix])
fi
fi
# libfmq
AC_ARG_WITH([libfmq],
[AS_HELP_STRING([--with-libfmq],
[Specify libfmq prefix])],
[lsd_search_libfmq="yes"],
[])
if test "x$lsd_search_libfmq" = "xyes"; then
if test -r "${with_libfmq}/include/fmq.h"; then
CFLAGS="-I${with_libfmq}/include ${CFLAGS}"
LDFLAGS="-L${with_libfmq}/lib ${LDFLAGS}"
else
AC_MSG_ERROR([${with_libfmq}/include/fmq.h not found. Please check libfmq prefix])
fi
fi
# libzre
AC_ARG_WITH([libzre],
[AS_HELP_STRING([--with-libzre],
[Specify libzre prefix])],
[lsd_search_libzre="yes"],
[])
if test "x$lsd_search_libzre" = "xyes"; then
if test -r "${with_libzre}/include/zre.h"; then
CFLAGS="-I${with_libzre}/include ${CFLAGS}"
LDFLAGS="-L${with_libzre}/lib ${LDFLAGS}"
else
AC_MSG_ERROR([${with_libzre}/include/zre.h not found. Please check libzre prefix])
fi
fi
# Host speciffic checks
AC_CANONICAL_HOST
# Determine whether or not documentation should be built and installed.
# Set some default features required by libzre code.
CFLAGS="-D_REENTRANT -D_THREAD_SAFE $CFLAGS"
# OS-specific tests
case "${host_os}" in
*linux*)
# Define on Linux to enable all library features
CFLAGS="-D_GNU_SOURCE -DLINUX $CFLAGS"
AC_DEFINE(LIBLSD_HAVE_LINUX, 1, [Have Linux OS])
case "${host_os}" in
*android*)
AC_DEFINE(LIBLSD_HAVE_ANDROID, 1, [Have Android OS])
liblsd_host_android="yes"
enable_python="no"
;;
esac
;;
*solaris*)
# Define on Solaris to enable all library features
CFLAGS="-D_PTHREADS $CFLAGS"
AC_DEFINE(LIBLSD_HAVE_SOLARIS, 1, [Have Solaris OS])
;;
*freebsd*)
# Define on FreeBSD to enable all library features
CFLAGS="-D__BSD_VISIBLE $CFLAGS"
AC_DEFINE(LIBLSD_HAVE_FREEBSD, 1, [Have FreeBSD OS])
;;
*darwin*)
# Define on Darwin to enable all library features
CFLAGS="-D_DARWIN_C_SOURCE $CFLAGS"
AC_DEFINE(LIBLSD_HAVE_OSX, 1, [Have DarwinOSX OS])
;;
*netbsd*)
# Define on NetBSD to enable all library features
CFLAGS="-D_NETBSD_SOURCE $CFLAGS"
AC_DEFINE(LIBLSD_HAVE_NETBSD, 1, [Have NetBSD OS])
;;
*openbsd*)
# Define on OpenBSD to enable all library features
CFLAGS="-D_BSD_SOURCE $CFLAGS"
AC_DEFINE(LIBLSD_HAVE_OPENBSD, 1, [Have OpenBSD OS])
;;
*nto-qnx*)
AC_DEFINE(LIBLSD_HAVE_QNXNTO, 1, [Have QNX Neutrino OS])
;;
*aix*)
AC_DEFINE(LIBLSD_HAVE_AIX, 1, [Have AIX OS])
;;
*hpux*)
# Define on HP-UX to enable all library features
CFLAGS="-D_POSIX_C_SOURCE=200112L"
AC_DEFINE(LIBLSD_HAVE_HPUX, 1, [Have HPUX OS])
;;
*mingw32*)
AC_DEFINE(LIBLSD_HAVE_WINDOWS, 1, [Have Windows OS])
AC_DEFINE(LIBLSD_HAVE_MINGW32, 1, [Have MinGW32])
AC_CHECK_HEADERS(windows.h)
lsd_on_mingw32="yes"
lsd_install_man="no"
;;
*cygwin*)
# Define on Cygwin to enable all library features
CFLAGS="-D_GNU_SOURCE $CFLAGS"
AC_DEFINE(LIBLSD_HAVE_CYGWIN, 1, [Have Cygwin])
;;
*)
AC_MSG_ERROR([unsupported system: ${host_os}.])
;;
esac
AM_CONDITIONAL(HOST_ANDROID, test "x$liblsd_host_android" = "xyes")
AM_CONDITIONAL(ENABLE_PYTHON, test "x$enable_python" = "xyes")
if test "x$enable_python" = "xyes"; then
SWIG_PYTHON
AM_PATH_PYTHON
CPPFLAGS="-I../include -I/usr/include/python$PYTHON_VERSION $CPPFLAGS"
fi
# Other libraries
AC_CHECK_LIB(uuid, uuid_generate, [
if test "x$enable_embedded" = "xyes"; then
LIBS="-Wl,-Bstatic -Wl,-luuid -Wl,-Bdynamic $LIBS"
else
LIBS="-luuid $LIBS"
fi
],
[AC_MSG_ERROR([cannot link with -luuid, install libuuid.])]
)
AC_CHECK_LIB(zmq, zmq_init, [LIBS="-lzmq $LIBS"],
[AC_MSG_ERROR([cannot link with -lzmq, install libzmq.])]
)
AC_CHECK_LIB(czmq, zctx_test, [
if test "x$enable_embedded" = "xyes"; then
LIBS="-Wl,-Bstatic -Wl,-lczmq -Wl,-Bdynamic $LIBS"
else
LIBS="-lczmq $LIBS"
fi
],
[AC_MSG_ERROR([cannot link with -lczmq, install libczmq.])]
)
AC_CHECK_LIB(crypto, SHA1_Init, [
if test "x$enable_embedded" = "xyes"; then
LIBS="-Wl,-Bstatic -Wl,-lcrypto -Wl,-Bdynamic $LIBS"
else
LIBS="-lcrypto $LIBS"
fi
],
[AC_MSG_ERROR([cannot link with -lcrypto, install libcrypto.])]
)
AC_CHECK_LIB(fmq, fmq_server_new, [
if test "x$enable_embedded" = "xyes"; then
LIBS="-Wl,-Bstatic -Wl,-lfmq -Wl,-Bdynamic $LIBS"
else
LIBS="-lfmq $LIBS"
fi
],
[AC_MSG_ERROR([cannot link with -lfmq, install libfmq.])]
)
AC_CHECK_LIB(zre, zre_msg_test, [
if test "x$enable_embedded" = "xyes"; then
LIBS="-Wl,-Bstatic -Wl,-lzre -Wl,-Bdynamic $LIBS"
else
LIBS="-lzre $LIBS"
fi
],
[AC_MSG_ERROR([cannot link with -lzre, install libzre.])]
)
# Checks for header files.
AC_HEADER_STDC
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_HEADER_TIME
AC_TYPE_UINT32_T
AC_C_VOLATILE
# These options are GNU compiler specific.
if test "x$GCC" = "xyes"; then
CFLAGS="-fPIC -Wno-write-strings -Werror -Wall -Wno-unused ${CFLAGS}"
LDFLAGS="-fPIC ${LDFLAGS}"
fi
AC_SUBST(CFLAGS)
AC_SUBST(LDFLAGS)
# Checks for library functions.
AC_TYPE_SIGNAL
AC_OUTPUT(Makefile src/Makefile src/liblsd.pc python/Makefile)