Merge branch 'minor'
[automake.git] / t / am-prog-mkdir-p.sh
bloba99dd5aa2e66817139e8db384c1c956c1c9a1fd2
1 #! /bin/sh
2 # Copyright (C) 2012-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 # Check that the AM_PROG_MKDIR_P macro is deprecated, but still works.
18 # We should should also still define $(mkdir_p), for backward
19 # compatibility.
21 . test-init.sh
23 cat >> configure.ac <<'END'
24 AC_CONFIG_FILES([sub/Makefile])
25 AM_PROG_MKDIR_P
26 AC_OUTPUT
27 END
29 cat > Makefile.am << 'END'
30 SUBDIRS = sub
31 all-local:
32 $(MKDIR_P) . dir1/a
33 $(mkdir_p) . dir2/b
34 @MKDIR_P@ . dir3/c
35 @mkdir_p@ . dir4/d
36 check-local: all
37 test -d dir1/a
38 test -d dir2/b
39 test -d dir3/c
40 test -d dir4/d
41 test -d dir5/e
42 test -d dir5/f
43 test -d dir5/g
44 END
46 mkdir sub
47 cat > sub/Makefile.am << 'END'
48 # Even '$(mkdir_p)' should continue to work also in subdir makefiles.
49 all-local:
50 $(MKDIR_P) .. ../dir5/d
51 $(mkdir_p) .. ../dir5/e
52 @MKDIR_P@ .. ../dir5/f
53 @mkdir_p@ .. ../dir5/g
54 END
56 $ACLOCAL
57 $AUTOCONF -Wnone -Wobsolete -Werror 2>stderr && { cat stderr >&2; exit 1; }
58 cat stderr >&2
59 grep "^configure\\.ac:5:.*'AM_PROG_MKDIR_P'.*deprecated" stderr
60 grep "[Aa]utoconf-provided 'AC_PROG_MKDIR_P'.* instead" stderr
61 grep "'\$(MKDIR_P)' instead of '\$(mkdir_p)'" stderr
63 $AUTOCONF -Wno-obsolete
64 $AUTOMAKE
66 ./configure
67 $MAKE check-local
68 $MAKE distcheck
70 # Now try using AC_PROG_MKDIR_P, but keeping the occurrences of
71 # $(mkdir_p) and @mkdir_p@. This is to check against a regression
72 # that hit us with Gettext 0.18.2.
73 $MAKE maintainer-clean
74 rm -rf autom4te*.cache
76 sed 's/AM_PROG_MKDIR/AC_PROG_MKDIR/' configure.ac > t
77 diff configure.ac t && fatal_ "failed to edit configure.ac"
78 mv -f t configure.ac
80 $ACLOCAL 2>stderr \
81 && $AUTOCONF -Wall -Werror 2>>stderr \
82 && test ! -s stderr \
83 || { cat stderr >&2; exit 1; }
85 $AUTOMAKE
86 ./configure
87 $MAKE check-local
88 $MAKE distcheck