# HG changeset patch # User Paul Eggert # Date 1345625225 25200 # Node ID a9db8a0359df9169c6ed7f8513351e876021f38c # Parent 373b50f0c21836cf991ba563dc17a089c1cc6ba2 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. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2012-08-22 Paul Eggert + + 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 extern-inline: support old GCC 'inline' diff --git a/MODULES.html.sh b/MODULES.html.sh --- 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 diff --git a/doc/glibc-headers/execinfo.texi b/doc/glibc-headers/execinfo.texi --- 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 diff --git a/lib/execinfo.c b/lib/execinfo.c new file mode 100644 --- /dev/null +++ b/lib/execinfo.c @@ -0,0 +1,3 @@ +#include +#define _GL_EXECINFO_INLINE _GL_EXTERN_INLINE +#include "execinfo.h" diff --git a/lib/execinfo.in.h b/lib/execinfo.in.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 . */ + +/* 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 diff --git a/m4/execinfo.m4 b/m4/execinfo.m4 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"]) +]) diff --git a/modules/execinfo b/modules/execinfo new file mode 100644 --- /dev/null +++ b/modules/execinfo @@ -0,0 +1,40 @@ +Description: +A GNU-like . + +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 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: + + +License: +LGPLv2+ + +Maintainer: +all