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 # find_in - utility function
33 # find_in directory filename
35 # Finds files following the *.in pattern, recursively in the
36 # directory (first argument).
37 # Results are appended into the file (second argument)
39 # Difference from the standard unix find is that files are tested
48 # if the first argument is not a directory, returns
50 if [ ! -d "$1" ] ; then
54 # dont look in the CVS directories
58 */adm_local/*) return ;;
62 # for each regular file contained in the directory
63 # test if it's a .in file
69 *.in) echo " "$i" \\" >> $f;;
75 # for each subdirectory of the first argument, proceeds recursively
86 #######################################################################
87 # Generate list of .in files (Makefile.in, config.h.in, etc)
88 # appending it in file configure.in
94 # Common part of the configure.in file
96 chmod u+w configure.in.base
97 if ! \cp -f configure.in.base configure.in_tmp1
100 echo "error : can't create files in" ${CONF_DIR}
102 chmod u-w configure.in.base
105 chmod u-w configure.in.base
107 if [ -e "${CONF_DIR}/salome_adm" ] ; then
108 \rm -f ${CONF_DIR}/salome_adm
111 # make a link allowing AC_OUTPUT to find the salome_adm/.../*.in files
112 echo "" >> configure.in_tmp1
113 echo 'ln -fs ${KERNEL_ROOT_DIR}/salome_adm ${ROOT_SRCDIR}/salome_adm' >> configure.in_tmp1
115 echo "" >> configure.in_tmp1
116 echo "AC_OUTPUT([ \\" >> configure.in_tmp1
119 # List of .in files in the adm/unix directory
120 # These files MUST be on top of AC_OUTPUT list so we
121 # put them "manually"
124 echo " ./salome_adm/unix/SALOMEconfig.h \\" >> configure.in_tmp1
125 echo " ./salome_adm/unix/F77config.h \\" >> configure.in_tmp1
126 echo " ./salome_adm/unix/sstream \\" >> configure.in_tmp1
127 echo " ./salome_adm/unix/depend \\" >> configure.in_tmp1
128 echo " ./adm_local/unix/make_omniorb \\" >> configure.in_tmp1
129 echo " ./salome_adm/unix/envScript \\" >> configure.in_tmp1
130 echo " ./adm_local/unix/make_commence \\" >> configure.in_tmp1
131 echo " ./adm_local/unix/make_conclude \\" >> configure.in_tmp1
132 echo " ./salome_adm/unix/make_module \\" >> configure.in_tmp1
134 \rm -f configure.in_tmp2 configure.in_tmp3
135 touch configure.in_tmp2
136 find_in . configure.in_tmp2
137 sed -e '/^...salome_adm/d' configure.in_tmp2 > configure.in_tmp3
138 sed -e '/^...adm_local.unix.make_omniorb/d' configure.in_tmp3 configure.in_tmp2
139 sed -e '/^...adm_local.unix.make_commence/d' configure.in_tmp2 > configure.in_tmp3
140 sed -e '/configure.in/d' configure.in_tmp3 > configure.in_tmp2
141 sed -e 's/.in / /' configure.in_tmp2 >> configure.in_tmp1
142 #sed '/^.salome_adm/d' configure.in_tmp2 > configure.in_tmp3
143 #sed '/configure.in/d' configure.in_tmp3 > configure.in_tmp2
144 #sed 's/.in / /' configure.in_tmp2 >> configure.in_tmp1
146 echo "])" >> configure.in_tmp1
148 # delete the link created for AC_OUTPUT
149 echo "" >> configure.in_tmp1
150 #echo 'rm -f ${ROOT_SRCDIR}/salome_adm' >> configure.in_tmp1
151 \mv configure.in_tmp1 configure.in_new
152 \rm -f configure.in_tmp2 configure.in_tmp3
155 ########################################################################
156 # Create new (or replace old) configure.in file
157 # Print a message if the file is write protected
161 if test ! -f configure.in
163 echo -n "Creating new file 'configure.in' ... "
164 if \mv configure.in_new configure.in >& /dev/null
168 echo "error, check your file permissions"
171 echo -n "Updating 'configure.in' file ... "
172 if ! \cp configure.in configure.in_old >& /dev/null
176 echo "Can't backup previous configure.in"
177 echo -n "Continue (you will not be able to revert) - (Y/N) ? "
186 if \cp configure.in_new configure.in >& /dev/null
191 echo "error, can't update previous configure.in"
195 ########################################################################
196 # Use autoconf to rebuild the configure script
201 echo -n "Updating 'configure' script ... "
203 echo -n "Creating 'configure' script ... "
206 aclocal --acdir=adm_local/unix/config_files -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files
211 echo "failed (check file permissions and/or user quotas ...)"