xref: /netbsd-src/external/gpl3/binutils/dist/config/debuginfod.m4 (revision d90047b5d07facf36e6c01dcc0bded8997ce9cc2)
1dnl Copyright (C) 1997-2019 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# Enable debuginfod
11AC_ARG_WITH([debuginfod],
12        AC_HELP_STRING([--with-debuginfod],
13                       [Enable debuginfo lookups with debuginfod (auto/yes/no)]),
14        [], [with_debuginfod=auto])
15AC_MSG_CHECKING([whether to use debuginfod])
16AC_MSG_RESULT([$with_debuginfod])
17
18if test "${with_debuginfod}" = no; then
19  AC_MSG_WARN([debuginfod support disabled; some features may be unavailable.])
20else
21  AC_CHECK_LIB([debuginfod], [debuginfod_begin], [have_debuginfod_lib=yes])
22  AC_CHECK_DECL([debuginfod_begin], [have_debuginfod_h=yes], [],
23                [#include <elfutils/debuginfod.h>])
24  if test "x$have_debuginfod_lib" = "xyes" -a \
25          "x$have_debuginfod_h" = "xyes"; then
26    AC_DEFINE([HAVE_LIBDEBUGINFOD], [1],
27              [Define to 1 if debuginfod is enabled.])
28    AC_SUBST([LIBDEBUGINFOD], ["-ldebuginfod"])
29  else
30    AC_SUBST([LIBDEBUGINFOD], [])
31    if test "$with_debuginfod" = yes; then
32      AC_MSG_ERROR([debuginfod is missing or unusable])
33    else
34      AC_MSG_WARN([debuginfod is missing or unusable; some features may be unavailable.])
35    fi
36  fi
37fi
38])
39