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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
|
dnl aclocal.m4 generated automatically by aclocal 1.4-p4
dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl This program is distributed in the hope that it will be useful,
dnl but WITHOUT ANY WARRANTY, to the extent permitted by law; without
dnl even the implied warranty of MERCHANTABILITY or FITNESS FOR A
dnl PARTICULAR PURPOSE.
dnl This file is part of QXi, the Qt XInput Extension.
dnl
dnl Copyright (C) 2000 Daniel Schmitt <[email protected]>
dnl
dnl This file may be distributed under the terms of the Q Public License as
dnl appearing in the file COPYING.QPL included in the packaging of this file.
dnl
dnl The portions of this file that deal with the detection of Qt are
dnl stripped-down versions of macros used in KDE (http://www.kde.org/).
dnl
dnl The originals are copyrighted by
dnl Copyright (C) 1997 Janos Farkas ([email protected])
dnl (C) 1997,98,99 Stephan Kulow ([email protected])
dnl ------------------------------------------------------------------------
dnl Find a file (or one of more files in a list of dirs)
dnl ------------------------------------------------------------------------
dnl
AC_DEFUN(AC_FIND_FILE,
[
$3=NO
for i in $2;
do
for j in $1;
do
if test -r "$i/$j"; then
$3=$i
break 2
fi
done
done
])
dnl ------------------------------------------------------------------------
dnl Find the meta object compiler in the PATH, in $QTDIR/bin, and some
dnl more usual places
dnl ------------------------------------------------------------------------
dnl
AC_DEFUN(AC_PATH_QT_MOC,
[
AC_PATH_PROG(MOC, moc, "", $ac_qt_bindir:$QTDIR/bin:$QTDIR/src/moc:/usr/bin /usr/X11R6/bin:/usr/lib/qt/bin:/usr/lib/qt2/bin:/usr/local/qt/bin:$PATH)
if test -z "$MOC"; then
if test -n "$ac_cv_path_moc"; then
output=`eval "$ac_cv_path_moc --help 2>&1 | sed -e '1q' | grep Qt"`
fi
echo "configure:__oline__: tried to call $ac_cv_path_moc --help 2>&1 | sed -e '1q' | grep Qt" >&AC_FD_CC
echo "configure:__oline__: moc output: $output" >&AC_FD_CC
if test -z "$output"; then
AC_MSG_ERROR([No Qt meta object compiler (moc) found!
Please check whether you installed Qt correctly.
You need to have a running moc binary.
configure tried to run $ac_cv_path_moc and the test didn't
succeed. If configure shouldn't have tried this one, set
the environment variable MOC to the right one before running
configure.
])
fi
fi
AC_SUBST(MOC)
])
AC_DEFUN(AC_PRINT_QT_PROGRAM,
[
cat > conftest.$ac_ext <<EOF
#include "confdefs.h"
#include <qglobal.h>
#include <qapplication.h>
#include <qstyle.h>
int main() {
QStringList *t = new QStringList();
return 0;
}
EOF
])
dnl ------------------------------------------------------------------------
dnl Try to find the Qt headers and libraries.
dnl $(QT_LDFLAGS) will be -Lqtliblocation (if needed)
dnl and $(QT_INCLUDES) will be -Iqthdrlocation (if needed)
dnl ------------------------------------------------------------------------
dnl
AC_DEFUN(AC_PATH_QT,
[
LIBQT="-lqt"
AC_MSG_CHECKING([for Qt])
ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO
qt_libraries=""
qt_includes=""
AC_ARG_WITH(qt-dir,
[ --with-qt-dir=DIR where the root of Qt is installed ],
[ ac_qt_includes="$withval"/include
ac_qt_libraries="$withval"/lib
ac_qt_bindir="$withval"/bin
])
AC_ARG_WITH(qt-includes,
[ --with-qt-includes=DIR where the Qt includes are. ],
[
ac_qt_includes="$withval"
])
ac_qt_libs_given=no
AC_ARG_WITH(qt-libraries,
[ --with-qt-libraries=DIR where the Qt library is installed.],
[ ac_qt_libraries="$withval"
ac_qt_libs_given=yes
])
AC_CACHE_VAL(ac_cv_have_qt,
[#try to guess Qt locations
qt_incdirs="$QTINC /usr/lib/qt/include /usr/local/qt/include /usr/include/qt3 /usr/include/qt /usr/include /usr/lib/qt2/include /usr/X11R6/include/X11/qt $x_includes"
test -n "$QTDIR" && qt_incdirs="$QTDIR/include $QTDIR $qt_incdirs"
qt_incdirs="$ac_qt_includes $qt_incdirs"
AC_FIND_FILE(qstyle.h, $qt_incdirs, qt_incdir)
ac_qt_includes="$qt_incdir"
qt_libdirs="$QTLIB /usr/lib/qt/lib /usr/X11R6/lib /usr/lib /usr/local/qt/lib /usr/lib/qt /usr/lib/qt2/lib $x_libraries"
test -n "$QTDIR" && qt_libdirs="$QTDIR/lib $QTDIR $qt_libdirs"
if test ! "$ac_qt_libraries" = "NO"; then
qt_libdirs="$ac_qt_libraries $qt_libdirs"
fi
test=NONE
qt_libdir=NONE
for dir in $qt_libdirs; do
try="ls -1 $dir/libqt*"
if test=`eval $try 2> /dev/null`; then qt_libdir=$dir; break; else echo "tried $dir" >&AC_FD_CC ; fi
done
ac_qt_libraries="$qt_libdir"
AC_LANG_SAVE
AC_LANG_CPLUSPLUS
ac_cxxflags_safe="$CXXFLAGS"
ac_ldflags_safe="$LDFLAGS"
ac_libs_safe="$LIBS"
CXXFLAGS="$CXXFLAGS -I$qt_incdir $all_includes"
LDFLAGS="-L$x_libraries -L$qt_libdir $all_libraries"
LIBS="$LIBS $LIBQT"
AC_PRINT_QT_PROGRAM
if AC_TRY_EVAL(ac_link) && test -s conftest; then
rm -f conftest*
else
echo "configure: failed program was:" >&AC_FD_CC
cat conftest.$ac_ext >&AC_FD_CC
ac_qt_libraries="NO"
fi
rm -f conftest*
CXXFLAGS="$ac_cxxflags_safe"
LDFLAGS="$ac_ldflags_safe"
LIBS="$ac_libs_safe"
AC_LANG_RESTORE
if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then
ac_cv_have_qt="have_qt=no"
ac_qt_notfound=""
if test "$ac_qt_includes" = NO; then
if test "$ac_qt_libraries" = NO; then
ac_qt_notfound="(headers and libraries)";
else
ac_qt_notfound="(headers)";
fi
else
ac_qt_notfound="(libraries)";
fi
AC_MSG_ERROR([Qt 2 not found. Please check your installation! ]);
else
have_qt="yes"
fi
])
eval "$ac_cv_have_qt"
if test "$have_qt" != yes; then
AC_MSG_RESULT([$have_qt]);
else
ac_cv_have_qt="have_qt=yes \
ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries"
AC_MSG_RESULT([libraries $ac_qt_libraries, headers $ac_qt_includes])
qt_libraries="$ac_qt_libraries"
qt_includes="$ac_qt_includes"
fi
AC_SUBST(qt_libraries)
AC_SUBST(qt_includes)
if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then
QT_INCLUDES="";
else
QT_INCLUDES="-I$qt_includes"
all_includes="$QT_INCLUDES $all_includes"
fi
if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then
QT_LDFLAGS=""
else
QT_LDFLAGS="-L$qt_libraries"
all_libraries="$QT_LDFLAGS $all_libraries"
fi
AC_SUBST(QT_INCLUDES)
AC_SUBST(QT_LDFLAGS)
AC_PATH_QT_MOC
LIB_QT='-lqt'
AC_SUBST(LIB_QT)
])
dnl ------------------------------------------------------------------------
dnl Find libz (required by libpng)
dnl ------------------------------------------------------------------------
dnl
AC_DEFUN(AC_FIND_ZLIB,
[
AC_MSG_CHECKING([for libz])
AC_CACHE_VAL(ac_cv_lib_z,
[
AC_LANG_C
ac_save_LIBS="$LIBS"
LIBS="$all_libraries -lz $LIBSOCKET"
ac_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $all_includes"
AC_TRY_LINK(dnl
[
#include<zlib.h>
],
[return (zlibVersion() == ZLIB_VERSION); ],
eval "ac_cv_lib_z='-lz'",
eval "ac_cv_lib_z=no")
LIBS="$ac_save_LIBS"
CFLAGS="$ac_save_CFLAGS"
])dnl
if eval "test ! \"`echo $ac_cv_lib_z`\" = no"; then
AC_DEFINE_UNQUOTED(HAVE_LIBZ, 1, [Define if you have libz])
LIBZ="$ac_cv_lib_z"
AC_SUBST(LIBZ)
AC_MSG_RESULT($ac_cv_lib_z)
else
AC_MSG_RESULT(no)
LIBZ=""
AC_SUBST(LIBZ)
fi
])
dnl ------------------------------------------------------------------------
dnl Find libpng (required by Qt 2)
dnl ------------------------------------------------------------------------
dnl
AC_DEFUN(AC_FIND_PNG,
[
AC_REQUIRE([AC_FIND_ZLIB])
AC_MSG_CHECKING([for libpng])
AC_CACHE_VAL(ac_cv_lib_png,
[
ac_save_LIBS="$LIBS"
LIBS="$LIBS $all_libraries -lpng $LIBZ -lm -lX11 $LIBSOCKET"
ac_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $all_includes"
AC_LANG_C
AC_TRY_LINK(dnl
[
#include<png.h>
],
[
png_structp png_ptr = png_create_read_struct( /* image ptr */
PNG_LIBPNG_VER_STRING, 0, 0, 0 );
return( png_ptr != 0 );
],
eval "ac_cv_lib_png='-lpng $LIBZ -lm'",
eval "ac_cv_lib_png=no"
)
LIBS="$ac_save_LIBS"
CFLAGS="$ac_save_CFLAGS"
])dnl
if eval "test ! \"`echo $ac_cv_lib_png`\" = no"; then
AC_DEFINE_UNQUOTED(HAVE_LIBPNG, 1, [Define if you have libpng])
LIBPNG="$ac_cv_lib_png"
AC_SUBST(LIBPNG)
AC_MSG_RESULT($ac_cv_lib_png)
else
AC_MSG_RESULT(no)
LIBPNG=""
AC_SUBST(LIBPNG)
fi
])
|