summaryrefslogtreecommitdiff
path: root/build_posix/reconf
blob: 16d4002d9b9b8c7d7e0bd46dcbbc760dc7c1a1fd (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#! /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()
{
	# Use the Makefile to remove object files if they exist.
	test -f Makefile && make distclean > /dev/null

	# Remove automatically generated files.
	rm -rf	Makefile \
		Makefile.am \
		Makefile.in \
		aclocal.m4 \
		auto-includes.chk \
		autom4te.cache \
		config.cache \
		config.hin \
		config.hin~ \
		config.log \
		config.status \
		configure \
		gnu-support \
		mklog
}

# We always clean things up, assume build_posix and the top-level directory
# are the build spots.
(cd .. && clean)
clean

while :
	do case "$1" in
	-c)				# Clean and leave empty
		exit 0;;
	*)				# 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' -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