From c812e7b365308ef8bd9369db492cd465b3b0c9bc Mon Sep 17 00:00:00 2001 From: mzn Date: Wed, 25 Feb 2009 17:48:22 +0000 Subject: [PATCH] Fix for bug 0019977: Installation of Salome modules wihtout gui. --- adm_local/unix/config_files/Makefile.am | 6 +- adm_local/unix/config_files/check_GUI.m4 | 96 +++++ adm_local/unix/config_files/check_opengl.m4 | 230 +++++++++++ adm_local/unix/config_files/check_qt.m4 | 422 ++++++++++++++++++++ adm_local/unix/config_files/check_vtk.m4 | 237 +++++++++++ build_configure | 33 +- configure.ac | 60 +-- 7 files changed, 1024 insertions(+), 60 deletions(-) create mode 100755 adm_local/unix/config_files/check_GUI.m4 create mode 100644 adm_local/unix/config_files/check_opengl.m4 create mode 100644 adm_local/unix/config_files/check_qt.m4 create mode 100644 adm_local/unix/config_files/check_vtk.m4 diff --git a/adm_local/unix/config_files/Makefile.am b/adm_local/unix/config_files/Makefile.am index 706857c88..0fd894b4f 100644 --- a/adm_local/unix/config_files/Makefile.am +++ b/adm_local/unix/config_files/Makefile.am @@ -22,4 +22,8 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am dist_admlocalm4_DATA = \ -check_GEOM.m4 +check_GEOM.m4 \ +check_GUI.m4 \ +check_qt.m4 \ +check_opengl.m4 \ +check_vtk.m4 diff --git a/adm_local/unix/config_files/check_GUI.m4 b/adm_local/unix/config_files/check_GUI.m4 new file mode 100755 index 000000000..41f3a8d61 --- /dev/null +++ b/adm_local/unix/config_files/check_GUI.m4 @@ -0,0 +1,96 @@ +dnl Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +dnl +dnl Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +dnl +dnl This library is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Lesser General Public +dnl License as published by the Free Software Foundation; either +dnl version 2.1 of the License. +dnl +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Lesser General Public License for more details. +dnl +dnl You should have received a copy of the GNU Lesser General Public +dnl License along with this library; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +dnl +dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +dnl +# Check availability of Salome binary distribution +# +# Author : Marc Tajchman (CEA, 2002) +#------------------------------------------------------------ + +AC_DEFUN([CHECK_GUI_MODULE],[ +AC_REQUIRE([AC_LINKER_OPTIONS])dnl + +LightGUI_ok=no +FullGUI_ok=no + +GUI_LDFLAGS="" +GUI_CXXFLAGS="" + +SALOME_GUI_DIR="" + +AC_ARG_WITH(gui, + [--with-gui=DIR root directory path of SALOME GUI installation], + [], + [with_gui=auto]) + +if test "${with_gui}" = "no"; then + SalomeGUI_need=no +else + # define SALOME_GUI_DIR + if test "${with_gui}" = "yes" -o "${with_gui}" = "auto"; then + SalomeGUI_need="$with_gui" + AC_MSG_RESULT(try \${GUI_ROOT_DIR}: ${GUI_ROOT_DIR}) + if test "x${GUI_ROOT_DIR}" != "x" ; then + # GUI_ROOT_DIR environment variable defined + SALOME_GUI_DIR=${GUI_ROOT_DIR} + else + # search Salome binaries in PATH variable + AC_PATH_PROG(TEMP, SUITApp) + if test "x${TEMP}" != "x" ; then + AC_MSG_RESULT(SUITApp was found at : ${TEMP}) + SALOME_BIN_DIR=`dirname ${TEMP}` + SALOME_GUI_DIR=`cd ${SALOME_BIN_DIR}/../..; pwd` + fi + fi + else + # GUI directory defined by user + SalomeGUI_need=yes + SALOME_GUI_DIR="$with_gui" + fi + + # check GUI installation + AC_CHECKING(for light GUI) + if test -f ${SALOME_GUI_DIR}/bin/salome/SUITApp ; then + LightGUI_ok=yes + AC_MSG_RESULT(Using SALOME GUI distribution in ${SALOME_GUI_DIR}) + + GUI_ROOT_DIR=${SALOME_GUI_DIR} + + GUI_LDFLAGS=-L${SALOME_GUI_DIR}/lib${LIB_LOCATION_SUFFIX}/salome + GUI_CXXFLAGS=-I${SALOME_GUI_DIR}/include/salome + + AC_CHECKING(for full GUI) + if test -f ${SALOME_GUI_DIR}/bin/salome/SALOME_Session_Server ; then + FullGUI_ok=yes + fi + else + AC_MSG_WARN("Cannot find compiled SALOME GUI distribution") + fi + AC_MSG_RESULT(for light GUI: ${LightGUI_ok}) + AC_MSG_RESULT(for full GUI: ${FullGUI_ok}) +fi + +AC_SUBST(GUI_LDFLAGS) +AC_SUBST(GUI_CXXFLAGS) +AC_SUBST(GUI_ROOT_DIR) + +])dnl + + diff --git a/adm_local/unix/config_files/check_opengl.m4 b/adm_local/unix/config_files/check_opengl.m4 new file mode 100644 index 000000000..dc94b1271 --- /dev/null +++ b/adm_local/unix/config_files/check_opengl.m4 @@ -0,0 +1,230 @@ +dnl Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +dnl +dnl Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +dnl +dnl This library is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Lesser General Public +dnl License as published by the Free Software Foundation; either +dnl version 2.1 of the License. +dnl +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Lesser General Public License for more details. +dnl +dnl You should have received a copy of the GNU Lesser General Public +dnl License along with this library; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +dnl +dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +dnl +AC_DEFUN([CHECK_OPENGL],[ +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_CPP])dnl +AC_REQUIRE([AC_LINKER_OPTIONS])dnl + +AC_LANG_SAVE +AC_LANG_CPLUSPLUS + +AC_ARG_WITH(opengl, + [AC_HELP_STRING([--with-opengl=DIR],[root directory path of OpenGL installation])], + [opengl_dir="$withval"], + [dirs="/usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib /opt/graphics/OpenGL/lib64 /opt/graphics/OpenGL/lib /usr/openwin/lib64 /usr/openwin/lib /usr/X11R6/lib64 /usr/X11R6/lib"])dnl + +AC_CHECKING(for OpenGL) +AC_CHECKING(for OpenGL headers) + +OGL_INCLUDES="" +OGL_LIBS="" + +GL_LIB_PATH="" +GLU_LIB_PATH="" + +OpenGL_ok=no +OpenGL_libs_ok=no +OpenGL_headers_ok=no + +dnl openGL headers +# by default +if test "x${opengl_dir}" != "x" ; then + AC_MSG_RESULT(for opengl_dir: $opengl_dir) + AC_CHECK_HEADER([${opengl_dir}/include/GL/gl.h], + [OpenGL_headers_ok=yes; OGL_INCLUDES="-I${opengl_dir}/include"], + [OpenGL_headers_ok=no]) + if test "x${OpenGL_headers_ok}" = "xyes" ; then + AC_CHECKING(for default OpenGL library) + if test "x${opengl_dir}" = "x/usr" ; then + OGL_LIBS="" + else + OGL_LIBS="-L${opengl_dir}/lib" + fi + LDFLAGS_old="$LDFLAGS" + LDFLAGS="$LDFLAGS $OGL_LIBS" + AC_CHECK_LIB([GL], + [glBegin], + [OpenGL_libs_ok=yes], + [OpenGL_libs_ok=no]) + if test "x${OpenGL_libs_ok}" = "xyes" ; then + AC_TRY_LINK([], + [], + [OpenGL_libs_ok=yes ; OpenGL_ok=yes; OGL_LIBS="$OGL_LIBS -lGL"], + [OpenGL_libs_ok=no]) + fi + LDFLAGS="$LDFLAGS_old" + fi +fi + +if test "x${OpenGL_headers_ok}" = "xno" ; then + AC_CHECK_HEADER(GL/gl.h, + [OpenGL_headers_ok=yes], + [OpenGL_headers_ok=no]) +fi + +# under SunOS ? +if test "x${OpenGL_headers_ok}" = "xno" ; then + AC_CHECK_HEADERS(/usr/openwin/share/include/GL/glxmd.h, + [OpenGL_headers_ok=yes; OGL_INCLUDES="-I/usr/openwin/share/include/"], + [OpenGL_headers_ok=no]) +fi + +# under IRIX ? +if test "x${OpenGL_headers_ok}" = "xno" ; then + AC_CHECK_HEADERS(/opt/graphics/OpenGL/include/GL/glxmd.h, + [OpenGL_headers_ok=yes; OGL_INCLUDES="-I/opt/graphics/OpenGL/include"], + [OpenGL_headers_ok=no]) +fi + +# some linux OpenGL servers hide the includes in /usr/X11R6/include/GL +if test "x${OpenGL_headers_ok}" = "xno" ; then + AC_CHECK_HEADERS(/usr/X11R6/include/GL/gl.h, + [OpenGL_headers_ok=yes; OGL_INCLUDES="-I/usr/X11R6/include"], + [OpenGL_headers_ok=no]) +fi + +if test "x${OpenGL_headers_ok}" = "xyes" ; then + AC_CHECKING(for OpenGL library) + for idir in $dirs; do + if test -r "${idir}/libGL.so"; then + AC_MSG_RESULT(in ${idir}) + if test "x${idir}" = "x/usr/lib64" -o "x${idir}" = "x/usr/lib" ; then + GL_LIB_PATH="" + else + GL_LIB_PATH="-L${idir}" + fi + break + fi + # under IRIX ? + if test -r "${idir}/libGL.sl"; then + AC_MSG_RESULT(in ${idir}) + if test "x${idir}" = "x/usr/lib64" -o "x${idir}" = "x/usr/lib" ; then + GL_LIB_PATH="" + else + GL_LIB_PATH="-L${idir}" + fi + break + fi + done + LDFLAGS_old="${LDFLAGS}" + LDFLAGS="${LDFLAGS} ${GL_LIB_PATH}" + AC_CHECK_LIB([GL], + [glBegin], + [OpenGL_libs_ok=yes], + [OpenGL_libs_ok=no]) + if test "x${OpenGL_libs_ok}" = "xyes" ; then + AC_TRY_LINK([], + [], + [OpenGL_libs_ok=yes ; OGL_LIBS="${OGL_LIBS} ${GL_LIB_PATH} -lGL"], + [OpenGL_libs_ok=no]) + fi + LDFLAGS="$LDFLAGS_old" +fi + +if test "x${OpenGL_libs_ok}" = "xyes" ; then + for idir in $dirs; do + if test -r "${idir}/libGLU.so"; then + AC_MSG_RESULT(in ${idir}) + if test "x${idir}" = "x/usr/lib64" -o "x${idir}" = "x/usr/lib" ; then + GLU_LIB_PATH="" + else + GLU_LIB_PATH="-L${idir}" + fi + break + fi + # under IRIX ? + if test -r "${idir}/libGLU.sl"; then + AC_MSG_RESULT(in ${idir}) + if test "x${idir}" = "x/usr/lib64" -o "x${idir}" = "x/usr/lib" ; then + GLU_LIB_PATH="" + else + GLU_LIB_PATH="-L${idir}" + fi + break + fi + done + + # workaround a problem with libGL library location + for idir in $dirs; do + if test -r "${idir}/libGLU.la"; then + GLU_LA_PATH="${idir}/libGLU.la" + GL_LA_PATH_TO_CHECK=`cat ${GLU_LA_PATH} | awk '{ for(i=1;i0) print $i } }'` + if test -z ${GL_LA_PATH_TO_CHECK} || test -r ${GL_LA_PATH_TO_CHECK}; then + # nothing to do + break + fi + for jdir in $dirs; do + if test -r "${jdir}/libGL.la"; then + GL_LA_PATH="${jdir}/libGL.la" + # copy the libGLU.la file and set correct libGL.la path in it + NEW_GLU_LA_PATH=${ROOT_BUILDDIR} + NEW_GLU_LA_FILE="${NEW_GLU_LA_PATH}/libGLU.la" + sed -e "s%${GL_LA_PATH_TO_CHECK}%${GL_LA_PATH}%" ${GLU_LA_PATH} > "${NEW_GLU_LA_FILE}" + chmod -f --reference=${GLU_LA_PATH} "${NEW_GLU_LA_FILE}" + # set a new libGLU.la path + GLU_LIB_PATH="-L${NEW_GLU_LA_PATH}" + # create a simbolic link to libGLU.so + for kdir in $dirs; do + if test -r "${kdir}/libGLU.so"; then + cp -fs "${kdir}/libGLU.so" "${NEW_GLU_LA_PATH}/libGLU.so" + break + fi + done + break + fi + done + break + fi + done + + LDFLAGS_old="${LDFLAGS}" + LDFLAGS="${LDFLAGS} ${OGL_LIBS} ${GLU_LIB_PATH}" + AC_CHECK_LIB([GLU], + [gluBeginSurface], + [OpenGL_libs_ok=yes], + [OpenGL_libs_ok=no]) + if test "x${OpenGL_libs_ok}" = "xyes" ; then + AC_TRY_LINK([], + [], + [OpenGL_libs_ok=yes ; OGL_LIBS="${OGL_LIBS} ${GLU_LIB_PATH} -lGLU"], + [OpenGL_libs_ok=no]) + fi + LDFLAGS="$LDFLAGS_old" +fi + +if test "x${OpenGL_headers_ok}" = "xyes" ; then + if test "x${OpenGL_libs_ok}" = "xyes" ; then + OpenGL_ok=yes + fi +fi + +AC_MSG_RESULT(for OpenGL_headers_ok: $OpenGL_headers_ok) +AC_MSG_RESULT(for OpenGL_libs_ok: $OpenGL_libs_ok) +AC_MSG_RESULT(for OpenGL_ok: $OpenGL_ok) + +AC_SUBST(OGL_INCLUDES) +AC_SUBST(OGL_LIBS) + +AC_LANG_RESTORE + +])dnl + diff --git a/adm_local/unix/config_files/check_qt.m4 b/adm_local/unix/config_files/check_qt.m4 new file mode 100644 index 000000000..5859b6afc --- /dev/null +++ b/adm_local/unix/config_files/check_qt.m4 @@ -0,0 +1,422 @@ +dnl Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +dnl +dnl Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +dnl +dnl This library is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Lesser General Public +dnl License as published by the Free Software Foundation; either +dnl version 2.1 of the License. +dnl +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Lesser General Public License for more details. +dnl +dnl You should have received a copy of the GNU Lesser General Public +dnl License along with this library; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +dnl +dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +dnl +dnl OPTIONS_QT +dnl ------------------------------------------------------------------------ +dnl Adds the --with-qt=path +dnl +AC_DEFUN([OPTIONS_QT], [ + AC_ARG_WITH([qt], + [AC_HELP_STRING([--with-qt], [Possible usage: + "Qt_Install_Path" - prefix to path where Qt was installd; + "" or "yes" or "auto" - means seaching installed Qt product in the system (checking $QTDIR and then - standard system paths ); + "no" - not use Qt product (is not supported) + By default "" option is used)])], + [with_qt=$withval], [with_qt=""]) +]) + +AC_DEFUN([CHECK_QT],[ +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_CXX])dnl +AC_REQUIRE([AC_PROG_CPP])dnl +AC_REQUIRE([AC_PROG_CXXCPP])dnl +AC_REQUIRE([CHECK_OPENGL])dnl +AC_REQUIRE([AC_LINKER_OPTIONS])dnl + +AC_REQUIRE([OPTIONS_QT])dnl + +AC_CHECKING(for Qt) + +if test "x$OpenGL_ok" != "xyes" ; then + AC_MSG_WARN(Qt needs OpenGL correct configuration, check configure output) +fi + +qt_ok=yes + +AC_LANG_SAVE +AC_LANG_CPLUSPLUS + +dnl QT install dir +if test -z $with_qt ; then + with_qt="" +fi +if test "x$with_qt" = "xyes" ; then + dnl in case user wrote --with-qt=yes + with_qt="" +fi +if test "x$with_qt" = "xauto" ; then + dnl in case user wrote --with-qt=auto + with_qt="" +fi +if test "x$with_qt" = "xno" ; then + dnl in case user wrote --with-qt=no + with_qt="" + AC_MSG_WARN(Value no, specified for option --with-qt, is not supported) +fi + +if test "x$with_qt" != "x" ; then + dnl Using "--with-qt" prefix path + QTDIR="$with_qt" +else + if test -z $QTDIR ; then + AC_MSG_WARN(undefined QTDIR variable which specify where Qt product was installed) + for d in /usr/local/lib/qt4 /usr/lib/qt4 ; do + if test -f ${d}/include/Qt/qconfig.h ; then + AC_MSG_RESULT(trying ${d}) + QTDIR="${d}" + break + else + if test -f ${d}/include/qconfig.h ; then + AC_MSG_RESULT(trying ${d}) + QTDIR="${d}" + break + fi + fi + done + else + dnl Using QTDIR environment variable + AC_MSG_RESULT(QTDIR is $QTDIR) + fi +fi + +# +# check QTDIR environment variable +# +if test "x$QTDIR" = "x" +then + AC_MSG_RESULT(Please define correct path in "--with-qt" option or use correct $QTDIR variable) + qt_ok=no +fi + +# +# check Qt version +# +if test "x$qt_ok" = "xyes" +then + qt_inc_ok=no + QTINC="" + AC_CHECK_FILE(${QTDIR}/include/qt4/QtCore/qglobal.h,QTINC="/qt4",QTINC="") + if test "x$QTINC" = "x" + then + AC_CHECK_FILE(${QTDIR}/include${QTINC}/QtCore/qglobal.h,qt_inc_ok=yes,qt_inc_ok=no) + else + qt_inc_ok=yes + fi + if test "x$qt_inc_ok" = "xyes" + then + AC_MSG_CHECKING(whether Qt version >= 4.0) + QT_VERSION=`grep "QT_VERSION_STR" ${QTDIR}/include${QTINC}/QtCore/qglobal.h | sed -e 's%^#define QT_VERSION_STR[[:space:]]*\"\([[:digit:]\.]*\)\"%\1%g'` + QT_VERSION_ID=`echo $QT_VERSION | awk -F. '{v=$[1]*10000+$[2]*100+$[3];print v}'` + if test $QT_VERSION_ID -ge 40000 + then + AC_MSG_RESULT(yes) + else + AC_MSG_RESULT(no) + qt_ok=no + fi + AC_MSG_CHECKING(Qt version) + AC_MSG_RESULT($QT_VERSION) + else + qt_ok=no + fi +fi + +# +# check moc presence (meta-object compiler) +# +if test "x$qt_ok" = "xyes" +then + if test -f ${QTDIR}/bin/moc + then + MOC=${QTDIR}/bin/moc + else + AC_PATH_PROG(MOC, moc) + fi + if test "x$MOC" = "x" + then + qt_ok=no + AC_MSG_RESULT(moc (Qt meta-object compiler) is not in the PATH variable) + else + qt_ok=yes + AC_MSG_RESULT(moc (Qt meta-object compiler) is found) + fi + + if test "x$qt_ok" = "xyes" + then + dnl check moc version + AC_MSG_CHECKING(cheching equality Qt and moc tool version) + MOC_VERSION=`$MOC -v 2>&1 | awk 'BEGIN{FS="[[ ()]]"};{print $(NF-1)}'` + if test "x$QT_VERSION" = "x$MOC_VERSION" + then + AC_MSG_RESULT(yes) + qt_ok=yes + else + AC_MSG_RESULT(moc tool and Qt product are inpompatible $MOC_VERSION) + qt_ok=no + fi + fi +fi + +# +# check uic presence (user interface compiler) +# +if test "x$qt_ok" = "xyes" +then + if test -f ${QTDIR}/bin/uic + then + UIC=${QTDIR}/bin/uic + else + AC_PATH_PROG(UIC, uic) + fi + if test "x$UIC" = "x" + then + qt_ok=no + AC_MSG_RESULT(uic (Qt user interface compiler) is not in the PATH variable) + else + qt_ok=yes + AC_MSG_RESULT(uic (Qt user interface compiler) is found) + fi +fi + +# +# check rcc presence (resources compiler) +# +if test "x$qt_ok" = "xyes" +then + if test -f ${QTDIR}/bin/rcc + then + QRCC=${QTDIR}/bin/rcc + else + AC_PATH_PROG(QRCC, rcc) + fi + if test "x$QRCC" = "x" + then + qt_ok=no + AC_MSG_RESULT(rcc (Qt resources compiler) is not in the PATH variable) + else + qt_ok=yes + AC_MSG_RESULT(rcc (Qt resources compiler) is found) + fi + + if test "x$qt_ok" = "xyes" + then + dnl check rcc version + AC_MSG_CHECKING(cheching equality Qt and rcc tool version) + QRCC_VERSION=`$QRCC -v 2>&1 | awk '{print $NF}'` + if test "x$QT_VERSION" = "x$QRCC_VERSION" + then + AC_MSG_RESULT(yes) + qt_ok=yes + else + AC_MSG_RESULT(rcc tool and Qt product are inpompatible) + qt_ok=no + fi + fi +fi + +# +# check lrelease presence (translation files compiler) +# +if test "x$qt_ok" = "xyes" +then + if test -f ${QTDIR}/bin/lrelease + then + LRELEASE=${QTDIR}/bin/lrelease + else + AC_PATH_PROG(LRELEASE, lrelease) + fi + if test "x$LRELEASE" = "x" + then + qt_ok=no + AC_MSG_RESULT(lrelease (Qt translation files compiler) is not in the PATH variable) + else + qt_ok=yes + AC_MSG_RESULT(lrelease (Qt translation files compiler) is found) + fi + + if test "x$qt_ok" = "xyes" + then + dnl check lrelease version + AC_MSG_CHECKING( equality of Qt and lrelease tool version) + LRELEASE_VERSION=`$LRELEASE -version 2>&1 | awk '{print $NF}'` + if test "x$QT_VERSION" = "x$LRELEASE_VERSION" + then + AC_MSG_RESULT(yes) + qt_ok=yes + else + AC_MSG_RESULT(lrelease tool and Qt product are inpompatible) + qt_ok=no + fi + fi +fi + +QT_ROOT=$QTDIR + +# +# check Qt header files +# +if test "x$qt_ok" = "xyes" +then + AC_CHECKING(include Qt header files) + + CPPFLAGS_old=$CPPFLAGS + CPPFLAGS="$CPPFLAGS -I${QTDIR}/include${QTINC} -I${QTDIR}/include${QTINC}/QtCore" + AC_CHECK_HEADER(QObject,qt_ok=yes,qt_ok=no) + CPPFLAGS=$CPPFLAGS_old + + if test "x$qt_ok" = "xno" + then + AC_MSG_RESULT(qt header files are not found in $QTDIR/include${QTINC}/QtCore) + AC_MSG_RESULT(QTDIR environment variable may be wrong (probably too old Qt version)) + else + AC_MSG_RESULT(qt header files seem to be OK) + QT_INCLUDES="-I${QTDIR}/include${QTINC}" + # user header files + QT_INCLUDES="${QT_INCLUDES} -I${QTDIR}/include${QTINC}/QtCore" + QT_INCLUDES="${QT_INCLUDES} -I${QTDIR}/include${QTINC}/QtGui" + QT_INCLUDES="${QT_INCLUDES} -I${QTDIR}/include${QTINC}/QtOpenGL" + QT_INCLUDES="${QT_INCLUDES} -I${QTDIR}/include${QTINC}/QtXml" + # not used currently header files (uncomment if required) + #QT_INCLUDES="${QT_INCLUDES} -I$(QTDIR)/include${QTINC}/QtAssistant" + #QT_INCLUDES="${QT_INCLUDES} -I$(QTDIR)/include${QTINC}/QtDBus" + #QT_INCLUDES="${QT_INCLUDES} -I$(QTDIR)/include${QTINC}/QtDesigner" + #QT_INCLUDES="${QT_INCLUDES} -I$(QTDIR)/include${QTINC}/QtNetwork" + #QT_INCLUDES="${QT_INCLUDES} -I$(QTDIR)/include${QTINC}/QtSql" + #QT_INCLUDES="${QT_INCLUDES} -I$(QTDIR)/include${QTINC}/QtSvg" + #QT_INCLUDES="${QT_INCLUDES} -I$(QTDIR)/include${QTINC}/QtTest" + #QT_INCLUDES="${QT_INCLUDES} -I$(QTDIR)/include${QTINC}/QtUiTools" + + QT_ASSISTANT_INCLUDES="${QT_ASSISTANT_INCLUDES} -I${QTDIR}/include${QTINC}/QtAssistant" + QT_ASSISTANT_INCLUDES="${QT_ASSISTANT_INCLUDES} -I${QTDIR}/include${QTINC}/QtNetwork" + + # this flag is obsolete with Qt 4 + QT_MT_INCLUDES="$QT_INCLUDES" + fi +fi + +# +# test Qt libraries +# +if test "x$qt_ok" = "xyes" +then + AC_MSG_CHECKING(linking against Qt library) + + CXXFLAGS_old=$CXXFLAGS + CXXFLAGS="$CXXFLAGS $QT_INCLUDES" + + LIBS_old=$LIBS + if test "x$QTDIR" = "x/usr" + then + QT_LIB_DIR="" + elif test -d ${QTDIR}/lib; then + QT_LIB_DIR="-L$QTDIR/lib" + elif test -d ${QTDIR}/lib64; then + QT_LIB_DIR="-L$QTDIR/lib64" + else + AC_MSG_ERROR(Can't detect of Qt library directory ) + qt_ok=no + fi + LIBS="$LIBS $QT_LIB_DIR -lQtCore" + + AC_CACHE_VAL(salome_cv_lib_qt,[ + AC_TRY_LINK( +#include +, int n; + char **s; + QCoreApplication a(n, s); + a.exec();, + eval "salome_cv_lib_qt=yes",eval "salome_cv_lib_qt=no") + ]) + qt_ok="$salome_cv_lib_qt" + + # BEGIN: for CCRT (installation of qt have only a "lib" directory) + if test "x$qt_ok" = "xno" + then + QT_LIB_DIR="-L$QTDIR/lib" + LIBS="$LIBS_old $QT_LIB_DIR -lQtCore" + + AC_CACHE_VAL(salome_cv_lib_qt,[ + AC_TRY_LINK( +#include +, int n; + char **s; + QCoreApplication a(n, s); + a.exec();, + eval "salome_cv_lib_qt=yes",eval "salome_cv_lib_qt=no") + ]) + qt_ok="$salome_cv_lib_qt" + fi + # END: for CCRT + + if test "x$qt_ok" = "xno" + then + AC_MSG_RESULT(no) + AC_MSG_RESULT(unable to link with qt library) + AC_MSG_RESULT(QTDIR environment variable may be wrong (probably too old Qt version)) + else + AC_MSG_RESULT(yes) + # core libs + QT_CORE_LIBS="$QT_LIB_DIR -lQtCore -lQtXml" + # gui libs + QT_GUI_LIBS="$QT_LIB_DIR -lQtGui -lQtOpenGL" + # other libs (currently not used) + QT_OTHER_LIBS="$QT_LIB_DIR" + # other libs (can be used if necessary) + #QT_OTHER_LIBS="$QT_LIB_DIR -lQt3Support -lQtAssistantClient -lQtDesigner -lQtNetwork -lQtSql -lQtSvg -lQtTest -ltQtUiTools" + QT_ASSISTANT_LIBS="$QT_LIB_DIR -lQtAssistantClient -lQtNetwork" + # all libs + QT_LIBS="$QT_CORE_LIBS $QT_GUI_LIBS $QT_OTHER_LIBS" + # this flag is obsolete with Qt 4 + QT_MT_LIBS="$QT_LIBS" + fi + LIBS=$LIBS_old + CXXFLAGS=$CXXFLAGS_old +fi + +AC_SUBST(QTDIR) +AC_SUBST(MOC) +AC_SUBST(UIC) +AC_SUBST(QRCC) +AC_SUBST(LRELEASE) + +AC_SUBST(QT_ROOT) +AC_SUBST(QT_INCLUDES) +AC_SUBST(QT_MT_INCLUDES) +AC_SUBST(QT_ASSISTANT_INCLUDES) +AC_SUBST(QT_LIB_DIR) +AC_SUBST(QT_CORE_LIBS) +AC_SUBST(QT_GUI_LIBS) +AC_SUBST(QT_OTHER_LIBS) +AC_SUBST(QT_LIBS) +AC_SUBST(QT_MT_LIBS) +AC_SUBST(QT_ASSISTANT_LIBS) +AC_SUBST(QT_VERSION) +AC_SUBST(QT_VERSION_ID) + +AC_LANG_RESTORE + +AC_MSG_RESULT(for Qt: $qt_ok) + +# Save cache +AC_CACHE_SAVE + +])dnl +dnl diff --git a/adm_local/unix/config_files/check_vtk.m4 b/adm_local/unix/config_files/check_vtk.m4 new file mode 100644 index 000000000..c70c5adda --- /dev/null +++ b/adm_local/unix/config_files/check_vtk.m4 @@ -0,0 +1,237 @@ +dnl Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +dnl +dnl Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +dnl CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +dnl +dnl This library is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Lesser General Public +dnl License as published by the Free Software Foundation; either +dnl version 2.1 of the License. +dnl +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Lesser General Public License for more details. +dnl +dnl You should have received a copy of the GNU Lesser General Public +dnl License along with this library; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +dnl +dnl See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +dnl +dnl OPTIONS_VTK +dnl ------------------------------------------------------------------------ +dnl Adds the --with-vtk=path and --with-vtk-version configure options +dnl +AC_DEFUN([OPTIONS_VTK], [ + AC_ARG_WITH([vtk], + [AC_HELP_STRING([--with-vtk], [The prefix where VTK is installed (default "" means taking from environment variable)])], + [with_vtk=$withval], [with_vtk=""]) + + AC_ARG_WITH([vtk-version], + [AC_HELP_STRING([--with-vtk-version], [VTK include directory name is vtk-suffix, e.g. vtk-5.0/. What is the suffix? (Default "yes" means taking from environment variable)])], + [vtk_suffix=$withval], [vtk_suffix="yes"]) + + AC_ARG_WITH([paraview], + [AC_HELP_STRING([--with-paraview], [ParaView from the specified location is used instead of VTK (default "" means ParaView should not be used)])]) +]) + +dnl +dnl CHECK_VTK +dnl ------------------------------------------------------------------------ +dnl +AC_DEFUN([CHECK_VTK], [ +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_CXX])dnl +AC_REQUIRE([AC_PROG_CPP])dnl +AC_REQUIRE([AC_PROG_CXXCPP])dnl +AC_REQUIRE([AC_LINKER_OPTIONS])dnl + +AC_REQUIRE([OPTIONS_VTK])dnl + +AC_CHECKING(for VTK) + +AC_LANG_SAVE +AC_LANG_CPLUSPLUS + +AC_SUBST(VTK_INCLUDES) +AC_SUBST(VTK_LIBS) +AC_SUBST(VTKPY_MODULES) + +VTK_INCLUDES="" +VTK_LIBS="" +VTKPY_MODULES="" + +vtk_ok=no + +if test "x$OpenGL_ok" != "xyes" ; then + AC_MSG_WARN(VTK needs OpenGL correct configuration, check configure output) +fi + +AC_PATH_X +if test "x$x_libraries" != "x" +then + LXLIB="-L$x_libraries" +else + LXLIB="" +fi + +if test "x$x_libraries" = "x/usr/lib" +then + LXLIB="" +fi + +if test "x$x_libraries" = "x/usr/lib${LIB_LOCATION_SUFFIX}" +then + LXLIB="" +fi + +LOCAL_INCLUDES="$OGL_INCLUDES" +LOCAL_LIBS="-lvtkCommon -lvtkGraphics -lvtkImaging -lvtkFiltering -lvtkIO -lvtkRendering -lvtkHybrid -lvtkParallel -lvtkWidgets $LXLIB -lX11 -lXt" +TRY_LINK_LIBS="-lvtkCommon $LXLIB -lX11 -lXt" + +dnl VTK version suffix +if test -z $vtk_suffix ; then + vtk_suffix="yes" +fi +if test "x$vtk_suffix" == "xno" ; then + dnl in case user wrote --with-vtk-version=no, use empty suffix + vtk_suffix="" +fi +if test "x$vtk_suffix" != "xyes" ; then + VTKSUFFIX="$vtk_suffix" +else + dnl in case user wrote --with-vtk-version=yes, get the suffix from env + if test -z $VTKSUFFIX ; then + VTKSUFFIX="-5.0" + fi +fi + +dnl VTK install dir +if test -z $with_vtk ; then + with_vtk="" +fi +if test "x$with_vtk" = "xyes" ; then + dnl in case user wrote --with-vtk=yes + with_vtk="" +fi +if test "x$with_vtk" = "xno" ; then + dnl in case user wrote --with-vtk=no + with_vtk="" + AC_MSG_WARN(Value "no", specified for option --with-vtk, is not supported) +fi + +if test "x$with_vtk" != "x" ; then + VTKHOME="$with_vtk" +else + if test -z $VTKHOME ; then + AC_MSG_WARN(undefined VTKHOME variable which specify where vtk was compiled) + for d in /usr/local /usr ; do + if test -f ${d}/include/vtk${VTKSUFFIX}/vtkPlane.h ; then + AC_MSG_RESULT(trying ${d}) + VTKHOME="${d}" + break + else + if test -f ${d}/include/vtk-5.0/vtkPlane.h ; then + AC_MSG_RESULT(trying ${d}) + VTKHOME="${d}" + VTKSUFFIX="-5.0" + break + else + if test -f ${d}/include/vtk/vtkPlane.h ; then + AC_MSG_RESULT(trying ${d}) + VTKHOME="${d}" + VTKSUFFIX="" + break + fi + fi + fi + done + fi +fi + +# Using regular VTK installation +if test "x$with_paraview" = "x" ; then + LOCAL_INCLUDES="-I$VTKHOME/include/vtk${VTKSUFFIX} $LOCAL_INCLUDES" + LOCAL_LIBS="-L$VTKHOME/lib${LIB_LOCATION_SUFFIX}/vtk${VTKSUFFIX} $LOCAL_LIBS" + TRY_LINK_LIBS="-L$VTKHOME/lib${LIB_LOCATION_SUFFIX} -L$VTKHOME/lib${LIB_LOCATION_SUFFIX}/vtk${VTKSUFFIX} $TRY_LINK_LIBS" + if test "x$VTKHOME" != "x/usr" ; then + LOCAL_LIBS="-L$VTKHOME/lib${LIB_LOCATION_SUFFIX} $LOCAL_LIBS" + fi +else +# VTK from ParaView overrides other VTK versions + if test "${with_paraview}" = "yes" ; then + if test -z $PVHOME ; then + PVHOME="/usr" + fi + else + PVHOME=${with_paraview} + fi + + if test -z $PVSRCHOME ; then + PVSRCHOME="$PVHOME/src" + fi + + if test -z $PVINSTALLHOME ; then + PVINSTALLHOME="$PVHOME/bin" + fi + + LOCAL_INCLUDES="-I$PVSRCHOME/VTK/Common -I$PVSRCHOME/VTK/Filtering -I$PVSRCHOME/VTK/GenericFiltering -I$PVSRCHOME/VTK/Graphics -I$PVSRCHOME/VTK/Hybrid -I$PVSRCHOME/VTK/Imaging -I$PVSRCHOME/VTK/Infovis -I$PVSRCHOME/VTK/IO -I$PVSRCHOME/VTK/Parallel -I$PVSRCHOME/VTK/Rendering -I$PVSRCHOME/VTK/Utilities -I$PVSRCHOME/VTK/Views -I$PVSRCHOME/VTK/VolumeRendering -I$PVSRCHOME/VTK/Widgets -I$PVINSTALLHOME/VTK -I$PVINSTALLHOME/VTK/Common -I$PVINSTALLHOME/VTK/Filtering -I$PVINSTALLHOME/VTK/GenericFiltering -I$PVINSTALLHOME/VTK/Graphics -I$PVINSTALLHOME/VTK/Hybrid -I$PVINSTALLHOME/VTK/Imaging -I$PVINSTALLHOME/VTK/Infovis -I$PVINSTALLHOME/VTK/IO -I$PVINSTALLHOME/VTK/Parallel -I$PVINSTALLHOME/VTK/Rendering -I$PVINSTALLHOME/VTK/Utilities -I$PVINSTALLHOME/VTK/Views -I$PVINSTALLHOME/VTK/VolumeRendering -I$PVINSTALLHOME/VTK/Widgets $LOCAL_INCLUDES" + LOCAL_LIBS="-L$PVINSTALLHOME/bin -lvtksys -lvtkzlib -lvtkpng -lvtkjpeg -lvtktiff -lvtkexpat -lvtksqlite -lvtkmetaio -lvtkverdict -lvtkNetCDF -lvtkDICOMParser -lvtkfreetype -lvtkftgl -lvtkexoIIc $LOCAL_LIBS" + TRY_LINK_LIBS="-L$PVINSTALLHOME/bin -lvtksys $TRY_LINK_LIBS" +fi + +dnl vtk headers +CPPFLAGS_old="$CPPFLAGS" +CPPFLAGS="$CPPFLAGS $LOCAL_INCLUDES" + +AC_CHECK_HEADER(vtkPlane.h,vtk_ok="yes",vtk_ok="no") + +CPPFLAGS="$CPPFLAGS_old" + +if test "x$vtk_ok" = "xyes" +then + VTK_INCLUDES="$LOCAL_INCLUDES" + + dnl vtk libraries + + AC_MSG_CHECKING(linking VTK library) + + LIBS_old="$LIBS" + LIBS="$LIBS $TRY_LINK_LIBS" + #LIBS="$LIBS $LOCAL_LIBS" + CPPFLAGS_old="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $VTK_INCLUDES" + + dnl VTKPY_MODULES="$VTKHOME/python" + + AC_CACHE_VAL(salome_cv_lib_vtk,[ + AC_TRY_LINK([#include "vtkPlane.h" + ], + [vtkPlane::New()], + [salome_cv_lib_vtk=yes], + [salome_cv_lib_vtk=no]) + ]) + vtk_ok="$salome_cv_lib_vtk" + LIBS="$LIBS_old" + CPPFLAGS="$CPPFLAGS_old" +fi + +if test "x$vtk_ok" = "xno" +then + AC_MSG_RESULT(no) + AC_MSG_WARN(unable to link with vtk library) +else + AC_MSG_RESULT(yes) + VTK_LIBS="$LOCAL_LIBS" + VTK_MT_LIBS="$LOCAL_LIBS" +fi + +AC_MSG_RESULT(for VTK: $vtk_ok) + +AC_LANG_RESTORE + +# Save cache +AC_CACHE_SAVE + +])dnl diff --git a/build_configure b/build_configure index d8b893183..dbbf3ba87 100755 --- a/build_configure +++ b/build_configure @@ -31,7 +31,6 @@ # ORIG_DIR=`pwd` CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"` -GEOM_WITH_GUI="yes" ######################################################################## # Test if the KERNEL_ROOT_DIR is set correctly @@ -47,34 +46,12 @@ fi # exit #fi -for option -do - case $option in - -with-gui | --with-gui) - GEOM_WITH_GUI="yes" - break;; - -without-gui | --without-gui | -with-gui=no | --with-gui=no) - GEOM_WITH_GUI="no" - break;; - esac -done - ######################################################################## -# Test if the GUI_ROOT_DIR is set correctly -if test ${GEOM_WITH_GUI} = yes; then - if test ! -d "${GUI_ROOT_DIR}"; then - echo "failed : GUI_ROOT_DIR variable is not correct !" - exit - fi -fi cd ${CONF_DIR} ABS_CONF_DIR=`pwd` ####################################################################### -# Update configure.ac script: to set NETGENPLUGIN_WITH_GUI variable -sed -e s/GEOM_WITH_GUI=[a-z]*/GEOM_WITH_GUI=${GEOM_WITH_GUI}/g configure.ac > configure.tmp -mv -f configure.tmp configure.ac mkdir -p salome_adm/unix/config_files #cp -f ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files/* salome_adm/unix/config_files @@ -102,14 +79,8 @@ cp -f ${KERNEL_ROOT_DIR}/salome_adm/unix/SALOMEconfig.h.in salome_adm/unix # autom4te.cache (directory) echo "====================================================== aclocal" -if test ${GEOM_WITH_GUI} = yes; then - aclocal -I adm_local/unix/config_files \ - -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \ - -I ${GUI_ROOT_DIR}/adm_local/unix/config_files || exit 1 -else - aclocal -I adm_local/unix/config_files \ - -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files || exit 1 -fi +aclocal -I adm_local/unix/config_files \ + -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files || exit 1 # ____________________________________________________________________ # libtoolize creates some configuration files (ltmain.sh, diff --git a/configure.ac b/configure.ac index 2c6a8897b..4d5fa551d 100644 --- a/configure.ac +++ b/configure.ac @@ -232,11 +232,34 @@ CORBA=adm_local/unix/$corba fi -GEOM_WITH_GUI=yes +echo +echo --------------------------------------------- +echo Testing GUI +echo --------------------------------------------- +echo + +CHECK_GUI_MODULE -AM_CONDITIONAL(GEOM_ENABLE_GUI, [test "${GEOM_WITH_GUI}" = "yes"]) +gui_ok=no +if test "${SalomeGUI_need}" != "no" -a "${FullGUI_ok}" = "yes" ; then + gui_ok=yes +fi -if test "${GEOM_WITH_GUI}" = "yes"; then +AM_CONDITIONAL(GEOM_ENABLE_GUI, [test "${gui_ok}" = "yes"]) + +if test "${SalomeGUI_need}" == "yes"; then + if test "${FullGUI_ok}" != "yes"; then + AC_MSG_WARN(For configure GEOM module necessary full GUI!) + fi +elif test "${SalomeGUI_need}" == "auto"; then + if test "${FullGUI_ok}" != "yes"; then + AC_MSG_WARN(Full GUI not found. Build will be done without GUI!) + fi +elif test "${SalomeGUI_need}" == "no"; then + echo Build without GUI option has been chosen +fi + +if test "${gui_ok}" = "yes"; then echo echo --------------------------------------------- echo testing openGL @@ -260,26 +283,6 @@ if test "${GEOM_WITH_GUI}" = "yes"; then echo CHECK_VTK - - echo - echo --------------------------------------------- - echo Testing GUI - echo --------------------------------------------- - echo - - CHECK_SALOME_GUI - - echo - echo --------------------------------------------- - echo Testing full GUI - echo --------------------------------------------- - echo - - CHECK_CORBA_IN_GUI - if test "x${CORBA_IN_GUI}" != "xyes"; then - echo "failed : For configure GEOM module necessary full GUI !" - exit - fi fi echo @@ -330,11 +333,12 @@ echo echo Configure -if test "${GEOM_WITH_GUI}" = "yes"; then -variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok omniORB_ok boost_ok occ_ok doxygen_ok graphviz_ok Kernel_ok SalomeGUI_ok" -fi -if test "${GEOM_WITH_GUI}" = "no"; then -variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok hdf5_ok omniORB_ok boost_ok occ_ok doxygen_ok graphviz_ok Kernel_ok" +if test "${gui_ok}" = "yes"; then + variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok omniORB_ok boost_ok occ_ok doxygen_ok graphviz_ok Kernel_ok gui_ok" +elif test "${SalomeGUI_need}" != "no"; then + variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok hdf5_ok omniORB_ok boost_ok occ_ok doxygen_ok graphviz_ok Kernel_ok gui_ok" +else + variables="cc_ok lex_yacc_ok python_ok swig_ok threads_ok hdf5_ok omniORB_ok boost_ok occ_ok doxygen_ok graphviz_ok Kernel_ok" fi for var in $variables -- 2.39.2