Hi,
Frankly, I don't think this kinda snippet would be suitable for current
amber configure code. Judged from the configure code, the prefered style is
simple and customizable. Although your X11 check code is simple indeed, it
would not be as portable as you thought. e.g. the header file "Intrinsic.h"
in your code rely on the fact that X11 library should be in standard search
path. If not, the compiling would be failed. For various OS, there are quite
a lot of possible positions for X11 lib. Below are some possible X11 paths I
found in auto* tool generated code:
/usr/include/X11, /usr/X11/include, /usr/local/X11/include,
/usr/X386/include/X11 /usr/openwin/include ...
So which kind of user does your code target for, power user or novice? For
power user, they know the detailes of their OS and hence may directly modify
the configure code. For novice, it would be probable to fail on specific OS
or distro and users still do not know what to do next. Therefore, this
checking would be less useful for both of these cases.
I think that current configure is good enough for experienced users. If you
want smarter code for green hands or for maximum portability, auto* tool
would be good choice. I once post a complete auto* enabled demo for amber8
last year. Hope it would be any help to you.
best wishes
qxb
On 1/6/07, Mark Williamson <Mark.Williamson.imperial.ac.uk> wrote:
>
> Dear All,
>
> Here's an initial offering for AMBER9's configure script to check/test
> for the presence of X11 libs. It's rather ad-hoc and may break things on
> systems where one only wants to build the non-graphical components of
> AMBER, but I think it generally does the job.
>
> If the patch is mangled by email, try the copy at
>
> http://dumb.ch.ic.ac.uk/~mjw99/tmp/X11.diff
>
> regards,
>
> Mark
>
>
>
>
> diff -urN ./amber-9.17/src/configure /opt/amber-9.17/src/configure
> --- ./amber-9.17/src/configure 2007-01-06 09:00:46.000000000 +0000
> +++ /opt/amber-9.17/src/configure 2007-01-06 09:06:14.000000000+0000
> .. -1254,6 +1254,36 ..
> slko='test.sander.DFTB'
> fi
>
>
> +#--------------------------------------------------------------------------
> +# Check if X11 libs are present
>
> +#--------------------------------------------------------------------------
> +
> +echo ""
> +echo "Testing for X11 libs..."
> +
> +cat <<EOF > conftest.c
> +#include <X11/Intrinsic.h>
> +int main ()
> +{
> + XtMalloc (0);
> + return 0;
> +}
> +EOF
> +
> +$cc -o conftest conftest.c $xlibs -lXt &>/dev/null
> +if [ $? != 0 ]; then
> + echo "X11 libs not found, quitting"
> + echo "<give some useful tips here>"
> + rm conftest.c &>/dev/null
> + exit
> +else
> + echo "X11 libs found"
> + rm conftest conftest.c &>/dev/null
> +fi
> +
> +
> +
> +
>
>
> #------------------------------------------------------------------------------
> # Finally, write out the config.h file:
>
>
> #------------------------------------------------------------------------------
>
>
--
... there have been two really clean,
consistent models of programming so far:
the C model and the Lisp model.
These two seem points of high ground,
with swampy lowlands between them.
--Paul Graham
Received on Wed Jan 10 2007 - 06:07:20 PST