1# AS_CASE(WORD, [PATTERN1], [IF-MATCHED1]...[DEFAULT]) 2# ---------------------------------------------------- 3# Expand into 4# | case WORD in 5# | PATTERN1) IF-MATCHED1 ;; 6# | ... 7# | *) DEFAULT ;; 8# | esac 9m4_define([_AS_CASE], 10[m4_if([$#], 0, [m4_fatal([$0: too few arguments: $#])], 11 [$#], 1, [ *) $1 ;;], 12 [$#], 2, [ $1) m4_default([$2], [:]) ;;], 13 [ $1) m4_default([$2], [:]) ;; 14$0(m4_shiftn(2, $@))])dnl 15]) 16m4_defun([AS_CASE], 17[m4_ifval([$2$3], 18[case $1 in 19_AS_CASE(m4_shift($@)) 20esac])]) 21 22