1#! /bin/sh
2#
3# Reconfigure for a release, by updating the Makefile dependencies and
4# running the autotools.
5#
6# $Id: reconf,v 1.3 2004/04/23 10:06:17 quozl Exp $
7
8# make the existing config.h disappear temporarily
9if test -f config.h
10then
11  mv -f config.h config.h.TMP
12fi
13touch config.h
14
15# rebuild dependencies (makedepend)
16for makefile in Makefile.am Makefile.uClinux
17do
18  echo -n "Rebuilding $makefile..."
19  head -`grep -n 'DO NOT ADD BELOW THIS POINT' $makefile | \
20	cut -d: -f1` $makefile > $makefile.new
21  for file in *.c
22  do
23    if test "$makefile" = "Makefile.uClinux"
24    then
25      gcc -MM $file -include config.embed.h
26    else
27      gcc -MM $file -DHAVE_CONFIG_H
28    fi
29    echo ''
30  done >> $makefile.new
31  echo 'done.'
32  if ! cmp -s $makefile.new $makefile
33  then
34    echo "Changes: <=old >=new"
35    diff $makefile $makefile.new | grep '^[<>]'
36    mv -f $makefile.new $makefile
37  else
38    rm -f $makefile.new
39    echo "No change."
40  fi
41done
42
43# restore the previous config.h
44rm -f config.h
45if test -f config.h.TMP
46then
47  mv -f config.h.TMP config.h
48fi
49
50# show us what we do next
51set -x
52
53# reset the configuration
54rm -f config.cache
55rm -f config.log
56
57# run the build tools sequence
58aclocal
59autoconf
60automake -a --copy --verbose
61autoheader
62