adfca8
diff --git a/configure.ac b/configure.ac
adfca8
index 62f53a3..a6f2f04 100644
adfca8
--- a/configure.ac
adfca8
+++ b/configure.ac
adfca8
@@ -1874,6 +1874,7 @@ if test "${HAVE_X11}" = "yes"; then
adfca8
   AC_MSG_RESULT($emacs_xkb)
adfca8
   if test $emacs_xkb = yes; then
adfca8
     AC_DEFINE(HAVE_XKBGETKEYBOARD, 1, [Define to 1 if you have the XkbGetKeyboard function.])
adfca8
+    AC_DEFINE(HAVE_XKB, 1, [Define to 1 if you have the Xkb extension.])
adfca8
   fi
adfca8
 
adfca8
   AC_CHECK_FUNCS(XrmSetDatabase XScreenResourceString \
adfca8
diff --git a/src/xterm.c b/src/xterm.c
adfca8
index fb407c8..f47141d 100644
adfca8
--- a/src/xterm.c
adfca8
+++ b/src/xterm.c
adfca8
@@ -130,6 +130,10 @@ extern void _XEditResCheckMessages (Widget, XtPointer, XEvent *, Boolean *);
adfca8
 
adfca8
 #include "bitmaps/gray.xbm"
adfca8
 
adfca8
+#ifdef HAVE_XKB
adfca8
+#include <X11/XKBlib.h>
adfca8
+#endif
adfca8
+
adfca8
 /* Default to using XIM if available.  */
adfca8
 #ifdef USE_XIM
adfca8
 int use_xim = 1;
adfca8
@@ -3243,7 +3247,11 @@ XTring_bell (struct frame *f)
adfca8
       else
adfca8
 	{
adfca8
 	  block_input ();
adfca8
+#ifdef HAVE_XKB
adfca8
+	  XkbBell (FRAME_X_DISPLAY (f), None, 0, None);
adfca8
+#else
adfca8
 	  XBell (FRAME_X_DISPLAY (f), 0);
adfca8
+#endif
adfca8
 	  XFlush (FRAME_X_DISPLAY (f));
adfca8
 	  unblock_input ();
adfca8
 	}