+
+\f
+
+/* First some libgc shims. */
+
+/* Make sure GC_fn_type is defined; it is missing from the public
+ headers of GC 7.1 and earlier. */
+#ifndef HAVE_GC_FN_TYPE
+typedef void * (* GC_fn_type) (void *);
+#endif
+
+
+/* Now define with_gc_active and with_gc_inactive. */
+
+#if (defined(HAVE_GC_DO_BLOCKING) && defined (HAVE_DECL_GC_DO_BLOCKING) && defined (HAVE_GC_CALL_WITH_GC_ACTIVE))
+
+/* We have a sufficiently new libgc (7.2 or newer). */
+
+static void*
+with_gc_inactive (GC_fn_type func, void *data)
+{
+ return GC_do_blocking (func, data);
+}
+
+static void*
+with_gc_active (GC_fn_type func, void *data)
+{
+ return GC_call_with_gc_active (func, data);
+}
+
+#else
+
+/* libgc not new enough, so never actually deactivate GC.
+
+ Note that though GC 7.1 does have a GC_do_blocking, it doesn't have
+ GC_call_with_gc_active. */
+
+static void*
+with_gc_inactive (GC_fn_type func, void *data)
+{
+ return func (data);
+}
+
+static void*
+with_gc_active (GC_fn_type func, void *data)
+{
+ return func (data);
+}
+
+#endif /* HAVE_GC_DO_BLOCKING */
+
+