1 dnl Copyright (C) 2006-2008 CEA/DEN, EDF R&D
3 dnl This library is free software; you can redistribute it and/or
4 dnl modify it under the terms of the GNU Lesser General Public
5 dnl License as published by the Free Software Foundation; either
6 dnl version 2.1 of the License.
8 dnl This library is distributed in the hope that it will be useful,
9 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
10 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 dnl Lesser General Public License for more details.
13 dnl You should have received a copy of the GNU Lesser General Public
14 dnl License along with this library; if not, write to the Free Software
15 dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 dnl the following variables are exported:
27 dnl qt4 is searched in the following order
28 dnl path given with --with-qt4 options
29 dnl presence of QTDIR variable
32 dnl ./configure --prefix=/home/prascle/partage/maquettes/install
33 dnl ./configure --prefix=/home/prascle/partage/maquettes/install --with-qt4
34 dnl ./configure --prefix=/home/prascle/partage/maquettes/install --with-qt4=/opt/qt443
35 dnl ./configure --prefix=/home/prascle/partage/maquettes/install --with-qt4-includes=/usr/include/qt4
36 dnl ./configure --prefix=/home/prascle/partage/maquettes/install --with-qt4-includes=/usr/include/qt4 --with-qt4-libraries=/usr/lib -with-qt4-tools=/usr/bin
37 dnl ./configure --prefix=/home/prascle/partage/maquettes/install --without-qt4
39 AC_DEFUN([I2_CHECK_QT4],
41 AC_REQUIRE([AC_PROG_CXX])
42 AC_REQUIRE([AC_PROG_CPP])
46 # --- check if qt4 standard install directory is defined (with subdirectories bin lib include)
49 AC_HELP_STRING([--with-qt4@<:@=DIR@:>@], [where the Qt4 package with a standard install is: default @<:@$QTDIR@:>@ or @<:@/usr@:>@]),
50 [qt4_install_path=$withval], [withval=notset])
52 # --- if qt4 standard install directory is defined but with no path: QTDIR value if defined, or /usr
53 if test x${withval} = xyes
57 qt4_install_path="/usr"
59 qt4_install_path=$QTDIR
63 # --- if qt4 standard install directory is not defined: QTDIR value if defined, or /usr
64 if test x${withval} = xnotset
68 qt4_install_path="/usr"
70 if test $QTDIR = /usr/lib/qt3 ; then
71 if test -d /usr/lib/qt4 ; then
72 AC_MSG_RESULT(it is strange for a qt4 installation !)
73 AC_MSG_RESULT(/usr/lib/qt4 is present)
74 AC_MSG_RESULT(replacing QTDIR by /usr/lib/qt4)
78 qt4_install_path=$QTDIR
82 # --- if qt4 standard install directory is not wanted: --without-qt4 or --with-qt4=no
83 if test x${withval} = xno
88 QT_DIR=${qt4_install_path}
91 # --- check if qt4 includes directory is defined
93 AC_ARG_WITH([qt4-includes],
94 AC_HELP_STRING([--with-qt4-includes@<:@=DIR@:>@], [where the Qt4 includes are: default @<:@$QTDIR/include@:>@ or @<:@/usr/include@:>@]),
95 [qt4_include_path=$withval], [withval=no])
96 if test x${withval} != xno
98 # --- qt4 includes directory is defined
99 if test x${qt4_include_path} = xyes
101 qt4_include_path="/usr/include"
104 if test x${qt4_install_path} != x
106 qt4_include_path="${qt4_install_path}/include"
111 # --- check if qt4 libraries directory is defined
113 AC_ARG_WITH([qt4-libraries],
114 AC_HELP_STRING([--with-qt4-libraries@<:@=DIR@:>@], [where the Qt4 libraries are: default @<:@$QTDIR/lib@:>@ or @<:@/usr/lib@:>@]),
115 [qt4_library_path=$withval], [withval=no])
116 if test x${withval} != xno
118 # --- qt4 libraries directory is defined
119 if test x${qt4_library_path} = xyes
121 qt4_library_path="/usr/lib"
124 if test x${qt4_install_path} != x
126 qt4_library_path="${qt4_install_path}/lib"
130 # --- check if qt4 tools directory is defined
132 AC_ARG_WITH([qt4-tools],
133 AC_HELP_STRING([--with-qt4-tools@<:@=DIR@:>@], [where the Qt4 executable tools are: default @<:@$QTDIR/bin@:>@ or @<:@/usr/bin@:>@]),
134 [qt4_tools_path=$withval], [withval=no])
135 if test x${withval} != xno
137 # --- qt4 tools directory is defined
138 if test x${qt4_tools_path} = xyes
140 qt4_tools_path="/usr/bin"
143 if test x${qt4_install_path} != x
145 qt4_tools_path="${qt4_install_path}/bin"
151 AC_MSG_NOTICE(${qt4_include_path})
152 AC_MSG_NOTICE(${qt4_library_path})
153 AC_MSG_NOTICE(${qt4_tools_path})
155 # test if qt4 is completely defined
157 if test x${qt4_include_path} = x
160 AC_MSG_NOTICE([No Qt4 include path defined])
162 if test x${qt4_library_path} = x
165 AC_MSG_NOTICE([No Qt4 library path defined])
167 if test x${qt4_tools_path} = x
170 AC_MSG_NOTICE([No Qt4 tools path defined])
173 # saving values for compilation variables
174 saved_CPPFLAGS=$CPPFLAGS
175 saved_LDFLAGS=$LDFLAGS
178 if ! test x${qt4_defined} = xno
180 # ask for qt4 support
181 AC_MSG_NOTICE([checking whether qt4 tools and headers are present])
183 # --- we test the presence of moc,first under the form moc-qt4, then moc
184 AC_PATH_PROGS(qt4_moc_found, [moc-qt4 moc], no, ${qt4_tools_path})
185 test x${qt4_moc_found} = xno && AC_MSG_ERROR([Qt4 moc command NOT FOUND])
186 QT_MOC=$qt4_moc_found
189 # --- we test the presence of uic,first under the form uic-qt4, then uic
190 AC_PATH_PROGS(qt4_uic_found, [uic-qt4 uic], no, ${qt4_tools_path})
191 test x${qt4_uic_found} = xno && AC_MSG_ERROR([Qt4 uic command NOT FOUND])
192 QT_UIC=$qt4_uic_found
195 # --- we test the presence of rcc,first under the form rcc-qt4, then rcc
196 AC_PATH_PROGS(qt4_rcc_found, [rcc-qt4 rcc], no, ${qt4_tools_path})
197 test x${qt4_rcc_found} = xno && AC_MSG_ERROR([Qt4 rcc command NOT FOUND])
198 QT_RCC=$qt4_rcc_found
201 # --- we test the header file presence and usability
203 AC_CHECK_FILE($qt4_include_path/qt4/QtCore/qglobal.h,QTINC="/qt4",QTINC="")
204 qt4_include_path="$qt4_include_path${QTINC}"
206 qt4_cppflags="${qt4_cppflags} -I$qt4_include_path/QtCore"
207 qt4_cppflags="${qt4_cppflags} -I$qt4_include_path/QtGui"
208 qt4_cppflags="${qt4_cppflags} -I$qt4_include_path/Qt"
209 qt4_cppflags="${qt4_cppflags} -I$qt4_include_path"
210 CPPFLAGS="${CPPFLAGS} ${qt4_cppflags}"
212 AC_CHECK_HEADERS([qapplication.h],
213 [qt4_header_found=yes],
214 [qt4_header_found=no],
217 test x${qt4_header_found} = xno && AC_MSG_ERROR([Qt4 include file NOT FOUND])
218 AC_SUBST(qt4_cppflags)
220 # --- we test the library file presence and usability
221 if test x${qt4_library_path} = /usr/lib
225 qt4_ldflags="-L$qt4_library_path"
228 AC_MSG_NOTICE([checking whether link with qt4 is working])
230 qt4_libs="-l$qt4_lib_name"
231 LDFLAGS="${LDFLAGS} ${qt4_ldflags}"
232 LIBS="${LIBS} ${qt4_libs}"
235 AC_LINK_IFELSE([AC_LANG_PROGRAM(
236 [[ #include <QApplication>
237 #include <QPushButton> ]],
238 [[ QApplication app(0, 0);
239 QPushButton hello("Hello world!");
240 hello.resize(100, 30);
242 [qt4_lib_found=yes], [qt4_lib_found=no] )
244 test x${qt4_lib_found} = xno && AC_MSG_ERROR([Qt4 library NOT FOUND])
247 AC_SUBST(qt4_ldflags)
250 # --- after all tests are successful, we support Qt4
253 AC_MSG_NOTICE([Qt4 support is OK])
257 AC_MSG_NOTICE([No Qt4 support])
260 # Propagate test into atlocal
263 # Propagate test into Makefiles...
264 AM_CONDITIONAL(WITH_QT4, test $WITH_QT4 = 1)
266 # ... and into source files
267 AC_DEFINE_UNQUOTED(HAS_QT4, $WITH_QT4, [Qt4 library])
269 # restoring saved values
270 CPPFLAGS=$saved_CPPFLAGS
271 LDFLAGS=$saved_LDFLAGS
277 AC_DEFUN([I2_CHECK_QSCINTILLA],
279 AC_REQUIRE([I2_CHECK_QT4])
284 # --- check if qsci4 includes directory is defined
285 qsci4_include_path=""
288 AC_ARG_WITH([qsci4-includes],
289 AC_HELP_STRING([--with-qsci4-includes@<:@=DIR@:>@], [where the Qsci4 includes are: default @<:@$QTDIR/include/Qsci@:>@ or @<:@/usr/include/Qsci@:>@]),
290 [qsci4_include_path=$withval])
292 if test x${qsci4_include_path} = x ; then
293 # --- "" --- try to use QSCINTILLA_DIR/include/Qsci
294 if test "x${QSCINTILLA_DIR}" != "x" ; then
295 qsci4_include_path="${QSCINTILLA_DIR}/include"
297 qsci4_include_path=no
301 if test x${qsci4_include_path} = xno ; then
302 # --- "no" --- no native installation, try to find in Qt
303 qsci4_include_path="${QT_DIR}/include${QTINC}/Qsci"
304 qsci4_cppflags=" -I$qsci4_include_path"
305 # " -I${QT_DIR}/include${QTINC}" is included in qt4_cppflags
307 if test x${qsci4_include_path} = xyes ; then
308 # --- "yes" --- try to find in /usr/include/Qsci
309 qsci4_include_path="/usr/include${QTINC}/Qsci"
310 qsci4_cppflags=" -I$qsci4_include_path"
311 # " -I/usr/include${QTINC}" is included in qt4_cppflags or by default (if QTINC is empty)
313 # --- "other" --- try to find in given dir
314 qsci4_cppflags=" -I$qsci4_include_path/Qsci -I$qsci4_include_path"
318 AC_MSG_NOTICE($qsci4_cppflags)
320 # --- check if qsci4 libraries directory is defined
321 qsci4_library_path=""
323 AC_ARG_WITH([qsci4-libraries],
324 AC_HELP_STRING([--with-qsci4-libraries@<:@=DIR@:>@], [where the Qsci4 libraries are: default @<:@$QTDIR/lib@:>@ or @<:@/usr/lib@:>@]),
325 [qsci4_library_path=$withval])
327 if test x${qsci4_library_path} = x ; then
328 # --- "" --- try to use QSCINTILLA_DIR/lib
329 if test "x${QSCINTILLA_DIR}" != "x" ; then
330 qsci4_library_path="${QSCINTILLA_DIR}/lib"
332 qsci4_library_path=no
336 if test x${qsci4_library_path} = xno ; then
337 # --- "no" --- no native installation, try to find in Qt
338 qsci4_library_path="${QT_DIR}/lib"
340 if test x${qsci4_library_path} = xyes ; then
341 # --- "yes" --- try to find in /usr/lib
342 qsci4_library_path="/usr/lib"
346 AC_MSG_NOTICE($qsci4_library_path)
348 # saving values for compilation variables
349 saved_CPPFLAGS=$CPPFLAGS
350 saved_LDFLAGS=$LDFLAGS
353 # ask for qsci4 support
354 AC_MSG_NOTICE([checking whether qscintilla for qt4 headers are present])
356 # --- we test the header file presence and usability
357 CPPFLAGS="${CPPFLAGS} ${qsci4_cppflags} ${qt4_cppflags}"
359 AC_CHECK_HEADERS([qsciscintilla.h],
360 [qsci4_header_found=yes],
361 [qsci4_header_found=no],
364 if test x${qsci4_header_found} = xyes
366 AC_SUBST(qsci4_cppflags)
368 # --- we test the library file presence and usability
369 if test x${qsci4_library_path} = x/usr/lib/qt4/lib
371 qsci4_library_path=/usr/lib
373 if test x${qsci4_library_path} = x/usr/lib
377 qsci4_ldflags="-L$qsci4_library_path"
380 AC_MSG_NOTICE([checking whether qscintilla2 library is present])
381 qsci4_libs=-lqscintilla2
382 AC_CHECK_FILE([${qsci4_library_path}/libqscintilla2.so],
383 [qsci4_library_found=yes],
384 [qsci4_library_found=no])
385 if test x${qsci4_library_found} = xyes
387 AC_MSG_NOTICE([qscintilla for qt4 support])
388 AC_SUBST(qsci4_ldflags)
392 # Propagate test into atlocal
397 AC_MSG_NOTICE([no support for qscintilla for qt4])
400 # Propagate test into Makefiles...
401 AM_CONDITIONAL(WITH_QSCI4, test $WITH_QSCI4 = 1)
403 # ... and into source files
404 AC_DEFINE_UNQUOTED(HAS_QSCI4, $WITH_QSCI4, [QsciScintilla library])
406 # restoring saved values
407 CPPFLAGS=$saved_CPPFLAGS
408 LDFLAGS=$saved_LDFLAGS