Commit Graph

15 Commits

Author SHA1 Message Date
Achim Kraus
5477e6885b dtls_prng_posix.c: fail for posix without HAVE_GETRANDOM nor
HAVE_RANDOM.

Support random().
Add #error with explanation and hint to solve it.

Signed-off-by: Achim Kraus <achim.kraus@cloudcoap.net>
2023-02-25 14:34:25 +01:00
Jon Shallow
89fc1ce53c configure.ac: Fix with test for inet_ntop for building dtls_debug.o
Signed-off-by: Jon Shallow <supjps-libcoap@jpshallow.com>
2022-07-23 06:50:34 +02:00
Olaf Bergmann
98e2cd7ed8 configure.ac: Prevent overwriting CFLAGS in configure
By setting CFLAGS in configure, commit b9c58a1f [1]
accidentally prevents passing additional CFLAGS
parameters into make.

[1] b9c58a1f23

Change-Id: Ibfb0a805e690cf401f77e53c9a58f4e75a668aa8
2022-05-27 11:26:22 +02:00
Hugo Hakim Damer
78a7084b43 autotools: Generate and install pkg-config file on build
In some cases it might be advantageous to install tinydtls to some
(system-wide) prefix (e.g. `/usr/local`) and use it from there.

Because the tinydtls headers require the header sub-directory (i.e.
`/usr/local/include/tinydtls` if the prefix is `/usr/local`) to be in the
header search path, software that uses tinydtls has to add `-I[HEADER_PATH]`
to its compiler flags (as well as the `-L[LIB_PATH] -ltinydtls` linker flags
if the prefix is not part of the standard library search path).

By providing a pkg-config file, it is possible for build scripts in dependent
projects to automatically set the appropiate compiler and linker flags for
tinydtls without having to manually find the tinydtls subdirectory in one of
its header search path entries.

The format of the pkg-config file follows the guide in
https://people.freedesktop.org/~dbn/pkg-config-guide.html, with the same
adjustments that were made in e.g. libcoap
(https://github.com/obgm/libcoap/blob/develop/libcoap-3.pc.in) to allow for
integration into autotools (e.g. setting the package name, URL and version
based on the values specified in `AC_INIT`).

Signed-off-by: Hugo Hakim Damer <hdamer@uni-bremen.de>
2021-12-29 06:52:58 +01:00
Jon Shallow
134e5c02f8 configure.ac: Fix CUNIT spurious bracket
configure.ac:
Remove spurious ] from the CUNIT test

README:

Include autoreconf to handle configure.ac updates.

Signed-off-by: Jon Shallow <supjps-libcoap@jpshallow.com>
2020-07-24 08:29:55 +01:00
Olaf Bergmann
961d664578 configure.ac: Set TEST_INCLUDE for unit tests
If '--enable-tests' is given and the CUnit library was found, the
pre-processor symbol TEST_INCLUDE is set to 1 to enable additional API
functions that allow calling static functions from unit tests. This
functionality is currently used in the ECC module.

Change-Id: I1d1a5a2028d339edd7f73ab14e5c8f2ef562b36e
2020-07-21 16:47:48 +02:00
Olaf Bergmann
dad634471a configure.ac: check for function getrandom()
Change-Id: I6fc3f74932bc1fe857a92dafa7b920e92fde928c
2020-06-12 12:30:40 +02:00
Fabrice Fontaine
802c03e8ef add --disable-shared option
Allow the user to disable shared library through --disable-shared.
Indeed, building of shared libraries is not supported by all toolchains
especially embedded ones

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2020-06-10 22:32:29 +02:00
Olaf Bergmann
4388e97e62 configure.ac: Add unit tests
The new configure option --enable-tests checks for the presence
of the cunit test framework [1] and enables the unit tests if
available. The unit tests are disabled by default.

[1] https://cunit.sourceforge.net

Change-Id: I5393010190c3fb236bcfe4ab7498a8b24a8731fd
2020-06-02 09:52:23 +02:00
Sören Tempel
b9c58a1f23 Build a shared library as well
The ruby ffi gem doesn't seem to support static libraries.

This is a dirty hack since I don't know how GNU autotools works.

Change-Id: If1b23b770ec5f16562cde1f8874c6a4331c93929
Signed-off-by: Sören Tempel <tempel@uni-bremen.de>
Signed-off-by: Olaf Bergmann <bergmann@tzi.org>
2018-07-18 14:23:19 +02:00
Olaf Bergmann
79a69fdd56 configure.ac: workaround for autoconf bug
When not using automake, invocation of autoreconf does not install
missing scripts such as install-sh but makes configure check for
an install script. As a workaround, this change creates an empty
file 'install-sh' in the current directory unless it is already
present.

Note that the Makefiles use 'cp' for installation.

Change-Id: Ief05a5672344c2e63f106c4442dc6f954d93983c
2018-02-16 15:33:11 +01:00
Olaf Bergmann
cc5863fa0e fixed Makefile variables for cross-compilation
When configured for a different host, the variables CC, AR and
RANLIB have not been set correctly. With this fix, tinydtls can
be compiled for another platform when it is configured as a
submodule of an automake-enabled project.

For example, when the dtls branch of libcoap[1] can be cross-compiled
for the raspberry pi as follows:

  ./configure --with-host=arm-linux-gnueabihf --disable-shared

Note that cross-compilation does not yet work without automake as the
m4 macro AM_PROG_AR depends on automake.

[1] https://github.com/obgm/libcoap/tree/dtls

Change-Id: If23080dc7754a48434e7ac787c0bddda1dd9530b
2017-04-18 16:19:38 +02:00
Olaf Bergmann
3e022210b3 Makefile: increase level of compiler warnings
Change-Id: I3865e17cdede51681e64d1b7385725747b38fbaa
2017-03-01 13:25:53 +01:00
Olaf Bergmann
7b0bc19cd9 configure.in: Remove AC_FUNC_MALLOC
The check for malloc usually is not required but can fail when
cross-compiling. In that case, autoconf looks for rpl_malloc()
which would need to be implemented by the application. A common
way of dealing with this is to remove AC_FUNC_MALLOC from
configure and have the user provide a malloc() wrapper if required.

Change-Id: I24ab688d0ffdcf7233db9f250a5d8255d72a9ad4
2017-02-28 13:56:49 +01:00
Olaf Bergmann
72028c54d9 configure.ac: rename configure.in to .ac
Change deprecated .in extension to .ac to silent warning.

 https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.69/html_node/Writing-Autoconf-Input.html

Change-Id: Ic6ef8374ddc927481262c982a2579cd45dc41b84
Signed-off-by: Gaëtan Harter <gaetan.harter@inria.fr>
2017-02-28 13:45:16 +01:00