diff options
Diffstat (limited to 'config.tests/x11/xshape.test')
-rwxr-xr-x | config.tests/x11/xshape.test | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/config.tests/x11/xshape.test b/config.tests/x11/xshape.test new file mode 100755 index 0000000..4fae606 --- /dev/null +++ b/config.tests/x11/xshape.test @@ -0,0 +1,54 @@ +#!/bin/sh + +XSHAPE=yes +XCONFIG=$1/qmake.conf +VERBOSE=$2 +shift 2 +IN_LIBDIRS= +IN_INCDIRS= +PARAMS=$@ +for PARAM in $PARAMS; do + PREFIX=`echo $PARAM | sed 's/^\(..\).*/\1/'` + case $PREFIX in + -L) + CLIBDIR=`echo $PARAM | sed -e 's/^-L//'` + IN_LIBDIRS="$IN_LIBDIRS $CLIBDIR" + ;; + -I) + CINCDIR=`echo $PARAM | sed -e 's/^-I//'` + IN_INCDIRS="$IN_INCDIRS $CINCDIR" + ;; + *) ;; + esac +done + +# debuggery +[ "$VERBOSE" = "yes" ] && echo "XShape auto-detection... ($*)" + +# NOTE: we assume that libXext is always available... +INCS="X11/extensions/shape.h" +XDIRS=`sed -n -e '/^QMAKE_INCDIR_X11[ ]*=/ { s/[^=]*=[ ]*//; s/-I/ /g; p; }' $XCONFIG` +INCDIRS="$IN_INCDIRS $XDIRS /usr/include /include" +for I in $INCS; do + F= + for INCDIR in $INCDIRS; do + if [ -f $INCDIR/$I ]; then + F=yes + [ "$VERBOSE" = "yes" ] && echo " Found $I in $INCDIR" + break + fi + done + if [ -z "$F" ]; then + XSHAPE=no + [ "$VERBOSE" = "yes" ] && echo " Could not find $I anywhere in $INCDIRS" + fi +done + +# done +if [ "$XSHAPE" != "yes" ]; then + [ "$VERBOSE" = "yes" ] && echo "XShape disabled." + exit 0 +else + [ "$VERBOSE" = "yes" ] && echo "XShape enabled." + exit 1 +fi |