2 # Copyright (C) 2007-2008 CEA/DEN, EDF R&D
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 # Tool for updating list of .in file for the SALOME project
21 # and regenerating configure script
22 # Author : Marc Tajchman - CEA
26 CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"`
27 BLSURFPLUGIN_WITH_GUI="yes"
29 ########################################################################
30 # Test if the KERNEL_ROOT_DIR is set correctly
32 if test ! -d "${KERNEL_ROOT_DIR}"; then
33 echo "failed : KERNEL_ROOT_DIR variable is not correct !"
37 # Test if the KERNEL_SRC is set correctly
39 #if test ! -d "${KERNEL_SRC}"; then
40 # echo "failed : KERNEL_SRC variable is not correct !"
47 -with-gui | --with-gui)
48 BLSURFPLUGIN_WITH_GUI="yes"
50 -without-gui | --without-gui | -with-gui=no | --with-gui=no)
51 BLSURFPLUGIN_WITH_GUI="no"
56 ########################################################################
57 # Test if the GUI_ROOT_DIR is set correctly
59 if test ${BLSURFPLUGIN_WITH_GUI} = yes; then
60 if test ! -d "${GUI_ROOT_DIR}"; then
61 echo "failed : GUI_ROOT_DIR variable is not correct !"
66 ########################################################################
67 # Test if the MED_ROOT_DIR is set correctly
69 if test ! -d "${MED_ROOT_DIR}"; then
70 echo "failed : MED_ROOT_DIR variable is not correct !"
74 ########################################################################
75 # Test if the GEOM_ROOT_DIR is set correctly
77 if test ! -d "${GEOM_ROOT_DIR}"; then
78 echo "failed : GEOM_ROOT_DIR variable is not correct !"
82 ########################################################################
83 # Test if the SMESH_ROOT_DIR is set correctly
85 if test ! -d "${SMESH_ROOT_DIR}"; then
86 echo "failed : SMESH_ROOT_DIR variable is not correct !"
90 ########################################################################
91 # find_in - utility function
94 # find_in directory filename
96 # Finds files following the *.in pattern, recursively in the
97 # directory (first argument).
98 # Results are appended into the file (second argument)
100 # Difference from the standard unix find is that files are tested
109 # if the first argument is not a directory, returns
111 if [ ! -d "$1" ] ; then
115 # dont look in the CVS directories
119 */adm_local/*) return ;;
123 # for each regular file contained in the directory
124 # test if it's a .in file
128 if [ -f "$i" ] ; then
130 *.in) echo " "$i" \\" >> $f;;
136 # for each subdirectory of the first argument, proceeds recursively
140 if [ -d "$i" ] ; then
147 #######################################################################
148 # Generate list of .in files (Makefile.in, config.h.in, etc)
149 # appending it in file configure.in
155 # Common part of the configure.in file
157 chmod u+w configure.in.base
158 if ! \cp -f configure.in.base configure.in_tmp1
161 echo "error : can't create files in" ${CONF_DIR}
163 chmod u-w configure.in.base
166 chmod u-w configure.in.base
168 if [ -e "${CONF_DIR}/salome_adm" ] ; then
169 \rm -f ${CONF_DIR}/salome_adm
172 # make a link allowing AC_OUTPUT to find the salome_adm/.../*.in files
173 echo "" >> configure.in_tmp1
174 echo 'ln -fs ${KERNEL_ROOT_DIR}/salome_adm ${ROOT_SRCDIR}/.' >> configure.in_tmp1
176 echo "" >> configure.in_tmp1
177 echo "AC_OUTPUT([ \\" >> configure.in_tmp1
180 # List of .in files in the adm/unix directory
181 # These files MUST be on top of AC_OUTPUT list so we
182 # put them "manually"
185 echo " ./salome_adm/unix/SALOMEconfig.h \\" >> configure.in_tmp1
186 echo " ./salome_adm/unix/F77config.h \\" >> configure.in_tmp1
187 echo " ./salome_adm/unix/sstream \\" >> configure.in_tmp1
188 echo " ./salome_adm/unix/depend \\" >> configure.in_tmp1
189 echo " ./adm_local/unix/make_omniorb:${ABS_CONF_DIR}/adm_local/unix/make_omniorb.in \\" >> configure.in_tmp1
190 echo " ./salome_adm/unix/envScript \\" >> configure.in_tmp1
191 echo " ./adm_local/unix/make_commence:${ABS_CONF_DIR}/adm_local/unix/make_commence.in \\" >> configure.in_tmp1
192 echo " ./salome_adm/unix/make_conclude \\" >> configure.in_tmp1
193 echo " ./salome_adm/unix/make_module \\" >> configure.in_tmp1
195 \rm -f configure.in_tmp2 configure.in_tmp3
196 touch configure.in_tmp2
197 find_in . configure.in_tmp2
198 sed -e '/^...salome_adm/d' configure.in_tmp2 > configure.in_tmp3
199 sed -e '/^...adm_local.unix.make_omniorb/d' configure.in_tmp3 configure.in_tmp2
200 sed -e '/^...adm_local.unix.make_commence/d' configure.in_tmp2 > configure.in_tmp3
201 sed -e '/configure.in/d' configure.in_tmp3 > configure.in_tmp2
202 sed -e 's/.in / /' configure.in_tmp2 >> configure.in_tmp1
203 #sed '/^.salome_adm/d' configure.in_tmp2 > configure.in_tmp3
204 #sed '/configure.in/d' configure.in_tmp3 > configure.in_tmp2
205 #sed 's/.in / /' configure.in_tmp2 >> configure.in_tmp1
207 echo "])" >> configure.in_tmp1
209 # delete the link created for AC_OUTPUT
210 echo "" >> configure.in_tmp1
211 #echo 'rm -f ${ROOT_SRCDIR}/salome_adm' >> configure.in_tmp1
212 \mv configure.in_tmp1 configure.in_new
213 \rm -f configure.in_tmp2 configure.in_tmp3
216 ########################################################################
217 # Create new (or replace old) configure.in file
218 # Print a message if the file is write protected
222 if test ! -f configure.in
224 echo -n "Creating new file 'configure.in' ... "
225 if \mv configure.in_new configure.in >& /dev/null
229 echo "error, check your file permissions"
232 echo -n "Updating 'configure.in' file ... "
233 if ! \cp configure.in configure.in_old >& /dev/null
237 echo "Can't backup previous configure.in"
238 echo -n "Continue (you will not be able to revert) - (Y/N) ? "
247 if \cp configure.in_new configure.in >& /dev/null
252 echo "error, can't update previous configure.in"
256 ########################################################################
257 # Use autoconf to rebuild the configure script
262 echo -n "Updating 'configure' script ... "
264 echo -n "Creating 'configure' script ... "
267 if test ${BLSURFPLUGIN_WITH_GUI} = yes; then
268 aclocal -I adm_local/unix/config_files \
269 -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \
270 -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files/DEPRECATED \
271 -I ${GUI_ROOT_DIR}/adm_local/unix/config_files \
272 -I ${MED_ROOT_DIR}/adm_local/unix/config_files \
273 -I ${GEOM_ROOT_DIR}/adm_local/unix/config_files \
274 -I ${SMESH_ROOT_DIR}/adm_local/unix/config_files
276 aclocal -I adm_local/unix/config_files \
277 -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \
278 -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files/DEPRECATED \
279 -I ${MED_ROOT_DIR}/adm_local/unix/config_files \
280 -I ${GEOM_ROOT_DIR}/adm_local/unix/config_files \
281 -I ${SMESH_ROOT_DIR}/adm_local/unix/config_files
288 echo "failed (check file permissions and/or user quotas ...)"