xref: /netbsd-src/external/bsd/am-utils/dist/m4/autopat (revision a53f50b9b44dc9467ccc9c464999b1d1c509cb0c)
1*a53f50b9Schristos#!/bin/bash -norc
2*a53f50b9Schristos# find patterns of cache entries to automatically remove from config.cache
3*a53f50b9Schristos# Used by am-utils developers.
4*a53f50b9Schristos# Erez Zadok <ezk AT cs.columbia.edu>
5*a53f50b9Schristos#set -x
6*a53f50b9Schristos
7*a53f50b9Schristosmacdir="../m4/macros"
8*a53f50b9Schristos
9*a53f50b9Schristos# find the right directory
10*a53f50b9Schristosif [ ! -d $macdir ]; then
11*a53f50b9Schristos    echo "Could not find $macdir directory."
12*a53f50b9Schristos    exit 2
13*a53f50b9Schristosfi
14*a53f50b9Schristos
15*a53f50b9Schristos# skip if no config.cache file
16*a53f50b9Schristosif [ ! -f config.cache ]; then
17*a53f50b9Schristos    echo "Not in the A.cpu-company-system."
18*a53f50b9Schristos    exit 2
19*a53f50b9Schristosfi
20*a53f50b9Schristos
21*a53f50b9Schristos# look for files that changed vs. config.cache
22*a53f50b9Schristospat=""
23*a53f50b9Schristosfor i in ${macdir}/*.m4; do
24*a53f50b9Schristos    if test $i -nt config.cache; then
25*a53f50b9Schristos	n=`egrep '^ac_cv_' $i |sed 's/[^a-zA-Z0-9_].*//g'|sort|uniq`
26*a53f50b9Schristos	if test -z "$n"; then
27*a53f50b9Schristos	    continue;
28*a53f50b9Schristos	fi
29*a53f50b9Schristos	if test -z "$pat"; then
30*a53f50b9Schristos	    pat="$n"
31*a53f50b9Schristos	else
32*a53f50b9Schristos	    pat="$pat|$n"
33*a53f50b9Schristos	fi
34*a53f50b9Schristos    fi
35*a53f50b9Schristosdone
36*a53f50b9Schristosecho "$pat"
37