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