summaryrefslogtreecommitdiffstats
path: root/m4
diff options
context:
space:
mode:
authorHans Ulrich Niedermann <hun@n-dimensional.de>2008-06-21 15:54:52 +0200
committerHans Ulrich Niedermann <hun@n-dimensional.de>2008-07-19 01:13:31 +0200
commitbd8a638e9caa2fa508f8865d9532c821f81fa909 (patch)
tree0ecc9aba522c50ae5f4f9e2c00c969d3f67daaae /m4
parentafcce7e37a5308198cd524f5b1e83f03eb580158 (diff)
downloadndim-git-utils-bd8a638e9caa2fa508f8865d9532c821f81fa909.tar.gz
ndim-git-utils-bd8a638e9caa2fa508f8865d9532c821f81fa909.tar.xz
ndim-git-utils-bd8a638e9caa2fa508f8865d9532c821f81fa909.zip
Generate version information from git info
Diffstat (limited to 'm4')
-rw-r--r--m4/ndim-check-sh-command-substitution.m44
-rw-r--r--m4/ndim-check-sh-functions.m43
-rw-r--r--m4/ndim-check-sh-param-expansion.m431
-rw-r--r--m4/ndim-require-posix-sh.m415
4 files changed, 52 insertions, 1 deletions
diff --git a/m4/ndim-check-sh-command-substitution.m4 b/m4/ndim-check-sh-command-substitution.m4
index 48c5e26..de2e80c 100644
--- a/m4/ndim-check-sh-command-substitution.m4
+++ b/m4/ndim-check-sh-command-substitution.m4
@@ -1,12 +1,14 @@
-# version 1.11
dnl NDIM_CHECK_SH_COMMAND_SUBSTITUTION([ACTION-IF-SUPPORTED],
dnl [ACTION-IF-NOT-SUPPORTED)dnl
dnl
m4_pattern_forbid([NDIM_CHECK_SH_COMMAND_SUBSTITUTION])dnl
AC_DEFUN([NDIM_CHECK_SH_COMMAND_SUBSTITUTION],[dnl
+AS_IF([test "x$ndim_sh_command_substitution" = "x"], [dnl
+AC_MSG_CHECKING([\$(cmd) type sh command substition])
ndim_sh_command_substitution=no
test "x$(pwd)" = "x`pwd`" && test "y$(echo "foobar")" = "y`echo foobar`" \
&& ndim_sh_command_substitution=yes
+AC_MSG_RESULT([$ndim_sh_command_substitution])])
m4_ifval([$1], [
if test "x$ndim_sh_command_substitution" = "xyes"; then
$1
diff --git a/m4/ndim-check-sh-functions.m4 b/m4/ndim-check-sh-functions.m4
index a0f5108..0b03dd7 100644
--- a/m4/ndim-check-sh-functions.m4
+++ b/m4/ndim-check-sh-functions.m4
@@ -7,8 +7,11 @@ AC_DEFUN([NDIM_CHECK_SH_FUNCTIONS],[dnl
NDIM_CHECK_SH_COMMAND_SUBSTITUTION([], [dnl
AC_MSG_ERROR([Sorry, POSIX sh with \$() required.])dnl
])dnl
+AS_IF([test "x$ndim_sh_functions" = "x"], [dnl
+AC_MSG_CHECKING([whether sh supports POSIX sh functions])
ndim_sh_functions=no
test "x$(moo() { echo "meh"; }; moo)" = "xmeh" && ndim_sh_functions=yes
+AC_MSG_RESULT([$ndim_sh_functions])])
m4_ifval([$1], [
if test "x$ndim_sh_functions" = "xyes"; then
$1
diff --git a/m4/ndim-check-sh-param-expansion.m4 b/m4/ndim-check-sh-param-expansion.m4
new file mode 100644
index 0000000..b253131
--- /dev/null
+++ b/m4/ndim-check-sh-param-expansion.m4
@@ -0,0 +1,31 @@
+# version 1.11
+dnl NDIM_CHECK_SH_COMMAND_SUBSTITUTION([ACTION-IF-SUPPORTED],
+dnl [ACTION-IF-NOT-SUPPORTED)dnl
+dnl
+m4_pattern_forbid([NDIM_CHECK_SH_PARAM_SUBSTITUTION])dnl
+AC_DEFUN([NDIM_CHECK_SH_PARAM_SUBSTITUTION],[dnl
+AS_IF([test "x$ndim_sh_param_substitution" = "x"], [dnl
+AC_MSG_CHECKING([\${foo%%bar} type sh param substitution])
+ndim_sh_param_substitution=no
+ndim_testvalue="12.34.56-1.23.4-615asdg"
+test "x${ndim_testvalue%%-*}" = "x12.34.56" \
+ && test "x${ndim_testvalue%-*}" = "x12.34.56-1.23.4" \
+ && test "x${ndim_testvalue##*-}" = "x615asdg" \
+ && test "x${ndim_testvalue#*-}" = "x1.23.4-615asdg" \
+ && ndim_sh_param_substitution=yes
+AC_MSG_RESULT([$ndim_sh_param_substitution])])
+m4_ifval([$1], [
+if test "x$ndim_sh_param_substitution" = "xyes"; then
+$1
+fi
+])dnl
+m4_ifval([$2], [
+if test "x$ndim_sh_param_substitution" = "xno"; then
+$2
+fi
+])
+])dnl
+dnl
+dnl Local Variables:
+dnl mode: autoconf
+dnl End:
diff --git a/m4/ndim-require-posix-sh.m4 b/m4/ndim-require-posix-sh.m4
new file mode 100644
index 0000000..e5e4814
--- /dev/null
+++ b/m4/ndim-require-posix-sh.m4
@@ -0,0 +1,15 @@
+dnl NDIM_REQUIRE_POSIX_SH()dnl
+dnl dnl
+m4_pattern_forbid([NDIM_REQUIRE_POSIX_SH])dnl
+AC_DEFUN([NDIM_REQUIRE_POSIX_SH],[dnl
+NDIM_CHECK_SH_COMMAND_SUBSTITUTION([], [dnl
+AC_MSG_ERROR([Sorry, POSIX sh with \$() required.])dnl
+])dnl
+NDIM_CHECK_SH_PARAM_SUBSTITUTION([], [dnl
+AC_MSG_ERROR([Sorry, POSIX sh with \${foo%%bar} & Co. required.])dnl
+])dnl
+])dnl
+dnl
+dnl Local Variables:
+dnl mode: autoconf
+dnl End: