diff options
Diffstat (limited to 'config.tests/x11/xinerama.test')
-rwxr-xr-x | config.tests/x11/xinerama.test | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/config.tests/x11/xinerama.test b/config.tests/x11/xinerama.test new file mode 100755 index 000000000..dc015589d --- /dev/null +++ b/config.tests/x11/xinerama.test @@ -0,0 +1,75 @@ +#!/bin/sh + +XINERAMA=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 "Xinerama auto-detection... ($*)" + +# check for lib +XDIRS=`sed -n -e '/^QMAKE_LIBDIR_X11[ ]*=/ { s/[^=]*=[ ]*//; s/-L/ /g; p; }' $XCONFIG` +LIBDIRS="$IN_LIBDIRS $XDIRS /usr/shlib /usr/lib /lib" +F= +for LIBDIR in $LIBDIRS; do + FOUND_LIB=`ls $LIBDIR/libXinerama.* 2>/dev/null` + if [ ! -z "$FOUND_LIB" ]; then + F=yes + [ "$VERBOSE" = "yes" ] && echo " Found Xinerama lib in $LIBDIR" + break + fi +done +if [ -z "$F" ]; then + XINERAMA=no + if [ "$VERBOSE" = "yes" ]; then + echo " Could not find Xinerama lib anywhere in $LIBDIRS" + fi +fi + +# check for headers +if [ "$XINERAMA" = "yes" ]; then + INC="X11/extensions/Xinerama.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 + [ "$VERBOSE" = "yes" ] && echo " Found $INC in $INCDIR" + break + fi + done + if [ -z "$F" ]; then + XINERAMA=no + if [ "$VERBOSE" = "yes" ]; then + echo " Could not find $INC anywhere in $INCDIRS" + fi + fi +fi + +# done +if [ "$XINERAMA" != "yes" ]; then + [ "$VERBOSE" = "yes" ] && echo "Xinerama disabled." + exit 0 +else + [ "$VERBOSE" = "yes" ] && echo "Xinerama enabled." + exit 1 +fi |