4 # Tool for updating list of .in file for the SALOME project
5 # and regenerating configure script
7 # It may be called with --with-kernel[=yes,no] or --without-kernel
8 # option, default is --with-kernel=yes
10 # Author : Marc Tajchman - CEA
16 CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"`
18 ########################################################################
19 # Check --with-kernel option
26 -with-kernel | --with-kernel)
29 -without-kernel | --without-kernel | -with-kernel=no | --with-kernel=no)
36 ########################################################################
37 # Test if the GUI_ROOT_DIR is set correctly if GUI required
39 if test "$MED_WITH_KERNEL" = "yes"; then
40 if test ! -d "${GUI_ROOT_DIR}"; then
41 echo "failed : GUI_ROOT_DIR variable is not correct !"
46 ########################################################################
47 # find_in - utility function
50 # find_in directory filename
52 # Finds files following the *.in pattern, recursively in the
53 # directory (first argument).
54 # Results are appended into the file (second argument)
56 # Difference from the standard unix find is that files are tested
65 # if the first argument is not a directory, returns
67 if [ ! -d "$1" ] ; then
71 # dont look in the CVS directories
75 */adm_local/*) return ;;
79 # for each regular file contained in the directory
80 # test if it's a .in file
86 *.in) echo " "$i" \\" >> $f;;
92 # for each subdirectory of the first argument, proceeds recursively
103 #######################################################################
104 # Generate list of .in files (Makefile.in, config.h.in, etc)
105 # appending it in file configure.in
111 # Common part of the configure.in file
113 if \cp -f configure.in.base configure.in_tmp1
116 chmod u+w configure.in_tmp1
119 echo "error : can't create files in" ${CONF_DIR}
123 chmod u-w configure.in.base
125 if [ -e "${CONF_DIR}/salome_adm" ] ; then
126 \rm -f ${CONF_DIR}/salome_adm
129 # insert header and AC_INIT(src) which must go before anything else
130 cat > configure.in_tmp1 <<EOF
132 # PLEASE DO NOT MODIFY configure.in FILE
134 # ALL CHANGES WILL BE DISCARDED BY THE NEXT
135 # build_configure COMMAND
137 # CHANGES MUST BE MADE IN configure.in.base FILE
140 # Author : Marc Tajchman (CEA)
142 # Modified by : Patrick GOLDBRONN (CEA)
143 # Modified by : Marc Tajchman (CEA)
145 # Created from configure.in.base
152 # initialize MED_WITH_KERNEL
153 echo "MED_WITH_KERNEL=${MED_WITH_KERNEL}" >> configure.in_tmp1
155 # insert the configure.in.base
156 cat configure.in.base >> configure.in_tmp1
158 # make a link allowing AC_OUTPUT to find the salome_adm/.../*.in files
159 echo "" >> configure.in_tmp1
160 echo 'if test ${MED_WITH_KERNEL} = yes; then' >> configure.in_tmp1
161 echo ' ln -fs ${KERNEL_ROOT_DIR}/salome_adm ${ROOT_SRCDIR}/.' >> configure.in_tmp1
162 echo 'else' >> configure.in_tmp1
163 echo ' ln -fs ${ROOT_SRCDIR}/adm_local_without_kernel ${ROOT_SRCDIR}/salome_adm' >> configure.in_tmp1
164 echo 'fi' >> configure.in_tmp1
168 # List of .in files in the adm/unix directory
169 # These files MUST be on top of AC_OUTPUT list so we
170 # put them "manually"
172 # Attention, l'ordre d'entrée des fichiers doit être choisi avec
175 echo "" >> configure.in_tmp1
176 echo "AC_OUTPUT([ \\" >> configure.in_tmp1
177 echo " ./salome_adm/unix/SALOMEconfig.h \\" >> configure.in_tmp1
178 echo " ./salome_adm/unix/sstream \\" >> configure.in_tmp1
179 echo " ./salome_adm/unix/depend \\" >> configure.in_tmp1
180 echo " ])" >> configure.in_tmp1
181 echo "" >> configure.in_tmp1
182 echo 'if test $MED_WITH_KERNEL = yes; then' >> configure.in_tmp1
183 echo "{" >> configure.in_tmp1
184 echo "AC_OUTPUT([ \\" >> configure.in_tmp1
185 echo " ./salome_adm/unix/F77config.h \\" >> configure.in_tmp1
186 echo " ./adm_local/unix/make_omniorb:${ABS_CONF_DIR}/adm_local/unix/make_omniorb.in \\" >> configure.in_tmp1
187 echo " ./salome_adm/unix/envScript \\" >> configure.in_tmp1
188 echo " ])" >> configure.in_tmp1
189 echo "}" >> configure.in_tmp1
190 echo "fi" >> configure.in_tmp1
191 echo "" >> configure.in_tmp1
192 echo "AC_OUTPUT([ \\" >> configure.in_tmp1
193 echo " ./salome_adm/unix/make_module \\" >> configure.in_tmp1
195 # _CS_gbo Pour assurer ls construction correct de la chaîne de
196 # dépendance, il apparaît nécessaire de surcharger le make_conclude
197 # (resp. make_commence) pardéfaut, c'est à dire le make_conclude de
198 # salome_adm, par le make_conclude (resp. make_commence) du module,
199 # c'est à dire le make_conclude (resp. make_commence) du répertoire
201 echo " ./adm_local/unix/make_commence:${ABS_CONF_DIR}/adm_local/unix/make_commence.in \\" >> configure.in_tmp1
202 echo " ./adm_local/unix/make_conclude:${ABS_CONF_DIR}/adm_local/unix/make_conclude.in \\" >> configure.in_tmp1
204 \rm -f configure.in_tmp2 configure.in_tmp3
205 touch configure.in_tmp2
207 find_in . configure.in_tmp2
209 # _CS_gbo_100204 Mise à jour du filtre pour prise en compte des
210 # restrictions imposées par les versions récente de autoconf.
211 sed -e '/^...salome_adm/d' \
212 -e '/configure.in/d' \
213 -e 's/.in / /' configure.in_tmp2 >> configure.in_tmp1
215 echo " ])" >> configure.in_tmp1
218 # delete the link created for AC_OUTPUT
219 #echo 'rm -f ${ROOT_SRCDIR}/salome_adm' >> configure.in_tmp1
220 \mv configure.in_tmp1 configure.in_new
221 \rm -f configure.in_tmp2 configure.in_tmp3
224 ########################################################################
225 # Create new (or replace old) configure.in file
226 # Print a message if the file is write protected
230 if test ! -f configure.in
232 echo -n "Creating new file 'configure.in' ... "
233 if \mv configure.in_new configure.in >& /dev/null
237 echo "error, check your file permissions"
240 echo -n "Updating 'configure.in' file ... "
241 if \cp configure.in configure.in_old >& /dev/null
247 echo "Can't backup previous configure.in"
248 echo -n "Continue (you will not be able to revert) - (Y/N) ? "
257 if \cp configure.in_new configure.in >& /dev/null
262 echo "error, can't update previous configure.in"
266 ########################################################################
267 # Use autoconf to rebuild the configure script
272 echo -n "Updating 'configure' script ... "
274 echo -n "Creating 'configure' script ... "
277 if test "x${MED_WITH_KERNEL}" != "xno"; then
278 AUX_CONFIG_INC="-I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files -I ${GUI_ROOT_DIR}/adm_local/unix/config_files"
280 AUX_CONFIG_INC="-I adm_local_without_kernel/unix/config_files"
283 aclocal -I adm_local/unix/config_files ${AUX_CONFIG_INC}
288 echo "failed (check file permissions and/or user quotas ...)"