* bootstrap (AUTORECONF): New variable to allow user overriding of
[m4/ericb.git] / bootstrap
blobae06b647231d53e32ce7aecaeb4f31858d9d2886
1 #! /bin/sh
3 # helps bootstrapping M4, when checked out from CVS
4 # requires GNU Autoconf, GNU Automake, GNU Gettext and GNU Libtool
6 : ${AWK=awk}
7 : ${SED=sed}
8 : ${RM=rm -f}
9 : ${GNULIB_TOOL=gnulib-tool}
10 : ${AUTORECONF=autoreconf}
12 ltdldir=ltdl
13 config_aux_dir=$ltdldir/config
14 config_macro_dir=$ltdldir/m4
16 # List dependencies here too; we don't extract them, otherwise dependent
17 # modules could end up being imported to src/ *and* gnu/!
18 src_modules='getopt version-etc-fsf version-etc'
20 dirname="s,/[^/]*$,,"
21 basename="s,^.*/,,g"
23 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
24 # is ksh but when the shell is invoked as "sh" and the current value of
25 # the _XPG environment variable is not equal to 1 (one), the special
26 # positional parameter $0, within a function call, is the name of the
27 # function.
28 progpath="$0"
30 # The name of this program:
31 progname=`echo "$progpath" | $SED "$basename"`
33 # func_echo arg...
34 # Echo program name prefixed message.
35 func_echo ()
37 echo $progname: ${1+"$@"}
40 func_echo "running: ${GNULIB_TOOL} --import"
41 ${GNULIB_TOOL} --import
43 func_echo "patching include directories in gnulib regex module"
44 mv $config_macro_dir/regex.m4 $config_macro_dir/regex-m4.old
45 sed 's,lib/regex.c,gnu/regex.c,g' $config_macro_dir/regex-m4.old > $config_macro_dir/regex.m4 && \
46 $RM $config_macro_dir/regex-m4.old
48 func_echo "hiding gnulib jm_\* macros"
49 cat >> $config_macro_dir/gnulib.m4 <<\EOF
50 AC_DEFUN([gl_AC_HEADER_INTTYPES_H], [jm_AC_HEADER_INTTYPES_H])
51 AC_DEFUN([gl_AC_HEADER_STDINT_H], [jm_AC_HEADER_STDINT_H])
52 AC_DEFUN([gl_AC_TYPE_UINTMAX_T], [jm_AC_TYPE_UINTMAX_T])
53 EOF
55 func_echo "fetching modules for src directory"
56 gnulibdir=`which gnulib-tool | $SED "$dirname"`
58 for file in `${GNULIB_TOOL} --extract-filelist $src_modules`; do
60 dest=`echo $file | $SED "$basename"`
61 case $file in
62 lib/*) dest=src/$dest ;;
63 m4/*) dest=$config_macro_dir/$dest ;;
64 *) func_echo "Unknown file: $file"
65 exit 1
67 esac
69 func_echo "copying file \`$dest'"
70 cp $gnulibdir/$file $dest
71 done
73 func_echo "running: libtoolize --ltdl=\"$ltdldir\" --force --copy"
74 libtoolize --ltdl="$ltdldir" --force --copy
76 func_echo "running: $AUTORECONF --force --verbose --install"
77 $AUTORECONF --force --verbose --install
80 func_echo "generating testsuite"
81 cd tests
82 $AWK -f ./generate.awk ../doc/m4.texinfo > generated.at
85 exit 0