[PATCH 1/1] Only bring in <execinfo.h> if it's available

Bernd Kuhls <[email protected]>
Newsgroups gmane.comp.security.virus.clamav.devel
Message-ID <[email protected]>
Fixes uclibc build as uclibc does not include backtrace functionality.

Compile error was found by an autobuild server, part of the buildroot project:
http://autobuild.buildroot.net/results/2a6/2a68aa790b1e8d6fd4dc41f2ab724dfc03b3806d//build-end.log

Signed-off-by: Bernd Kuhls <[email protected]>
---
 clamav-config.h.in           |    3 +++
 configure                    |    2 +-
 libclamav/mbox.c             |    2 ++
 m4/reorganization/headers.m4 |    2 +-
 4 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/clamav-config.h.in b/clamav-config.h.in
index bc13504..1db5d2e 100644
--- a/clamav-config.h.in
+++ b/clamav-config.h.in
@@ -182,6 +182,9 @@
 /* Define to 1 if the system has the type `error_t'. */
 #undef HAVE_ERROR_T
 
+/* Define to 1 if you have the <execinfo.h> header file. */
+#undef HAVE_EXECINFO_H
+
 /* have working file descriptor passing support */
 #undef HAVE_FD_PASSING
 
diff --git a/configure b/configure
index b8cd3a9..0f7158e 100755
--- a/configure
+++ b/configure
@@ -14437,7 +14437,7 @@ esac
 
 
 
-for ac_header in stdint.h unistd.h sys/int_types.h dlfcn.h inttypes.h sys/inttypes.h sys/times.h memory.h ndir.h stdlib.h strings.h string.h sys/mman.h sys/param.h sys/stat.h sys/types.h malloc.h poll.h limits.h sys/filio.h sys/uio.h termios.h stdbool.h pwd.h grp.h sys/queue.h sys/cdefs.h
+for ac_header in stdint.h unistd.h sys/int_types.h dlfcn.h inttypes.h sys/inttypes.h sys/times.h memory.h ndir.h stdlib.h strings.h string.h sys/mman.h sys/param.h sys/stat.h sys/types.h malloc.h poll.h limits.h sys/filio.h sys/uio.h termios.h stdbool.h pwd.h grp.h sys/queue.h sys/cdefs.h execinfo.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
diff --git a/libclamav/mbox.c b/libclamav/mbox.c
index b0233ae..5d4e5cb 100644
--- a/libclamav/mbox.c
+++ b/libclamav/mbox.c
@@ -84,7 +84,9 @@
 #endif
 
 #ifdef HAVE_BACKTRACE
+#ifdef HAVE_EXECINFO_H
 #include <execinfo.h>
+#endif
 #include <syslog.h>
 
 static	void	sigsegv(int sig);
diff --git a/m4/reorganization/headers.m4 b/m4/reorganization/headers.m4
index 9b71f33..23016bc 100644
--- a/m4/reorganization/headers.m4
+++ b/m4/reorganization/headers.m4
@@ -1,4 +1,4 @@
-AC_CHECK_HEADERS([stdint.h unistd.h sys/int_types.h dlfcn.h inttypes.h sys/inttypes.h sys/times.h memory.h ndir.h stdlib.h strings.h string.h sys/mman.h sys/param.h sys/stat.h sys/types.h malloc.h poll.h limits.h sys/filio.h sys/uio.h termios.h stdbool.h pwd.h grp.h sys/queue.h sys/cdefs.h])
+AC_CHECK_HEADERS([stdint.h unistd.h sys/int_types.h dlfcn.h inttypes.h sys/inttypes.h sys/times.h memory.h ndir.h stdlib.h strings.h string.h sys/mman.h sys/param.h sys/stat.h sys/types.h malloc.h poll.h limits.h sys/filio.h sys/uio.h termios.h stdbool.h pwd.h grp.h sys/queue.h sys/cdefs.h execinfo.h])
 AC_CHECK_HEADER([syslog.h],AC_DEFINE([USE_SYSLOG],1,[use syslog]),)
 
 have_pthreads=no
-- 
1.7.10.4

_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html
Please submit your patches to our Bugzilla: http://bugs.clamav.net

http://www.clamav.net/contact.html#ml
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.