[RFC] Detect system XKB installation paths

Yaakov (Cygwin/X) yselkowitz at users.sourceforge.net
Tue Mar 23 03:22:38 PDT 2010


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>
---
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
+	PKG_CHECK_EXISTS(xkeyboard-config,
+		[DEFAULT_XKB_PATH="`$PKG_CONFIG --variable=xkb_base xkeyboard-config`"])
+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])
+
 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
+
 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])
 
-- 
1.6.6.1



More information about the xorg-devel mailing list