Imported Upstream version 0.9.1
[platform/upstream/iotivity.git] / extlibs / tinydtls / configure.in
1 #                                               -*- Autoconf -*-
2 # Process this file with autoconf to produce a configure script.
3 #
4 # Copyright (C) 2011--2014 Olaf Bergmann <bergmann@tzi.org>
5 #
6 # Permission is hereby granted, free of charge, to any person
7 # obtaining a copy of this software and associated documentation
8 # files (the "Software"), to deal in the Software without
9 # restriction, including without limitation the rights to use, copy,
10 # modify, merge, publish, distribute, sublicense, and/or sell copies
11 # of the Software, and to permit persons to whom the Software is
12 # furnished to do so, subject to the following conditions:
13 #
14 # The above copyright notice and this permission notice shall be
15 # included in all copies or substantial portions of the Software.
16 #
17 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
21 # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
22 # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 # SOFTWARE.
25
26 AC_PREREQ([2.65])
27 AC_INIT([tinydtls], [0.8.1])
28 AC_CONFIG_SRCDIR([dtls.c])
29 dnl AC_CONFIG_HEADERS([config.h])
30
31 AC_ARG_WITH(contiki,
32   [AS_HELP_STRING([--with-contiki],[build libtinydtls for the Contiki OS])],
33   [AC_DEFINE(WITH_CONTIKI,1,[Define to 1 if building for Contiki.])
34    WITH_CONTIKI=1],
35   [])
36
37 AC_PATH_PROG(DOXYGEN, doxygen, [:])
38 AC_PATH_PROG(ETAGS, etags, [/bin/false])
39
40 if test "${with_contiki}" != "yes" ; then
41 # Checks for programs.
42 AC_PROG_MAKE_SET
43 AC_PROG_CC
44 AC_PROG_RANLIB
45
46 AC_C_BIGENDIAN
47
48 # Checks for libraries.
49 AC_SEARCH_LIBS([gethostbyname], [nsl])
50 AC_SEARCH_LIBS([socket], [socket])
51 fi
52
53 AC_ARG_WITH(debug,
54   [AS_HELP_STRING([--without-debug],[disable all debug output and assertions])],
55   [CPPFLAGS="${CPPFLAGS} -DNDEBUG"
56    NDEBUG=1], 
57   [])
58
59 AC_ARG_WITH(ecc,
60   [AS_HELP_STRING([--without-ecc],[disable support for TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8])],
61   [],
62   [AC_DEFINE(DTLS_ECC, 1, [Define to 1 if building with ECC support.])
63    OPT_OBJS="${OPT_OBJS} ecc/ecc.o"
64    DTLS_ECC=1])
65
66 AC_ARG_WITH(psk,
67   [AS_HELP_STRING([--without-psk],[disable support for TLS_PSK_WITH_AES_128_CCM_8])],
68   [],
69   [AC_DEFINE(DTLS_PSK, 1, [Define to 1 if building with PSK support])
70    DTLS_PSK=1])
71
72 CPPFLAGS="${CPPFLAGS} -DDTLSv12 -DWITH_SHA256"
73 OPT_OBJS="${OPT_OBJS} sha2/sha2.o"
74
75 AC_SUBST(OPT_OBJS)
76 AC_SUBST(NDEBUG)
77 AC_SUBST(WITH_CONTIKI)
78 AC_SUBST(DTLS_ECC)
79 AC_SUBST(DTLS_PSK)
80
81 if test "${with_contiki}" = "yes" ; then
82   AC_MSG_NOTICE([skipping header checks for Contiki])
83 else
84   # Checks for header files.
85   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])
86
87   AC_CHECK_HEADERS([sys/time.h time.h])
88   AC_CHECK_HEADERS([sys/types.h sys/stat.h])
89
90 # Checks for typedefs, structures, and compiler characteristics.
91 AC_C_INLINE
92 AC_TYPE_SIZE_T
93
94 AC_CHECK_MEMBER([struct sockaddr_in6.sin6_len],
95                 [AC_DEFINE(HAVE_SOCKADDR_IN6_SIN6_LEN, [1], 
96                   [Define to 1 if struct sockaddr_in6 has a member sin6_len.])], [], 
97                 [#include <netinet/in.h>])
98
99 # Checks for library functions.
100 AC_FUNC_MALLOC
101 AC_CHECK_FUNCS([memset select socket strdup strerror strnlen fls vprintf])
102 fi
103
104 AC_CONFIG_HEADERS([dtls_config.h tinydtls.h])
105
106 AC_CONFIG_FILES([Makefile
107                  doc/Makefile
108                  doc/Doxyfile
109                  tests/Makefile
110                  examples/contiki/Makefile
111                  platform-specific/Makefile
112                  sha2/Makefile
113                  aes/Makefile
114                  ecc/Makefile])
115 AC_OUTPUT