#!/bin/bash -norc
# find patterns of cache entries to automatically remove from config.cache
# Used by am-utils developers.
# Erez Zadok <ezk AT cs.columbia.edu>
#set -x

macdir="../m4/macros"

# find the right directory
if [ ! -d $macdir ]; then
    echo "Could not find $macdir directory."
    exit 2
fi

# skip if no config.cache file
if [ ! -f config.cache ]; then
    echo "Not in the A.cpu-company-system."
    exit 2
fi

# look for files that changed vs. config.cache
pat=""
for i in ${macdir}/*.m4; do
    if test $i -nt config.cache; then
	n=`egrep '^ac_cv_' $i |sed 's/[^a-zA-Z0-9_].*//g'|sort|uniq`
	if test -z "$n"; then
	    continue;
	fi
	if test -z "$pat"; then
	    pat="$n"
	else
	    pat="$pat|$n"
	fi
    fi
done
echo "$pat"
