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