-
Notifications
You must be signed in to change notification settings - Fork 28
/
configure.ac
207 lines (180 loc) · 6.75 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
#
# This file is part of systemd-bootchart.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# systemd is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
AC_PREREQ([2.64])
AC_INIT([systemd-bootchart],
[235],
[https://github.com/systemd/systemd-bootchart/issues],
[systemd-bootchart],
[https://github.com/systemd/systemd-bootchart/])
AC_CONFIG_SRCDIR([src/bootchart.c])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR([build-aux])
AC_USE_SYSTEM_EXTENSIONS
AC_SYS_LARGEFILE
AC_PREFIX_DEFAULT([/usr])
AM_MAINTAINER_MODE([enable])
AM_INIT_AUTOMAKE([foreign 1.11 -Wall -Wno-portability silent-rules tar-pax no-dist-gzip dist-xz subdir-objects parallel-tests])
AM_SILENT_RULES([yes])
AC_CANONICAL_HOST
AC_DEFINE_UNQUOTED([CANONICAL_HOST], "$host", [Canonical host string.])
LT_PREREQ(2.2)
LT_INIT([disable-static])
AC_PROG_CC_C99
SET_ARCH(X86_64, x86_64*)
SET_ARCH(IA32, i*86*)
SET_ARCH(MIPS, mips*)
SET_ARCH(AARCH64, aarch64*)
SET_ARCH(RISCV64, riscv64*)
AC_CHECK_SIZEOF(pid_t)
AC_CHECK_SIZEOF(uid_t)
AC_CHECK_SIZEOF(gid_t)
AC_CHECK_SIZEOF(time_t)
AC_CHECK_SIZEOF(dev_t)
AC_CHECK_SIZEOF(rlim_t,,[
#include <sys/time.h>
#include <sys/resource.h>
])
AC_CHECK_DECLS([gettid, getrandom], [], [], [[
#include <sys/types.h>
#include <unistd.h>
#include <sys/mount.h>
#include <linux/random.h>
]])
AC_ARG_WITH(libsystemd,
AS_HELP_STRING([--without-libsystemd], [Disable use of libsystemd for journal output]),
[], [with_libsystemd=yes])
AS_IF([test "x$with_libsystemd" != xno],
[PKG_CHECK_MODULES(LIBSYSTEMD, [libsystemd >= 221],
[AC_DEFINE([HAVE_LIBSYSTEMD],[1],[Define if you have libsystemd])],
[AC_MSG_ERROR([*** libsystemd library not found])]
)]
)
CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
-pipe \
-Wall \
-Wextra \
-Wundef \
"-Wformat=2 -Wformat-security -Wformat-nonliteral" \
-Wlogical-op \
-Wmissing-include-dirs \
-Wold-style-definition \
-Wpointer-arith \
-Winit-self \
-Wdeclaration-after-statement \
-Wfloat-equal \
-Wsuggest-attribute=noreturn \
-Werror=missing-prototypes \
-Werror=implicit-function-declaration \
-Werror=missing-declarations \
-Werror=return-type \
-Werror=shadow \
-Wstrict-prototypes \
-Wredundant-decls \
-Wmissing-noreturn \
-Wshadow \
-Wendif-labels \
-Wstrict-aliasing=2 \
-Wwrite-strings \
-Wno-unused-parameter \
-Wno-missing-field-initializers \
-Wno-unused-result \
-Wno-format-signedness \
-Werror=overflow \
-Wdate-time \
-Wnested-externs \
-ffast-math \
-fno-common \
-fdiagnostics-show-option \
-fno-strict-aliasing \
-fvisibility=hidden \
-fstack-protector \
-fstack-protector-strong \
-fPIE \
--param=ssp-buffer-size=4])
AS_CASE([$CC], [*clang*],
[CC_CHECK_FLAGS_APPEND([with_cppflags], [CPPFLAGS], [\
-Wno-typedef-redefinition \
-Wno-gnu-variable-sized-type-not-at-end \
])])
AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*],
[CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
-flto -ffat-lto-objects])],
[AC_MSG_RESULT([skipping -flto, optimization not enabled])])
AC_SUBST([OUR_CFLAGS], "$with_cflags $sanitizer_cflags")
AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*],
[CC_CHECK_FLAGS_APPEND([with_cppflags], [CPPFLAGS], [\
-Wp,-D_FORTIFY_SOURCE=2])],
[AC_MSG_RESULT([skipping -D_FORTIFY_SOURCE, optimization not enabled])])
AC_SUBST([OUR_CPPFLAGS], "$with_cppflags $sanitizer_cppflags")
AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*],
[CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
-Wl,--gc-sections])],
[AC_MSG_RESULT([skipping --gc-sections, optimization not enabled])])
AC_SUBST([OUR_CFLAGS], "$with_ldflags $sanitizer_cflags")
AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*],
[CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
-ffunction-sections -fdata-sections])],
[AC_MSG_RESULT([skipping -ffunction/data-section, optimization not enabled])])
AC_SUBST([OUR_CFLAGS], "$with_cflags $sanitizer_cflags")
CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
-Wl,--as-needed \
-Wl,--no-undefined \
-Wl,-z,relro \
-Wl,-z,now \
-pie])
AC_SUBST([OUR_LDFLAGS], "$with_ldflags $sanitizer_ldflags")
AC_ARG_WITH([rootprefix],
AS_HELP_STRING([--with-rootprefix=DIR], [rootfs directory prefix for config files and binaries necessary for boot]),
[], [with_rootprefix=${ac_default_prefix}])
# --with-rootprefix= (empty) should default to "/" but AX_NORMALIZE_PATH
# defaults those to ".", solve that here for now until we can find a suitable
# fix for AX_NORMALIZE_PATH upstream at autoconf-archive.
# See: https://github.com/systemd/systemd/issues/54
if test "x${with_rootprefix}" = "x"; then
with_rootprefix="/"
fi
AX_NORMALIZE_PATH([with_rootprefix])
AC_ARG_WITH([rootlibdir],
AS_HELP_STRING([--with-rootlibdir=DIR], [Root directory for libraries necessary for boot]),
[],
[with_rootlibdir=${libdir}])
AC_SUBST([rootprefix], [$with_rootprefix])
AC_SUBST([rootlibdir], [$with_rootlibdir])
AC_ARG_ENABLE([man],
AS_HELP_STRING([--disable-man],[Build the man pages (default: yes)]),
[build_man=$enableval],
[build_man=yes])
AC_PATH_PROG([XSLTPROC], [xsltproc])
AS_IF([test -z "$XSLTPROC" -a "$build_man" = "yes"],
[AC_MSG_ERROR([*** xsltproc is required for man pages])])
AM_CONDITIONAL([COND_man],[test "$build_man" = "yes"])
AC_CONFIG_FILES([
Makefile
])
AC_OUTPUT
AC_MSG_RESULT([
$PACKAGE_NAME $VERSION
prefix: ${prefix}
sysconf dir: ${sysconfdir}
datarootdir: ${datarootdir}
includedir: ${includedir}
lib dir: ${libdir}
rootlib dir: ${with_rootlibdir}
CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
CPPFLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}
LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS}
])