'AC_DEFUN_ONCE',
'AU_DEFUN',
'_AM_AUTOCONF_VERSION',
+ # FIXME: We still need to trace AC_CONFIG_MACRO_DIR
+ # for compatibility with older autoconf. Remove this
+ # when we can assume Autoconf 2.70 or later.
'AC_CONFIG_MACRO_DIR',
- 'AC_CONFIG_MACRO_DIRS')),
+ 'AC_CONFIG_MACRO_DIR_TRACE')),
# Do not trace $1 for all other macros as we do
# not need it and it might contains harmful
# characters (like newlines).
{
$ac_version = $arg1;
}
- elsif ($macro eq 'AC_CONFIG_MACRO_DIR')
+ elsif ($macro eq 'AC_CONFIG_MACRO_DIR_TRACE')
{
- @ac_config_macro_dirs = ($arg1);
+ push @ac_config_macro_dirs, $arg1;
}
- elsif ($macro eq 'AC_CONFIG_MACRO_DIRS')
+ # FIXME: We still need to trace AC_CONFIG_MACRO_DIR
+ # for compatibility with older autoconf. Remove this
+ # when we can assume Autoconf 2.70 or later.
+ elsif ($macro eq 'AC_CONFIG_MACRO_DIR')
{
- # Empty leading/trailing fields might be produced by split,
- # hence the grep is really needed.
- push @ac_config_macro_dirs, grep (/./, (split /\s+/, $arg1));
+ @ac_config_macro_dirs = ($arg1);
}
}
+ # FIXME: in Autoconf >= 2.70, AC_CONFIG_MACRO_DIR calls
+ # AC_CONFIG_MACRO_DIR_TRACE behind the scenes, which could
+ # leave unwanted duplicates in @ac_config_macro_dirs.
+ @ac_config_macro_dirs = uniq @ac_config_macro_dirs;
+
$tracefh->close;
return %traced;
END
} || skip_all_ "autoconf doesn't define the AC_CONFIG_MACRO_DIRS macro"
-plan_ 13
+plan_ 14
ocwd=$(pwd) || fatal_ "getting current working directory"
ACLOCAL_PATH=; unset ACLOCAL_PATH
#---------------------------------------------------------------------------
-test_begin "AC_CONFIG_MACRO_DIRS: several arguments"
+test_begin "AC_CONFIG_MACRO_DIRS several arguments"
cat > configure.ac <<'END'
AC_INIT([more-args], [0.2])
#---------------------------------------------------------------------------
-test_begin "AC_CONFIG_MACRO_DIRS: several calls"
+test_begin "AC_CONFIG_MACRO_DIRS several calls"
cat > configure.ac <<'END'
AC_INIT([more-calls], [2.0])
#---------------------------------------------------------------------------
-test_begin "AC_CONFIG_MACRO_DIRS: extra whitespace"
+test_begin "AC_CONFIG_MACRO_DIRS extra whitespace"
bslash=\\
#---------------------------------------------------------------------------
+test_begin "AC_CONFIG_MACRO_DIRS precedence"
+
+cat > configure.ac <<'END'
+AC_INIT([more-calls], [2.0])
+AC_CONFIG_MACRO_DIRS([dir1])
+AC_CONFIG_MACRO_DIRS([dir2 dir3])
+MY_FOO
+MY_BAR
+MY_BAZ
+END
+
+mkdir dir1 dir2 dir3
+echo 'AC_DEFUN([MY_FOO], [OK-Foo])' > dir1/b.m4
+echo 'AC_DEFUN([MY_FOO], [KO-Foo])' > dir2/a.m4
+echo 'AC_DEFUN([MY_BAR], [OK-Bar])' > dir2/1.m4
+echo 'AC_DEFUN([MY_BAR], [KO-Bar])' > dir3/0.m4
+echo 'AC_DEFUN([MY_BAZ], [OK-Baz])' > dir3/x.m4
+
+$ACLOCAL \
+ && $FGREP 'm4_include([dir1/b.m4])' aclocal.m4 \
+ && $FGREP 'm4_include([dir2/1.m4])' aclocal.m4 \
+ && $FGREP 'm4_include([dir3/x.m4])' aclocal.m4 \
+ && test $($FGREP -c 'm4_include([dir1' aclocal.m4) -eq 1 \
+ && test $($FGREP -c 'm4_include([dir2' aclocal.m4) -eq 1 \
+ && test $($FGREP -c 'm4_include([dir3' aclocal.m4) -eq 1 \
+ && $AUTOCONF \
+ && not $EGREP 'MY_(FOO|BAR|BAZ)' configure \
+ && $FGREP 'OK-Foo' configure \
+ && $FGREP 'OK-Bar' configure \
+ && $FGREP 'OK-Baz' configure \
+ && not $FGREP 'KO-' configure \
+ || r='not ok'
+
+test_end
+
+#---------------------------------------------------------------------------
+
test_begin "AC_CONFIG_MACRO_DIRS interaction with --install"
cat > configure.ac << 'END'