2 [ "${0%/*}" = "$0" ] ||
cd "${0%/*}" ||
exit
4 # %reldir%/%canon_reldir% (%D%/%C%) only appeared in automake 1.14, but RHEL/CentOS 7 has 1.13.4
5 # This is an (overly) simplistic preprocessor that papers around this for the duration of the generation step,
6 # and can be removed once support for CentOS 7 is dropped
7 automake
--version |
awk '{print $NF; exit}' |
(
8 IFS
=.
read -r AM_MAJ AM_MIN _
9 [ "$AM_MAJ" -gt 1 ] ||
[ "$AM_MIN" -ge 14 ]
14 grep -q '%[CD]%' "$root/Makefile.am" ||
return
15 find "$root" -name Makefile.am
"$@" |
while read -r dir
; do
16 dir
="${dir%/Makefile.am}"
17 grep -q '%[CD]%' "$dir/Makefile.am" ||
continue
22 canon_reldir
="$(printf '%s' "$reldir" | tr -C 'a-zA-Z0-9@_' '_')"
24 reldir_slash
="$reldir/"
25 canon_reldir_slash
="${canon_reldir}_"
26 [ -z "$reldir" ] && reldir_slash
=
27 [ -z "$reldir" ] && canon_reldir_slash
=
29 echo "$dir/Makefile.am" >&3
30 sed -i~
-e "s:%D%/:$reldir_slash:g" -e "s:%D%:$reldir:g" \
31 -e "s:%C%_:$canon_reldir_slash:g" -e "s:%C%:$canon_reldir:g" "$dir/Makefile.am"
32 done 3>>"$substituted_files"
38 done < "$substituted_files"
39 rm -f "$substituted_files"
43 echo "Automake <1.14; papering over missing %reldir%/%canon_reldir% support" >&2
45 substituted_files
="$(mktemp)"
48 roots
="$(sed '/Makefile$/!d;/module/d;s:^\s*:./:;s:/Makefile::;/^\.$/d' configure.ac)"
52 for root
in $roots; do
58 # shellcheck disable=SC2086,SC2046
59 process_root . $
(printf '!\n-path\n%s/*\n' $roots)
62 autoreconf
-fiv && rm -rf autom4te.cache