diff --git a/m4/moo-gtk.m4 b/m4/moo-gtk.m4 index aeb630a7..bb4b8d48 100644 --- a/m4/moo-gtk.m4 +++ b/m4/moo-gtk.m4 @@ -1,3 +1,17 @@ +############################################################################## +# _MOO_SPLIT_VERSION(PKG_NAME,pkg-name) +# +AC_DEFUN([_MOO_SPLIT_VERSION],[ +AC_MSG_CHECKING($1 version) +_moo_ac_version=`$PKG_CONFIG --modversion $2` +$1[]_VERSION=$_moo_ac_version +$1[]_MAJOR_VERSION=`echo "$_moo_ac_version" | $SED 's/\([[^.]][[^.]]*\).*/\1/'` +$1[]_MINOR_VERSION=`echo "$_moo_ac_version" | $SED 's/[[^.]][[^.]]*.\([[^.]][[^.]]*\).*/\1/'` +$1[]_MICRO_VERSION=`echo "$_moo_ac_version" | $SED 's/[[^.]][[^.]]*.[[^.]][[^.]]*.\(.*\)/\1/'` +AC_MSG_RESULT($[]$1[]_MAJOR_VERSION.$[]$1[]_MINOR_VERSION.$[]$1[]_MICRO_VERSION) +]) + + ############################################################################## # MOO_CHECK_VERSION(PKG_NAME,pkg-name) # @@ -5,19 +19,12 @@ dnl used also in moo-pygtk.m4 AC_DEFUN([MOO_CHECK_VERSION],[ if test x$MOO_OS_CYGWIN != xyes; then PKG_CHECK_MODULES($1,$2) - - AC_MSG_CHECKING($1 version) - _moo_ac_version=`$PKG_CONFIG --modversion $2` - - $1[]_VERSION=$_moo_ac_version - $1[]_MAJOR_VERSION=`echo "$_moo_ac_version" | $SED 's/\([[^.]][[^.]]*\).*/\1/'` - $1[]_MINOR_VERSION=`echo "$_moo_ac_version" | $SED 's/[[^.]][[^.]]*.\([[^.]][[^.]]*\).*/\1/'` - $1[]_MICRO_VERSION=`echo "$_moo_ac_version" | $SED 's/[[^.]][[^.]]*.[[^.]][[^.]]*.\(.*\)/\1/'` - + _MOO_SPLIT_VERSION($1,$2) m4_foreach([num],[2,4,6,8,10,12,14], [AM_CONDITIONAL($1[]_2_[]num, test $[]$1[]_MINOR_VERSION -ge num)]) - - AC_MSG_RESULT($[]$1[]_MAJOR_VERSION.$[]$1[]_MINOR_VERSION.$[]$1[]_MICRO_VERSION) +else + m4_foreach([num],[2,4,6,8,10,12,14], + [AM_CONDITIONAL($1[]_2_[]num, false)]) fi ]) diff --git a/m4/moo-pygtk.m4 b/m4/moo-pygtk.m4 index 63acc82c..1e0caf65 100644 --- a/m4/moo-pygtk.m4 +++ b/m4/moo-pygtk.m4 @@ -16,8 +16,6 @@ AC_DEFUN([_MOO_AC_PYGTK_CODEGEN],[ AC_MSG_NOTICE([using installed codegen]) AC_MSG_NOTICE([pygtk codegen dir: $PYGTK_CODEGEN_DIR]) fi - - AM_CONDITIONAL(MOO_USE_CUSTOM_CODEGEN, $MOO_USE_CUSTOM_CODEGEN) ]) @@ -50,7 +48,6 @@ AC_DEFUN([_MOO_AC_CHECK_PYGTK_REAL],[ AC_SUBST(PYGTK[]$1[]_CODEGEN_DIR,[$PYGTK_CODEGEN_DIR]) ]) AC_MSG_NOTICE([pygtk defs dir: $PYGTK_DEFS_DIR]) - _MOO_AC_PYGTK_CODEGEN m4_if([$2],[],[:],[$2]) ],[ AC_MSG_RESULT([no]) @@ -113,7 +110,7 @@ AC_DEFUN_ONCE([MOO_AC_PYTHON],[ MOO_AC_CHECK_PYTHON($_moo_python_version,[ _MOO_AC_CHECK_PYGTK([ MOO_USE_PYTHON=true - MOO_CHECK_VERSION(PYGTK, pygtk-2.0) + _MOO_SPLIT_VERSION(PYGTK, pygtk-2.0) AC_SUBST(PYGTK_VERSION) AC_SUBST(PYGTK_MAJOR_VERSION) AC_SUBST(PYGTK_MINOR_VERSION) @@ -135,5 +132,10 @@ AC_DEFUN_ONCE([MOO_AC_PYTHON],[ AM_CONDITIONAL(MOO_USE_PYTHON, $MOO_USE_PYTHON) if $MOO_USE_PYTHON; then AC_DEFINE(MOO_USE_PYTHON, 1, [build python bindings and plugin]) + _MOO_AC_PYGTK_CODEGEN + else + MOO_USE_CUSTOM_CODEGEN=false fi + + AM_CONDITIONAL(MOO_USE_CUSTOM_CODEGEN, $MOO_USE_CUSTOM_CODEGEN) ])