summaryrefslogtreecommitdiffstats
path: root/config.tests/unix/cups.test
diff options
context:
space:
mode:
Diffstat (limited to 'config.tests/unix/cups.test')
-rwxr-xr-xconfig.tests/unix/cups.test82
1 files changed, 82 insertions, 0 deletions
diff --git a/config.tests/unix/cups.test b/config.tests/unix/cups.test
new file mode 100755
index 0000000..0b97e2b
--- /dev/null
+++ b/config.tests/unix/cups.test
@@ -0,0 +1,82 @@
+#!/bin/sh
+
+CUPS=yes
+XPLATFORM=`basename $1`
+XCONFIG=$1/qmake.conf
+VERBOSE=$2
+shift 2
+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 "CUPS auto-detection... ($*)"
+
+# check for the CUPS library
+LIBS=cups
+LIBDIRS="$IN_LIBDIRS /usr/shlib /usr/lib /lib"
+if [ -z "$LIBS" ]; then
+ CUPS=no
+ [ "$VERBOSE" = "yes" ] && echo " No CUPS libraries specified."
+else
+ 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 "$F" ]; then
+ CUPS=no
+ [ "VERBOSE" = "yes" ] && echo " Could not find CUPS lib anywhere in $LIBDIRS"
+ fi
+ done
+fi
+
+# check for cups/cups.h
+if [ "$CUPS" = "yes" ]
+then
+ INCS="cups/cups.h"
+ INCDIRS="$IN_INCDIRS /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
+ CUPS=no
+ [ "$VERBOSE" = "yes" ] && echo " Could not find $I anywhere in $INCDIRS"
+ fi
+ done
+fi
+
+# done
+if [ "$CUPS" != "yes" ]; then
+ [ "$VERBOSE" = "yes" ] && echo "CUPS disabled."
+ exit 0
+else
+ [ "$VERBOSE" = "yes" ] && echo "CUPS enabled."
+ exit 1
+fi