summaryrefslogtreecommitdiffstats
path: root/m4
diff options
context:
space:
mode:
authorHans Ulrich Niedermann <hun@n-dimensional.de>2008-06-22 17:33:07 +0200
committerHans Ulrich Niedermann <hun@n-dimensional.de>2008-07-15 12:28:52 +0200
commit1ecb5d9fdd1634cef8fa4bb43ed0d563cc3a5738 (patch)
tree55c34f9c4a0e7f4e1d530a2916f7fb5232d9df96 /m4
parentfe118b849167155dd9bcfbc525dfce391f1a11bb (diff)
downloadnbb-1ecb5d9fdd1634cef8fa4bb43ed0d563cc3a5738.tar.gz
nbb-1ecb5d9fdd1634cef8fa4bb43ed0d563cc3a5738.tar.xz
nbb-1ecb5d9fdd1634cef8fa4bb43ed0d563cc3a5738.zip
m4 macro cleanup
Diffstat (limited to 'm4')
-rw-r--r--m4/ndim-check-sh-command-substitution.m413
-rw-r--r--m4/ndim-check-sh-functions.m416
-rw-r--r--m4/ndim-check-sh-param-expansion.m431
-rw-r--r--m4/ndim-detect-man2txt.m413
-rw-r--r--m4/ndim-require-posix-sh.m42
5 files changed, 27 insertions, 48 deletions
diff --git a/m4/ndim-check-sh-command-substitution.m4 b/m4/ndim-check-sh-command-substitution.m4
index de2e80c..e382294 100644
--- a/m4/ndim-check-sh-command-substitution.m4
+++ b/m4/ndim-check-sh-command-substitution.m4
@@ -1,3 +1,4 @@
+# serial 1.2.3
dnl NDIM_CHECK_SH_COMMAND_SUBSTITUTION([ACTION-IF-SUPPORTED],
dnl [ACTION-IF-NOT-SUPPORTED)dnl
dnl
@@ -9,16 +10,8 @@ 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
-fi
-])dnl
-m4_ifval([$2], [
-if test "x$ndim_sh_command_substitution" = "xno"; then
-$2
-fi
-])
+m4_ifval([$1], [AS_IF([test "x$ndim_sh_command_substitution" = "xyes"], [$1])])dnl
+m4_ifval([$2], [AS_IF([test "x$ndim_sh_command_substitution" = "xno" ], [$2])])dnl
])dnl
dnl
dnl Local Variables:
diff --git a/m4/ndim-check-sh-functions.m4 b/m4/ndim-check-sh-functions.m4
index 0b03dd7..77e1559 100644
--- a/m4/ndim-check-sh-functions.m4
+++ b/m4/ndim-check-sh-functions.m4
@@ -1,4 +1,4 @@
-# version 1.11
+# version 1.12
dnl NDIM_CHECK_SH_FUNCTIONS([ACTION-IF-SUPPORTED],
dnl [ACTION-IF-NOT-SUPPORTED)dnl
dnl
@@ -11,17 +11,9 @@ 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
-fi
-])dnl
-m4_ifval([$2], [
-if test "x$ndim_sh_functions" = "xno"; then
-$2
-fi
-])
+AC_MSG_RESULT([$ndim_sh_functions])])dnl
+m4_ifval([$1], [AS_IF([test "x$ndim_sh_functions" = "xyes"], [$1])])dnl
+m4_ifval([$2], [AS_IF([test "x$ndim_sh_functions" = "xno" ], [$2])])dnl
])dnl
dnl
dnl Local Variables:
diff --git a/m4/ndim-check-sh-param-expansion.m4 b/m4/ndim-check-sh-param-expansion.m4
index b253131..91941e8 100644
--- a/m4/ndim-check-sh-param-expansion.m4
+++ b/m4/ndim-check-sh-param-expansion.m4
@@ -1,29 +1,22 @@
-# version 1.11
-dnl NDIM_CHECK_SH_COMMAND_SUBSTITUTION([ACTION-IF-SUPPORTED],
-dnl [ACTION-IF-NOT-SUPPORTED)dnl
+# version 1.12
+dnl NDIM_CHECK_SH_COMMAND_EXPANSION([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
+m4_pattern_forbid([NDIM_CHECK_SH_PARAM_EXPANSION])dnl
+AC_DEFUN([NDIM_CHECK_SH_PARAM_EXPANSION],[dnl
+AS_IF([test "x$ndim_sh_param_expansion" = "x"], [dnl
+AC_MSG_CHECKING([\${foo%%bar} type sh param expansion])
+ndim_sh_param_expansion=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
-])
+ && ndim_sh_param_expansion=yes
+AC_MSG_RESULT([$ndim_sh_param_expansion])])
+m4_ifval([$1], [AS_IF([test "x$ndim_sh_param_expansion" = "xyes"], [$1])])dnl
+m4_ifval([$2], [AS_IF([test "x$ndim_sh_param_expansion" = "xno" ], [$2])])dnl
])dnl
dnl
dnl Local Variables:
diff --git a/m4/ndim-detect-man2txt.m4 b/m4/ndim-detect-man2txt.m4
index 023b5ba..0cb4b6e 100644
--- a/m4/ndim-detect-man2txt.m4
+++ b/m4/ndim-detect-man2txt.m4
@@ -1,4 +1,4 @@
-# serial 1.6.3
+# serial 1.6.4
dnl
dnl NDIM_DETECT_MAN2TXT
dnl
@@ -21,22 +21,23 @@ 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_ARG_VAR([MAN], [man(1) program to use])
AC_PATH_PROG([MAN], [man], [false])
-AC_ARG_VAR([COL])
+AC_ARG_VAR([COL], [col(1) program to use])
AC_PATH_PROG([COL], [col], [false])
AM_CONDITIONAL([HAVE_NDIM_MAN2TXT],
[test "x$MAN" != "xfalse" &&
test "x$COL" != "xfalse" &&
test "x$(echo "ABXY" | $COL -b)" = "xBY"])
AC_MSG_CHECKING([man and col -b work correctly])
-if test "x$HAVE_NDIM_MAN2TXT_FALSE" = "x#"; then
+AS_IF([test "x$HAVE_NDIM_MAN2TXT_FALSE" = "x#"],
+[
AC_MSG_RESULT([yes])
NDIM_MAN2TXT='m2t(){ $(MAN) "$$(dirname "[$$]1")/$$(basename "[$$]1")"|$(COL) -b; }; m2t'
-else
+], [
AC_MSG_RESULT([no $(echo "ABXY" | $COL -b)])
NDIM_MAN2TXT='false'
-fi
+])
AC_SUBST([NDIM_MAN2TXT])
])dnl
dnl
diff --git a/m4/ndim-require-posix-sh.m4 b/m4/ndim-require-posix-sh.m4
index e5e4814..c81cb5d 100644
--- a/m4/ndim-require-posix-sh.m4
+++ b/m4/ndim-require-posix-sh.m4
@@ -5,7 +5,7 @@ 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
+NDIM_CHECK_SH_PARAM_EXPANSION([], [dnl
AC_MSG_ERROR([Sorry, POSIX sh with \${foo%%bar} & Co. required.])dnl
])dnl
])dnl