Make sure that $autoheader is always set. When we would use the plain
[bpt/guile.git] / autogen.sh
1 #!/bin/sh
2 # Usage: sh -x ./autogen.sh [WORKBOOK]
3
4 set -e
5
6 [ -f GUILE-VERSION ] || {
7 echo "autogen.sh: run this command only at the top of guile-core."
8 exit 1
9 }
10
11 ######################################################################
12 ### Find workbook and make symlinks.
13
14 workbook=../workbook # assume "cvs co hack"
15 test x$1 = x || workbook=$1
16 if [ ! -d $workbook ] ; then
17 echo "ERROR: could not find workbook dir"
18 echo " re-run like so: $0 WORKBOOK"
19 exit 1
20 fi
21 : found workbook at $workbook
22 workbook=`(cd $workbook ; pwd)`
23
24 workbookdistfiles="ANON-CVS HACKING SNAPSHOTS"
25 for f in $workbookdistfiles ; do
26 rm -f $f
27 ln -s $workbook/build/dist-files/$f $f
28 done
29 rm -f examples/example.gdbinit
30 ln -s $workbook/build/dist-files/.gdbinit examples/example.gdbinit
31
32 # TODO: This should be moved to dist-guile
33 mscripts=../guile-scripts
34 rm -f BUGS
35 $mscripts/render-bugs > BUGS
36
37 ######################################################################
38
39 # Make sure this matches the ACLOCAL invokation in Makefile.am
40
41 ./guile-aclocal.sh
42
43 ######################################################################
44 ### Libtool setup.
45
46 # Get a clean version.
47 libtoolize --force --copy --automake
48
49 ######################################################################
50
51 ac_version=`autoconf --version | head -1`
52 ac_version=`echo ${ac_version} | sed -e 's/autoconf.* \([0-9].[0-9]\+\)$/\1/'`
53 case "${ac_version}" in
54 (2.5?) autoconf=autoconf; autoheader=autoheader ;;
55 esac
56
57 # configure.in reqs autoconf-2.53; try to find it
58 if test -z "$autoconf"; then
59 for suf in "-2.53" "2.53" "" false; do
60 version=`autoconf$suf --version 2>/dev/null | head -1 | awk '{print $NF}' | awk -F. '{print $1 * 100 + $2}'`
61 if test "0$version" -eq 253; then
62 autoconf=autoconf$suf
63 autoheader=autoheader$suf
64 break
65 fi
66 done
67 fi
68
69 if test -z "$autoconf"; then
70 echo "ERROR: Please install autoconf 2.53"
71 exit 1
72 fi
73 ################################################################
74
75 #detect automake version
76
77
78 # configure.in reqs automake-1.6; try to find it
79 for suf in "-1.6" "1.6" "" false; do
80 version=`automake$suf --version 2>/dev/null | head -1 | awk '{print $NF}' | awk -F. '{print $1 * 10 + $2}'`
81 if test "0$version" -eq 16; then
82 automake=automake$suf
83 break
84 fi
85 done
86
87 if test -z "$automake"; then
88 echo "ERROR: Please install automake 1.6.x"
89 exit 1
90 fi
91
92
93 ################################################################
94 $autoheader
95 $autoconf
96
97 # Automake has a bug that will let it only add one copy of a missing
98 # file. We need two mdate-sh, tho, one in doc/ref/ and one in
99 # doc/tutorial/. We run automake twice as a workaround.
100
101 $automake --add-missing
102 $automake --add-missing
103
104 echo "guile-readline..."
105 (cd guile-readline && ./autogen.sh)
106
107 echo "Now run configure and make."
108 echo "You must pass the \`--enable-maintainer-mode' option to configure."
109
110 # autogen.sh ends here