maint: Update HACKING
[automake.git] / t / aclocal-path-install-serial.sh
blob5ebcb1b5880e76a19f4a68772ed9f600097f6835
1 #! /bin/sh
2 # Copyright (C) 2011-2017 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
7 # any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <https://www.gnu.org/licenses/>.
17 # ACLOCAL_PATH, acdir and '--install' interactions when serial number
18 # are involved.
20 am_create_testdir=empty
21 . test-init.sh
23 cat > configure.ac << 'END'
24 AC_INIT
25 AM_FOO
26 END
28 set_serial ()
30 serial=$1 file=$2
31 sed '/^# serial/d' $file > t
32 case $serial in
33 none) mv -f t $file;;
34 *) (echo "# serial $serial" && cat t) > $file; rm -f t;;
35 esac
36 cat $file # For debugging.
39 win ()
41 case $1 in
42 sdir) ok=sdir ko=pdir;;
43 pdir) ok=pdir ko=sdir;;
44 *) fatal_ "win(): invalid argument '$1'";;
45 esac
46 # This is required on fast machine, to avoid caching and timestamp
47 # issues with the autotools (already happened in practice).
48 rm -rf configure aclocal.m4 autom4te*.cache m4/*
49 $ACLOCAL -I m4 --install
50 test -f m4/foo.m4 # Sanity check.
51 $AUTOCONF
52 $FGREP "::$ok:" m4/foo.m4
53 $FGREP "::$ok::" configure
54 $FGREP "::$ko::" m4/foo.m4 configure && exit 1
58 mkdir sdir pdir m4
60 ACLOCAL="$ACLOCAL --system-acdir=$(pwd)/sdir"
61 ACLOCAL_PATH=./pdir; export ACLOCAL_PATH
63 cat > sdir/foo.m4 << 'END'
64 AC_DEFUN([AM_FOO], [::sdir::])
65 END
66 cat > pdir/foo.m4 << 'END'
67 AC_DEFUN([AM_FOO], [::pdir::])
68 END
70 set_serial 2 sdir/foo.m4
71 set_serial 1 pdir/foo.m4
72 win sdir
74 set_serial 3.3 sdir/foo.m4
75 set_serial 5.7 pdir/foo.m4
76 win pdir
78 set_serial 0 sdir/foo.m4
79 set_serial none pdir/foo.m4
80 win sdir
82 set_serial none sdir/foo.m4
83 set_serial 1.2.3 pdir/foo.m4
84 win pdir