-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed configuration process for Contiki.
When invoked with option "--with-contiki" configure used to copy a hard-coded Makefile and header file instead of generating them from their according *.in templates. Now, configure performs the platform checks as specified in configure.in. For platform-specific adjustments, dtls_config.h can include configuration files that are given in the subdirectory platform-specific. To invoke configure for building with Contiki, the host and build options must be passed, e.g. ./configure --with-contiki --build=x86_64-linux-gnu \ --host=arm-none-eabi (Seems not to work with msp430-gcc yet.)
- Loading branch information
Showing
5 changed files
with
142 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# -*- Autoconf -*- | ||
# Process this file with autoconf to produce a configure script. | ||
# | ||
# Copyright (C) 2011--2013 Olaf Bergmann <[email protected]> | ||
# Copyright (C) 2011--2014 Olaf Bergmann <[email protected]> | ||
# | ||
# Permission is hereby granted, free of charge, to any person | ||
# obtaining a copy of this software and associated documentation | ||
|
@@ -24,18 +24,14 @@ | |
# SOFTWARE. | ||
|
||
AC_PREREQ([2.65]) | ||
AC_INIT([tinydtls], [0.5.2]) | ||
AC_INIT([tinydtls], [0.6.0]) | ||
AC_CONFIG_SRCDIR([dtls.c]) | ||
dnl AC_CONFIG_HEADERS([config.h]) | ||
|
||
# First check for Contiki build to quit configure before any other test | ||
AC_ARG_WITH(contiki, | ||
[AS_HELP_STRING([--with-contiki],[build libtinydtls for the Contiki OS])], | ||
[cp -p Makefile.contiki Makefile | ||
cp -p config.h.contiki config.h | ||
cp -p ecc/Makefile.contiki ecc/Makefile | ||
AC_MSG_NOTICE([Contiki build prepared]) | ||
exit 0], | ||
[AC_DEFINE(WITH_CONTIKI,1,[Define to 1 if building for Contiki.]) | ||
WITH_CONTIKI=1], | ||
[]) | ||
|
||
# Checks for programs. | ||
|
@@ -50,7 +46,6 @@ AC_C_BIGENDIAN | |
# Checks for libraries. | ||
AC_SEARCH_LIBS([gethostbyname], [nsl]) | ||
AC_SEARCH_LIBS([socket], [socket]) | ||
dnl AC_CHECK_LIB([dl], [dlopen]) | ||
|
||
AC_ARG_WITH(debug, | ||
[AS_HELP_STRING([--without-debug],[disable all debug output and assertions])], | ||
|
@@ -63,6 +58,7 @@ AC_ARG_WITH(ecc, | |
[AS_HELP_STRING([--without-ecc],[disable support for TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8])], | ||
[], | ||
[AC_DEFINE(DTLS_ECC, 1, [Define to 1 if building with ECC support.]) | ||
OPT_OBJS="${OPT_OBJS} ecc/ecc.o" | ||
DTLS_ECC=1]) | ||
|
||
AC_ARG_WITH(psk, | ||
|
@@ -76,19 +72,23 @@ OPT_OBJS="${OPT_OBJS} sha2/sha2.o" | |
|
||
AC_SUBST(OPT_OBJS) | ||
AC_SUBST(NDEBUG) | ||
AC_SUBST(WITH_CONTIKI) | ||
AC_SUBST(DTLS_ECC) | ||
AC_SUBST(DTLS_PSK) | ||
|
||
# Checks for header files. | ||
AC_CHECK_HEADERS([assert.h arpa/inet.h fcntl.h inttypes.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h strings.h sys/param.h sys/socket.h sys/time.h time.h unistd.h]) | ||
AC_CHECK_HEADERS([assert.h arpa/inet.h fcntl.h inttypes.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h strings.h sys/param.h sys/socket.h unistd.h]) | ||
|
||
dnl Skip checks for time.h when cross-compiling Contiki to avoid trouble | ||
if test "${cross_compiling}" = "no" -o "${with_contiki}" != "yes" ; then | ||
AC_CHECK_HEADERS([sys/time.h time.h]) | ||
else | ||
AC_MSG_NOTICE([skipping sys/time.h and time.h checks on cross-compiled Contiki]) | ||
fi | ||
|
||
# Checks for typedefs, structures, and compiler characteristics. | ||
AC_C_INLINE | ||
AC_TYPE_SIZE_T | ||
dnl AC_TYPE_UINT8_T | ||
dnl AC_TYPE_UINT16_T | ||
dnl AC_TYPE_UINT32_T | ||
dnl AC_TYPE_UINT64_T | ||
|
||
AC_CHECK_MEMBER([struct sockaddr_in6.sin6_len], | ||
[AC_DEFINE(HAVE_SOCKADDR_IN6_SIN6_LEN, [1], | ||
|
@@ -99,12 +99,13 @@ AC_CHECK_MEMBER([struct sockaddr_in6.sin6_len], | |
AC_FUNC_MALLOC | ||
AC_CHECK_FUNCS([memset select socket strdup strerror strnlen fls vprintf]) | ||
|
||
AC_CONFIG_HEADERS([config.h tinydtls.h]) | ||
AC_CONFIG_HEADERS([dtls_config.h tinydtls.h]) | ||
|
||
AC_CONFIG_FILES([Makefile | ||
doc/Makefile | ||
doc/Doxyfile | ||
tests/Makefile | ||
platform-specific/Makefile | ||
sha2/Makefile | ||
aes/Makefile | ||
ecc/Makefile]) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,68 @@ | ||
/* config.h.in. Generated from configure.in by autoheader. */ | ||
/* tinydtls -- a very basic DTLS implementation | ||
* | ||
* Copyright (C) 2011--2014 Olaf Bergmann <[email protected]> | ||
* Copyright (C) 2013 Hauke Mehrtens <[email protected]> | ||
* | ||
* Permission is hereby granted, free of charge, to any person | ||
* obtaining a copy of this software and associated documentation | ||
* files (the "Software"), to deal in the Software without | ||
* restriction, including without limitation the rights to use, copy, | ||
* modify, merge, publish, distribute, sublicense, and/or sell copies | ||
* of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be | ||
* included in all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS | ||
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | ||
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
* SOFTWARE. | ||
*/ | ||
|
||
/** | ||
* @file dtls_config.h | ||
* @brief internal configuration for tinydtls library | ||
* | ||
* This file has been generated by configure from dtls_config.h.in. | ||
*/ | ||
|
||
/* dummy definitions for PACKAGE_NAME and PACKAGE_VERSION */ | ||
#define PACKAGE_NAME "tinydtls" | ||
#define PACKAGE_STRING PACKAGE_NAME | ||
|
||
#ifdef CONTIKI | ||
#include "contiki.h" | ||
#include "contiki-lib.h" | ||
#include "contiki-net.h" | ||
|
||
#include "contiki-conf.h" | ||
|
||
/* global constants for constrained devices running Contiki */ | ||
#ifndef DTLS_PEER_MAX | ||
/** The maximum number DTLS peers (i.e. sessions). */ | ||
# define DTLS_PEER_MAX 1 | ||
#endif | ||
|
||
#ifndef DTLS_HANDSHAKE_MAX | ||
/** The maximum number of concurrent DTLS handshakes. */ | ||
# define DTLS_HANDSHAKE_MAX 1 | ||
#endif | ||
|
||
#ifndef DTLS_SECURITY_MAX | ||
/** The maximum number of concurrently used cipher keys */ | ||
# define DTLS_SECURITY_MAX (DTLS_PEER_MAX + DTLS_HANDSHAKE_MAX) | ||
#endif | ||
|
||
#ifndef DTLS_HASH_MAX | ||
/** The maximum number of hash functions that can be used in parallel. */ | ||
# define DTLS_HASH_MAX (3 * DTLS_PEER_MAX) | ||
#endif | ||
#endif /* CONTIKI */ | ||
|
||
/* Define if building universal (internal helper macro) */ | ||
#undef AC_APPLE_UNIVERSAL_BUILD | ||
|
@@ -135,3 +199,35 @@ | |
/* Define to `unsigned int' if <sys/types.h> does not define. */ | ||
|
||
#undef size_t | ||
|
||
/************************************************************************/ | ||
/* Specific Contiki platforms */ | ||
/************************************************************************/ | ||
|
||
#ifdef CONTIKI | ||
|
||
#if CONTIKI_TARGET_ECONOTAG | ||
# include "platform-specific/config-econotag.h" | ||
#endif /* CONTIKI_TARGET_REDBEE_ECONOTAG */ | ||
|
||
#ifdef CONTIKI_TARGET_CC2538DK | ||
# include "platform-specific/config-cc2538dk.h" | ||
#endif /* CONTIKI_TARGET_CC2538DK */ | ||
|
||
#if defined(TMOTE_SKY) | ||
/* Need to set the byte order for TMote Sky explicitely */ | ||
|
||
#define BYTE_ORDER UIP_LITTLE_ENDIAN | ||
|
||
typedef int ssize_t; | ||
#endif /* defined(TMOTE_SKY) */ | ||
|
||
#ifndef BYTE_ORDER | ||
# ifdef UIP_CONF_BYTE_ORDER | ||
# define BYTE_ORDER UIP_CONF_BYTE_ORDER | ||
# else | ||
# error "UIP_CONF_BYTE_ORDER not defined" | ||
# endif /* UIP_CONF_BYTE_ORDER */ | ||
#endif /* BYTE_ORDER */ | ||
|
||
#endif /* CONTIKI */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# the library's version | ||
VERSION:=@PACKAGE_VERSION@ | ||
|
||
# tools | ||
@SET_MAKE@ | ||
SHELL = /bin/sh | ||
MKDIR = mkdir | ||
|
||
top_builddir = @top_builddir@ | ||
|
||
THIS=platform-specific | ||
DISTDIR?=$(top_builddir)/@PACKAGE_TARNAME@-@PACKAGE_VERSION@ | ||
FILES:=Makefile.in $(wildcard *.h) | ||
|
||
clean: | ||
|
||
distclean: clean | ||
@rm -rf $(DISTDIR) | ||
@rm -f *~ | ||
|
||
dist: | ||
test -d $(DISTDIR)/$(THIS) || mkdir $(DISTDIR)/$(THIS) | ||
cp -r $(FILES) $(DISTDIR)/$(THIS) | ||
|
||
# this directory contains no installation candidates | ||
install: | ||
: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#define BYTE_ORDER 1234 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#define BYTE_ORDER 1234 |