Hi,

On Thu, Aug 04, 2005 at 01:45:18PM +0200, Tim Van Holder wrote:
> Couldn't you simply fix the VPATH detection?

no, many macros use "$srcdir = ."  Not all of them are part of the
Autoconf src tree.

> Comparing `(cd $srcdir; pwd)` and `pwd` should do the trick, no?

I think you are right.  We can set srcdir=. in this case.

See the attached patch.

Stepan Kasal
2005-08-04  Stepan Kasal  <[EMAIL PROTECTED]>

        * lib/autoconf/general.m4 (_AC_INIT_SRCDIR): When building in place,
          set srcdir="."; suggested by Tim Van Holder.

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     4 Aug 2005 12:51:13 -0000
@@ -454,7 +454,7 @@
 # _AC_INIT_DIRCHECK
 # -----------------
 # Set ac_pwd, and sanity-check it and the source and installation directories.
-m4_define([_AC_INIT_DIRCHECK],
+AC_DEFUN([_AC_INIT_DIRCHECK],
 [m4_divert_push([PARSE_ARGS])dnl
 
 ac_pwd=`pwd` && test -n "$ac_pwd" &&
@@ -470,8 +470,9 @@
 # _AC_INIT_SRCDIR
 # ---------------
 # Compute `srcdir' based on `$ac_unique_file'.
-m4_define([_AC_INIT_SRCDIR],
-[m4_divert_push([PARSE_ARGS])dnl
+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 +490,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 +1305,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      4 Aug 2005 12:51:14 -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 ;;

Reply via email to