about summary refs log tree commit diff stats
path: root/scripts/cfg_defs.sh
diff options
context:
space:
mode:
authorThomas E. Dickey <dickey@invisible-island.net>2011-06-11 13:06:08 -0400
committerThomas E. Dickey <dickey@invisible-island.net>2011-06-11 13:06:08 -0400
commitf06f1fc3d95167ec780cb0963548f2afdd548b20 (patch)
tree6c12f0dea0a3c860994a46c37d7f32336d39d7db /scripts/cfg_defs.sh
parent279010bc0791556e63b4951d83a2c45252142b80 (diff)
downloadlynx-snapshots-f06f1fc3d95167ec780cb0963548f2afdd548b20.tar.gz
snapshot of project "lynx", label v2-8-8dev_8m
Diffstat (limited to 'scripts/cfg_defs.sh')
-rwxr-xr-xscripts/cfg_defs.sh48
1 files changed, 48 insertions, 0 deletions
diff --git a/scripts/cfg_defs.sh b/scripts/cfg_defs.sh
new file mode 100755
index 00000000..5f37e962
--- /dev/null
+++ b/scripts/cfg_defs.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+# Translate the lynx_cfg.h and config.cache data into a table, useful for
+# display at runtime.
+
+TOP="${1-.}"
+OUT=cfg_defs.h
+
+# just in case we want to run this outside the makefile
+: ${SHELL:=/bin/sh}
+
+cat >$OUT <<EOF
+#ifndef CFG_DEFS_H
+#define CFG_DEFS_H 1
+
+static const struct {
+	const char *name;
+	const char *value;
+} config_cache[] = {
+EOF
+
+sed \
+	-e '/^#/d'     \
+	-e 's/^.[^=]*_cv_//' \
+	-e 's/=\${.*=/=/'  \
+	-e 's/}$//'          \
+	config.cache | $SHELL $TOP/scripts/cfg_edit.sh >>$OUT
+
+cat >>$OUT <<EOF
+};
+
+static const struct {
+	const char *name;
+	const char *value;
+} config_defines[] = {
+EOF
+fgrep	'#define' lynx_cfg.h |
+sed	-e 's@	@ @g' \
+	-e 's@  @ @g' \
+	-e 's@^[ 	]*#define[ 	]*@@' \
+	-e 's@[ ]*/\*.*\*/@@' \
+	-e 's@[ 	][ 	]*@=@' \
+    | $SHELL $TOP/scripts/cfg_edit.sh >>$OUT
+
+cat >>$OUT <<EOF
+};
+
+#endif /* CFG_DEFS_H */
+EOF