blob: d4cb4ba177a04b720c297754c1b38201ee60e6e7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
|
#!/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
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
INC="freetype2/freetype/freetype.h" # libfreetype <= 2.4.9-1.1
if ! [ -f $INCDIR/$INC ]; then
INC="freetype2/freetype.h" # libfreetype >= 2.5.1-1
fi
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
|