From: Richard W.M. Jones Date: Thu, 5 Oct 2017 10:15:24 +0000 (+0100) Subject: lib: Allow compilation with Augeas < 1.8.0 which lacked ‘aug_source’ function. X-Git-Tag: v0.6~18 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=a4165c822baf74f5c1906593a984f996b11058d1;p=ocaml-augeas.git lib: Allow compilation with Augeas < 1.8.0 which lacked ‘aug_source’ function. Fixes commit 05f00ac539c2cd0cf5dcbf90d031023a7e973ae7. --- diff --git a/augeas-c.c b/augeas-c.c index da11acc..3c523ea 100644 --- a/augeas-c.c +++ b/augeas-c.c @@ -390,6 +390,7 @@ ocaml_augeas_transform (value tv, value lensv, value filev, value modev) CAMLprim value ocaml_augeas_source (value tv, value pathv) { +#ifdef HAVE_AUG_SOURCE CAMLparam2 (tv, pathv); CAMLlocal2 (optv, v); augeas_t t = Augeas_t_val (tv); @@ -411,4 +412,7 @@ ocaml_augeas_source (value tv, value pathv) raise_error (t, "Augeas.source"); CAMLreturn (optv); +#else + caml_failwith ("Augeas.source: function not implemented"); +#endif } diff --git a/configure.ac b/configure.ac index e0b0f7a..6b27aff 100644 --- a/configure.ac +++ b/configure.ac @@ -45,6 +45,12 @@ PKG_CHECK_MODULES([LIBXML2], [libxml-2.0]) dnl Check for Augeas C library. PKG_CHECK_MODULES([AUGEAS], [augeas]) +dnl Check for aug_source function, added in Augeas 1.8.0. +old_LIBS="$LIBS" +LIBS="$AUGEAS_LIBS" +AC_CHECK_FUNCS([aug_source]) +LIBS="$old_LIBS" + dnl Produce output files. AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([Makefile META])