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 qt4_install_path=$QTDIR
74 # --- if qt4 standard install directory is not wanted: --without-qt4 or --with-qt4=no
75 if test x${withval} = xno
80 QT_DIR=${qt4_install_path}
83 # --- check if qt4 includes directory is defined
85 AC_ARG_WITH([qt4-includes],
86 AC_HELP_STRING([--with-qt4-includes@<:@=DIR@:>@], [where the Qt4 includes are: default @<:@$QTDIR/include@:>@ or @<:@/usr/include@:>@]),
87 [qt4_include_path=$withval], [withval=no])
88 if test x${withval} != xno
90 # --- qt4 includes directory is defined
91 if test x${qt4_include_path} = xyes
93 qt4_include_path="/usr/include"
96 if test x${qt4_install_path} != x
98 qt4_include_path="${qt4_install_path}/include"
103 # --- check if qt4 libraries directory is defined
105 AC_ARG_WITH([qt4-libraries],
106 AC_HELP_STRING([--with-qt4-libraries@<:@=DIR@:>@], [where the Qt4 libraries are: default @<:@$QTDIR/lib@:>@ or @<:@/usr/lib@:>@]),
107 [qt4_library_path=$withval], [withval=no])
108 if test x${withval} != xno
110 # --- qt4 libraries directory is defined
111 if test x${qt4_library_path} = xyes
113 qt4_library_path="/usr/lib"
116 if test x${qt4_install_path} != x
118 qt4_library_path="${qt4_install_path}/lib"
122 # --- check if qt4 tools directory is defined
124 AC_ARG_WITH([qt4-tools],
125 AC_HELP_STRING([--with-qt4-tools@<:@=DIR@:>@], [where the Qt4 executable tools are: default @<:@$QTDIR/bin@:>@ or @<:@/usr/bin@:>@]),
126 [qt4_tools_path=$withval], [withval=no])
127 if test x${withval} != xno
129 # --- qt4 tools directory is defined
130 if test x${qt4_tools_path} = xyes
132 qt4_tools_path="/usr/bin"
135 if test x${qt4_install_path} != x
137 qt4_tools_path="${qt4_install_path}/bin"
143 AC_MSG_NOTICE(${qt4_include_path})
144 AC_MSG_NOTICE(${qt4_library_path})
145 AC_MSG_NOTICE(${qt4_tools_path})
147 # test if qt4 is completely defined
149 if test x${qt4_include_path} = x
152 AC_MSG_NOTICE([No Qt4 include path defined])
154 if test x${qt4_library_path} = x
157 AC_MSG_NOTICE([No Qt4 library path defined])
159 if test x${qt4_tools_path} = x
162 AC_MSG_NOTICE([No Qt4 tools path defined])
165 # saving values for compilation variables
166 saved_CPPFLAGS=$CPPFLAGS
167 saved_LDFLAGS=$LDFLAGS
170 if ! test x${qt4_defined} = xno
172 # ask for qt4 support
173 AC_MSG_NOTICE([checking whether qt4 tools and headers are present])
175 # --- we test the presence of moc,first under the form moc-qt4, then moc
176 AC_PATH_PROGS(qt4_moc_found, [moc-qt4 moc], no, ${qt4_tools_path})
177 test x${qt4_moc_found} = xno && AC_MSG_ERROR([Qt4 moc command NOT FOUND])
178 QT_MOC=$qt4_moc_found
181 # --- we test the presence of uic,first under the form uic-qt4, then uic
182 AC_PATH_PROGS(qt4_uic_found, [uic-qt4 uic], no, ${qt4_tools_path})
183 test x${qt4_uic_found} = xno && AC_MSG_ERROR([Qt4 uic command NOT FOUND])
184 QT_UIC=$qt4_uic_found
187 # --- we test the presence of rcc,first under the form rcc-qt4, then rcc
188 AC_PATH_PROGS(qt4_rcc_found, [rcc-qt4 rcc], no, ${qt4_tools_path})
189 test x${qt4_rcc_found} = xno && AC_MSG_ERROR([Qt4 rcc command NOT FOUND])
190 QT_RCC=$qt4_rcc_found
193 # --- we test the header file presence and usability
195 AC_CHECK_FILE($qt4_include_path/qt4/QtCore/qglobal.h,QTINC="/qt4",QTINC="")
196 qt4_include_path="$qt4_include_path${QTINC}"
198 qt4_cppflags="${qt4_cppflags} -I$qt4_include_path/QtCore"
199 qt4_cppflags="${qt4_cppflags} -I$qt4_include_path/QtGui"
200 qt4_cppflags="${qt4_cppflags} -I$qt4_include_path/Qt"
201 qt4_cppflags="${qt4_cppflags} -I$qt4_include_path"
202 CPPFLAGS="${CPPFLAGS} ${qt4_cppflags}"
204 AC_CHECK_HEADERS([qapplication.h],
205 [qt4_header_found=yes],
206 [qt4_header_found=no],
209 test x${qt4_header_found} = xno && AC_MSG_ERROR([Qt4 include file NOT FOUND])
210 AC_SUBST(qt4_cppflags)
212 # --- we test the library file presence and usability
213 if test x${qt4_library_path} = /usr/lib
217 qt4_ldflags="-L$qt4_library_path"
220 AC_MSG_NOTICE([checking whether link with qt4 is working])
222 qt4_libs="-l$qt4_lib_name"
223 LDFLAGS="${LDFLAGS} ${qt4_ldflags}"
224 LIBS="${LIBS} ${qt4_libs}"
227 AC_LINK_IFELSE([AC_LANG_PROGRAM(
228 [[ #include <QApplication>
229 #include <QPushButton> ]],
230 [[ QApplication app(0, 0);
231 QPushButton hello("Hello world!");
232 hello.resize(100, 30);
234 [qt4_lib_found=yes], [qt4_lib_found=no] )
236 test x${qt4_lib_found} = xno && AC_MSG_ERROR([Qt4 library NOT FOUND])
239 AC_SUBST(qt4_ldflags)
242 # --- after all tests are successful, we support Qt4
245 AC_MSG_NOTICE([Qt4 support is OK])
249 AC_MSG_NOTICE([No Qt4 support])
252 # Propagate test into atlocal
255 # Propagate test into Makefiles...
256 AM_CONDITIONAL(WITH_QT4, test $WITH_QT4 = 1)
258 # ... and into source files
259 AC_DEFINE_UNQUOTED(HAS_QT4, $WITH_QT4, [Qt4 library])
261 # restoring saved values
262 CPPFLAGS=$saved_CPPFLAGS
263 LDFLAGS=$saved_LDFLAGS
269 AC_DEFUN([I2_CHECK_QSCINTILLA],
271 AC_REQUIRE([I2_CHECK_QT4])
276 # --- check if qsci4 includes directory is defined
277 qsci4_include_path=""
280 AC_ARG_WITH([qsci4-includes],
281 AC_HELP_STRING([--with-qsci4-includes@<:@=DIR@:>@], [where the Qsci4 includes are: default @<:@$QTDIR/include/Qsci@:>@ or @<:@/usr/include/Qsci@:>@]),
282 [qsci4_include_path=$withval])
284 if test x${qsci4_include_path} = x ; then
285 # --- "" --- try to use QSCINTILLA_DIR/include/Qsci
286 if test "x${QSCINTILLA_DIR}" != "x" ; then
287 qsci4_include_path="${QSCINTILLA_DIR}/include"
289 qsci4_include_path=no
293 if test x${qsci4_include_path} = xno ; then
294 # --- "no" --- no native installation, try to find in Qt
295 qsci4_include_path="${QT_DIR}/include${QTINC}/Qsci"
296 qsci4_cppflags=" -I$qsci4_include_path"
297 # " -I${QT_DIR}/include${QTINC}" is included in qt4_cppflags
299 if test x${qsci4_include_path} = xyes ; then
300 # --- "yes" --- try to find in /usr/include/Qsci
301 qsci4_include_path="/usr/include${QTINC}/Qsci"
302 qsci4_cppflags=" -I$qsci4_include_path"
303 # " -I/usr/include${QTINC}" is included in qt4_cppflags or by default (if QTINC is empty)
305 # --- "other" --- try to find in given dir
306 qsci4_cppflags=" -I$qsci4_include_path/Qsci -I$qsci4_include_path"
310 AC_MSG_NOTICE($qsci4_cppflags)
312 # --- check if qsci4 libraries directory is defined
313 qsci4_library_path=""
315 AC_ARG_WITH([qsci4-libraries],
316 AC_HELP_STRING([--with-qsci4-libraries@<:@=DIR@:>@], [where the Qsci4 libraries are: default @<:@$QTDIR/lib@:>@ or @<:@/usr/lib@:>@]),
317 [qsci4_library_path=$withval])
319 if test x${qsci4_library_path} = x ; then
320 # --- "" --- try to use QSCINTILLA_DIR/lib
321 if test "x${QSCINTILLA_DIR}" != "x" ; then
322 qsci4_library_path="${QSCINTILLA_DIR}/lib"
324 qsci4_library_path=no
328 if test x${qsci4_library_path} = xno ; then
329 # --- "no" --- no native installation, try to find in Qt
330 qsci4_library_path="${QT_DIR}/lib"
332 if test x${qsci4_library_path} = xyes ; then
333 # --- "yes" --- try to find in /usr/lib
334 qsci4_library_path="/usr/lib"
338 AC_MSG_NOTICE($qsci4_library_path)
340 # saving values for compilation variables
341 saved_CPPFLAGS=$CPPFLAGS
342 saved_LDFLAGS=$LDFLAGS
345 # ask for qsci4 support
346 AC_MSG_NOTICE([checking whether qscintilla for qt4 headers are present])
348 # --- we test the header file presence and usability
349 CPPFLAGS="${CPPFLAGS} ${qsci4_cppflags} ${qt4_cppflags}"
351 AC_CHECK_HEADERS([qsciscintilla.h],
352 [qsci4_header_found=yes],
353 [qsci4_header_found=no],
356 if test x${qsci4_header_found} = xyes
358 AC_SUBST(qsci4_cppflags)
360 # --- we test the library file presence and usability
361 if test x${qsci4_library_path} = x/usr/lib
365 qsci4_ldflags="-L$qsci4_library_path"
368 AC_MSG_NOTICE([checking whether qscintilla2 library is present])
369 qsci4_libs=-lqscintilla2
370 AC_CHECK_FILE([${qsci4_library_path}/libqscintilla2.so],
371 [qsci4_library_found=yes],
372 [qsci4_library_found=no])
373 if test x${qsci4_library_found} = xyes
375 AC_MSG_NOTICE([qscintilla for qt4 support])
376 AC_SUBST(qsci4_ldflags)
380 # Propagate test into atlocal
385 AC_MSG_NOTICE([no support for qscintilla for qt4])
388 # Propagate test into Makefiles...
389 AM_CONDITIONAL(WITH_QSCI4, test $WITH_QSCI4 = 1)
391 # ... and into source files
392 AC_DEFINE_UNQUOTED(HAS_QSCI4, $WITH_QSCI4, [QsciScintilla library])
394 # restoring saved values
395 CPPFLAGS=$saved_CPPFLAGS
396 LDFLAGS=$saved_LDFLAGS