summaryrefslogtreecommitdiffstats
path: root/src/util/reconf
blob: 197db278d5e8aeb618a54a3c1516ad71c77b40f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/sh

force=
autoreconfprog=./util/autoconf/autoreconf
localdir=.
autoreconfoptions="-m util/autoconf"
verbose=false

autoreconf="/bin/sh $autoreconfprog"

usage="Usage: $0 [--force] [--verbose] [--help]"
for option
do
  case "$option" in
  --force | -f)
    echo "Remaking all configuration files"
    force=--force ;;
  -help | --help | --hel | --he | --h)
    echo "$usage"; exit 0 ;;
  -v | --verbose)
    verbose=true ;;
  *) echo "$usage"; exit 1 ;;
  esac
done

# Currently (2000-10-03) we need 2.12 or later, and 2.13 is current.
# Thie pattern also recognizes 2.40 and up.
patb="2.(1[2-9])|([4-9][0-9])"

# sedcmd1 recognizes the older 2.12 version, and sedcmd2 the newer 2.49
sedcmd1="s,.*version \(.*\)$,\1,"
sedcmd2="s,.*) \(.*\)$,\1,;1q"

if test ! -f $autoreconfprog ; then
	if autoreconf --version | sed -e "$sedcmd1" -e "$sedcmd2" | egrep "$patb" >/dev/null && \
	   autoconf --version  | sed -e "$sedcmd1" -e "$sedcmd2"  | egrep "$patb" >/dev/null && \
	   autoheader --version | sed -e "$sedcmd1" -e "$sedcmd2" | egrep "$patb" >/dev/null; then
		autoreconf=autoreconf
		autoreconfoptions=
		autoconfversion=`autoconf --version | sed -e "$sedcmd1" -e "$sedcmd2"`
		echo "Using autoconf version $autoconfversion found in your path..."
		# Determine if localdir needs to be relative or absolute
		case "$autoconfversion" in
		  2.1*)
		       localdir=.
		       ;;
		     *)
		       localdir=`pwd`
		       ;;
		esac
	else
		echo "Couldn't find autoconf 2.12 or higher in your path."
		echo " "
		echo "Please cd to util/autoconf, and type the commands"
		echo "'configure' and then 'make'; then cd back to the top"
		echo "of the source tree and re-run ./util/reconf"
		exit 1
	fi
fi

if $verbose ; then 
	echo $autoreconf $autoreconfoptions -l $localdir --verbose $force 
fi
$autoreconf $autoreconfoptions  -l $localdir --verbose $force