summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Nieto Cid <dnietoc@gmail.com>2011-04-16 20:22:31 -0300
committerDiego Nieto Cid <dnietoc@gmail.com>2011-04-16 23:46:58 -0300
commitd028b59ccaac609f5d9e01907df30f9cecd2595e (patch)
tree95c81ae0df891d2c84926ced12aaeb5f3866ecb6
parentb2662d9ddb3320fb3ac295c4858efe285fc4168f (diff)
Find the absolute path to <X11/keysymdef.h>
Specifying the header file relative to $(includeir) won't work because it is defined in terms of prefix variable which is redefined during installation to the destination directory. And the dependency check will fail during 'make install' because the header might not be in the destination tree. * config.make.in (X11_KEYSYMDEF_H, SED): New variables. * configure.in: Check for sed. Find X11/keysymdef.h absolute location using the preprocessor and save it in X11_KEYSYMDEF_H variable. * console-client/Makefile (kstoucs_map.c): Use X11_KEYSYMDEF_H to depend on the header file.
-rw-r--r--config.make.in2
-rw-r--r--configure.in19
-rw-r--r--console-client/Makefile2
3 files changed, 22 insertions, 1 deletions
diff --git a/config.make.in b/config.make.in
index 1fbdef1b..6aed976f 100644
--- a/config.make.in
+++ b/config.make.in
@@ -44,6 +44,7 @@ RANLIB = @RANLIB@
MIG = @MIG@
MIGCOM = $(MIG) -cc cat - /dev/null
AWK = @AWK@
+SED = @SED@
# Compilation flags. Append these to the definitions already made by
# the specific Makefile.
@@ -71,6 +72,7 @@ HAVE_X11 = @have_x11@
X11_CFLAGS = @X11_CFLAGS@
X11_LIBS = @X11_LIBS@
XKB_BASE = @XKB_BASE@
+X11_KEYSYMDEF_H = @X11_KEYSYMDEF_H@
# Installation tools.
INSTALL = @INSTALL@
diff --git a/configure.in b/configure.in
index 18216540..978de1e2 100644
--- a/configure.in
+++ b/configure.in
@@ -82,6 +82,7 @@ AC_SUBST(enable_static_progs)
INSTALL="$SHELL $(readlink -f "$ac_install_sh")"\ -C || unset INSTALL]
AC_PROG_INSTALL
AC_PROG_AWK
+AC_PROG_SED
AC_PROG_CC
# Require GCC.
@@ -247,10 +248,28 @@ PKG_CHECK_MODULES([X11], [x11 xproto],
AC_MSG_RESULT([$XKB_BASE])],
[XKB_BASE="$datadir/X11/xkb"
AC_MSG_RESULT([(default) $XKB_BASE])])
+
+ have_keysymdef_h=no
+ AC_CHECK_HEADER([X11/keysymdef.h],
+ [AC_MSG_CHECKING([for X11/keysymdef.h absolute location])
+ AC_PREPROC_IFELSE([#include <X11/keysymdef.h>],
+ [[X11_KEYSYMDEF_H=`$SED -n 's%^[^"]*"\([^"]*X11/keysymdef.h\)".*$%\1%p' conftest.i`]
+ # did the sed magic above work?
+ AS_IF([test -f "$X11_KEYSYMDEF_H"],
+ [have_keysymdef_h=yes],
+ [X11_KEYSYMDEF_H=not-found])
+ ],
+ [X11_KEYSYMDEF_H=not-found])
+ AC_MSG_RESULT([$X11_KEYSYMDEF_H])
+ ])
+ AS_IF([test $have_keysymdef_h = no],
+ [AC_MSG_WARN([X11/keysymdef.h was not found, XKB will be disabled.])
+ have_x11=no])
], [have_x11=no])
])
AC_SUBST([have_x11])
AC_SUBST([XKB_BASE])
+AC_SUBST([X11_KEYSYMDEF_H])
if test -f ./$ac_unique_file; then
# Configuring in source directory; don't create any Makefiles.
diff --git a/console-client/Makefile b/console-client/Makefile
index c84eb7eb..3139f9ea 100644
--- a/console-client/Makefile
+++ b/console-client/Makefile
@@ -130,7 +130,7 @@ $(XKB_BASE)/%: xkb/xkb-data/%
# FIXME: dependency files won't catch this one.
$(srcdir)/xkb/kstoucs.c: kstoucs_map.c
-kstoucs_map.c: $(includedir)/X11/keysymdef.h $(srcdir)/xkb/kstoucs_map.sh
+kstoucs_map.c: $(X11_KEYSYMDEF_H) $(srcdir)/xkb/kstoucs_map.sh
SED=$(SED) \
AWK=$(AWK) \
sh $(srcdir)/xkb/kstoucs_map.sh \