[RFC] Detect system XKB installation paths

Dan Nicholson dbn.lists at gmail.com
Tue Mar 23 06:29:43 PDT 2010


On Tue, Mar 23, 2010 at 3:22 AM, Yaakov (Cygwin/X)
<yselkowitz at users.sourceforge.net> wrote:
> From: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>
>
> In the case where xserver is built in a different prefix from xkbcomp
> and xkeyboard-config, e.g. when building from git with autogen.sh
> without arguments (which defaults to /usr/local) against
> distro-installed components (usually in /usr), assuming the same prefix
> will cause the server to not find these and fail to run.
>
> Instead, if not cross-compiling, detect the system-installed locations
> if present and use these instead.
>
> Signed-off-by: Yaakov Selkowitz <yselkowitz at users.sourceforge.net>

I've wanted to do this for a while, but there are a couple issues.

> ---
> This depends on my newly-proposed patch for xkeyboard-config:
> https://bugs.freedesktop.org/show_bug.cgi?id=27257
>
> Therefore this is *not* intended as a candidate for xserver 1.8.
>
>  configure.ac |   25 ++++++++++++++++++++++---
>  1 files changed, 22 insertions(+), 3 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index e9f9453..55e9156 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -523,9 +523,19 @@ AC_ARG_WITH(default-font-path, AS_HELP_STRING([--with-default-font-path=PATH], [
>  AC_MSG_CHECKING([for default font path])
>  AC_MSG_RESULT([$FONTPATH])
>
> -AC_ARG_WITH(xkb-path,         AS_HELP_STRING([--with-xkb-path=PATH], [Path to XKB base dir (default: ${datadir}/X11/xkb)]),
> +DEFAULT_XKB_PATH="${datadir}/X11/xkb"
> +if test "$cross_compiling" != yes; then

Why exclude cross compiling? Using PKG_CHECK_EXISTS or AC_PATH_PROG
have no problems in those situations.

> +       PKG_CHECK_EXISTS(xkeyboard-config,
> +               [DEFAULT_XKB_PATH="`$PKG_CONFIG --variable=xkb_base xkeyboard-config`"])

Check if DEFAULT_XKB_PATH is empty and set it to ${datadir}/X11/xkb if
so. Then we can fallback gracefully on older xkeyboard-config
installations.

> +fi
> +
> +AC_ARG_WITH(xkb-path,         AS_HELP_STRING([--with-xkb-path=PATH], [Path to XKB base dir (default: auto)]),
>                                [ XKBPATH="$withval" ],
> -                               [ XKBPATH="${datadir}/X11/xkb" ])
> +                               [ XKBPATH="${DEFAULT_XKB_PATH}" ])
> +
> +AC_MSG_CHECKING([for XKB data directory])
> +AC_MSG_RESULT([$XKBPATH])

The only drawback is that there's never been a hard requirement on
having xkeyboard-config installed before xserver, and we risk picking
up the host's installation instead of the one the user expects. Still
the CHECKING/RESULT is nice and informs people.

> +
>  AC_ARG_WITH(xkb-output,       AS_HELP_STRING([--with-xkb-output=PATH], [Path to XKB output dir (default: ${datadir}/X11/xkb/compiled)]),
>                                [ XKBOUTPUT="$withval" ],
>                                [ XKBOUTPUT="compiled" ])
> @@ -1135,10 +1145,19 @@ AM_CONDITIONAL(INT10MODULE, test "x$INT10MODULE" = xyes)
>  AC_DEFINE(SHAPE, 1, [Support SHAPE extension])
>
>  AC_DEFINE_DIR(XKB_BASE_DIRECTORY, XKBPATH, [Path to XKB data])
> +
> +DEFAULT_XKB_BIN_DIR="${bindir}"
> +if test "$cross_compiling" != yes; then
> +       AC_PATH_PROG(XKBCOMP, xkbcomp)
> +       if test "$XKBCOMP" != ""; then
> +               DEFAULT_XKB_BIN_DIR=`dirname $XKBCOMP`
> +       fi
> +fi

Same argument as above where we're likely to pick up the host's
xkbcomp since there was no hard requirement before. Hopefully they'd
see the result in the output.

> +
>  AC_ARG_WITH(xkb-bin-directory,
>                                AS_HELP_STRING([--with-xkb-bin-directory=DIR], [Directory containing xkbcomp program]),
>                                [XKB_BIN_DIRECTORY="$withval"],
> -                               [XKB_BIN_DIRECTORY="$bindir"])
> +                               [XKB_BIN_DIRECTORY="${DEFAULT_XKB_BIN_DIR}"])
>
>  AC_DEFINE_DIR(XKB_BIN_DIRECTORY, XKB_BIN_DIRECTORY, [Path to XKB bin dir])

We should remove this stupid macro and just #define the path to
xkbcomp until some glorious future where it doesn't need to be forked
from the server. That's a separate patch, but --with-xkbcomp would be
better.

--
Dan


More information about the xorg-devel mailing list