Hello,

it seems we have discovered an Autoconf problem, so I'm moving this
subthread to bug-autoconf.  Make sure to cc Jason.

On Wed, Aug 03, 2005 at 10:17:45PM +0200, Bruno Haible wrote:
> So it looks like your "build system" is doing
>
>     ./configure --prefix=/xsys --srcdir=`pwd`
...
> This has the effect of starting a VPATH build, with $builddir = $srcdir.
> You're probably the first one in the world to use this kind of build
> configuration :-)

I wouldn't be so sure.  As Jason told me in another post, he has never
used --srcdir; it was AC_CONFIG_SUBDIRS which generated the call:

/tmp/xsys.32647.0/gettext-0.14.5/gettext-tools/configure \
        '--prefix=/xsys' 'CC=gcc' 'CXX=g++' '--cache-file=/dev/null' \
        '--srcdir=/tmp/xsys.32647.0/gettext-0.14.5/gettext-tools'

AC_CONFIG_SUBDIRS always uses the --srcdir options, so that the subscripts
need not to autodetect it.

So far so good.  But why had the upper configure srcdir set to full path?

The autodetection code (_AC_INIT_SRCDIR in lib/autoconf/general.m4) tries
the folowing candidates for srcdir:
1) directory name of the configure script
2) ..

So if configure was called with full path, srcdir is set to the full path.
This can cause problems: VPATH build is recognized by "test $srcdir = ."
(for example, search ac_vpsub in lib/autoconf/status.m4).

I think _AC_INIT_SRCDIR should try srcdir=. before the other two
candidates.

A patch is attached (not tested at all).

To try this patch, you have to:
- checkout CVS Autoconf,
- apply the patch,
- build & install Autoconf,
- unpack gettext and cd into it
- run autoconf
- run ./configure
- make dist

Then you have a new gettext tarball (though perhaps with the same name),
which you can try.

Have a nice day,
        Stepan Kasal
2005-08-04  Stepan Kasal  <[EMAIL PROTECTED]>

        * lib/autoconf/general.m4 (_AC_INIT_SRCDIR): When autodetecting,
          try the current directory first.

Index: lib/autoconf/general.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/general.m4,v
retrieving revision 1.879
diff -u -c -r1.879 general.m4
*** lib/autoconf/general.m4     25 Jul 2005 18:10:25 -0000      1.879
--- lib/autoconf/general.m4     4 Aug 2005 10:29:06 -0000
***************
*** 474,492 ****
  [m4_divert_push([PARSE_ARGS])dnl
  
  # Find the source files, if location was not specified.
! if test -z "$srcdir"; then
    ac_srcdir_defaulted=yes
!   # Try the directory containing this script, then the parent directory.
!   ac_confdir=`AS_DIRNAME(["$[0]"])`
!   srcdir=$ac_confdir
!   if test ! -r "$srcdir/$ac_unique_file"; then
!     srcdir=..
    fi
- else
-   ac_srcdir_defaulted=no
  fi
  if test ! -r "$srcdir/$ac_unique_file"; then
!   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 ||
--- 474,499 ----
  [m4_divert_push([PARSE_ARGS])dnl
  
  # Find the source files, if location was not specified.
! if test "x$srcdir" != x; then
!   ac_srcdir_defaulted=no
! else
    ac_srcdir_defaulted=yes
!   # We have to try the current directory first, because srcdir != .
!   # would indicates a VPATH build.  Then we try the directory
!   # containing this script, and then the parent directory.
!   if test -r "./$ac_unique_file"; then
!     srcdir=.
!   else
!     ac_confdir=`AS_DIRNAME(["$[0]"])`
!     if test -r "$ac_confdir/$ac_unique_file"; then
!       srcdir=$ac_confdir
!     else
!       srcdir=..
!     fi
    fi
  fi
  if test ! -r "$srcdir/$ac_unique_file"; then
!   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 ||

Reply via email to