summaryrefslogtreecommitdiffstats
path: root/scripts/cfg_defs.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 16:37:15 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 16:37:15 +0000
commitae5d181b854d3ccb373b6bc01b4869e44ff4d87a (patch)
tree91f59efb48c56a84cc798e012fccb667b63d3fee /scripts/cfg_defs.sh
parentInitial commit. (diff)
downloadlynx-upstream.tar.xz
lynx-upstream.zip
Adding upstream version 2.9.0dev.12.upstream/2.9.0dev.12upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts/cfg_defs.sh')
-rwxr-xr-xscripts/cfg_defs.sh51
1 files changed, 51 insertions, 0 deletions
diff --git a/scripts/cfg_defs.sh b/scripts/cfg_defs.sh
new file mode 100755
index 0000000..560dfc4
--- /dev/null
+++ b/scripts/cfg_defs.sh
@@ -0,0 +1,51 @@
+#!/bin/sh
+# $LynxId: cfg_defs.sh,v 1.2 2021/01/07 00:38:05 tom Exp $
+# 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 <<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"
+
+cat <<EOF
+};
+
+static const struct {
+ const char *name;
+ const char *value;
+} config_defines[] = {
+EOF
+${FGREP-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"
+
+cat <<EOF
+};
+
+#endif /* CFG_DEFS_H */
+EOF
+} >$OUT