1 dnl Copyright © 2012, 2021 Nick Bowler
3 dnl Definitions to help maintain compatibility with multiple Automake versions.
5 dnl License WTFPL2: Do What The Fuck You Want To Public License, version 2.
6 dnl This is free software: you are free to do what the fuck you want to.
7 dnl There is NO WARRANTY, to the extent permitted by law.
11 dnl Provides definitions to help maintain compatibility with older versions of
12 dnl Automake. Currently, this means:
14 dnl - AM_V and AM_DEFAULT_V (new in Automake 1.12) are defined and AC_SUBSTed
15 dnl if Automake did not already, in a manner compatible with silent-rules
16 dnl support from previous versions.
18 dnl - A make variable DX_ALIGN_V is defined which contain printf alignment
19 dnl flags for silent-rules output, since the alignment changed between
20 dnl Automake 1.11 and 1.12. It is intended to be used like this:
22 dnl MYGEN_V = $(MYGEN_V@AM_V@)
23 dnl MYGEN_V_ = $(MYGEN_V_@AM_DEFAULT_V)
24 dnl MYGEN_V_0 = @printf ' %$(DX_ALIGN_V)s %s\n' 'MYGEN ' $@
26 dnl The spacing after MYGEN should be defined so that the silent-rules
27 dnl alignment is correct for the latest version of Automake if DX_ALIGN_V
28 dnl is empty (that way, this definition provides only backwards
29 dnl compatibility). However, it is irrelevant when DX_ALIGN_V is defined
30 dnl by this macro, as the spacing will always be correct. This feature
31 dnl maintains alignment by truncating the argument, so it will only work
32 dnl properly if your string can actually be aligned in all versions of
33 dnl Automake being targeted (this means you are limited to 6 characters
34 dnl in Automake 1.11).
36 AC_DEFUN_ONCE([DX_AUTOMAKE_COMPAT], [dnl
39 AC_CONFIG_COMMANDS_PRE([dnl
40 AS_VAR_SET_IF([AM_V], [], [AC_SUBST([AM_V], ['$(V)'])])
41 AS_VAR_SET_IF([AM_DEFAULT_V], [],
42 [AC_SUBST([AM_DEFAULT_V], ['$(AM_DEFAULT_VERBOSITY)'])])])
44 # This will only work if there is a Makefile.in generated at the top srcdir.
45 AC_CACHE_CHECK([for alignment of silent-rules output], [dx_cv_align_v], [dnl
46 cat >conftest.sed <<'EOF'
48 s/@<:@^"@:>@*" \(GEN *\).*/\1/
53 if sed -nf conftest.sed "$srcdir/Makefile.in" >conftest.out 2>/dev/null; then
54 read dx_genline <conftest.out
55 dx_cv_align_v=`expr "$dx_genline" : '.*'`
56 test $dx_cv_align_v -eq 0 && dx_cv_align_v=unknown
58 : "${dx_cv_align_v:=unknown}"
62 AS_IF([test x"$dx_cv_align_v" != x"unknown"],
63 [AC_SUBST([DX_ALIGN_V], [-$dx_cv_align_v.$dx_cv_align_v])])
65 AC_CACHE_CHECK([for depfiles generation method], [dx_cv_am_depfiles],
66 [AS_IF([grep '^am--depfiles:' "$srcdir/Makefile.in" >/dev/null ||
67 grep '[[$]](am__maybe_remake_depfiles)' "$srcdir/Makefile.in" >/dev/null],
68 [dx_cv_am_depfiles='make am--depfiles'],
69 [dx_cv_am_depfiles='config.status'])])
70 AS_CASE([$dx_cv_am_depfiles],
71 ['make am--depfiles'], [dx_include_marker=' @%:@ am--include-marker'],
72 [dx_include_marker=''])
73 AC_SUBST([dx_depfiles_target], [am--depfiles])
74 AC_SUBST([dx_include_marker])
75 AM_SUBST_NOTMAKE([dx_depfiles_target])
76 AM_SUBST_NOTMAKE([dx_include_marker])