2005-04-20 Stepan Kasal * lib/autoconf/general.m4 (AC_CONFIG_LIBOBJ_DIR): Really check whether the given path looks sane. * lib/m4sugar/m4sugar.m4 (m4_bmatch): Halt with error if we don't get enough arguments, similarly as m4_bpatsubsts. (m4_re_relative_path): New macro; matches well named subdirectory of the package. Index: lib/autoconf/general.m4 =================================================================== RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/general.m4,v retrieving revision 1.851 diff -u -r1.851 general.m4 --- lib/autoconf/general.m4 20 Apr 2005 05:34:25 -0000 1.851 +++ lib/autoconf/general.m4 20 Apr 2005 08:27:18 -0000 @@ -2501,9 +2501,9 @@ # ----------------------------- # Announce LIBOBJ replacement files are in $top_srcdir/DIRNAME. AC_DEFUN_ONCE([AC_CONFIG_LIBOBJ_DIR], -[m4_bmatch([$1], [^]m4_defn([m4_cr_symbols2]), - [AC_WARNING([invalid replacement directory: $1])])dnl -m4_divert_text([DEFAULTS], [ac_config_libobj_dir=$1])[]dnl +[m4_bmatch([$1], m4_defn([m4_re_relative_path]), + [m4_divert_text([DEFAULTS], [ac_config_libobj_dir=$1])], + [AC_WARNING([invalid replacement directory: $1])])[]dnl ]) Index: lib/m4sugar/m4sugar.m4 =================================================================== RCS file: /cvsroot/autoconf/autoconf/lib/m4sugar/m4sugar.m4,v retrieving revision 2.84 diff -u -r2.84 m4sugar.m4 --- lib/m4sugar/m4sugar.m4 19 Apr 2005 06:20:38 -0000 2.84 +++ lib/m4sugar/m4sugar.m4 20 Apr 2005 08:27:19 -0000 @@ -374,8 +374,8 @@ # All the values are optional, and the macro is robust to active symbols # properly quoted. m4_define([m4_bmatch], -[m4_if([$#], 0, [], - [$#], 1, [], +[m4_if([$#], 0, [m4_fatal([$0: too few arguments: $#])], + [$#], 1, [m4_fatal([$0: too few arguments: $#: $1])], [$#], 2, [$2], [m4_if(m4_bregexp([$1], [$2]), -1, [$0([$1], m4_shiftn(3, $@))], [$3])])]) @@ -1343,6 +1343,17 @@ ) +# m4_re_relative_path +# ------------------- +# Regexp for `^[-.a-zA-Z_0-9][-.a-zA-Z_0-9/]*$' +m4_define([m4_re_relative_path], +[^]dnl +m4_dquote([-.]m4_defn([m4_cr_symbols2]))dnl +m4_dquote([-.]m4_defn([m4_cr_symbols2])/)dnl +[*$]dnl +) + + # m4_tolower(STRING) # m4_toupper(STRING) # ------------------