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 # make a link allowing AC_OUTPUT to find the salome_adm/.../*.in files
101 echo "" >> configure.in_tmp1
102 echo 'ln -fs ${KERNEL_ROOT_DIR}/salome_adm ${ROOT_SRCDIR}/salome_adm' >> configure.in_tmp1
104 echo "" >> configure.in_tmp1
105 echo "AC_OUTPUT([ \\" >> configure.in_tmp1
108 # List of .in files in the adm/unix directory
109 # These files MUST be on top of AC_OUTPUT list so we
110 # put them "manually"
113 echo " ./salome_adm/unix/SALOMEconfig.h \\" >> configure.in_tmp1
114 echo " ./salome_adm/unix/F77config.h \\" >> configure.in_tmp1
115 echo " ./salome_adm/unix/sstream \\" >> configure.in_tmp1
116 echo " ./salome_adm/unix/depend \\" >> configure.in_tmp1
117 echo " ./salome_adm/unix/make_omniorb \\" >> configure.in_tmp1
118 echo " ./salome_adm/unix/envScript \\" >> configure.in_tmp1
119 echo " ./salome_adm/unix/make_commence \\" >> configure.in_tmp1
120 echo " ./salome_adm/unix/make_conclude \\" >> configure.in_tmp1
121 echo " ./salome_adm/unix/make_module \\" >> configure.in_tmp1
123 \rm -f configure.in_tmp2 configure.in_tmp3
124 touch configure.in_tmp2
125 find_in . configure.in_tmp2
126 sed '/^.*salome_adm/d' configure.in_tmp2 > configure.in_tmp3
127 sed '/configure.in/d' configure.in_tmp3 > configure.in_tmp2
128 sed 's/.in / /' configure.in_tmp2 >> configure.in_tmp1
130 echo "])" >> configure.in_tmp1
132 # delete the link created for AC_OUTPUT
133 echo "" >> configure.in_tmp1
134 echo 'rm -f ${ROOT_SRCDIR}/salome_adm' >> configure.in_tmp1
135 \mv configure.in_tmp1 configure.in_new
136 \rm -f configure.in_tmp2 configure.in_tmp3
139 ########################################################################
140 # Create new (or replace old) configure.in file
141 # Print a message if the file is write protected
145 if test ! -f configure.in
147 echo -n "Creating new file 'configure.in' ... "
148 if \mv configure.in_new configure.in >& /dev/null
152 echo "error, check your file permissions"
155 echo -n "Updating 'configure.in' file ... "
156 if ! \cp configure.in configure.in_old >& /dev/null
160 echo "Can't backup previous configure.in"
161 echo -n "Continue (you will not be able to revert) - (Y/N) ? "
170 if \cp configure.in_new configure.in >& /dev/null
175 echo "error, can't update previous configure.in"
179 ########################################################################
180 # Use autoconf to rebuild the configure script
185 echo -n "Updating 'configure' script ... "
187 echo -n "Creating 'configure' script ... "
190 aclocal --acdir=${KERNEL_ROOT_DIR}/salome_adm/unix/config_files
195 echo "failed (check file permissions and/or user quotas ...)"