1 dnl Convenient macros, by Mikhael Goikhman
3 dnl mg_ARG_WITH(NAME, HELP-STRING, VAR [, DEFAULT-VALUE])
4 AC_DEFUN(mg_ARG_WITH, [
5 AC_DIVERT_PUSH(HELP_WITH)dnl
9 [#] Check whether --with-[$1] or --without-[$1] was given.
10 withvar="[${with_]patsubst([$1], -, _)-no}"
11 if test "$withvar" != no; then
12 withvar="[$with_]patsubst([$1], -, _)"
14 ifelse([$4], , , [else
20 dnl mg_DEFAULT_DIR_ARG(ARG, DEFAULT_VALUE)
21 AC_DEFUN(mg_DEFAULT_DIR_ARG, [
23 if echo "${var}NONE" | ${AWK} '/^\$|^NONE/ { exit 1 }'; then
28 case "[$]$1" in "") echo "No value for $1. Failed."; exit 1;; esac
31 dnl mg_LIST_MINUS(LIST1-VAR, LIST2-VAR, LIST3-VAR)
32 AC_DEFUN(mg_LIST_MINUS, [
35 $3=`${AWK} -v l1="${list1}" -v l2="${list2}" 'BEGIN {
36 split(l1, a1, / +/); split(l2, a2, / +/); l3 = "";
38 u = 1; for (i2 in a2) { if (a1[[i1]] == a2[[i2]]) u = 0; }
39 if (u) l3 = l3 a1[[i1]] " ";
41 }' | xargs -n 1 echo | sort`