From 3b0e95bc750a42b4b38cc94a12c50b3d11da1693 Mon Sep 17 00:00:00 2001 From: Ramiro Estrugo Date: Tue, 10 Apr 2001 03:02:03 +0000 Subject: Add nautilus-macros.m4 svn path=/trunk/; revision=1655 --- hack-macros/nautilus-macros.m4 | 56 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 hack-macros/nautilus-macros.m4 diff --git a/hack-macros/nautilus-macros.m4 b/hack-macros/nautilus-macros.m4 new file mode 100644 index 00000000..5c4e0f64 --- /dev/null +++ b/hack-macros/nautilus-macros.m4 @@ -0,0 +1,56 @@ +dnl +dnl NAUTILUS_VERSION_CANON(version) +dnl 1 +AC_DEFUN(NAUTILUS_VERSION_CANON, [` + + dnl Assumes that there are no more than 999 revisions at a level, + dnl no more than three levels of revision. + dnl + dnl Any more than that, and test starts messing up the numeric + dnl comparisons because its integers overflow, and there's no + dnl way to do string comparisons in the shell. Grr. + dnl + dnl Must come up with some way to fix this. + + echo "$1" | + tr . '\012' | + sed -e 's/^/000/' -e 's/^.*\(...\)/\1/' | + tr -d '\012' | + sed 's/$/000000000/ + s/^\(.........\).*/\1/' +`]) + +dnl NAUTILUS_VERSION_INSIST(package, get-version-cmd, operator, want-version-var) +dnl 1 2 3 4 + +AC_DEFUN(NAUTILUS_VERSION_INSIST, [ + ez_want_version=[$]$4 + + case "$3" in + ">") ez_operator=-gt ;; + ">=") ez_operator=-ge ;; + "<") ez_operator=-lt ;; + "<=") ez_operator=-le ;; + "=") ez_operator=-eq ;; + "!=") ez_operator=-ne ;; + *) AC_ERROR(Unknown operator $3 in configure script) ;; + esac + + AC_MSG_CHECKING(for $1 $3 [$ez_want_version]) + + if ez_installed_version="`$2`" + then + AC_MSG_RESULT([$ez_installed_version]) + else + AC_ERROR($2 failed) + fi + + if test "NAUTILUS_VERSION_CANON([$ez_installed_version])" "$ez_operator" \ + "NAUTILUS_VERSION_CANON([$ez_want_version])" + then + : + AC_SUBST($4) + else + AC_ERROR($1 version [$ez_want_version] is required.) + fi +]) -- cgit v1.2.1