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 | |
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.
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | m4/gob2.m4 | 58 |
2 files changed, 60 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac index 033b244..dd37664 100644 --- a/configure.ac +++ b/configure.ac @@ -10,6 +10,7 @@ PACKAGE_URL_DEV=https://github.com/rhaberkorn/sciteco AC_SUBST(PACKAGE_URL_DEV) AC_DEFINE_UNQUOTED(PACKAGE_URL_DEV, ["$PACKAGE_URL_DEV"], [Package development homepage.]) +AC_CONFIG_MACRO_DIR(m4) AC_CONFIG_AUX_DIR(config) AM_INIT_AUTOMAKE @@ -267,10 +268,7 @@ gtk) GTK_FLOW_BOX_FALLBACK=true ]) - AC_CHECK_PROG(GOB2, gob2, gob2) - if [[ x$GOB2 = x ]]; then - AC_MSG_ERROR([Gob2 (GObject Builder) not found!]) - fi + GOB2_CHECK(2.0.20) AC_DEFINE(INTERFACE_GTK, , [Build with GTK+ 3.0 support]) 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])]) +]) |