2 # Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
4 # Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
5 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License.
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # Lesser General Public License for more details.
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this library; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 # Tool for updating list of .in file for the SALOME project
24 # and regenerating configure script
25 # Author : Marc Tajchman - CEA
30 CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"`
32 ########################################################################
33 # Check --with-kernel option
40 -with-ihm | --with-ihm)
43 -without-ihm | --without-ihm | -with-ihm=no | --with-ihm=no)
49 ########################################################################
50 # Test if the KERNEL_ROOT_DIR is set correctly
52 if test ! -d "${KERNEL_ROOT_DIR}"; then
53 echo "failed : KERNEL_ROOT_DIR variable is not correct !"
57 # Test if the KERNEL_SRC is set correctly
59 #if test ! -d "${KERNEL_SRC}"; then
60 # echo "failed : KERNEL_SRC variable is not correct !"
63 ########################################################################
64 # Test if the GUI_ROOT_DIR is set correctly
66 if test ${SUPERV_WITH_GUI} = yes; then
67 if test ! -d "${GUI_ROOT_DIR}"; then
68 echo "failed : GUI_ROOT_DIR variable is not correct !"
73 ########################################################################
74 # find_in - utility function
77 # find_in directory filename
79 # Finds files following the *.in pattern, recursively in the
80 # directory (first argument).
81 # Results are appended into the file (second argument)
83 # Difference from the standard unix find is that files are tested
92 # if the first argument is not a directory, returns
94 if [ ! -d "$1" ] ; then
98 # dont look in the CVS directories
102 */adm_local/*) return ;;
106 # for each regular file contained in the directory
107 # test if it's a .in file
111 if [ -f "$i" ] ; then
113 *.in) echo " "$i" \\" >> $f;;
119 # for each subdirectory of the first argument, proceeds recursively
123 if [ -d "$i" ] ; then
130 #######################################################################
131 # Generate list of .in files (Makefile.in, config.h.in, etc)
132 # appending it in file configure.in
138 # Common part of the configure.in file
140 chmod u+w configure.in.base
141 if ! \cp -f configure.in.base configure.in_tmp1
144 echo "error : can't create files in" ${CONF_DIR}
146 chmod u-w configure.in.base
149 chmod u-w configure.in.base
151 if [ -e "${CONF_DIR}/salome_adm" ] ; then
152 \rm -f ${CONF_DIR}/salome_adm
155 # make a link allowing AC_OUTPUT to find the salome_adm/.../*.in files
156 echo "" >> configure.in_tmp1
157 echo 'ln -fs ${KERNEL_ROOT_DIR}/salome_adm ${ROOT_SRCDIR}/.' >> configure.in_tmp1
159 echo "" >> configure.in_tmp1
160 echo "AC_OUTPUT([ \\" >> configure.in_tmp1
163 # List of .in files in the adm/unix directory
164 # These files MUST be on top of AC_OUTPUT list so we
165 # put them "manually"
168 echo " ./salome_adm/unix/SALOMEconfig.h \\" >> configure.in_tmp1
169 echo " ./salome_adm/unix/F77config.h \\" >> configure.in_tmp1
170 echo " ./salome_adm/unix/sstream \\" >> configure.in_tmp1
171 echo " ./salome_adm/unix/depend \\" >> configure.in_tmp1
172 echo " ./adm_local/unix/make_omniorb:${ABS_CONF_DIR}/adm_local/unix/make_omniorb.in \\" >> configure.in_tmp1
173 echo " ./salome_adm/unix/envScript \\" >> configure.in_tmp1
174 echo " ./adm_local/unix/make_commence:${ABS_CONF_DIR}/adm_local/unix/make_commence.in \\" >> configure.in_tmp1
175 echo " ./salome_adm/unix/make_conclude \\" >> configure.in_tmp1
176 echo " ./salome_adm/unix/make_module \\" >> configure.in_tmp1
178 \rm -f configure.in_tmp2 configure.in_tmp3
179 touch configure.in_tmp2
180 find_in . configure.in_tmp2
181 sed -e '/^...salome_adm/d' configure.in_tmp2 > configure.in_tmp3
182 sed -e '/^...adm_local.unix.make_omniorb/d' configure.in_tmp3 > configure.in_tmp2
183 sed -e '/^...adm_local.unix.make_commence/d' configure.in_tmp2 > configure.in_tmp3
184 sed -e '/configure.in/d' configure.in_tmp3 > configure.in_tmp2
185 sed -e 's/.in / /' configure.in_tmp2 >> configure.in_tmp1
186 #sed '/^.*salome_adm/d' configure.in_tmp2 > configure.in_tmp3
187 #sed '/configure.in/d' configure.in_tmp3 > configure.in_tmp2
188 #sed 's/.in / /' configure.in_tmp2 >> configure.in_tmp1
190 echo "])" >> configure.in_tmp1
192 # delete the link created for AC_OUTPUT
193 #echo "" >> configure.in_tmp1
194 #echo 'rm -f ${ROOT_SRCDIR}/salome_adm' >> configure.in_tmp1
195 \mv configure.in_tmp1 configure.in_new
196 \rm -f configure.in_tmp2 configure.in_tmp3
199 ########################################################################
200 # Create new (or replace old) configure.in file
201 # Print a message if the file is write protected
205 if test ! -f configure.in
207 echo -n "Creating new file 'configure.in' ... "
208 if \mv configure.in_new configure.in >& /dev/null
212 echo "error, check your file permissions"
215 echo -n "Updating 'configure.in' file ... "
216 if ! \cp configure.in configure.in_old >& /dev/null
220 echo "Can't backup previous configure.in"
221 echo -n "Continue (you will not be able to revert) - (Y/N) ? "
230 if \cp configure.in_new configure.in >& /dev/null
235 echo "error, can't update previous configure.in"
239 ########################################################################
240 # Use autoconf to rebuild the configure script
245 echo -n "Updating 'configure' script ... "
247 echo -n "Creating 'configure' script ... "
250 if test ${SUPERV_WITH_GUI} = yes; then
251 aclocal -I adm_local/unix/config_files -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \
252 -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files/DEPRECATED \
253 -I ${GUI_ROOT_DIR}/adm_local/unix/config_files
255 aclocal -I adm_local/unix/config_files -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \
256 -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files/DEPRECATED
263 echo "failed (check file permissions and/or user quotas ...)"