]>
Commit | Line | Data |
---|---|---|
b08d5a8f UD |
1 | dnl Process this file with autoconf to produce a configure script. |
2 | dnl Configure input file for elfutils. -*-autoconf-*- | |
3 | dnl | |
e27e30ca | 4 | dnl Copyright (C) 1996-2019 Red Hat, Inc. |
b08d5a8f | 5 | dnl |
de2ed97f | 6 | dnl This file is part of elfutils. |
b08d5a8f | 7 | dnl |
de2ed97f MW |
8 | dnl This file is free software; you can redistribute it and/or modify |
9 | dnl it under the terms of the GNU General Public License as published by | |
10 | dnl the Free Software Foundation; either version 3 of the License, or | |
11 | dnl (at your option) any later version. | |
b08d5a8f | 12 | dnl |
de2ed97f MW |
13 | dnl elfutils is distributed in the hope that it will be useful, but |
14 | dnl WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | dnl GNU General Public License for more details. | |
b08d5a8f | 17 | dnl |
de2ed97f MW |
18 | dnl You should have received a copy of the GNU General Public License |
19 | dnl along with this program. If not, see <http://www.gnu.org/licenses/>. | |
01747645 | 20 | AC_INIT([elfutils],[0.185],[https://sourceware.org/bugzilla],[elfutils],[http://elfutils.org/]) |
b08d5a8f | 21 | |
34b037b8 MW |
22 | dnl Workaround for older autoconf < 2.64 |
23 | m4_ifndef([AC_PACKAGE_URL], | |
24 | [AC_DEFINE([PACKAGE_URL], ["http://elfutils.org/"], | |
25 | [Define to home page for this package]) | |
26 | AC_SUBST([PACKAGE_URL], ["http://elfutils.org/"])]) | |
27 | ||
fc5e808d DL |
28 | LIBDEBUGINFOD_SONAME=libdebuginfod.so.1 |
29 | AC_SUBST([LIBDEBUGINFOD_SONAME]) | |
30 | ||
9ba24584 MW |
31 | # We want eu- as default program prefix if none was given by the user. |
32 | # But if the user explicitly provided --program-prefix="" then pretend | |
33 | # it wasn't set at all (NONE). We want to test this really early before | |
34 | # configure has a chance to use the value. | |
35 | ||
36 | if test "x$program_prefix" = "xNONE"; then | |
37 | AC_MSG_NOTICE([No --program-prefix given, using "eu-"]) | |
38 | program_prefix="eu-" | |
39 | elif test "x$program_prefix" = "x"; then | |
40 | AC_MSG_NOTICE([Using no program-prefix]) | |
41 | program_prefix=NONE | |
42 | fi | |
43 | ||
b08d5a8f UD |
44 | AC_CONFIG_AUX_DIR([config]) |
45 | AC_CONFIG_FILES([config/Makefile]) | |
46 | ||
ae05738d | 47 | AC_COPYRIGHT([Copyright (C) 1996-2021 The elfutils developers.]) |
db12f164 | 48 | AC_PREREQ(2.63) dnl Minimum Autoconf version required. |
b08d5a8f | 49 | |
9aa8ef7f | 50 | dnl We use GNU make extensions; automake 1.10 defaults to -Wportability. |
86be792c | 51 | AM_INIT_AUTOMAKE([gnits 1.11 -Wno-portability dist-bzip2 no-dist-gzip parallel-tests]) |
c373d850 | 52 | AM_MAINTAINER_MODE |
b08d5a8f | 53 | |
c04f491f MW |
54 | AM_SILENT_RULES([yes]) |
55 | ||
b08d5a8f UD |
56 | AC_CONFIG_SRCDIR([libelf/libelf.h]) |
57 | AC_CONFIG_FILES([Makefile]) | |
58 | AC_CONFIG_HEADERS([config.h]) | |
59 | ||
b08d5a8f UD |
60 | dnl The RPM spec file. We substitute a few values in the file. |
61 | AC_CONFIG_FILES([elfutils.spec:config/elfutils.spec.in]) | |
62 | ||
288f6b19 | 63 | dnl debuginfo-server client & server parts. |
fc5e808d | 64 | AC_CONFIG_FILES([debuginfod/Makefile debuginfod/debuginfod.h]) |
b08d5a8f UD |
65 | |
66 | AC_CANONICAL_HOST | |
67 | ||
3284b799 RM |
68 | AC_ARG_ENABLE(deterministic-archives, |
69 | [AS_HELP_STRING([--enable-deterministic-archives], | |
70 | [ar and ranlib default to -D behavior])], [ | |
71 | if test "${enableval}" = no; then | |
72 | default_ar_deterministic=false | |
73 | else | |
74 | default_ar_deterministic=true | |
75 | fi], [default_ar_deterministic=false]) | |
76 | AC_DEFINE_UNQUOTED(DEFAULT_AR_DETERMINISTIC, $default_ar_deterministic, | |
77 | [Should ar and ranlib use -D behavior by default?]) | |
78 | ||
7e678fa3 | 79 | AC_ARG_ENABLE([thread-safety], |
09c9bb92 MW |
80 | AS_HELP_STRING([--enable-thread-safety], |
81 | [enable thread safety of libraries EXPERIMENTAL]), | |
82 | use_locks=$enableval, use_locks=no) | |
7e678fa3 UD |
83 | AM_CONDITIONAL(USE_LOCKS, test "$use_locks" = yes) |
84 | AS_IF([test "$use_locks" = yes], [AC_DEFINE(USE_LOCKS)]) | |
09c9bb92 MW |
85 | AS_IF([test "$use_locks" = yes], |
86 | [AC_MSG_WARN([thread-safety is EXPERIMENTAL tests might fail.])]) | |
d56e232f | 87 | |
7e678fa3 | 88 | AH_TEMPLATE([USE_LOCKS], [Defined if libraries should be thread-safe.]) |
b08d5a8f | 89 | |
b08d5a8f UD |
90 | AC_PROG_CC |
91 | AC_PROG_RANLIB | |
92 | AC_PROG_YACC | |
93 | AM_PROG_LEX | |
a45c8043 MF |
94 | # Only available since automake 1.12 |
95 | m4_ifdef([AM_PROG_AR], [AM_PROG_AR]) | |
96 | AC_CHECK_TOOL([READELF], [readelf]) | |
97 | AC_CHECK_TOOL([NM], [nm]) | |
b08d5a8f | 98 | |
aba6d762 MW |
99 | # We use -std=gnu99 but have explicit checks for some language constructs |
100 | # and GNU extensions since some compilers claim GNU99 support, but don't | |
101 | # really support all language extensions. In particular we need | |
102 | # Mixed Declarations and Code | |
103 | # https://gcc.gnu.org/onlinedocs/gcc/Mixed-Declarations.html | |
104 | # Nested Functions | |
105 | # https://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html | |
106 | # Arrays of Variable Length | |
107 | # https://gcc.gnu.org/onlinedocs/gcc/Variable-Length.html | |
108 | AC_CACHE_CHECK([for gcc with GNU99 support], ac_cv_c99, [dnl | |
b08d5a8f UD |
109 | old_CFLAGS="$CFLAGS" |
110 | CFLAGS="$CFLAGS -std=gnu99" | |
f64e25f2 | 111 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([dnl |
aba6d762 MW |
112 | int foo (int a) |
113 | { | |
114 | for (int i = 0; i < a; ++i) if (i % 4) break; int s = a; return s; | |
115 | } | |
116 | ||
117 | double bar (double a, double b) | |
118 | { | |
119 | double square (double z) { return z * z; } | |
120 | return square (a) + square (b); | |
121 | } | |
122 | ||
123 | void baz (int n) | |
124 | { | |
125 | struct S { int x[[n]]; }; | |
126 | }])], | |
b08d5a8f UD |
127 | ac_cv_c99=yes, ac_cv_c99=no) |
128 | CFLAGS="$old_CFLAGS"]) | |
129 | AS_IF([test "x$ac_cv_c99" != xyes], | |
aba6d762 | 130 | AC_MSG_ERROR([gcc with GNU99 support required])) |
b08d5a8f | 131 | |
1127470a UH |
132 | AC_CACHE_CHECK([whether gcc supports __attribute__((visibility()))], |
133 | ac_cv_visibility, [dnl | |
134 | save_CFLAGS="$CFLAGS" | |
135 | CFLAGS="$save_CFLAGS -Werror" | |
136 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([dnl | |
137 | int __attribute__((visibility("hidden"))) | |
138 | foo (int a) | |
139 | { | |
140 | return a; | |
141 | }])], ac_cv_visibility=yes, ac_cv_visibility=no) | |
142 | CFLAGS="$save_CFLAGS"]) | |
143 | if test "$ac_cv_visibility" = "yes"; then | |
144 | AC_DEFINE([HAVE_VISIBILITY], [1], | |
145 | [Defined if __attribute__((visibility())) is supported]) | |
146 | fi | |
147 | ||
17d7194d UH |
148 | AC_CACHE_CHECK([whether gcc supports __attribute__((gcc_struct))], |
149 | ac_cv_gcc_struct, [dnl | |
150 | save_CFLAGS="$CFLAGS" | |
151 | CFLAGS="$save_CFLAGS -Werror" | |
152 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([dnl | |
153 | struct test { int x; } __attribute__((gcc_struct)); | |
154 | ])], ac_cv_gcc_struct=yes, ac_cv_gcc_struct=no) | |
155 | CFLAGS="$save_CFLAGS"]) | |
156 | if test "$ac_cv_gcc_struct" = "yes"; then | |
157 | AC_DEFINE([HAVE_GCC_STRUCT], [1], | |
158 | [Defined if __attribute__((gcc_struct)) is supported]) | |
159 | fi | |
160 | ||
07737584 UH |
161 | AC_CACHE_CHECK([whether gcc supports -fPIC], ac_cv_fpic, [dnl |
162 | save_CFLAGS="$CFLAGS" | |
163 | CFLAGS="$save_CFLAGS -fPIC -Werror" | |
164 | AC_COMPILE_IFELSE([AC_LANG_SOURCE()], ac_cv_fpic=yes, ac_cv_fpic=no) | |
165 | CFLAGS="$save_CFLAGS" | |
166 | ]) | |
167 | if test "$ac_cv_fpic" = "yes"; then | |
168 | fpic_CFLAGS="-fPIC" | |
169 | else | |
170 | fpic_CFLAGS="" | |
171 | fi | |
172 | AC_SUBST([fpic_CFLAGS]) | |
173 | ||
174 | AC_CACHE_CHECK([whether gcc supports -fPIE], ac_cv_fpie, [dnl | |
175 | save_CFLAGS="$CFLAGS" | |
176 | CFLAGS="$save_CFLAGS -fPIE -Werror" | |
177 | AC_COMPILE_IFELSE([AC_LANG_SOURCE()], ac_cv_fpie=yes, ac_cv_fpie=no) | |
178 | CFLAGS="$save_CFLAGS" | |
179 | ]) | |
180 | if test "$ac_cv_fpie" = "yes"; then | |
181 | fpie_CFLAGS="-fPIE" | |
182 | else | |
183 | fpie_CFLAGS="" | |
184 | fi | |
185 | AC_SUBST([fpie_CFLAGS]) | |
186 | ||
187 | dso_LDFLAGS="-shared" | |
188 | ||
189 | ZDEFS_LDFLAGS="-Wl,-z,defs" | |
190 | AC_CACHE_CHECK([whether gcc supports $ZDEFS_LDFLAGS], ac_cv_zdefs, [dnl | |
191 | save_LDFLAGS="$LDFLAGS" | |
192 | LDFLAGS="$ZDEFS_LDFLAGS $save_LDFLAGS" | |
193 | AC_LINK_IFELSE([AC_LANG_PROGRAM()], ac_cv_zdefs=yes, ac_cv_zdefs=no) | |
194 | LDFLAGS="$save_LDFLAGS" | |
195 | ]) | |
196 | if test "$ac_cv_zdefs" = "yes"; then | |
197 | dso_LDFLAGS="$dso_LDFLAGS $ZDEFS_LDFLAGS" | |
198 | fi | |
199 | ||
cf1b5fe1 MW |
200 | # We really want build-ids. Warn and force generating them if gcc was |
201 | # configure without --enable-linker-build-id | |
202 | AC_CACHE_CHECK([whether the compiler generates build-ids], ac_cv_buildid, [dnl | |
9698a399 | 203 | AC_LINK_IFELSE([AC_LANG_PROGRAM()],[ac_cv_buildid=yes; $READELF -n conftest$EXEEXT | grep -q NT_GNU_BUILD_ID || ac_cv_buildid=no],AC_MSG_FAILURE([unexpected compile failure]))]) |
cf1b5fe1 MW |
204 | if test "$ac_cv_buildid" = "no"; then |
205 | AC_MSG_WARN([compiler doesn't generate build-id by default]) | |
206 | LDFLAGS="$LDFLAGS -Wl,--build-id" | |
207 | fi | |
208 | ||
07737584 UH |
209 | ZRELRO_LDFLAGS="-Wl,-z,relro" |
210 | AC_CACHE_CHECK([whether gcc supports $ZRELRO_LDFLAGS], ac_cv_zrelro, [dnl | |
211 | save_LDFLAGS="$LDFLAGS" | |
212 | LDFLAGS="$ZRELRO_LDFLAGS $save_LDFLAGS" | |
213 | AC_LINK_IFELSE([AC_LANG_PROGRAM()], ac_cv_zrelro=yes, ac_cv_zrelro=no) | |
214 | LDFLAGS="$save_LDFLAGS" | |
215 | ]) | |
216 | if test "$ac_cv_zrelro" = "yes"; then | |
217 | dso_LDFLAGS="$dso_LDFLAGS $ZRELRO_LDFLAGS" | |
218 | fi | |
219 | ||
220 | AC_SUBST([dso_LDFLAGS]) | |
221 | ||
8181739c | 222 | AC_CACHE_CHECK([for __thread support], ac_cv_tls, [dnl |
e72bf15c RM |
223 | # Use the same flags that we use for our DSOs, so the test is representative. |
224 | # Some old compiler/linker/libc combinations fail some ways and not others. | |
225 | save_CFLAGS="$CFLAGS" | |
226 | save_LDFLAGS="$LDFLAGS" | |
07737584 UH |
227 | CFLAGS="$fpic_CFLAGS $CFLAGS" |
228 | LDFLAGS="$dso_LDFLAGS $LDFLAGS" | |
8181739c | 229 | AC_LINK_IFELSE([dnl |
0a35e3ac MW |
230 | AC_LANG_PROGRAM([[#include <stdlib.h> |
231 | #undef __thread | |
e72bf15c | 232 | static __thread int a; int foo (int b) { return a + b; }]], |
8181739c | 233 | [[exit (foo (0));]])], |
e72bf15c RM |
234 | ac_cv_tls=yes, ac_cv_tls=no) |
235 | CFLAGS="$save_CFLAGS" | |
236 | LDFLAGS="$save_LDFLAGS"]) | |
7e678fa3 | 237 | AS_IF([test "x$ac_cv_tls" != xyes], |
8181739c | 238 | AC_MSG_ERROR([__thread support required])) |
7e678fa3 | 239 | |
98b69a97 | 240 | dnl Before 4.9 gcc doesn't ship stdatomic.h, but the necessary atomics are |
77b66a71 JA |
241 | dnl available by (at least) 4.7. So if the system doesn't have a stdatomic.h we |
242 | dnl fall back on one copied from FreeBSD that handles the difference. | |
243 | AC_CACHE_CHECK([whether gcc provides stdatomic.h], ac_cv_has_stdatomic, | |
244 | [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <stdatomic.h>]])], | |
245 | ac_cv_has_stdatomic=yes, ac_cv_has_stdatomic=no)]) | |
246 | AM_CONDITIONAL(HAVE_STDATOMIC_H, test "x$ac_cv_has_stdatomic" = xyes) | |
247 | AS_IF([test "x$ac_cv_has_stdatomic" = xyes], [AC_DEFINE(HAVE_STDATOMIC_H)]) | |
248 | ||
249 | AH_TEMPLATE([HAVE_STDATOMIC_H], [Define to 1 if `stdatomic.h` is provided by the | |
250 | system, 0 otherwise.]) | |
251 | ||
b08d5a8f UD |
252 | dnl This test must come as early as possible after the compiler configuration |
253 | dnl tests, because the choice of the file model can (in principle) affect | |
254 | dnl whether functions and headers are available, whether they work, etc. | |
255 | AC_SYS_LARGEFILE | |
256 | ||
ee225020 MW |
257 | dnl Older glibc had a broken fts that didn't work with Large File Systems. |
258 | dnl We want the version that can handler LFS, but include workaround if we | |
259 | dnl get a bad one. Add define to CFLAGS (not AC_DEFINE it) since we need to | |
260 | dnl check it before including config.h (which might define _FILE_OFFSET_BITS). | |
261 | AC_CACHE_CHECK([whether fts.h is bad when included (with LFS)], ac_cv_bad_fts, | |
262 | [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <fts.h>]])], | |
263 | ac_cv_bad_fts=no, ac_cv_bad_fts=yes)]) | |
ad7036f1 MW |
264 | AS_IF([test "x$ac_cv_bad_fts" = "xyes"], |
265 | [CFLAGS="$CFLAGS -DBAD_FTS=1" CXXFLAGS="$CXXFLAGS -DBAD_FTS=1"]) | |
ee225020 | 266 | |
01b994e3 MW |
267 | # See if we can add -D_FORTIFY_SOURCE=2. Don't do it if it is already |
268 | # (differently) defined or if it generates warnings/errors because we | |
269 | # don't use the right optimisation level (string.h will warn about that). | |
270 | AC_MSG_CHECKING([whether to add -D_FORTIFY_SOURCE=2 to CFLAGS]) | |
271 | case "$CFLAGS" in | |
272 | *-D_FORTIFY_SOURCE=2*) | |
273 | AC_MSG_RESULT([no, already there]) | |
274 | ;; | |
275 | *) | |
276 | save_CFLAGS="$CFLAGS" | |
c435a338 | 277 | CFLAGS="-D_FORTIFY_SOURCE=2 $CFLAGS -Werror" |
01b994e3 MW |
278 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ |
279 | #include <string.h> | |
280 | int main() { return 0; } | |
281 | ]])], [ AC_MSG_RESULT([yes]) | |
282 | CFLAGS="-D_FORTIFY_SOURCE=2 $save_CFLAGS" ], | |
283 | [ AC_MSG_RESULT([no]) | |
284 | CFLAGS="$save_CFLAGS"]) | |
285 | ;; | |
286 | esac | |
287 | ||
3cbdd387 | 288 | dnl enable debugging of branch prediction. |
28a0c615 | 289 | AC_ARG_ENABLE([debugpred], |
db12f164 | 290 | AS_HELP_STRING([--enable-debugpred],[build binaries with support to debug branch prediction]), |
8f3002e2 MF |
291 | [use_debugpred=$enableval], [use_debugpred=no]) |
292 | case $use_debugpred in | |
7702a3c1 MW |
293 | yes) use_debugpred_val=1 ;; |
294 | *) use_debugpred_val=0 ;; | |
8f3002e2 | 295 | esac |
7702a3c1 | 296 | AC_SUBST([DEBUGPRED], $use_debugpred_val) |
3cbdd387 | 297 | |
98b69a97 | 298 | dnl Enable gprof support. |
47be795d | 299 | AC_ARG_ENABLE([gprof], |
8f3002e2 | 300 | AS_HELP_STRING([--enable-gprof],[build binaries with gprof support]), [use_gprof=$enableval], [use_gprof=no]) |
47be795d UD |
301 | if test "$use_gprof" = yes; then |
302 | CFLAGS="$CFLAGS -pg" | |
303 | LDFLAGS="$LDFLAGS -pg" | |
304 | fi | |
305 | AM_CONDITIONAL(GPROF, test "$use_gprof" = yes) | |
fbe998a0 | 306 | |
98b69a97 | 307 | # Enable gcov support. |
fbe998a0 | 308 | AC_ARG_ENABLE([gcov], |
8f3002e2 | 309 | AS_HELP_STRING([--enable-gcov],[build binaries with gcov support]), [use_gcov=$enableval], [use_gcov=no]) |
fbe998a0 UD |
310 | if test "$use_gcov" = yes; then |
311 | CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage" | |
3f81dbd2 | 312 | CXXFLAGS="$CXXFLAGS -fprofile-arcs -ftest-coverage" |
fbe998a0 | 313 | LDFLAGS="$LDFLAGS -fprofile-arcs" |
2a16a0fc DL |
314 | AC_CHECK_PROG([GCOV], [gcov], [gcov]) |
315 | AC_CHECK_PROG([LCOV], [lcov], [lcov]) | |
316 | AC_CHECK_PROG([GENHTML], [genhtml], [genhtml]) | |
fbe998a0 | 317 | fi |
39cec7a0 | 318 | AM_CONDITIONAL(GCOV, test "$use_gcov" = yes) |
fbe998a0 | 319 | |
2b250b75 MW |
320 | AC_ARG_ENABLE([sanitize-undefined], |
321 | AS_HELP_STRING([--enable-sanitize-undefined], | |
322 | [Use gcc undefined behaviour sanitizer]), | |
323 | [use_undefined=$enableval], [use_undefined=no]) | |
324 | if test "$use_undefined" = yes; then | |
325 | old_CFLAGS="$CFLAGS" | |
326 | old_CXXFLAGS="$CXXFLAGS" | |
327 | # We explicitly use unaligned access when possible (see ALLOW_UNALIGNED) | |
328 | # We want to fail immediately on first error, don't try to recover. | |
170f1bb0 MW |
329 | CFLAGS="$CFLAGS -fsanitize=undefined -fno-sanitize-recover" |
330 | CXXFLAGS="$CXXFLAGS -fsanitize=undefined -fno-sanitize-recover" | |
331 | AC_LINK_IFELSE([AC_LANG_SOURCE([int main (int argc, char **argv) { return 0; }])], use_undefined=yes, use_undefined=no) | |
2b250b75 MW |
332 | AS_IF([test "x$use_undefined" != xyes], |
333 | AC_MSG_WARN([gcc undefined behaviour sanitizer not available]) | |
334 | CFLAGS="$old_CFLAGS" CXXFLAGS="$old_CXXFLAGS") | |
335 | fi | |
170f1bb0 MW |
336 | case $use_undefined in |
337 | yes) check_undefined_val=1 ;; | |
338 | *) check_undefined_val=0 ;; | |
339 | esac | |
340 | AC_DEFINE_UNQUOTED(CHECK_UNDEFINED, $check_undefined_val, | |
341 | [Building with -fsanitize=undefined or not]) | |
2b250b75 | 342 | |
e3e3ee26 MW |
343 | AC_ARG_ENABLE([valgrind], |
344 | AS_HELP_STRING([--enable-valgrind],[run all tests under valgrind]), | |
345 | [use_valgrind=$enableval], [use_valgrind=no]) | |
346 | if test "$use_valgrind" = yes; then | |
347 | AC_CHECK_PROG(HAVE_VALGRIND, valgrind, yes, no) | |
348 | if test "$HAVE_VALGRIND" = "no"; then | |
349 | AC_MSG_ERROR([valgrind not found]) | |
350 | fi | |
351 | fi | |
352 | AM_CONDITIONAL(USE_VALGRIND, test "$use_valgrind" = yes) | |
353 | ||
5e2a8e25 JA |
354 | AC_ARG_WITH([valgrind], |
355 | AS_HELP_STRING([--with-valgrind],[include directory for Valgrind headers]), | |
356 | [with_valgrind_headers=$withval], [with_valgrind_headers=no]) | |
357 | if test "x$with_valgrind_headers" != xno; then | |
358 | save_CFLAGS="$CFLAGS" | |
359 | CFLAGS="$CFLAGS -I$with_valgrind_headers" | |
360 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ | |
361 | #include <valgrind/valgrind.h> | |
362 | int main() { return 0; } | |
363 | ]])], [ HAVE_VALGRIND_HEADERS="yes" | |
364 | CFLAGS="$save_CFLAGS -I$with_valgrind_headers" ], | |
365 | [ AC_MSG_ERROR([invalid valgrind include directory: $with_valgrind_headers]) ]) | |
366 | fi | |
367 | ||
368 | AC_ARG_ENABLE([valgrind-annotations], | |
369 | AS_HELP_STRING([--enable-valgrind-annotations],[insert extra annotations for better valgrind support]), | |
370 | [use_vg_annotations=$enableval], [use_vg_annotations=no]) | |
371 | if test "$use_vg_annotations" = yes; then | |
372 | if test "x$HAVE_VALGRIND_HEADERS" != "xyes"; then | |
373 | AC_MSG_CHECKING([whether Valgrind headers are available]) | |
374 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ | |
375 | #include <valgrind/valgrind.h> | |
376 | int main() { return 0; } | |
377 | ]])], [ AC_MSG_RESULT([yes]) ], | |
378 | [ AC_MSG_ERROR([valgrind annotations requested but no headers are available]) ]) | |
379 | fi | |
380 | fi | |
381 | AM_CONDITIONAL(USE_VG_ANNOTATIONS, test "$use_vg_annotations" = yes) | |
382 | ||
b63007ed MW |
383 | AC_ARG_ENABLE([install-elfh], |
384 | AS_HELP_STRING([--enable-install-elfh],[install elf.h in include dir]), | |
385 | [install_elfh=$enableval], [install_elfh=no]) | |
386 | AM_CONDITIONAL(INSTALL_ELFH, test "$install_elfh" = yes) | |
387 | ||
47be795d | 388 | AM_CONDITIONAL(BUILD_STATIC, [dnl |
32324794 | 389 | test "$use_gprof" = yes -o "$use_gcov" = yes]) |
47be795d | 390 | |
1b8b446a | 391 | AC_ARG_ENABLE([tests-rpath], |
db12f164 | 392 | AS_HELP_STRING([--enable-tests-rpath],[build $ORIGIN-using rpath into tests]), |
8f3002e2 | 393 | [tests_use_rpath=$enableval], [tests_use_rpath=no]) |
1b8b446a RM |
394 | AM_CONDITIONAL(TESTS_RPATH, test "$tests_use_rpath" = yes) |
395 | ||
528cb45f | 396 | dnl zlib is mandatory. |
bca43152 RM |
397 | save_LIBS="$LIBS" |
398 | LIBS= | |
24169646 | 399 | eu_ZIPLIB(zlib,ZLIB,z,gzdirect,gzip) |
2d703bf1 | 400 | AS_IF([test "x$with_zlib" = xno], [AC_MSG_ERROR([zlib not found but is required])]) |
528cb45f MW |
401 | LIBS="$save_LIBS" |
402 | ||
52536d7d MW |
403 | dnl Test for bzlib and xz/lzma/zstd, gives BZLIB/LZMALIB/ZSTD .am |
404 | dnl conditional and config.h USE_BZLIB/USE_LZMALIB/USE_ZSTD #define. | |
528cb45f MW |
405 | save_LIBS="$LIBS" |
406 | LIBS= | |
24169646 | 407 | eu_ZIPLIB(bzlib,BZLIB,bz2,BZ2_bzdopen,bzip2) |
0aa60ac6 MW |
408 | # We need this since bzip2 doesn't have a pkgconfig file. |
409 | BZ2_LIB="$LIBS" | |
410 | AC_SUBST([BZ2_LIB]) | |
24169646 | 411 | eu_ZIPLIB(lzma,LZMA,lzma,lzma_auto_decoder,[LZMA (xz)]) |
0aa60ac6 MW |
412 | AS_IF([test "x$with_lzma" = xyes], [LIBLZMA="liblzma"], [LIBLZMA=""]) |
413 | AC_SUBST([LIBLZMA]) | |
52536d7d MW |
414 | eu_ZIPLIB(zstd,ZSTD,zstd,ZSTD_decompress,[ZSTD (zst)]) |
415 | AS_IF([test "x$with_zstd" = xyes], [LIBZSTD="libzstd"], [LIBLZSTD=""]) | |
416 | AC_SUBST([LIBZSTD]) | |
bca43152 RM |
417 | zip_LIBS="$LIBS" |
418 | LIBS="$save_LIBS" | |
419 | AC_SUBST([zip_LIBS]) | |
420 | ||
a24d52ac AO |
421 | AC_CHECK_DECLS([memrchr, rawmemchr],[],[], |
422 | [#define _GNU_SOURCE | |
423 | #include <string.h>]) | |
424 | AC_CHECK_DECLS([powerof2],[],[],[#include <sys/param.h>]) | |
b3248e68 UH |
425 | AC_CHECK_DECLS([mempcpy],[],[], |
426 | [#define _GNU_SOURCE | |
427 | #include <string.h>]) | |
a24d52ac | 428 | |
afffdff2 MW |
429 | AC_CHECK_FUNCS([process_vm_readv]) |
430 | ||
8db222e3 ÉR |
431 | old_CFLAGS="$CFLAGS" |
432 | CFLAGS="$CFLAGS -D_GNU_SOURCE" | |
433 | AC_FUNC_STRERROR_R() | |
434 | CFLAGS="$old_CFLAGS" | |
435 | ||
b4a16cf0 UD |
436 | AC_CHECK_LIB([stdc++], [__cxa_demangle], [dnl |
437 | AC_DEFINE([USE_DEMANGLE], [1], [Defined if demangling is enabled])]) | |
1ce4a459 MF |
438 | AM_CONDITIONAL(DEMANGLE, test "x$ac_cv_lib_stdcpp___cxa_demangle" = "xyes") |
439 | AS_IF([test "x$ac_cv_lib_stdcpp___cxa_demangle" = "xyes"], | |
e6e80dae | 440 | [enable_demangler=yes],[enable_demangler=no]) |
b4a16cf0 | 441 | |
805ec833 MW |
442 | AC_ARG_ENABLE([textrelcheck], |
443 | AS_HELP_STRING([--disable-textrelcheck], | |
444 | [Disable textrelcheck being a fatal error])) | |
445 | AM_CONDITIONAL(FATAL_TEXTREL, [test "x$enable_textrelcheck" != "xno"]) | |
7702a3c1 MW |
446 | AS_IF([test "x$enable_textrelcheck" != "xno"], |
447 | [enable_textrelcheck=yes],[enable_textrelcheck=no]) | |
805ec833 | 448 | |
bafacaca MF |
449 | AC_ARG_ENABLE([symbol-versioning], |
450 | AS_HELP_STRING([--disable-symbol-versioning], | |
451 | [Disable symbol versioning in shared objects])) | |
4a3330a9 UH |
452 | |
453 | AC_CACHE_CHECK([whether symbol versioning is supported], ac_cv_symbol_versioning, [dnl | |
454 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([dnl | |
455 | #define NEW_VERSION(name, version) \ | |
456 | asm (".symver " #name "," #name "@@@" #version); | |
457 | int foo(int x) { return x + 1; } | |
458 | NEW_VERSION (foo, ELFUTILS_12.12) | |
459 | ])], ac_cv_symbol_versioning=yes, ac_cv_symbol_versioning=no)]) | |
460 | if test "$ac_cv_symbol_versioning" = "no"; then | |
461 | if test "x$enable_symbol_versioning" != "xno"; then | |
462 | AC_MSG_ERROR([Symbol versioning is not supported. | |
463 | Use --disable-symbol-versioning to build without.]) | |
464 | fi | |
465 | fi | |
466 | ||
bafacaca MF |
467 | AM_CONDITIONAL(SYMBOL_VERSIONING, [test "x$enable_symbol_versioning" != "xno"]) |
468 | AS_IF([test "x$enable_symbol_versioning" = "xno"], | |
7702a3c1 MW |
469 | [AC_MSG_WARN([Disabling symbol versioning breaks ABI compatibility.]) |
470 | enable_symbol_versioning=no],[enable_symbol_versioning=yes]) | |
bafacaca | 471 | |
4b7953db MW |
472 | AC_CACHE_CHECK([whether gcc accepts -Wstack-usage], ac_cv_stack_usage, [dnl |
473 | old_CFLAGS="$CFLAGS" | |
239cd48b | 474 | CFLAGS="$CFLAGS -Wstack-usage=262144 -Werror" |
4b7953db MW |
475 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([])], |
476 | ac_cv_stack_usage=yes, ac_cv_stack_usage=no) | |
477 | CFLAGS="$old_CFLAGS"]) | |
478 | AM_CONDITIONAL(ADD_STACK_USAGE_WARNING, [test "x$ac_cv_stack_usage" != "xno"]) | |
479 | ||
8bc1423b MW |
480 | # -Wlogical-op was too fragile in the past, make sure we get a sane one. |
481 | AC_CACHE_CHECK([whether gcc has a sane -Wlogical-op], ac_cv_logical_op, [dnl | |
482 | old_CFLAGS="$CFLAGS" | |
483 | CFLAGS="$CFLAGS -Wlogical-op -Werror" | |
484 | AC_COMPILE_IFELSE([AC_LANG_SOURCE( | |
485 | [#define FLAG 1 | |
486 | int f (int r, int f) { return (r && (FLAG || (FLAG & f))); }])], | |
487 | ac_cv_logical_op=yes, ac_cv_logical_op=no) | |
488 | CFLAGS="$old_CFLAGS"]) | |
489 | AM_CONDITIONAL(SANE_LOGICAL_OP_WARNING, | |
490 | [test "x$ac_cv_logical_op" != "xno"]) | |
491 | ||
492 | # -Wduplicated-cond was added by GCC6 | |
493 | AC_CACHE_CHECK([whether gcc accepts -Wduplicated-cond], ac_cv_duplicated_cond, [dnl | |
494 | old_CFLAGS="$CFLAGS" | |
239cd48b | 495 | CFLAGS="$CFLAGS -Wduplicated-cond -Werror" |
8bc1423b MW |
496 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([])], |
497 | ac_cv_duplicated_cond=yes, ac_cv_duplicated_cond=no) | |
498 | CFLAGS="$old_CFLAGS"]) | |
499 | AM_CONDITIONAL(HAVE_DUPLICATED_COND_WARNING, | |
500 | [test "x$ac_cv_duplicated_cond" != "xno"]) | |
501 | ||
6993d408 MW |
502 | # -Wnull-dereference was added by GCC6 |
503 | AC_CACHE_CHECK([whether gcc accepts -Wnull-dereference], ac_cv_null_dereference, [dnl | |
504 | old_CFLAGS="$CFLAGS" | |
239cd48b | 505 | CFLAGS="$CFLAGS -Wnull-dereference -Werror" |
6993d408 MW |
506 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([])], |
507 | ac_cv_null_dereference=yes, ac_cv_null_dereference=no) | |
508 | CFLAGS="$old_CFLAGS"]) | |
509 | AM_CONDITIONAL(HAVE_NULL_DEREFERENCE_WARNING, | |
510 | [test "x$ac_cv_null_dereference" != "xno"]) | |
511 | ||
a3cc8182 MW |
512 | # -Wimplicit-fallthrough was added by GCC7 |
513 | AC_CACHE_CHECK([whether gcc accepts -Wimplicit-fallthrough], ac_cv_implicit_fallthrough, [dnl | |
514 | old_CFLAGS="$CFLAGS" | |
515 | CFLAGS="$CFLAGS -Wimplicit-fallthrough -Werror" | |
516 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([])], | |
517 | ac_cv_implicit_fallthrough=yes, ac_cv_implicit_fallthrough=no) | |
518 | CFLAGS="$old_CFLAGS"]) | |
519 | AM_CONDITIONAL(HAVE_IMPLICIT_FALLTHROUGH_WARNING, | |
520 | [test "x$ac_cv_implicit_fallthrough" != "xno"]) | |
521 | ||
d6c85cff TB |
522 | # Check whether the compiler additionally accepts -Wimplicit-fallthrough=5 |
523 | # GCC accepts this and 5 means "don't parse any fallthrough comments and | |
524 | # only accept the fallthrough attribute" | |
525 | AC_CACHE_CHECK([whether the compiler accepts -Wimplicit-fallthrough=5], ac_cv_implicit_fallthrough_5, [dnl | |
526 | old_CFLAGS="$CFLAGS" | |
527 | CFLAGS="$CFLAGS -Wimplicit-fallthrough=5 -Werror" | |
528 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([])], | |
529 | ac_cv_implicit_fallthrough_5=yes, ac_cv_implicit_fallthrough_5=no) | |
530 | CFLAGS="$old_CFLAGS"]) | |
531 | AM_CONDITIONAL(HAVE_IMPLICIT_FALLTHROUGH_5_WARNING, | |
532 | [test "x$ac_cv_implicit_fallthrough_5" != "xno"]) | |
533 | ||
555e15eb JW |
534 | # Assume the fallthrough attribute is supported if -Wimplict-fallthrough is supported |
535 | if test "$ac_cv_implicit_fallthrough" = "yes"; then | |
536 | AC_DEFINE([HAVE_FALLTHROUGH], [1], | |
537 | [Defined if __attribute__((fallthrough)) is supported]) | |
538 | fi | |
539 | ||
00d92d0b TB |
540 | AC_CACHE_CHECK([whether the compiler accepts -Wtrampolines], ac_cv_trampolines, [dnl |
541 | old_CFLAGS="$CFLAGS" | |
542 | CFLAGS="$CFLAGS -Wtrampolines -Werror" | |
543 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([])], | |
544 | ac_cv_trampolines=yes, ac_cv_trampolines=no) | |
545 | CFLAGS="$old_CFLAGS"]) | |
546 | AM_CONDITIONAL(HAVE_TRAMPOLINES_WARNING, | |
547 | [test "x$ac_cv_trampolines" != "xno"]) | |
548 | ||
1645d4a7 TB |
549 | AC_CACHE_CHECK([whether the compiler accepts -Wno-packed-not-aligned], ac_cv_no_packed_not_aligned, [dnl |
550 | old_CFLAGS="$CFLAGS" | |
551 | CFLAGS="$CFLAGS -Wno-packed-not-aligned -Werror" | |
552 | AC_COMPILE_IFELSE([AC_LANG_SOURCE([])], | |
553 | ac_cv_no_packed_not_aligned=yes, ac_cv_no_packed_not_aligned=no) | |
554 | CFLAGS="$old_CFLAGS"]) | |
555 | AM_CONDITIONAL(HAVE_NO_PACKED_NOT_ALIGNED_WARNING, | |
556 | [test "x$ac_cv_no_packed_not_aligned" != "xno"]) | |
557 | ||
be084ccb DL |
558 | saved_LIBS="$LIBS" |
559 | AC_SEARCH_LIBS([argp_parse], [argp]) | |
560 | LIBS="$saved_LIBS" | |
561 | case "$ac_cv_search_argp_parse" in | |
562 | no) AC_MSG_FAILURE([failed to find argp_parse]) ;; | |
563 | -l*) argp_LDADD="$ac_cv_search_argp_parse" ;; | |
564 | *) argp_LDADD= ;; | |
565 | esac | |
1ab3c2be AB |
566 | AC_SUBST([argp_LDADD]) |
567 | ||
da855fc9 ÉR |
568 | saved_LIBS="$LIBS" |
569 | AC_SEARCH_LIBS([fts_close], [fts]) | |
570 | LIBS="$saved_LIBS" | |
571 | case "$ac_cv_search_fts_close" in | |
572 | no) AC_MSG_FAILURE([failed to find fts_close]) ;; | |
573 | -l*) fts_LIBS="$ac_cv_search_fts_close" ;; | |
574 | *) fts_LIBS= ;; | |
575 | esac | |
576 | AC_SUBST([fts_LIBS]) | |
577 | ||
578 | saved_LIBS="$LIBS" | |
579 | AC_SEARCH_LIBS([_obstack_free], [obstack]) | |
580 | LIBS="$saved_LIBS" | |
581 | case "$ac_cv_search__obstack_free" in | |
8ffada54 | 582 | no) AC_MSG_FAILURE([failed to find _obstack_free]) ;; |
da855fc9 ÉR |
583 | -l*) obstack_LIBS="$ac_cv_search__obstack_free" ;; |
584 | *) obstack_LIBS= ;; | |
585 | esac | |
586 | AC_SUBST([obstack_LIBS]) | |
587 | ||
b08d5a8f UD |
588 | dnl The directories with content. |
589 | ||
590 | dnl Documentation. | |
f0a51767 | 591 | AC_CONFIG_FILES([doc/Makefile]) |
b08d5a8f UD |
592 | |
593 | dnl Support library. | |
594 | AC_CONFIG_FILES([lib/Makefile]) | |
595 | ||
596 | dnl ELF library. | |
2c9ee4f9 | 597 | AC_CONFIG_FILES([libelf/Makefile]) |
b08d5a8f UD |
598 | |
599 | dnl Higher-level ELF support library. | |
600 | AC_CONFIG_FILES([libebl/Makefile]) | |
601 | ||
9380297e MW |
602 | dnl DWARF-ELF Lower-level Functions support library. |
603 | AC_CONFIG_FILES([libdwelf/Makefile]) | |
604 | ||
b08d5a8f UD |
605 | dnl DWARF library. |
606 | AC_CONFIG_FILES([libdw/Makefile]) | |
607 | ||
608 | dnl Higher-level DWARF support library. | |
609 | AC_CONFIG_FILES([libdwfl/Makefile]) | |
610 | ||
611 | dnl CPU handling library. | |
612 | AC_CONFIG_FILES([libcpu/Makefile]) | |
613 | ||
614 | dnl Assembler library. | |
615 | AC_CONFIG_FILES([libasm/Makefile]) | |
616 | ||
e47ab76f RM |
617 | dnl CPU-specific backend libraries. |
618 | AC_CONFIG_FILES([backends/Makefile]) | |
619 | ||
b08d5a8f UD |
620 | dnl Tools. |
621 | AC_CONFIG_FILES([src/Makefile po/Makefile.in]) | |
622 | ||
623 | dnl Test suite. | |
624 | AC_CONFIG_FILES([tests/Makefile]) | |
625 | ||
0aa60ac6 | 626 | dnl pkgconfig files |
288f6b19 | 627 | AC_CONFIG_FILES([config/libelf.pc config/libdw.pc config/libdebuginfod.pc]) |
0aa60ac6 | 628 | |
dd52d2ab DL |
629 | dnl As long as "git grep 'PRI[diouxX]' po" reports matches in |
630 | dnl translatable strings, we must use need-formatstring-macros here. | |
631 | AM_GNU_GETTEXT([external], [need-formatstring-macros]) | |
632 | ||
633 | dnl AM_GNU_GETTEXT_VERSION is still needed for old versions | |
634 | dnl of autoreconf that do not recognize AM_GNU_GETTEXT_REQUIRE_VERSION. | |
635 | dnl 0.19.6 is the first version of gettext that provides | |
636 | dnl AM_GNU_GETTEXT_REQUIRE_VERSION support. | |
637 | AM_GNU_GETTEXT_VERSION([0.19.6]) | |
638 | AM_GNU_GETTEXT_REQUIRE_VERSION([0.19.6]) | |
b08d5a8f | 639 | |
b4d6f0f8 RM |
640 | dnl Appended to the config.h file. |
641 | dnl We hide all kinds of configuration magic in lib/eu-config.h. | |
642 | AH_BOTTOM([#include <eu-config.h>]) | |
b08d5a8f | 643 | |
fbc7245d RM |
644 | dnl Version compatibility header. |
645 | AC_CONFIG_FILES([version.h:config/version.h.in]) | |
646 | AC_SUBST([eu_version]) | |
ee9d60de RM |
647 | |
648 | # 1.234<whatever> -> 1234<whatever> | |
649 | case "$PACKAGE_VERSION" in | |
e9bf1d30 | 650 | [[0-9]].*) eu_version=`echo "$PACKAGE_VERSION" | sed 's@\.@@'` ;; |
ee9d60de RM |
651 | *) AC_MSG_ERROR([confused by version number '$PACKAGE_VERSION']) ;; |
652 | esac | |
653 | case "$eu_version" in | |
654 | *.*) | |
655 | # 1234.567 -> "1234", "567" | |
656 | eu_extra_version="${eu_version#*.}" | |
657 | eu_version="${eu_version%%.*}" | |
658 | case "$eu_extra_version" in | |
659 | [[0-9]][[0-9]][[0-9]]) ;; | |
660 | [[0-9]][[0-9]]) eu_extra_version="${eu_extra_version}0" ;; | |
661 | [[0-9]]) eu_extra_version="${eu_extra_version}00" ;; | |
662 | *) AC_MSG_ERROR([confused by version number '$PACKAGE_VERSION']) ;; | |
663 | esac | |
664 | ;; | |
665 | *) | |
666 | eu_extra_version=000 | |
667 | ;; | |
668 | esac | |
669 | ||
670 | case "$eu_version" in | |
671 | 0[[0-9]][[0-9]][[0-9]]) eu_version="${eu_version#0}$eu_extra_version" ;; | |
672 | [[0-9]][[0-9]][[0-9]][[0-9]]) eu_version="${eu_version}$eu_extra_version" ;; | |
673 | [[0-9]][[0-9]][[0-9]]) eu_version="${eu_version}0$eu_extra_version" ;; | |
2c71252e | 674 | [[0-9]][[0-9]]) eu_version="${eu_version}00$eu_extra_version";; |
ee9d60de | 675 | *) AC_MSG_ERROR([confused by version number '$PACKAGE_VERSION']) ;; |
fbc7245d RM |
676 | esac |
677 | ||
105e3984 | 678 | # Round up to the next release API (x.y) version. |
e9bf1d30 | 679 | eu_version=$(( (eu_version + 999) / 1000 )) |
105e3984 | 680 | |
0b867460 JK |
681 | AC_CHECK_SIZEOF(long) |
682 | ||
c1e0fcb9 KM |
683 | # On aarch64 before glibc 2.20 we would get the kernel user_pt_regs instead |
684 | # of the user_regs_struct from sys/user.h. They are structurally the same | |
685 | # but we get either one or the other. | |
686 | AC_CHECK_TYPE([struct user_regs_struct], | |
687 | [sys_user_has_user_regs=yes], [sys_user_has_user_regs=no], | |
688 | [[#include <sys/ptrace.h>] | |
689 | [#include <sys/time.h>] | |
690 | [#include <sys/user.h>]]) | |
691 | if test "$sys_user_has_user_regs" = "yes"; then | |
692 | AC_DEFINE(HAVE_SYS_USER_REGS, 1, | |
693 | [Define to 1 if <sys/user.h> defines struct user_regs_struct]) | |
694 | fi | |
695 | ||
0b867460 JK |
696 | # On a 64-bit host where can can use $CC -m32, we'll run two sets of tests. |
697 | # Likewise in a 32-bit build on a host where $CC -m64 works. | |
698 | utrace_BIARCH | |
699 | # `$utrace_biarch' will be `-m64' even on an uniarch i386 machine. | |
8ae9bc9d | 700 | CC_BIARCH="$CC $utrace_biarch" |
0b867460 JK |
701 | AC_SUBST([CC_BIARCH]) |
702 | ||
4664fd58 MW |
703 | # In maintainer mode we really need flex and bison. |
704 | # Otherwise we really need a release dir with maintainer files generated. | |
705 | if test "x$enable_maintainer_mode" = xyes; then | |
706 | AC_CHECK_PROG(HAVE_FLEX, flex, yes, no) | |
707 | if test "$HAVE_FLEX" = "no"; then | |
708 | AC_MSG_ERROR([flex needed in maintainer mode]) | |
709 | fi | |
710 | AC_CHECK_PROG(HAVE_BISON, bison, yes, no) | |
711 | if test "$HAVE_BISON" = "no"; then | |
712 | AC_MSG_ERROR([bison needed in maintainer mode]) | |
713 | fi | |
d6126841 RB |
714 | AC_CHECK_PROG(HAVE_GAWK, gawk, yes, no) |
715 | if test "$HAVE_GAWK" = "no"; then | |
716 | AC_MSG_ERROR([gawk needed in maintainer mode]) | |
717 | fi | |
4664fd58 MW |
718 | else |
719 | if test ! -f ${srcdir}/libdw/known-dwarf.h; then | |
720 | AC_MSG_ERROR([No libdw/known-dwarf.h. configure --enable-maintainer-mode]) | |
721 | fi | |
722 | fi | |
723 | ||
724 | # The testfiles are all compressed, we need bunzip2 when running make check | |
725 | AC_CHECK_PROG(HAVE_BUNZIP2, bunzip2, yes, no) | |
726 | if test "$HAVE_BUNZIP2" = "no"; then | |
727 | AC_MSG_WARN([No bunzip2, needed to run make check]) | |
728 | fi | |
729 | ||
52536d7d MW |
730 | # For tests that need to use zstd compression |
731 | AC_CHECK_PROG(HAVE_ZSTD, zstd, yes, no) | |
732 | AM_CONDITIONAL([HAVE_ZSTD],[test "x$HAVE_ZSTD" = "xyes"]) | |
733 | ||
f7f0cdc5 MW |
734 | # Look for libcurl for libdebuginfod minimum version as per rhel7. |
735 | AC_ARG_ENABLE([libdebuginfod],AC_HELP_STRING([--enable-libdebuginfod], [Build debuginfod client library (can be =dummy)])) | |
736 | AS_IF([test "x$enable_libdebuginfod" != "xno"], [ | |
737 | if test "x$enable_libdebuginfod" != "xdummy"; then | |
738 | AC_MSG_NOTICE([checking libdebuginfod dependencies, --disable-libdebuginfod or --enable-libdebuginfo=dummy to skip]) | |
739 | enable_libdebuginfod=yes # presume success | |
740 | PKG_PROG_PKG_CONFIG | |
741 | PKG_CHECK_MODULES([libcurl],[libcurl >= 7.29.0],[],[enable_libdebuginfod=no]) | |
742 | if test "x$enable_libdebuginfod" = "xno"; then | |
743 | AC_MSG_ERROR([dependencies not found, use --disable-libdebuginfod to disable or --enable-libdebuginfod=dummy to build a (bootstrap) dummy library.]) | |
744 | fi | |
745 | else | |
746 | AC_MSG_NOTICE([building (bootstrap) dummy libdebuginfo library]) | |
747 | fi | |
748 | ]) | |
749 | ||
69fc2b3a FCE |
750 | AC_CHECK_LIB(pthread, pthread_setname_np, [ |
751 | AC_DEFINE([HAVE_PTHREAD_SETNAME_NP],[1],[Enable pthread_setname_np])]) | |
752 | ||
4ced3010 DL |
753 | AS_IF([test "x$enable_libdebuginfod" = "xyes" || test "x$enable_libdebuginfod" = "xdummy"], |
754 | [AC_DEFINE([ENABLE_LIBDEBUGINFOD], [1], [Enable libdebuginfod])]) | |
755 | AS_IF([test "x$enable_libdebuginfod" = "xdummy"], | |
756 | [AC_DEFINE([DUMMY_LIBDEBUGINFOD], [1], [Build dummy libdebuginfod])]) | |
f7f0cdc5 MW |
757 | AM_CONDITIONAL([LIBDEBUGINFOD],[test "x$enable_libdebuginfod" = "xyes" || test "x$enable_libdebuginfod" = "xdummy"]) |
758 | AM_CONDITIONAL([DUMMY_LIBDEBUGINFOD],[test "x$enable_libdebuginfod" = "xdummy"]) | |
759 | ||
760 | # Look for libmicrohttpd, libarchive, sqlite for debuginfo server | |
761 | # minimum versions as per rhel7. | |
762 | AC_ARG_ENABLE([debuginfod],AC_HELP_STRING([--enable-debuginfod], [Build debuginfod server])) | |
e27e30ca | 763 | AC_PROG_CXX |
e27e30ca | 764 | AS_IF([test "x$enable_debuginfod" != "xno"], [ |
14d5b412 FCE |
765 | AC_MSG_NOTICE([checking debuginfod C++11 support, --disable-debuginfod to skip]) |
766 | AX_CXX_COMPILE_STDCXX(11, noext, mandatory) | |
767 | AC_MSG_NOTICE([checking debuginfod dependencies, --disable-debuginfod to skip]) | |
f7f0cdc5 MW |
768 | if test "x$enable_libdebuginfod" = "xno"; then |
769 | AC_MSG_ERROR([need libdebuginfod (or dummy), use --disable-debuginfod to disable.]) | |
770 | fi | |
e27e30ca FCE |
771 | enable_debuginfod=yes # presume success |
772 | PKG_PROG_PKG_CONFIG | |
e27e30ca | 773 | PKG_CHECK_MODULES([libmicrohttpd],[libmicrohttpd >= 0.9.33],[],[enable_debuginfod=no]) |
e27e30ca FCE |
774 | PKG_CHECK_MODULES([sqlite3],[sqlite3 >= 3.7.17],[],[enable_debuginfod=no]) |
775 | PKG_CHECK_MODULES([libarchive],[libarchive >= 3.1.2],[],[enable_debuginfod=no]) | |
776 | if test "x$enable_debuginfod" = "xno"; then | |
14d5b412 | 777 | AC_MSG_ERROR([dependencies not found, use --disable-debuginfod to disable.]) |
e27e30ca FCE |
778 | fi |
779 | ]) | |
780 | ||
781 | AS_IF([test "x$enable_debuginfod" != "xno"],AC_DEFINE([ENABLE_DEBUGINFOD],[1],[Build debuginfod])) | |
288f6b19 AM |
782 | AM_CONDITIONAL([DEBUGINFOD],[test "x$enable_debuginfod" = "xyes"]) |
783 | ||
94708e96 FCE |
784 | dnl for /etc/profile.d/elfutils.{csh,sh} |
785 | default_debuginfod_urls="" | |
786 | AC_ARG_ENABLE(debuginfod-urls, | |
787 | [AS_HELP_STRING([--enable-debuginfod-urls@<:@=URLS@:>@],[add URLS to profile.d DEBUGINFOD_URLS])], | |
788 | [if test "x${enableval}" = "xyes"; | |
789 | then default_debuginfod_urls="https://debuginfod.elfutils.org/"; | |
790 | elif test "x${enableval}" != "xno"; then | |
791 | default_debuginfod_urls="${enableval}"; | |
792 | fi], | |
793 | [default_debuginfod_urls=""]) | |
794 | AC_SUBST(DEBUGINFOD_URLS, $default_debuginfod_urls) | |
795 | AC_CONFIG_FILES([config/profile.sh config/profile.csh]) | |
288f6b19 | 796 | |
b08d5a8f | 797 | AC_OUTPUT |
7702a3c1 MW |
798 | |
799 | AC_MSG_NOTICE([ | |
800 | ===================================================================== | |
801 | elfutils: ${PACKAGE_VERSION} (eu_version: ${eu_version}) | |
802 | ===================================================================== | |
803 | ||
804 | Prefix : ${prefix} | |
805 | Program prefix ("eu-" recommended) : ${program_prefix} | |
806 | Source code location : ${srcdir} | |
807 | Maintainer mode : ${enable_maintainer_mode} | |
7702a3c1 MW |
808 | build arch : ${ac_cv_build} |
809 | ||
810 | RECOMMENDED FEATURES (should all be yes) | |
811 | gzip support : ${with_zlib} | |
812 | bzip2 support : ${with_bzlib} | |
813 | lzma/xz support : ${with_lzma} | |
52536d7d | 814 | zstd support : ${with_zstd} |
e6e80dae | 815 | libstdc++ demangle support : ${enable_demangler} |
7702a3c1 MW |
816 | File textrel check : ${enable_textrelcheck} |
817 | Symbol versioning : ${enable_symbol_versioning} | |
818 | ||
819 | NOT RECOMMENDED FEATURES (should all be no) | |
820 | Experimental thread safety : ${use_locks} | |
b63007ed | 821 | install elf.h : ${install_elfh} |
7702a3c1 MW |
822 | |
823 | OTHER FEATURES | |
824 | Deterministic archives by default : ${default_ar_deterministic} | |
825 | Native language support : ${USE_NLS} | |
5e2a8e25 | 826 | Extra Valgrind annotations : ${use_vg_annotations} |
f7f0cdc5 MW |
827 | libdebuginfod client support : ${enable_libdebuginfod} |
828 | Debuginfod server support : ${enable_debuginfod} | |
94708e96 | 829 | Default DEBUGINFOD_URLS : ${default_debuginfod_urls} |
7702a3c1 MW |
830 | |
831 | EXTRA TEST FEATURES (used with make check) | |
4664fd58 | 832 | have bunzip2 installed (required) : ${HAVE_BUNZIP2} |
52536d7d | 833 | have zstd installed : ${HAVE_ZSTD} |
7702a3c1 MW |
834 | debug branch prediction : ${use_debugpred} |
835 | gprof support : ${use_gprof} | |
836 | gcov support : ${use_gcov} | |
837 | run all tests under valgrind : ${use_valgrind} | |
2b250b75 | 838 | gcc undefined behaviour sanitizer : ${use_undefined} |
7702a3c1 MW |
839 | use rpath in tests : ${tests_use_rpath} |
840 | test biarch : ${utrace_cv_cc_biarch} | |
841 | ]) | |
b63007ed MW |
842 | |
843 | if test "$install_elfh" = yes; then | |
844 | if test "${prefix}" = "/usr/local" -o "${prefix}" = "/usr"; then | |
845 | AC_MSG_WARN([installing elf.h in ${includedir} might conflict with glibc/system elf.h]) | |
846 | fi | |
847 | fi |