Remove unused pkg dependancy
[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 AC_ARG_WITH(x509,
73   [AS_HELP_STRING([--with-x509],[use dtls as transport protocol])],
74   [AC_DEFINE(DTLS_X509, 1, [Define to 1 if building with X.509 support])
75    DTLS_X509=1],
76   [])
77
78 AC_ARG_WITH(hal,
79   [AS_HELP_STRING([--with-hal],[use a hardware abstraction layer for crypto functions])],
80   [AC_DEFINE(DTLS_CRYPTO_HAL, 1, [Define to 1 if building with Hardware Abstraction Layer])
81    DTLS_CRYPTO_HAL=1],
82   [])
83
84 CPPFLAGS="${CPPFLAGS} -DDTLSv12 -DWITH_SHA256"
85 OPT_OBJS="${OPT_OBJS} sha2/sha2.o"
86
87 AC_SUBST(OPT_OBJS)
88 AC_SUBST(NDEBUG)
89 AC_SUBST(WITH_CONTIKI)
90 AC_SUBST(DTLS_ECC)
91 AC_SUBST(DTLS_PSK)
92
93 if test "${with_contiki}" = "yes" ; then
94   AC_MSG_NOTICE([skipping header checks for Contiki])
95 else
96   # Checks for header files.
97   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])
98
99   AC_CHECK_HEADERS([sys/time.h time.h])
100   AC_CHECK_HEADERS([sys/types.h sys/stat.h])
101
102 # Checks for typedefs, structures, and compiler characteristics.
103 AC_C_INLINE
104 AC_TYPE_SIZE_T
105
106 AC_CHECK_MEMBER([struct sockaddr_in6.sin6_len],
107                 [AC_DEFINE(HAVE_SOCKADDR_IN6_SIN6_LEN, [1], 
108                   [Define to 1 if struct sockaddr_in6 has a member sin6_len.])], [], 
109                 [#include <netinet/in.h>])
110
111 # Checks for library functions.
112 AC_FUNC_MALLOC
113 AC_CHECK_FUNCS([memset select socket strdup strerror strnlen fls vprintf])
114 fi
115
116 AC_CONFIG_HEADERS([dtls_config.h tinydtls.h])
117
118 AC_CONFIG_FILES([Makefile
119                  doc/Makefile
120                  doc/Doxyfile
121                  tests/Makefile
122                  examples/contiki/Makefile
123                  platform-specific/Makefile
124                  sha2/Makefile
125                  aes/Makefile
126                  ecc/Makefile])
127 AC_OUTPUT