#! /bin/sh

# Set TSD by removing last slash and all that follows $0
TSD=`echo $0 | sed 's%/[^/][^/]*$%%'`
# Set TSD to be the absolute pathname to the top_srcdir
if [ "$TSD" = "$0" -o "X$TSD" = "X." ] ; then
    TSD=`pwd`
fi

configs=`find $TSD -name configure -print | sort`

prefix=""
for config in $configs ; do
    suffix=`echo $config | sed -e 's%\(.*\)/\([^/]*\)/configure$%\2%'`
    if [ "x$prefix" = "x" ] ; then
        prefix="$suffix/"
        echo "****** Configure Options available in Main-Package: $prefix"
    else
        echo "****** Configure Options available in Sub-Package: $prefix$suffix"
    fi
    $config --help > tmpconfig.txt
#   Print from line 44 till the end from the output of `configure --help`
    sed -n '44,$p' tmpconfig.txt
    rm -f tmpconfig.txt
    echo ; echo
done
