Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / dist-auxfile.test
1 #! /bin/sh
2 # Copyright (C) 2011 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 # Files specified by AC_REQUIRE_AUX_FILE must exist, and they get
18 # automatically distributed by the top-level Makefile.am.
19 # Automake bug#9651 reported that this didn't happen when the build-aux
20 # directory was set to `.' by AC_CONFIG_AUX_DIR.
21
22 am_create_testdir=empty
23 . ./defs || Exit 1
24
25 set -e
26
27 i=0
28 for auxdir in build-aux ''; do
29
30   echo "*** Testing with auxdir '$auxdir' ***"
31
32   i=`expr $i + 1`
33   mkdir T$i.d
34   cd T$i.d
35
36   unindent > configure.in <<END
37     AC_INIT([$me], [1.0])
38     AC_CONFIG_AUX_DIR([${auxdir:-.}])
39     AM_INIT_AUTOMAKE
40     AC_REQUIRE_AUX_FILE([foo.txt])
41     AC_REQUIRE_AUX_FILE([bar.sh])
42     AC_REQUIRE_AUX_FILE([zardoz])
43     AC_CONFIG_FILES([Makefile subdir/Makefile])
44     AC_OUTPUT
45 END
46
47   echo auxdir = ${auxdir:+"$auxdir/"} > Makefile.am
48   unindent >> Makefile.am <<'END'
49     SUBDIRS = subdir
50     test: distdir
51         ls -l $(distdir) $(distdir)/*      ;: For debugging.
52         @echo DIST_COMMON = $(DIST_COMMON) ;: Likewise.
53         echo ' ' $(DIST_COMMON) ' ' | grep '[ /]$(auxdir)foo.txt '
54         echo ' ' $(DIST_COMMON) ' ' | grep '[ /]$(auxdir)bar.sh '
55         echo ' ' $(DIST_COMMON) ' ' | grep '[ /]$(auxdir)zardoz '
56         test -f $(distdir)/$(auxdir)foo.txt
57         test -f $(distdir)/$(auxdir)bar.sh
58         test -f $(distdir)/$(auxdir)zardoz
59     .PHONY: test
60     check-local: test
61 END
62
63   mkdir subdir
64   : > subdir/Makefile.am
65   
66   test -z "$auxdir" || mkdir "$auxdir" || Exit 99
67
68   if test -z "$auxdir"; then
69     auxdir=.
70     auxdir_rx='\.'
71   else
72     auxdir_rx=$auxdir
73   fi
74
75   $ACLOCAL
76   $AUTOCONF
77
78   AUTOMAKE_fails
79   grep "^configure\\.in:4:.* required file.*$auxdir_rx/foo\\.txt" stderr
80   grep "^configure\\.in:5:.* required file.*$auxdir_rx/bar\\.sh"  stderr
81   grep "^configure\\.in:6:.* required file.*$auxdir_rx/zardoz"    stderr
82
83   touch $auxdir/foo.txt $auxdir/bar.sh $auxdir/zardoz
84   cp "$testsrcdir"/../lib/missing "$testsrcdir"/../lib/install-sh $auxdir
85   $AUTOMAKE
86   ./configure
87   $MAKE test
88   $EGREP '(foo\.txt|bar\.sh|zardoz)' subdir/Makefile.in && Exit 1
89
90   $MAKE distcheck
91
92   cd ..
93
94 done
95
96 :