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