[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
dynamic --help
From: |
Werner LEMBERG |
Subject: |
dynamic --help |
Date: |
Thu, 03 Jun 2004 10:19:02 +0200 (CEST) |
Consider the following problem:
To install an X Windows application resource file, the default
location of the X root directory (normally /usr/X11/lib) must be
found[*]; the directory for resources is then
<Xroot>/X11/app-defaults. To customize this value, I use a variable
--with-appresdir=DIR; and I want to have its help text look like this:
--with-appresdir=DIR X11 application resource files
[/usr/X11/lib/X11/app-defaults]
^^^^^^^^^^^^
The marked part should be created dynamically; this is, the code to
check for the X root should be executed before the help text is
generated to get the default value for the current platform. I've
tried hard but I haven't found an elegant solution to do that with
current autoconf.
I wonder whether you will support creating of dynamic help texts in
the future. Normally, the `configure --help' output should be
identical on all platforms, but in this particular case I think an
exception is worthwhile to consider.
Werner
[*] I've written a macro for that (see below), and I ask for inclusion
into autoconf. My version can be simplified a lot, of course, in
case it is integrated into autoconf since it is more or less a
fragment of AC_PATH_X.
Guido, I contribute this code for your autoconf archive. I can
format it to your needs if necessary.
======================================================================
# Get a default value for the application resource directory.
#
# We ignore the `XAPPLRES' and `XUSERFILESEARCHPATH' environment variables.
#
# The goal is to find the `root' of X11. Under most systems this is
# `/usr/X11/lib'. Application default files are then in
# `/usr/X11/lib/X11/app-defaults'.
#
# Based on autoconf's AC_PATH_X macro.
AC_DEFUN([GROFF_APPRESDIR_DEFAULT],
[if test -z "$groff_no_x"; then
# Create an Imakefile, run `xmkmf', then `make'.
rm -f -r conftest.dir
if mkdir conftest.dir; then
cd conftest.dir
# Make sure to not put `make' in the Imakefile rules,
# since we grep it out.
cat >Imakefile <<'EOF'
xlibdirs:
@echo 'groff_x_usrlibdir="${USRLIBDIR}"; groff_x_libdir="${LIBDIR}"'
EOF
if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
# GNU make sometimes prints "make[1]: Entering...",
# which would confuse us.
eval `${MAKE-make} xlibdirs 2>/dev/null | grep -v make`
# Open Windows `xmkmf' reportedly sets LIBDIR instead of USRLIBDIR.
for groff_extension in a so sl; do
if test ! -f $groff_x_usrlibdir/libX11.$groff_extension &&
test -f $groff_x_libdir/libX11.$groff_extension; then
groff_x_usrlibdir=$groff_x_libdir
break
fi
done
fi
cd ..
rm -f -r conftest.dir
fi
# In case the test with `xmkmf' wasn't successful, try a suite of
# standard directories. Check `X11' before `X11Rn' because it is often
# a symlink to the current release.
groff_x_libdirs='
/usr/X11/lib
/usr/X11R6/lib
/usr/X11R5/lib
/usr/X11R4/lib
/usr/lib/X11
/usr/lib/X11R6
/usr/lib/X11R5
/usr/lib/X11R4
/usr/local/X11/lib
/usr/local/X11R6/lib
/usr/local/X11R5/lib
/usr/local/X11R4/lib
/usr/local/lib/X11
/usr/local/lib/X11R6
/usr/local/lib/X11R5
/usr/local/lib/X11R4
/usr/X386/lib
/usr/x386/lib
/usr/XFree86/lib/X11
/usr/lib
/usr/local/lib
/usr/unsupported/lib
/usr/athena/lib
/usr/local/x11r5/lib
/usr/lpp/Xamples/lib
/usr/openwin/lib
/usr/openwin/share/lib'
if test -z "$groff_x_usrlibdir"; then
# We only test whether libX11 exists.
for groff_dir in $groff_x_libdirs; do
for groff_extension in a so sl; do
if test ! -r $groff_dir/libX11.$groff_extension; then
groff_x_usrlibdir=$groff_dir
break 2
fi
done
done
fi
if test "x$with_appresdir" = "x"; then
appresdir=$groff_x_usrlibdir/X11/app-defaults
else
appresdir=$with_appresdir
fi
fi
AC_SUBST([appresdir])])
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- dynamic --help,
Werner LEMBERG <=