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