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 # find_in - utility function
27 # find_in directory filename
29 # Finds files following the *.in pattern, recursively in the
30 # directory (first argument).
31 # Results are appended into the file (second argument)
33 # Difference from the standard unix find is that files are tested
42 # if the first argument is not a directory, returns
44 if [ ! -d "$1" ] ; then
48 # dont look in the CVS directories
55 # for each regular file contained in the directory
56 # test if it's a .in file
62 *.in) echo $i" \\" >> $f;;
68 # for each subdirectory of the first argument, proceeds recursively
79 #######################################################################
80 # Generate list of .in files (Makefile.in, config.h.in, etc)
81 # appending it in file configure.in
87 # Common part of the configure.in file
89 chmod u+w configure.in.base
90 if ! \cp -f configure.in.base configure.in_tmp1
93 echo "error : can't create files in" ${CONF_DIR}
95 chmod u-w configure.in.base
98 chmod u-w configure.in.base
100 if [ -e "${CONF_DIR}/salome_adm" ] ; then
101 \rm -f ${CONF_DIR}/salome_adm
104 # make a link allowing AC_OUTPUT to find the salome_adm/.../*.in files
105 echo "" >> configure.in_tmp1
106 echo 'ln -fs ${KERNEL_ROOT_DIR}/salome_adm ${ROOT_SRCDIR}' >> configure.in_tmp1
108 echo "" >> configure.in_tmp1
109 echo "AC_OUTPUT([ \\" >> configure.in_tmp1
112 # List of .in files in the adm/unix directory
113 # These files MUST be on top of AC_OUTPUT list so we
114 # put them "manually"
117 echo "./salome_adm/unix/SALOMEconfig.h \\" >> configure.in_tmp1
118 echo "./salome_adm/unix/F77config.h \\" >> configure.in_tmp1
119 echo "./salome_adm/unix/sstream \\" >> configure.in_tmp1
120 echo "./salome_adm/unix/depend \\" >> configure.in_tmp1
121 echo "./adm_local/unix/make_omniorb \\" >> configure.in_tmp1
122 echo "./salome_adm/unix/envScript \\" >> configure.in_tmp1
123 echo "./adm_local/unix/make_commence \\" >> configure.in_tmp1
124 echo "./salome_adm/unix/make_conclude \\" >> configure.in_tmp1
125 echo "./salome_adm/unix/make_module \\" >> configure.in_tmp1
127 \rm -f configure.in_tmp2
128 touch configure.in_tmp2
129 find_in . configure.in_tmp2
131 sed -e '/^.\/salome_adm/d' \
132 -e '/configure.in/d' \
133 -e '/^.\/adm_local/d' \
135 configure.in_tmp2 >> configure.in_tmp1
137 echo "])" >> configure.in_tmp1
139 # delete the link created for AC_OUTPUT
140 echo "" >> configure.in_tmp1
141 \mv configure.in_tmp1 configure.in_new
142 \rm -f configure.in_tmp2
145 ########################################################################
146 # Create new (or replace old) configure.in file
147 # Print a message if the file is write protected
151 if test ! -f configure.in
153 echo -n "Creating new file 'configure.in' ... "
154 if \mv configure.in_new configure.in >& /dev/null
158 echo "error, check your file permissions"
161 echo -n "Updating 'configure.in' file ... "
162 if ! \cp configure.in configure.in_old >& /dev/null
166 echo "Can't backup previous configure.in"
167 echo -n "Continue (you will not be able to revert) - (Y/N) ? "
176 if \cp configure.in_new configure.in >& /dev/null
178 \rm -f configure.in_new
182 echo "error, can't update previous configure.in"
186 ########################################################################
187 # Use autoconf to rebuild the configure script
192 echo -n "Updating 'configure' script ... "
194 echo -n "Creating 'configure' script ... "
197 aclocal --acdir=adm_local/unix/config_files -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files
202 echo "failed (check file permissions and/or user quotas ...)"