]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
[ng] refactor: make '$am_config_aux_dir' available as a make variable
authorStefano Lattarini <stefano.lattarini@gmail.com>
Mon, 21 May 2012 21:27:55 +0000 (23:27 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 22 May 2012 11:44:35 +0000 (13:44 +0200)
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 <stefano.lattarini@gmail.com>
automake.in
t/auxdir.sh
t/auxdir6.sh
t/auxdir7.sh
t/auxdir8.sh
t/distcom-subdir.sh
t/distcom2.sh
t/yacc-auxdir.sh

index 6b49543823efa07a80c36e6847d3427e01a5c202..ff9bb54c1ad772575c14eede57907d8dc021e490 100644 (file)
@@ -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.
index f2abfd7876baab610705df771a1f61b4c32e2ecd..be113d9cd00a45b8aa152eb2977b660649e48077 100755 (executable)
@@ -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
 
 :
index a6d68fddaf86927e1e7231668200b5f1d27888cb..57f4d95b012ac4d37be3ae354f61a39ab829eb5f 100755 (executable)
@@ -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
 
 :
index bdf571efb5952158ef1a7c56c8d4d282e15feacc..6eba0795bda86d5331c67ddf57f2c7dbfbaef65c 100755 (executable)
@@ -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
 
 :
index 21c346ebf43cf4538f1fc4c6568455b95dbe86d2..9f4f76d3eca20560ad08dd46a7d7a096fabfd7a4 100755 (executable)
 
 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
 
 :
index 46e516a63a440ecefae5405f2d349334859edcbf..20aa8a592df53e5f6ee53a454fb57d654682e2a6 100755 (executable)
@@ -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
 
index 141cd79aa53a15015fd8166e1e5e9742147693e2..76ded068b6e357daa566fcc72a5bd9679fd6f34d 100755 (executable)
@@ -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
 
index 1b494e82c1a944c09665f02464d7adf3eea6753f..534abbd5345b9f8ad43be00c71bcfbddffa81b9d 100755 (executable)
@@ -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
 
 :