4 # Tool for updating list of .in file for the SALOME project
5 # and regenerating configure script
7 # Author : Marc Tajchman - CEA
12 CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"`
14 ########################################################################
15 # Test if the KERNEL_ROOT_DIR is set correctly
17 if test ! -d "${KERNEL_ROOT_DIR}"; then
18 echo "failed : KERNEL_ROOT_DIR variable is not correct !"
22 # Test if the KERNEL_SRC is set correctly
24 #if test ! -d "${KERNEL_SRC}"; then
25 # echo "failed : KERNEL_SRC variable is not correct !"
28 ########################################################################
29 # Test if the GUI_ROOT_DIR is set correctly
31 if test ! -d "${GUI_ROOT_DIR}"; then
32 echo "failed : GUI_ROOT_DIR variable is not correct !"
36 ########################################################################
37 # Test if the MED_ROOT_DIR is set correctly
39 if test ! -d "${MED_ROOT_DIR}"; then
40 echo "failed : MED_ROOT_DIR variable is not correct !"
44 ########################################################################
45 # Test if the GEOM_ROOT_DIR is set correctly
47 if test ! -d "${GEOM_ROOT_DIR}"; then
48 echo "failed : GEOM_ROOT_DIR variable is not correct !"
52 ########################################################################
53 # Test if the SMESH_ROOT_DIR is set correctly
55 if test ! -d "${SMESH_ROOT_DIR}"; then
56 echo "failed : SMESH_ROOT_DIR variable is not correct !"
60 ########################################################################
61 # find_in - utility function
64 # find_in directory filename
66 # Finds files following the *.in pattern, recursively in the
67 # directory (first argument).
68 # Results are appended into the file (second argument)
70 # Difference from the standard unix find is that files are tested
79 # if the first argument is not a directory, returns
81 if [ ! -d "$1" ] ; then
85 # dont look in the CVS directories
89 */adm_local/*) return ;;
93 # for each regular file contained in the directory
94 # test if it's a .in file
100 *.in) echo " "$i" \\" >> $f;;
106 # for each subdirectory of the first argument, proceeds recursively
110 if [ -d "$i" ] ; then
117 #######################################################################
118 # Generate list of .in files (Makefile.in, config.h.in, etc)
119 # appending it in file configure.in
125 echo "CONF_DIR : $CONF_DIR"
126 echo "ABS_CONF_DIR : $ABS_CONF_DIR"
127 echo "KERNEL_ROOT_DIR : $KERNEL_ROOT_DIR"
128 echo "ROOT_SRCDIR : $ROOT_SRCDIR"
132 # Common part of the configure.in file
134 chmod u+w configure.in.base
135 if ! \cp -f configure.in.base configure.in_tmp1
138 echo "error : can't create files in" ${CONF_DIR}
140 chmod u-w configure.in.base
143 chmod u-w configure.in.base
145 if [ -e "${CONF_DIR}/salome_adm" ] ; then
146 echo "salome_adm file exists in the current directory"
147 \rm -f ${CONF_DIR}/salome_adm
150 # make a link allowing AC_OUTPUT to find the salome_adm/.../*.in files
151 echo "" >> configure.in_tmp1
152 echo 'ln -fs ${KERNEL_ROOT_DIR}/salome_adm ${ROOT_SRCDIR}/.' >> configure.in_tmp1
154 echo "" >> configure.in_tmp1
155 echo "AC_OUTPUT([ \\" >> configure.in_tmp1
158 # List of .in files in the adm/unix directory
159 # These files MUST be on top of AC_OUTPUT list so we
160 # put them "manually"
163 echo " ./salome_adm/unix/SALOMEconfig.h \\" >> configure.in_tmp1
164 echo " ./salome_adm/unix/F77config.h \\" >> configure.in_tmp1
165 echo " ./salome_adm/unix/sstream \\" >> configure.in_tmp1
166 echo " ./salome_adm/unix/depend \\" >> configure.in_tmp1
167 echo " ./adm_local/unix/make_omniorb:${ABS_CONF_DIR}/adm_local/unix/make_omniorb.in \\" >> configure.in_tmp1
168 echo " ./salome_adm/unix/envScript \\" >> configure.in_tmp1
169 echo " ./adm_local/unix/make_commence:${ABS_CONF_DIR}/adm_local/unix/make_commence.in \\" >> configure.in_tmp1
170 echo " ./salome_adm/unix/make_conclude \\" >> configure.in_tmp1
171 echo " ./salome_adm/unix/make_module \\" >> configure.in_tmp1
173 \rm -f configure.in_tmp2 configure.in_tmp3
174 touch configure.in_tmp2
175 find_in . configure.in_tmp2
177 sed -e '/^...salome_adm/d' configure.in_tmp2 > configure.in_tmp3
178 sed -e '/^...adm_local.unix.make_omniorb/d' configure.in_tmp3 configure.in_tmp2
179 sed -e '/^...adm_local.unix.make_commence/d' configure.in_tmp2 > configure.in_tmp3
180 sed -e '/configure.in/d' configure.in_tmp3 > configure.in_tmp2
181 sed -e 's/.in / /' configure.in_tmp2 >> configure.in_tmp1
182 #sed '/^.salome_adm/d' configure.in_tmp2 > configure.in_tmp3
183 #sed '/configure.in/d' configure.in_tmp3 > configure.in_tmp2
184 #sed 's/.in / /' configure.in_tmp2 >> configure.in_tmp1
186 echo "])" >> configure.in_tmp1
188 # delete the link created for AC_OUTPUT
189 echo "" >> configure.in_tmp1
190 #echo 'rm -f ${ROOT_SRCDIR}/salome_adm' >> configure.in_tmp1
192 \mv configure.in_tmp1 configure.in_new
193 \rm -f configure.in_tmp2 configure.in_tmp3
195 ########################################################################
196 # Create new (or replace old) configure.in file
197 # Print a message if the file is write protected
201 if test ! -f configure.in
203 echo -n "Creating new file 'configure.in' ... "
204 if \mv configure.in_new configure.in >& /dev/null
208 echo "error, check your file permissions"
211 echo -n "Updating 'configure.in' file ... "
212 if ! \cp configure.in configure.in_old >& /dev/null
216 echo "Can't backup previous configure.in"
217 echo -n "Continue (you will not be able to revert) - (Y/N) ? "
226 if \cp configure.in_new configure.in >& /dev/null
231 echo "error, can't update previous configure.in"
235 ########################################################################
236 # Use autoconf to rebuild the configure script
241 echo -n "Updating 'configure' script ... "
243 echo -n "Creating 'configure' script ... "
246 aclocal -I adm_local/unix/config_files -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \
247 -I ${GUI_ROOT_DIR}/adm_local/unix/config_files \
248 -I ${MED_ROOT_DIR}/adm_local/unix/config_files \
249 -I ${GEOM_ROOT_DIR}/adm_local/unix/config_files \
250 -I ${SMESH_ROOT_DIR}/adm_local/unix/config_files
256 echo "failed (check file permissions and/or user quotas ...)"