fix: handle EINTR correctly in get_cpu_mask_from_sysfs
[libside.git] / configure.ac
CommitLineData
82abd52d
MJ
1dnl SPDX-License-Identifier: MIT
2dnl SPDX-FileCopyrightText: 2022 EfficiOS Inc.
3dnl
4dnl Process this file with autoconf to produce a configure script.
5
6# Project version information
67337c4a
MD
7m4_define([side_version_major], [0])
8m4_define([side_version_minor], [1])
9m4_define([side_version_patch], [0])
10m4_define([side_version_dev_stage], [-pre])
11m4_define([side_version], side_version_major[.]side_version_minor[.]side_version_patch[]side_version_dev_stage)
82abd52d 12
67337c4a 13# Library version information of "libside"
82abd52d
MJ
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
67337c4a
MD
16m4_define([side_lib_version_current], [0])
17m4_define([side_lib_version_revision], [0])
18m4_define([side_lib_version_age], [0])
19m4_define([side_lib_version], side_lib_version_current[:]side_lib_version_revision[:]side_lib_version_age)
82abd52d
MJ
20
21
22## ##
23## Autoconf base setup ##
24## ##
25
26AC_PREREQ([2.69])
67337c4a 27AC_INIT([libside],[side_version],[mathieu dot desnoyers at efficios dot com],[],[https://github.com/compudj/libside/])
82abd52d
MJ
28
29AC_CONFIG_HEADERS([include/config.h])
30AC_CONFIG_AUX_DIR([config])
31AC_CONFIG_MACRO_DIR([m4])
32
33AC_CANONICAL_TARGET
34AC_CANONICAL_HOST
35
36
37## ##
38## Automake base setup ##
39## ##
40
41AM_INIT_AUTOMAKE([1.12 foreign dist-bzip2 no-dist-gzip nostdinc subdir-objects -Wall -Werror])
42AM_MAINTAINER_MODE([enable])
43
44# Enable silent rules by default
45AM_SILENT_RULES([yes])
46
47
48## ##
49## C compiler checks ##
50## ##
51
52# Choose the C compiler
53AC_PROG_CC
54# AC_PROG_CC_STDC was merged in AC_PROG_CC in autoconf 2.70
55m4_version_prereq([2.70], [], [AC_PROG_CC_STDC])
56
57# Make sure the C compiler supports C99
58AS_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
61AC_USE_SYSTEM_EXTENSIONS
62AC_SYS_LARGEFILE
63
64# Make sure the C compiler supports __attribute__
65AX_C___ATTRIBUTE__
66AS_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
70AX_PTHREAD([], [AC_MSG_ERROR([Could not configure pthread support])])
71
72# Checks for typedefs, structures, and compiler characteristics.
73AC_C_INLINE
74AC_C_TYPEOF
75AC_TYPE_INT32_T
76AC_TYPE_INT64_T
77AC_TYPE_OFF_T
78AC_TYPE_SIZE_T
79AC_TYPE_UINT32_T
80AC_TYPE_UINT64_T
81
82# Detect warning flags supported by the C compiler and append them to
83# WARN_CFLAGS.
84m4_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.
109AC_LANG_PUSH([C])
110AX_APPEND_COMPILE_FLAGS([WARN_FLAGS_LIST], [WARN_CFLAGS], [-Werror])
111AC_LANG_POP([C])
112
113AC_LANG_PUSH([C++])
114AX_APPEND_COMPILE_FLAGS([WARN_FLAGS_LIST], [WARN_CXXFLAGS], [-Werror])
115AC_LANG_POP([C++])
116
117AE_IF_FEATURE_ENABLED([Werror], [WARN_CFLAGS="${WARN_CFLAGS} -Werror"])
118AE_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)
126AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory])
127
128
129## ##
130## Header checks ##
131## ##
132
133AC_HEADER_STDBOOL
134AC_CHECK_HEADERS([ \
135 limits.h \
136 stddef.h \
137 sys/time.h \
138])
139
140
141## ##
142## Programs checks ##
143## ##
144
145AM_PROG_AR
146AC_PROG_AWK
147AC_PROG_MAKE_SET
148
149# Initialize and configure libtool
150LT_INIT
151
152
153## ##
154## Library checks ##
155## ##
156
157# Checks for library functions.
158AC_FUNC_MMAP
159AC_FUNC_FORK
160AC_CHECK_FUNCS([ \
161 atexit \
162 memset \
163 strerror \
164])
165
166# AC_FUNC_MALLOC causes problems when cross-compiling.
167#AC_FUNC_MALLOC
168
169PKG_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
177AE_FEATURE_DEFAULT_DISABLE
178AE_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
67337c4a 186AC_SUBST([SIDE_LIBRARY_VERSION], [side_lib_version])
82abd52d
MJ
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.
191AM_CPPFLAGS="-I\$(top_builddir)/include -I\$(top_srcdir)/include -include config.h $RSEQ_CFLAGS"
192AC_SUBST(AM_CPPFLAGS)
193
194AM_CFLAGS="$WARN_CFLAGS $PTHREAD_CFLAGS"
195AC_SUBST(AM_CFLAGS)
196
197AM_CXXFLAGS="$WARN_CXXFLAGS $PTHREAD_CFLAGS"
198AC_SUBST(AM_CXXFLAGS)
199
200
201## ##
202## Output files generated by configure ##
203## ##
204
205AC_CONFIG_FILES([
206 Makefile
207 include/Makefile
208 src/Makefile
67337c4a 209 src/libside.pc
82abd52d
MJ
210 tests/Makefile
211 tests/utils/Makefile
212])
213
214AC_OUTPUT
215
216
217#
218# Mini-report on what will be built.
219#
220
221AE_PPRINT_INIT
222AE_PPRINT_SET_INDENT(1)
223AE_PPRINT_SET_TS(38)
224
225AS_ECHO
67337c4a 226AS_ECHO("${AE_PPRINT_COLOR_BLDBLU}libside $PACKAGE_VERSION${AE_PPRINT_COLOR_RST}")
82abd52d
MJ
227AS_ECHO
228
229AE_PPRINT_SUBTITLE([Features])
230
231AE_PPRINT_PROP_STRING([Target architecture], $host_cpu)
232
233report_bindir="`eval eval echo $bindir`"
234report_libdir="`eval eval echo $libdir`"
235
236# Print the bindir and libdir this `make install' will install into.
237AS_ECHO
238AE_PPRINT_SUBTITLE([Install directories])
239AE_PPRINT_PROP_STRING([Binaries], [$report_bindir])
240AE_PPRINT_PROP_STRING([Libraries], [$report_libdir])
This page took 0.035927 seconds and 4 git commands to generate.