~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to config.tests/x11/xinput.test

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
 
 
3
XINPUT=yes
 
4
PLATFORM=$1
 
5
XCONFIG=$PLATFORM/qmake.conf
 
6
VERBOSE=$2
 
7
shift 2
 
8
IN_LIBDIRS=""
 
9
IN_INCDIRS=""
 
10
PARAMS=$@
 
11
for PARAM in $PARAMS; do
 
12
    PREFIX=`echo $PARAM | sed 's/^\(..\).*/\1/'`
 
13
    case $PREFIX in
 
14
    -L)
 
15
        CLIBDIR=`echo $PARAM | sed -e 's/^-L//'`
 
16
        IN_LIBDIRS="$IN_LIBDIRS $CLIBDIR"
 
17
        ;;
 
18
    -I)
 
19
        CINCDIR=`echo $PARAM | sed -e 's/^-I//'`
 
20
        IN_INCDIRS="$IN_INCDIRS $CINCDIR"
 
21
        ;;
 
22
    *) ;;
 
23
    esac
 
24
done
 
25
 
 
26
# debuggery
 
27
[ "$VERBOSE" = "yes" ] && echo "XInput auto-detection... ($*)"
 
28
 
 
29
# check for the XInput library
 
30
XDIRS=`sed -n -e '/^QMAKE_LIBDIR_X11[   ]*=/ { s/[^=]*=[         ]*//; s/-L/ /g; p; }' $XCONFIG`
 
31
LIBDIRS="$IN_LIBDIRS $XDIRS /usr/shlib /usr/lib /lib"
 
32
F=
 
33
for LIBDIR in $LIBDIRS; do
 
34
    FOUND_LIB=`ls $LIBDIR/libXi.* 2>/dev/null`
 
35
    if [ ! -z "$FOUND_LIB" ]; then
 
36
        F=yes
 
37
        [ "$VERBOSE" = "yes" ] && echo "  Found XInput lib in $LIBDIR"
 
38
        break
 
39
     fi
 
40
done
 
41
if [ -z "$F" ]; then
 
42
    XINPUT=no
 
43
    [ "VERBOSE" = "yes" ] && echo "  Could not find XInput lib anywhere in $LIBDIRS"
 
44
fi
 
45
 
 
46
PLATFORM=`echo $PLATFORM | sed -e 's,.*/mkspecs/\([a-zA-Z0-9]*\).*,\1,'`
 
47
# check for XInput.h and the IRIX wacom.h
 
48
if [ "$XINPUT" = "yes" ]; then
 
49
    INCS="X11/extensions/XInput.h"
 
50
    if [ "$PLATFORM" = "irix" ]; then
 
51
        INCS=$INCS" wacom.h"
 
52
    fi
 
53
    XDIRS=`sed -n -e '/^QMAKE_INCDIR_X11[       ]*=/ { s/[^=]*=[         ]*//; s/-I/ /g; p; }' $XCONFIG`
 
54
    INCDIRS="$IN_INCDIRS $XDIRS /usr/include /include"
 
55
 
 
56
    for I in $INCS; do
 
57
        F=
 
58
        for INCDIR in $INCDIRS; do
 
59
            if [ -f $INCDIR/$I ]; then
 
60
                F=yes
 
61
                [ "$VERBOSE" = "yes" ] && echo "  Found $I in $INCDIR"
 
62
                break
 
63
            fi
 
64
        done
 
65
        if [ -z "$F" ]; then
 
66
            XINPUT=no
 
67
            [ "$VERBOSE" = "yes" ] && echo "  Could not find $I anywhere in $INCDIRS"
 
68
        fi
 
69
    done
 
70
fi
 
71
 
 
72
# done
 
73
if [ "$XINPUT" != "yes" ]; then
 
74
    [ "$VERBOSE" = "yes" ] && echo "XInput disabled."
 
75
    exit 0
 
76
else
 
77
    [ "$VERBOSE" = "yes" ] && echo "XInput enabled."
 
78
    exit 1
 
79
fi