# to $1 with a warning at the beginning to not edit the generated file.
#
# All arguments (except the first which is the filename) are passed to m4.
+#
+# The following macros are defined: IF and FI. Example:
+# IF(OS, debian)
+# ...
+# FI
m4() {
# First argument is file name.
file=$1
# Process $1.m4 with m4 using the given options.
echo "m4(): generating '$file' from '$file.m4' with options '$*'"
- $m4 $* $file.m4 >> $file
+ # Add useful macros.
+ (echo "define(\`IF', \`ifelse(\`\$1', \`\$2',dnl')dnl
+define(\`FI', \`)dnl')dnl";
+ # Run the file (and the default macros) through m4.
+ cat $file.m4) | $m4 $* >> $file
unset file
}