Salome HOME
Merge from V6_main_20120808 08Aug12
[samples/calculator.git] / configure.ac
1 # Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 #  PLEASE DO NOT MODIFY configure.in FILE
21 #  ALL CHANGES WILL BE DISCARDED BY THE NEXT
22 #  build_configure COMMAND
23 #  CHANGES MUST BE MADE IN configure.in.base FILE
24 # Author : Marc Tajchman (CEA)
25 # Date : 28/06/2001
26 # Modified by : Patrick GOLDBRONN (CEA)
27 # Modified by : Marc Tajchman (CEA)
28 #
29 AC_INIT([Salome2 Project CALCULATOR module], [6.5.0], [webmaster.salome@opencascade.com], [SalomeCALCULATOR])
30 AC_CONFIG_AUX_DIR(adm_local/unix/config_files)
31 AC_CANONICAL_HOST
32 AC_CANONICAL_TARGET
33 AM_INIT_AUTOMAKE([-Wno-portability])
34
35 XVERSION=`echo $VERSION | awk -F. '{printf("0x%02x%02x%02x",$1,$2,$3)}'`
36 AC_SUBST(XVERSION)
37 VERSION_DEV=1
38 AC_SUBST(VERSION_DEV)
39
40 # set up MODULE_NAME variable for dynamic construction of directories (resources, etc.)
41 MODULE_NAME=calculator
42 AC_SUBST(MODULE_NAME)
43
44 dnl
45 dnl Initialize source and build root directories
46 dnl
47
48 ROOT_BUILDDIR=`pwd`
49 ROOT_SRCDIR=`echo $0 | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
50 cd $ROOT_SRCDIR
51 ROOT_SRCDIR=`pwd`
52 cd $ROOT_BUILDDIR
53
54 AC_SUBST(ROOT_SRCDIR)
55 AC_SUBST(ROOT_BUILDDIR)
56
57 echo
58 echo Source root directory : $ROOT_SRCDIR
59 echo Build  root directory : $ROOT_BUILDDIR
60 echo
61 echo
62
63 AC_CHECK_PROG(SHELL,sh)
64 AC_SUBST(SHELL)
65
66 if test -z "$AR"; then
67    AC_CHECK_PROGS(AR,ar xar,:,$PATH)
68 fi
69 AC_SUBST(AR)
70
71 dnl Export the AR macro so that it will be placed in the libtool file
72 dnl correctly.
73 export AR
74
75 echo
76 echo ---------------------------------------------
77 echo testing make
78 echo ---------------------------------------------
79 echo
80
81 AC_PROG_MAKE_SET
82 AC_PROG_INSTALL
83 AC_LOCAL_INSTALL
84 dnl 
85 dnl libtool macro check for CC, LD, NM, LN_S, RANLIB, STRIP + for shared libraries
86
87 AC_ENABLE_DEBUG(yes)
88 AC_DISABLE_PRODUCTION
89
90 echo ---------------------------------------------
91 echo testing libtool
92 echo ---------------------------------------------
93
94 dnl first, we set static to no!
95 dnl if we want it, use --enable-static
96 AC_ENABLE_STATIC(no)
97
98 AC_LIBTOOL_DLOPEN
99 AC_PROG_LIBTOOL
100
101 dnl Fix up the INSTALL macro if it s a relative path. We want the
102 dnl full-path to the binary instead.
103 case "$INSTALL" in
104    *install-sh*)
105      #INSTALL='\${ROOT_BUILDDIR}'/adm_local/unix/config_files/install-sh
106      #;;
107      case $host_os in
108        osf*)
109          INSTALL="${AUX_CONFIG_DIR}/install-sh -c"
110          ;;
111        *)
112          INSTALL='\${AUX_CONFIG_DIR}'/install-sh
113          ;;
114      esac
115 esac
116
117 echo
118 echo ---------------------------------------------
119 echo testing C/C++
120 echo ---------------------------------------------
121 echo
122
123 cc_ok=no
124 dnl inutil car libtool
125 dnl AC_PROG_CC
126 AC_PROG_CXX
127 AC_CXX_WARNINGS
128 AC_CXX_TEMPLATE_OPTIONS
129 AC_DEPEND_FLAG
130 # AC_CC_WARNINGS([ansi])
131 cc_ok=yes
132
133 dnl Library libdl :
134 AC_CHECK_LIB(dl,dlopen)
135
136 dnl Library librt : for alpha/osf
137 AC_CHECK_LIB(rt,nanosleep)
138
139 dnl add library libm :
140 AC_CHECK_LIB(m,ceil)
141
142 dnl 
143 dnl Check if we use std iostream by default or if we must add
144 dnl a compiler directive for that
145 dnl
146
147 AC_CXX_USE_STD_IOSTREAM
148
149 dnl 
150 dnl Well we use sstream which is not in gcc pre-2.95.3
151 dnl We must test if it exists. If not, add it in include !
152 dnl
153
154 AC_CXX_HAVE_SSTREAM
155 #AM_CONDITIONAL(MED_ENABLE_SSTREAM, [test "$HAVE_SSTREAM" = yes])
156
157 dnl
158 dnl ---------------------------------------------
159 dnl testing linker
160 dnl ---------------------------------------------
161 dnl
162
163 AC_LINKER_OPTIONS
164
165 echo
166 echo ---------------------------------------------
167 echo testing threads
168 echo ---------------------------------------------
169 echo
170
171 ENABLE_PTHREADS
172
173 echo
174 echo ---------------------------------------------
175 echo testing MPI
176 echo ---------------------------------------------
177 echo
178
179 CHECK_MPI
180
181 echo
182 echo ---------------------------------------------
183 echo testing python
184 echo ---------------------------------------------
185 echo
186
187 CHECK_PYTHON
188
189 echo
190 echo ---------------------------------------------
191 echo testing swig
192 echo ---------------------------------------------
193 echo
194
195 AM_PATH_PYTHON(2.3)
196 CHECK_SWIG
197 #AM_CONDITIONAL(MED_SWIG_1_3_21, [test "$SWIG_VERSION" = 1.3.21])
198
199 echo
200 echo ---------------------------------------------
201 echo testing HDF5
202 echo ---------------------------------------------
203 echo
204
205 CHECK_HDF5
206
207 echo
208 echo ---------------------------------------------
209 echo BOOST Library
210 echo ---------------------------------------------
211 echo
212
213 CHECK_BOOST
214
215 echo
216 echo ---------------------------------------------
217 echo testing MED3
218 echo ---------------------------------------------
219 echo
220
221 CHECK_MED3
222
223 echo
224 echo ---------------------------------------------
225 echo testing omniORB
226 echo ---------------------------------------------
227 echo
228
229 CHECK_OMNIORB
230
231 echo
232 echo ---------------------------------------------
233 echo default ORB : omniORB
234 echo ---------------------------------------------
235 echo
236
237 DEFAULT_ORB=omniORB
238 CHECK_CORBA
239
240 AC_SUBST_FILE(CORBA)
241 corba=make_$ORB
242 CORBA=adm_local/unix/$corba
243
244 echo
245 echo ---------------------------------------------
246 echo Testing OpenCascade
247 echo ---------------------------------------------
248 echo
249
250 CHECK_CAS
251
252 echo
253 echo ---------------------------------------------
254 echo testing MED
255 echo ---------------------------------------------
256 echo
257
258 CHECK_MED
259
260 dnl For the sake of $MACHINE needed for MED Wrapper
261 AC_DEPEND_FLAG
262
263 echo
264 echo ---------------------------------------------
265 echo Testing Kernel
266 echo ---------------------------------------------
267 echo
268
269 CHECK_KERNEL
270
271 echo
272 echo ---------------------------------------------
273 echo Summary
274 echo ---------------------------------------------
275 echo
276
277 echo Configure
278 variables="python_ok omniORB_ok Kernel_ok"
279
280 for var in $variables
281 do
282    printf "   %10s : " `echo \$var | sed -e "s,_ok,,"`
283    eval echo \$$var
284 done
285
286 echo
287 echo "Default ORB   : $DEFAULT_ORB"
288 echo
289
290 dnl We don t need to say when we re entering directories if we re using
291 dnl GNU make becuase make does it for us.
292 if test "X$GMAKE" = "Xyes"; then
293    AC_SUBST(SETX) SETX=":"
294 else
295    AC_SUBST(SETX) SETX="set -x"
296 fi
297
298 echo
299 echo ---------------------------------------------
300 echo generating Makefiles and configure files
301 echo ---------------------------------------------
302 echo
303
304 AC_OUTPUT_COMMANDS([ \
305       chmod +x ./bin/*; \
306 ])
307
308 AC_HACK_LIBTOOL
309 AC_CONFIG_COMMANDS([hack_libtool],[
310 sed -i "s%^CC=\"\(.*\)\"%hack_libtool (){ \n\
311   $(pwd)/hack_libtool \1 \"\$[@]\" \n\
312 }\n\
313 CC=\"hack_libtool\"%g" libtool
314 sed -i "s%\(\s*\)for searchdir in \$newlib_search_path \$lib_search_path \$sys_lib_search_path \$shlib_search_path; do%\1searchdirs=\"\$newlib_search_path \$lib_search_path \$sys_lib_search_path \$shlib_search_path\"\n\1for searchdir in \$searchdirs; do%g" libtool
315 sed -i "s%\(\s*\)searchdirs=\"\$newlib_search_path \$lib_search_path \(.*\)\"%\1searchdirs=\"\$newlib_search_path \$lib_search_path\"\n\1sss_beg=\"\"\n\1sss_end=\"\2\"%g" libtool
316 sed -i "s%\(\s*\)\(for searchdir in \$searchdirs; do\)%\1for sss in \$searchdirs; do\n\1  if ! test -d \$sss; then continue; fi\n\1  ssss=\$(cd \$sss; pwd)\n\1  if test \"\$ssss\" != \"\" \&\& test -d \$ssss; then\n\1    case \$ssss in\n\1      /usr/lib | /usr/lib64 ) ;;\n\1      * ) sss_beg=\"\$sss_beg \$ssss\" ;;\n\1    esac\n\1  fi\n\1done\n\1searchdirs=\"\$sss_beg \$sss_end\"\n\1\2%g" libtool
317 ],[])
318
319 # This list is initiated using autoscan and must be updated manually
320 # when adding a new file <filename>.in to manage. When you execute
321 # autoscan, the Makefile list is generated in the output file configure.scan.
322 # This could be helpfull to update de configuration.
323 AC_OUTPUT([ \
324   adm_local/Makefile \
325   adm_local/unix/Makefile \
326   adm_local/unix/config_files/Makefile \
327   bin/VERSION \
328   bin/runAppli \
329   bin/Makefile \
330   doc/Makefile \
331   CALCULATOR_version.h \
332   src/Makefile \
333   src/CALCULATOR/Makefile \
334   resources/Makefile \
335   resources/CALCULATORCatalog.xml \
336   resources/SalomeApp.xml \
337   idl/Makefile \
338   Makefile \
339 ])