4 # Tool for updating list of .in file for the SALOME project
5 # and regenerating configure script
7 # Author : Marc Tajchman - CEA
13 CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"`
15 ########################################################################
16 # Test if the KERNEL_ROOT_DIR is set correctly
18 if test ! -d "${KERNEL_ROOT_DIR}"; then
19 echo "failed : KERNEL_ROOT_DIR variable is not correct !"
23 ########################################################################
24 # Test if the GUI_ROOT_DIR is set correctly
26 if test ! -d "${GUI_ROOT_DIR}"; then
27 echo "failed : GUI_ROOT_DIR variable is not correct !"
31 ########################################################################
32 # Test if the MED_ROOT_DIR is set correctly
34 if test ! -d "${MED_ROOT_DIR}"; then
35 echo "failed : MED_ROOT_DIR variable is not correct !"
39 ########################################################################
40 # Test if the MED2HOME is set correctly
42 if test ! -d "${MED2HOME}"; then
43 echo "failed : MED2HOME variable is not correct !"
47 ########################################################################
48 # Test if the HDF5HOME is set correctly
50 if test ! -d "${HDF5HOME}"; then
51 echo "failed : HDF5HOME variable is not correct !"
55 ########################################################################
56 # find_in - utility function
59 # find_in directory filename
61 # Finds files following the *.in pattern, recursively in the
62 # directory (first argument).
63 # Results are appended into the file (second argument)
65 # Difference from the standard unix find is that files are tested
74 # if the first argument is not a directory, returns
76 if [ ! -d "$1" ] ; then
80 # dont look in the CVS directories
84 */adm_local/*) return ;;
88 # for each regular file contained in the directory
89 # test if it's a .in file
95 *.in) echo $i" \\" >> $f;;
101 # for each subdirectory of the first argument, proceeds recursively
105 if [ -d "$i" ] ; then
112 #######################################################################
113 # Generate list of .in files (Makefile.in, config.h.in, etc)
114 # appending it in file configure.in
120 # Common part of the configure.in file
122 chmod u+w configure.in.base
123 if ! \cp -f configure.in.base configure.in_tmp1
126 echo "error : can't create files in" ${CONF_DIR}
128 chmod u-w configure.in.base
131 chmod u-w configure.in.base
133 if [ -e "${CONF_DIR}/salome_adm" ] ; then
134 \rm -f ${CONF_DIR}/salome_adm
137 # make a link allowing AC_OUTPUT to find the salome_adm/.../*.in files
138 echo "" >> configure.in_tmp1
139 echo 'ln -fs ${KERNEL_ROOT_DIR}/salome_adm ${ROOT_SRCDIR}' >> configure.in_tmp1
141 echo "" >> configure.in_tmp1
142 echo "AC_OUTPUT([ \\" >> configure.in_tmp1
145 # List of .in files in the adm/unix directory
146 # These files MUST be on top of AC_OUTPUT list so we
147 # put them "manually"
150 echo "./salome_adm/unix/SALOMEconfig.h \\" >> configure.in_tmp1
151 echo "./salome_adm/unix/F77config.h \\" >> configure.in_tmp1
152 echo "./salome_adm/unix/sstream \\" >> configure.in_tmp1
153 echo "./salome_adm/unix/depend \\" >> configure.in_tmp1
154 echo "./adm_local/unix/make_omniorb:${ABS_CONF_DIR}/adm_local/unix/make_omniorb.in \\" >> configure.in_tmp1
155 echo "./salome_adm/unix/envScript \\" >> configure.in_tmp1
156 echo "./adm_local/unix/make_commence:${ABS_CONF_DIR}/adm_local/unix/make_commence.in \\" >> configure.in_tmp1
157 echo "./salome_adm/unix/make_conclude \\" >> configure.in_tmp1
158 echo "./salome_adm/unix/make_module \\" >> configure.in_tmp1
160 \rm -f configure.in_tmp2
161 touch configure.in_tmp2
162 find_in . configure.in_tmp2
164 sed -e '/^...salome_adm/d' \
165 -e '/configure.in/d' \
166 -e '/^...adm_local/d' \
168 configure.in_tmp2 >> configure.in_tmp1
170 echo "])" >> configure.in_tmp1
172 # delete the link created for AC_OUTPUT
173 echo "" >> configure.in_tmp1
174 \mv configure.in_tmp1 configure.in_new
175 \rm -f configure.in_tmp2
178 ########################################################################
179 # Create new (or replace old) configure.in file
180 # Print a message if the file is write protected
184 if test ! -f configure.in
186 echo -n "Creating new file 'configure.in' ... "
187 if \mv configure.in_new configure.in >& /dev/null
191 echo "error, check your file permissions"
194 echo -n "Updating 'configure.in' file ... "
195 if ! \cp configure.in configure.in_old >& /dev/null
199 echo "Can't backup previous configure.in"
200 echo -n "Continue (you will not be able to revert) - (Y/N) ? "
209 if \cp configure.in_new configure.in >& /dev/null
211 \rm -f configure.in_new
215 echo "error, can't update previous configure.in"
219 ########################################################################
220 # Use autoconf to rebuild the configure script
225 echo -n "Updating 'configure' script ... "
227 echo -n "Creating 'configure' script ... "
230 aclocal -I adm_local/unix/config_files -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \
231 -I ${GUI_ROOT_DIR}/adm_local/unix/config_files \
232 -I ${MED_ROOT_DIR}/adm_local/unix/config_files
237 echo "failed (check file permissions and/or user quotas ...)"