]> git.meshlink.io Git - meshlink/blob - configure.ac
Add blackbox test cases for submesh
[meshlink] / configure.ac
1 dnl Process this file with autoconf to produce a configure script.
2
3 AC_PREREQ(2.61)
4 AC_INIT([MeshLink], [0.1])
5 AM_INIT_AUTOMAKE([std-options subdir-objects nostdinc silent-rules -Wall])
6 AC_CONFIG_HEADERS([config.h])
7 AC_CONFIG_MACRO_DIR([m4])
8 AM_SILENT_RULES([yes])
9
10 # Enable GNU extensions.
11 # Define this here, not in acconfig's @TOP@ section, since definitions
12 # in the latter don't make it into the configure-time tests.
13 AC_GNU_SOURCE
14 AC_DEFINE([__USE_BSD], 1, [Enable BSD extensions])
15
16 dnl Checks for programs.
17 AM_PROG_CC_C_O
18 AM_PROG_AR
19 AC_PROG_CC_C99
20 AC_PROG_CXX
21 AC_PROG_CPP
22 AC_PROG_INSTALL
23 AC_PROG_LN_S
24 AC_PROG_LIBTOOL
25 AX_PTHREAD
26
27 dnl Check and set OS
28
29 AC_CANONICAL_HOST
30
31 case $host_os in
32   *linux*)
33     linux=true
34     AC_DEFINE(HAVE_LINUX, 1, [Linux])
35   ;;
36   *mingw*)
37     mingw=true
38     AC_DEFINE(HAVE_MINGW, 1, [MinGW])
39     LIBS="$LIBS -lws2_32 -lgdi32 -lcrypt32"
40   ;;
41 esac
42
43 AM_CONDITIONAL(LINUX, test "$linux" = true)
44 AM_CONDITIONAL(MINGW, test "$mingw" = true)
45
46 AC_CACHE_SAVE
47
48 if test -d /sw/include ; then
49   CPPFLAGS="$CPPFLAGS -I/sw/include"
50 fi
51 if test -d /sw/lib ; then
52   LIBS="$LIBS -L/sw/lib"
53 fi
54
55 dnl Compiler hardening flags
56 dnl No -fstack-protector-all because it doesn't work on all platforms or architectures.
57
58 AC_ARG_ENABLE([hardening], AS_HELP_STRING([--disable-hardening], [disable compiler and linker hardening flags]))
59 AS_IF([test "x$enable_hardening" != "xno"],
60   [CPPFLAGS="$CPPFLAGS -W -pedantic"
61    AX_CHECK_COMPILE_FLAG([-DFORTIFY_SOURCE=2], [CPPFLAGS="$CPPFLAGS -DFORITFY_SOURCE=2"])
62    AX_CHECK_COMPILE_FLAG([-fwrapv], [CPPFLAGS="$CPPFLAGS -fwrapv"],
63      [AX_CHECK_COMPILE_FLAG([-fno-strict-overflow], [CPPFLAGS="$CPPFLAGS -fno-strict-overflow"])]
64    )
65    case $host_os in
66      *mingw*)
67        AX_CHECK_LINK_FLAG([-Wl,--dynamicbase], [LDFLAGS="$LDFLAGS -Wl,--dynamicbase"])
68        AX_CHECK_LINK_FLAG([-Wl,--nxcompat], [LDFLAGS="$LDFLAGS -Wl,--nxcompat"])
69        ;;
70      *)
71        AX_CHECK_COMPILE_FLAG([-fPIC], [CPPFLAGS="$CPPFLAGS -fPIC"])
72        ;;
73    esac
74    AX_CHECK_LINK_FLAG([-Wl,-z,relro], [LDFLAGS="$LDFLAGS -Wl,-z,relro"])
75    AX_CHECK_LINK_FLAG([-Wl,-z,now], [LDFLAGS="$LDFLAGS -Wl,-z,now"])
76   ]
77 );
78
79 dnl Allow building without Catta
80 AC_ARG_ENABLE([catta], AS_HELP_STRING([--disable-catta], [disable linking with the Catta library]))
81 AS_IF([test "x$enable_catta" != "xno"],
82   AC_DEFINE(HAVE_CATTA, 1, [Link with Catta])
83   AC_CONFIG_SUBDIRS([catta])
84 )
85 AM_CONDITIONAL(CATTA, test "x$enable_catta" != "xno")
86
87 dnl UTCP debug flags
88 AC_ARG_ENABLE([utcp_debug], AS_HELP_STRING([--enable-utcp-debug], [compile utcp with debug output]))
89 AS_IF([test "x$enable_utcp_debug" = "xyes"],
90   [AX_CHECK_COMPILE_FLAG([-DUTCP_DEBUG], [CPPFLAGS="$CPPFLAGS -DUTCP_DEBUG"])
91   ]
92 );
93
94 dnl Blackbox test suite
95 PKG_CHECK_MODULES([CMOCKA], [cmocka >= 1.1.0], [cmocka=true], [cmocka=false])
96 PKG_CHECK_MODULES([LXC], [lxc >= 2.0.0], [lxc=true], [lxc=false])
97 AM_CONDITIONAL(BLACKBOX_TESTS, test "$cmocka" = true -a "$lxc" = true)
98
99 dnl Additional example code
100 PKG_CHECK_MODULES([NCURSES], [ncurses >= 5], [curses=true], [curses=false])
101 AM_CONDITIONAL(CURSES, test "$curses" = true)
102
103 dnl Install test binaries
104 AC_ARG_ENABLE([install_tests],
105   [AS_HELP_STRING([--enable-install-tests], [include test binaries in installation])],
106   [AS_IF([test "x$enable_install_tests" = "xyes"], [install_tests=true], [install_tests=false])],
107   [install_tests=false]
108 )
109
110 AM_CONDITIONAL(INSTALL_TESTS, test "$install_tests" = true)
111
112 dnl Checks for header files.
113 dnl We do this in multiple stages, because unlike Linux all the other operating systems really suck and don't include their own dependencies.
114
115 AC_CHECK_HEADERS([syslog.h sys/file.h sys/param.h sys/resource.h sys/socket.h sys/time.h sys/un.h sys/wait.h netdb.h arpa/inet.h dirent.h])
116
117 dnl Checks for typedefs, structures, and compiler characteristics.
118 MeshLink_ATTRIBUTE(__malloc__)
119 MeshLink_ATTRIBUTE(__warn_unused_result__)
120
121 AC_CHECK_TYPES([socklen_t, struct addrinfo, struct sockaddr_in6], , ,
122   [#include "$srcdir/src/have.h"]
123 )
124
125 AC_CHECK_TYPES([struct sockaddr_storage], ,AC_MSG_ERROR([System must support struct sockaddr_storage.]),
126   [#include "$srcdir/src/have.h"]
127 )
128
129 dnl Checks for library functions.
130 AC_TYPE_SIGNAL
131 AC_CHECK_FUNCS([asprintf fchmod fork gettimeofday random select strdup usleep],
132   [], [], [#include "$srcdir/src/have.h"]
133 )
134
135 dnl Support for SunOS
136
137 AC_CHECK_FUNC(socket, [], [
138   AC_CHECK_LIB(socket, connect)
139 ])
140 AC_CHECK_FUNC(gethostbyname, [], [
141   AC_CHECK_LIB(nsl, gethostbyname)
142 ])
143
144 AC_CHECK_DECLS([freeaddrinfo, gai_strerror, getaddrinfo, getnameinfo],
145   [], [], [#include "$srcdir/src/have.h"]
146 )
147
148 AC_CACHE_SAVE
149
150 AC_CONFIG_FILES([
151          Makefile
152          src/Makefile
153          doc/Makefile
154          test/Makefile
155          test/blackbox/Makefile
156          test/blackbox/run_blackbox_tests/Makefile
157          test/blackbox/test_case_channel_conn_01/Makefile
158          test/blackbox/test_case_channel_conn_02/Makefile
159          test/blackbox/test_case_channel_conn_03/Makefile
160          test/blackbox/test_case_channel_conn_04/Makefile
161          test/blackbox/test_case_channel_conn_05/Makefile
162          test/blackbox/test_case_channel_conn_06/Makefile
163          test/blackbox/test_case_channel_conn_07/Makefile
164          test/blackbox/test_case_channel_conn_08/Makefile
165          test/blackbox/test_case_meta_conn_01/Makefile
166          test/blackbox/test_case_meta_conn_02/Makefile
167          test/blackbox/test_case_meta_conn_03/Makefile
168          test/blackbox/test_case_meta_conn_04/Makefile
169          test/blackbox/test_case_meta_conn_05/Makefile
170          test/blackbox/test_cases_submesh01/Makefile
171          test/blackbox/test_cases_submesh02/Makefile
172          test/blackbox/test_cases_submesh03/Makefile
173          test/blackbox/test_cases_submesh04/Makefile
174          examples/Makefile
175 ])
176
177 AC_OUTPUT