xref: /netbsd-src/external/gpl3/binutils/dist/config/debuginfod.m4 (revision cb63e24e8d6aae7ddac1859a9015f48b1d8bd90e)
1dnl Copyright (C) 1997-2020 Free Software Foundation, Inc.
2dnl This file is free software, distributed under the terms of the GNU
3dnl General Public License.  As a special exception to the GNU General
4dnl Public License, this file may be distributed as part of a program
5dnl that contains a configuration script generated by Autoconf, under
6dnl the same distribution terms as the rest of that program.
7
8AC_DEFUN([AC_DEBUGINFOD],
9[
10# Handle optional debuginfod support as well as optional section
11# downloading support.
12#
13# Define HAVE_LIBDEBUGINFOD if libdebuginfod is found with version >= 0.179.
14#
15# Define HAVE_LIBDEBUGINFOD_FIND_SECTION if libdebuginfod is found with
16# version >= 0.188.
17AC_ARG_WITH([debuginfod],
18  AC_HELP_STRING([--with-debuginfod], [Enable debuginfo lookups with debuginfod (auto/yes/no)]),
19  [], [with_debuginfod=auto])
20AC_MSG_CHECKING([whether to use debuginfod])
21AC_MSG_RESULT([$with_debuginfod])
22
23if test "x$with_debuginfod" != xno; then
24  PKG_CHECK_MODULES([DEBUGINFOD], [libdebuginfod >= 0.188],
25    [AC_DEFINE([HAVE_LIBDEBUGINFOD_FIND_SECTION], [1],
26               [Define to 1 if debuginfod section downloading is supported.])],
27    [AC_MSG_WARN([libdebuginfod is missing or some features may be unavailable.])])
28
29  PKG_CHECK_MODULES([DEBUGINFOD], [libdebuginfod >= 0.179],
30    [AC_DEFINE([HAVE_LIBDEBUGINFOD], [1], [Define to 1 if debuginfod is enabled.])],
31    [if test "x$with_debuginfod" = xyes; then
32       AC_MSG_ERROR(["--with-debuginfod was given, but libdebuginfod is missing or unusable."])
33     else
34       AC_MSG_WARN([libdebuginfod is missing or unusable; some features may be unavailable.])
35     fi])
36else
37  AC_MSG_WARN([debuginfod support disabled; some features may be unavailable.])
38fi
39])
40