From 5b768320419c034d19d2f4646365c3e3f2b93ff8 Mon Sep 17 00:00:00 2001
From: Chris Roberts <cpr420@gmail.com>
Date: Mon, 9 Dec 2013 18:27:26 -0700
Subject: Attempt to bring libIDL into the modern age


diff --git a/acinclude.m4 b/acinclude.m4
index 0481a2f..0fc8e87 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -1,4 +1,15 @@
 dnl Autoconf extension macros for libIDL
+# GLIB_AC_DIVERT_BEFORE_HELP(STUFF)
+# ---------------------------------
+# Put STUFF early enough so that they are available for $ac_help expansion.
+# Handle both classic (<= v2.13) and modern autoconf
+AC_DEFUN([GLIB_AC_DIVERT_BEFORE_HELP],
+[ifdef([m4_divert_text], [m4_divert_text([NOTICE],[$1])],
+   [ifdef([AC_DIVERT], [AC_DIVERT([NOTICE],[$1])],
+       [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
+$1
+AC_DIVERT_POP()])])])
+
 AC_DEFUN(AC_CPP_ACCEPT_IDL,
 	[AC_CACHE_CHECK([if C preprocessor likes IDL],
 		ac_cv_cpp_accept_idl,
diff --git a/configure.in b/configure.in
index 3b32bbe..a4af53d 100644
--- a/configure.in
+++ b/configure.in
@@ -3,7 +3,7 @@ dnl Process this file with autoconf to produce a configure script.
 
 AC_INIT(IDL.h.new.in)
 
-AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl
+GLIB_AC_DIVERT_BEFORE_HELP([
 #
 # Making releases:
 #   LIBIDL_MICRO_VERSION += 1;
@@ -20,7 +20,7 @@ LIBIDL_INTERFACE_AGE=4
 LIBIDL_BINARY_AGE=8
 LIBIDL_LIBRARY_VERSION=$LIBIDL_MAJOR_VERSION.$LIBIDL_MINOR_VERSION.$LIBIDL_MICRO_VERSION
 GLIB_VERSION_REQUIRED=1.2.0
-AC_DIVERT_POP()dnl
+])
 
 AC_SUBST(LIBIDL_MAJOR_VERSION)
 AC_SUBST(LIBIDL_MINOR_VERSION)
-- 
1.8.3.4

