autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problem with symlinks and VPATH Builds


From: Mark D. Roth
Subject: Problem with symlinks and VPATH Builds
Date: Fri, 19 Jul 2002 07:31:24 -0500
User-agent: Mutt/1.2.5i

My build environment supports multiple platforms by NFS-mounting a
common source tree on multiple build hosts.  The directory structure
looks like this:

   /projects/encap-src/psg/common       (source trees)
   /projects/encap-src/psg/<PLATFORM>   (build tree for each platform)

The build hosts NFS-mount the /projects filesystem from the source
server.  Each build host has a symlink from /usr/local/src to
/projects/encap-src/psg/<PLATFORM>.

As a reference case, everything works fine when I use the "real" path
for the build directory:

address@hidden:/projects/encap-src/psg/common> mkdir dummy-0.1
address@hidden:/projects/encap-src/psg/common> cd dummy-0.1/
address@hidden:/projects/encap-src/psg/common/dummy-0.1> touch dummy.c
address@hidden:/projects/encap-src/psg/common/dummy-0.1> touch Makefile.in
address@hidden:/projects/encap-src/psg/common/dummy-0.1> cat > configure.ac
AC_INIT([dummy], [0.1])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_SRCDIR([dummy.c])
AC_PROG_CC
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
address@hidden:/projects/encap-src/psg/common/dummy-0.1> autoconf
address@hidden:/projects/encap-src/psg/common/dummy-0.1> autoheader
autoheader: `config.h.in' is created
address@hidden:/projects/encap-src/psg/common/dummy-0.1> cd 
/projects/encap-src/psg/sparc-solaris8/
address@hidden:/projects/encap-src/psg/sparc-solaris8> mkdir dummy-0.1
address@hidden:/projects/encap-src/psg/sparc-solaris8> cd dummy-0.1/
address@hidden:/projects/encap-src/psg/sparc-solaris8/dummy-0.1> 
../../common/dummy-0.1/configure 
checking for gcc... gcc
checking for C compiler default output... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h

The problem comes when I cd to the build directory using the
/usr/local/src symlink instead of the "real"
/projects/encap-src/psg/<PLATFORM> path:

address@hidden:/projects/encap-src/psg/sparc-solaris8/dummy-0.1> cd ..
address@hidden:/projects/encap-src/psg/sparc-solaris8> rm -rf dummy-0.1
address@hidden:/projects/encap-src/psg/sparc-solaris8> cd /usr/local/src
address@hidden:/usr/local/src> mkdir dummy-0.1
address@hidden:/usr/local/src> cd dummy-0.1
address@hidden:/usr/local/src/dummy-0.1> ../../common/dummy-0.1/configure 
checking for gcc... gcc
checking for C compiler default output... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
configure: creating ./config.status
./config.status[551]: ../../common/dummy-0.1:  not found
./config.status[552]: ../../common/dummy-0.1:  not found
config.status: creating Makefile
config.status: creating config.h

Lines 547 through 552 of config.status are:

# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
# absolute.
ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd`
ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`

The value of $ac_dir is ".".  The purpose of the "cd $ac_dir" command
is to get to the true path of ".", but it doesn't work right.  I
inserted this line right before the ac_abs_srcdir line:

cd . && pwd

Running ./config.status printed out "/usr/local/src/dummy-0.1", not
"/projects/encap-src/psg/sparc-solaris8/dummy-0.1".  That means that
it's trying to find "/usr/local/common/dummy-0.1" (which doesn't
exist), not "/projects/encap-src/psg/common/dummy-0.1" (which is what
it should find).

The fact that "cd ." doesn't work as expected is probably broken
behavior on ksh's part, but I can reproduce this on multiple
platforms.  You can also see the problem from an interactive shell:

address@hidden:~> ksh
$ cd /usr/local/src/dummy-0.1
$ pwd
/usr/local/src/dummy-0.1
$ /bin/pwd
/projects/encap-src/psg/sparc-solaris8/dummy-0.1
$ cd .
$ pwd
/usr/local/src/dummy-0.1
$ /bin/pwd
/projects/encap-src/psg/sparc-solaris8/dummy-0.1

This is obviously something we need to work around, but I'm just not
sure what the best way is to fix it.  The only thing I can think of is
to use "`/bin/pwd`" instead of "." for $ac_dir, but I'm not sure if
that would break anything else.

Any suggestions?

-- 
Mark D. Roth <address@hidden>
http://www.feep.net/~roth/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]