~ubuntu-branches/ubuntu/maverick/openturns/maverick

« back to all changes in this revision

Viewing changes to lib/m4/bnv_have_qt.m4

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Prud'homme
  • Date: 2008-11-18 06:32:22 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20081118063222-pa0qncclrerrqkg2
Tags: 0.12.2-1
* New upstream release
* Bug fix: "New upstream release available (0.12.2)", thanks to Jerome
  Robert (Closes: #506005).
* Applied patch by J. Robert.
* debian/control: build-depends on libxml2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#                                               -*- Autoconf -*-
2
 
#
3
 
#  bnv_have_qt.m4
4
 
#
5
 
#  (C) Copyright 2005-2007 EDF-EADS-Phimeca
6
 
#
7
 
#  This library is free software; you can redistribute it and/or
8
 
#  modify it under the terms of the GNU Lesser General Public
9
 
#  License as published by the Free Software Foundation; either
10
 
#  version 2.1 of the License.
11
 
#
12
 
#  This library is distributed in the hope that it will be useful
13
 
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
 
#  Lesser General Public License for more details.
16
 
#
17
 
#  You should have received a copy of the GNU Lesser General Public
18
 
#  License along with this library; if not, write to the Free Software
19
 
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
20
 
#
21
 
#  @author: $LastChangedBy: dutka $
22
 
#  @date:   $LastChangedDate: 2008-05-21 11:21:38 +0200 (mer, 21 mai 2008) $
23
 
#  Id:      $Id: bnv_have_qt.m4 815 2008-05-21 09:21:38Z dutka $
24
 
#
25
 
dnl @synopsis BNV_HAVE_QT [--with-Qt-dir=DIR] [--with-Qt-lib-dir=DIR] [--with-Qt-lib=LIB]
26
 
dnl @synopsis BNV_HAVE_QT [--with-Qt-include-dir=DIR] [--with-Qt-bin-dir=DIR] [--with-Qt-lib-dir=DIR] [--with-Qt-lib=LIB]
27
 
dnl
28
 
dnl @summary Search for Trolltech's Qt GUI framework.
29
 
dnl
30
 
dnl Searches common directories for Qt include files, libraries and Qt
31
 
dnl binary utilities. The macro supports several different versions of
32
 
dnl the Qt framework being installed on the same machine. Without
33
 
dnl options, the macro is designed to look for the latest library,
34
 
dnl i.e., the highest definition of QT_VERSION in qglobal.h. By use of
35
 
dnl one or more options a different library may be selected. There are
36
 
dnl two different sets of options. Both sets contain the option
37
 
dnl --with-Qt-lib=LIB which can be used to force the use of a
38
 
dnl particular version of the library file when more than one are
39
 
dnl available. LIB must be in the form as it would appear behind the
40
 
dnl "-l" option to the compiler. Examples for LIB would be "qt-mt" for
41
 
dnl the multi-threaded version and "qt" for the regular version. In
42
 
dnl addition to this, the first set consists of an option
43
 
dnl --with-Qt-dir=DIR which can be used when the installation conforms
44
 
dnl to Trolltech's standard installation, which means that header files
45
 
dnl are in DIR/include, binary utilities are in DIR/bin and the library
46
 
dnl is in DIR/lib. The second set of options can be used to indicate
47
 
dnl individual locations for the header files, the binary utilities and
48
 
dnl the library file, in addition to the specific version of the
49
 
dnl library file.
50
 
dnl
51
 
dnl The following shell variable is set to either "yes" or "no":
52
 
dnl
53
 
dnl   have_qt
54
 
dnl
55
 
dnl Additionally, the following variables are exported:
56
 
dnl
57
 
dnl   QT_CXXFLAGS
58
 
dnl   QT_LIBS
59
 
dnl   QT_MOC
60
 
dnl   QT_UIC
61
 
dnl   QT_DIR
62
 
dnl
63
 
dnl which respectively contain an "-I" flag pointing to the Qt include
64
 
dnl directory (and "-DQT_THREAD_SUPPORT" when LIB is "qt-mt"), link
65
 
dnl flags necessary to link with Qt and X, the name of the meta object
66
 
dnl compiler and the user interface compiler both with full path, and
67
 
dnl finaly the variable QTDIR as Trolltech likes to see it defined (if
68
 
dnl possible).
69
 
dnl
70
 
dnl Example lines for Makefile.in:
71
 
dnl
72
 
dnl   CXXFLAGS = @QT_CXXFLAGS@
73
 
dnl   MOC      = @QT_MOC@
74
 
dnl
75
 
dnl After the variables have been set, a trial compile and link is
76
 
dnl performed to check the correct functioning of the meta object
77
 
dnl compiler. This test may fail when the different detected elements
78
 
dnl stem from different releases of the Qt framework. In that case, an
79
 
dnl error message is emitted and configure stops.
80
 
dnl
81
 
dnl No common variables such as $LIBS or $CFLAGS are polluted.
82
 
dnl
83
 
dnl Options:
84
 
dnl
85
 
dnl --with-Qt-dir=DIR: DIR is equal to $QTDIR if you have followed the
86
 
dnl installation instructions of Trolltech. Header files are in
87
 
dnl DIR/include, binary utilities are in DIR/bin and the library is in
88
 
dnl DIR/lib.
89
 
dnl
90
 
dnl --with-Qt-include-dir=DIR: Qt header files are in DIR.
91
 
dnl
92
 
dnl --with-Qt-bin-dir=DIR: Qt utilities such as moc and uic are in DIR.
93
 
dnl
94
 
dnl --with-Qt-lib-dir=DIR: The Qt library is in DIR.
95
 
dnl
96
 
dnl --with-Qt-lib=LIB: Use -lLIB to link with the Qt library.
97
 
dnl
98
 
dnl If some option "=no" or, equivalently, a --without-Qt-* version is
99
 
dnl given in stead of a --with-Qt-*, "have_qt" is set to "no" and the
100
 
dnl other variables are set to the empty string.
101
 
dnl
102
 
dnl @category InstalledPackages
103
 
dnl @author Bastiaan Veelo <Bastiaan@Veelo.net>
104
 
dnl @version 2006-03-12
105
 
dnl @license AllPermissive
106
 
 
107
 
dnl Copyright (C) 2001, 2002, 2003, 2005, 2006 Bastiaan Veelo
108
 
 
109
 
dnl THANKS! This code includes bug fixes and contributions made by:
110
 
dnl Tim McClarren,
111
 
dnl Dennis R. Weilert,
112
 
dnl Qingning Huo,
113
 
dnl Brian Mingus,
114
 
dnl Jens Hannemann,
115
 
dnl Pavel Roskin,
116
 
dnl Scott J. Bertin.
117
 
 
118
 
dnl ChangeLog
119
 
dnl 2006-03-12  * Hide output of ls and fix an m4 quoting problem (due to Scott J. Bertin).
120
 
dnl 2006-02-13  * Check compiler return value instead of parsing the error stream,
121
 
dnl               which detected warnings as false negatives (due to Jens Hannemann).
122
 
dnl 2006-02-02  * Spelling of "Success".
123
 
dnl             * Fixed unsave test for $bnv_qt_lib without quotes.
124
 
dnl             * Put dnl in front of all comments.
125
 
dnl             * Changed -l$bnv_qt_lib_dir into -L$bnv_qt_lib_dir (all due to Pavel Roskin).
126
 
dnl 2006-01-19  * Support for 64bit architectures.
127
 
dnl             * Updated documentation.
128
 
dnl 2006-01-18: * Fix "cat: bnv_qt_test.c: No such file or directory" (due to Jens Hannemann).
129
 
dnl             * Hide output of failing ls.
130
 
dnl 2006-01-11: * Check in /Developer on Mac OS X; Check in $QTDIR (due to Brian Mingus).
131
 
 
132
 
dnl Calls BNV_PATH_QT_DIRECT (contained in this file) as a subroutine.
133
 
AC_DEFUN([BNV_HAVE_QT],
134
 
[
135
 
  AC_REQUIRE([AC_PROG_CXX])
136
 
  AC_REQUIRE([AC_PATH_X])
137
 
  AC_REQUIRE([AC_PATH_XTRA])
138
 
 
139
 
  AC_MSG_CHECKING(for Qt)
140
 
 
141
 
  AC_ARG_WITH([Qt-dir],
142
 
    [  --with-Qt-dir=DIR       DIR is equal to $QTDIR if you have followed the
143
 
                          installation instructions of Trolltech. Header
144
 
                          files are in DIR/include, binary utilities are
145
 
                          in DIR/bin. The library is in DIR/lib, unless
146
 
                          --with-Qt-lib-dir is also set.])
147
 
  AC_ARG_WITH([Qt-include-dir],
148
 
    [  --with-Qt-include-dir=DIR
149
 
                          Qt header files are in DIR])
150
 
  AC_ARG_WITH([Qt-bin-dir],
151
 
    [  --with-Qt-bin-dir=DIR   Qt utilities such as moc and uic are in DIR])
152
 
  AC_ARG_WITH([Qt-lib-dir],
153
 
    [  --with-Qt-lib-dir=DIR   The Qt library is in DIR])
154
 
  AC_ARG_WITH([Qt-lib],
155
 
    [  --with-Qt-lib=LIB       Use -lLIB to link with the Qt library])
156
 
  if test x"$with_Qt_dir" = x"no" ||
157
 
     test x"$with_Qt_include-dir" = x"no" ||
158
 
     test x"$with_Qt_bin_dir" = x"no" ||
159
 
     test x"$with_Qt_lib_dir" = x"no" ||
160
 
     test x"$with_Qt_lib" = x"no"; then
161
 
    # user disabled Qt. Leave cache alone.
162
 
    have_qt="User disabled Qt."
163
 
  else
164
 
    # "yes" is a bogus option
165
 
    if test x"$with_Qt_dir" = xyes; then
166
 
      with_Qt_dir=
167
 
    fi
168
 
    if test x"$with_Qt_include_dir" = xyes; then
169
 
      with_Qt_include_dir=
170
 
    fi
171
 
    if test x"$with_Qt_bin_dir" = xyes; then
172
 
      with_Qt_bin_dir=
173
 
    fi
174
 
    if test x"$with_Qt_lib_dir" = xyes; then
175
 
      with_Qt_lib_dir=
176
 
    fi
177
 
    if test x"$with_Qt_lib" = xyes; then
178
 
      with_Qt_lib=
179
 
    fi
180
 
    # No Qt unless we discover otherwise
181
 
    have_qt=no
182
 
    # Check whether we are requested to link with a specific version
183
 
    if test x"$with_Qt_lib" != x; then
184
 
      bnv_qt_lib="$with_Qt_lib"
185
 
    fi
186
 
    # Check whether we were supplied with an answer already
187
 
    if test x"$with_Qt_dir" != x; then
188
 
      have_qt=yes
189
 
      bnv_qt_dir="$with_Qt_dir"
190
 
      bnv_qt_include_dir="$with_Qt_dir/include"
191
 
      bnv_qt_bin_dir="$with_Qt_dir/bin"
192
 
      bnv_qt_lib_dir="$with_Qt_dir/lib"
193
 
      # Only search for the lib if the user did not define one already
194
 
      if test x"$bnv_qt_lib" = x; then
195
 
        bnv_qt_lib="`ls $bnv_qt_lib_dir/libqt* | sed -n 1p |
196
 
                     sed s@$bnv_qt_lib_dir/lib@@ | [sed s@[.].*@@]`"
197
 
      fi
198
 
      bnv_qt_LIBS="-L$bnv_qt_lib_dir -l$bnv_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS"
199
 
    else
200
 
      # Use cached value or do search, starting with suggestions from
201
 
      # the command line
202
 
      AC_CACHE_VAL(bnv_cv_have_qt,
203
 
      [
204
 
        # We are not given a solution and there is no cached value.
205
 
        bnv_qt_dir=NO
206
 
        bnv_qt_include_dir=NO
207
 
        bnv_qt_lib_dir=NO
208
 
        if test x"$bnv_qt_lib" = x; then
209
 
          bnv_qt_lib=NO
210
 
        fi
211
 
        BNV_PATH_QT_DIRECT
212
 
        if test "$bnv_qt_dir" = NO ||
213
 
           test "$bnv_qt_include_dir" = NO ||
214
 
           test "$bnv_qt_lib_dir" = NO ||
215
 
           test "$bnv_qt_lib" = NO; then
216
 
          # Problem with finding complete Qt.  Cache the known absence of Qt.
217
 
          bnv_cv_have_qt="have_qt=no"
218
 
        else
219
 
          # Record where we found Qt for the cache.
220
 
          bnv_cv_have_qt="have_qt=yes                  \
221
 
                       bnv_qt_dir=$bnv_qt_dir          \
222
 
               bnv_qt_include_dir=$bnv_qt_include_dir  \
223
 
                   bnv_qt_bin_dir=$bnv_qt_bin_dir      \
224
 
                      bnv_qt_LIBS=\"$bnv_qt_LIBS\""
225
 
        fi
226
 
      ])dnl
227
 
      eval "$bnv_cv_have_qt"
228
 
    fi # all $bnv_qt_* are set
229
 
  fi   # $have_qt reflects the system status
230
 
  if test x"$have_qt" = xyes; then
231
 
    QT_CXXFLAGS="-I$bnv_qt_include_dir"
232
 
    if test x"$bnv_qt_lib" = xqt-mt; then
233
 
        QT_CXXFLAGS="$QT_CXXFLAGS -DQT_THREAD_SUPPORT"
234
 
    fi
235
 
    QT_DIR="$bnv_qt_dir"
236
 
    QT_LIBS="$bnv_qt_LIBS"
237
 
    # If bnv_qt_dir is defined, utilities are expected to be in the
238
 
    # bin subdirectory
239
 
    if test x"$bnv_qt_dir" != x; then
240
 
        if test -x "$bnv_qt_dir/bin/uic"; then
241
 
          QT_UIC="$bnv_qt_dir/bin/uic"
242
 
        else
243
 
          # Old versions of Qt don't have uic
244
 
          QT_UIC=
245
 
        fi
246
 
      QT_MOC="$bnv_qt_dir/bin/moc"
247
 
    else
248
 
      # Or maybe we are told where to look for the utilities
249
 
      if test x"$bnv_qt_bin_dir" != x; then
250
 
        if test -x "$bnv_qt_bin_dir/uic"; then
251
 
          QT_UIC="$bnv_qt_bin_dir/uic"
252
 
        else
253
 
          # Old versions of Qt don't have uic
254
 
          QT_UIC=
255
 
        fi
256
 
        QT_MOC="$bnv_qt_bin_dir/moc"
257
 
      else
258
 
      # Last possibility is that they are in $PATH
259
 
        QT_UIC="`which uic`"
260
 
        QT_MOC="`which moc`"
261
 
      fi
262
 
    fi
263
 
    # All variables are defined, report the result
264
 
    AC_MSG_RESULT([$have_qt:
265
 
    QT_CXXFLAGS=$QT_CXXFLAGS
266
 
    QT_DIR=$QT_DIR
267
 
    QT_LIBS=$QT_LIBS
268
 
    QT_UIC=$QT_UIC
269
 
    QT_MOC=$QT_MOC])
270
 
  else
271
 
    # Qt was not found
272
 
    QT_CXXFLAGS=
273
 
    QT_DIR=
274
 
    QT_LIBS=
275
 
    QT_UIC=
276
 
    QT_MOC=
277
 
    AC_MSG_RESULT($have_qt)
278
 
  fi
279
 
  AC_SUBST(QT_CXXFLAGS)
280
 
  AC_SUBST(QT_DIR)
281
 
  AC_SUBST(QT_LIBS)
282
 
  AC_SUBST(QT_UIC)
283
 
  AC_SUBST(QT_MOC)
284
 
 
285
 
  #### Being paranoid:
286
 
  if test x"$have_qt" = xyes; then
287
 
    AC_MSG_CHECKING(correct functioning of Qt installation)
288
 
    AC_CACHE_VAL(bnv_cv_qt_test_result,
289
 
    [
290
 
      cat > bnv_qt_test.h << EOF
291
 
#include <qobject.h>
292
 
class Test : public QObject
293
 
{
294
 
Q_OBJECT
295
 
public:
296
 
  Test() {}
297
 
  ~Test() {}
298
 
public slots:
299
 
  void receive() {}
300
 
signals:
301
 
  void send();
302
 
};
303
 
EOF
304
 
 
305
 
      cat > bnv_qt_main.$ac_ext << EOF
306
 
#include "bnv_qt_test.h"
307
 
#include <qapplication.h>
308
 
int main( int argc, char **argv )
309
 
{
310
 
  QApplication app( argc, argv );
311
 
  Test t;
312
 
  QObject::connect( &t, SIGNAL(send()), &t, SLOT(receive()) );
313
 
}
314
 
EOF
315
 
 
316
 
      bnv_cv_qt_test_result="failure"
317
 
      bnv_try_1="$QT_MOC bnv_qt_test.h -o moc_bnv_qt_test.$ac_ext >/dev/null 2>/dev/null"
318
 
      AC_TRY_EVAL(bnv_try_1)
319
 
      if test x"$ac_status" != x0; then
320
 
        echo "$bnv_err_1" >&AC_FD_CC
321
 
        echo "configure: could not run $QT_MOC on:" >&AC_FD_CC
322
 
        cat bnv_qt_test.h >&AC_FD_CC
323
 
      else
324
 
        bnv_try_2="$CXX $QT_CXXFLAGS -c $CXXFLAGS -o moc_bnv_qt_test.o moc_bnv_qt_test.$ac_ext >/dev/null 2>/dev/null"
325
 
        AC_TRY_EVAL(bnv_try_2)
326
 
        if test x"$ac_status" != x0; then
327
 
          echo "$bnv_err_2" >&AC_FD_CC
328
 
          echo "configure: could not compile:" >&AC_FD_CC
329
 
          cat moc_bnv_qt_test.$ac_ext >&AC_FD_CC
330
 
        else
331
 
          bnv_try_3="$CXX $QT_CXXFLAGS -c $CXXFLAGS -o bnv_qt_main.o bnv_qt_main.$ac_ext >/dev/null 2>/dev/null"
332
 
          AC_TRY_EVAL(bnv_try_3)
333
 
          if test x"$ac_status" != x0; then
334
 
            echo "$bnv_err_3" >&AC_FD_CC
335
 
            echo "configure: could not compile:" >&AC_FD_CC
336
 
            cat bnv_qt_main.$ac_ext >&AC_FD_CC
337
 
          else
338
 
            bnv_try_4="$CXX $QT_LIBS $LIBS -o bnv_qt_main bnv_qt_main.o moc_bnv_qt_test.o $QT_LIBS>/dev/null 2>/dev/null"
339
 
            AC_TRY_EVAL(bnv_try_4)
340
 
            if test x"$ac_status" != x0; then
341
 
              echo "$bnv_err_4" >&AC_FD_CC
342
 
            else
343
 
              bnv_cv_qt_test_result="success"
344
 
            fi
345
 
          fi
346
 
        fi
347
 
      fi
348
 
    ])dnl AC_CACHE_VAL bnv_cv_qt_test_result
349
 
    AC_MSG_RESULT([$bnv_cv_qt_test_result]);
350
 
    if test x"$bnv_cv_qt_test_result" = "xfailure"; then
351
 
      AC_MSG_ERROR([Failed to find matching components of a complete
352
 
                  Qt installation. Try using more options,
353
 
                  see ./configure --help.])
354
 
    fi
355
 
 
356
 
    rm -f bnv_qt_test.h moc_bnv_qt_test.$ac_ext moc_bnv_qt_test.o \
357
 
          bnv_qt_main.$ac_ext bnv_qt_main.o bnv_qt_main
358
 
  fi
359
 
])
360
 
 
361
 
dnl Internal subroutine of BNV_HAVE_QT
362
 
dnl Set bnv_qt_dir bnv_qt_include_dir bnv_qt_bin_dir bnv_qt_lib_dir bnv_qt_lib
363
 
AC_DEFUN([BNV_PATH_QT_DIRECT],
364
 
[
365
 
  ## Binary utilities ##
366
 
  if test x"$with_Qt_bin_dir" != x; then
367
 
    bnv_qt_bin_dir=$with_Qt_bin_dir
368
 
  fi
369
 
  ## Look for header files ##
370
 
  if test x"$with_Qt_include_dir" != x; then
371
 
    bnv_qt_include_dir="$with_Qt_include_dir"
372
 
  else
373
 
    # The following header file is expected to define QT_VERSION.
374
 
    qt_direct_test_header=qglobal.h
375
 
    # Look for the header file in a standard set of common directories.
376
 
    bnv_include_path_list="
377
 
      /usr/include
378
 
      `ls -dr ${QTDIR}/include 2>/dev/null`
379
 
      `ls -dr /usr/include/qt* 2>/dev/null`
380
 
      `ls -dr /usr/lib/qt*/include 2>/dev/null`
381
 
      `ls -dr /usr/local/qt*/include 2>/dev/null`
382
 
      `ls -dr /opt/qt*/include 2>/dev/null`
383
 
      `ls -dr /Developer/qt*/include 2>/dev/null`
384
 
    "
385
 
    for bnv_dir in $bnv_include_path_list; do
386
 
      if test -r "$bnv_dir/$qt_direct_test_header"; then
387
 
        bnv_dirs="$bnv_dirs $bnv_dir"
388
 
      fi
389
 
    done
390
 
    # Now look for the newest in this list
391
 
    bnv_prev_ver=0
392
 
    for bnv_dir in $bnv_dirs; do
393
 
      bnv_this_ver=`egrep -w '#define QT_VERSION' $bnv_dir/$qt_direct_test_header | sed s/'#define QT_VERSION'//`
394
 
      if expr $bnv_this_ver '>' $bnv_prev_ver > /dev/null; then
395
 
        bnv_qt_include_dir=$bnv_dir
396
 
        bnv_prev_ver=$bnv_this_ver
397
 
      fi
398
 
    done
399
 
  fi dnl Found header files.
400
 
 
401
 
  # Are these headers located in a traditional Trolltech installation?
402
 
  # That would be $bnv_qt_include_dir stripped from its last element:
403
 
  bnv_possible_qt_dir=`dirname $bnv_qt_include_dir`
404
 
  if (test -x $bnv_possible_qt_dir/bin/moc) &&
405
 
     ((ls $bnv_possible_qt_dir/lib/libqt* > /dev/null 2>/dev/null) ||
406
 
      (ls $bnv_possible_qt_dir/lib64/libqt* > /dev/null 2>/dev/null)); then
407
 
    # Then the rest is a piece of cake
408
 
    bnv_qt_dir=$bnv_possible_qt_dir
409
 
    bnv_qt_bin_dir="$bnv_qt_dir/bin"
410
 
    if test x"$with_Qt_lib_dir" != x; then
411
 
      bnv_qt_lib_dir="$with_Qt_lib_dir"
412
 
    else
413
 
      if (test -d $bnv_qt_dir/lib64); then
414
 
        bnv_qt_lib_dir="$bnv_qt_dir/lib64"
415
 
      else
416
 
        bnv_qt_lib_dir="$bnv_qt_dir/lib"
417
 
      fi
418
 
    fi
419
 
    # Only look for lib if the user did not supply it already
420
 
    if test x"$bnv_qt_lib" = xNO; then
421
 
      bnv_qt_lib="`ls $bnv_qt_lib_dir/libqt* | sed -n 1p |
422
 
                   sed s@$bnv_qt_lib_dir/lib@@ | [sed s@[.].*@@]`"
423
 
    fi
424
 
    bnv_qt_LIBS="-L$bnv_qt_lib_dir -l$bnv_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS"
425
 
  else
426
 
    # There is no valid definition for $QTDIR as Trolltech likes to see it
427
 
    bnv_qt_dir=
428
 
    ## Look for Qt library ##
429
 
    if test x"$with_Qt_lib_dir" != x; then
430
 
      bnv_qt_lib_dir="$with_Qt_lib_dir"
431
 
      # Only look for lib if the user did not supply it already
432
 
      if test x"$bnv_qt_lib" = xNO; then
433
 
        bnv_qt_lib="`ls $bnv_qt_lib_dir/libqt* | sed -n 1p |
434
 
                     sed s@$bnv_qt_lib_dir/lib@@ | [sed s@[.].*@@]`"
435
 
      fi
436
 
      bnv_qt_LIBS="-L$bnv_qt_lib_dir -l$bnv_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS"
437
 
    else
438
 
      # Normally, when there is no traditional Trolltech installation,
439
 
      # the library is installed in a place where the linker finds it
440
 
      # automatically.
441
 
      # If the user did not define the library name, try with qt
442
 
      if test x"$bnv_qt_lib" = xNO; then
443
 
        bnv_qt_lib=qt
444
 
      fi
445
 
      qt_direct_test_header=qapplication.h
446
 
      qt_direct_test_main="
447
 
        int argc;
448
 
        char ** argv;
449
 
        QApplication app(argc,argv);
450
 
      "
451
 
      # See if we find the library without any special options.
452
 
      # Don't add top $LIBS permanently yet
453
 
      bnv_save_LIBS="$LIBS"
454
 
      LIBS="-l$bnv_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS"
455
 
      bnv_qt_LIBS="$LIBS"
456
 
      bnv_save_CXXFLAGS="$CXXFLAGS"
457
 
      CXXFLAGS="-I$bnv_qt_include_dir"
458
 
      AC_TRY_LINK([#include <$qt_direct_test_header>],
459
 
        $qt_direct_test_main,
460
 
      [
461
 
        # Success.
462
 
        # We can link with no special library directory.
463
 
        bnv_qt_lib_dir=
464
 
      ], [
465
 
        # That did not work. Try the multi-threaded version
466
 
        echo "Non-critical error, please neglect the above." >&AC_FD_CC
467
 
        bnv_qt_lib=qt-mt
468
 
        LIBS="-l$bnv_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS"
469
 
        AC_TRY_LINK([#include <$qt_direct_test_header>],
470
 
          $qt_direct_test_main,
471
 
        [
472
 
          # Success.
473
 
          # We can link with no special library directory.
474
 
          bnv_qt_lib_dir=
475
 
        ], [
476
 
          # That did not work. Try the OpenGL version
477
 
          echo "Non-critical error, please neglect the above." >&AC_FD_CC
478
 
          bnv_qt_lib=qt-gl
479
 
          LIBS="-l$bnv_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS"
480
 
          AC_TRY_LINK([#include <$qt_direct_test_header>],
481
 
            $qt_direct_test_main,
482
 
          [
483
 
            # Success.
484
 
            # We can link with no special library directory.
485
 
            bnv_qt_lib_dir=
486
 
          ], [
487
 
            # That did not work. Maybe a library version I don't know about?
488
 
            echo "Non-critical error, please neglect the above." >&AC_FD_CC
489
 
            # Look for some Qt lib in a standard set of common directories.
490
 
            bnv_dir_list="
491
 
              `echo $bnv_qt_includes | sed ss/includess`
492
 
              /lib
493
 
              /usr/lib64
494
 
              /usr/lib
495
 
              /usr/local/lib64
496
 
              /usr/local/lib
497
 
              /opt/lib64
498
 
              /opt/lib
499
 
              `ls -dr /usr/lib64/qt* 2>/dev/null`
500
 
              `ls -dr /usr/lib64/qt*/lib64 2>/dev/null`
501
 
              `ls -dr /usr/lib/qt* 2>/dev/null`
502
 
              `ls -dr /usr/local/qt* 2>/dev/null`
503
 
              `ls -dr /opt/qt* 2>/dev/null`
504
 
            "
505
 
            for bnv_dir in $bnv_dir_list; do
506
 
              if ls $bnv_dir/libqt* >/dev/null 2>/dev/null; then
507
 
                # Gamble that it's the first one...
508
 
                bnv_qt_lib="`ls $bnv_dir/libqt* | sed -n 1p |
509
 
                            sed s@$bnv_dir/lib@@ | sed s/[[.]].*//`"
510
 
                bnv_qt_lib_dir="$bnv_dir"
511
 
                break
512
 
              fi
513
 
            done
514
 
            # Try with that one
515
 
            LIBS="-l$bnv_qt_lib $X_PRE_LIBS $X_LIBS -lX11 -lXext -lXmu -lXt -lXi $X_EXTRA_LIBS"
516
 
            AC_TRY_LINK([#include <$qt_direct_test_header>],
517
 
              $qt_direct_test_main,
518
 
            [
519
 
              # Success.
520
 
              # We can link with no special library directory.
521
 
              bnv_qt_lib_dir=
522
 
            ], [
523
 
              # Leave bnv_qt_lib_dir defined
524
 
            ])
525
 
          ])
526
 
        ])
527
 
      ])
528
 
      if test x"$bnv_qt_lib_dir" != x; then
529
 
        bnv_qt_LIBS="-L$bnv_qt_lib_dir $LIBS"
530
 
      else
531
 
        bnv_qt_LIBS="$LIBS"
532
 
      fi
533
 
      LIBS="$bnv_save_LIBS"
534
 
      CXXFLAGS="$bnv_save_CXXFLAGS"
535
 
    fi dnl $with_Qt_lib_dir was not given
536
 
  fi dnl Done setting up for non-traditional Trolltech installation
537
 
])