| 1 | dnl Copyright (C) 1997-2019 Free Software Foundation, Inc. |
| 2 | dnl This file is free software, distributed under the terms of the GNU |
| 3 | dnl General Public License. As a special exception to the GNU General |
| 4 | dnl Public License, this file may be distributed as part of a program |
| 5 | dnl that contains a configuration script generated by Autoconf, under |
| 6 | dnl the same distribution terms as the rest of that program. |
| 7 | |
| 8 | AC_DEFUN([AC_DEBUGINFOD], |
| 9 | [ |
| 10 | # Enable debuginfod |
| 11 | AC_ARG_WITH([debuginfod], |
| 12 | AC_HELP_STRING([--with-debuginfod], |
| 13 | [Enable debuginfo lookups with debuginfod (auto/yes/no)]), |
| 14 | [], [with_debuginfod=auto]) |
| 15 | AC_MSG_CHECKING([whether to use debuginfod]) |
| 16 | AC_MSG_RESULT([$with_debuginfod]) |
| 17 | |
| 18 | if test "${with_debuginfod}" = no; then |
| 19 | AC_MSG_WARN([debuginfod support disabled; some features may be unavailable.]) |
| 20 | else |
| 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 |
| 37 | fi |
| 38 | ]) |