test harness: improve catching of usage errors in script 'test-driver'
[platform/upstream/automake.git] / t / mkdir_p.sh
1 #! /bin/sh
2 # Copyright (C) 2012-2013 Free Software Foundation, Inc.
3 #
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.
8 #
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.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 # AM_INIT_AUTOMAKE should still define $(mkdir_p), for backward
18 # compatibility.
19
20 . test-init.sh
21
22 cat >> configure.ac << 'END'
23 AC_CONFIG_FILES([sub/Makefile])
24 AC_OUTPUT
25 END
26
27 cat > Makefile.am << 'END'
28 SUBDIRS = sub
29 all-local:
30         $(mkdir_p) . dir1/a
31         @mkdir_p@ . dir2/b
32 check-local: all
33         test -d dir1/a
34         test -d dir2/b
35         test -d dir3/c
36         test -d dir3/d
37 END
38
39 mkdir sub
40 cat > sub/Makefile.am << 'END'
41 # '$(mkdir_p)' should continue to work even in subdir makefiles.
42 all-local:
43         $(mkdir_p) .. ../dir3/c
44         @mkdir_p@ .. ../dir3/d
45 END
46
47 $ACLOCAL
48 $AUTOCONF -Werror -Wall
49 $AUTOMAKE
50
51 ./configure
52 $MAKE check-local
53 $MAKE distcheck
54
55 :