From 6b551c1c6061fe6431ff265f7acc7ff227236b7d Mon Sep 17 00:00:00 2001 From: Alexis Ballier Date: Fri, 26 Jun 2009 21:42:41 +0200 Subject: [PATCH] Fix build on systems without execinfo in the libc. Try to see if we have execinfo.h, and if we need to link to an extra library for using it. For instance FreeBSD does not have execinfo.h but a port has been made and we can use libexecinfo. --- configure.in | 9 +++++++++ gnome-session/Makefile.am | 1 + gnome-session/gdm-signal-handler.c | 6 ++++++ 3 files changed, 16 insertions(+), 0 deletions(-) diff --git a/configure.in b/configure.in index 1b8067c..55a566c 100644 --- a/configure.in +++ b/configure.in @@ -253,6 +253,15 @@ 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) +LIBEXECINFO="" +AC_CHECK_LIB(execinfo, backtrace, [LIBEXECINFO="-lexecinfo"],[]) +AC_SUBST(LIBEXECINFO) + +dnl ==================================================================== dnl Check for newish X interface dnl ==================================================================== oCFLAGS="$CFLAGS" diff --git a/gnome-session/Makefile.am b/gnome-session/Makefile.am index d5cb98c..fb81bb8 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) \ + $(LIBEXECINFO) \ $(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 #include #include +#if HAVE_EXECINFO_H #include +#endif #include #include #include @@ -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 } -- 1.6.3.3