summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Ulrich Niedermann <hun@n-dimensional.de>2007-11-06 17:42:55 +0100
committerHans Ulrich Niedermann <hun@n-dimensional.de>2007-11-06 17:42:55 +0100
commitf91d7a4575498a12f4c9a306aeadd0a204aedcc2 (patch)
tree1daa53d6104146bb7ecd8114a8297a62ba198bc3
parent19aa6ad8a96b17bbc269295686c5b22bb918e7ee (diff)
downloadndim-git-utils-f91d7a4575498a12f4c9a306aeadd0a204aedcc2.tar.gz
ndim-git-utils-f91d7a4575498a12f4c9a306aeadd0a204aedcc2.tar.xz
ndim-git-utils-f91d7a4575498a12f4c9a306aeadd0a204aedcc2.zip
Add checks for POSIX sh $(cmd) and functions
-rwxr-xr-xgit-amb/git-amb.in6
-rw-r--r--m4/ndim-check-sh-command-substitution.m426
-rw-r--r--m4/ndim-check-sh-functions.m428
-rw-r--r--m4/ndim_detect_man2txt.m43
4 files changed, 63 insertions, 0 deletions
diff --git a/git-amb/git-amb.in b/git-amb/git-amb.in
index 6aab868..a06b086 100755
--- a/git-amb/git-amb.in
+++ b/git-amb/git-amb.in
@@ -31,6 +31,12 @@ else
exit 1
fi
+if test "x$(moo() { echo "meh"; }; moo)" = "xmeh"; then :;
+else
+ echo "$self: FATAL: This shell does not support POSIX sh functions" >&2
+ exit 1
+fi
+
self="$(basename "$0")"
bindir="$(cd "$(dirname "$0")" && pwd)"
prefixdir="$(dirname "$bindir")"
diff --git a/m4/ndim-check-sh-command-substitution.m4 b/m4/ndim-check-sh-command-substitution.m4
new file mode 100644
index 0000000..30ea082
--- /dev/null
+++ b/m4/ndim-check-sh-command-substitution.m4
@@ -0,0 +1,26 @@
+# version 1.11
+dnl NDIM_CHECK_SH_COMMAND_SUBSTITUTION([ACTION-IF-SUPPORTED],
+dnl [ACTION-IF-NOT-SUPPORTED)dnl
+dnl
+AC_DEFUN([NDIM_CHECK_SH_COMMAND_SUBSTITUTION],[dnl
+ndim_sh_command_substitution=no
+if test "x$(pwd)" = "x`pwd`" \
+&& test "y$(echo "foobar")" = "y`echo foobar`"
+then
+ ndim_sh_command_substitution=yes
+fi
+m4_ifval([$1], [
+if test "x$ndim_sh_command_substitution" = "xyes"; then
+$1
+fi
+])dnl
+m4_ifval([$2], [
+if test "x$ndim_sh_command_substitution" = "xno"; then
+$2
+fi
+])
+])dnl
+dnl
+dnl Local Variables:
+dnl mode: autoconf
+dnl End:
diff --git a/m4/ndim-check-sh-functions.m4 b/m4/ndim-check-sh-functions.m4
new file mode 100644
index 0000000..137a218
--- /dev/null
+++ b/m4/ndim-check-sh-functions.m4
@@ -0,0 +1,28 @@
+# version 1.11
+dnl NDIM_CHECK_SH_FUNCTIONS([ACTION-IF-SUPPORTED],
+dnl [ACTION-IF-NOT-SUPPORTED)dnl
+dnl
+AC_DEFUN([NDIM_CHECK_SH_FUNCTIONS],[dnl
+NDIM_CHECK_SH_COMMAND_SUBSTITUTION([], [dnl
+AC_MSG_ERROR([Sorry, POSIX sh with \$() required.])dnl
+])dnl
+ndim_sh_functions=no
+if test "x$(moo() { echo "meh"; }; moo)" = "xmeh"
+then
+ ndim_sh_functions=yes
+fi
+m4_ifval([$1], [
+if test "x$ndim_sh_functions" = "xyes"; then
+$1
+fi
+])dnl
+m4_ifval([$2], [
+if test "x$ndim_sh_functions" = "xno"; then
+$2
+fi
+])
+])dnl
+dnl
+dnl Local Variables:
+dnl mode: autoconf
+dnl End:
diff --git a/m4/ndim_detect_man2txt.m4 b/m4/ndim_detect_man2txt.m4
index 96986d1..023b5ba 100644
--- a/m4/ndim_detect_man2txt.m4
+++ b/m4/ndim_detect_man2txt.m4
@@ -18,6 +18,9 @@ dnl If that is true, define NDIM_MAN2TXT.
dnl
m4_pattern_forbid([NDIM_DETECT_MAN2TXT])dnl
AC_DEFUN([NDIM_DETECT_MAN2TXT], [dnl
+NDIM_CHECK_SH_FUNCTIONS([], [dnl
+AC_MSG_ERROR([Sorry, POSIX sh with functions required.])dnl
+])dnl
AC_ARG_VAR([MAN])
AC_PATH_PROG([MAN], [man], [false])
AC_ARG_VAR([COL])