Salome HOME
Bug IPAL11479, added a removal a temporary file "hdf_from_ascii.hdf"
[modules/kernel.git] / configure.ac
1 #
2 # ================================================================
3 # Process this file with autoconf to produce a configure script
4 # ================================================================
5 #
6 #AC_PREREQ(2.59)
7 #AC_INIT(src)
8 AC_INIT([Salome2 Project], [3.1.0], [gboulant@CS], [salome])
9
10 # AC_CONFIG_AUX_DIR defines an alternative directory where to find the auxiliary
11 # scripts such as config.guess, install-sh, ...
12 AC_CONFIG_AUX_DIR(salome_adm/unix/config_files)
13 AC_CANONICAL_HOST
14 AC_CANONICAL_TARGET
15 AM_INIT_AUTOMAKE
16 #AC_CONFIG_HEADER([config.h])
17
18 PACKAGE=salome
19 AC_SUBST(PACKAGE)
20
21 VERSION=3.1.0
22 AC_SUBST(VERSION)
23
24
25 echo
26 echo ---------------------------------------------
27 echo Initialize source and build root directories
28 echo ---------------------------------------------
29 echo
30
31 #
32 # This function return on stdout the absolute path of the filename in
33 # argument. Exemple:
34 # $ filename="../KERNEL_SRC/configure
35 # $ absfilename=`absolute_path $filename`
36 function absolute_path {
37     filename=$1
38     here=`pwd`
39     apath=`dirname $filename`
40     cd $apath
41     apath=`pwd`
42     cd $here
43     echo $apath
44 }
45
46 # Build directory, where the configure script is executed.
47 ROOT_BUILDDIR=`pwd`
48 # Source directory, where the configure script is located.
49 ROOT_SRCDIR=`absolute_path $0`
50
51 AC_SUBST(ROOT_SRCDIR)
52 AC_SUBST(ROOT_BUILDDIR)
53
54 echo
55 echo Source root directory : $ROOT_SRCDIR
56 echo Build  root directory : $ROOT_BUILDDIR
57
58 # ----------------------------------------------------------------------------
59 # --- test options
60
61 AC_ARG_ENABLE(corba_gen,
62   [AC_HELP_STRING([--enable-corba-gen],[Generate CORBA stuff [default=yes]])],
63   [case "${enableval}" in
64      yes) corba_gen=true ;;
65      no)  corba_gen=false ;;
66      *) AC_MSG_ERROR(bad value ${enableval} for --enable-corba-gen) ;;
67   esac],[corba_gen=true])
68 AM_CONDITIONAL(CORBA_GEN, test x$corba_gen = xtrue)
69
70 # ----------------------------------------------------------------------------
71
72 echo
73 echo
74 echo ============================================================
75 echo testing general mandatory products - for all configurations
76 echo ============================================================
77 echo
78
79 dnl Modification B. Secher portage sur osf
80 AC_CHECK_PROG(SHELL,sh)
81 AC_SUBST(SHELL)
82
83 if test -z "$AR"; then
84    AC_CHECK_PROGS(AR,ar xar,:,$PATH)
85 fi
86 AC_SUBST(AR)
87
88 echo
89 echo ---------------------------------------------
90 echo testing make
91 echo ---------------------------------------------
92 echo
93 AC_PROG_MAKE_SET
94 AC_PROG_INSTALL
95
96 echo
97 echo ---------------------------------------------
98 echo Configuring production
99 echo ---------------------------------------------
100 echo
101 # production.m4
102 AC_ENABLE_DEBUG(yes)
103 AC_DISABLE_PRODUCTION
104
105 echo
106 echo ---------------------------------------------
107 echo testing libtool
108 echo ---------------------------------------------
109 echo
110
111 dnl first, we set static to no!
112 dnl if we want it, use --enable-static
113 AC_ENABLE_STATIC(no)
114 AC_LIBTOOL_DLOPEN
115 AC_PROG_LIBTOOL
116
117 echo
118 echo ---------------------------------------------
119 echo testing C/C++
120 echo ---------------------------------------------
121 echo
122
123 cc_ok=no
124 AC_PROG_CC
125 AC_PROG_CXX
126 AC_CXX_WARNINGS
127 AC_CXX_TEMPLATE_OPTIONS
128 AC_DEPEND_FLAG
129 # AC_CC_WARNINGS([ansi])
130 cc_ok=yes
131
132 dnl Library libdl :
133 AC_CHECK_LIB(dl,dlopen)
134
135 dnl Library librt : for alpha/osf
136 AC_CHECK_LIB(rt,nanosleep)
137
138 dnl add library libm :
139 AC_CHECK_LIB(m,ceil)
140
141 # _CS_gbo We should add all dependent libraries
142
143 AC_CXX_USE_STD_IOSTREAM
144
145 AC_CXX_HAVE_SSTREAM
146
147 # Testing linker
148 AC_LINKER_OPTIONS
149
150 echo
151 echo ---------------------------------------------
152 echo testing threads
153 echo ---------------------------------------------
154 echo
155
156 ENABLE_PTHREADS
157
158 echo
159 echo ---------------------------------------------
160 echo testing python
161 echo ---------------------------------------------
162 echo
163
164 CHECK_PYTHON
165
166 echo
167 echo ---------------------------------------------
168 echo testing swig
169 echo ---------------------------------------------
170 echo
171
172 dnl _CS_gbo We should use here a variable given from the CHECK_PYTHON
173 AM_PATH_PYTHON(2.3)
174 CHECK_SWIG
175
176 echo
177 echo ---------------------------------------------
178 echo testing HDF5
179 echo ---------------------------------------------
180 echo
181
182 CHECK_HDF5
183
184 echo
185 echo ---------------------------------------------
186 echo Testing OpenCascade
187 echo ---------------------------------------------
188 echo
189
190 CHECK_CAS
191
192 # ----------------------------------------------------------------------------
193 # --- test corba
194
195 if test x$corba_gen = xtrue; then
196
197 echo
198 echo ============================================================
199 echo testing mandatory products for CORBA configurations
200 echo ============================================================
201 echo
202
203 dnl
204 dnl ---------------------------------------------
205 dnl testing sockets
206 dnl ---------------------------------------------
207 dnl
208
209 CHECK_SOCKETS
210
211 echo
212 echo ---------------------------------------------
213 echo Configuration of the ORB
214 echo ---------------------------------------------
215 echo
216
217 echo Testing OMNIORB ...
218 CHECK_OMNIORB
219
220 echo Selecting the default ORB
221 DEFAULT_ORB=omniORB
222 echo DEFAULT_ORB : $DEFAULT_ORB
223 CHECK_CORBA
224
225 CORBA=salome_adm/unix/make_$ORB
226 AC_SUBST_FILE(CORBA)
227
228 # _CS_gbo:
229 # The CORBA variable defines the file name that
230 # implements the building rules to be included by Makefile to process
231 # idl files and CORBA specific dependencies (ex: the file
232 # salome_adm/unix/make_omniorb is the default for SALOME). The value
233 # of ORB is defined by CHECK_CORBA.
234
235 # Note that this checking process is no longer relevant for SALOME
236 # because the possibility of changing the ORB as a plugin is probably
237 # deprecated. The software configuration is clearly omniorb for CORBA
238 # communication. This could be simplify in a near futur.
239
240 echo
241 echo ---------------------------------------------
242 echo Testing QT
243 echo ---------------------------------------------
244 echo
245 # Qt must be kept because kernel makes use of qxml and some other
246 # non-graphical stuff.
247 CHECK_QT
248
249 echo
250 echo ---------------------------------------------
251 echo BOOST Library
252 echo ---------------------------------------------
253 echo
254
255 CHECK_BOOST
256
257 fi 
258 # --- end test corba
259 # ----------------------------------------------------------------------------
260
261 echo
262 echo ============================================================
263 echo testing optionnal products
264 echo ============================================================
265 echo
266
267 echo
268 echo ---------------------------------------------
269 echo checking if MPI is requested by user
270 echo ---------------------------------------------
271 echo
272
273 CHECK_MPI
274
275 echo
276 echo ---------------------------------------------
277 echo Testing Batch
278 echo ---------------------------------------------
279 echo
280
281 dnl Several batch systems (OpenPBS, LSF, ...) can be operated using
282 dnl the Batch classes library integrated in the KERNEL module. The
283 dnl checking process tests here the presence of underlying batch
284 dnl softwares. If none is detected, the KERNEL is declared to be
285 dnl "without batch". 
286
287 echo testing OpenPBS
288 echo ---------------
289 openpbs_ok=no
290 CHECK_OPENPBS
291 dnl openpbs_ok is set to yes by CHECK_OPENPBS
292
293 echo testing LSF
294 echo -----------
295 lsf_ok=no
296 CHECK_LSF
297 dnl lsf_ok is set to yes by CHECK_LSF
298 echo lsf = $lsf_ok
299
300 echo testing Local batch system
301 echo --------------------------
302 localbatch_ok=no
303 CHECK_LOCAL
304 dnl localbatch_ok is set to yes by CHECK_LOCAL
305
306 WITH_BATCH=no
307 test x$openpbs_ok = xyes || test x$lsf_ok = xyes || test x$localbatch_ok = xyes && WITH_BATCH=yes
308 AC_SUBST(WITH_BATCH)
309 AM_CONDITIONAL(WITH_BATCH, [test x"$WITH_BATCH" = xyes])
310
311 echo
312 echo ----------------------------------------------
313 echo testing CPPUNIT only required for unit testing
314 echo ----------------------------------------------
315 echo
316 CHECK_CPPUNIT
317
318 echo
319 echo ============================================================
320 echo testing products required only for documentation generation
321 echo ============================================================
322 echo
323
324 echo
325 echo ---------------------------------------------
326 echo Testing html generators
327 echo ---------------------------------------------
328 echo
329
330 CHECK_HTML_GENERATORS
331
332 echo
333 echo ============================================================
334 echo Summary
335 echo ============================================================
336 echo
337
338 # This function displays the values of each variable given in arguments 
339 function summary {
340   variables=$*
341   for var in $variables
342   do
343     eval toto=\$$var
344     if test x$toto != "x"; then
345       printf "   %10s : " `echo \$var | sed -e "s,_ok,,"`
346       eval echo \$$var
347     fi
348   done
349 }
350
351 # --------------------------------------
352
353 function check_fatal_error {
354   variables=$*
355   for var in $variables
356   do
357     eval toto=\$$var
358     if test x$toto != "xyes"; then
359         echo "FATAL ERROR: some mandatory products are missing."
360         echo "Installing the missing products is required before running the configure script".
361         exit 1
362     fi
363   done  
364 }
365
366 # --------------------------------------
367
368 basic_mandatory_products="cc_ok threads_ok python_ok swig_ok hdf5_ok occ_ok"
369 echo --- General mandatory products - Light configuration:
370 summary $basic_mandatory_products
371 check_fatal_error $basic_mandatory_products
372 echo
373
374 corba_mandatory_products="omniORB_ok qt_ok boost_ok"
375 if test x$corba_gen = xtrue; then
376   echo --- CORBA mandatory products - default configuration:
377   summary $corba_mandatory_products
378   check_fatal_error $corba_mandatory_products
379 else
380   echo --- CORBA products not required - option --disable-corba-gen
381 fi
382 echo
383
384 if test x$MPIREQUESTED = xyes; then
385   requested_products="mpi_ok"
386   echo --- products requested by user
387   summary $requested_products
388   check_fatal_error $requested_products
389   echo
390 fi
391
392 optional_products="cppunit_ok openpbs_ok lsf_ok"
393 echo --- Optional products:
394 echo ["    These products are optional because the KERNEL functions"]
395 echo ["    using them are built only if the products are detected."]
396 summary $optional_products
397 echo
398
399 htmldoc_products="doxygen_ok graphviz_ok rst2html_ok"
400
401 echo --- Html documentation products: only required for doc production
402 summary $htmldoc_products
403 echo
404
405 echo
406 echo "Default ORB   : $DEFAULT_ORB"
407 echo
408
409 dnl generals files which could be included in every makefile
410
411 AC_SUBST_FILE(COMMENCE) COMMENCE=salome_adm/unix/make_commence
412 AC_SUBST_FILE(CONCLUDE) CONCLUDE=salome_adm/unix/make_conclude
413 AC_SUBST_FILE(MODULE) MODULE=salome_adm/unix/make_module
414
415 dnl les dependences
416 AC_SUBST_FILE(DEPEND) DEPEND=salome_adm/unix/depend
417
418 dnl We don t need to say when we re entering directories if we re using
419 dnl GNU make becuase make does it for us.
420 if test "X$GMAKE" = "Xyes"; then
421    AC_SUBST(SETX) SETX=":"
422 else
423    AC_SUBST(SETX) SETX="set -x"
424 fi
425
426 echo 
427 echo ---------------------------------------------
428 echo copying resource files, shell scripts, and 
429 echo xml files
430 echo ---------------------------------------------
431 echo
432
433
434 mkdir -p bin/salome
435 cd bin/salome
436 for i in  `find $ROOT_SRCDIR/bin`
437 do
438   local_bin=`echo $i | sed -e "s,$ROOT_SRCDIR/bin,.,"`
439   case "$local_bin" in
440         *.in | *~) ;;
441         . | */CVS | */CVS/* | ./salome) ;;
442         ./appliskel |./appliskel/env.d) $INSTALL -d $local_bin ; echo $local_bin ;;
443         *) $INSTALL $i $local_bin; echo $local_bin ;;
444   esac
445 done
446 cd $ROOT_BUILDDIR
447
448 echo
449 echo ---------------------------------------------
450 echo generating Makefiles and configure files
451 echo ---------------------------------------------
452 echo
453
454 AC_OUTPUT_COMMANDS([ \
455         chmod +x ./bin/*; \
456         chmod +x ./bin/salome/* \
457 ])
458
459 # This list is initiated using autoscan and must be updated manually
460 # when adding a new file <filename>.in to manage. When you execute
461 # autoscan, the Makefile list is generated in the output file configure.scan.
462 # This could be helpfull to update de configuration.
463 AC_OUTPUT([ \
464         ./salome_adm/unix/SALOMEconfig.h \
465         ./salome_adm/Makefile \
466         ./salome_adm/unix/Makefile \
467         ./salome_adm/unix/config_files/Makefile \
468         ./Makefile \
469         ./bin/Makefile \
470         ./bin/runIDLparser \
471         ./doc/Makefile \
472         ./doc/salome/Makefile \
473         ./doc/salome/DevelopersGuide/DevelopersGuide.tex \
474         ./doc/salome/DevelopersGuide/Makefile \
475         ./doc/salome/gui/Makefile \
476         ./doc/salome/tui/Makefile \
477         ./idl/Makefile \
478         ./resources/Makefile \
479         ./resources/DEPRECATED/Plugin \
480         ./src/Makefile \
481         ./src/Basics/Makefile \
482         ./src/Basics/Test/Makefile \
483         ./src/Batch/Makefile \
484         ./src/Batch_SWIG/Makefile \
485         ./src/CASCatch/Makefile \
486         ./src/Communication/Makefile \
487         ./src/Communication_SWIG/Makefile \
488         ./src/Container/Makefile \
489         ./src/DataTypeCatalog/Makefile \
490         ./src/GenericObj/Makefile \
491         ./src/HDFPersist/Makefile \
492         ./src/KERNEL_PY/Makefile \
493         ./src/LifeCycleCORBA/Makefile \
494         ./src/LifeCycleCORBA/Test/Makefile \
495         ./src/LifeCycleCORBA_SWIG/Makefile \
496         ./src/Logger/Makefile \
497         ./src/Logger/Test/Makefile \
498         ./src/ModuleCatalog/Makefile \
499         ./src/ModuleGenerator/Makefile \
500         ./src/ModuleGenerator/testIDLparser \
501         ./src/MPIContainer/Makefile \
502         ./src/NamingService/Makefile \
503         ./src/NamingService/Test/Makefile \
504         ./src/Notification/Makefile \
505         ./src/NOTIFICATION_SWIG/Makefile \
506         ./src/Registry/Makefile \
507         ./src/ResourcesManager/Makefile \
508         ./src/RessourcesCatalog/Makefile \
509         ./src/SALOMEDS/Makefile \
510         ./src/SALOMEDS/Test/Makefile \
511         ./src/SALOMEDSClient/Makefile \
512         ./src/SALOMEDSImpl/Makefile \
513         ./src/SALOMEDSImpl/Test/Makefile \
514         ./src/SALOMELocalTrace/Makefile \
515         ./src/SALOMELocalTrace/Test/Makefile \
516         ./src/SALOMETraceCollector/Makefile \
517         ./src/SALOMETraceCollector/Test/Makefile \
518         ./src/TestContainer/Makefile \
519         ./src/TestMPIContainer/Makefile \
520         ./src/TOOLSDS/Makefile \
521         ./src/UnitTests/Makefile \
522         ./src/Utils/Makefile \
523         ./src/Utils/Test/Makefile \
524 ])
525