2 # Copyright (C) 2011 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)
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 <http://www.gnu.org/licenses/>.
17 # Not all primaries/directories combinations are valid.
18 # Automake should flag them as errors.
19 # Originated from PR/294, extended later (following bug #7647) to
21 # See also test `primary-prefix-valid-couples.test'.
27 oIFS=$IFS # Saved for later.
36 cat >> configure.in <<'END'
39 AC_SUBST([LIBTOOL], [:]) dnl So that we don't have to require Libtool.
47 # Please keep this list in sync with the list of "Directory Variables"
48 # in the GNU Coding Standards and with the list additional directory
49 # variables provided by autoconf and/or automake (pkgdatadir, pkglibdir,
50 # ...). See also the hash `%standard_prefix' in the automake script.
51 prefixes='bin data dataroot doc dvi exec html include info lib libexec
52 lisp locale localstate man man1 man2 man3 man4 man5 man6 man7
53 man8 man9 oldinclude pdf pkgdata pkginclude pkglib pkglibexec
54 ps sbin sharedstate sysconf'
55 # Please keep this list in sync with the list of primaries documented in
56 # the Automake manual (see the "The Uniform Naming Scheme" section).
57 primaries='PROGRAMS LIBRARIES LTLIBRARIES LISP PYTHON JAVA SCRIPTS DATA
58 HEADERS MANS TEXINFOS'
60 # Use files, not variables, to hold the list of all the possible
61 # prefix_PRIMARY couples and the list of those couples valid for
62 # automake, to avoid having unreadable very verbose traces.
64 set +x # Don't be overly verbose.
66 for prefix in $prefixes; do
67 for primary in $primaries; do
68 echo ${prefix} ${primary}
72 for primary in $primaries; do
75 LIBRARIES|LTLIBRARIES)
76 prefixes_ok='lib pkglib'
79 prefixes_ok='bin sbin libexec pkglibexec'
82 prefixes_ok='bin sbin libexec pkglibexec pkgdata'
85 prefixes_ok='data dataroot pkgdata doc html dvi pdf ps
86 sysconf sharedstate localstate lisp'
89 prefixes_ok='include oldinclude pkginclude'
101 # FIXME: Here we'd like to have:
102 # prefixes_ok='man man1 man2 man3 man4 man5 man6 man7 man8 man9'
103 # but Automake currently fails on that, as it allows the MANS
104 # primary to be coupled to any prefix.
105 # See also Automake bug#7656.
106 # We should dig out how automake had come to behave this way, and
107 # if such a behaviour can be safely changed.
108 prefixes_ok=$prefixes
111 # FIXME: Here we'd like to have:
113 # but Automake currently fails on that, as it allows the use of
114 # `foo_TEXINFOS' to declare extra Texinfo sources for the `foo'
115 # Texinfo manual, as in e.g.:
116 # info_TEXINFOS = foo.texi
117 # foo_TEXINFOS = gpl.texi
118 # See also Automake bug#7657.
119 prefixes_ok=$prefixes
122 fatal_ "unrecognized primary '$primary'"
125 for prefix in $prefixes_ok; do
126 echo ${prefix}_${primary}
130 # `html_TEXINFOS' is not yet supported, and might never be.
131 grep -v '^html TEXINFOS$' all.list | awk '{print NR, $0}' > t
135 echo '=== all.list ==='
137 echo '=== allow.list ==='
140 # Create the Makefile.am.
141 while read lineno prefix primary; do
142 test -n "$prefix" && test -n "$primary" && test 0 -lt $lineno \
143 || fatal_ "internal error in 'all.list'"
146 LTLIBRARIES) pfx=lib ext=la;;
147 LIBRARIES) pfx=lib ext=a;;
155 test -z "$ext" || ext=.$ext
156 if test $primary = TEXINFOS; then
157 echo @setfilename foo$lineno.info > foo$lineno.texi
159 echo ${prefix}_${primary} = ${pfx}foo${lineno}${ext}
160 done <all.list >Makefile.am
163 echo '=== Makefile.am ==='
166 set -x # Restore shell xtraces from now on.
170 while read lineno prefix primary; do
171 test -n "$prefix" && test -n "$primary" && test 0 -lt $lineno \
172 || fatal_ "internal error in 'all.list'"
173 grep "^${prefix}_${primary}$" allow.list >/dev/null && continue
174 errmsg_rx=".*${prefix}dir.* not a legitimate directory .*$primary"
175 grep "^Makefile\\.am:$lineno: $errmsg_rx" stderr || Exit 1
178 # Check that automake really failed only for the expected reason(s).
179 grep -v 'dir.* not a legitimate directory' stderr && Exit 1
181 # Check that the same failures are present without the `--add-missing'
185 diff stderr.old stderr