Re: Support building in a different directory on Solaris

From: Ian Lance Taylor <ian(at)airs(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Support building in a different directory on Solaris
Date: 2001-08-10 22:20:32
Message-ID: silmkr7e1b.fsf@daffy.airs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:

> Tom Lane writes:
>
> > Ian Lance Taylor <ian(at)airs(dot)com> writes:
> > > the test built in to /bin/sh does not support -ef, although
> > > /usr/bin/test does support it.
> >
> > Rather than assuming a test with -ef is available, ISTM the portable
> > answer is not to depend on it at all. Why not forget the whole thing
> > and use something like
> >
> > if [ `cd "$srcdir" ; /bin/pwd` = `/bin/pwd` ] ; then : ; else
>
> That doesn't work in some setups; that's why we have what we have now.
> The problem is that this test would actually evaluate to "not equal" and
> the prep_buildtree would run on top of the source tree. Ugh.
>
> Another way to find out if you're in the source tree might be to use
> something like
>
> test -f configure
>
> but that's of course less than 100% positive. Ian, you seem to use this a
> lot; any ideas?

I normally use the full-fledged autoconf approach, in which you have a
Makefile.in in each source directory, and you list them all in
AC_OUTPUT. Then configure will build the directory tree for you, and
you don't need prep_buildtree.

You're trying to avoid running prep_buildtree when the build is done
in the source directory. One thing to do would be to make
prep_buildtree harmless when it is run in the source directory, and
switch to the test Tom suggests. Tom's test will work in most cases,
so this will only be inefficient in the relatively unusual cases where
it does not work.

For example, perhaps something this would work, although I haven't
tested it:

if test ! -f "${item}.in"; then
- ln -fs "$item" "$buildtree/$subdir" || exit 1
+ if cmp "$item" "$buildtree/subdir" >/dev/null 2>&1; then : ; else
+ ln -fs "$item" "$buildtree/$subdir" || exit 1
+ fi

Ian

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2001-08-10 22:24:42 Re: Support building in a different directory on Solaris
Previous Message Peter Eisentraut 2001-08-10 22:09:51 Re: Support building in a different directory on Solaris