On Tue, Sep 11, 2012 at 9:43 AM, Ross Burton <[email protected]> wrote:
> Currently keysymdef.h is found by using the includedir of xproto.  This 
> doesn't
> work when cross-compiling with a sysroot as that ends up being 
> /usr/include/X11,
> not a path into the cross-build environment.
>
> So, add an option to allow explicitly specifying the location of keysymdef.h,
> and verify that the specified or found path exists.
>
> (original patch by Martin Jansa <[email protected]>, revised by myself)
>
> Signed-off-by: Ross Burton <[email protected]>

It's unfortunate that PKG_CONFIG_SYSROOT_DIR doesn't help you here,
but it only does the mangling at the Cflags/Libs level rather than at
individual variables.

> ---
>  configure.ac |   13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/configure.ac b/configure.ac
> index 48a0c8a..200db15 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -306,7 +306,18 @@ AC_CHECK_FUNC(poll, [AC_DEFINE(USE_POLL, 1, [poll() 
> function is available])], )
>  # Find keysymdef.h
>  #
>  AC_MSG_CHECKING([keysym definitions])
> -KEYSYMDEFDIR=`$PKG_CONFIG --variable=includedir xproto`/X11
> +AC_ARG_WITH(keysymdefdir,
> +        AC_HELP_STRING([--with-keysymdefdir=DIR], [The location of 
> keysymdef.h (defaults to xproto include dir)]),
> +        KEYSYMDEFDIR=$withval, KEYSYMDEFDIR="")
> +
> +if test x$KEYSYMDEFDIR = x; then
> +       KEYSYMDEFDIR=`$PKG_CONFIG --variable=includedir xproto`/X11
> +fi

You could compact these together so the pkg-config query is just the
option default. Plus all the stuff in the macros should be quoted to
be safe when autoconf expands it.

AC_ARG_WITH([keysymdefdir],
        [AC_HELP_STRING([--with-keysymdefdir=DIR], [The location of
keysymdef.h (defaults to xproto include dir)])],
        [KEYSYMDEFDIR=$withval],
        [KEYSYMDEFDIR=`$PKG_CONFIG --variable=includedir xproto`/X11])

> +if test ! -d $KEYSYMDEFDIR; then

I'd quote the variable here so stupid shell errors don't happen if
someone throws in a directory with spaces.

> +       AC_MSG_ERROR([$KEYSYMDEFDIR doesn't exist or isn't a directory])
> +fi
> +
>  FILES="keysymdef.h XF86keysym.h Sunkeysym.h DECkeysym.h HPkeysym.h"
>  for i in $FILES; do
>      if test -f "$KEYSYMDEFDIR/$i"; then

Other than those nitpicks, it seems like a good fix to me.

Reviewed-by: Dan Nicholson <[email protected]>
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to