4
dnl This file is part of the KDE libraries/packages
5
dnl Copyright (C) 1997 Janos Farkas (chexum@shadow.banki.hu)
6
dnl (C) 1997,98,99 Stephan Kulow (coolo@kde.org)
7
dnl (C) 2002 g10 Code GmbH
8
dnl Modified for PINENTRY by Marcus Brinkmann.
10
dnl This file is free software; you can redistribute it and/or
11
dnl modify it under the terms of the GNU Library General Public
12
dnl License as published by the Free Software Foundation; either
13
dnl version 2 of the License, or (at your option) any later version.
15
dnl This library is distributed in the hope that it will be useful,
16
dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
17
dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
dnl Library General Public License for more details.
20
dnl You should have received a copy of the GNU Library General Public License
21
dnl along with this library; see the file COPYING.LIB. If not, write to
22
dnl the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23
dnl Boston, MA 02111-1307, USA.
25
dnl ------------------------------------------------------------------------
26
dnl Find a file (or one of more files in a list of dirs)
27
dnl ------------------------------------------------------------------------
29
AC_DEFUN([QT_FIND_FILE],
36
echo "configure: __oline__: $i/$j" >&AS_MESSAGE_LOG_FD
37
if test -r "$i/$j"; then
38
echo "taking that" >&AS_MESSAGE_LOG_FD
46
dnl ------------------------------------------------------------------------
47
dnl Find the meta object compiler in the PATH,
48
dnl in $QTDIR/bin, and some more usual places
49
dnl ------------------------------------------------------------------------
51
AC_DEFUN([QT_PATH_MOC],
54
for dir in $qt_dirs; do
55
qt_bindirs="$qt_bindirs:$dir/bin:$dir/src/moc"
57
qt_bindirs="$qt_bindirs:/usr/bin:/usr/X11R6/bin:/usr/local/qt/bin"
58
if test ! "$ac_qt_bindir" = "NO"; then
59
qt_bindirs="$ac_qt_bindir:$qt_bindirs"
62
AC_PATH_PROG(MOC, moc, no, [$qt_bindirs])
63
if test "$MOC" = no; then
64
#AC_MSG_ERROR([No Qt meta object compiler (moc) found!
65
#Please check whether you installed Qt correctly.
66
#You need to have a running moc binary.
67
#configure tried to run $ac_cv_path_moc and the test didn't
68
#succeed. If configure shouldn't have tried this one, set
69
#the environment variable MOC to the right one before running
80
dnl ------------------------------------------------------------------------
81
dnl Find the header files and libraries for the X Window System.
82
dnl Extended the macro AC_PATH_XTRA.
83
dnl ------------------------------------------------------------------------
89
[ --enable-embedded link to Qt-embedded, don't use X],
90
qt_use_emb=$enableval,
96
[ --enable-palmtop link to Qt-embedded, don't use X, link to the Qt Palmtop Environment],
97
qt_use_emb_palm=$enableval,
101
if test "$qt_use_emb" = "no"; then
104
if test "$no_x" = yes; then
105
AC_MSG_ERROR([Can't find X. Please check your installation and add the correct paths!])
107
QT_CXXFLAGS="$X_CFLAGS"
109
QT_LIBS="$X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS"
112
dnl We're using QT Embedded
113
QT_CXXFLAGS="-fno-rtti -DQWS"
116
QTE_NORTTI="-fno-rtti -DQWS"
118
AC_SUBST(QT_CXXFLAGS)
124
AC_DEFUN([QT_PRINT_PROGRAM],
126
AC_REQUIRE([QT_CHECK_VERSION])
127
cat > conftest.$ac_ext <<EOF
128
#include "confdefs.h"
130
#include <qapplication.h>
132
if test "$qt_ver" = "2"; then
133
cat >> conftest.$ac_ext <<EOF
139
if test $qt_subver -gt 0; then
140
cat >> conftest.$ac_ext <<EOF
141
#include <qiconview.h>
146
if test "$qt_ver" = "3"; then
147
cat >> conftest.$ac_ext <<EOF
149
#include <qstylefactory.h>
150
#include <private/qucomextra_p.h>
154
echo "#if ! ($qt_verstring)" >> conftest.$ac_ext
155
cat >> conftest.$ac_ext <<EOF
161
if test "$qt_ver" = "2"; then
162
cat >> conftest.$ac_ext <<EOF
163
QStringList *t = new QStringList();
166
if test $qt_subver -gt 0; then
167
cat >> conftest.$ac_ext <<EOF
169
iv.setWordWrapIconText(false);
171
s.setLatin1("Elvis is alive", 14);
175
if test "$qt_ver" = "3"; then
176
cat >> conftest.$ac_ext <<EOF
177
(void)QStyleFactory::create(QString::null);
178
QCursor c(Qt::WhatsThisCursor);
181
cat >> conftest.$ac_ext <<EOF
188
AC_DEFUN([QT_CHECK_VERSION],
190
if test -z "$1"; then
194
qt_subver=`echo "$1" | sed -e 's#[0-9][0-9]*\.\([0-9][0-9]*\).*#\1#'`
195
# following is the check if subversion isn�t found in passed argument
196
if test "$qt_subver" = "$1"; then
199
qt_ver=`echo "$1" | sed -e 's#^\([0-9][0-9]*\)\..*#\1#'`
200
if test "$qt_ver" = "1"; then
205
if test -z "$2"; then
206
if test "$qt_ver" = "2"; then
207
if test $qt_subver -gt 0; then
208
qt_minversion=">= Qt 2.2.2"
210
qt_minversion=">= Qt 2.0.2"
213
if test "$qt_ver" = "3"; then
214
qt_minversion=">= Qt 3.0.1"
216
if test "$qt_ver" = "1"; then
217
qt_minversion=">= 1.42 and < 2.0"
223
if test -z "$3"; then
224
if test $qt_ver = 3; then
225
qt_verstring="QT_VERSION >= 301"
227
if test $qt_ver = 2; then
228
if test $qt_subver -gt 0; then
229
qt_verstring="QT_VERSION >= 222"
231
qt_verstring="QT_VERSION >= 200"
234
if test $qt_ver = 1; then
235
qt_verstring="QT_VERSION >= 142 && QT_VERSION < 200"
241
if test $qt_ver = 3; then
242
qt_dirs="$QTDIR /usr/lib/qt3 /usr/lib/qt"
244
if test $qt_ver = 2; then
245
qt_dirs="$QTDIR /usr/lib/qt2 /usr/lib/qt"
247
if test $qt_ver = 1; then
248
qt_dirs="$QTDIR /usr/lib/qt"
253
dnl ------------------------------------------------------------------------
254
dnl Try to find the Qt headers and libraries.
255
dnl $(QT_LDFLAGS) will be -Lqtliblocation (if needed)
256
dnl and $(QT_INCLUDES) will be -Iqthdrlocation (if needed)
257
dnl ------------------------------------------------------------------------
259
AC_DEFUN([QT_PATH_1_3],
261
AC_REQUIRE([QT_PATH_X])
262
AC_REQUIRE([QT_CHECK_VERSION])
264
dnl ------------------------------------------------------------------------
265
dnl Add configure flag to enable linking to MT version of Qt library.
266
dnl ------------------------------------------------------------------------
270
[ --disable-mt link to non-threaded Qt (deprecated)],
271
qt_use_mt=$enableval,
273
if test $qt_ver = 3; then
283
dnl ------------------------------------------------------------------------
284
dnl If we not get --disable-qt-mt then adjust some vars for the host.
285
dnl ------------------------------------------------------------------------
289
if test "x$qt_use_mt" = "xyes"; then
291
if test "x$qt_use_threading" = "xyes"; then
292
QT_CXXFLAGS="$USE_THREADS -DQT_THREAD_SUPPORT $QT_CXXFLAGS"
293
QT_MT_LDFLAGS="$USE_THREADS"
294
QT_MT_LIBS="$LIBPTHREAD"
299
AC_SUBST(QT_MT_LDFLAGS)
302
dnl ------------------------------------------------------------------------
303
dnl If we haven't been told how to link to Qt, we work it out for ourselves.
304
dnl ------------------------------------------------------------------------
305
if test -z "$LIBQT_GLOB"; then
306
if test "x$qt_use_emb" = "xyes"; then
307
LIBQT_GLOB="libqte.*"
313
if test -z "$LIBQT"; then
314
dnl ------------------------------------------------------------
315
dnl If we got --enable-embedded then adjust the Qt library name.
316
dnl ------------------------------------------------------------
317
if test "x$qt_use_emb" = "xyes"; then
324
if test -z "$LIBQPE"; then
325
dnl ------------------------------------------------------------
326
dnl If we got --enable-palmtop then add -lqpe to the link line
327
dnl ------------------------------------------------------------
328
if test "x$qt_use_emb" = "xyes"; then
329
if test "x$qt_use_emb_palm" = "xyes"; then
339
dnl ------------------------------------------------------------------------
340
dnl If we got --enable-qt-mt then adjust the Qt library name for the host.
341
dnl ------------------------------------------------------------------------
343
if test "x$qt_use_mt" = "xyes"; then
344
if test -z "$LIBQT"; then
349
LIBQT_GLOB="lib$qtlib-mt.*"
350
USING_QT_MT="using -mt"
355
AC_MSG_CHECKING([for Qt])
357
QT_LIBS="$LIBQT $QT_LIBS"
358
test -z "$QT_MT_LIBS" || QT_LIBS="$QT_LIBS $QT_MT_LIBS"
360
ac_qt_includes=NO ac_qt_libraries=NO ac_qt_bindir=NO
364
[ --with-qt-dir=DIR where the root of Qt is installed ],
365
[ ac_qt_includes="$withval"/include
366
ac_qt_libraries="$withval"/lib
367
ac_qt_bindir="$withval"/bin
370
AC_ARG_WITH(qt-includes,
371
[ --with-qt-includes=DIR where the Qt includes are. ],
373
ac_qt_includes="$withval"
378
AC_ARG_WITH(qt-libraries,
379
[ --with-qt-libraries=DIR where the Qt library is installed.],
380
[ ac_qt_libraries="$withval"
381
kde_qt_libs_given=yes
384
AC_CACHE_VAL(ac_cv_have_qt,
385
[#try to guess Qt locations
388
for dir in $qt_dirs; do
389
qt_incdirs="$qt_incdirs $dir/include $dir"
391
qt_incdirs="$QTINC $qt_incdirs /usr/local/qt/include /usr/include /usr/X11R6/include/X11/qt /usr/X11R6/include/qt /usr/X11R6/include/qt2 /usr/include/qt3 $x_includes"
392
if test ! "$ac_qt_includes" = "NO"; then
393
qt_incdirs="$ac_qt_includes $qt_incdirs"
396
if test "$qt_ver" != "1"; then
397
kde_qt_header=qstyle.h
399
kde_qt_header=qglobal.h
402
QT_FIND_FILE($kde_qt_header, $qt_incdirs, qt_incdir)
403
ac_qt_includes="$qt_incdir"
406
for dir in $qt_dirs; do
407
qt_libdirs="$qt_libdirs $dir/lib $dir"
409
qt_libdirs="$QTLIB $qt_libdirs /usr/X11R6/lib /usr/lib /usr/local/qt/lib $x_libraries"
410
if test ! "$ac_qt_libraries" = "NO"; then
411
qt_libdir=$ac_qt_libraries
413
qt_libdirs="$ac_qt_libraries $qt_libdirs"
414
# if the Qt was given, the chance is too big that libqt.* doesn't exist
416
for dir in $qt_libdirs; do
417
try="ls -1 $dir/${LIBQT_GLOB}"
418
if test -n "`$try 2> /dev/null`"; then qt_libdir=$dir; break; else echo "tried $dir" >&AS_MESSAGE_LOG_FD; fi
422
ac_qt_libraries="$qt_libdir"
426
ac_cxxflags_safe="$CXXFLAGS"
427
ac_ldflags_safe="$LDFLAGS"
430
CXXFLAGS="$CXXFLAGS -I$qt_incdir $QT_CXXFLAGS"
431
LDFLAGS="$LDFLAGS -L$qt_libdir $QT_LDFLAGS"
432
LIBS="$LIBS $QT_LIBS"
436
if AC_TRY_EVAL(ac_link) && test -s conftest; then
439
echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
440
cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD
444
CXXFLAGS="$ac_cxxflags_safe"
445
LDFLAGS="$ac_ldflags_safe"
449
if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then
450
ac_cv_have_qt="have_qt=no"
453
if test "$ac_qt_includes" = NO; then
454
if test "$ac_qt_libraries" = NO; then
455
ac_qt_notfound="(headers and libraries)";
457
ac_qt_notfound="(headers)";
460
if test "x$qt_use_mt" = "xyes"; then
462
Make sure that you have compiled Qt with thread support!"
463
ac_qt_notfound="(library $qtlib-mt)";
465
ac_qt_notfound="(library $qtlib)";
469
#AC_MSG_ERROR([Qt ($qt_minversion) $ac_qt_notfound not found. Please check your installation!
470
#For more details about this problem, look at the end of config.log.$missing_qt_mt])
477
eval "$ac_cv_have_qt"
479
if test "$have_qt" != yes; then
480
AC_MSG_RESULT([$have_qt]);
482
ac_cv_have_qt="have_qt=yes \
483
ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries"
484
AC_MSG_RESULT([libraries $ac_qt_libraries, headers $ac_qt_includes $USING_QT_MT])
486
qt_libraries="$ac_qt_libraries"
487
qt_includes="$ac_qt_includes"
490
AC_SUBST(qt_libraries)
491
AC_SUBST(qt_includes)
493
if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then
496
QT_INCLUDES="-I$qt_includes"
499
if test "$qt_libraries" != "$x_libraries" && test -n "$qt_libraries"; then
500
QT_LDFLAGS="$QT_LDFLAGS -L$qt_libraries"
502
test -z "$QT_MT_LDFLAGS" || QT_LDFLAGS="$QT_LDFLAGS $QT_MT_LDFLAGS"
504
AC_SUBST(QT_INCLUDES)
518
AC_DEFUN([QT_CHECK_COMPILER_FLAG],
520
AC_MSG_CHECKING(whether $CXX supports -$1)
521
kde_cache=`echo $1 | sed 'y% .=/+-%____p_%'`
522
AC_CACHE_VAL(kde_cv_prog_cxx_$kde_cache,
525
save_CXXFLAGS="$CXXFLAGS"
526
CXXFLAGS="$CXXFLAGS -$1"
527
AC_TRY_LINK([],[ return 0; ], [eval "kde_cv_prog_cxx_$kde_cache=yes"], [])
528
CXXFLAGS="$save_CXXFLAGS"
531
if eval "test \"`echo '$kde_cv_prog_cxx_'$kde_cache`\" = yes"; then
542
dnl QT_REMOVE_FORBIDDEN removes forbidden arguments from variables
543
dnl use: QT_REMOVE_FORBIDDEN(CC, [-forbid -bad-option whatever])
544
dnl it's all white-space separated
545
AC_DEFUN([QT_REMOVE_FORBIDDEN],
548
if test -n "$__val"; then
554
*" $i "*) AC_MSG_WARN([found forbidden $i in $1, removing it]) ;;
555
*) # Careful to not add spaces, where there were none, because otherwise
556
# libtool gets confused, if we change e.g. CXX
557
if test -z "$__new" ; then __new=$i ; else __new="$__new $i" ; fi ;;
565
dnl QT_VALIDIFY_CXXFLAGS checks for forbidden flags the user may have given
566
AC_DEFUN([QT_VALIDIFY_CXXFLAGS],
568
if test "x$qt_use_emb" != "xyes"; then
569
QT_REMOVE_FORBIDDEN(CXX, [-fno-rtti -rpath])
570
QT_REMOVE_FORBIDDEN(CXXFLAGS, [-fno-rtti -rpath])
572
QT_REMOVE_FORBIDDEN(CXX, [-rpath])
573
QT_REMOVE_FORBIDDEN(CXXFLAGS, [-rpath])
577
AC_DEFUN([QT_CHECK_COMPILERS],
581
QT_CHECK_COMPILER_FLAG(fexceptions,[QT_CXXFLAGS="$QT_CXXFLAGS -fexceptions"])
584
*-*-irix*) test "$GXX" = yes && QT_CXXFLAGS="-D_LANGUAGE_C_PLUS_PLUS -D__LANGUAGE_C_PLUS_PLUS $QT_CXXFLAGS" ;;
585
*-*-sysv4.2uw*) QT_CXXFLAGS="-D_UNIXWARE $QT_CXXFLAGS";;
586
*-*-sysv5uw7*) QT_CXXFLAGS="-D_UNIXWARE7 $QT_CXXFLAGS";;
588
if test "$GXX" = yes; then
589
libstdcpp=`$CXX -print-file-name=libstdc++.so`
590
if test ! -f $libstdcpp; then
591
AC_MSG_ERROR([You've compiled gcc without --enable-shared. This doesn't work with the Qt pinentry. Please recompile gcc with --enable-shared to receive a libstdc++.so])
602
AC_DEFUN([QT_CHECK_RPATH],
604
AC_MSG_CHECKING(for rpath)
606
[ --disable-rpath do not use the rpath feature of ld],
607
USE_RPATH=$enableval, USE_RPATH=yes)
609
if test -z "$QT_RPATH" && test "$USE_RPATH" = "yes"; then
612
if test -n "$qt_libraries"; then
613
QT_RPATH="$QT_RPATH -Wl,--rpath -Wl,\$(qt_libraries)"
615
dnl $x_libraries is set to /usr/lib in case
616
if test -n "$X_LIBS"; then
617
QT_RPATH="$QT_RPATH -Wl,--rpath -Wl,\$(x_libraries)"
620
AC_SUBST(x_libraries)
622
AC_MSG_RESULT($USE_RPATH)
626
AC_DEFUN([QT_CHECK_LIBPTHREAD],
628
AC_CHECK_LIB(pthread, pthread_create, [LIBPTHREAD="-lpthread"] )
632
AC_DEFUN([QT_CHECK_PTHREAD_OPTION],
634
AC_ARG_ENABLE(kernel-threads, [ --enable-kernel-threads Enable the use of the LinuxThreads port on FreeBSD/i386 only.],
635
kde_use_kernthreads=$enableval, kde_use_kernthreads=no)
637
if test "$kde_use_kernthreads" = "yes"; then
638
ac_save_CXXFLAGS="$CXXFLAGS"
639
ac_save_CFLAGS="$CXXFLAGS"
640
CXXFLAGS="-I/usr/local/include/pthread/linuxthreads $CXXFLAGS"
641
CFLAGS="-I/usr/local/include/pthread/linuxthreads $CFLAGS"
642
AC_CHECK_HEADERS(pthread/linuxthreads/pthread.h)
643
CXXFLAGS="$ac_save_CXXFLAGS"
644
CFLAGS="$ac_save_CFLAGS"
645
if test "$ac_cv_header_pthread_linuxthreads_pthread_h" = "no"; then
646
kde_use_kernthreads=no
648
dnl Add proper -I and -l statements
649
AC_CHECK_LIB(lthread, pthread_join, [LIBPTHREAD="-llthread -llgcc_r"]) dnl for FreeBSD
650
if test "x$LIBPTHREAD" = "x"; then
651
kde_use_kernthreads=no
653
USE_THREADS="-D_THREAD_SAFE -I/usr/local/include/pthread/linuxthreads"
658
if test -z "$LIBPTHREAD"; then
659
QT_CHECK_COMPILER_FLAG(pthread, [USE_THREADS="-pthread"] )
665
QT_CHECK_COMPILER_FLAG(mt, [USE_THREADS="-mt"])
666
QT_CXXFLAGS="$QT_CXXFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -DUSE_SOLARIS -DSVR4"
669
QT_CXXFLAGS="$QT_CXXFLAGS -D_THREAD_SAFE"
672
QT_CXXFLAGS="$QT_CXXFLAGS -D_THREAD_SAFE"
673
LIBPTHREAD="$LIBPTHREAD -lc_r"
675
linux*) QT_CXXFLAGS="$QT_CXXFLAGS -D_REENTRANT"
676
if test "$CXX" = "KCC"; then
677
QT_CXXFLAGS="$QT_CXXFLAGS --thread_safe"
683
AC_SUBST(USE_THREADS)
687
AC_DEFUN([QT_CHECK_THREADING],
689
AC_REQUIRE([QT_CHECK_LIBPTHREAD])
690
AC_REQUIRE([QT_CHECK_PTHREAD_OPTION])
691
dnl default is yes if libpthread is found and no if no libpthread is available
692
if test -z "$LIBPTHREAD"; then
693
if test -z "$USE_THREADS"; then
694
kde_check_threading_default=no
696
kde_check_threading_default=yes
699
kde_check_threading_default=yes
701
AC_ARG_ENABLE(threading, [ --disable-threading disables threading even if libpthread found ],
702
qt_use_threading=$enableval, qt_use_threading=$kde_check_threading_default)
703
if test "x$qt_use_threading" = "xyes"; then
704
AC_DEFINE(HAVE_LIBPTHREAD, 1, [Define if you have a working libpthread (will enable threaded code)])