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 # Test if the KERNEL_SRC is set correctly
25 #if test ! -d "${KERNEL_SRC}"; then
26 # echo "failed : KERNEL_SRC variable is not correct !"
29 ########################################################################
30 # Test if the GUI_ROOT_DIR is set correctly
32 if test ! -d "${GUI_ROOT_DIR}"; then
33 echo "failed : GUI_ROOT_DIR variable is not correct !"
37 ########################################################################
38 # Test if the MED_ROOT_DIR is set correctly
40 if test ! -d "${MED_ROOT_DIR}"; then
41 echo "failed : MED_ROOT_DIR variable is not correct !"
45 ########################################################################
46 # find_in - utility function
49 # find_in directory filename
51 # Finds files following the *.in pattern, recursively in the
52 # directory (first argument).
53 # Results are appended into the file (second argument)
55 # Difference from the standard unix find is that files are tested
64 # if the first argument is not a directory, returns
66 if [ ! -d "$1" ] ; then
70 # dont look in the CVS directories
74 */adm_local/*) return ;;
78 # for each regular file contained in the directory
79 # test if it's a .in file
85 *.in) echo " "$i" \\" >> $f;;
91 # for each subdirectory of the first argument, proceeds recursively
102 #######################################################################
103 # Generate list of .in files (Makefile.in, config.h.in, etc)
104 # appending it in file configure.in
110 # Common part of the configure.in file
112 chmod u+w configure.in.base
113 if ! \cp -f configure.in.base configure.in_tmp1
116 echo "error : can't create files in" ${CONF_DIR}
118 chmod u-w configure.in.base
121 chmod u-w configure.in.base
123 if [ -e "${CONF_DIR}/salome_adm" ] ; then
124 \rm -f ${CONF_DIR}/salome_adm
128 # make a link allowing AC_OUTPUT to find the salome_adm/.../*.in files
129 echo "" >> configure.in_tmp1
130 echo 'ln -fs ${KERNEL_ROOT_DIR}/salome_adm ${ROOT_SRCDIR}/.' >> configure.in_tmp1
132 echo "" >> configure.in_tmp1
133 echo "AC_OUTPUT([ \\" >> configure.in_tmp1
136 # List of .in files in the adm/unix directory
137 # These files MUST be on top of AC_OUTPUT list so we
138 # put them "manually"
141 echo " ./salome_adm/unix/SALOMEconfig.h \\" >> configure.in_tmp1
142 echo " ./salome_adm/unix/F77config.h \\" >> configure.in_tmp1
143 echo " ./salome_adm/unix/sstream \\" >> configure.in_tmp1
144 echo " ./salome_adm/unix/depend \\" >> configure.in_tmp1
145 echo " ./adm_local/unix/make_omniorb \\" >> configure.in_tmp1
146 echo " ./salome_adm/unix/envScript \\" >> configure.in_tmp1
147 echo " ./adm_local/unix/make_commence \\" >> configure.in_tmp1
148 echo " ./salome_adm/unix/make_conclude \\" >> configure.in_tmp1
149 echo " ./salome_adm/unix/make_module \\" >> configure.in_tmp1
151 \rm -f configure.in_tmp2 configure.in_tmp3
152 touch configure.in_tmp2
153 find_in . configure.in_tmp2
154 sed -e '/^...salome_adm/d' configure.in_tmp2 > configure.in_tmp3
155 sed -e '/^...adm_local.unix.make_omniorb/d' configure.in_tmp3 > configure.in_tmp2
156 sed -e '/^...adm_local.unix.make_commence/d' configure.in_tmp2 > configure.in_tmp3
157 sed -e '/configure.in/d' configure.in_tmp3 > configure.in_tmp2
158 sed -e 's/.in / /' configure.in_tmp2 >> configure.in_tmp1
159 #sed '/^.*salome_adm/d' configure.in_tmp2 > configure.in_tmp3
160 #sed '/configure.in/d' configure.in_tmp3 > configure.in_tmp2
161 #sed 's/.in / /' configure.in_tmp2 >> configure.in_tmp1
163 echo "])" >> configure.in_tmp1
165 # delete the link created for AC_OUTPUT
166 #echo "" >> configure.in_tmp1
167 #echo 'rm -f ${ROOT_SRCDIR}/salome_adm' >> configure.in_tmp1
168 \mv configure.in_tmp1 configure.in_new
169 \rm -f configure.in_tmp2 configure.in_tmp3
172 ########################################################################
173 # Create new (or replace old) configure.in file
174 # Print a message if the file is write protected
178 if test ! -f configure.in
180 echo -n "Creating new file 'configure.in' ... "
181 if \mv configure.in_new configure.in >& /dev/null
185 echo "error, check your file permissions"
188 echo -n "Updating 'configure.in' file ... "
189 if ! \cp configure.in configure.in_old >& /dev/null
193 echo "Can't backup previous configure.in"
194 echo -n "Continue (you will not be able to revert) - (Y/N) ? "
203 if \cp configure.in_new configure.in >& /dev/null
208 echo "error, can't update previous configure.in"
212 ########################################################################
213 # Use autoconf to rebuild the configure script
218 echo -n "Updating 'configure' script ... "
220 echo -n "Creating 'configure' script ... "
223 aclocal -I adm_local/unix/config_files -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \
224 -I ${GUI_ROOT_DIR}/adm_local/unix/config_files \
225 -I ${MED_ROOT_DIR}/adm_local/unix/config_files
230 echo "failed (check file permissions and/or user quotas ...)"