tests: add unregistered and no syscall tests
[librseq.git] / configure.ac
1 dnl SPDX-License-Identifier: MIT
2 dnl
3 dnl SPDX-FileCopyrightText: 2021 EfficiOS, Inc.
4 dnl
5 dnl Process this file with autoconf to produce a configure script.
6
7 # Project version information
8 m4_define([rseq_version_major], [0])
9 m4_define([rseq_version_minor], [1])
10 m4_define([rseq_version_patch], [0])
11 m4_define([rseq_version_dev_stage], [-pre])
12 m4_define([rseq_version], rseq_version_major[.]rseq_version_minor[.]rseq_version_patch[]rseq_version_dev_stage)
13
14 # Library version information of "librseq"
15 # Following the numbering scheme proposed by libtool for the library version
16 # http://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
17 m4_define([rseq_lib_version_current], [0])
18 m4_define([rseq_lib_version_revision], [0])
19 m4_define([rseq_lib_version_age], [0])
20 m4_define([rseq_lib_version], rseq_lib_version_current[:]rseq_lib_version_revision[:]rseq_lib_version_age)
21
22
23 ## ##
24 ## Autoconf base setup ##
25 ## ##
26
27 AC_PREREQ([2.69])
28 AC_INIT([librseq],[rseq_version],[mathieu dot desnoyers at efficios dot com],[],[https://github.com/compudj/librseq/])
29
30 AC_CONFIG_HEADERS([include/config.h])
31 AC_CONFIG_AUX_DIR([config])
32 AC_CONFIG_MACRO_DIR([m4])
33
34 AC_CANONICAL_TARGET
35 AC_CANONICAL_HOST
36
37
38 ## ##
39 ## Automake base setup ##
40 ## ##
41
42 AM_INIT_AUTOMAKE([1.12 foreign dist-bzip2 no-dist-gzip nostdinc -Wall -Werror])
43 AM_MAINTAINER_MODE([enable])
44
45 # Enable silent rules by default
46 AM_SILENT_RULES([yes])
47
48
49 ## ##
50 ## C compiler checks ##
51 ## ##
52
53 # Choose the C compiler
54 AC_PROG_CC
55 # AC_PROG_CC_STDC was merged in AC_PROG_CC in autoconf 2.70
56 m4_version_prereq([2.70], [], [AC_PROG_CC_STDC])
57
58 # Make sure the C compiler supports C99
59 AS_IF([test "$ac_cv_prog_cc_c99" = "no"], [AC_MSG_ERROR([The compiler does not support C99])])
60
61 # Enable available system extensions and LFS support
62 AC_USE_SYSTEM_EXTENSIONS
63 AC_SYS_LARGEFILE
64
65 # Make sure the C compiler supports __attribute__
66 AX_C___ATTRIBUTE__
67 AS_IF([test "x$ax_cv___attribute__" != "xyes"],
68 [AC_MSG_ERROR([The compiler does not support __attribute__ extensions])])
69
70 # Make sure we have pthread support
71 AX_PTHREAD([], [AC_MSG_ERROR([Could not configure pthread support])])
72
73 # Checks for typedefs, structures, and compiler characteristics.
74 AC_C_INLINE
75 AC_C_TYPEOF
76 AC_TYPE_INT32_T
77 AC_TYPE_INT64_T
78 AC_TYPE_OFF_T
79 AC_TYPE_SIZE_T
80 AC_TYPE_UINT32_T
81 AC_TYPE_UINT64_T
82
83 # Detect warning flags supported by the C compiler and append them to
84 # WARN_CFLAGS.
85 m4_define([WARN_FLAGS_LIST], [ dnl
86 -Wall dnl
87 -Wextra dnl
88 -Wmissing-prototypes dnl
89 -Wmissing-declarations dnl
90 -Wnull-dereference dnl
91 -Wundef dnl
92 -Wshadow dnl
93 -Wjump-misses-init dnl
94 -Wsuggest-attribute=format dnl
95 -Wtautological-constant-out-of-range-compare dnl
96 -Wnested-externs dnl
97 -Wwrite-strings dnl
98 -Wformat=2 dnl
99 -Wstrict-aliasing dnl
100 -Wmissing-noreturn dnl
101 -Winit-self dnl
102 -Wduplicated-cond dnl
103 -Wduplicated-branches dnl
104 -Wlogical-op dnl
105 -Wredundant-decls dnl
106 ])
107
108 # Pass -Werror as an extra flag during the test: this is needed to make the
109 # -Wunknown-warning-option diagnostic fatal with clang.
110 AC_LANG_PUSH([C])
111 AX_APPEND_COMPILE_FLAGS([WARN_FLAGS_LIST], [WARN_CFLAGS], [-Werror])
112 AC_LANG_POP([C])
113
114 AC_LANG_PUSH([C++])
115 AX_APPEND_COMPILE_FLAGS([WARN_FLAGS_LIST], [WARN_CXXFLAGS], [-Werror])
116 AC_LANG_POP([C++])
117
118 AE_IF_FEATURE_ENABLED([Werror], [WARN_CFLAGS="${WARN_CFLAGS} -Werror"])
119 AE_IF_FEATURE_ENABLED([Werror], [WARN_CXXFLAGS="${WARN_CXXFLAGS} -Werror"])
120
121
122 ## ##
123 ## C++ compiler checks ##
124 ## ##
125
126 # Require a C++11 compiler without GNU extensions (-std=c++11)
127 AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory])
128
129
130 ## ##
131 ## Header checks ##
132 ## ##
133
134 AC_HEADER_STDBOOL
135 AC_CHECK_HEADERS([ \
136 limits.h \
137 stddef.h \
138 sys/time.h \
139 ])
140
141
142 ## ##
143 ## Programs checks ##
144 ## ##
145
146 AM_PROG_AR
147 AC_PROG_AWK
148 AC_PROG_MAKE_SET
149
150 # Initialize and configure libtool
151 LT_INIT
152
153
154 ## ##
155 ## Library checks ##
156 ## ##
157
158 # Checks for library functions.
159 AC_FUNC_MMAP
160 AC_FUNC_FORK
161 AC_CHECK_FUNCS([ \
162 atexit \
163 memset \
164 strerror \
165 ])
166
167 # AC_FUNC_MALLOC causes problems when cross-compiling.
168 #AC_FUNC_MALLOC
169
170 # Check dor dlopen() in -ldl or -lc
171 AC_CHECK_LIB([dl], [dlopen], [
172 libdl_name=dl
173 DL_LIBS="-ldl"
174 ], [
175 # dlopen not found in libdl, check in libc
176 AC_CHECK_LIB([c], [dlopen], [
177 libdl_name=c
178 DL_LIBS="-lc"
179 ], [
180 AC_MSG_ERROR([Cannot find dlopen in libdl nor libc. Use [LDFLAGS]=-Ldir to specify their location.])
181 ])
182 ])
183 AC_SUBST(DL_LIBS)
184
185 PKG_CHECK_MODULES([SECCOMP], [libseccomp],
186 [
187 dnl PKG_CHECK_MODULES defines SECCOMP_LIBS
188 have_seccomp=yes
189 ],
190 [
191 have_seccomp=no
192 ])
193
194
195 ## ##
196 ## Optional features selection ##
197 ## ##
198
199 # When given, add -Werror to WARN_CFLAGS and WARN_CXXFLAGS.
200 # Disabled by default
201 AE_FEATURE_DEFAULT_DISABLE
202 AE_FEATURE([Werror], [Treat compiler warnings as errors.])
203
204
205 ## ##
206 ## Set automake variables for optional feature conditionnals in Makefile.am ##
207 ## ##
208
209 AM_CONDITIONAL([ENABLE_SECCOMP], test "x${have_seccomp}" = "xyes")
210
211
212 ## ##
213 ## Substitute variables for use in Makefile.am ##
214 ## ##
215
216 # Library versions for libtool
217 AC_SUBST([RSEQ_LIBRARY_VERSION], [rseq_lib_version])
218
219 # The order in which the include folders are searched is important.
220 # The top_builddir should always be searched first in the event that a build
221 # time generated file is included.
222 AM_CPPFLAGS="-I\$(top_builddir)/include -I\$(top_srcdir)/include -include config.h"
223 AC_SUBST(AM_CPPFLAGS)
224
225 AM_CFLAGS="$WARN_CFLAGS $PTHREAD_CFLAGS"
226 AC_SUBST(AM_CFLAGS)
227
228 AM_CXXFLAGS="$WARN_CXXFLAGS $PTHREAD_CFLAGS"
229 AC_SUBST(AM_CXXFLAGS)
230
231
232 ## ##
233 ## Output files generated by configure ##
234 ## ##
235
236 AC_CONFIG_FILES([
237 Makefile
238 doc/Makefile
239 doc/man/Makefile
240 include/Makefile
241 src/Makefile
242 src/librseq.pc
243 tests/Makefile
244 tests/utils/Makefile
245 tests/unit/Makefile
246 ])
247
248 AC_OUTPUT
249
250
251 #
252 # Mini-report on what will be built.
253 #
254
255 PPRINT_INIT
256 PPRINT_SET_INDENT(1)
257 PPRINT_SET_TS(38)
258
259 AS_ECHO
260 AS_ECHO("${PPRINT_COLOR_BLDBLU}librseq $PACKAGE_VERSION${PPRINT_COLOR_RST}")
261 AS_ECHO
262
263 PPRINT_SUBTITLE([Features])
264
265 PPRINT_PROP_STRING([Target architecture], $host_cpu)
266
267 report_bindir="`eval eval echo $bindir`"
268 report_libdir="`eval eval echo $libdir`"
269
270 # Print the bindir and libdir this `make install' will install into.
271 AS_ECHO
272 PPRINT_SUBTITLE([Install directories])
273 PPRINT_PROP_STRING([Binaries], [$report_bindir])
274 PPRINT_PROP_STRING([Libraries], [$report_libdir])
This page took 0.035947 seconds and 5 git commands to generate.