summaryrefslogtreecommitdiff
path: root/build_posix/reconf
blob: 4087c41bf259001575cf448e6bbd075da2181e49 (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
#! /bin/sh

t=/tmp/__configure.$$
trap 'rm -f $t; exit 0' 0 1 2 3 13 15

# Insulate against IFS from the user's env
IFS=' ''	''
'
export IFS

# Allow this script to be run from anywhere
cd "`dirname \"$0\"`"

# There's a cleanup function so we can easily clean out the directory.
clean()
{
	test -f Makefile && make distclean > /dev/null
	rm -rf ../Makefile.am ../Makefile.in ../aclocal.m4 ../autom4te.cache \
	    ../config.hin ../config.hin~ ../configure gnu-support mklog
}

while :
	do case "$1" in
	-c)
		clean			# Clean and leave empty
		exit 0;;
	*)
		clean			# Clean and then re-create
		break;;
	esac
done

# Build configure.ac
(
echo "# DO NOT EDIT"
echo "# This file is built automatically from build_posix/configure.ac.in."

sed -n '1,/BEGIN check existence/p' configure.ac.in

sed -e 's/#.*$//' -e '/^$/d' Make.subdirs | while read dir cond ; do
	test -d ../$dir || continue
	echo 'AC_CONFIG_FILES(['$dir/Makefile'])'
done

sed -n '/END check existence/,$p' configure.ac.in
) > ../configure.ac

# Build Makefile.am
sh ./makemake

# From here on, work in the top of the tree
cd ..
autoreconf --install --warnings=all

# Make sure any missing files are writable
chmod 755 build_posix/gnu-support/*

# Cleanup
rm -rf autom4te.cache

exit 0