build: check for existence of execinfo.h

GLIBC is not necessarily the only library that provides execinfo.
With libexecinfo execinfo can be used also in other Libraries.
The patch lets the configure check the existence of the header
and the libexecinfo Library and uses them if avaible.

(also fixes compilation if execinfo is not avaible)
This commit is contained in:
John Zimmermann 2018-05-18 00:41:11 +02:00 committed by Denis Kenzior
parent 37173350e2
commit 3b4c1dd4d3
3 changed files with 6 additions and 1 deletions

View File

@ -86,6 +86,9 @@ AC_DEFINE_UNQUOTED(CONFIGDIR, "/etc/iwd", [Configuration directory])
AC_CHECK_HEADERS(linux/types.h linux/if_alg.h)
AC_CHECK_HEADERS_ONCE(execinfo.h)
AC_CHECK_LIB(execinfo, backtrace)
if (test "${enable_client}" != "no"); then
AC_CHECK_HEADERS(readline/readline.h, enable_readline=yes,
AC_MSG_ERROR(readline header files are required))

View File

@ -653,7 +653,9 @@ static void parse_modem(const char *path, struct l_dbus_message_iter *props)
* has been seen to happen.
*/
l_error("modem %s already found", path);
#ifdef HAVE_EXECINFO_H
__iwd_backtrace_print(2);
#endif
exit(1);
}

View File

@ -27,7 +27,7 @@
#define _GNU_SOURCE
#include <features.h>
#ifdef __GLIBC__
#ifdef HAVE_EXECINFO_H
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>