diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-05-22 07:57:48 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2013-05-22 07:57:48 (GMT) |
commit | 586b77aea13cf6128fc8d09fbfff887ab9838545 (patch) | |
tree | 49732b9d8128de8e9bacd6ec26fa5d3a15bd3813 | |
parent | 7aa36089928e7adb750ca9afab8fb779551fb093 (diff) | |
download | tk-586b77aea13cf6128fc8d09fbfff887ab9838545.zip tk-586b77aea13cf6128fc8d09fbfff887ab9838545.tar.gz tk-586b77aea13cf6128fc8d09fbfff887ab9838545.tar.bz2 |
Only call XInitThreads() when we have a very new X11 library. Checked by looking whether XKeycodeToKeysym() is deprecated, which also happend in some very new X11 version.
-rwxr-xr-x | unix/configure | 71 | ||||
-rw-r--r-- | unix/configure.in | 19 | ||||
-rw-r--r-- | unix/tkUnixEvent.c | 2 |
3 files changed, 91 insertions, 1 deletions
diff --git a/unix/configure b/unix/configure index b896382..9cec7b7 100755 --- a/unix/configure +++ b/unix/configure @@ -10827,6 +10827,77 @@ _ACEOF fi #-------------------------------------------------------------------- +# Check whether XKeycodeToKeysym is deprecated in X11 headers. +#-------------------------------------------------------------------- + +if test $tk_aqua = no; then + echo "$as_me:$LINENO: checking whether XKeycodeToKeysym is deprecated" >&5 +echo $ECHO_N "checking whether XKeycodeToKeysym is deprecated... $ECHO_C" >&6 + tk_oldCFlags=$CFLAGS + CFLAGS="$CFLAGS -Werror" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + + #include <X11/Xlib.h> + +int +main () +{ + + XKeycodeToKeysym(0,0,0); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define XKEYCODETOKEYSYM_IS_DEPRECATED 1 +_ACEOF + + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS=$tk_oldCFlags +fi + +#-------------------------------------------------------------------- # XXX Do this last. # It might modify XLIBSW which could affect other tests. # diff --git a/unix/configure.in b/unix/configure.in index 3c59369..bc22472 100644 --- a/unix/configure.in +++ b/unix/configure.in @@ -589,6 +589,25 @@ if test $tk_aqua = no; then fi #-------------------------------------------------------------------- +# Check whether XKeycodeToKeysym is deprecated in X11 headers. +#-------------------------------------------------------------------- + +if test $tk_aqua = no; then + AC_MSG_CHECKING([whether XKeycodeToKeysym is deprecated]) + tk_oldCFlags=$CFLAGS + CFLAGS="$CFLAGS -Werror" + AC_TRY_LINK([ + #include <X11/Xlib.h> + ], [ + XKeycodeToKeysym(0,0,0); + ], [ + AC_MSG_RESULT([yes]) + AC_DEFINE(XKEYCODETOKEYSYM_IS_DEPRECATED, 1, [Is XKeycodeToKeysym deprecated?]) + ], AC_MSG_RESULT([no])) + CFLAGS=$tk_oldCFlags +fi + +#-------------------------------------------------------------------- # XXX Do this last. # It might modify XLIBSW which could affect other tests. # diff --git a/unix/tkUnixEvent.c b/unix/tkUnixEvent.c index 9b32502..8eaa741 100644 --- a/unix/tkUnixEvent.c +++ b/unix/tkUnixEvent.c @@ -128,7 +128,7 @@ TkpOpenDisplay( int minor = 0; int reason = 0; unsigned int use_xkb = 0; -#ifdef TCL_THREADS +#if defined(XKEYCODETOKEYSYM_IS_DEPRECATED) && defined(TCL_THREADS) static int xinited = 0; TCL_DECLARE_MUTEX(xinitMutex); |