[gnome-session/gnome-2-26] [build] Fix build on systems without execinfo



commit 409efdb86d0b83aa97a9e2191e964a736f4e0fd7
Author: Alexis Ballier <aballier gentoo org>
Date:   Fri Jun 26 21:42:41 2009 +0200

    [build] Fix build on systems without execinfo
    
    See if execinfo.h is available, and if we need to link to an extra
    library to use it.
    
    For instance, FreeBSD does not have execinfo.h by default but a
    libexecinfo library has been created.
    
    http://bugzilla.gnome.org/show_bug.cgi?id=587088

 configure.in                       |    8 ++++++++
 gnome-session/Makefile.am          |    1 +
 gnome-session/gdm-signal-handler.c |    6 ++++++
 3 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/configure.in b/configure.in
index 9ef742a..8a18a45 100644
--- a/configure.in
+++ b/configure.in
@@ -256,6 +256,14 @@ AC_HEADER_STDC
 AC_CHECK_HEADERS(syslog.h tcpd.h sys/param.h)
 
 dnl ====================================================================
+dnl check for backtrace support
+dnl ====================================================================
+
+AC_CHECK_HEADERS(execinfo.h)
+AC_CHECK_LIB(execinfo, backtrace, [EXECINFO_LIBS="-lexecinfo"], [EXECINFO_LIBS=""])
+AC_SUBST(EXECINFO_LIBS)
+
+dnl ====================================================================
 dnl Check for newish X interface
 dnl ====================================================================
 oCFLAGS="$CFLAGS"
diff --git a/gnome-session/Makefile.am b/gnome-session/Makefile.am
index ab9cedb..2dd34dc 100644
--- a/gnome-session/Makefile.am
+++ b/gnome-session/Makefile.am
@@ -53,6 +53,7 @@ gnome_session_LDADD =				\
 	$(POLKIT_GNOME_LIBS)			\
 	$(XRENDER_LIBS)				\
 	$(XTEST_LIBS)				\
+	$(EXECINFO_LIBS)			\
 	$(NULL)
 
 gnome_session_SOURCES =				\
diff --git a/gnome-session/gdm-signal-handler.c b/gnome-session/gdm-signal-handler.c
index 58dca7d..353f79f 100644
--- a/gnome-session/gdm-signal-handler.c
+++ b/gnome-session/gdm-signal-handler.c
@@ -27,7 +27,9 @@
 #include <unistd.h>
 #include <string.h>
 #include <signal.h>
+#if HAVE_EXECINFO_H
 #include <execinfo.h>
+#endif
 #include <syslog.h>
 #include <sys/wait.h>
 #include <sys/stat.h>
@@ -160,6 +162,7 @@ signal_io_watch (GIOChannel       *ioc,
 static void
 fallback_get_backtrace (void)
 {
+#if HAVE_EXECINFO_H
         void *  frames[64];
         size_t  size;
         char ** strings;
@@ -174,8 +177,11 @@ fallback_get_backtrace (void)
                 free (strings);
                 syslog (LOG_CRIT, "******************* END **********************************");
         } else {
+#endif
                 g_warning ("GDM crashed, but symbols couldn't be retrieved.");
+#if HAVE_EXECINFO_H
         }
+#endif
 }
 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]