diff options
Diffstat (limited to 'cfg_defs.sh')
-rwxr-xr-x | cfg_defs.sh | 53 |
1 files changed, 15 insertions, 38 deletions
diff --git a/cfg_defs.sh b/cfg_defs.sh index d20a77f7..4f8a0034 100755 --- a/cfg_defs.sh +++ b/cfg_defs.sh @@ -2,7 +2,9 @@ # Translate the lynx_cfg.h and config.cache data into a table, useful for # display at runtime. -cat <<EOF +OUT=cfg_defs.h + +cat >$OUT <<EOF #ifndef CFG_DEFS_H #define CFG_DEFS_H 1 @@ -12,37 +14,14 @@ static CONST struct { } config_cache[] = { EOF -# Empirical test for format of config.cache. -# I'd welcome a better touchstone. -# Ideally, "configure" should generate a uniform format config.cache. -# -- gil -case `grep '^ac_cv_func_' config.cache | head -1` in - - # `set' quotes correctly as required by POSIX, so do not add quotes. - *{*'="'* ) - sed \ +sed \ -e '/^#/d' \ - -e 's/^.[^=]*_cv_/ { "/' \ - -e 's/=\${.*=/", /' \ - -e 's/}$/ },/' \ - config.cache | sort - ;; - # `set' does not quote correctly, so add quotes - # ( cf. configure script's building config.cache ) - * ) -sed -e '/^#/d' \ - -e 's/"/\\"/g' \ - -e 's/=}$/=""}/' \ - -e "s/'/\"/g" \ - -e 's/^.[^=]*_cv_/ { "/' \ - -e 's/=${[^=]*="/", "/' \ - -e 's/=${[^=]*=/", "/' \ - -e 's/"}$/}/' \ - -e 's/}$/" },/' \ - config.cache | sort - ;; esac + -e 's/^.[^=]*_cv_//' \ + -e 's/=\${.*=/=/' \ + -e 's/}$//' \ + config.cache | cfg_edit.sh >>$OUT -cat <<EOF +cat >>$OUT <<EOF }; static CONST struct { @@ -50,17 +29,15 @@ static CONST struct { CONST char *value; } config_defines[] = { EOF -fgrep '#define' lynx_cfg.h |sort | +fgrep '#define' lynx_cfg.h | sed -e 's@ @ @g' \ -e 's@ @ @g' \ - -e 's@[ ]*#define @@' \ + -e 's@^[ ]*#define[ ]*@@' \ -e 's@[ ]*/\*.*\*/@@' \ - -e 's@"$@@' \ - -e 's@"@@' \ - -e 's@ @", "@' \ - -e 's@^@ { "@' \ - -e 's@$@" },@' -cat <<EOF + -e 's@[ ][ ]*@=@' \ + | cfg_edit.sh >>$OUT + +cat >>$OUT <<EOF }; #endif /* CFG_DEFS_H */ |