summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/libuv/m4/as_case.m4
diff options
context:
space:
mode:
Diffstat (limited to '3rdparty/libuv/m4/as_case.m4')
-rw-r--r--3rdparty/libuv/m4/as_case.m421
1 files changed, 21 insertions, 0 deletions
diff --git a/3rdparty/libuv/m4/as_case.m4 b/3rdparty/libuv/m4/as_case.m4
new file mode 100644
index 00000000000..c7ae0f0f5ed
--- /dev/null
+++ b/3rdparty/libuv/m4/as_case.m4
@@ -0,0 +1,21 @@
+# AS_CASE(WORD, [PATTERN1], [IF-MATCHED1]...[DEFAULT])
+# ----------------------------------------------------
+# Expand into
+# | case WORD in
+# | PATTERN1) IF-MATCHED1 ;;
+# | ...
+# | *) DEFAULT ;;
+# | esac
+m4_define([_AS_CASE],
+[m4_if([$#], 0, [m4_fatal([$0: too few arguments: $#])],
+ [$#], 1, [ *) $1 ;;],
+ [$#], 2, [ $1) m4_default([$2], [:]) ;;],
+ [ $1) m4_default([$2], [:]) ;;
+$0(m4_shiftn(2, $@))])dnl
+])
+m4_defun([AS_CASE],
+[m4_ifval([$2$3],
+[case $1 in
+_AS_CASE(m4_shift($@))
+esac])])
+