blob: 515ac70495995b466ac37bc0bb2284f9b502face [file] [log] [blame]
Ulrich Drepperb08d5a82005-07-26 05:00:05 +00001dnl Process this file with autoconf to produce a configure script.
2dnl Configure input file for elfutils. -*-autoconf-*-
3dnl
Frank Ch. Eiglere27e30c2019-10-28 13:29:26 -04004dnl Copyright (C) 1996-2019 Red Hat, Inc.
Ulrich Drepperb08d5a82005-07-26 05:00:05 +00005dnl
Mark Wielaardde2ed972012-06-05 17:15:16 +02006dnl This file is part of elfutils.
Ulrich Drepperb08d5a82005-07-26 05:00:05 +00007dnl
Mark Wielaardde2ed972012-06-05 17:15:16 +02008dnl This file is free software; you can redistribute it and/or modify
9dnl it under the terms of the GNU General Public License as published by
10dnl the Free Software Foundation; either version 3 of the License, or
11dnl (at your option) any later version.
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000012dnl
Mark Wielaardde2ed972012-06-05 17:15:16 +020013dnl elfutils is distributed in the hope that it will be useful, but
14dnl WITHOUT ANY WARRANTY; without even the implied warranty of
15dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16dnl GNU General Public License for more details.
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000017dnl
Mark Wielaardde2ed972012-06-05 17:15:16 +020018dnl You should have received a copy of the GNU General Public License
19dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
Mark Wielaardd4fd0802020-10-31 17:57:47 +010020AC_INIT([elfutils],[0.182],[https://sourceware.org/bugzilla],[elfutils],[http://elfutils.org/])
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000021
Mark Wielaard34b037b2017-01-12 11:43:30 +010022dnl Workaround for older autoconf < 2.64
23m4_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
Mark Wielaard9ba24582016-03-02 15:04:43 +010028# We want eu- as default program prefix if none was given by the user.
29# But if the user explicitly provided --program-prefix="" then pretend
30# it wasn't set at all (NONE). We want to test this really early before
31# configure has a chance to use the value.
32
33if test "x$program_prefix" = "xNONE"; then
34 AC_MSG_NOTICE([No --program-prefix given, using "eu-"])
35 program_prefix="eu-"
36elif test "x$program_prefix" = "x"; then
37 AC_MSG_NOTICE([Using no program-prefix])
38 program_prefix=NONE
39fi
40
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000041AC_CONFIG_AUX_DIR([config])
42AC_CONFIG_FILES([config/Makefile])
43
Mark Wielaarda2bc0212020-06-11 16:09:03 +020044AC_COPYRIGHT([Copyright (C) 1996-2020 The elfutils developers.])
Ulrich Drepperdb12f162009-09-21 08:04:38 -070045AC_PREREQ(2.63) dnl Minimum Autoconf version required.
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000046
Roland McGrath9aa8ef72007-05-18 08:59:43 +000047dnl We use GNU make extensions; automake 1.10 defaults to -Wportability.
Mark Wielaard86be7922013-04-26 23:44:25 +020048AM_INIT_AUTOMAKE([gnits 1.11 -Wno-portability dist-bzip2 no-dist-gzip parallel-tests])
Roland McGrathc373d852006-10-10 00:25:21 +000049AM_MAINTAINER_MODE
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000050
Mark Wielaardc04f4912015-10-07 13:37:56 +020051AM_SILENT_RULES([yes])
52
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000053AC_CONFIG_SRCDIR([libelf/libelf.h])
54AC_CONFIG_FILES([Makefile])
55AC_CONFIG_HEADERS([config.h])
56
57AC_CONFIG_MACRO_DIR([m4])
58AC_CONFIG_FILES([m4/Makefile])
59
60dnl The RPM spec file. We substitute a few values in the file.
61AC_CONFIG_FILES([elfutils.spec:config/elfutils.spec.in])
62
Aaron Merey288f6b12019-10-28 13:29:26 -040063dnl debuginfo-server client & server parts.
64AC_CONFIG_FILES([debuginfod/Makefile])
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000065
66AC_CANONICAL_HOST
67
Roland McGrath3284b792012-01-20 12:51:46 -080068AC_ARG_ENABLE(deterministic-archives,
69[AS_HELP_STRING([--enable-deterministic-archives],
70 [ar and ranlib default to -D behavior])], [
71if test "${enableval}" = no; then
72 default_ar_deterministic=false
73else
74 default_ar_deterministic=true
75fi], [default_ar_deterministic=false])
76AC_DEFINE_UNQUOTED(DEFAULT_AR_DETERMINISTIC, $default_ar_deterministic,
77 [Should ar and ranlib use -D behavior by default?])
78
Ulrich Drepper7e678fa2009-01-10 18:02:05 -080079AC_ARG_ENABLE([thread-safety],
Mark Wielaard09c9bb92013-11-06 12:21:32 +010080AS_HELP_STRING([--enable-thread-safety],
81 [enable thread safety of libraries EXPERIMENTAL]),
82 use_locks=$enableval, use_locks=no)
Ulrich Drepper7e678fa2009-01-10 18:02:05 -080083AM_CONDITIONAL(USE_LOCKS, test "$use_locks" = yes)
84AS_IF([test "$use_locks" = yes], [AC_DEFINE(USE_LOCKS)])
Mark Wielaard09c9bb92013-11-06 12:21:32 +010085AS_IF([test "$use_locks" = yes],
86 [AC_MSG_WARN([thread-safety is EXPERIMENTAL tests might fail.])])
Ulrich Drepperd56e2322008-08-16 03:09:13 +000087
Ulrich Drepper7e678fa2009-01-10 18:02:05 -080088AH_TEMPLATE([USE_LOCKS], [Defined if libraries should be thread-safe.])
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000089
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000090AC_PROG_CC
91AC_PROG_RANLIB
92AC_PROG_YACC
93AM_PROG_LEX
Michael Forneya45c8042013-11-01 00:51:04 -070094# Only available since automake 1.12
95m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
96AC_CHECK_TOOL([READELF], [readelf])
97AC_CHECK_TOOL([NM], [nm])
Ulrich Drepperb08d5a82005-07-26 05:00:05 +000098
Mark Wielaardaba6d762015-04-14 10:18:37 +020099# 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
108AC_CACHE_CHECK([for gcc with GNU99 support], ac_cv_c99, [dnl
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000109old_CFLAGS="$CFLAGS"
110CFLAGS="$CFLAGS -std=gnu99"
Roland McGrathf64e25f2011-02-08 19:36:50 -0800111AC_COMPILE_IFELSE([AC_LANG_SOURCE([dnl
Mark Wielaardaba6d762015-04-14 10:18:37 +0200112int foo (int a)
113{
114 for (int i = 0; i < a; ++i) if (i % 4) break; int s = a; return s;
115}
116
117double bar (double a, double b)
118{
119 double square (double z) { return z * z; }
120 return square (a) + square (b);
121}
122
123void baz (int n)
124{
125 struct S { int x[[n]]; };
126}])],
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000127 ac_cv_c99=yes, ac_cv_c99=no)
128CFLAGS="$old_CFLAGS"])
129AS_IF([test "x$ac_cv_c99" != xyes],
Mark Wielaardaba6d762015-04-14 10:18:37 +0200130 AC_MSG_ERROR([gcc with GNU99 support required]))
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000131
Ulf Hermann11274702017-08-18 13:06:36 +0200132AC_CACHE_CHECK([whether gcc supports __attribute__((visibility()))],
133 ac_cv_visibility, [dnl
134save_CFLAGS="$CFLAGS"
135CFLAGS="$save_CFLAGS -Werror"
136AC_COMPILE_IFELSE([AC_LANG_SOURCE([dnl
137int __attribute__((visibility("hidden")))
138foo (int a)
139{
140 return a;
141}])], ac_cv_visibility=yes, ac_cv_visibility=no)
142CFLAGS="$save_CFLAGS"])
143if test "$ac_cv_visibility" = "yes"; then
144 AC_DEFINE([HAVE_VISIBILITY], [1],
145 [Defined if __attribute__((visibility())) is supported])
146fi
147
Ulf Hermann17d71942017-08-18 14:05:10 +0200148AC_CACHE_CHECK([whether gcc supports __attribute__((gcc_struct))],
149 ac_cv_gcc_struct, [dnl
150save_CFLAGS="$CFLAGS"
151CFLAGS="$save_CFLAGS -Werror"
152AC_COMPILE_IFELSE([AC_LANG_SOURCE([dnl
153struct test { int x; } __attribute__((gcc_struct));
154])], ac_cv_gcc_struct=yes, ac_cv_gcc_struct=no)
155CFLAGS="$save_CFLAGS"])
156if test "$ac_cv_gcc_struct" = "yes"; then
157 AC_DEFINE([HAVE_GCC_STRUCT], [1],
158 [Defined if __attribute__((gcc_struct)) is supported])
159fi
160
Ulf Hermann07737582017-08-18 12:41:11 +0200161AC_CACHE_CHECK([whether gcc supports -fPIC], ac_cv_fpic, [dnl
162save_CFLAGS="$CFLAGS"
163CFLAGS="$save_CFLAGS -fPIC -Werror"
164AC_COMPILE_IFELSE([AC_LANG_SOURCE()], ac_cv_fpic=yes, ac_cv_fpic=no)
165CFLAGS="$save_CFLAGS"
166])
167if test "$ac_cv_fpic" = "yes"; then
168 fpic_CFLAGS="-fPIC"
169else
170 fpic_CFLAGS=""
171fi
172AC_SUBST([fpic_CFLAGS])
173
174AC_CACHE_CHECK([whether gcc supports -fPIE], ac_cv_fpie, [dnl
175save_CFLAGS="$CFLAGS"
176CFLAGS="$save_CFLAGS -fPIE -Werror"
177AC_COMPILE_IFELSE([AC_LANG_SOURCE()], ac_cv_fpie=yes, ac_cv_fpie=no)
178CFLAGS="$save_CFLAGS"
179])
180if test "$ac_cv_fpie" = "yes"; then
181 fpie_CFLAGS="-fPIE"
182else
183 fpie_CFLAGS=""
184fi
185AC_SUBST([fpie_CFLAGS])
186
187dso_LDFLAGS="-shared"
188
189ZDEFS_LDFLAGS="-Wl,-z,defs"
190AC_CACHE_CHECK([whether gcc supports $ZDEFS_LDFLAGS], ac_cv_zdefs, [dnl
191save_LDFLAGS="$LDFLAGS"
192LDFLAGS="$ZDEFS_LDFLAGS $save_LDFLAGS"
193AC_LINK_IFELSE([AC_LANG_PROGRAM()], ac_cv_zdefs=yes, ac_cv_zdefs=no)
194LDFLAGS="$save_LDFLAGS"
195])
196if test "$ac_cv_zdefs" = "yes"; then
197 dso_LDFLAGS="$dso_LDFLAGS $ZDEFS_LDFLAGS"
198fi
199
Mark Wielaardcf1b5fe2019-12-06 17:20:00 +0100200# We really want build-ids. Warn and force generating them if gcc was
201# configure without --enable-linker-build-id
202AC_CACHE_CHECK([whether the compiler generates build-ids], ac_cv_buildid, [dnl
Sergei Trofimovich9698a392020-06-14 20:28:07 +0100203AC_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]))])
Mark Wielaardcf1b5fe2019-12-06 17:20:00 +0100204if test "$ac_cv_buildid" = "no"; then
205 AC_MSG_WARN([compiler doesn't generate build-id by default])
206 LDFLAGS="$LDFLAGS -Wl,--build-id"
207fi
208
Ulf Hermann07737582017-08-18 12:41:11 +0200209ZRELRO_LDFLAGS="-Wl,-z,relro"
210AC_CACHE_CHECK([whether gcc supports $ZRELRO_LDFLAGS], ac_cv_zrelro, [dnl
211save_LDFLAGS="$LDFLAGS"
212LDFLAGS="$ZRELRO_LDFLAGS $save_LDFLAGS"
213AC_LINK_IFELSE([AC_LANG_PROGRAM()], ac_cv_zrelro=yes, ac_cv_zrelro=no)
214LDFLAGS="$save_LDFLAGS"
215])
216if test "$ac_cv_zrelro" = "yes"; then
217 dso_LDFLAGS="$dso_LDFLAGS $ZRELRO_LDFLAGS"
218fi
219
220AC_SUBST([dso_LDFLAGS])
221
Roland McGrath81817392009-01-23 03:23:02 -0800222AC_CACHE_CHECK([for __thread support], ac_cv_tls, [dnl
Roland McGrathe72bf152009-01-23 14:27:39 -0800223# 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.
225save_CFLAGS="$CFLAGS"
226save_LDFLAGS="$LDFLAGS"
Ulf Hermann07737582017-08-18 12:41:11 +0200227CFLAGS="$fpic_CFLAGS $CFLAGS"
228LDFLAGS="$dso_LDFLAGS $LDFLAGS"
Roland McGrath81817392009-01-23 03:23:02 -0800229AC_LINK_IFELSE([dnl
Mark Wielaard0a35e3a2015-03-13 23:51:40 +0100230AC_LANG_PROGRAM([[#include <stdlib.h>
231#undef __thread
Roland McGrathe72bf152009-01-23 14:27:39 -0800232static __thread int a; int foo (int b) { return a + b; }]],
Roland McGrath81817392009-01-23 03:23:02 -0800233 [[exit (foo (0));]])],
Roland McGrathe72bf152009-01-23 14:27:39 -0800234 ac_cv_tls=yes, ac_cv_tls=no)
235CFLAGS="$save_CFLAGS"
236LDFLAGS="$save_LDFLAGS"])
Ulrich Drepper7e678fa2009-01-10 18:02:05 -0800237AS_IF([test "x$ac_cv_tls" != xyes],
Roland McGrath81817392009-01-23 03:23:02 -0800238 AC_MSG_ERROR([__thread support required]))
Ulrich Drepper7e678fa2009-01-10 18:02:05 -0800239
Jonathon Anderson77b66a72019-08-25 10:01:51 -0500240dnl Before 4.9 gcc doesn't ship stdatomic.h, but the nessesary atomics are
241dnl available by (at least) 4.7. So if the system doesn't have a stdatomic.h we
242dnl fall back on one copied from FreeBSD that handles the difference.
243AC_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)])
246AM_CONDITIONAL(HAVE_STDATOMIC_H, test "x$ac_cv_has_stdatomic" = xyes)
247AS_IF([test "x$ac_cv_has_stdatomic" = xyes], [AC_DEFINE(HAVE_STDATOMIC_H)])
248
249AH_TEMPLATE([HAVE_STDATOMIC_H], [Define to 1 if `stdatomic.h` is provided by the
250 system, 0 otherwise.])
251
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000252dnl This test must come as early as possible after the compiler configuration
253dnl tests, because the choice of the file model can (in principle) affect
254dnl whether functions and headers are available, whether they work, etc.
255AC_SYS_LARGEFILE
256
Mark Wielaardee225022016-11-23 20:51:35 +0100257dnl Older glibc had a broken fts that didn't work with Large File Systems.
258dnl We want the version that can handler LFS, but include workaround if we
259dnl get a bad one. Add define to CFLAGS (not AC_DEFINE it) since we need to
260dnl check it before including config.h (which might define _FILE_OFFSET_BITS).
261AC_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)])
Mark Wielaardad7036f2020-07-18 01:53:29 +0200264AS_IF([test "x$ac_cv_bad_fts" = "xyes"],
265 [CFLAGS="$CFLAGS -DBAD_FTS=1" CXXFLAGS="$CXXFLAGS -DBAD_FTS=1"])
Mark Wielaardee225022016-11-23 20:51:35 +0100266
Mark Wielaard01b994e2017-02-09 21:09:54 +0100267# 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).
270AC_MSG_CHECKING([whether to add -D_FORTIFY_SOURCE=2 to CFLAGS])
271case "$CFLAGS" in
272 *-D_FORTIFY_SOURCE=2*)
273 AC_MSG_RESULT([no, already there])
274 ;;
275 *)
276 save_CFLAGS="$CFLAGS"
Omar Sandovalc435a332019-12-11 16:23:27 -0800277 CFLAGS="-D_FORTIFY_SOURCE=2 $CFLAGS -Werror"
Mark Wielaard01b994e2017-02-09 21:09:54 +0100278 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 ;;
286esac
287
Ulrich Drepper3cbdd382008-01-02 17:44:39 +0000288dnl enable debugging of branch prediction.
Ulrich Drepper28a0c612008-01-21 18:57:48 +0000289AC_ARG_ENABLE([debugpred],
Ulrich Drepperdb12f162009-09-21 08:04:38 -0700290AS_HELP_STRING([--enable-debugpred],[build binaries with support to debug branch prediction]),
Mike Frysinger8f3002e2011-10-08 15:09:15 -0700291[use_debugpred=$enableval], [use_debugpred=no])
292case $use_debugpred in
Mark Wielaard7702a3c2015-05-01 09:23:57 +0200293 yes) use_debugpred_val=1 ;;
294 *) use_debugpred_val=0 ;;
Mike Frysinger8f3002e2011-10-08 15:09:15 -0700295esac
Mark Wielaard7702a3c2015-05-01 09:23:57 +0200296AC_SUBST([DEBUGPRED], $use_debugpred_val)
Ulrich Drepper3cbdd382008-01-02 17:44:39 +0000297
298dnl Enable gprof suport.
Ulrich Drepper47be7952005-08-07 04:41:39 +0000299AC_ARG_ENABLE([gprof],
Mike Frysinger8f3002e2011-10-08 15:09:15 -0700300AS_HELP_STRING([--enable-gprof],[build binaries with gprof support]), [use_gprof=$enableval], [use_gprof=no])
Ulrich Drepper47be7952005-08-07 04:41:39 +0000301if test "$use_gprof" = yes; then
302 CFLAGS="$CFLAGS -pg"
303 LDFLAGS="$LDFLAGS -pg"
304fi
305AM_CONDITIONAL(GPROF, test "$use_gprof" = yes)
Ulrich Drepperfbe998a2005-08-29 16:27:10 +0000306
307# Enable gcov suport.
308AC_ARG_ENABLE([gcov],
Mike Frysinger8f3002e2011-10-08 15:09:15 -0700309AS_HELP_STRING([--enable-gcov],[build binaries with gcov support]), [use_gcov=$enableval], [use_gcov=no])
Ulrich Drepperfbe998a2005-08-29 16:27:10 +0000310if test "$use_gcov" = yes; then
311 CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
Mark Wielaard3f81dbd2019-11-26 08:56:44 +0100312 CXXFLAGS="$CXXFLAGS -fprofile-arcs -ftest-coverage"
Ulrich Drepperfbe998a2005-08-29 16:27:10 +0000313 LDFLAGS="$LDFLAGS -fprofile-arcs"
314fi
Ulrich Drepper39cec7a2005-08-30 01:22:01 +0000315AM_CONDITIONAL(GCOV, test "$use_gcov" = yes)
Ulrich Drepperfbe998a2005-08-29 16:27:10 +0000316
Mark Wielaard2b250b72015-05-21 23:36:51 +0200317AC_ARG_ENABLE([sanitize-undefined],
318 AS_HELP_STRING([--enable-sanitize-undefined],
319 [Use gcc undefined behaviour sanitizer]),
320 [use_undefined=$enableval], [use_undefined=no])
321if test "$use_undefined" = yes; then
322 old_CFLAGS="$CFLAGS"
323 old_CXXFLAGS="$CXXFLAGS"
324 # We explicitly use unaligned access when possible (see ALLOW_UNALIGNED)
325 # We want to fail immediately on first error, don't try to recover.
Mark Wielaard170f1bb2015-05-31 22:37:19 +0200326 CFLAGS="$CFLAGS -fsanitize=undefined -fno-sanitize-recover"
327 CXXFLAGS="$CXXFLAGS -fsanitize=undefined -fno-sanitize-recover"
328 AC_LINK_IFELSE([AC_LANG_SOURCE([int main (int argc, char **argv) { return 0; }])], use_undefined=yes, use_undefined=no)
Mark Wielaard2b250b72015-05-21 23:36:51 +0200329 AS_IF([test "x$use_undefined" != xyes],
330 AC_MSG_WARN([gcc undefined behaviour sanitizer not available])
331 CFLAGS="$old_CFLAGS" CXXFLAGS="$old_CXXFLAGS")
332fi
Mark Wielaard170f1bb2015-05-31 22:37:19 +0200333case $use_undefined in
334 yes) check_undefined_val=1 ;;
335 *) check_undefined_val=0 ;;
336esac
337AC_DEFINE_UNQUOTED(CHECK_UNDEFINED, $check_undefined_val,
338 [Building with -fsanitize=undefined or not])
Mark Wielaard2b250b72015-05-21 23:36:51 +0200339
Mark Wielaarde3e3ee22012-10-01 16:14:12 +0200340AC_ARG_ENABLE([valgrind],
341AS_HELP_STRING([--enable-valgrind],[run all tests under valgrind]),
342[use_valgrind=$enableval], [use_valgrind=no])
343if test "$use_valgrind" = yes; then
344 AC_CHECK_PROG(HAVE_VALGRIND, valgrind, yes, no)
345 if test "$HAVE_VALGRIND" = "no"; then
346 AC_MSG_ERROR([valgrind not found])
347 fi
348fi
349AM_CONDITIONAL(USE_VALGRIND, test "$use_valgrind" = yes)
350
Jonathon Anderson5e2a8e22019-08-25 09:53:50 -0500351AC_ARG_WITH([valgrind],
352AS_HELP_STRING([--with-valgrind],[include directory for Valgrind headers]),
353[with_valgrind_headers=$withval], [with_valgrind_headers=no])
354if test "x$with_valgrind_headers" != xno; then
355 save_CFLAGS="$CFLAGS"
356 CFLAGS="$CFLAGS -I$with_valgrind_headers"
357 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
358 #include <valgrind/valgrind.h>
359 int main() { return 0; }
360 ]])], [ HAVE_VALGRIND_HEADERS="yes"
361 CFLAGS="$save_CFLAGS -I$with_valgrind_headers" ],
362 [ AC_MSG_ERROR([invalid valgrind include directory: $with_valgrind_headers]) ])
363fi
364
365AC_ARG_ENABLE([valgrind-annotations],
366AS_HELP_STRING([--enable-valgrind-annotations],[insert extra annotations for better valgrind support]),
367[use_vg_annotations=$enableval], [use_vg_annotations=no])
368if test "$use_vg_annotations" = yes; then
369 if test "x$HAVE_VALGRIND_HEADERS" != "xyes"; then
370 AC_MSG_CHECKING([whether Valgrind headers are available])
371 AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
372 #include <valgrind/valgrind.h>
373 int main() { return 0; }
374 ]])], [ AC_MSG_RESULT([yes]) ],
375 [ AC_MSG_ERROR([valgrind annotations requested but no headers are available]) ])
376 fi
377fi
378AM_CONDITIONAL(USE_VG_ANNOTATIONS, test "$use_vg_annotations" = yes)
379
Mark Wielaardb63007e2019-01-18 14:18:22 +0100380AC_ARG_ENABLE([install-elfh],
381AS_HELP_STRING([--enable-install-elfh],[install elf.h in include dir]),
382 [install_elfh=$enableval], [install_elfh=no])
383AM_CONDITIONAL(INSTALL_ELFH, test "$install_elfh" = yes)
384
Ulrich Drepper47be7952005-08-07 04:41:39 +0000385AM_CONDITIONAL(BUILD_STATIC, [dnl
Mark Wielaard32324792014-04-13 17:39:57 +0200386test "$use_gprof" = yes -o "$use_gcov" = yes])
Ulrich Drepper47be7952005-08-07 04:41:39 +0000387
Roland McGrath1b8b4462005-11-16 01:33:38 +0000388AC_ARG_ENABLE([tests-rpath],
Ulrich Drepperdb12f162009-09-21 08:04:38 -0700389AS_HELP_STRING([--enable-tests-rpath],[build $ORIGIN-using rpath into tests]),
Mike Frysinger8f3002e2011-10-08 15:09:15 -0700390 [tests_use_rpath=$enableval], [tests_use_rpath=no])
Roland McGrath1b8b4462005-11-16 01:33:38 +0000391AM_CONDITIONAL(TESTS_RPATH, test "$tests_use_rpath" = yes)
392
Mark Wielaard528cb452015-10-16 23:07:12 +0200393dnl zlib is mandatory.
Roland McGrathbca43152009-01-05 23:59:32 -0800394save_LIBS="$LIBS"
395LIBS=
Roland McGrath24169642009-08-26 02:26:34 -0700396eu_ZIPLIB(zlib,ZLIB,z,gzdirect,gzip)
Mike Frysinger2d703bf2016-01-14 13:46:18 -0500397AS_IF([test "x$with_zlib" = xno], [AC_MSG_ERROR([zlib not found but is required])])
Mark Wielaard528cb452015-10-16 23:07:12 +0200398LIBS="$save_LIBS"
399
Mark Wielaard52536d72020-09-18 12:49:29 +0200400dnl Test for bzlib and xz/lzma/zstd, gives BZLIB/LZMALIB/ZSTD .am
401dnl conditional and config.h USE_BZLIB/USE_LZMALIB/USE_ZSTD #define.
Mark Wielaard528cb452015-10-16 23:07:12 +0200402save_LIBS="$LIBS"
403LIBS=
Roland McGrath24169642009-08-26 02:26:34 -0700404eu_ZIPLIB(bzlib,BZLIB,bz2,BZ2_bzdopen,bzip2)
Mark Wielaard0aa60ac2016-01-04 21:41:52 +0100405# We need this since bzip2 doesn't have a pkgconfig file.
406BZ2_LIB="$LIBS"
407AC_SUBST([BZ2_LIB])
Roland McGrath24169642009-08-26 02:26:34 -0700408eu_ZIPLIB(lzma,LZMA,lzma,lzma_auto_decoder,[LZMA (xz)])
Mark Wielaard0aa60ac2016-01-04 21:41:52 +0100409AS_IF([test "x$with_lzma" = xyes], [LIBLZMA="liblzma"], [LIBLZMA=""])
410AC_SUBST([LIBLZMA])
Mark Wielaard52536d72020-09-18 12:49:29 +0200411eu_ZIPLIB(zstd,ZSTD,zstd,ZSTD_decompress,[ZSTD (zst)])
412AS_IF([test "x$with_zstd" = xyes], [LIBZSTD="libzstd"], [LIBLZSTD=""])
413AC_SUBST([LIBZSTD])
Roland McGrathbca43152009-01-05 23:59:32 -0800414zip_LIBS="$LIBS"
415LIBS="$save_LIBS"
416AC_SUBST([zip_LIBS])
417
Akihiko Odakia24d52a2016-10-13 09:16:48 +0900418AC_CHECK_DECLS([memrchr, rawmemchr],[],[],
419 [#define _GNU_SOURCE
420 #include <string.h>])
421AC_CHECK_DECLS([powerof2],[],[],[#include <sys/param.h>])
Ulf Hermannb3248e62017-02-16 10:10:30 +0100422AC_CHECK_DECLS([mempcpy],[],[],
423 [#define _GNU_SOURCE
424 #include <string.h>])
Akihiko Odakia24d52a2016-10-13 09:16:48 +0900425
Mark Wielaardafffdff2018-03-18 00:24:08 +0100426AC_CHECK_FUNCS([process_vm_readv])
427
Ulrich Drepperb4a16cf2011-10-02 08:33:19 -0400428AC_CHECK_LIB([stdc++], [__cxa_demangle], [dnl
429AC_DEFINE([USE_DEMANGLE], [1], [Defined if demangling is enabled])])
Max Filippov1ce4a452015-05-03 21:14:09 +0300430AM_CONDITIONAL(DEMANGLE, test "x$ac_cv_lib_stdcpp___cxa_demangle" = "xyes")
431AS_IF([test "x$ac_cv_lib_stdcpp___cxa_demangle" = "xyes"],
Mark Wielaarde6e80da2015-05-01 10:31:36 +0200432 [enable_demangler=yes],[enable_demangler=no])
Ulrich Drepperb4a16cf2011-10-02 08:33:19 -0400433
Mark Wielaard805ec832014-11-27 23:53:30 +0100434AC_ARG_ENABLE([textrelcheck],
435AS_HELP_STRING([--disable-textrelcheck],
436 [Disable textrelcheck being a fatal error]))
437AM_CONDITIONAL(FATAL_TEXTREL, [test "x$enable_textrelcheck" != "xno"])
Mark Wielaard7702a3c2015-05-01 09:23:57 +0200438AS_IF([test "x$enable_textrelcheck" != "xno"],
439 [enable_textrelcheck=yes],[enable_textrelcheck=no])
Mark Wielaard805ec832014-11-27 23:53:30 +0100440
Max Filippovbafacac2015-04-23 20:46:59 +0200441AC_ARG_ENABLE([symbol-versioning],
442AS_HELP_STRING([--disable-symbol-versioning],
443 [Disable symbol versioning in shared objects]))
Ulf Hermann4a3330a2017-08-18 15:50:42 +0200444
445AC_CACHE_CHECK([whether symbol versioning is supported], ac_cv_symbol_versioning, [dnl
446AC_COMPILE_IFELSE([AC_LANG_SOURCE([dnl
447#define NEW_VERSION(name, version) \
448 asm (".symver " #name "," #name "@@@" #version);
449int foo(int x) { return x + 1; }
450NEW_VERSION (foo, ELFUTILS_12.12)
451])], ac_cv_symbol_versioning=yes, ac_cv_symbol_versioning=no)])
452if test "$ac_cv_symbol_versioning" = "no"; then
453 if test "x$enable_symbol_versioning" != "xno"; then
454 AC_MSG_ERROR([Symbol versioning is not supported.
455 Use --disable-symbol-versioning to build without.])
456 fi
457fi
458
Max Filippovbafacac2015-04-23 20:46:59 +0200459AM_CONDITIONAL(SYMBOL_VERSIONING, [test "x$enable_symbol_versioning" != "xno"])
460AS_IF([test "x$enable_symbol_versioning" = "xno"],
Mark Wielaard7702a3c2015-05-01 09:23:57 +0200461 [AC_MSG_WARN([Disabling symbol versioning breaks ABI compatibility.])
462 enable_symbol_versioning=no],[enable_symbol_versioning=yes])
Max Filippovbafacac2015-04-23 20:46:59 +0200463
Mark Wielaard4b7953d2015-06-09 00:28:13 +0200464AC_CACHE_CHECK([whether gcc accepts -Wstack-usage], ac_cv_stack_usage, [dnl
465old_CFLAGS="$CFLAGS"
Filipe Brandenburger239cd482016-05-02 13:26:13 -0700466CFLAGS="$CFLAGS -Wstack-usage=262144 -Werror"
Mark Wielaard4b7953d2015-06-09 00:28:13 +0200467AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],
468 ac_cv_stack_usage=yes, ac_cv_stack_usage=no)
469CFLAGS="$old_CFLAGS"])
470AM_CONDITIONAL(ADD_STACK_USAGE_WARNING, [test "x$ac_cv_stack_usage" != "xno"])
471
Mark Wielaard8bc14232016-02-09 16:10:22 +0100472# -Wlogical-op was too fragile in the past, make sure we get a sane one.
473AC_CACHE_CHECK([whether gcc has a sane -Wlogical-op], ac_cv_logical_op, [dnl
474old_CFLAGS="$CFLAGS"
475CFLAGS="$CFLAGS -Wlogical-op -Werror"
476AC_COMPILE_IFELSE([AC_LANG_SOURCE(
477 [#define FLAG 1
478 int f (int r, int f) { return (r && (FLAG || (FLAG & f))); }])],
479 ac_cv_logical_op=yes, ac_cv_logical_op=no)
480CFLAGS="$old_CFLAGS"])
481AM_CONDITIONAL(SANE_LOGICAL_OP_WARNING,
482 [test "x$ac_cv_logical_op" != "xno"])
483
484# -Wduplicated-cond was added by GCC6
485AC_CACHE_CHECK([whether gcc accepts -Wduplicated-cond], ac_cv_duplicated_cond, [dnl
486old_CFLAGS="$CFLAGS"
Filipe Brandenburger239cd482016-05-02 13:26:13 -0700487CFLAGS="$CFLAGS -Wduplicated-cond -Werror"
Mark Wielaard8bc14232016-02-09 16:10:22 +0100488AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],
489 ac_cv_duplicated_cond=yes, ac_cv_duplicated_cond=no)
490CFLAGS="$old_CFLAGS"])
491AM_CONDITIONAL(HAVE_DUPLICATED_COND_WARNING,
492 [test "x$ac_cv_duplicated_cond" != "xno"])
493
Mark Wielaard6993d402016-02-13 19:10:00 +0100494# -Wnull-dereference was added by GCC6
495AC_CACHE_CHECK([whether gcc accepts -Wnull-dereference], ac_cv_null_dereference, [dnl
496old_CFLAGS="$CFLAGS"
Filipe Brandenburger239cd482016-05-02 13:26:13 -0700497CFLAGS="$CFLAGS -Wnull-dereference -Werror"
Mark Wielaard6993d402016-02-13 19:10:00 +0100498AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],
499 ac_cv_null_dereference=yes, ac_cv_null_dereference=no)
500CFLAGS="$old_CFLAGS"])
501AM_CONDITIONAL(HAVE_NULL_DEREFERENCE_WARNING,
502 [test "x$ac_cv_null_dereference" != "xno"])
503
Mark Wielaarda3cc8182016-11-02 13:29:26 +0100504# -Wimplicit-fallthrough was added by GCC7
505AC_CACHE_CHECK([whether gcc accepts -Wimplicit-fallthrough], ac_cv_implicit_fallthrough, [dnl
506old_CFLAGS="$CFLAGS"
507CFLAGS="$CFLAGS -Wimplicit-fallthrough -Werror"
508AC_COMPILE_IFELSE([AC_LANG_SOURCE([])],
509 ac_cv_implicit_fallthrough=yes, ac_cv_implicit_fallthrough=no)
510CFLAGS="$old_CFLAGS"])
511AM_CONDITIONAL(HAVE_IMPLICIT_FALLTHROUGH_WARNING,
512 [test "x$ac_cv_implicit_fallthrough" != "xno"])
513
Joshua Watt555e15e2018-02-09 10:27:18 -0600514# Assume the fallthrough attribute is supported if -Wimplict-fallthrough is supported
515if test "$ac_cv_implicit_fallthrough" = "yes"; then
516 AC_DEFINE([HAVE_FALLTHROUGH], [1],
517 [Defined if __attribute__((fallthrough)) is supported])
518fi
519
Anthony G. Basile1ab3c2b2015-05-04 02:25:39 +0300520dnl Check if we have argp available from our libc
521AC_LINK_IFELSE(
522 [AC_LANG_PROGRAM(
523 [#include <argp.h>],
Filipe Brandenburgerafeccd42016-05-02 12:18:47 -0700524 [int argc=1; char *argv[]={"test"}; argp_parse(0,argc,&argv,0,0,0); return 0;]
Anthony G. Basile1ab3c2b2015-05-04 02:25:39 +0300525 )],
526 [libc_has_argp="true"],
527 [libc_has_argp="false"]
528)
529
530dnl If our libc doesn't provide argp, then test for libargp
531if test "$libc_has_argp" = "false" ; then
532 AC_MSG_WARN("libc does not have argp")
533 AC_CHECK_LIB([argp], [argp_parse], [have_argp="true"], [have_argp="false"])
534
535 if test "$have_argp" = "false"; then
536 AC_MSG_ERROR("no libargp found")
537 else
538 argp_LDADD="-largp"
539 fi
540else
541 argp_LDADD=""
542fi
543AC_SUBST([argp_LDADD])
544
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000545dnl The directories with content.
546
547dnl Documentation.
Ben Woodardf0a51762019-08-23 13:42:06 -0700548AC_CONFIG_FILES([doc/Makefile])
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000549
550dnl Support library.
551AC_CONFIG_FILES([lib/Makefile])
552
553dnl ELF library.
Ulrich Drepper2c9ee4f2007-06-06 02:49:30 +0000554AC_CONFIG_FILES([libelf/Makefile])
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000555
556dnl Higher-level ELF support library.
557AC_CONFIG_FILES([libebl/Makefile])
558
Mark Wielaard93802972014-04-11 23:52:47 +0200559dnl DWARF-ELF Lower-level Functions support library.
560AC_CONFIG_FILES([libdwelf/Makefile])
561
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000562dnl DWARF library.
563AC_CONFIG_FILES([libdw/Makefile])
564
565dnl Higher-level DWARF support library.
566AC_CONFIG_FILES([libdwfl/Makefile])
567
568dnl CPU handling library.
569AC_CONFIG_FILES([libcpu/Makefile])
570
571dnl Assembler library.
Roland McGrathd7f8d0c2005-11-17 02:32:03 +0000572AM_CONDITIONAL(HAVE_LIBASM, true)dnl Used in tests/Makefile.am, which see.
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000573AC_CONFIG_FILES([libasm/Makefile])
574
Roland McGrathe47ab762005-11-17 03:16:00 +0000575dnl CPU-specific backend libraries.
576AC_CONFIG_FILES([backends/Makefile])
577
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000578dnl Tools.
579AC_CONFIG_FILES([src/Makefile po/Makefile.in])
580
581dnl Test suite.
Roland McGrathd7f8d0c2005-11-17 02:32:03 +0000582AM_CONDITIONAL(STANDALONE, false)dnl Used in tests/Makefile.am, which see.
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000583AC_CONFIG_FILES([tests/Makefile])
584
Mark Wielaard0aa60ac2016-01-04 21:41:52 +0100585dnl pkgconfig files
Aaron Merey288f6b12019-10-28 13:29:26 -0400586AC_CONFIG_FILES([config/libelf.pc config/libdw.pc config/libdebuginfod.pc])
Mark Wielaard0aa60ac2016-01-04 21:41:52 +0100587
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000588# Get the definitions necessary to create the Makefiles in the po
589# subdirectories. This is a small subset of the gettext rules.
590AC_SUBST(USE_NLS, yes)
591AM_PO_SUBDIRS
592
Roland McGrathb4d6f0f2008-08-25 22:55:17 +0000593dnl Appended to the config.h file.
594dnl We hide all kinds of configuration magic in lib/eu-config.h.
595AH_BOTTOM([#include <eu-config.h>])
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000596
Roland McGrathfbc72452008-12-16 17:03:03 -0800597dnl Version compatibility header.
598AC_CONFIG_FILES([version.h:config/version.h.in])
599AC_SUBST([eu_version])
Roland McGrathee9d60d2009-04-17 13:18:35 -0700600
601# 1.234<whatever> -> 1234<whatever>
602case "$PACKAGE_VERSION" in
Roland McGrathe9bf1d32011-10-08 15:14:30 -0700603[[0-9]].*) eu_version=`echo "$PACKAGE_VERSION" | sed 's@\.@@'` ;;
Roland McGrathee9d60d2009-04-17 13:18:35 -0700604*) AC_MSG_ERROR([confused by version number '$PACKAGE_VERSION']) ;;
605esac
606case "$eu_version" in
607*.*)
608 # 1234.567 -> "1234", "567"
609 eu_extra_version="${eu_version#*.}"
610 eu_version="${eu_version%%.*}"
611 case "$eu_extra_version" in
612 [[0-9]][[0-9]][[0-9]]) ;;
613 [[0-9]][[0-9]]) eu_extra_version="${eu_extra_version}0" ;;
614 [[0-9]]) eu_extra_version="${eu_extra_version}00" ;;
615 *) AC_MSG_ERROR([confused by version number '$PACKAGE_VERSION']) ;;
616 esac
617 ;;
618*)
619 eu_extra_version=000
620 ;;
621esac
622
623case "$eu_version" in
624 0[[0-9]][[0-9]][[0-9]]) eu_version="${eu_version#0}$eu_extra_version" ;;
625[[0-9]][[0-9]][[0-9]][[0-9]]) eu_version="${eu_version}$eu_extra_version" ;;
626[[0-9]][[0-9]][[0-9]]) eu_version="${eu_version}0$eu_extra_version" ;;
Ulrich Drepper2c712522010-06-28 12:10:53 -0700627[[0-9]][[0-9]]) eu_version="${eu_version}00$eu_extra_version";;
Roland McGrathee9d60d2009-04-17 13:18:35 -0700628*) AC_MSG_ERROR([confused by version number '$PACKAGE_VERSION']) ;;
Roland McGrathfbc72452008-12-16 17:03:03 -0800629esac
630
Roland McGrath105e3982009-04-19 16:07:45 -0700631# Round up to the next release API (x.y) version.
Roland McGrathe9bf1d32011-10-08 15:14:30 -0700632eu_version=$(( (eu_version + 999) / 1000 ))
Roland McGrath105e3982009-04-19 16:07:45 -0700633
Jan Kratochvil0b867462013-05-30 14:37:38 +0200634AC_CHECK_SIZEOF(long)
635
Kyle McMartinc1e0fcb2014-06-09 21:06:26 +0200636# On aarch64 before glibc 2.20 we would get the kernel user_pt_regs instead
637# of the user_regs_struct from sys/user.h. They are structurally the same
638# but we get either one or the other.
639AC_CHECK_TYPE([struct user_regs_struct],
640 [sys_user_has_user_regs=yes], [sys_user_has_user_regs=no],
641 [[#include <sys/ptrace.h>]
642 [#include <sys/time.h>]
643 [#include <sys/user.h>]])
644if test "$sys_user_has_user_regs" = "yes"; then
645 AC_DEFINE(HAVE_SYS_USER_REGS, 1,
646 [Define to 1 if <sys/user.h> defines struct user_regs_struct])
647fi
648
Jan Kratochvil0b867462013-05-30 14:37:38 +0200649# On a 64-bit host where can can use $CC -m32, we'll run two sets of tests.
650# Likewise in a 32-bit build on a host where $CC -m64 works.
651utrace_BIARCH
652# `$utrace_biarch' will be `-m64' even on an uniarch i386 machine.
Jan Kratochvil8ae9bc92013-12-02 20:54:28 +0100653CC_BIARCH="$CC $utrace_biarch"
Jan Kratochvil0b867462013-05-30 14:37:38 +0200654AC_SUBST([CC_BIARCH])
655
Mark Wielaard4664fd52015-05-30 22:50:37 +0200656# In maintainer mode we really need flex and bison.
657# Otherwise we really need a release dir with maintainer files generated.
658if test "x$enable_maintainer_mode" = xyes; then
659 AC_CHECK_PROG(HAVE_FLEX, flex, yes, no)
660 if test "$HAVE_FLEX" = "no"; then
661 AC_MSG_ERROR([flex needed in maintainer mode])
662 fi
663 AC_CHECK_PROG(HAVE_BISON, bison, yes, no)
664 if test "$HAVE_BISON" = "no"; then
665 AC_MSG_ERROR([bison needed in maintainer mode])
666 fi
Ross Burtond6126842018-07-04 12:11:07 +0100667 AC_CHECK_PROG(HAVE_GAWK, gawk, yes, no)
668 if test "$HAVE_GAWK" = "no"; then
669 AC_MSG_ERROR([gawk needed in maintainer mode])
670 fi
Mark Wielaard4664fd52015-05-30 22:50:37 +0200671else
672 if test ! -f ${srcdir}/libdw/known-dwarf.h; then
673 AC_MSG_ERROR([No libdw/known-dwarf.h. configure --enable-maintainer-mode])
674 fi
675fi
676
677# The testfiles are all compressed, we need bunzip2 when running make check
678AC_CHECK_PROG(HAVE_BUNZIP2, bunzip2, yes, no)
679if test "$HAVE_BUNZIP2" = "no"; then
680 AC_MSG_WARN([No bunzip2, needed to run make check])
681fi
682
Mark Wielaard52536d72020-09-18 12:49:29 +0200683# For tests that need to use zstd compression
684AC_CHECK_PROG(HAVE_ZSTD, zstd, yes, no)
685AM_CONDITIONAL([HAVE_ZSTD],[test "x$HAVE_ZSTD" = "xyes"])
686
Mark Wielaardf7f0cdc2020-06-19 19:41:08 +0200687# Look for libcurl for libdebuginfod minimum version as per rhel7.
688AC_ARG_ENABLE([libdebuginfod],AC_HELP_STRING([--enable-libdebuginfod], [Build debuginfod client library (can be =dummy)]))
689AS_IF([test "x$enable_libdebuginfod" != "xno"], [
690 if test "x$enable_libdebuginfod" != "xdummy"; then
691 AC_MSG_NOTICE([checking libdebuginfod dependencies, --disable-libdebuginfod or --enable-libdebuginfo=dummy to skip])
692 enable_libdebuginfod=yes # presume success
693 PKG_PROG_PKG_CONFIG
694 PKG_CHECK_MODULES([libcurl],[libcurl >= 7.29.0],[],[enable_libdebuginfod=no])
695 if test "x$enable_libdebuginfod" = "xno"; then
696 AC_MSG_ERROR([dependencies not found, use --disable-libdebuginfod to disable or --enable-libdebuginfod=dummy to build a (bootstrap) dummy library.])
697 fi
698 else
699 AC_MSG_NOTICE([building (bootstrap) dummy libdebuginfo library])
700 fi
701])
702
Dmitry V. Levin4ced3012020-08-20 23:27:24 +0300703AS_IF([test "x$enable_libdebuginfod" = "xyes" || test "x$enable_libdebuginfod" = "xdummy"],
704 [AC_DEFINE([ENABLE_LIBDEBUGINFOD], [1], [Enable libdebuginfod])])
705AS_IF([test "x$enable_libdebuginfod" = "xdummy"],
706 [AC_DEFINE([DUMMY_LIBDEBUGINFOD], [1], [Build dummy libdebuginfod])])
Mark Wielaardf7f0cdc2020-06-19 19:41:08 +0200707AM_CONDITIONAL([LIBDEBUGINFOD],[test "x$enable_libdebuginfod" = "xyes" || test "x$enable_libdebuginfod" = "xdummy"])
708AM_CONDITIONAL([DUMMY_LIBDEBUGINFOD],[test "x$enable_libdebuginfod" = "xdummy"])
709
710# Look for libmicrohttpd, libarchive, sqlite for debuginfo server
711# minimum versions as per rhel7.
712AC_ARG_ENABLE([debuginfod],AC_HELP_STRING([--enable-debuginfod], [Build debuginfod server]))
Frank Ch. Eiglere27e30c2019-10-28 13:29:26 -0400713AC_PROG_CXX
Frank Ch. Eiglere27e30c2019-10-28 13:29:26 -0400714AS_IF([test "x$enable_debuginfod" != "xno"], [
Frank Ch. Eigler14d5b412020-02-03 06:29:31 -0500715 AC_MSG_NOTICE([checking debuginfod C++11 support, --disable-debuginfod to skip])
716 AX_CXX_COMPILE_STDCXX(11, noext, mandatory)
717 AC_MSG_NOTICE([checking debuginfod dependencies, --disable-debuginfod to skip])
Mark Wielaardf7f0cdc2020-06-19 19:41:08 +0200718 if test "x$enable_libdebuginfod" = "xno"; then
719 AC_MSG_ERROR([need libdebuginfod (or dummy), use --disable-debuginfod to disable.])
720 fi
Frank Ch. Eiglere27e30c2019-10-28 13:29:26 -0400721 enable_debuginfod=yes # presume success
722 PKG_PROG_PKG_CONFIG
Frank Ch. Eiglere27e30c2019-10-28 13:29:26 -0400723 PKG_CHECK_MODULES([libmicrohttpd],[libmicrohttpd >= 0.9.33],[],[enable_debuginfod=no])
Frank Ch. Eiglere27e30c2019-10-28 13:29:26 -0400724 PKG_CHECK_MODULES([sqlite3],[sqlite3 >= 3.7.17],[],[enable_debuginfod=no])
725 PKG_CHECK_MODULES([libarchive],[libarchive >= 3.1.2],[],[enable_debuginfod=no])
726 if test "x$enable_debuginfod" = "xno"; then
Frank Ch. Eigler14d5b412020-02-03 06:29:31 -0500727 AC_MSG_ERROR([dependencies not found, use --disable-debuginfod to disable.])
Frank Ch. Eiglere27e30c2019-10-28 13:29:26 -0400728 fi
729])
Aaron Merey288f6b12019-10-28 13:29:26 -0400730
Frank Ch. Eiglere27e30c2019-10-28 13:29:26 -0400731AS_IF([test "x$enable_debuginfod" != "xno"],AC_DEFINE([ENABLE_DEBUGINFOD],[1],[Build debuginfod]))
Aaron Merey288f6b12019-10-28 13:29:26 -0400732AM_CONDITIONAL([DEBUGINFOD],[test "x$enable_debuginfod" = "xyes"])
733
Frank Ch. Eigler94708e92020-10-01 16:56:49 -0400734dnl for /etc/profile.d/elfutils.{csh,sh}
735default_debuginfod_urls=""
736AC_ARG_ENABLE(debuginfod-urls,
737 [AS_HELP_STRING([--enable-debuginfod-urls@<:@=URLS@:>@],[add URLS to profile.d DEBUGINFOD_URLS])],
738 [if test "x${enableval}" = "xyes";
739 then default_debuginfod_urls="https://debuginfod.elfutils.org/";
740 elif test "x${enableval}" != "xno"; then
741 default_debuginfod_urls="${enableval}";
742 fi],
743 [default_debuginfod_urls=""])
744AC_SUBST(DEBUGINFOD_URLS, $default_debuginfod_urls)
745AC_CONFIG_FILES([config/profile.sh config/profile.csh])
Aaron Merey288f6b12019-10-28 13:29:26 -0400746
Ulrich Drepperb08d5a82005-07-26 05:00:05 +0000747AC_OUTPUT
Mark Wielaard7702a3c2015-05-01 09:23:57 +0200748
749AC_MSG_NOTICE([
750=====================================================================
751 elfutils: ${PACKAGE_VERSION} (eu_version: ${eu_version})
752=====================================================================
753
754 Prefix : ${prefix}
755 Program prefix ("eu-" recommended) : ${program_prefix}
756 Source code location : ${srcdir}
757 Maintainer mode : ${enable_maintainer_mode}
Mark Wielaard7702a3c2015-05-01 09:23:57 +0200758 build arch : ${ac_cv_build}
759
760 RECOMMENDED FEATURES (should all be yes)
761 gzip support : ${with_zlib}
762 bzip2 support : ${with_bzlib}
763 lzma/xz support : ${with_lzma}
Mark Wielaard52536d72020-09-18 12:49:29 +0200764 zstd support : ${with_zstd}
Mark Wielaarde6e80da2015-05-01 10:31:36 +0200765 libstdc++ demangle support : ${enable_demangler}
Mark Wielaard7702a3c2015-05-01 09:23:57 +0200766 File textrel check : ${enable_textrelcheck}
767 Symbol versioning : ${enable_symbol_versioning}
768
769 NOT RECOMMENDED FEATURES (should all be no)
770 Experimental thread safety : ${use_locks}
Mark Wielaardb63007e2019-01-18 14:18:22 +0100771 install elf.h : ${install_elfh}
Mark Wielaard7702a3c2015-05-01 09:23:57 +0200772
773 OTHER FEATURES
774 Deterministic archives by default : ${default_ar_deterministic}
775 Native language support : ${USE_NLS}
Jonathon Anderson5e2a8e22019-08-25 09:53:50 -0500776 Extra Valgrind annotations : ${use_vg_annotations}
Mark Wielaardf7f0cdc2020-06-19 19:41:08 +0200777 libdebuginfod client support : ${enable_libdebuginfod}
778 Debuginfod server support : ${enable_debuginfod}
Frank Ch. Eigler94708e92020-10-01 16:56:49 -0400779 Default DEBUGINFOD_URLS : ${default_debuginfod_urls}
Mark Wielaard7702a3c2015-05-01 09:23:57 +0200780
781 EXTRA TEST FEATURES (used with make check)
Mark Wielaard4664fd52015-05-30 22:50:37 +0200782 have bunzip2 installed (required) : ${HAVE_BUNZIP2}
Mark Wielaard52536d72020-09-18 12:49:29 +0200783 have zstd installed : ${HAVE_ZSTD}
Mark Wielaard7702a3c2015-05-01 09:23:57 +0200784 debug branch prediction : ${use_debugpred}
785 gprof support : ${use_gprof}
786 gcov support : ${use_gcov}
787 run all tests under valgrind : ${use_valgrind}
Mark Wielaard2b250b72015-05-21 23:36:51 +0200788 gcc undefined behaviour sanitizer : ${use_undefined}
Mark Wielaard7702a3c2015-05-01 09:23:57 +0200789 use rpath in tests : ${tests_use_rpath}
790 test biarch : ${utrace_cv_cc_biarch}
791])
Mark Wielaardb63007e2019-01-18 14:18:22 +0100792
793if test "$install_elfh" = yes; then
794 if test "${prefix}" = "/usr/local" -o "${prefix}" = "/usr"; then
795 AC_MSG_WARN([installing elf.h in ${includedir} might conflict with glibc/system elf.h])
796 fi
797fi