+# ifdef HAVE_MESA_GL
+
+# include <signal.h>
+
+static RETSIGTYPE
+lament_signal_kludge (int sig)
+{
+ signal (sig, SIG_DFL);
+ fprintf (stderr,
+ "\n"
+ "%s: dying with signal %d (%s).\n"
+ "\n"
+ "\tThis is almost certainly a bug in the Mesa GL library,\n"
+ "\tespecially if the stack trace in the core file mentions\n"
+ "\t`lambda_textured_triangle' or `render_quad'.\n"
+ "\n"
+ "\tFirst make sure that you have the latest version of Mesa.\n"
+ "\tIf that doesn't fix it, then I encourage you to report this\n"
+ "\tbug to the Mesa maintainers at <http://www.mesa3d.org/>.\n"
+ "\n",
+ progname,
+ sig,
+ (sig == SIGILL ? "SIGILL" :
+ sig == SIGFPE ? "SIGFPE" :
+ sig == SIGBUS ? "SIGBUS" :
+ sig == SIGSEGV ? "SIGSEGV" : "???"));
+ fflush (stderr);
+ kill (getpid (), sig);
+}
+
+static void
+handle_signals (void)
+{
+ signal (SIGILL, lament_signal_kludge);
+ signal (SIGFPE, lament_signal_kludge);
+ signal (SIGBUS, lament_signal_kludge);
+ signal (SIGSEGV, lament_signal_kludge);
+}
+# endif /* HAVE_MESA_GL */
+
+