Hello,
On Mon, Aug 15, 2005 at 04:07:46PM -0700, Paul Eggert wrote:
> This looks good to me; please install. But could you please also
> document the reason for the change from m4_define to AC_DEFUN?
yes, I did this. Attached please find the patch in the exact form
in which I committed.
Stepan
2005-08-16 Stepan Kasal <[EMAIL PROTECTED]>
When building in place, set srcdir="."; suggested by Tim Van Holder.
* lib/autoconf/general.m4 (_AC_INIT_SRCDIR): Do this; to recognize
build in place, we need ac_pwd, and thus have to AC_REQUIRE ...
(_AC_INIT_DIRCHECK): ... this macro and AC_DEFUN both of them.
* lib/autoconf/status.m4 (_AC_SRCDIRS): Fix a comment: srcdir="."
does not mean "no --srcdir option".
Index: lib/autoconf/general.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/general.m4,v
retrieving revision 1.879
diff -u -r1.879 general.m4
--- lib/autoconf/general.m4 25 Jul 2005 18:10:25 -0000 1.879
+++ lib/autoconf/general.m4 16 Aug 2005 08:28:48 -0000
@@ -454,7 +454,10 @@
# _AC_INIT_DIRCHECK
# -----------------
# Set ac_pwd, and sanity-check it and the source and installation directories.
-m4_define([_AC_INIT_DIRCHECK],
+#
+# (This macro is AC_REQUIREd by _AC_INIT_SRCDIR, so it has to be AC_DEFUNed.)
+#
+AC_DEFUN([_AC_INIT_DIRCHECK],
[m4_divert_push([PARSE_ARGS])dnl
ac_pwd=`pwd` && test -n "$ac_pwd" &&
@@ -470,8 +473,12 @@
# _AC_INIT_SRCDIR
# ---------------
# Compute `srcdir' based on `$ac_unique_file'.
-m4_define([_AC_INIT_SRCDIR],
-[m4_divert_push([PARSE_ARGS])dnl
+#
+# (We have to AC_DEFUN it, since we use AC_REQUIRE.)
+#
+AC_DEFUN([_AC_INIT_SRCDIR],
+[AC_REQUIRE([_AC_INIT_DIRCHECK])dnl
+m4_divert_push([PARSE_ARGS])dnl
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
@@ -489,11 +496,17 @@
test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
AC_MSG_ERROR([cannot find sources ($ac_unique_file) in $srcdir])
fi
-(cd $srcdir && test -r "./$ac_unique_file") 2>/dev/null ||
- AC_MSG_ERROR([sources are in $srcdir, but `cd $srcdir' does not work])
-dnl Remove unnecessary trailing slashes from srcdir.
-dnl Double slashes in file names in object file debugging info
-dnl mess up M-x gdb in Emacs.
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+ cd $srcdir && test -r "./$ac_unique_file" || AC_MSG_ERROR([$ac_msg])
+ pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+ srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
case $srcdir in
*/) srcdir=`expr "X$srcdir" : 'X\(.*[[^/]]\)' \| "X$srcdir" : 'X\(.*\)'`;;
esac
@@ -1298,8 +1311,8 @@
m4_ifval([$2], [_AC_INIT_PACKAGE($@)])
_AC_INIT_DEFAULTS
_AC_INIT_PARSE_ARGS
-_AC_INIT_SRCDIR
_AC_INIT_DIRCHECK
+_AC_INIT_SRCDIR
_AC_INIT_HELP
_AC_INIT_VERSION
_AC_INIT_CONFIG_LOG
Index: lib/autoconf/status.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/status.m4,v
retrieving revision 1.72
diff -u -r1.72 status.m4
--- lib/autoconf/status.m4 26 Jul 2005 10:14:25 -0000 1.72
+++ lib/autoconf/status.m4 16 Aug 2005 08:28:48 -0000
@@ -121,7 +121,7 @@
ac_top_builddir=$ac_top_build_prefix
case $srcdir in
- .) # No --srcdir option. We are building in place.
+ .) # We are building in place.
ac_srcdir=.
ac_top_srcdir=$ac_top_builddir_sub
ac_abs_top_srcdir=$ac_pwd ;;