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 ! -d "${GUI_ROOT_DIR}"; then
40 echo "failed : GUI_ROOT_DIR variable is not correct !"
44 ########################################################################
45 # find_in - utility function
48 # find_in directory filename
50 # Finds files following the *.in pattern, recursively in the
51 # directory (first argument).
52 # Results are appended into the file (second argument)
54 # Difference from the standard unix find is that files are tested
63 # if the first argument is not a directory, returns
65 if [ ! -d "$1" ] ; then
69 # dont look in the CVS directories
73 */adm_local/*) return ;;
77 # for each regular file contained in the directory
78 # test if it's a .in file
84 *.in) echo " "$i" \\" >> $f;;
90 # for each subdirectory of the first argument, proceeds recursively
101 #######################################################################
102 # Generate list of .in files (Makefile.in, config.h.in, etc)
103 # appending it in file configure.in
109 # Common part of the configure.in file
111 if \cp -f configure.in.base configure.in_tmp1
114 chmod u+w configure.in_tmp1
117 echo "error : can't create files in" ${CONF_DIR}
121 chmod u-w configure.in.base
123 if [ -e "${CONF_DIR}/salome_adm" ] ; then
124 \rm -f ${CONF_DIR}/salome_adm
127 # insert header and AC_INIT(src) which must go before anything else
128 cat > configure.in_tmp1 <<EOF
130 # PLEASE DO NOT MODIFY configure.in FILE
132 # ALL CHANGES WILL BE DISCARDED BY THE NEXT
133 # build_configure COMMAND
135 # CHANGES MUST BE MADE IN configure.in.base FILE
138 # Author : Marc Tajchman (CEA)
140 # Modified by : Patrick GOLDBRONN (CEA)
141 # Modified by : Marc Tajchman (CEA)
143 # Created from configure.in.base
150 # initialize MED_WITH_KERNEL
151 echo "MED_WITH_KERNEL=${MED_WITH_KERNEL}" >> configure.in_tmp1
153 # insert the configure.in.base
154 cat configure.in.base >> configure.in_tmp1
156 # make a link allowing AC_OUTPUT to find the salome_adm/.../*.in files
157 echo "" >> configure.in_tmp1
158 echo 'if test ${MED_WITH_KERNEL} = yes; then' >> configure.in_tmp1
159 echo ' ln -fs ${KERNEL_ROOT_DIR}/salome_adm ${ROOT_SRCDIR}/.' >> configure.in_tmp1
160 echo 'else' >> configure.in_tmp1
161 echo ' ln -fs ${ROOT_SRCDIR}/adm_local_without_kernel ${ROOT_SRCDIR}/salome_adm' >> configure.in_tmp1
162 echo 'fi' >> configure.in_tmp1
166 # List of .in files in the adm/unix directory
167 # These files MUST be on top of AC_OUTPUT list so we
168 # put them "manually"
170 # Attention, l'ordre d'entrée des fichiers doit être choisi avec
173 echo "" >> configure.in_tmp1
174 echo "AC_OUTPUT([ \\" >> configure.in_tmp1
175 echo " ./salome_adm/unix/SALOMEconfig.h \\" >> configure.in_tmp1
176 echo " ./salome_adm/unix/sstream \\" >> configure.in_tmp1
177 echo " ./salome_adm/unix/depend \\" >> configure.in_tmp1
178 echo " ])" >> configure.in_tmp1
179 echo "" >> configure.in_tmp1
180 echo 'if test $MED_WITH_KERNEL = yes; then' >> configure.in_tmp1
181 echo "{" >> configure.in_tmp1
182 echo "AC_OUTPUT([ \\" >> configure.in_tmp1
183 echo " ./salome_adm/unix/F77config.h \\" >> configure.in_tmp1
184 echo " ./adm_local/unix/make_omniorb:${ABS_CONF_DIR}/adm_local/unix/make_omniorb.in \\" >> configure.in_tmp1
185 echo " ./salome_adm/unix/envScript \\" >> configure.in_tmp1
186 echo " ])" >> configure.in_tmp1
187 echo "}" >> configure.in_tmp1
188 echo "fi" >> configure.in_tmp1
189 echo "" >> configure.in_tmp1
190 echo "AC_OUTPUT([ \\" >> configure.in_tmp1
191 echo " ./salome_adm/unix/make_module \\" >> configure.in_tmp1
193 # _CS_gbo Pour assurer ls construction correct de la chaîne de
194 # dépendance, il apparaît nécessaire de surcharger le make_conclude
195 # (resp. make_commence) pardéfaut, c'est à dire le make_conclude de
196 # salome_adm, par le make_conclude (resp. make_commence) du module,
197 # c'est à dire le make_conclude (resp. make_commence) du répertoire
199 echo " ./adm_local/unix/make_commence:${ABS_CONF_DIR}/adm_local/unix/make_commence.in \\" >> configure.in_tmp1
200 echo " ./adm_local/unix/make_conclude:${ABS_CONF_DIR}/adm_local/unix/make_conclude.in \\" >> configure.in_tmp1
202 \rm -f configure.in_tmp2 configure.in_tmp3
203 touch configure.in_tmp2
205 find_in . configure.in_tmp2
207 # _CS_gbo_100204 Mise à jour du filtre pour prise en compte des
208 # restrictions imposées par les versions récente de autoconf.
209 sed -e '/^...salome_adm/d' \
210 -e '/configure.in/d' \
211 -e 's/.in / /' configure.in_tmp2 >> configure.in_tmp1
213 echo " ])" >> configure.in_tmp1
216 # delete the link created for AC_OUTPUT
217 #echo 'rm -f ${ROOT_SRCDIR}/salome_adm' >> configure.in_tmp1
218 \mv configure.in_tmp1 configure.in_new
219 \rm -f configure.in_tmp2 configure.in_tmp3
222 ########################################################################
223 # Create new (or replace old) configure.in file
224 # Print a message if the file is write protected
228 if test ! -f configure.in
230 echo -n "Creating new file 'configure.in' ... "
231 if \mv configure.in_new configure.in >& /dev/null
235 echo "error, check your file permissions"
238 echo -n "Updating 'configure.in' file ... "
239 if \cp configure.in configure.in_old >& /dev/null
245 echo "Can't backup previous configure.in"
246 echo -n "Continue (you will not be able to revert) - (Y/N) ? "
255 if \cp configure.in_new configure.in >& /dev/null
260 echo "error, can't update previous configure.in"
264 ########################################################################
265 # Use autoconf to rebuild the configure script
270 echo -n "Updating 'configure' script ... "
272 echo -n "Creating 'configure' script ... "
275 if test "x${MED_WITH_KERNEL}" != "xno"; then
276 AUX_CONFIG_DIR=${KERNEL_ROOT_DIR}/salome_adm/unix/config_files
278 AUX_CONFIG_DIR=adm_local_without_kernel/unix/config_files
281 aclocal -I adm_local/unix/config_files -I ${AUX_CONFIG_DIR} -I ${GUI_ROOT_DIR}/adm_local/unix/config_files
286 echo "failed (check file permissions and/or user quotas ...)"