diff options
author | Timothy Pearson <[email protected]> | 2011-11-08 12:31:36 -0600 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2011-11-08 12:31:36 -0600 |
commit | d796c9dd933ab96ec83b9a634feedd5d32e1ba3f (patch) | |
tree | 6e3dcca4f77e20ec8966c666aac7c35bd4704053 /config.tests/x11/opengl.test | |
download | tqt3-d796c9dd933ab96ec83b9a634feedd5d32e1ba3f.tar.gz tqt3-d796c9dd933ab96ec83b9a634feedd5d32e1ba3f.zip |
Test conversion to TQt3 from Qt3 8c6fc1f8e35fd264dd01c582ca5e7549b32ab731
Diffstat (limited to 'config.tests/x11/opengl.test')
-rwxr-xr-x | config.tests/x11/opengl.test | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/config.tests/x11/opengl.test b/config.tests/x11/opengl.test new file mode 100755 index 000000000..35a3918eb --- /dev/null +++ b/config.tests/x11/opengl.test @@ -0,0 +1,103 @@ +#!/bin/sh + +OPENGL=yes +XCONFIG=$1/qmake.conf +THREAD=$2 +VERBOSE=$3 +shift 3 +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 "OpenGL auto-detection... ($*)" + +# check for lib +LIBS=`sed -n -e '/^QMAKE_LIBS_OPENGL[ ]*=/ { s/[^=]*=[ ]*//; s/-l/ /g; p; }' $XCONFIG` +GLDIRS=`sed -n -e '/^QMAKE_LIBDIR_OPENGL[ ]*=/ { s/[^=]*=[ ]*//; p; }' $XCONFIG` +XDIRS=`sed -n -e '/^QMAKE_LIBDIR_X11[ ]*=/ { s/[^=]*=[ ]*//; p; }' $XCONFIG` +LIBDIRS="$IN_LIBDIRS $GLDIRS $XDIRS /usr/shlib /usr/lib /lib" +for L in $LIBS; do + FOUND_LIB= + F= + for LIBDIR in $LIBDIRS; do + FOUND_LIB=`ls $LIBDIR/lib$L.* 2>/dev/null` + if [ ! -z "$FOUND_LIB" ]; then + F=yes + [ "$VERBOSE" = "yes" ] && echo " Found $L lib in $LIBDIR" + break + fi + done + if [ ! -z "$FOUND_LIB" -a ! "x$THREAD" = "xyes" -a ! -z "$F" ]; then + LDD_P=`which ldd 2>/dev/null` + if [ ! -z "$LDD_P" ]; then + for a in $FOUND_LIB; do + if $LDD_P $a 2>/dev/null | grep -i thread >/dev/null 2>&1; then + FOUND_LIB=$a + F_REASON="threads" + F= + break + fi + done + fi + fi + if [ -z "$F" ]; then + OPENGL=no + if [ "x$F_REASON" = "xthreads" ]; then + echo + echo "WARNING: $FOUND_LIB is threaded!" + echo "The Qt OpenGL module retquires Qt to be configured with -thread." + echo + else + [ "$VERBOSE" = "yes" ] && echo " Could not find $L lib anywhere in $LIBDIRS" + fi + break + fi +done + +# check for headers +if [ "$OPENGL" = "yes" ]; then + INCS="GL/gl.h GL/glu.h" + GLDIRS=`sed -n -e '/^QMAKE_INCDIR_OPENGL[ ]*=/ { s/[^=]*=[ ]*//; p; }' $XCONFIG` + XDIRS=`sed -n -e '/^QMAKE_INCDIR_X11[ ]*=/ { s/[^=]*=[ ]*//; p; }' $XCONFIG` + INCDIRS="$IN_INCDIRS $GLDIRS $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 + OPENGL=no + [ "$VERBOSE" = "yes" ] && echo " Could not find $I anywhere in $INCDIRS" + break + fi + done +fi + +# done +if [ "$OPENGL" != "yes" ]; then + [ "$VERBOSE" = "yes" ] && echo "OpenGL disabled." + exit 0 +else + [ "$VERBOSE" = "yes" ] && echo "OpenGL enabled." + exit 1 +fi |