From ad070633c6d34d6e2b5cb35588cdaad099fcf140 Mon Sep 17 00:00:00 2001 From: mzn Date: Wed, 25 Feb 2009 17:50:43 +0000 Subject: [PATCH] Fix for bug 0019977: Installation of Salome modules wihtout gui. --- adm_local/unix/config_files/Makefile.am | 3 +- adm_local/unix/config_files/check_qwt.m4 | 170 +++++++++++++++++++++++ build_configure | 43 +----- configure.ac | 65 ++++----- 4 files changed, 210 insertions(+), 71 deletions(-) create mode 100644 adm_local/unix/config_files/check_qwt.m4 diff --git a/adm_local/unix/config_files/Makefile.am b/adm_local/unix/config_files/Makefile.am index 0ed70f5f8..54f5b3f51 100644 --- a/adm_local/unix/config_files/Makefile.am +++ b/adm_local/unix/config_files/Makefile.am @@ -24,4 +24,5 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am dist_admlocalm4_DATA = \ check_SMESH.m4 \ check_f77.m4 \ - check_Platform.m4 + check_Platform.m4 \ + check_qwt.m4 diff --git a/adm_local/unix/config_files/check_qwt.m4 b/adm_local/unix/config_files/check_qwt.m4 new file mode 100644 index 000000000..c62506993 --- /dev/null +++ b/adm_local/unix/config_files/check_qwt.m4 @@ -0,0 +1,170 @@ +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_QWT],[ +AC_REQUIRE([CHECK_QT])dnl +AC_REQUIRE([AC_LINKER_OPTIONS])dnl + +AC_CHECKING(for qwt) + +AC_LANG_SAVE +AC_LANG_CPLUSPLUS + +qwt_ok=yes + +dnl where is qwt ? + +AC_ARG_WITH(qwt, + [ --with-qwt=DIR directory path to QWT installation ], + [QWTHOME="$withval" + AC_MSG_RESULT("select $withval as path to QWT") + ]) + +AC_ARG_WITH(qwt_inc, + [ --with-qwt_inc=DIR directory path to QWT includes ], + [QWT_INCDIR="$withval" + AC_MSG_RESULT("select $withval as path to QWT includes") + ]) + +if test -z $QWTHOME; then + AC_MSG_RESULT(QWTHOME not defined) + exist_ok=no + if test "x$exist_ok" = "xno"; then + for d in /usr/local /usr ; do + AC_CHECK_FILE(${d}/lib${LIB_LOCATION_SUFFIX}/libqwt.so,exist_ok=yes,exist_ok=no) + if test "x$exist_ok" = "xyes"; then + QWTHOME=$d + AC_MSG_RESULT(libqwt.so detected in $d/lib) + fi + done + fi + if test "x$exist_ok" = "xno"; then + for d in `echo $LD_LIBRARY_PATH | sed -e "s/:/ /g"` ; do + if test -f $d/libqwt.so ; then + AC_MSG_RESULT(libqwt.so detected in $d) + QWTHOME=$d + QWTHOME=`echo ${QWTHOME} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"` + exist_ok=yes + break + fi + done + fi + if test "x$exist_ok" = "xyes"; then + if test -z $QWT_INCDIR; then + QWT_INCDIR=$QWTHOME"/include/qwt" + if test ! -f $QWT_INCDIR/qwt.h ; then + QWT_INCDIR=$QWTHOME"/include" + fi + if test ! -f $QWT_INCDIR/qwt.h ; then + QWT_INCDIR=/usr/lib/qt4/include/qwt + fi + fi + else + qwt_ok=no + fi +else + if test -z $QWT_INCDIR; then + QWT_INCDIR="$QWTHOME/include" + fi +fi + +if test "x$qwt_ok" = xno -o ! -d "$QWTHOME" ; then + AC_MSG_RESULT(no) + AC_MSG_WARN(qwt not found) + qwt_ok=no +else + CPPFLAGS_old=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $QT_INCLUDES -I$QWT_INCDIR" + + AC_CHECK_HEADER(qwt.h,qwt_ok=yes,qwt_ok=no) + CPPFLAGS=$CPPFLAGS_old + + AC_MSG_CHECKING(include of qwt headers) + + if test "x$qwt_ok" = xno ; then + AC_MSG_RESULT(no) + AC_MSG_WARN(qwt not found) + else + AC_MSG_RESULT(yes) + QWT_INCLUDES=-I$QWT_INCDIR + fi + + # + # test Qwt libraries + # + if test "x$qwt_ok" = "xyes" ; then + AC_MSG_CHECKING(linking qwt library) + + LIBS_old=$LIBS + LIBS="$LIBS $QT_LIBS" + if test "x$QWTHOME" = "x/usr" ; then + LIBS="$LIBS -lqwt" + else + LIBS="$LIBS -L$QWTHOME/lib -lqwt" + fi + + CXXFLAGS_old=$CXXFLAGS + CXXFLAGS="$CXXFLAGS $QT_INCLUDES $QWT_INCLUDES" + + AC_CACHE_VAL(salome_cv_lib_qwt,[ + AC_TRY_LINK( +#include +#include +, int n; + char **s; + QApplication a(n, s); + QwtPlot p; + p.resize( 600, 400 ); + p.show(); + a.exec();, + eval "salome_cv_lib_qwt=yes",eval "salome_cv_lib_qwt=no") + ]) + qwt_ok="$salome_cv_lib_qwt" + + if test "x$qwt_ok" = "xno" ; then + AC_MSG_RESULT(unable to link with qwt library) + AC_MSG_RESULT(QWTHOME environment variable may be wrong) + else + AC_MSG_RESULT(yes) + if test "x$QWTHOME" = "x/usr" ; then + QWT_LIBS=" -lqwt" + else + QWT_LIBS="-L$QWTHOME/lib -lqwt" + fi + fi + + LIBS=$LIBS_old + CXXFLAGS=$CXXFLAGS_old + fi +fi + +AC_SUBST(QWT_INCLUDES) +AC_SUBST(QWT_LIBS) + +AC_LANG_RESTORE + +AC_MSG_RESULT(for qwt: $qwt_ok) + +# Save cache +AC_CACHE_SAVE + +])dnl +dnl diff --git a/build_configure b/build_configure index d135d9e8d..07d07d604 100755 --- a/build_configure +++ b/build_configure @@ -29,7 +29,6 @@ # ORIG_DIR=`pwd` CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"` -SMESH_WITH_GUI="yes" ######################################################################## # Test if the KERNEL_ROOT_DIR is set correctly @@ -46,28 +45,6 @@ fi # exit #fi -for option -do - case $option in - -with-gui | --with-gui) - SMESH_WITH_GUI="yes" - break;; - -without-gui | --without-gui | -with-gui=no | --with-gui=no) - SMESH_WITH_GUI="no" - break;; - esac -done - -######################################################################## -# Test if the GUI_ROOT_DIR is set correctly - -if test ${SMESH_WITH_GUI} = yes; then - if test ! -d "${GUI_ROOT_DIR}"; then - echo "failed : GUI_ROOT_DIR variable is not correct !" - exit - fi -fi - ######################################################################## # Test if the MED_ROOT_DIR is set correctly @@ -89,9 +66,6 @@ cd ${CONF_DIR} ABS_CONF_DIR=`pwd` ####################################################################### -# Update configure.ac script: to set SMESH_WITH_GUI variable -sed -e s/SMESH_WITH_GUI=[a-z]*/SMESH_WITH_GUI=${SMESH_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 @@ -120,19 +94,10 @@ cp -f ${KERNEL_ROOT_DIR}/salome_adm/unix/SALOMEconfig.h.in salome_adm/unix # aclocal.m4 # autom4te.cache (directory) echo "====================================================== aclocal" - -if test ${SMESH_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 \ - -I ${MED_ROOT_DIR}/adm_local/unix/config_files \ - -I ${GEOM_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 \ - -I ${MED_ROOT_DIR}/adm_local/unix/config_files \ - -I ${GEOM_ROOT_DIR}/adm_local/unix/config_files || exit 1 -fi +aclocal -I adm_local/unix/config_files \ + -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \ + -I ${MED_ROOT_DIR}/adm_local/unix/config_files \ + -I ${GEOM_ROOT_DIR}/adm_local/unix/config_files || exit 1 # ____________________________________________________________________ # libtoolize creates some configuration files (ltmain.sh, diff --git a/configure.ac b/configure.ac index f8b78be01..bba2836de 100644 --- a/configure.ac +++ b/configure.ac @@ -212,10 +212,6 @@ echo ENABLE_PTHREADS -SMESH_WITH_GUI=yes - -AM_CONDITIONAL(SMESH_ENABLE_GUI, [test "${SMESH_WITH_GUI}" = "yes"]) - if test "x${GUI_DISABLE_CORBA}" != "xyes" ; then echo echo --------------------------------------------- @@ -255,8 +251,34 @@ dnl CHECK_MICO fi +echo +echo --------------------------------------------- +echo Testing GUI +echo --------------------------------------------- +echo + +CHECK_GUI_MODULE -if test "${SMESH_WITH_GUI}" = "yes"; then +gui_ok=no +if test "${SalomeGUI_need}" != "no" -a "${FullGUI_ok}" = "yes" ; then + gui_ok=yes +fi + +AM_CONDITIONAL(SMESH_ENABLE_GUI, [test "${gui_ok}" = "yes"]) + +if test "${SalomeGUI_need}" == "yes"; then + if test "${FullGUI_ok}" != "yes"; then + AC_MSG_WARN(For configure SMESH 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 @@ -280,26 +302,6 @@ if test "${SMESH_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 SMESH module necessary full GUI !" - exit - fi fi echo @@ -326,7 +328,7 @@ echo CHECK_CAS -if test "${SMESH_WITH_GUI}" = "yes"; then +if test "${gui_ok}" = "yes"; then echo echo --------------------------------------------- @@ -379,12 +381,13 @@ echo --------------------------------------------- echo echo Configure -if test "${SMESH_WITH_GUI}" = "yes"; then -variables="cc_ok fortran_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok omniORB_ok occ_ok doxygen_ok graphviz_ok qwt_ok Kernel_ok Geom_ok Med_ok SalomeGUI_ok" -fi -if test "${SMESH_WITH_GUI}" = "no"; then -variables="cc_ok fortran_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok hdf5_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok Geom_ok Med_ok" +if test "${gui_ok}" = "yes"; then + variables="cc_ok fortran_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok omniORB_ok occ_ok doxygen_ok graphviz_ok qwt_ok Kernel_ok Geom_ok Med_ok gui_ok" +elif test "${SalomeGUI_need}" != "no"; then + variables="cc_ok fortran_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok hdf5_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok Geom_ok Med_ok gui_ok" +else + variables="cc_ok fortran_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok hdf5_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok Geom_ok Med_ok" fi for var in $variables -- 2.39.2