-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathacinclude.m4
200 lines (183 loc) · 6.09 KB
/
acinclude.m4
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
# Qt location code adapted from iTALC (italc.sourceforge.net) -- with thanks!
# Check for Qt compiler flags, linker flags, and binary packages
AC_DEFUN([RG_CHECK_QT],
[
AC_REQUIRE([AC_PROG_CXX])
AC_REQUIRE([AC_PATH_X])
AC_MSG_CHECKING([QTDIR])
AC_ARG_WITH([qtdir], [ --with-qtdir=DIR Qt installation directory [default=$QTDIR]], QTDIR=$withval)
# Check that QTDIR is defined or that --with-qtdir given
if test x"$QTDIR" = x ; then
# some usual Qt locations
QT_SEARCH="/usr /opt /usr/lib/qt"
else
case "$QTDIR" in *3*)
AC_MSG_WARN([
The QTDIR environment variable is set to "$QTDIR".
This looks suspiciously like the location of a Qt3 installation
instead of the Qt4 installation we require. If configure fails,
please ensure QTDIR is either set correctly or not set at all.
])
;;
esac
QT_SEARCH=$QTDIR
QTDIR=""
fi
for i in $QT_SEARCH ; do
QT_INCLUDE_SEARCH="include/qt4 include"
for j in $QT_INCLUDE_SEARCH ; do
if test -f $i/$j/Qt/qglobal.h && test x$QTDIR = x ; then
QTDIR=$i
QT_INCLUDES=$i/$j
fi
done
done
if test x"$QTDIR" = x ; then
AC_MSG_ERROR([*** Failed to find Qt4 installation. QTDIR must be defined, or --with-qtdir option given])
fi
AC_MSG_RESULT([$QTDIR])
# Change backslashes in QTDIR to forward slashes to prevent escaping
# problems later on in the build process, mainly for Cygwin build
# environment using MSVC as the compiler
QTDIR=`echo $QTDIR | sed 's/\\\\/\\//g'`
AC_MSG_CHECKING([Qt includes])
# Check where includes are located
if test x"$QT_INCLUDES" = x ; then
AC_MSG_ERROR([
Failed to find required Qt4 headers.
Please ensure you have the Qt4 development files installed,
and if necessary set QTDIR to the location of your Qt4 installation.
])
fi
AC_MSG_RESULT([$QT_INCLUDES])
# Check that moc is in path
AC_CHECK_PROG(MOC, moc-qt4, $QTDIR/bin/moc-qt4,,$QTDIR/bin/)
if test x$MOC = x ; then
AC_CHECK_PROG(MOC, moc, $QTDIR/bin/moc,,$QTDIR/bin/)
if test x$MOC = x ; then
AC_CHECK_PROG(MOC, moc.exe, $QTDIR/bin/moc.exe,,$QTDIR/bin/)
if test x$MOC = x ; then
AC_MSG_ERROR([
Failed to find required moc-qt4 or moc program.
Please ensure you have the Qt4 development files installed,
and if necessary set QTDIR to the location of your Qt4 installation.
])
fi
fi
fi
# Check that uic is in path
AC_CHECK_PROG(UIC, uic-qt4, $QTDIR/bin/uic-qt4,,$QTDIR/bin/)
if test x$UIC = x ; then
AC_CHECK_PROG(UIC, uic, $QTDIR/bin/uic,,$QTDIR/bin/)
if test x$UIC = x ; then
AC_CHECK_PROG(UIC, uic.exe, $QTDIR/bin/uic.exe,,$QTDIR/bin/)
if test x$UIC = x ; then
AC_MSG_ERROR([
Failed to find required uic-qt4 or uic program.
Please ensure you have the Qt4 development files installed,
and if necessary set QTDIR to the location of your Qt4 installation.
])
fi
fi
fi
# Check that rcc is in path
AC_CHECK_PROG(RCC, rcc-qt4, $QTDIR/bin/rcc-qt4,,$QTDIR/bin/)
if test x$RCC = x ; then
AC_CHECK_PROG(RCC, rcc, $QTDIR/bin/rcc,,$QTDIR/bin/)
if test x$RCC = x ; then
AC_CHECK_PROG(RCC, rcc.exe, $QTDIR/bin/rcc.exe,,$QTDIR/bin/)
if test x$RCC = x ; then
AC_MSG_ERROR([
Failed to find required rcc-qt4 or rcc program.
Please ensure you have the Qt4 development files installed,
and if necessary set QTDIR to the location of your Qt4 installation.
])
fi
fi
fi
# lupdate is the Qt translation-update utility.
AC_CHECK_PROG(LUPDATE, lupdate-qt4, $QTDIR/bin/lupdate-qt4,,$QTDIR/bin/)
if test x$LUPDATE = x ; then
AC_CHECK_PROG(LUPDATE, lupdate, $QTDIR/bin/lupdate,,$QTDIR/bin/)
if test x$LUPDATE = x ; then
AC_CHECK_PROG(LUPDATE, lupdate.exe, $QTDIR/bin/lupdate.exe,,$QTDIR/bin/)
if test x$LUPDATE = x ; then
AC_MSG_WARN([
Failed to find lupdate-qt4 or lupdate program.
This program is not needed for a simple build,
but it should be part of a Qt4 development installation
and its absence is troubling.
])
fi
fi
fi
# lrelease is the Qt translation-release utility.
AC_CHECK_PROG(LRELEASE, lrelease-qt4, $QTDIR/bin/lrelease-qt4,,$QTDIR/bin/)
if test x$LRELEASE = x ; then
AC_CHECK_PROG(LRELEASE, lrelease, $QTDIR/bin/lrelease,,$QTDIR/bin/)
if test x$LRELEASE = x ; then
AC_CHECK_PROG(LRELEASE, lrelease.exe, $QTDIR/bin/lrelease.exe,,$QTDIR/bin/)
if test x$LRELEASE = x ; then
AC_MSG_WARN([
Failed to find lrelease-qt4 or lrelease program.
This program is not needed for a simple build,
but it should be part of a Qt4 development installation
and its absence is troubling.
])
fi
fi
fi
QT_CXXFLAGS="-I$QT_INCLUDES/QtGui -I$QT_INCLUDES/QtXml -I$QT_INCLUDES/QtNetwork -I$QT_INCLUDES/QtCore -I$QT_INCLUDES"
AC_MSG_CHECKING([QTLIBDIR])
AC_ARG_WITH([qtlibdir], [ --with-qtlibdir=DIR Qt library directory [default=$QTLIBDIR]], QTLIBDIR=$withval)
if test x"$QTLIBDIR" = x ; then
# bin is included because that's where Qt DLLs hide on Windows
# On Mandriva Qt libraries are in /usr/lib or /usr/lib64 although
# QTDIR is /usr/lib/qt4
QTLIB_SEARCH="$QTDIR/lib $QTDIR/lib64 $QTDIR/lib32 $QTDIR/bin /usr/lib /usr/lib/${build_alias} /usr/lib64"
else
case "$QTLIBDIR" in *3*)
AC_MSG_WARN([
The QTLIBDIR environment variable is set to "$QTLIBDIR".
This looks suspiciously like the location for Qt3 libraries
instead of the Qt4 libraries we require. If configure fails,
please ensure QTLIBDIR is either set correctly or not set at all.
])
;;
esac
QTLIB_SEARCH="$QTLIBDIR"
QTDIR=""
fi
QTLIB_EXTS=".so .a .dylib 4.dll"
QTLIB_NEED_4=""
for i in $QTLIB_SEARCH ; do
for j in $QTLIB_EXTS ; do
if test -f $i/libQtGui$j && test x$QTLIBDIR = x ; then
QTLIBDIR=$i
elif test -f $i/QtGui$j && test x$QTLIBDIR = x ; then
QTLIBDIR=$i
if test x$j = x4.dll ; then
QTLIB_NEED_4=1
fi
fi
done
done
if test x"$QTLIBDIR" = x ; then
AC_MSG_ERROR([
Failed to find required Qt4 GUI link entry point (libQtGui.so or equivalent).
Define QTLIBDIR or use --with-qtlibdir to specify the library location.
])
fi
AC_MSG_RESULT([$QTLIBDIR])
if test x$QTLIB_NEED_4 = x ; then
QT_LIBS="-L$QTLIBDIR -lQtGui -lQtXml -lQtNetwork -lQtCore"
else
QT_LIBS="-L$QTLIBDIR -lQtGui4 -lQtXml4 -lQtNetwork4 -lQtCore4"
fi
AC_MSG_CHECKING([QT_CXXFLAGS])
AC_MSG_RESULT([$QT_CXXFLAGS])
AC_MSG_CHECKING([QT_LIBS])
AC_MSG_RESULT([$QT_LIBS])
AC_SUBST(QT_CXXFLAGS)
AC_SUBST(QT_LIBS)
])