summaryrefslogtreecommitdiffstats
path: root/tqtinterface/qt4/config.tests/x11/xkb.test
blob: 5560b0809458ddcd65d621060abe75fb58f79694 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/sh

XKB=yes
XPLATFORM=`basename $1`
XCONFIG=$1/qmake.conf
VERBOSE=$2
shift 2
IN_INCDIRS=""
PARAMS=$@
for PARAM in $PARAMS; do
    PREFIX=`echo $PARAM | sed 's/^\(..\).*/\1/'`
    case $PREFIX in
    -I)
        CINCDIR=`echo $PARAM | sed -e 's/^-I//'`
        IN_INCDIRS="$IN_INCDIRS $CINCDIR"
        ;;
    *) ;;
    esac 
done

# debuggery
[ "$VERBOSE" = "yes" ] && echo "XKB auto-detection... ($*)"

# some platforms are known to be broken
#   Solaris 7 + Xsun
#   	Patches 107648-01 and 107649-01 upgrade the Xsun package
#   	of Solaris 7 to X Window 6.4 on SPARC and Intel platforms
#   	respectively, introducing XKB support. However most headers
#   	are missing and there's no patch to fix that. Our solution
#   	is to disable XKB support on Solaris 7.
#   	Of course XFree86 is not affected by this Xsun bug, so ideally
#   	we should disable XKB support on Solaris + Xsun only, not on
#   	Solaris + XFree86. But then how to detect Xsun vs. XFree86?
#   Tru64
#   	Link-time problems.
case "$XPLATFORM" in
solaris-*)
    UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
    case "$UNAME_RELEASE" in
    5.7)
	[ "x$VERBOSE" = "xyes" ] && echo "XKB extension known to be broken on this platform."
	XKB=no
	;;
    esac
    ;;
tru64-*)
    UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
    [ "x$VERBOSE" = "xyes" ] && echo "XKB extension not supported on this platform."
    XKB=no
    ;;
esac
    
# check for headers
XKBLIB_H=
if [ "$XKB" = "yes" ]; then
    INC="X11/XKBlib.h"
    XDIRS=`sed -n -e '/^QMAKE_INCDIR_X11[	]*=/ { s/[^=]*=[	 ]*//; s/-I/ /g; p; }' $XCONFIG`
    INCDIRS="$IN_INCDIRS $XDIRS /usr/include /include"
    F=
    for INCDIR in $INCDIRS; do
	if [ -f $INCDIR/$INC ]; then
	    F=yes
	    XKBLIB_H=$INCDIR/$INC
	    if [ "$VERBOSE" = "yes" ]
	    then
		echo "  Found $INC in $INCDIR"
	    fi
	    break
	fi
    done
    if [ -z "$F" ]; then
	XKB=no
	if [ "$VERBOSE" = "yes" ]; then
	    echo "  Could not find $INC anywhere in $INCDIRS"
	fi
    fi
fi

# check for XkbSetPerClientControls in X11/XKBlib.h
# if it is not found, we disable xkb support
if [ "$XKB" = "yes" ] && [ -f "$XKBLIB_H" ]; then
    grep XkbSetPerClientControls $XKBLIB_H >/dev/null || XKB=no
    if [ "$VERBOSE" = "yes" ]; then
	if [ "$XKB" = "yes" ]; then
	    echo "  XkbSetPerClientControls found."
	else
	    echo "  XkbSetPerClientControls not found."
	fi
    fi
fi


# done
if [ "$XKB" != "yes" ]; then
    [ "$VERBOSE" = "yes" ] && echo "XKB disabled."
    exit 0
else
    [ "$VERBOSE" = "yes" ] && echo "XKB enabled."
    exit 1
fi