summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2017-06-21 10:27:47 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2017-06-28 10:27:19 +0200
commit022ce62b9f6706749feed3939335e46bb0146978 (patch)
treef26c6bc8e936810aa5b47f0420a9868b94d4867b
parent1a3e3af3216348559320ec1039480278b2f3a582 (diff)
Use autoconf header detection correctly for libmissing
AC_CHECK_HEADERS already makes sure our config header contains a HAVE_$FOO_H macro if a header was found. There is no need to awkwardly set our own Automake conditionals and check for it all over the place in the Automake files. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r--Makefile.am4
-rw-r--r--configure.ac3
-rw-r--r--include/libmissing.h6
-rw-r--r--lib/execinfo.c4
-rw-r--r--tests/fs-tests/Makemodule.am7
5 files changed, 8 insertions, 16 deletions
diff --git a/Makefile.am b/Makefile.am
index 31b21bc..4c123f2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -10,10 +10,6 @@ if WITHOUT_LZO
AM_CPPFLAGS += -DWITHOUT_LZO
endif
-if HAVE_EXECINFO
-AM_CPPFLAGS += -DHAVE_EXECINFO
-endif
-
sbin_PROGRAMS =
sbin_SCRIPTS =
noinst_LIBRARIES =
diff --git a/configure.ac b/configure.ac
index aedbb32..8db281d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -164,7 +164,7 @@ if test "x$need_cmocka" = "xyes"; then
PKG_CHECK_MODULES(CMOCKA, [cmocka], [], [cmocka_missing="yes"])
fi
-AC_CHECK_HEADERS([execinfo.h], [execinfo_found=yes])
+AC_CHECK_HEADERS([execinfo.h])
##### produce summary on dependencies #####
@@ -223,7 +223,6 @@ fi
AM_CONDITIONAL([WITHOUT_LZO], [test "x$need_lzo" != "xyes"])
AM_CONDITIONAL([WITHOUT_XATTR], [test "x$need_xattr" != "xyes"])
-AM_CONDITIONAL([HAVE_EXECINFO], [test "x$execinfo_found" == "xyes"])
AC_CHECK_SIZEOF([off_t])
AC_CHECK_SIZEOF([loff_t])
diff --git a/include/libmissing.h b/include/libmissing.h
index c765f6d..0196033 100644
--- a/include/libmissing.h
+++ b/include/libmissing.h
@@ -1,11 +1,13 @@
#ifndef LIBMISSING_H
#define LIBMISSING_H
-#ifdef HAVE_EXECINFO
+#include "config.h"
+
+#ifdef HAVE_EXECINFO_H
#include <execinfo.h>
#endif
-#ifndef HAVE_EXECINFO
+#ifndef HAVE_EXECINFO_H
int backtrace(void **buffer, int size);
char **backtrace_symbols(void *const *buffer, int size);
void backtrace_symbols_fd(void *const *buffer, int size, int fd);
diff --git a/lib/execinfo.c b/lib/execinfo.c
index a39df83..a59f6a9 100644
--- a/lib/execinfo.c
+++ b/lib/execinfo.c
@@ -1,6 +1,6 @@
#include "libmissing.h"
-#ifndef HAVE_EXECINFO
+#ifndef HAVE_EXECINFO_H
#define PROGRAM_NAME "libmissing"
#include "common.h"
@@ -22,4 +22,4 @@ void backtrace_symbols_fd(void *const *buffer, int size, int fd)
{
errmsg("backtrace_symbols_fd() is not implemented");
}
-#endif /* !HAVE_EXECINFO */
+#endif /* !HAVE_EXECINFO_H */
diff --git a/tests/fs-tests/Makemodule.am b/tests/fs-tests/Makemodule.am
index d3acaa5..2eae860 100644
--- a/tests/fs-tests/Makemodule.am
+++ b/tests/fs-tests/Makemodule.am
@@ -1,12 +1,7 @@
integck_SOURCES = tests/fs-tests/integrity/integck.c
-integck_LDADD = libubi.a
+integck_LDADD = libubi.a libmissing.a
integck_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/ubi-utils/include
-if HAVE_EXECINFO
-else
-integck_LDADD += libmissing.a
-endif
-
test_1_SOURCES = tests/fs-tests/simple/test_1.c tests/fs-tests/lib/tests.c
test_1_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_srcdir)/tests/fs-tests/lib