Autoconf/automake macro for the Gedcom parser library.
authorPeter Verthez <Peter.Verthez@advalvas.be>
Sat, 2 Nov 2002 09:05:26 +0000 (09:05 +0000)
committerPeter Verthez <Peter.Verthez@advalvas.be>
Sat, 2 Nov 2002 09:05:26 +0000 (09:05 +0000)
m4/.cvsignore [new file with mode: 0644]
m4/Makefile.am [new file with mode: 0644]
m4/gedcom.m4 [new file with mode: 0644]

diff --git a/m4/.cvsignore b/m4/.cvsignore
new file mode 100644 (file)
index 0000000..70845e0
--- /dev/null
@@ -0,0 +1 @@
+Makefile.in
diff --git a/m4/Makefile.am b/m4/Makefile.am
new file mode 100644 (file)
index 0000000..a8d4f3a
--- /dev/null
@@ -0,0 +1,4 @@
+## Process this file with automake to produce Makefile.in
+# $Id$
+# $Name$
+EXTRA_DIST = gedcom.m4
diff --git a/m4/gedcom.m4 b/m4/gedcom.m4
new file mode 100644 (file)
index 0000000..d233573
--- /dev/null
@@ -0,0 +1,36 @@
+dnl Autoconf/automake macros for the Gedcom parser library
+dnl Peter Verthez
+dnl 
+dnl $Id$
+dnl $Name$
+
+dnl AM_LIB_GEDCOM_PARSER([MINIMUM-MAJOR-VERSION, [MINIMUM-MINOR-VERSION]])
+dnl Test for the availability of the Gedcom parser library, and check whether
+dnl the required minimum version is available (parameters default to 0 if
+dnl not given
+AC_DEFUN(AM_LIB_GEDCOM_PARSER, [
+  AC_CHECK_LIB(gedcom, gedcom_parse_file,,
+     AC_MSG_ERROR([Cannot find libgedcom: Please install gedcom-parse]))
+  major_version=ifelse([$1], ,0,$1)
+  minor_version=ifelse([$2], ,0,$2)
+  AC_MSG_CHECKING(for libgedcom version >= $major_version.$minor_version)
+  AC_TRY_RUN([
+#include <stdio.h>
+#include <stdlib.h>
+#include <gedcom.h>
+int
+main()
+{
+if (GEDCOM_PARSE_VERSION >= $major_version * 1000 + $minor_version) exit(0);
+exit(1);
+}],
+ac_gedcom_version_ok='yes',
+ac_gedcom_version_ok='no',
+ac_gedcom_version_ok='no')
+if test "$ac_gedcom_version_ok" = 'yes' ; then
+  AC_MSG_RESULT(ok)
+else
+  AC_MSG_RESULT(not ok)
+  AC_MSG_ERROR(You need at least version $major_version.$minor_version of gedcom-parse)
+fi
+])