atexit not available. (sunos4.1.4 needs it.)
int terminating;
/* called on process termination. */
-static void cleanup (void)
+#ifdef HAVE_ATEXIT
+static void
+cleanup (void)
+#else
+#ifdef HAVE_ON_EXIT
+static void
+cleanup (int status, void *arg)
+#else
+#error Dont know how to setup a cleanup handler on your system.
+#endif
+#endif
{
terminating = 1;
scm_flush_all_ports ();
#ifdef HAVE_ATEXIT
atexit (cleanup);
+#else
+#ifdef HAVE_ON_EXIT
+ on_exit (cleanup, 0);
+#endif
#endif
scm_undefineds = scm_cons (SCM_UNDEFINED, SCM_EOL);