diff options
-rwxr-xr-x | git-amb/git-amb.in | 6 | ||||
-rw-r--r-- | m4/ndim-check-sh-command-substitution.m4 | 26 | ||||
-rw-r--r-- | m4/ndim-check-sh-functions.m4 | 28 | ||||
-rw-r--r-- | m4/ndim_detect_man2txt.m4 | 3 |
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]) |