diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2016-02-18 17:41:25 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2016-02-18 17:41:25 +0100 |
commit | 58a395c9ad73720a6b65e7c1d2769978cc2c23c6 (patch) | |
tree | c6cbd98e152c3d373323a05afe3440b7f352719c /m4 | |
parent | b8e8cc8da49c474159f904c5c8bd2acc849c7c52 (diff) | |
download | sciteco-58a395c9ad73720a6b65e7c1d2769978cc2c23c6.tar.gz |
replace custom Gob2 check with GOB2_CHECK() from gob2.m4
* Allows us to check for the Gob2 version at ./configure time
* this file ships with Gob2 installations, so in most cases
it could be found without shipping it with SciTECO.
* Autoconf is built such that source distributions will contain
all additional external macros compiled in aclocal.m4.
* However if somebody builds from Git, he/she would still
expect the ./configure checks to produce meaningful results
even if not all dependencies are installed properly.
It therefore seems to be good practice to include all
external M4 macros (gob2.m4) as a fallback with the source tree.
* /usr/share/aclocal contains many more useful m4 macros.
However since we can depend on pkg-config e.g. for finding
Gtk+ and Glib, I won't use those macros as else I would
have to bundle them to achieve the same kind of ./configure
robustness.
Diffstat (limited to 'm4')
-rw-r--r-- | m4/gob2.m4 | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/m4/gob2.m4 b/m4/gob2.m4 new file mode 100644 index 0000000..196d6c2 --- /dev/null +++ b/m4/gob2.m4 @@ -0,0 +1,58 @@ +dnl +dnl GOB_HOOK(script if found, fail) +dnl if fail = "failure", abort if GOB not found +dnl + + +AC_DEFUN([GOB2_HOOK],[ + AC_PATH_PROG(GOB2,gob2) + if test ! x$GOB2 = x; then + if test ! x$1 = x; then + AC_MSG_CHECKING(for gob-2 >= $1) + g_r_ve=`echo $1|sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + g_r_ma=`echo $1|sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + g_r_mi=`echo $1|sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + g_ve=`$GOB2 --version 2>&1|sed 's/Gob version \([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + g_ma=`$GOB2 --version 2>&1|sed 's/Gob version \([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + g_mi=`$GOB2 --version 2>&1|sed 's/Gob version \([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + + if test $g_ve -eq $g_r_ve; then + if test $g_ma -ge $g_r_ma; then + if test $g_mi -ge $g_r_mi; then + AC_MSG_RESULT(ok) + else + if test $g_ma -gt $g_r_ma; then + AC_MSG_RESULT(ok) + else + AC_MSG_ERROR("found $g_ve.$g_ma.$g_mi requires $g_r_ve.$g_r_ma.$g_r_mi") + fi + fi + else + AC_MSG_ERROR("found $g_ve.$g_ma.$g_mi requires $g_r_ve.$g_r_ma.$g_r_mi") + fi + else + if test $g_ve -gt $g_r_ve; then + AC_MSG_RESULT(ok) + else + AC_MSG_ERROR(major version $g_ve found but $g_r_ve required) + fi + fi + + unset gob_version + unset g_ve + unset g_ma + unset g_mi + unset g_r_ve + unset g_r_ma + unset g_r_mi + fi + AC_SUBST(GOB2) + $2 + else + $3 + fi +]) + +AC_DEFUN([GOB2_CHECK],[ + GOB2_HOOK($1,[],[AC_MSG_ERROR([Cannot find GOB-2, check http://www.5z.com/jirka/gob.html])]) +]) |