From: Stefano Lattarini Date: Mon, 21 May 2012 21:27:55 +0000 (+0200) Subject: [ng] refactor: make '$am_config_aux_dir' available as a make variable X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a16c3c08bdc2d26f64ee513c0796b75b50b1a4e;p=thirdparty%2Fautomake.git [ng] refactor: make '$am_config_aux_dir' available as a make variable This API improvement will become useful in future changes. * automake.in (generate_makefile): Define an internal make variable '$(am__config_aux_dir)', holding value '$am_config_aux_dir' computed at Automake time. (All users): Adjusted. * t/distcom2.sh: Adjust. * t/distcom-subdir.sh: Likewise. * t/yacc-auxdir.sh: Likewise. * t/auxdir.sh: Adjust and simplify. * t/auxdir6.sh: Likewise. * t/auxdir7.sh: Likewise. * t/auxdir8.sh: Likewise. Signed-off-by: Stefano Lattarini --- diff --git a/automake.in b/automake.in index 6b4954382..ff9bb54c1 100644 --- a/automake.in +++ b/automake.in @@ -1322,7 +1322,7 @@ sub handle_languages { # Set location of depcomp. &define_variable ('depcomp', - "\$(SHELL) $am_config_aux_dir/depcomp", + '$(SHELL) $(am__config_aux_dir)/depcomp', INTERNAL); require_conf_file ("$am_file.am", FOREIGN, 'depcomp'); @@ -3258,7 +3258,7 @@ sub handle_texinfo_helper ($) my $conf_dir; if ($config_aux_dir_set_in_configure_ac) { - $conf_dir = "$am_config_aux_dir/"; + $conf_dir = '$(am__config_aux_dir)/'; } else { @@ -3287,7 +3287,7 @@ sub handle_texinfo_helper ($) } elsif ($config_aux_dir_set_in_configure_ac) { - $texinfodir = $am_config_aux_dir; + $texinfodir = '$(am__config_aux_dir)'; define_variable ('TEXINFO_TEX', "$texinfodir/texinfo.tex", INTERNAL); $need_texi_file = 2; # so that we require_conf_file later } @@ -4586,7 +4586,7 @@ sub handle_per_suffix_test($) { require_conf_file ("parallel-tests", FOREIGN, 'test-driver'); define_variable ("${pfx}LOG_DRIVER", - "\$(SHELL) $am_config_aux_dir/test-driver", + '$(SHELL) $(am__config_aux_dir)/test-driver', INTERNAL); } # Required to avoid spurious errors like: @@ -4699,7 +4699,7 @@ sub handle_emacs_lisp require_variables ($elfiles[0][0], "Emacs Lisp sources seen", TRUE, 'EMACS', 'lispdir'); require_conf_file ($elfiles[0][0], FOREIGN, 'elisp-comp'); - &define_variable ('elisp_comp', "$am_config_aux_dir/elisp-comp", INTERNAL); + &define_variable ('elisp_comp', '$(am__config_aux_dir)/elisp-comp', INTERNAL); } # Handle Python @@ -4711,7 +4711,7 @@ sub handle_python require_variables ($pyfiles[0][0], "Python sources seen", TRUE, 'PYTHON'); require_conf_file ($pyfiles[0][0], FOREIGN, 'py-compile'); - &define_variable ('py_compile', "$am_config_aux_dir/py-compile", INTERNAL); + &define_variable ('py_compile', '$(am__config_aux_dir)/py-compile', INTERNAL); } # Handle Java. @@ -5699,7 +5699,7 @@ sub yacc_lex_finish_helper # FIXME: for now, no line number. require_conf_file ($configure_ac, FOREIGN, 'ylwrap'); - &define_variable ('YLWRAP', "$am_config_aux_dir/ylwrap", INTERNAL); + &define_variable ('YLWRAP', '$(am__config_aux_dir)/ylwrap', INTERNAL); } sub lang_yacc_finish @@ -7320,7 +7320,7 @@ sub push_required_file # of $am_config_aux_dir here is deliberate and necessary. elsif ($dir eq $config_aux_dir) { - push_dist_common ("$am_config_aux_dir/$file"); + push_dist_common ('$(am__config_aux_dir)/' . $file); } # FIXME: another spacial case, for AC_LIBOBJ/AC_LIBSOURCE support. # We probably need some refactoring of this function and its callers, @@ -7766,6 +7766,7 @@ sub generate_makefile ($$) # Must do this after reading .am file. define_variable ('subdir', $relative_dir, INTERNAL); + define_variable ('am__config_aux_dir', $am_config_aux_dir, INTERNAL); # If DIST_SUBDIRS is defined, make sure SUBDIRS is, so that # recursive rules are enabled. diff --git a/t/auxdir.sh b/t/auxdir.sh index f2abfd787..be113d9cd 100755 --- a/t/auxdir.sh +++ b/t/auxdir.sh @@ -24,20 +24,15 @@ AC_INIT([$me], [1.0]) AC_CONFIG_AUX_DIR([./.]) AM_INIT_AUTOMAKE AC_CONFIG_FILES([Makefile]) -AM_PATH_PYTHON END -cat > Makefile.am << 'END' -python_PYTHON = foo.py -END - -cp "$am_scriptdir/py-compile" . +: > Makefile.am # The "././" prefix confuses Automake into thinking it is doing a # subdir build. Yes, this is hacky. $ACLOCAL $AUTOMAKE ././Makefile -grep '/\./\./py-compile' Makefile.in +grep '^am__config_aux_dir = \$(top_srcdir)/\./\.$' Makefile.in : diff --git a/t/auxdir6.sh b/t/auxdir6.sh index a6d68fdda..57f4d95b0 100755 --- a/t/auxdir6.sh +++ b/t/auxdir6.sh @@ -27,25 +27,19 @@ AC_INIT([$me], [1.0]) AC_CONFIG_AUX_DIR([auxdir]) AM_INIT_AUTOMAKE AC_CONFIG_FILES([Makefile subdir/Makefile]) -AM_PATH_PYTHON END mkdir subdir auxdir -cat > Makefile.am << 'END' -python_PYTHON = foo.py -END - -cp Makefile.am subdir/Makefile.am - +: > Makefile.am +: > subdir/Makefile.am : > auxdir/install-sh : > auxdir/missing -: > auxdir/py-compile $ACLOCAL $AUTOMAKE -$FGREP '$(top_srcdir)/auxdir/py-compile' Makefile.in -$FGREP '$(top_srcdir)/auxdir/py-compile' subdir/Makefile.in +grep '^am__config_aux_dir = \$(top_srcdir)/auxdir$' Makefile.in +grep '^am__config_aux_dir = \$(top_srcdir)/auxdir$' subdir/Makefile.in : diff --git a/t/auxdir7.sh b/t/auxdir7.sh index bdf571efb..6eba0795b 100755 --- a/t/auxdir7.sh +++ b/t/auxdir7.sh @@ -26,23 +26,17 @@ AC_INIT([$me], [1.0]) AC_CONFIG_AUX_DIR([.]) AM_INIT_AUTOMAKE AC_CONFIG_FILES([Makefile subdir/Makefile]) -AM_PATH_PYTHON END mkdir subdir -cat > Makefile.am << 'END' -python_PYTHON = foo.py -END - -cp Makefile.am subdir/Makefile.am - -: > py-compile +: > Makefile.am +: > subdir/Makefile.am $ACLOCAL $AUTOMAKE -$FGREP '$(top_srcdir)/py-compile' Makefile.in -$FGREP '$(top_srcdir)/py-compile' subdir/Makefile.in +grep '^am__config_aux_dir = \$(top_srcdir)$' Makefile.in +grep '^am__config_aux_dir = \$(top_srcdir)$' subdir/Makefile.in : diff --git a/t/auxdir8.sh b/t/auxdir8.sh index 21c346ebf..9f4f76d3e 100755 --- a/t/auxdir8.sh +++ b/t/auxdir8.sh @@ -25,23 +25,17 @@ cat >> configure.ac << 'END' AC_CONFIG_FILES([subdir/Makefile]) -AM_PATH_PYTHON END mkdir subdir -cat > Makefile.am << 'END' -python_PYTHON = foo.py -END - -cp Makefile.am subdir/Makefile.am - -: > py-compile +: > Makefile.am +: > subdir/Makefile.am $ACLOCAL $AUTOMAKE -$FGREP '$(top_srcdir)/py-compile' Makefile.in -$FGREP '$(top_srcdir)/py-compile' subdir/Makefile.in +grep '^am__config_aux_dir = \$(top_srcdir)$' Makefile.in +grep '^am__config_aux_dir = \$(top_srcdir)$' subdir/Makefile.in : diff --git a/t/distcom-subdir.sh b/t/distcom-subdir.sh index 46e516a63..20aa8a592 100755 --- a/t/distcom-subdir.sh +++ b/t/distcom-subdir.sh @@ -22,6 +22,7 @@ cat >> configure.ac << 'END' AC_CONFIG_FILES([subdir/Makefile]) AC_PROG_CC +AC_PROG_FGREP AC_OUTPUT END @@ -32,14 +33,18 @@ END rm -f depcomp mkdir subdir -: > subdir/Makefile.am +cat > subdir/Makefile.am << 'END' +.PHONY: test-distcommon +test-distcommon: + echo ' ' $(am__dist_common) ' ' | $(FGREP) ' $(top_srcdir)/depcomp ' +END $ACLOCAL $AUTOCONF $AUTOMAKE test ! -f depcomp -cat > subdir/Makefile.am << 'END' +cat >> subdir/Makefile.am << 'END' bin_PROGRAMS = foo END @@ -47,28 +52,8 @@ END $AUTOMAKE -a subdir/Makefile test -f depcomp - -# FIXME: the logic of this check and other similar ones in other -# FIXME: 'distcom*.test' files should be factored out in a common -# FIXME: subroutine in 'defs'... -sed -n -e " - /^am__dist_common =.*\\\\$/ { - :loop - p - n - t clear - :clear - s/\\\\$/\\\\/ - t loop - s/$/ / - s/[$tab ][$tab ]*/ /g - p - n - }" subdir/Makefile.in > dc.txt -cat dc.txt -$FGREP ' $(top_srcdir)/depcomp ' dc.txt - ./configure +(cd subdir && $MAKE test-distcommon) $MAKE distdir test -f $distdir/depcomp diff --git a/t/distcom2.sh b/t/distcom2.sh index 141cd79aa..76ded068b 100755 --- a/t/distcom2.sh +++ b/t/distcom2.sh @@ -72,10 +72,12 @@ for opt in '' --no-force; do cat dc.txt # For debugging. cat subdir/dc.txt # Likewise. - $FGREP ' $(top_srcdir)/depcomp ' subdir/dc.txt - # The 'compile' script will be listed in the am__dist_common of the top-level - # Makefile because it's required in configure.ac (by AM_PROG_CC_C_O). - $FGREP ' $(top_srcdir)/compile ' dc.txt || $FGREP ' compile ' dc.txt + $FGREP ' $(am__config_aux_dir)/depcomp ' subdir/dc.txt + # The 'compile' script will be listed in the am__dist_common of + # the top-level Makefile because it's required in configure.ac + # (by AM_PROG_CC_C_O). + $FGREP ' $(am__config_aux_dir)/compile ' dc.txt \ + || $FGREP ' compile ' dc.txt done diff --git a/t/yacc-auxdir.sh b/t/yacc-auxdir.sh index 1b494e82c..534abbd53 100755 --- a/t/yacc-auxdir.sh +++ b/t/yacc-auxdir.sh @@ -50,7 +50,7 @@ test -f aux1/ylwrap test ! -f ylwrap test ! -f sub/ylwrap grep -i 'ylwrap' Makefile.in sub/Makefile.in # For debugging. -$FGREP '$(top_srcdir)/aux1/ylwrap' Makefile.in -$FGREP '$(top_srcdir)/aux1/ylwrap' sub/Makefile.in +$FGREP '$(am__config_aux_dir)/ylwrap' Makefile.in +$FGREP '$(am__config_aux_dir)/ylwrap' sub/Makefile.in :