+msg()
+{
+ # TODO: only output from here if "quiet" option is not given
+ echo "$*"
+}
+
+# write all the common options to stdout, massaging them specially if they are
+# meant to be included in a configure input file setup.h.in
+#
+# usage: cat_common_options_for setup_inc.h setup0.h
+cat_common_options_for()
+{
+ # get rid of the copyright header on top of the file
+ cmd="sed '1,/^\$/d' $1"
+
+ # the file used for configure is special: we need to get rid of C++
+ # comments in it because it is included by some C code and we also have to
+ # set all options to 0 by default as they're put to 1 only by configure
+ # (and hence any #ifdefs setting default values for them become unneeded)
+ if [ $2 = "setup.h.in" ]; then
+ cmd="$cmd | sed -e '/^\/\//d' \
+ -e 's@ *//.*\$@@' \
+ -e 's/# *define \(.\+\) \+1 *\$/#define \1 0/'"
+ fi
+
+ eval $cmd
+}
+
+# update the single setup.h file passed in as the parameter if it is out of
+# date
+#
+# usage: update_single_setup_h {common|MSW} setup_inc.h setup0.h