Salome HOME
Copyrights update 2015.
[modules/yacs.git] / src / wrappergen / bin / HXX2SALOME_GENERIC_CLASS_NAME_SRC / build_configure
1 #!/bin/bash
2 # Copyright (C) 2006-2015  CEA/DEN, EDF R&D
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20
21 # Tool for updating list of .in file for the SALOME project 
22 # and regenerating configure script
23 # Author : Marc Tajchman - CEA
24 # Date : 10/10/2002
25 # $Header $
26 #
27 ORIG_DIR=`pwd`
28 CONF_DIR=`echo $0 | sed -e "s,[^/]*$,,;s,/$,,;s,^$,.,"`
29
30 ########################################################################
31 # Test if the KERNEL_ROOT_DIR is set correctly
32
33 if test ! -d "${KERNEL_ROOT_DIR}"; then
34     echo "failed : KERNEL_ROOT_DIR variable is not correct !"
35     exit
36 fi
37
38 ########################################################################
39 # find_in - utility function
40 #
41 # usage :  
42 #    find_in directory filename 
43 #
44 # Finds files following the *.in pattern, recursively in the
45 # directory (first argument).
46 # Results are appended into the file (second argument)
47 #
48 # Difference from the standard unix find is that files are tested
49 # before directories
50
51
52 find_in()
53 {
54   local i
55   local f=$2
56
57 # if the first argument is not a directory, returns
58
59   if [ ! -d "$1" ] ; then 
60      return 
61   fi
62
63 # dont look in the CVS directories
64
65   case $1 in
66     */CVS) return ;;
67     *) ;;
68   esac
69
70 # for each regular file contained in the directory
71 # test if it's a .in file
72
73   for i in "$1"/*
74   do
75      if [ -f "$i" ] ; then
76        case $i in 
77          *.in) echo $i" \\" >> $f;;
78          *) ;;
79         esac
80      fi
81   done
82
83 # for each subdirectory of the first argument, proceeds recursively
84
85   for i in "$1"/*
86   do
87      if [ -d "$i" ] ; then
88         find_in "$i" "$f"
89      fi
90   done
91 }
92
93
94 #######################################################################
95 # Generate list of .in files (Makefile.in, config.h.in, etc)
96 # appending it in file configure.in
97
98 cd ${CONF_DIR}
99 ABS_CONF_DIR=`pwd`
100
101 #
102 # Common part of the configure.in file
103 #
104 chmod u+w configure.in.base
105 if ! \cp -f configure.in.base configure.in_tmp1 
106 then
107         echo
108         echo "error : can't create files in" ${CONF_DIR}
109         echo "aborting ..."
110         chmod u-w configure.in.base 
111         exit
112 fi
113 chmod u-w configure.in.base 
114
115 if [ -e "${CONF_DIR}/salome_adm" ] ; then
116     \rm -f ${CONF_DIR}/salome_adm
117 fi
118
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}' >> configure.in_tmp1
122
123 echo  "" >> configure.in_tmp1
124 echo "AC_OUTPUT([ \\" >> configure.in_tmp1
125
126 #
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"
130 #
131
132 echo "./salome_adm/unix/SALOMEconfig.h \\" >> configure.in_tmp1
133 echo "./salome_adm/unix/F77config.h \\" >> configure.in_tmp1
134 echo "./salome_adm/unix/sstream \\" >> configure.in_tmp1
135 echo "./salome_adm/unix/depend \\" >> configure.in_tmp1
136 echo "./adm_local/unix/make_omniorb \\" >> configure.in_tmp1
137 echo "./salome_adm/unix/envScript \\" >> configure.in_tmp1
138 echo "./adm_local/unix/make_commence \\" >> configure.in_tmp1
139 echo "./salome_adm/unix/make_conclude \\" >> configure.in_tmp1
140 echo "./salome_adm/unix/make_module \\" >> configure.in_tmp1
141
142 \rm -f configure.in_tmp2
143 touch configure.in_tmp2
144 find_in . configure.in_tmp2
145
146 sed -e '/^.\/salome_adm/d'    \
147     -e '/configure.in/d'      \
148     -e '/^.\/adm_local/d'   \
149     -e 's/.in / /'            \
150     configure.in_tmp2  >>  configure.in_tmp1
151
152 echo  "])" >> configure.in_tmp1
153
154 # delete the link created for AC_OUTPUT
155 echo "" >> configure.in_tmp1
156 \mv configure.in_tmp1 configure.in_new
157 \rm  -f configure.in_tmp2 
158
159
160 ########################################################################
161 # Create new (or replace old) configure.in file
162 # Print a message if the file is write protected
163 #
164
165 echo
166 if test ! -f configure.in
167 then
168         echo -n "Creating new file 'configure.in' ... "
169         if \mv configure.in_new configure.in >& /dev/null
170         then
171                 echo "done"
172         else
173                 echo "error, check your file permissions"
174         fi
175 else
176         echo -n "Updating 'configure.in' file ... "
177         if ! \cp configure.in configure.in_old >& /dev/null
178         then
179                 echo
180                 echo
181                 echo "Can't backup previous configure.in"
182                 echo -n "Continue (you will not be able to revert) - (Y/N) ? "
183                 read R
184                 case "x$R" in
185                     xn*) exit;;
186                     xN*) exit;;
187                 esac
188                 echo
189                 echo -n "                                 "
190         fi
191         if \cp configure.in_new configure.in >& /dev/null
192         then
193                 \rm  -f configure.in_new
194                 echo "done"
195         else
196                 echo
197                 echo "error, can't update previous configure.in"
198         fi
199 fi
200
201 ########################################################################
202 # Use autoconf to rebuild the configure script
203 #
204
205 if test -f configure
206 then
207         echo -n "Updating 'configure' script ...  "
208 else
209         echo -n "Creating 'configure' script ...  "
210 fi
211
212 aclocal -I adm_local/unix/config_files -I ${KERNEL_ROOT_DIR}/salome_adm/unix/config_files \
213                                             -I ${GUI_ROOT_DIR}/adm_local/unix/config_files
214 if autoconf
215 then
216         echo "done"
217 else
218         echo "failed (check file permissions and/or user quotas ...)"
219 fi
220
221 cd ${ORIG_DIR}
222
223 echo