summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrmanfredi <rmanfredi@2592e710-e01b-42a5-8df0-11608a6cc53d>2011-01-01 22:01:00 +0000
committerrmanfredi <rmanfredi@2592e710-e01b-42a5-8df0-11608a6cc53d>2011-01-01 22:01:00 +0000
commit0114f0c3d6c3b72a2fe3fd03f7b7475376a00c12 (patch)
treeef2545a2870b4cee616c7001b2414cc4a436204d
parent8a7e11663f43be976ef9424bb60bc7d35ae9e753 (diff)
Added check for backtrace().
git-svn-id: svn://svn.code.sf.net/p/dist/code/trunk/dist@65 2592e710-e01b-42a5-8df0-11608a6cc53d
-rw-r--r--MANIFEST1
-rw-r--r--mcon/U/d_backtrace.U41
2 files changed, 42 insertions, 0 deletions
diff --git a/MANIFEST b/MANIFEST
index afd5ea6..b43f040 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -165,6 +165,7 @@ mcon/U/d_access.U Do we have access()?
mcon/U/d_alarm.U Do we have alarm()?
mcon/U/d_arc4random.U Do we have arc4random()?
mcon/U/d_attribut.U Checks wether your cc groks __attribute__
+mcon/U/d_backtrace.U Do we have backtrace()?
mcon/U/d_bcmp.U Do we have bcmp() or memcmp()?
mcon/U/d_bcopy.U Do we have bcopy() or memcpy()?
mcon/U/d_bindtxtcode.U Do we have bind_textdomain_codeset()?
diff --git a/mcon/U/d_backtrace.U b/mcon/U/d_backtrace.U
new file mode 100644
index 0000000..5f90e80
--- /dev/null
+++ b/mcon/U/d_backtrace.U
@@ -0,0 +1,41 @@
+?RCS: $Id$
+?RCS:
+?RCS: Copyright (c) 2011, Raphael Manfredi
+?RCS:
+?RCS: You may redistribute only under the terms of the Artistic Licence,
+?RCS: as specified in the README file that comes with the distribution.
+?RCS: You may reuse parts of this distribution only within the terms of
+?RCS: that same Artistic Licence; a copy of which may be found at the root
+?RCS: of the source tree for dist 4.0.
+?RCS:
+?RCS: $Log: d_semget.U,v $
+?RCS:
+?MAKE:d_backtrace: Trylink cat
+?MAKE: -pick add $@ %<
+?S:d_backtrace:
+?S: This variable conditionally defines the HAS_BACKTRACE symbol, which
+?S: indicates to the C program that the backtrace() routine is available
+?S: to get a stack trace.
+?S:.
+?C:HAS_BACKTRACE:
+?C: This symbol, if defined, indicates that the backtrace() routine is
+?C: available to get a stack trace. The <execinfo.h> header must be
+?C: included to use this routine.
+?C:.
+?H:#$d_backtrace HAS_BACKTRACE /**/
+?H:.
+?LINT:set d_backtrace
+: see if backtrace exists
+$cat >try.c <<EOC
+#include <execinfo.h>
+int main(void)
+{
+ void *buf[2];
+ int ret = backtrace(buf, 2);
+ return ret ? 0 : 1;
+}
+EOC
+cyn=backtrace
+set d_backtrace
+eval $trylink
+