forked from obgm/libcoap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
640 lines (565 loc) · 26.8 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
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
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
# configure.ac for the libcoap package
#
# Copyright (C) 2010-2015 Olaf Bergmann <[email protected]>
# (C) 2015-2017 Carsten Schoenert <[email protected]>
#
# Please run 'autogen.sh' to let autoconf produce a configure script.
# Define the libcoap software version here. Note! The libtool versions are
# defined later.
m4_define([libcoap_major_version], [4])
m4_define([libcoap_minor_version], [2])
m4_define([libcoap_micro_version], [0])
# define a appending release state if needed, for example for pre-releases
# like 'alpha' or 'rc1', for a full release keep the value empty!
m4_define([libcoap_release_state], [alpha])
# concatenate the full libcoap version string
m4_define([libcoap_version], [m4_format([%s.%s.%s%s], libcoap_major_version, libcoap_minor_version, libcoap_micro_version, libcoap_release_state)])
AC_INIT([libcoap], [libcoap_version], [[email protected]], [libcoap], [https://libcoap.net/])
AC_PREREQ([2.64])
AM_INIT_AUTOMAKE([1.10 -Wall no-define no-dist-gzip dist-bzip2])
PKG_PROG_PKG_CONFIG([0.20])
# Generate one configuration header file for building the library itself with
# an auto generated template. We need later a second one (include/libcoap.h)
# that will be installed alongside the library.
AC_CONFIG_HEADERS([coap_config.h])
AC_PROG_CC
AM_PROG_CC_C_O
AC_PROG_SED
AC_CONFIG_MACRO_DIR([m4])
m4_pattern_allow([AM_PROG_AR])
AM_PROG_AR
AC_C_BIGENDIAN
# enable the automatically build of shared and static libraries, the unit
# tests needs the static library
LT_INIT([shared static])
# Setting the libtool versioning
###################################################################################
# #
# To set the version of the library, libtool provides the -version-info #
# parameter, which accepts three numbers, separated by colons, that are called #
# respectively, current, revision and age. Both their name and their behaviour, #
# nowadays, have to be considered fully arbitrary, as the explanation provided #
# in the official documentation is confusing to say the least, and can be, in #
# some cases, considered completely wrong. #
# https://autotools.io/libtool/version.html #
# #
###################################################################################
#
# How to work with the libtool versioning?
#
# Follow the followings steps from top to bottom. This means always start at point 1
# if you plan to make a release and change the values.
# Every new library starts with a version 'current' (short 'c') = 0
# 'revision' (short 'r') = 0
# 'age' (short 'a') = 0
#
# Update the libtool versioning only after the release of a public release of libcoap.
# Go through the following checklist from top to bottom and check your needs, following
# the reminded changes if you can "Yes" for specific check.
#
# 1. Only existing code has changed, no functional changes
# If the library source code has changed but *no* new symbols were added at all
# since the last update, then increment revision (c:r:a becomes c:r+1:a).
# This is usually happen if the existing source of a function was changed for
# bug fixing e.g.
#
# --> Increase the 'LT_LIBCOAP_REVISION' value with *every* new software release
# within one release cycle.
#
# 2. Interfaces were added, functional changed or removed
# If any interfaces [exported functions or data] have been added, got internal
# changes that implies a different behaviour or removed and by this the visible
# symbols have changed since the last update, increment current, and set
# revision to 0 (c:r:a becomes c+1:r=0:a).
#
# --> Increase the 'LT_LIBCOAP_CURRENT' value whenever as an interface has been added
# or removed. This implies also a API change! You mostly have to change the
# 'libcoap_major_version' or at least 'libcoap_minor_version' then too!
# --> Set 'LT_LIBCOAP_REVISION' to 0.
#
# 3. Interfaces were added but none removed or changed
# If any interfaces have been added since the last public release and non of the
# existing interfaces were removed and existing interfaces have not changed internally
# functionality then the new library is backward compatible. Existing binaries can
# use the new library the same than as the existing old library without loosing
# existing functionality or breakage.
# Increase age by 1 (c:r:a becomes c:r:a+1).
#
# --> Increase the 'LT_LIBCOAP_AGE' value only if the changes made to the ABI are
# backward compatible.
#
# 4. Interfaces were removed or have functional changes
# If any interfaces within the library have been removed since the last public
# release or got some internal changes that let the interface act different than
# before, then set age to 0. The library isn't backwards compatible.
#
# --> Set 'LT_LIBCOAP_AGE' to 0.
LT_LIBCOAP_CURRENT=1
LT_LIBCOAP_REVISION=0
LT_LIBCOAP_AGE=1
LIBCOAP_SO_VERSION=$LT_LIBCOAP_CURRENT.$LT_LIBCOAP_REVISION.$LT_LIBCOAP_AGE
# Announce the libtool version
AC_SUBST(LT_LIBCOAP_CURRENT)
AC_SUBST(LT_LIBCOAP_REVISION)
AC_SUBST(LT_LIBCOAP_AGE)
AC_SUBST(LIBCOAP_SO_VERSION)
# Defining the API Version
LIBCOAP_API_VERSION=1
AC_SUBST(LIBCOAP_API_VERSION)
# Adding some default warning options for code QS
# see https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
# and http://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html
WARNING_CFLAGS="\
-pedantic \
-Wall \
-Wextra \
-Wformat-security \
-Winline \
-Wmissing-declarations \
-Wmissing-prototypes \
-Wnested-externs \
-Wpointer-arith \
-Wshadow \
-Wstrict-prototypes \
-Wswitch-default \
-Wswitch-enum \
-Wunused \
"
# check whether or not the compiler supports -Wlogical-op (clang does not...)
AX_CHECK_COMPILE_FLAG([-Wlogical-op], [WARNING_CFLAGS="$WARNING_CFLAGS -Wlogical-op"],,[-Werror])
AX_CHECK_COMPILE_FLAG([-fdiagnostics-color], [CFLAGS="$CFLAGS -fdiagnostics-color"],,[-Werror])
AX_CHECK_COMPILE_FLAG([-Wunused-result], [WARNING_CFLAGS="$WARNING_CFLAGS -Wunused-result"])
AC_SUBST([WARNING_CFLAGS])
AX_CHECK_LINK_FLAG([-Wl,--version-script=${srcdir}/libcoap-${LIBCOAP_API_VERSION}.map],
[libcoap_SYMBOLS="-Wl,--version-script=\$(srcdir)/libcoap-\$(LIBCOAP_API_VERSION).map"],
[libcoap_SYMBOLS="-export-symbols \$(srcdir)/libcoap-\$(LIBCOAP_API_VERSION).sym"])
AC_SUBST(libcoap_SYMBOLS)
# configure options
# __documentation__
doxygen_version_required=1.7.0
dot_version_required=2.26.0
AC_ARG_ENABLE([documentation],
[AS_HELP_STRING([--enable-documentation],
[Enable building the documentation [default=yes]])],
[build_documentation="$enableval"],
[build_documentation="yes"])
if test "x$build_documentation" = "xyes"; then
# Check for doxygen
AC_PATH_PROGS([DOXYGEN], [doxygen])
if test -z "$DOXYGEN"; then
if test "x$build_documentation" = "xyes"; then
AC_MSG_WARN([==> Doxygen not found - continuing without Doxygen support])
AC_MSG_WARN([==> The libcoap html documentation will not be build!])
doxygen_version="not found"
fi
else
AC_MSG_CHECKING([for compatible doxygen version (>= $doxygen_version_required)])
doxygen_version=`$DOXYGEN --version`
AS_VERSION_COMPARE([$doxygen_version],
[$doxygen_version_required],
[AC_MSG_RESULT([no])
DOXYGEN=""],
[AC_MSG_RESULT([yes $doxygen_version])],
[AC_MSG_RESULT([yes $doxygen_version])])
if test "x$DOXYGEN" = "x" -a "x$build_documentation" = "xyes"; then
AC_MSG_ERROR([==> Doxygen $doxygen_version too old. Doxygen >= $doxygen_version_required required for documentation build.])
AC_MSG_ERROR([==> Install required doxygen version or disable the documentation using '--disable-documentation'.])
else
# we found doxygen and the version is valid
DOC_DIR=doc
AC_SUBST(DOC_DIR)
# now checking dot (needed for graphics)
AC_PATH_PROG([DOT], [dot])
if test "x$DOT" = "x"; then
AC_MSG_WARN([==> dot not found - continuing without DOT support])
AC_MSG_WARN([==> The libcoap html documentation will be build without DOT graphics!])
HAVE_DOT="NO"
USE_CALL_GRAPH="NO"
else
AC_MSG_CHECKING([for compatible dot version (>= $dot_version_required)])
case $host in
*-freebsd1*)
# csh and tcsh have a different output redirection than more recent shells
# cmd >& file # Redirect both stdout and stderr to file.
# cmd >>& file # Append both stdout and stderr to file.
# cmd1 | cmd2 # pipe stdout to cmd2
# cmd1 |& cmd2 # pipe stdout and stderr to cmd2
# Using a explicit call with the default always available C-shell on FreeBSD,
# the user may have installed another shell from a port which we don't know here
dot_version=`export DOT=$DOT && csh -c '$DOT -V |& cut -f5 -d" "'`
;;
*)
dot_version=`$DOT -V 2>&1 | cut -f5 -d" "`
;;
esac
AS_VERSION_COMPARE([$dot_version],
[$dot_version_required],
[AC_MSG_RESULT([no])
DOT=""],
[AC_MSG_RESULT([yes $dot_version])],
[AC_MSG_RESULT([yes $dot_version])])
if test "x$DOT" = "x" -a "x$build_documentation" = "xyes"; then
AC_MSG_WARN([==> Graphviz dot $dot_version too old. Graphviz >= $dot_version_required required for documentation build.])
AC_MSG_ERROR([==> Install required graphviz version or disable the documentation using '--disable-documentation'.])
fi
# we found dot and the version is valid
HAVE_DOT="YES"
# let doxygen create caller graphics
# see http://www.stack.nl/~dimitri/doxygen/manual/config.html#cfg_call_graph
USE_CALL_GRAPH="YES"
# exporting the tests to doc/Doxygen(.in)
AC_SUBST(HAVE_DOT)
AC_SUBST(USE_CALL_GRAPH)
fi
fi
fi
fi
AM_CONDITIONAL(BUILD_DOCUMENTATION, [test "x$build_documentation" = "xyes"])
AM_CONDITIONAL([HAVE_DOXYGEN], [test -n "$DOXYGEN"])
AM_COND_IF([HAVE_DOXYGEN], [AC_CONFIG_FILES([doc/Doxyfile])])
# configure options
# __dtls__
# The Datagram Transport Layer Security (DTLS) feature needs cryptographic
# functions.
# We currently support the GnuTLS and OpenSSL library. The user can preselect
# the cryptographic library that should be used by adding '--with-gnutls' or
# '--with-openssl'.
# If the user isn't using a selection we first search for GnuTLS and fallback
# to OpenSSL if the GnuTLS library couldn't be found.
gnutls_version_required=3.2.0
openssl_version_required=1.1.0
AC_ARG_ENABLE([dtls],
[AS_HELP_STRING([--enable-dtls],
[Enable building with DTLS support [default=yes]])],
[build_dtls="$enableval"],
[build_dtls="yes"])
AC_ARG_WITH([gnutls],
[AS_HELP_STRING([--with-gnutls],
[Use GnuTLS for DTLS functions])],
[with_gnutls="yes"],
[with_gnutls="no"])
AC_ARG_WITH([openssl],
[AS_HELP_STRING([--with-openssl],
[Use OpenSSL for DTLS functions])],
[with_openssl="yes"],
[with_openssl="no"])
AC_ARG_WITH([tinydtls],
[AS_HELP_STRING([--with-tinydtls],
[Use TinyDTLS for DTLS functions])],
[with_tinydtls="yes"],
[with_tinydtls="no"])
if test "x$with_gnutls" = "xyes" -o "x$with_openssl" = "xyes"; then
if test "x$build_dtls" = "x"; then
# Give a advice that '--with_gnutls' or '--with_openssl' was used but
# DTLS support isn't configured.
AC_MSG_NOTICE([==> Using the configure options '--with-gnutls' or '--with-openssl' without '--enable-dtls' is useles and will be ignored.])
fi
fi
# O.K. the user hasn't de-selected DTLS
if test "x$build_dtls" = "xyes"; then
# The user can't select multiple crypto libraries.
if test "x$with_gnutls" = "xyes" -a "x$with_openssl" = "xyes"; then
AC_MSG_ERROR([==> You can't use the options '--with-gnutls' and '--with-openssl' at the same time while '--enable-dtls' is selected!
==> Please note, the option '--enable-dtls' is turned on by default if not explicitly disabled!])
fi
# Check for all possible usable and supported SSL crypto libraries
# GnuTLS
PKG_CHECK_MODULES([GnuTLS],
[gnutls],
[have_gnutls="yes"],
[have_gnutls="no"])
# OpenSSL
PKG_CHECK_MODULES([OpenSSL],
[openssl],
[have_openssl="yes"],
[have_openssl="no"])
# TinyDTLS ?
# TBD ?
# The user wants to use explicit GnuTLS if '--with-gnutls' was set.
if test "x$with_gnutls" = "xyes"; then
# Some more sanity checking.
if test "x$have_gnutls" != "xyes"; then
AC_MSG_ERROR([==> You want to build libcoap with DTLS support by the GnuTLS library but pkg-config file 'gnutls.pc' could not be found!
Install the package(s) containing the development files for GnuTLS,
or use '--with_openssl' or disable the DTLS support using '--disable-dtls'.])
fi
AC_MSG_NOTICE([The use of GnuTLS was explicit requested due configure option '--with-gnutls'!])
# check for valid GnuTLS version
gnutls_version=`pkg-config --modversion gnutls`
AX_CHECK_GNUTLS_VERSION
have_openssl="no" # don't confuse AC_MSG_RESULT at the end of the script
fi
# The user wants to use explicit OpenSSL if '--with-openssl was set'.
if test "x$with_openssl" = "xyes"; then
# Some more sanity checking.
if test "x$have_openssl" != "xyes"; then
AC_MSG_ERROR([==> You want to build libcoap with DTLS support by the OpenSSL library but pkg-config file 'openssl.pc' could not be found!
Install the package(s) containing the development files for OpenSSL,
or use '--with_gnutls' or disable the DTLS support using '--disable-dtls'.])
fi
AC_MSG_NOTICE([The use of OpenSSL was explicit requested due configure option '--with-openssl'!])
# check for valid OpenSSL version
openssl_version=`pkg-config --modversion openssl`
AX_CHECK_OPENSSL_VERSION
have_gnutls="no" # don't confuse AC_MSG_RESULT at the end of the script
fi
# The user wants to use explicit OpenSSL if '--with-tinydtls was set'.
if test "x$with_tinydtls" = "xyes" ; then
if test "x$enable_shared" = "xyes"; then
AC_MSG_ERROR([==> You want to build libcoap with DTLS support by tinyDTLS but have enabled shared libraries.
Please pass '--disable-shared' to configure or select a different DTLS library.])
fi
if test -d "$srcdir/ext/tinydtls"; then
AC_CONFIG_SUBDIRS([ext/tinydtls])
have_tinydtls="yes"
else
have_tinydtls="no"
fi
fi
# The user hasn't requested the use of a specific cryptographic library
# we try first GnuTLS for usability ...
if test "x$have_gnutls" = "xyes" -a "x$with_gnutls" = "xno" -a "x$with_tinydtls" = "xno"; then
gnutls_version=`pkg-config --modversion gnutls`
AX_CHECK_GNUTLS_VERSION
AC_MSG_NOTICE([Using autoselected library GnuTLS for DTLS support!])
with_gnutls_auto="yes"
have_openssl="no" # don't confuse AC_MSG_RESULT at the end of the script
fi
# ... and if not found check OpenSSL is suitable.
if test "x$have_openssl" = "xyes" -a "x$with_openssl" = "xno" -a "x$with_gnutls_auto" = "x" -a "x$with_tinydtls" = "xno"; then
openssl_version=`pkg-config --modversion openssl`
AX_CHECK_OPENSSL_VERSION
AC_MSG_NOTICE([Using autoselected library OpenSSL for DTLS support!])
with_openssl_auto="yes"
have_gnutls="no" # don't confuse AC_MSG_RESULT at the end of the script
fi
# Note that tinyDTLS is used only when explicitly requested.
# Giving out a error message if we haven't found at least one crypto library.
if test "x$have_gnutls" = "xno" -a "x$have_openssl" = "xno" -a "x$have_tinydtls" = "xno"; then
AC_MSG_ERROR([==> Option '--enable-dtls' is set but one of the needed cryptographic library GnuTLS nor OpenSSL nor tinyDTLS could be found!
Install at least on of the package(s) containing the development files for GnuTLS (>= $gnutls_version_required) or OpenSSL(>= $openssl_version_required)
or disable the DTLS support using '--disable-dtls'.])
fi
# Saving the DTLS related Compiler flags.
if test "x$with_gnutls" = "xyes" -o "x$with_gnutls_auto" = "xyes"; then
DTLS_CFLAGS="$GnuTLS_CFLAGS"
DTLS_LIBS="$GnuTLS_LIBS"
AC_DEFINE(HAVE_LIBGNUTLS, [1], [Define if the system has libgnutls28])
fi
if test "x$with_openssl" = "xyes" -o "x$with_openssl_auto" = "xyes"; then
DTLS_CFLAGS="$OpenSSL_CFLAGS"
DTLS_LIBS="$OpenSSL_LIBS"
AC_DEFINE(HAVE_OPENSSL, [1], [Define if the system has libssl1.1])
fi
if test "x$with_tinydtls" = "xyes"; then
DTLS_CFLAGS="-I \$(top_srcdir)/ext/tinydtls"
DTLS_LIBS="-L\$(top_srcdir)/ext/tinydtls -ltinydtls"
AC_DEFINE(HAVE_LIBTINYDTLS, [1], [Define if the system has libtinydtls])
fi
AC_SUBST(DTLS_CFLAGS)
AC_SUBST(DTLS_LIBS)
fi
# configure options
# __tests__
AC_ARG_ENABLE([tests],
[AS_HELP_STRING([--enable-tests],
[Enable building the binary testsuite [default=no]])],
[build_tests="$enableval"],
[build_tests="no"])
if test "x$build_tests" = "xyes"; then
PKG_CHECK_MODULES([CUNIT],
[cunit],
[have_cunit=yes
AC_DEFINE(HAVE_LIBCUNIT, [1], [Define if the system has libcunit])],
[have_cunit=no
AC_MSG_WARN([==> You want to build the testing binary but the pkg-config file cunit.pc could not be found or installed CUnit version is too old!])
AC_MSG_ERROR([==> Install the package(s) containing the development files for CUnit or disable the testing binary using '--disable-tests'.])
])
fi
AM_CONDITIONAL(HAVE_CUNIT, [test "x$CUNIT_LIBS" != "x"])
# configure options
# __examples__
AC_ARG_ENABLE([examples],
[AS_HELP_STRING([--enable-examples],
[Enable building the example binaries [default=yes]])],
[build_examples="$enableval"],
[build_examples="yes"])
if test "x$build_examples" = "xyes" -a "x$build_documentation" = "xyes"; then
AC_ARG_VAR([A2X], [a2x command])
AC_PATH_PROG([A2X], [a2x])
if test "x$A2X" = "x"; then
AC_MSG_WARN([==> You want to build the examples binaries, that is also including the respective manpages but a2x was not found!])
AC_MSG_ERROR([==> Install the package containg a2x (mostly asciidoc) or disable the build of the examples using '--disable-examples'.])
fi
build_examples="yes"
fi
AM_CONDITIONAL(BUILD_EXAMPLES, [test "x$build_examples" = "xyes"])
# end configure options
#######################
###########################################
# from configure options independent checks
# Check for (ex)ctags binary
# The needed ctags binary name differs on FreeBSD and Linux, on Linux
# systems we search for 'ctags', on FreeBSD for 'exctags'
case $host in
# FreeBSD has exctags from the ctags port
*-freebsd1*)
AC_ARG_VAR([CTAGS_PROG],[the 'exctags' program to use for make target 'update-map-file'])
AC_PATH_PROG([CTAGS_PROG],[exctags])
;;
*)
# Linux distributions have exuberant-ctags
AC_ARG_VAR([CTAGS_PROG],[the 'ctags' program to use for make target 'update-map-file'])
AC_PATH_PROG([CTAGS_PROG],[ctags])
;;
esac
if test "x$CTAGS_PROG" = "x"; then
AC_MSG_NOTICE([==> Note: '(ex)ctags' command not found!])
AC_MSG_WARN([==> Without ctags you will be unable to run the target 'update-map-file'!])
AC_MSG_WARN([==> This is no problem if you just want to build the library libcoap.])
else
if test "`$CTAGS_PROG --help | grep '\--<LANG>-kinds'`" = ""; then
AC_MSG_NOTICE([==> Note: Your ctags binary does not support '--c-kinds'!])
AC_MSG_NOTICE([==> Most likely, you are using the GNU Emacs ctag and not exuberant ctag.])
AC_MSG_WARN([==> This option is required for the target 'update-map-file'.])
AC_MSG_WARN([==> which is not a problem if you just want to build the library libcoap.])
fi
fi
# Checks for header files.
AC_CHECK_HEADERS([assert.h arpa/inet.h limits.h netdb.h netinet/in.h \
stdlib.h string.h strings.h sys/socket.h sys/time.h \
time.h unistd.h sys/unistd.h syslog.h sys/ioctl.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
# Checks for library functions.
AC_CHECK_FUNCS([memset select socket strcasecmp strrchr getaddrinfo \
strnlen malloc])
# Check if -lsocket -lnsl is required (specifically Solaris)
AC_SEARCH_LIBS([socket], [socket])
AC_SEARCH_LIBS([inet_ntop], [nsl])
# Check if clock_gettime() requires librt, when available
AC_SEARCH_LIBS([clock_gettime], [rt])
AC_MSG_CHECKING([operating system])
# Set up here some extra platform depended defines and variables.
# The "ADDITIONAL_CFLAGS" is need as this stand-alone definition
# for the doxygen part.
case $host in
*-linux* | *-uclinux*)
AC_MSG_RESULT([Linux])
ADDITIONAL_CFLAGS="-D_GNU_SOURCE"
# Not yet needed but if some code definitions have to depend on the platform.
#AC_DEFINE(OS_LINUX, 1, [Linux backend])
#AC_SUBST(OS_LINUX)
;;
*-solaris*)
AC_MSG_RESULT([Solaris])
# set _XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED to enable XPG4v2 (POSIX 2004)
# set __EXTENSION__ to shut up feature test macros that restrict -std=c99
# to only C99 (and nothing newer)
ADDITIONAL_CFLAGS="-D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=600 -D__EXTENSIONS__=1"
;;
*-darwin*)
AC_MSG_RESULT([Darwin])
ADDITIONAL_CFLAGS="-D_GNU_SOURCE"
AC_DEFINE(__APPLE_USE_RFC_3542, 1, [Define this to 1 for ancillary data on MacOS])
# Not yet needed but if some code definitions have to depend on the platform.
#AC_DEFINE(OS_MACOS, 1, [MacOS backend])
#AC_SUBST(OS_MACOS)
;;
*-freebsd1*)
AC_MSG_RESULT([FreeBSD-1x])
ADDITIONAL_CFLAGS="-D_GNU_SOURCE"
;;
*kfreebsd*)
AC_MSG_RESULT([kFreeBSD])
ADDITIONAL_CFLAGS="-D_GNU_SOURCE"
;;
*)
AC_MSG_WARN([==> Currently unsupported operating system '${host}' !])
AC_MSG_ERROR([==> If you can provide patches to support your operating system please write to '[email protected]'.])
esac
# Exporting the PREDEFINED_CFLAGS definition
PREDEFINED_CFLAGS=`echo $ADDITIONAL_CFLAGS | $SED -e 's/-D//g'`
AC_SUBST(PREDEFINED_CFLAGS)
# And finally combining the CFLAGS together ...
CFLAGS="$CFLAGS $ADDITIONAL_CFLAGS"
# Override the various template files, currently just makefiles and the
# pkgconfig *.pc file.
# Later if the API version is changing don't forget to change the
# libcoap-$LIBCOAP_API_VERSION.pc.in file too!! You will have to change
# the 'Cflags' variable to something like
# Cflags: -I${includedir}/coap-@LIBCOAP_API_VERSION@
#
AC_CONFIG_FILES([
Makefile
doc/Makefile
examples/Makefile
examples/coap-client.txt
examples/coap-server.txt
examples/coap-rd.txt
include/coap/coap.h
tests/Makefile
libcoap-$LIBCOAP_API_VERSION.pc:libcoap-$LIBCOAP_API_VERSION.pc.in
])
AC_OUTPUT
AC_MSG_RESULT([
libcoap configuration summary:
libcoap package version : "$PACKAGE_VERSION"
libcoap library version : "$LIBCOAP_SO_VERSION"
libcoap API version : "$LIBCOAP_API_VERSION"
host system : "$host"]);
if test "x$with_gnutls" = "xyes" -o "x$with_gnutls_auto" = "xyes"; then
AC_MSG_RESULT([ build DTLS support : "yes"])
AC_MSG_RESULT([ --> GnuTLS around : "yes" (found GnuTLS $gnutls_version)])
AC_MSG_RESULT([ GNUTLS_CFLAGS : "$GnuTLS_CFLAGS"])
AC_MSG_RESULT([ GNUTLS_LIBS : "$GnuTLS_LIBS"])
fi
if test "x$with_openssl" = "xyes" -o "x$with_openssl_auto" = "xyes"; then
AC_MSG_RESULT([ build DTLS support : "yes"])
AC_MSG_RESULT([ --> OpenSSL around : "yes" (found OpenSSL $openssl_version)])
AC_MSG_RESULT([ OPENSSL_CFLAGS : "$OpenSSL_CFLAGS"])
AC_MSG_RESULT([ OPENSSL_LIBS : "$OpenSSL_LIBS"])
fi
if test "x$with_tinydtls" = "xyes"; then
AC_MSG_RESULT([ build DTLS support : "yes"])
AC_MSG_RESULT([ --> OpenSSL around : "yes" (found tinyDTLS)])
AC_MSG_RESULT([ TINYDTLS_CFLAGS : "$DTLS_CFLAGS"])
AC_MSG_RESULT([ TINYDTLS_LIBS : "$DTLS_LIBS"])
fi
if test "x$build_dtls" != "xyes"; then
AC_MSG_RESULT([ build DTLS support : "no"])
fi
if test "x$build_documentation" = "xyes" -a "x$DOXYGEN" != "x"; then
AC_MSG_RESULT([ build documentation : "yes"])
AC_MSG_RESULT([ --> Doxygen around : "yes" ($DOXYGEN $doxygen_version)])
if test "x$DOT" = "x"; then
AC_MSG_RESULT([ --> dot around : "no" (DOT not found!)])
else
AC_MSG_RESULT([ --> dot around : "yes" ($DOT $dot_version)])
fi
else
if test "x$build_documentation" = "xno"; then
AC_MSG_RESULT([ build documentation : "no"])
fi
fi
if test "x$build_tests" = "xyes"; then
AC_MSG_RESULT([ build unit test binary : "yes"])
else
AC_MSG_RESULT([ build unit test binary : "no"])
fi
if test "x$build_examples" = "xyes"; then
AC_MSG_RESULT([ build examples : "yes"])
if test "x$A2X" != "x"; then
AC_MSG_RESULT([ --> use a2x : "yes" ($A2X)])
else
AC_MSG_RESULT([ --> use a2x : "no"])
fi
else
AC_MSG_RESULT([ build examples : "no"])
fi
if test "x$build_dtls" = "xyes"; then
AC_MSG_RESULT([ build with DTLS support : "yes"])
else
AC_MSG_RESULT([ build with DTLS support : "no"])
fi