L4Re/departure

Annotated libext2fs/tools/make_config

618:7123a7307a82
8 months ago Paul Boddie Introduced some debugging output control.
paul@212 1
#!/bin/sh
paul@212 2
paul@212 3
# Find definition usage in this package's sources.
paul@212 4
paul@212 5
THISDIR=`dirname "$0"`
paul@212 6
PKGDIR=`dirname "$THISDIR"`
paul@212 7
CONFIG=$1
paul@212 8
paul@212 9
if [ ! -e "$CONFIG" ] ; then
paul@212 10
    cat 1>&2 <<EOF
paul@212 11
Please specify the location of lib/config.h in the e2fsprogs distribution.
paul@212 12
EOF
paul@212 13
    exit 1
paul@212 14
fi
paul@212 15
paul@212 16
# Insert base configuration.
paul@212 17
paul@212 18
cat "$PKGDIR/lib/config.h.in-l4re" > "$PKGDIR/lib/config.h"
paul@212 19
paul@212 20
# Find definition names in the sources and insert appropriate configuration
paul@212 21
# settings.
paul@212 22
paul@212 23
DEFS='HAVE_[0-9A-Z_]*\|TLS\|VERSION'
paul@212 24
paul@212 25
for SETTING in `find "$PKGDIR/include" "$PKGDIR/lib" -mindepth 2 -type f -name '*.[ch]' | xargs grep -o "$DEFS" | cut -d: -f2 | sort -u` ; do
paul@212 26
    grep -e "$SETTING" "$CONFIG" | grep '#define'
paul@212 27
done \
paul@212 28
| uniq >> "$PKGDIR/lib/config.h"
paul@212 29
paul@212 30
# vim: tabstop=4 expandtab shiftwidth=4