Re: Support building in a different directory on Solaris - Mailing list pgsql-patches

From Ian Lance Taylor
Subject Re: Support building in a different directory on Solaris
Date
Msg-id silmkr7e1b.fsf@daffy.airs.com
Whole thread Raw
In response to Re: Support building in a different directory on Solaris  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-patches
Peter Eisentraut <peter_e@gmx.net> writes:

> Tom Lane writes:
>
> > Ian Lance Taylor <ian@airs.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

pgsql-patches by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Support building in a different directory on Solaris
Next
From: Tom Lane
Date:
Subject: Re: Support building in a different directory on Solaris