changeset 17057:a9db8a0359df

execinfo: new module This is for Emacs. Currently, it provides a no-effect stub on all platforms where it does not already work. It already works on glibc-based systems, and on Solaris 11. * lib/execinfo.c, lib/execinfo.in.h, m4/execinfo.m4, modules/execinfo: New files. * doc/glibc-headers/execinfo.texi (execinfo.h): * MODULES.html.sh (Misc): Document it.
author Paul Eggert <eggert@cs.ucla.edu>
date Wed, 22 Aug 2012 01:47:05 -0700
parents 373b50f0c218
children 4d1be3544907
files ChangeLog MODULES.html.sh doc/glibc-headers/execinfo.texi lib/execinfo.c lib/execinfo.in.h m4/execinfo.m4 modules/execinfo
diffstat 7 files changed, 135 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2012-08-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+	execinfo: new module
+	This is for Emacs.  Currently, it provides a no-effect stub
+	on all platforms where it does not already work.
+	It already works on glibc-based systems, and on Solaris 11.
+	* lib/execinfo.c, lib/execinfo.in.h, m4/execinfo.m4, modules/execinfo:
+	New files.
+	* doc/glibc-headers/execinfo.texi (execinfo.h):
+	* MODULES.html.sh (Misc): Document it.
+
 2012-08-20  Paul Eggert  <eggert@cs.ucla.edu>
 
 	extern-inline: support old GCC 'inline'
--- a/MODULES.html.sh
+++ b/MODULES.html.sh
@@ -2000,6 +2000,7 @@
   func_module crc
   func_module diacrit
   func_module diffseq
+  func_module execinfo
   func_module getline
   func_module getdelim
   func_module getnline
--- a/doc/glibc-headers/execinfo.texi
+++ b/doc/glibc-headers/execinfo.texi
@@ -21,11 +21,14 @@
 
 Portability problems fixed by Gnulib:
 @itemize
+This header file is missing on some platforms:
+Mac OS X 10.3, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin, mingw, MSVC 9, Interix 3.5, BeOS.
 @end itemize
 
 Portability problems not fixed by Gnulib:
 @itemize
 @item
-This header file is missing on some platforms:
-Mac OS X 10.3, FreeBSD 6.0, NetBSD 5.0, OpenBSD 3.8, Minix 3.1.8, AIX 5.1, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin, mingw, MSVC 9, Interix 3.5, BeOS.
+On platforms where the header file is missing,
+the Gnulib substitute implementation is just a stub,
+and does nothing.
 @end itemize
new file mode 100644
--- /dev/null
+++ b/lib/execinfo.c
@@ -0,0 +1,3 @@
+#include <config.h>
+#define _GL_EXECINFO_INLINE _GL_EXTERN_INLINE
+#include "execinfo.h"
new file mode 100644
--- /dev/null
+++ b/lib/execinfo.in.h
@@ -0,0 +1,54 @@
+/* Information about executables.
+
+   Copyright (C) 2012 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as published by
+   the Free Software Foundation; either version 2.1 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#ifndef _GL_EXECINFO_H
+#define _GL_EXECINFO_H
+
+_GL_INLINE_HEADER_BEGIN
+#ifndef _GL_EXECINFO_INLINE
+# define _GL_EXECINFO_INLINE _GL_INLINE
+#endif
+
+_GL_EXECINFO_INLINE int
+backtrace (void **buffer, int size)
+{
+  (void) buffer;
+  (void) size;
+  return 0;
+}
+
+_GL_EXECINFO_INLINE char **
+backtrace_symbols (void *const *buffer, int size)
+{
+  (void) buffer;
+  (void) size;
+  return 0;
+}
+
+_GL_EXECINFO_INLINE void
+backtrace_symbols_fd (void *const *buffer, int size, int fd)
+{
+  (void) buffer;
+  (void) size;
+  (void) fd;
+}
+
+_GL_INLINE_HEADER_END
+
+#endif
new file mode 100644
--- /dev/null
+++ b/m4/execinfo.m4
@@ -0,0 +1,21 @@
+# Check for GNU-style execinfo.h.
+
+dnl Copyright 2012 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_EXECINFO_H],
+[
+  AC_CHECK_HEADERS_ONCE([execinfo.h])
+
+  if test $ac_cv_header_execinfo_h = yes; then
+    EXECINFO_H=''
+  else
+    EXECINFO_H='execinfo.h'
+    AC_LIBOBJ([execinfo])
+  fi
+
+  AC_SUBST([EXECINFO_H])
+  AM_CONDITIONAL([GL_GENERATE_EXECINFO_H], [test -n "$EXECINFO_H"])
+])
new file mode 100644
--- /dev/null
+++ b/modules/execinfo
@@ -0,0 +1,40 @@
+Description:
+A GNU-like <execinfo.h>.
+
+Files:
+lib/execinfo.c
+lib/execinfo.in.h
+m4/execinfo.m4
+
+Depends-on:
+extern-inline
+
+configure.ac:
+gl_EXECINFO_H
+
+Makefile.am:
+BUILT_SOURCES += $(EXECINFO_H)
+
+# We need the following in order to create <execinfo.h> when the system
+# doesn't have one that works.
+if GL_GENERATE_EXECINFO_H
+execinfo.h: execinfo.in.h $(top_builddir)/config.status
+	$(AM_V_GEN)rm -f $@-t $@ && \
+	{ echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+	  cat $(srcdir)/execinfo.in.h; \
+	} > $@-t && \
+	mv $@-t $@
+else
+execinfo.h: $(top_builddir)/config.status
+	rm -f $@
+endif
+MOSTLYCLEANFILES += execinfo.h execinfo.h-t
+
+Include:
+<execinfo.h>
+
+License:
+LGPLv2+
+
+Maintainer:
+all