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 # find_in - utility function
35 # find_in directory filename
37 # Finds files following the *.in pattern, recursively in the
38 # directory (first argument).
39 # Results are appended into the file (second argument)
41 # Difference from the standard unix find is that files are tested
50 # if the first argument is not a directory, returns
52 if [ ! -d "$1" ] ; then
56 # dont look in the CVS directories
60 */adm_local/*) return ;;
64 # for each regular file contained in the directory
65 # test if it's a .in file
71 *.in) echo $i" \\" >> $f;;
77 # for each subdirectory of the first argument, proceeds recursively
88 #######################################################################
89 # Generate list of .in files (Makefile.in, config.h.in, etc)
90 # appending it in file configure.in
96 # Common part of the configure.in file
98 chmod u+w configure.in.base
99 if ! \cp -f configure.in.base configure.in_tmp1
102 echo "error : can't create files in" ${CONF_DIR}
104 chmod u-w configure.in.base
107 chmod u-w configure.in.base
109 if [ -e "${CONF_DIR}/salome_adm" ] ; then
110 \rm -f ${CONF_DIR}/salome_adm
113 # make a link allowing AC_OUTPUT to find the salome_adm/.../*.in files
114 echo "" >> configure.in_tmp1
115 echo 'ln -fs ${KERNEL_ROOT_DIR}/salome_adm ${ROOT_SRCDIR}' >> configure.in_tmp1
117 echo "" >> configure.in_tmp1
118 echo "AC_OUTPUT([ \\" >> configure.in_tmp1
121 # List of .in files in the adm/unix directory
122 # These files MUST be on top of AC_OUTPUT list so we
123 # put them "manually"
126 echo "./salome_adm/unix/SALOMEconfig.h \\" >> configure.in_tmp1
127 echo "./salome_adm/unix/F77config.h \\" >> configure.in_tmp1
128 echo "./salome_adm/unix/sstream \\" >> configure.in_tmp1
129 echo "./salome_adm/unix/depend \\" >> configure.in_tmp1
130 echo "./adm_local/unix/make_omniorb:${ABS_CONF_DIR}/adm_local/unix/make_omniorb.in \\" >> configure.in_tmp1
131 echo "./salome_adm/unix/envScript \\" >> configure.in_tmp1
132 echo "./adm_local/unix/make_commence:${ABS_CONF_DIR}/adm_local/unix/make_commence.in \\" >> configure.in_tmp1
133 echo "./salome_adm/unix/make_conclude \\" >> configure.in_tmp1
134 echo "./salome_adm/unix/make_module \\" >> configure.in_tmp1
136 \rm -f configure.in_tmp2
137 touch configure.in_tmp2
138 find_in . configure.in_tmp2
140 sed -e '/^...salome_adm/d' \
141 -e '/configure.in/d' \
142 -e '/^...adm_local/d' \
144 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 \mv configure.in_tmp1 configure.in_new
151 \rm -f configure.in_tmp2
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
187 \rm -f configure.in_new
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 -I adm_local/unix/config_files -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \
207 -I ${GUI_ROOT_DIR}/adm_local/unix/config_files
212 echo "failed (check file permissions and/or user quotas ...)"