diff options
Diffstat (limited to 'tqtinterface/qt4/config.tests/unix/checkavail')
-rwxr-xr-x | tqtinterface/qt4/config.tests/unix/checkavail | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/tqtinterface/qt4/config.tests/unix/checkavail b/tqtinterface/qt4/config.tests/unix/checkavail new file mode 100755 index 0000000..1dd59c9 --- /dev/null +++ b/tqtinterface/qt4/config.tests/unix/checkavail @@ -0,0 +1,124 @@ +#!/bin/sh +# +# usage: $1 is featurename, $2 verbose +# $3..$n librarynames like '-llibmysqlclient.*' or (optional) extra library paths like '-L/usr/local/lib' +# or filenames like "mysql.h" and (optional) extra include paths like '-I/usr/local/include' +# returns 0 on success + +SUCCESS= +MODULE_NAME=$1 +VERBOSE=$2 +shift 2 +LIBDIRS="/lib /usr/lib" +LIBNAMES="" +INCLUDEDIRS="/usr/include" +INCLUDES="" + +PARAMS=$@ +for PARAM in $PARAMS +do + PREFIX=`echo $PARAM | sed 's/^\(..\).*/\1/'` + case $PREFIX in + -L) + CLIBDIR=`echo $PARAM | sed -e 's/^-L//'` + LIBDIRS="$LIBDIRS $CLIBDIR" + ;; + -l) + CLIBNAME=`echo $PARAM | sed -e 's/^-l//'` + LIBNAMES="$LIBNAMES lib${CLIBNAME}.*" + ;; + -I) + CINCDIR=`echo $PARAM | sed -e 's/^-I//'` + INCLUDEDIRS="$INCLUDEDIRS $CINCDIR" + ;; + *) + INCLUDES="$PARAM $INCLUDES" + ;; + esac +done + +# debuggery + +if [ "$VERBOSE" = "yes" ] +then + echo "$MODULE_NAME auto-detection..." +# echo "searching for $LIBNAMES in $LIBDIRS" +# echo "and $INCLUDES in $INCLUDEDIRS" +fi + + +# check for lib +for LIBNAME in $LIBNAMES +do + SUCCESS="" + for LIBDIR in $LIBDIRS + do + FOUND_LIB=`ls $LIBDIR/$LIBNAME 2>/dev/null` + if [ ! -z "$FOUND_LIB" ] + then + SUCCESS=yes + if [ "$VERBOSE" = "yes" ] + then + echo " Found $LIBNAME in $LIBDIR" + fi + break + fi + done + if [ -z "$SUCCESS" ] + then + SUCCESS=no + if [ "$VERBOSE" = "yes" ] + then + echo " Could not tqfind $LIBNAME anywhere in $LIBDIRS" + fi + break + fi +done + +# check for includes +if [ "$SUCCESS" = "yes" ] +then + for INCLUDE in $INCLUDES + do + SUCCESS="" + for INCLUDEDIR in $INCLUDEDIRS + do + FOUND_INC=`ls $INCLUDEDIR/$INCLUDE 2>/dev/null` + if [ ! -z "$FOUND_INC" ] + then + SUCCESS=yes + if [ "$VERBOSE" = "yes" ] + then + echo " Found $INCLUDE in $INCLUDEDIR" + fi + break + fi + done + if [ -z "$SUCCESS" ] + then + SUCCESS=no + if [ "$VERBOSE" = "yes" ] + then + echo " Could not tqfind $INCLUDE anywhere in $INCLUDEDIRS" + fi + break + fi + done +fi + +if [ "$SUCCESS" != "yes" ] +then + if [ "$VERBOSE" = "yes" ] + then + echo "$MODULE_NAME disabled." + fi + exit 1 +else + if [ "$VERBOSE" = "yes" ] + then + echo "$MODULE_NAME enabled." + fi + exit 0 +fi +exit 1 + |