2002-07-20 Han-Wen <hanwen@cs.uu.nl>
[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 rm -rf libltdl
48 libtoolize --force --copy --automake --ltdl
49
50 # Fix older versions of libtool.
51 # Make sure we use a ./configure.in compatible autoconf in ./libltdl/
52 if [ -f libltdl/configure.in ]; then
53 mv libltdl/configure.in libltdl/configure.tmp
54 echo 'AC_PREREQ(2.50)' > libltdl/configure.in
55 cat libltdl/configure.tmp >> libltdl/configure.in
56 rm libltdl/configure.tmp
57 fi
58
59 # Maybe patch ltdl.c. This is only needed for 1.4.2 and earlier.
60 if patch libltdl/ltdl.c <<EOP
61 --- ltdl.c~ Fri Apr 12 18:52:48 2002
62 +++ ltdl.c Tue Jul 9 14:12:47 2002
63 @@ -2246,15 +2246,15 @@
64 static int
65 find_handle_callback (filename, data, ignored)
66 char *filename;
67 lt_ptr data;
68 lt_ptr ignored;
69 {
70 lt_dlhandle *handle = (lt_dlhandle *) data;
71 - int found = access (filename, R_OK);
72 + int found = !access (filename, F_OK);
73
74 /* Bail out if file cannot be read... */
75 if (!found)
76 return 0;
77
78 /* Try to dlopen the file, but do not continue searching in any
79 case. */
80 EOP
81 then true
82 else
83 echo "WARNING: could not patch libltdl, but this is probably OK."
84 fi
85
86 ######################################################################
87
88
89 # configure.in reqs autoconf-2.53; try to find it
90 for suf in "-2.53" "2.53" "" false; do
91 version=`autoconf$suf --version 2>/dev/null | head -1 | awk '{print $NF}' | awk -F. '{print $1 * 100 + $2}'`
92 if test "0$version" -eq 253; then
93 autoconf=autoconf$suf
94 autoheader=autoheader$suf
95 break
96 fi
97 done
98
99 if test -z "$autoconf"; then
100 echo "ERROR: Please install autoconf 2.53"
101 exit 1
102 fi
103
104
105 ################################################################
106 $autoheader
107 $autoconf
108
109 # Automake has a bug that will let it only add one copy of a missing
110 # file. We need two mdate-sh, tho, one in doc/ref/ and one in
111 # doc/tutorial/. We run automake twice as a workaround.
112
113 automake --add-missing
114 automake --add-missing
115
116 # Make sure that libltdl uses the same autoconf version as the rest.
117 #
118 echo "libltdl..."
119 (cd libltdl && aclocal)
120 (cd libltdl && autoconf)
121 (cd libltdl && automake --gnu --add-missing)
122
123 echo "guile-readline..."
124 (cd guile-readline && ./autogen.sh)
125
126 echo "Now run configure and make."
127 echo "You must pass the \`--enable-maintainer-mode' option to configure."
128
129 # autogen.sh ends here