[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
m4_normalize and flattening some file lists
From: |
Pavel Roskin |
Subject: |
m4_normalize and flattening some file lists |
Date: |
Fri, 12 Jan 2001 14:55:04 -0500 (EST) |
Hello!
This patch normalizes (i.e. converts to a space separated list) the lists
given as argument to AC_CONFIG_FILES and similar macros.
The current autoconf would write to configure
ac_config_files="$ac_config_files very_very_\
long_name"
given
AC_CONFIG_FILES([very_very_\
long_name])
whereas the patched autoconf would write
ac_config_files="$ac_config_files very_very_long_name"
This is not a problem for most (hopefully all) shells, but I would prefer
to see Autoconf doing this job.
Also extra spaces are removed, which makes the output of "config.status
--version" somewhat easier to read.
ChangeLog:
* m4sugar.m4 (m4_normalize): New macro - superposition of
m4_flatten and m4_strip.
(m4_join): Use m4_normalize.
* acgeneral.m4 (AC_FOREACH): Use m4_normalize.
(AC_CONFIG_HEADERS): Normalize the first argument.
(AC_CONFIG_LINKS): Likewise.
(AC_CONFIG_SUBDIRS): Likewise.
Regards,
Pavel Roskin
___________________________
--- acgeneral.m4
+++ acgeneral.m4
@@ -511,7 +511,7 @@
# ive ], [-Var-])end
# => -active--b--active-end
m4_define([AC_FOREACH],
-[m4_foreach([$1], m4_split(m4_strip(m4_flatten([$2]))), [$3])])
+[m4_foreach([$1], m4_split(m4_normalize([$2])), [$3])])
@@ -3597,7 +3597,7 @@
])])])
_AC_CONFIG_COMMANDS_INIT([$3])
m4_divert_pop()dnl
-ac_config_headers="$ac_config_headers $1"
+ac_config_headers="$ac_config_headers m4_normalize([$1])"
])dnl
# Initialize to empty. It is much easier and uniform to have a config
@@ -3634,7 +3634,7 @@
])])])
_AC_CONFIG_COMMANDS_INIT([$3])
m4_divert_pop()dnl
-ac_config_links="$ac_config_links $1"
+ac_config_links="$ac_config_links m4_normalize([$1])"
])dnl
@@ -3705,7 +3705,7 @@
])])])
_AC_CONFIG_COMMANDS_INIT([$3])
m4_divert_pop()dnl
-ac_config_files="$ac_config_files $1"
+ac_config_files="$ac_config_files m4_normalize([$1])"
])dnl
# Initialize the lists.
@@ -3732,7 +3732,8 @@
AC_VAR_INDIR_IFELSE([$1],
[AC_DIAGNOSE(syntax,
[$0: you should use literals])])
-m4_divert_text([DEFAULTS], [ac_subdirs_all="$ac_subdirs_all $1"])
+m4_divert_text([DEFAULTS],
+ [ac_subdirs_all="$ac_subdirs_all m4_normalize([$1])"])
AC_SUBST(subdirs, "$subdirs $1")dnl
])
--- m4sugar.m4
+++ m4sugar.m4
@@ -1377,6 +1377,13 @@
[ \(.\)$], [\1])])
+# m4_normalize(STRING)
+# --------------------
+# Apply m4_flatten and m4_strip to STRING.
+m4_define([m4_normalize],
+[m4_strip(m4_flatten([$1]))])
+
+
# m4_join(SEP, ARG1, ARG2...)
# ---------------------------
@@ -1495,7 +1502,7 @@
m4_if(m4_eval(m4_Cursor > m4_len(m4_Prefix)),
1, [m4_define([m4_Cursor], m4_len(m4_Prefix))
m4_Prefix])[]dnl
-m4_foreach_quoted([m4_Word], (m4_split(m4_strip(m4_flatten([$1])))),
+m4_foreach_quoted([m4_Word], (m4_split(m4_normalize([$1]))),
[m4_define([m4_Cursor], m4_eval(m4_Cursor + len(m4_Word) + 1))dnl
dnl New line if too long, else insert a space unless it is the first
dnl of the words.
___________________________
- m4_normalize and flattening some file lists,
Pavel Roskin <=