#!/bin/sh CPPOPTIONS=-I/usr/include/linuxconf if [ "$1" = "--cppoptions" ] ; then CPPOPTIONS="$2" shift shift fi if [ $# -lt 2 ] ; then echo tlccversion [ --cppoptions \"options\" ] source_file.tlcc ... [ output_file ] echo Extract the version of every TLMP component used by the echo source files exit 1 else CPP=/lib/cpp if [ ! -x $CPP ] ; then CPP=cpp fi TMPFILE=/tmp/version.tmp.$$ rm -f $TMPFILE touch $TMPFILE while [ $# != 0 ] do case $1 in *.tlcc) $CPP -dM -xc++ $CPPOPTIONS $1 >>$TMPFILE 2>/dev/null shift ;; *) break ;; esac done if [ $# = 1 ] ; then grep "define[ ]*_TLMP_" $TMPFILE | sed 's/#define//' | sort | uniq | sed s/_TLMP_// >$1 elif [ $# = 0 ] ; then grep "define[ ]*_TLMP_" $TMPFILE | sed 's/#define//' | sort | uniq | sed s/_TLMP_// else echo error fi rm $TMPFILE fi