• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2test -n "$srcdir" || srcdir=`dirname "$0"`
3test -n "$srcdir" || srcdir=.
4
5patchdir="$srcdir/patches"
6
7# Suppress warnings about obsolete macros if still needed (#122)
8ac_dir=$(aclocal --print-ac-dir)
9if test -r "$ac_dir/ax_create_stdint_h.m4"; then
10    serial=$(awk '/#serial/{ print $2 }' "$ac_dir/ax_create_stdint_h.m4")
11    if test "$serial" -lt 21; then
12	m4_dir=$(cd $srcdir; autoconf -t 'AC_CONFIG_MACRO_DIR:$%')
13	target="$srcdir/$m4_dir/ax_create_stdint_h.m4"
14	echo "Copying file to $target"
15	cp "$ac_dir/ax_create_stdint_h.m4" "$srcdir/$m4_dir"
16	if test "$serial" -lt 20; then
17	    echo "patching file $target to #serial 20"
18	    patch --quiet $target \
19		  "$patchdir/ax_create_stdint_h.19-20.m4.patch"
20	fi
21	echo "patching file $target to #serial 21"
22	patch --quiet "$target" \
23	      "$patchdir/ax_create_stdint_h.20-21.m4.patch"
24    fi
25fi
26
27autoreconf --force --install --verbose --warnings=all "$srcdir"
28patch "$srcdir/ltmain.sh" "$patchdir/ltmain.sh.patch"
29patch "$srcdir/po/Rules-quot" "$patchdir/Rules-quot.patch"
30autoreconf "$srcdir"
31
32# Taken from https://gitlab.com/utsushi/utsushi/blob/master/bootstrap
33#
34# Sanity check the result to catch the most common errors that are
35# not diagnosed by autoreconf itself (or could use some extra help
36# explaining what to do in those cases).
37
38if grep AX_CXX_COMPILE_STDCXX "$srcdir/configure" >/dev/null 2>&1; then
39    cat <<EOF
40It seems 'aclocal' could not find the autoconf macros used to check
41for C++ standard's compliance.
42
43These macros are available in the 'autoconf-archive'.  If you have
44this archive installed, it is probably installed in a location that
45is not searched by default.  In that case, please note this via:
46
47  `autoconf -t AC_INIT:'$3'`
48
49If you haven't installed the 'autoconf-archive', please do so and
50rerun:
51
52  $0 $*
53
54If the 'autoconf-archive' is not packaged for your operating system,
55you can find the sources at:
56
57  http://www.gnu.org/software/autoconf-archive/
58
59EOF
60    exit 1
61fi
62