]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
The AU-glue code for AC_LINK_FILES was not fully compatible: in
authorAkim Demaille <akim@epita.fr>
Thu, 10 Feb 2000 09:45:25 +0000 (09:45 +0000)
committerAkim Demaille <akim@epita.fr>
Thu, 10 Feb 2000 09:45:25 +0000 (09:45 +0000)
  AC_LINK_FILES($from, $to)
`$from' and `$to' can be lists, hence `AC_CONFIG_LINKS($to:$from)'
is wrong.
Reported by H.J. Lu.

* acgeneral.m4 (AC_LINK_FILES): Replace the m4-glue code from
AC_LINK_FILES to AC_CONFIG_LINKS, with sh-glue code.
Give a detailed update message.
(_AC_LINK_FILES_CNT): New variable.  Initialize.
* tests/tools.m4 (autoupdate): No longer exercise `autoupdate'
with AC_LINK_FILES.

ChangeLog
acgeneral.m4
lib/autoconf/general.m4
tests/tools.m4

index 6b7a901fc076cb0160f3558fb331165a55e6c618..b30da2d2f59211862308d02fb6fcf25f1786064b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2000-02-10  Akim Demaille  <akim@epita.fr>
+
+       The AU-glue code for AC_LINK_FILES was not fully compatible: in
+         AC_LINK_FILES($from, $to)
+       `$from' and `$to' can be lists, hence `AC_CONFIG_LINKS($to:$from)'
+       is wrong.
+       Reported by H.J. Lu.
+
+       * acgeneral.m4 (AC_LINK_FILES): Replace the m4-glue code from
+       AC_LINK_FILES to AC_CONFIG_LINKS, with sh-glue code.
+       Give a detailed update message.
+       (_AC_LINK_FILES_CNT): New variable.  Initialize.
+       * tests/tools.m4 (autoupdate): No longer exercise `autoupdate'
+       with AC_LINK_FILES.
+
 2000-02-10  Akim Demaille  <akim@epita.fr>
 
        * acspecific.m4 (AC_PROG_SED): Removed.
index 290fbdec86cc75672a64aee6f05986010657774f..bbe3f24227f9da01388ca540c06cc7e8c1db49e9 100644 (file)
@@ -3174,20 +3174,39 @@ define([AC_LIST_LINKS_COMMANDS])
 # ---------------------------------
 # Link each of the existing files SOURCE... to the corresponding
 # link name in DEST...
+#
+# Unfortunately we can't provide a very good autoupdate service here,
+# since in `AC_LINK_FILES($from, $to)' it is possible that `$from'
+# and `$to' are actually lists.  It would then be completely wrong to
+# replace it with `AC_CONFIG_LINKS($to:$from).  It is possible in the
+# case of literal values though, but because I don't think there is any
+# interest in creating config links with literal values, no special
+# mechanism is implemented to handle them.
+#
+# _AC_LINK_CNT is used to be robust to multiple calls.
 AU_DEFUN([AC_LINK_FILES],
 [ifelse($#, 2, ,
         [m4_fatal([$0: incorrect number of arguments])])dnl
-pushdef([AC_Srcs], m4_split(m4_strip(m4_join([$1]))))dnl
-pushdef([AC_Dsts], m4_split(m4_strip(m4_join([$2]))))dnl
-dnl
-m4_foreach([AC_Dummy], (AC_Srcs),
-[AC_CONFIG_LINKS(m4_car(AC_Dsts):m4_car(AC_Srcs))dnl
-define([AC_Srcs], m4_shift(AC_Srcs))dnl
-define([AC_Dsts], m4_shift(AC_Dsts))])dnl
-dnl
-popdef([AC_Srcs])dnl
-popdef([AC_Dsts])dnl
-])# AC_LINK_FILES
+define([_AC_LINK_FILES_CNT], incr(_AC_LINK_FILES_CNT))dnl
+ac_sources="$1"
+ac_dests="$2"
+while test -n "$ac_sources"; do
+  set $ac_dests; ac_dest=[$]1; shift; ac_dests=[$]*
+  set $ac_sources; ac_source=[$]1; shift; ac_sources=[$]*
+  [ac_config_links_]_AC_LINK_FILES_CNT="$[ac_config_links_]_AC_LINK_FILES_CNT $ac_dest:$ac_source"
+done
+AC_CONFIG_LINKS($[ac_config_links_]_AC_LINK_FILES_CNT)dnl
+],
+[
+  It is technically impossible to `autoupdate' cleanly from AC_LINK_FILES
+  to AC_CONFIG_FILES.  `autoupdate' provides a functional but inelegant
+  update, you should probably tune the result yourself.])# AC_LINK_FILES
+
+
+# Initialize both in `autoconf::' and `autoupdate::'.
+define(_AC_LINK_FILES_CNT, 0)
+m4_namespace_define(autoupdate,
+                    [_AC_LINK_FILES_CNT], 0)
 
 
 
index 290fbdec86cc75672a64aee6f05986010657774f..bbe3f24227f9da01388ca540c06cc7e8c1db49e9 100644 (file)
@@ -3174,20 +3174,39 @@ define([AC_LIST_LINKS_COMMANDS])
 # ---------------------------------
 # Link each of the existing files SOURCE... to the corresponding
 # link name in DEST...
+#
+# Unfortunately we can't provide a very good autoupdate service here,
+# since in `AC_LINK_FILES($from, $to)' it is possible that `$from'
+# and `$to' are actually lists.  It would then be completely wrong to
+# replace it with `AC_CONFIG_LINKS($to:$from).  It is possible in the
+# case of literal values though, but because I don't think there is any
+# interest in creating config links with literal values, no special
+# mechanism is implemented to handle them.
+#
+# _AC_LINK_CNT is used to be robust to multiple calls.
 AU_DEFUN([AC_LINK_FILES],
 [ifelse($#, 2, ,
         [m4_fatal([$0: incorrect number of arguments])])dnl
-pushdef([AC_Srcs], m4_split(m4_strip(m4_join([$1]))))dnl
-pushdef([AC_Dsts], m4_split(m4_strip(m4_join([$2]))))dnl
-dnl
-m4_foreach([AC_Dummy], (AC_Srcs),
-[AC_CONFIG_LINKS(m4_car(AC_Dsts):m4_car(AC_Srcs))dnl
-define([AC_Srcs], m4_shift(AC_Srcs))dnl
-define([AC_Dsts], m4_shift(AC_Dsts))])dnl
-dnl
-popdef([AC_Srcs])dnl
-popdef([AC_Dsts])dnl
-])# AC_LINK_FILES
+define([_AC_LINK_FILES_CNT], incr(_AC_LINK_FILES_CNT))dnl
+ac_sources="$1"
+ac_dests="$2"
+while test -n "$ac_sources"; do
+  set $ac_dests; ac_dest=[$]1; shift; ac_dests=[$]*
+  set $ac_sources; ac_source=[$]1; shift; ac_sources=[$]*
+  [ac_config_links_]_AC_LINK_FILES_CNT="$[ac_config_links_]_AC_LINK_FILES_CNT $ac_dest:$ac_source"
+done
+AC_CONFIG_LINKS($[ac_config_links_]_AC_LINK_FILES_CNT)dnl
+],
+[
+  It is technically impossible to `autoupdate' cleanly from AC_LINK_FILES
+  to AC_CONFIG_FILES.  `autoupdate' provides a functional but inelegant
+  update, you should probably tune the result yourself.])# AC_LINK_FILES
+
+
+# Initialize both in `autoconf::' and `autoupdate::'.
+define(_AC_LINK_FILES_CNT, 0)
+m4_namespace_define(autoupdate,
+                    [_AC_LINK_FILES_CNT], 0)
 
 
 
index c59dddc197dd7fedbd5e7d5c7d1bbd4c772d37fb..0c1ae805e7105984fc661e5cda5970ac9421a823 100644 (file)
@@ -51,7 +51,6 @@ AT_SETUP(autoupdate)
 
 AT_DATA(configure.in,
 [[AC_INIT
-AC_LINK_FILES(from1 from2, to1 to2)
 dnl The doc says 27 is a valid fubar.
 fubar=27
 AC_OUTPUT(Makefile, echo $fubar, fubar=$fubar)
@@ -60,7 +59,6 @@ AC_OUTPUT(Makefile, echo $fubar, fubar=$fubar)
 # Checking `autoupdate'.
 AT_CHECK([../autoupdate -m .. -l $at_srcdir -<configure.in], 0,
 [[AC_INIT
-AC_CONFIG_LINKS(to1:from1)AC_CONFIG_LINKS(to2:from2)
 dnl The doc says 27 is a valid fubar.
 fubar=27
 AC_CONFIG_FILES(Makefile)