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
17 if test ! -d "${KERNEL_ROOT_DIR}"; then
18 echo "failed : KERNEL_ROOT_DIR variable is not correct !"
22 # Test if the KERNEL_SRC is set correctly
24 #if test ! -d "${KERNEL_SRC}"; then
25 # echo "failed : KERNEL_SRC variable is not correct !"
28 ########################################################################
29 # find_in - utility function
32 # find_in directory filename
34 # Finds files following the *.in pattern, recursively in the
35 # directory (first argument).
36 # Results are appended into the file (second argument)
38 # Difference from the standard unix find is that files are tested
47 # if the first argument is not a directory, returns
49 if [ ! -d "$1" ] ; then
53 # dont look in the CVS directories
57 */adm_local/*) return ;;
61 # for each regular file contained in the directory
62 # test if it's a .in file
68 *.in) echo " "$i" \\" >> $f;;
74 # for each subdirectory of the first argument, proceeds recursively
85 #######################################################################
86 # Generate list of .in files (Makefile.in, config.h.in, etc)
87 # appending it in file configure.in
93 # Common part of the configure.in file
95 chmod u+w configure.in.base
96 if ! \cp -f configure.in.base configure.in_tmp1
99 echo "error : can't create files in" ${CONF_DIR}
101 chmod u-w configure.in.base
104 chmod u-w configure.in.base
106 if [ -e "${CONF_DIR}/salome_adm" ] ; then
107 \rm -rf ${CONF_DIR}/salome_adm
110 # make a link allowing AC_OUTPUT to find the salome_adm/.../*.in files
111 echo "" >> configure.in_tmp1
112 echo 'ln -fs ${KERNEL_ROOT_DIR}/salome_adm ${ROOT_SRCDIR}/salome_adm' >> configure.in_tmp1
114 echo "" >> configure.in_tmp1
115 echo "AC_OUTPUT([ \\" >> configure.in_tmp1
118 # List of .in files in the adm/unix directory
119 # These files MUST be on top of AC_OUTPUT list so we
120 # put them "manually"
123 echo " ./salome_adm/unix/SALOMEconfig.h \\" >> configure.in_tmp1
124 echo " ./salome_adm/unix/F77config.h \\" >> configure.in_tmp1
125 echo " ./salome_adm/unix/sstream \\" >> configure.in_tmp1
126 echo " ./salome_adm/unix/depend \\" >> configure.in_tmp1
127 echo " ./adm_local/unix/make_omniorb \\" >> configure.in_tmp1
128 echo " ./salome_adm/unix/envScript \\" >> configure.in_tmp1
129 echo " ./adm_local/unix/make_commence \\" >> configure.in_tmp1
130 echo " ./salome_adm/unix/make_conclude \\" >> configure.in_tmp1
131 echo " ./salome_adm/unix/make_module \\" >> configure.in_tmp1
133 \rm -f configure.in_tmp2 configure.in_tmp3
134 touch configure.in_tmp2
135 find_in . configure.in_tmp2
136 sed -e '/^...salome_adm/d' configure.in_tmp2 > configure.in_tmp3
137 sed -e '/^...adm_local.unix.make_omniorb/d' configure.in_tmp3 > configure.in_tmp2
138 sed -e '/^...adm_local.unix.make_commence/d' configure.in_tmp2 > configure.in_tmp3
139 sed -e '/configure.in/d' configure.in_tmp3 > configure.in_tmp2
140 sed -e 's/.in / /' configure.in_tmp2 >> configure.in_tmp1
141 #sed '/^.salome_adm/d' configure.in_tmp2 > configure.in_tmp3
142 #sed '/configure.in/d' configure.in_tmp3 > configure.in_tmp2
143 #sed 's/.in / /' configure.in_tmp2 >> configure.in_tmp1
145 echo "])" >> configure.in_tmp1
147 # delete the link created for AC_OUTPUT
148 echo "" >> configure.in_tmp1
149 #echo 'rm -f ${ROOT_SRCDIR}/salome_adm' >> configure.in_tmp1
150 \mv configure.in_tmp1 configure.in_new
151 \rm -f configure.in_tmp2 configure.in_tmp3
154 ########################################################################
155 # Create new (or replace old) configure.in file
156 # Print a message if the file is write protected
160 if test ! -f configure.in
162 echo -n "Creating new file 'configure.in' ... "
163 if \mv configure.in_new configure.in >& /dev/null
167 echo "error, check your file permissions"
170 echo -n "Updating 'configure.in' file ... "
171 if ! \cp configure.in configure.in_old >& /dev/null
175 echo "Can't backup previous configure.in"
176 echo -n "Continue (you will not be able to revert) - (Y/N) ? "
185 if \cp configure.in_new configure.in >& /dev/null
190 echo "error, can't update previous configure.in"
194 ########################################################################
195 # Use autoconf to rebuild the configure script
200 echo -n "Updating 'configure' script ... "
202 echo -n "Creating 'configure' script ... "
205 aclocal --acdir=adm_local/unix/config_files -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files
210 echo "failed (check file permissions and/or user quotas ...)"