4 # Tool for updating list of .in file for the SALOME project
5 # and regenerating configure script
7 # File : build_configure
8 # 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 # Test if the GUI_ROOT_DIR is set correctly
32 if test ! -d "${GUI_ROOT_DIR}"; then
33 echo "failed : GUI_ROOT_DIR variable is not correct !"
37 ########################################################################
38 # find_in - utility function
41 # find_in directory filename
43 # Finds files following the *.in pattern, recursively in the
44 # directory (first argument).
45 # Results are appended into the file (second argument)
47 # Difference from the standard unix find is that files are tested
56 # if the first argument is not a directory, returns
58 if [ ! -d "$1" ] ; then
62 # dont look in the CVS directories
66 */adm_local/*) return ;;
70 # for each regular file contained in the directory
71 # test if it's a .in file
77 *.in) echo " "$i" \\" >> $f;;
83 # for each subdirectory of the first argument, proceeds recursively
94 #######################################################################
95 # Generate list of .in files (Makefile.in, config.h.in, etc)
96 # appending it in file configure.in
102 # Common part of the configure.in file
104 chmod u+w configure.in.base
105 if ! \cp -f configure.in.base configure.in_tmp1
108 echo "error : can't create files in" ${CONF_DIR}
110 chmod u-w configure.in.base
113 chmod u-w configure.in.base
115 if [ -e "${CONF_DIR}/salome_adm" ] ; then
116 \rm -f ${CONF_DIR}/salome_adm
119 # make a link allowing AC_OUTPUT to find the salome_adm/.../*.in files
120 echo "" >> configure.in_tmp1
121 echo 'ln -fs ${KERNEL_ROOT_DIR}/salome_adm ${ROOT_SRCDIR}/salome_adm' >> configure.in_tmp1
123 echo "" >> configure.in_tmp1
124 echo "AC_OUTPUT([ \\" >> configure.in_tmp1
127 # List of .in files in the adm/unix directory
128 # These files MUST be on top of AC_OUTPUT list so we
129 # put them "manually"
131 # Attention, l'ordre d'entrée des fichiers doit être choisi avec
134 echo " ./salome_adm/unix/SALOMEconfig.h \\" >> configure.in_tmp1
135 echo " ./salome_adm/unix/F77config.h \\" >> configure.in_tmp1
136 echo " ./salome_adm/unix/sstream \\" >> configure.in_tmp1
138 echo " ./salome_adm/unix/depend \\" >> configure.in_tmp1
139 echo " ./adm_local/unix/make_omniorb \\" >> configure.in_tmp1
140 echo " ./salome_adm/unix/envScript \\" >> configure.in_tmp1
141 echo " ./salome_adm/unix/make_module \\" >> configure.in_tmp1
143 # _CS_gbo Pour assurer ls construction correct de la chaîne de
144 # dépendance, il apparaît nécessaire de surcharger le make_conclude
145 # (resp. make_commence) pardéfaut, c'est à dire le make_conclude de
146 # salome_adm, par le make_conclude (resp. make_commence) du module,
147 # c'est à dire le make_conclude (resp. make_commence) du répertoire
149 echo " ./adm_local/unix/make_commence \\" >> configure.in_tmp1
150 echo " ./salome_adm/unix/make_conclude \\" >> configure.in_tmp1
152 \rm -f configure.in_tmp2 configure.in_tmp3
153 touch configure.in_tmp2
155 find_in . configure.in_tmp2
157 # _CS_gbo_100204 Mise à jour du filtre pour prise en compte des
158 # restrictions imposées par les versions récente de autoconf.
159 sed -e '/^...salome_adm/d' \
160 -e '/configure.in/d' \
161 -e 's/.in / /' configure.in_tmp2 >> configure.in_tmp1
163 echo "])" >> configure.in_tmp1
166 # delete the link created for AC_OUTPUT
167 echo "" >> configure.in_tmp1
168 #echo 'rm -f ${ROOT_SRCDIR}/salome_adm' >> configure.in_tmp1
169 \mv configure.in_tmp1 configure.in_new
170 \rm -f configure.in_tmp2 configure.in_tmp3
173 ########################################################################
174 # Create new (or replace old) configure.in file
175 # Print a message if the file is write protected
179 if test ! -f configure.in
181 echo -n "Creating new file 'configure.in' ... "
182 if \mv configure.in_new configure.in >& /dev/null
186 echo "error, check your file permissions"
189 echo -n "Updating 'configure.in' file ... "
190 if ! \cp configure.in configure.in_old >& /dev/null
194 echo "Can't backup previous configure.in"
195 echo -n "Continue (you will not be able to revert) - (Y/N) ? "
204 if \cp configure.in_new configure.in >& /dev/null
209 echo "error, can't update previous configure.in"
213 ########################################################################
214 # Use autoconf to rebuild the configure script
219 echo -n "Updating 'configure' script ... "
221 echo -n "Creating 'configure' script ... "
224 aclocal --acdir=adm_local/unix/config_files -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \
225 -I ${GUI_ROOT_DIR}/adm_local/unix/config_files
230 echo "failed (check file permissions and/or user quotas ...)"