diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-07-10 15:24:15 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2011-07-10 15:24:15 -0500 |
commit | bd0f3345a938b35ce6a12f6150373b0955b8dd12 (patch) | |
tree | 7a520322212d48ebcb9fbe1087e7fca28b76185c /config.tests/x11/xfreetype.test | |
download | qt3-bd0f3345a938b35ce6a12f6150373b0955b8dd12.tar.gz qt3-bd0f3345a938b35ce6a12f6150373b0955b8dd12.zip |
Add Qt3 development HEAD version
Diffstat (limited to 'config.tests/x11/xfreetype.test')
-rwxr-xr-x | config.tests/x11/xfreetype.test | 180 |
1 files changed, 180 insertions, 0 deletions
diff --git a/config.tests/x11/xfreetype.test b/config.tests/x11/xfreetype.test new file mode 100755 index 0000000..5cabc32 --- /dev/null +++ b/config.tests/x11/xfreetype.test @@ -0,0 +1,180 @@ +#!/bin/sh + +XFT=yes +XFT2=no +XFT2_HEADER=no +XCONFIG=$1/qmake.conf +VERBOSE=$2 +SRCDIR=$3 +OUTDIR=$4 +shift 4 +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 "Xft auto-detection... ($*)" + +# cleanup... +rm -f $OUTDIR/config.tests/x11/xft.cfg +rm -f $OUTDIR/config.tests/x11/xft.inc +rm -f $OUTDIR/config.tests/x11/xft.lib + +# check for the Xft library +XDIRS=`sed -n -e '/^QMAKE_LIBDIR_X11[ ]*=/ { s/[^=]*=[ ]*//; s/-L/ /g; p; }' $XCONFIG` +LIBDIRS="$IN_LIBDIRS $XDIRS /usr/shlib /usr/lib /lib" +F= +LIBS="Xft2 Xft" +for LIB in $LIBS; do + for LIBDIR in $LIBDIRS; do + EXTENSIONS="a so sl" + for E in $EXTENSIONS; do + if [ -f "$LIBDIR/lib$LIB.$E" ]; then + F="$LIB" + [ "$VERBOSE" = "yes" ] && echo " Found lib$LIB.$E in $LIBDIR" + break + fi + done + done + [ -n "$F" ] && break +done +if [ -z "$F" ]; then + XFT=no + [ "$VERBOSE" = "yes" ] && echo " Could not find Xft lib anywhere in $LIBDIRS" +fi +LIBXFT="-l$F -lfreetype" + +# check for X11/Xft/Xft.h +XFT_H= +if [ "$XFT" = "yes" ]; then + 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 + INCS="X11/Xft/Xft2.h X11/Xft/Xft.h" + for INC in $INCS; do + if [ -f $INCDIR/$INC ]; then + F=yes + [ "$INC" = "X11/Xft/Xft2.h" ] && XFT2_HEADER=yes + XFT_H=$INCDIR/$INC + [ "$VERBOSE" = "yes" ] && echo " Found $INC in $INCDIR" + break + fi + done + done + if [ -z "$F" ]; then + XFT=no + [ "$VERBOSE" = "yes" ] && echo " Could not find $INC anywhere in $INCDIRS" + fi +fi + +# detect major version of Xft +if [ "$XFT" = "yes" ]; then + XFT_MAJOR=`grep XFT_MAJOR $XFT_H | head -n 1 | awk '{ print \$3 }'` + XFT_MINOR=`grep XFT_MINOR $XFT_H | head -n 1 | awk '{ print \$3 }'` + XFT_REVISION=`grep XFT_REVISION $XFT_H | head -n 1 | awk '{ print \$3 }'` + [ "$VERBOSE" = "yes" ] && echo " Found Xft version $XFT_MAJOR.$XFT_MINOR.$XFT_REVISION" + if [ "$XFT_MAJOR" = "2" ]; then + XFT2=yes + LIBXFT="$LIBXFT -lfontconfig" + fi +fi + +# find XftFreetype.h if using Xft1 +if [ "$XFT" = "yes" ] && [ "$XFT2" = "no" ]; then + INC="X11/Xft/XftFreetype.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 + XFT=no + [ "$VERBOSE" = "yes" ] && echo " Could not find $INC anywhere in $INCDIRS" + fi +fi + +# check for freetype2 headers +FREETYPE2_INCDIR= +if [ "$XFT" = "yes" ]; then + INC="freetype2/freetype/freetype.h" + XDIRS=`sed -n -e '/^QMAKE_INCDIR_X11[ ]*=/ { s/[^=]*=[ ]*//; s/-I/ /g; p; }' $XCONFIG` + LDIRS=`sed -n -e '/^QMAKE_INCDIR[ ]*=/ { s/[^=]*=[ ]*//; s/-I/ /g; p; }' $XCONFIG` + INCDIRS="$IN_INCDIRS $XDIRS $LDIRS /usr/include /include" + F= + for INCDIR in $INCDIRS; do + if [ -f $INCDIR/$INC ]; then + # detect major version of freetype2 + FREETYPE_MAJOR=`grep "#define FREETYPE_MAJOR" $INCDIR/$INC | head -n 1 | awk '{ print \$3 }'` + FREETYPE_MINOR=`grep "#define FREETYPE_MINOR" $INCDIR/$INC | head -n 1 | awk '{ print \$3 }'` + FREETYPE_PATCH=`grep "#define FREETYPE_PATCH" $INCDIR/$INC | head -n 1 | awk '{ print \$3 }'` + test -z "$FREETYPE_PATCH" && FREETYPE_PATCH="0" + [ "$VERBOSE" = "yes" ] && \ + echo " Found Freetype version $FREETYPE_MAJOR.$FREETYPE_MINOR.$FREETYPE_PATCH" + if [ "$FREETYPE_MAJOR" -eq "2" ] \ + && [ "$FREETYPE_MINOR" -ge "0" -a "$FREETYPE_PATCH" -ge "9" ] \ + || [ "$FREETYPE_MINOR" -ge "1" ]; then + F=yes + FREETYPE2_INCDIR=$INCDIR/freetype2 + [ "$VERBOSE" = "yes" ] && echo " Found $INC in $INCDIR" + break + fi + fi + done + if [ -z "$F" ]; then + XFT=no + [ "$VERBOSE" = "yes" ] && echo " Could not find $INC anywhere in $INCDIRS" + fi +fi + +# check for fontconfig headers when using Xft2 +if [ "$XFT" = "yes" ] && [ "$XFT2" = "yes" ]; then + INC="fontconfig/fontconfig.h" + XDIRS=`sed -n -e '/^QMAKE_INCDIR_X11[ ]*=/ { s/[^=]*=[ ]*//; s/-I/ /g; p; }' $XCONFIG` + LDIRS=`sed -n -e '/^QMAKE_INCDIR[ ]*=/ { s/[^=]*=[ ]*//; s/-I/ /g; p; }' $XCONFIG` + INCDIRS="$IN_INCDIRS $XDIRS $LDIRS /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 + XFT=no + [ "$VERBOSE" = "yes" ] && echo " Could not find $INC anywhere in $INCDIRS" + fi +fi + +# done +if [ "$XFT" != "yes" ]; then + [ "$VERBOSE" = "yes" ] && echo "Xft disabled." + exit 0 +else + [ "$VERBOSE" = "yes" ] && echo "Xft enabled." + [ "$XFT2_HEADER" = "yes" ] && \ + echo "xft2header" > $OUTDIR/config.tests/x11/xft.cfg + echo "$FREETYPE2_INCDIR" > $OUTDIR/config.tests/x11/xft.inc + echo "$LIBXFT" > $OUTDIR/config.tests/x11/xft.lib + exit 1 +fi |