Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/med.git] / build_configure
index 872aa0f6360cee952513600f8c32e9a036be9474..e928e0d10e628c28537a7d3b19d0c55125a9bf60 100755 (executable)
@@ -11,6 +11,8 @@
 # Date : 10/10/2002
 # $Header$
 #
+# 14/03/2007: Mikhail PONIKAROV - OCN
+# Reorganization for uage of autotools
 
 ORIG_DIR=`pwd`
 CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"`
@@ -19,275 +21,146 @@ CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"`
 # Check --with-kernel option
 
 MED_WITH_KERNEL="yes"
+MED_WITH_GUI="yes"
 
 for option
 do
   case $option in
       -with-kernel | --with-kernel)
           MED_WITH_KERNEL="yes"
+          MED_WITH_GUI="yes"
           break;;
       -without-kernel | --without-kernel | -with-kernel=no | --with-kernel=no)
           MED_WITH_KERNEL="no"
+          MED_WITH_GUI="no"
           break;;
   esac
 done
 
+for option
+do
+  case $option in
+      -with-ihm | --with-ihm)
+          MED_WITH_GUI="yes"
+          break;;
+      -without-ihm | --without-ihm | -with-ihm=no | --with-ihm=no)
+          MED_WITH_GUI="no"
+          break;;
+  esac
+done
 
+########################################################################
+# Test if the KERNEL_ROOT_DIR is set correctly if KERNEL required
+
+if test ${MED_WITH_KERNEL} = yes; then
+    if test ! -d "${KERNEL_ROOT_DIR}"; then
+        echo "failed : KERNEL_ROOT_DIR variable is not correct !"
+        exit
+    fi
+fi
 ########################################################################
 # Test if the GUI_ROOT_DIR is set correctly if GUI required
 
-if test "$MED_WITH_KERNEL" = "yes"; then
+if test ${MED_WITH_GUI} = yes; then
     if test ! -d "${GUI_ROOT_DIR}"; then
         echo "failed : GUI_ROOT_DIR variable is not correct !"
         exit
     fi
 fi
 
-########################################################################
-# find_in - utility function
-#
-# usage :  
-#    find_in directory filename 
-#
-# Finds files following the *.in pattern, recursively in the
-# directory (first argument).
-# Results are appended into the file (second argument)
-#
-# Difference from the standard unix find is that files are tested
-# before directories
-# 
-
-find_in()
-{
-  i=0
-  f=$2
-
-# if the first argument is not a directory, returns
-
-  if [ ! -d "$1" ] ; then 
-     return 
-  fi
-
-# dont look in the CVS directories
-
-  case $1 in
-    */CVS) return ;;
-    */adm_local/*) return ;;
-    *) ;;
-  esac
-
-# for each regular file contained in the directory
-# test if it's a .in file
-
-  for i in "$1"/*
-  do
-     if [ -f "$i" ] ; then
-       case $i in 
-         *.in) echo "  "$i" \\" >> $f;;
-         *) ;;
-        esac
-     fi
-  done
-
-# for each subdirectory of the first argument, proceeds recursively
-
-  for i in "$1"/*
-  do
-     if [ -d "$i" ] ; then
-        find_in "$i" "$f"
-     fi
-  done
-}
-
-
-#######################################################################
-# Generate list of .in files (Makefile.in, config.h.in, etc)
-# appending it in file configure.in
-
 cd ${CONF_DIR}
 ABS_CONF_DIR=`pwd`
 
-#
-# Common part of the configure.in file
-#
-if \cp -f configure.in.base configure.in_tmp1
-then
-       echo
-        chmod u+w configure.in_tmp1
-else
-       echo
-       echo "error : can't create files in" ${CONF_DIR}
-       echo "aborting ..."
-       exit
-fi
-chmod u-w configure.in.base 
-
-if [ -e "${CONF_DIR}/salome_adm" ] ; then
-    \rm -f ${CONF_DIR}/salome_adm
-fi
-
-# insert header and AC_INIT(src) which must go before anything else
-cat > configure.in_tmp1 <<EOF
-#
-#  PLEASE DO NOT MODIFY configure.in FILE
-#
-#  ALL CHANGES WILL BE DISCARDED BY THE NEXT
-#  build_configure COMMAND
-#
-#  CHANGES MUST BE MADE IN configure.in.base FILE
-#
-#
-# Author : Marc Tajchman (CEA)
-# Date : 28/06/2001
-# Modified by : Patrick GOLDBRONN (CEA)
-# Modified by : Marc Tajchman (CEA)
-#
-# Created from configure.in.base
-#
-
-AC_INIT(src)
-
-EOF
-
-# initialize MED_WITH_KERNEL
-echo "MED_WITH_KERNEL=${MED_WITH_KERNEL}"                        >> configure.in_tmp1
-
-# insert the configure.in.base
-cat configure.in.base                                            >> configure.in_tmp1
-
-# make a link allowing AC_OUTPUT to find the salome_adm/.../*.in  files
-echo ""                                                          >> configure.in_tmp1
-echo 'if test ${MED_WITH_KERNEL} = yes; then'                   >> configure.in_tmp1
-echo '    ln -fs ${KERNEL_ROOT_DIR}/salome_adm ${ROOT_SRCDIR}/.' >> configure.in_tmp1
-echo 'else'                                                      >> configure.in_tmp1
-echo '    ln -fs ${ROOT_SRCDIR}/adm_local_without_kernel ${ROOT_SRCDIR}/salome_adm' >> configure.in_tmp1
-echo 'fi'                                                        >> configure.in_tmp1
-
-
-#
-# List of .in files in the adm/unix directory
-# These files MUST be on top of AC_OUTPUT list so we
-# put them "manually"
-#
-# Attention, l'ordre d'entrée des fichiers doit être choisi avec
-# précision
-#
-echo ""                                      >> configure.in_tmp1
-echo "AC_OUTPUT([ \\"                        >> configure.in_tmp1
-echo " ./salome_adm/unix/SALOMEconfig.h \\" >> configure.in_tmp1
-echo " ./salome_adm/unix/sstream \\"        >> configure.in_tmp1
-echo " ./salome_adm/unix/depend \\"         >> configure.in_tmp1
-echo  " ])"                                  >> configure.in_tmp1
-echo ""                                      >> configure.in_tmp1
-echo 'if test $MED_WITH_KERNEL = yes; then' >> configure.in_tmp1
-echo "{"                                     >> configure.in_tmp1
-echo "AC_OUTPUT([ \\"                        >> configure.in_tmp1
-echo " ./salome_adm/unix/F77config.h \\"    >> configure.in_tmp1
-echo " ./adm_local/unix/make_omniorb:${ABS_CONF_DIR}/adm_local/unix/make_omniorb.in \\"    >> configure.in_tmp1
-echo " ./salome_adm/unix/envScript \\"      >> configure.in_tmp1
-echo  " ])"                                  >> configure.in_tmp1
-echo "}"                                     >> configure.in_tmp1
-echo "fi"                                    >> configure.in_tmp1
-echo ""                                      >> configure.in_tmp1
-echo "AC_OUTPUT([ \\"                        >> configure.in_tmp1
-echo " ./salome_adm/unix/make_module \\"    >> configure.in_tmp1
-
-# _CS_gbo Pour assurer ls construction correct de la chaîne de
-# dépendance, il apparaît nécessaire de surcharger le make_conclude
-# (resp. make_commence) pardéfaut, c'est à dire le make_conclude de
-# salome_adm, par le make_conclude (resp. make_commence) du module,
-# c'est à dire le make_conclude (resp. make_commence) du répertoire
-# adm_local
-echo " ./adm_local/unix/make_commence:${ABS_CONF_DIR}/adm_local/unix/make_commence.in \\"   >> configure.in_tmp1
-echo " ./adm_local/unix/make_conclude:${ABS_CONF_DIR}/adm_local/unix/make_conclude.in \\"   >> configure.in_tmp1
-
-\rm -f configure.in_tmp2 configure.in_tmp3
-touch configure.in_tmp2
-
-find_in . configure.in_tmp2
-
-# _CS_gbo_100204 Mise à jour du filtre pour prise en compte des
-# restrictions imposées par les versions récente de autoconf.
-    sed -e '/^...salome_adm/d' \
-       -e '/configure.in/d'      \
-       -e 's/.in / /' configure.in_tmp2     >> configure.in_tmp1
-
-echo  " ])"                                  >> configure.in_tmp1
-
-
-# delete the link created for AC_OUTPUT
-#echo 'rm -f ${ROOT_SRCDIR}/salome_adm' >> configure.in_tmp1
-\mv configure.in_tmp1 configure.in_new
-\rm  -f configure.in_tmp2 configure.in_tmp3
-
-
-########################################################################
-# Create new (or replace old) configure.in file
-# Print a message if the file is write protected
-#
-
-echo
-if test ! -f configure.in
-then
-       echo -n "Creating new file 'configure.in' ... "
-       if \mv configure.in_new configure.in >& /dev/null
-       then
-               echo "done"
-       else
-               echo "error, check your file permissions"
-       fi
-else
-       echo -n "Updating 'configure.in' file ... "
-       if \cp configure.in configure.in_old >& /dev/null
-       then
-               echo
-       else
-               echo
-               echo
-               echo "Can't backup previous configure.in"
-               echo -n "Continue (you will not be able to revert) - (Y/N) ? "
-               read R
-                case "x$R" in
-                   xn*) exit;;
-                   xN*) exit;;
-               esac
-               echo
-               echo -n "                                 "
-       fi
-       if \cp configure.in_new configure.in >& /dev/null
-       then
-               echo "done"
-       else
-               echo
-               echo "error, can't update previous configure.in"
-       fi
-fi
-
-########################################################################
-# Use autoconf to rebuild the configure script
-#
-
-if test -f configure
-then
-       echo -n "Updating 'configure' script ...  "
-else
-       echo -n "Creating 'configure' script ...  "
-fi
-
-if test "x${MED_WITH_KERNEL}" != "xno"; then
-   AUX_CONFIG_INC="-I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files -I ${GUI_ROOT_DIR}/adm_local/unix/config_files"
-else
-   AUX_CONFIG_INC="-I adm_local_without_kernel/unix/config_files"
+#######################################################################
+# Update configure.ac script: to set MED_WITH_KERNEL and MED_WITH_GUI variables
+sed -e s/MED_WITH_KERNEL=[a-z]*/MED_WITH_KERNEL=${MED_WITH_KERNEL}/g configure.ac > configure.tmp
+sed -e s/MED_WITH_GUI=[a-z]*/MED_WITH_GUI=${MED_WITH_GUI}/g configure.tmp > configure.ac
+rm configure.tmp
+
+# copy configure files
+CONFIGURE_SOURCE_DIR=${KERNEL_ROOT_DIR}/salome_adm
+if test ${MED_WITH_KERNEL} = no; then
+  CONFIGURE_SOURCE_DIR=${ABS_CONF_DIR}/adm_local_without_kernel
 fi
 
-aclocal -I adm_local/unix/config_files ${AUX_CONFIG_INC}
-if autoconf
-then
-       echo "done"
+rm -rf salome_adm
+mkdir -p salome_adm/unix/config_files
+#cp -f ${CONFIGURE_SOURCE_DIR}/unix/config_files/* salome_adm/unix/config_files
+cp -f ${CONFIGURE_SOURCE_DIR}/unix/SALOMEconfig.h.in salome_adm/unix
+#if test ${MED_WITH_KERNEL} = yes; then
+#  cp -f ${CONFIGURE_SOURCE_DIR}/unix/pythonbe.py salome_adm/unix
+#fi
+
+# if with GUI, cofy configure files from it
+#if test ${MED_WITH_GUI} = yes; then
+#  cp -f ${GUI_ROOT_DIR}/adm_local/unix/config_files/* salome_adm/unix/config_files
+#fi
+
+# remove KERNEL deprecated configure files
+#for deprecated in ac_cc_warnings.m4 ac_cxx_partial_specialization.m4 \
+#  check_mico.m4 config.guess ltmain.sh ac_cxx_bool.m4 ltconfig ac_cxx_typename.m4 \
+#  check_pthreads.m4 config.sub libtool.m4 ac_cxx_mutable.m4 missing
+#do
+#  rm -f salome_adm/unix/config_files/${deprecated}
+#done
+
+# ____________________________________________________________________
+# aclocal creates the aclocal.m4 file from the standard macro and the
+# custom macro embedded in the directory salome_adm/unix/config_files
+# and KERNEL config_files directory.
+# output:
+#   aclocal.m4
+#   autom4te.cache (directory)
+echo "====================================================== aclocal"
+
+if test ${MED_WITH_GUI} = yes; then
+  aclocal -I adm_local/unix/config_files \
+          -I ${CONFIGURE_SOURCE_DIR}/unix/config_files \
+         -I ${GUI_ROOT_DIR}/adm_local/unix/config_files || exit 1
 else
-       echo "failed (check file permissions and/or user quotas ...)"
+  aclocal -I adm_local/unix/config_files \
+          -I ${CONFIGURE_SOURCE_DIR}/unix/config_files || exit 1
 fi
 
-cd ${ORIG_DIR}
-
-echo
+# ____________________________________________________________________
+# libtoolize creates some configuration files (ltmain.sh,
+# config.guess and config.sub). It only depends on the libtool
+# version. The files are created in the directory specified with the
+# AC_CONFIG_AUX_DIR(<mydir>) tag (see configure.ac).
+# output:
+#   salome_adm/unix/config_files/config.guess
+#   salome_adm/unix/config_files/config.sub
+#   salome_adm/unix/config_files/ltmain.sh
+#echo "====================================================== libtoolize"
+
+libtoolize --force --copy --automake || exit 1
+
+# ____________________________________________________________________
+# make link to KERNEL configuration files to
+#ln -sf ${KERNEL_ROOT_DIR}/salome_adm .
+
+# ____________________________________________________________________
+# autoconf creates the configure script from the file configure.ac (or
+# configure.in if configure.ac doesn't exist)
+# output:
+#   configure
+echo "====================================================== autoconf"
+
+autoconf
+
+# ____________________________________________________________________
+# automake creates some scripts used in building process
+# (install-sh, missing, ...). It only depends on the automake
+# version. The files are created in the directory specified with the
+# AC_CONFIG_AUX_DIR(<mydir>) tag (see configure.ac). This step also
+# creates the Makefile.in files from the Makefile.am files.
+# output:
+#   salome_adm/unix/config_files/compile
+#   salome_adm/unix/config_files/depcomp
+#   salome_adm/unix/config_files/install-sh
+#   salome_adm/unix/config_files/missing
+#   salome_adm/unix/config_files/py-compile
+#   Makefile.in (from Makefile.am)
+echo "====================================================== automake"
+
+automake --copy --gnu --add-missing