Salome HOME
Avoid problem with parallel compilation (without workaround)
[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 fi 
254 # --- end test corba
255 # ----------------------------------------------------------------------------
256
257 echo
258 echo ============================================================
259 echo testing parallel products
260 echo ============================================================
261 echo
262
263 echo
264 echo ---------------------------------------------
265 echo checking if MPI is requested by user
266 echo ---------------------------------------------
267 echo
268
269 CHECK_MPI
270
271 echo
272 echo ---------------------------------------------
273 echo checking if PaCO++ is requested by user
274 echo ---------------------------------------------
275 echo
276
277 CHECK_PACO
278
279 echo
280 echo ------------------------------------------------------------
281 echo checking if parallel kernel extensions are requested by user
282 echo ------------------------------------------------------------
283 echo
284
285 AC_MSG_CHECKING(whether to enable parallel kernel extension)
286 AC_ARG_ENABLE(parallel_extension, 
287               AC_HELP_STRING([--enable-parallel_extension], [parallel kernel extension = [no/yes] (default is no)]),
288               parallel_extension_ok=$enableval,                
289               parallel_extension_ok=no)
290 if test "x$parallel_extension_ok" = "xyes"
291 then
292   if test "x$PaCO_ok" = "xno"
293   then
294     parallel_extension_ok=no
295   fi
296 fi
297
298 if test "x$parallel_extension_ok" = "xyes"
299 then
300   AC_MSG_RESULT([yes])
301 else
302   AC_MSG_RESULT([no])
303 fi
304
305 AM_CONDITIONAL([WITH_PACO_PARALLEL], [test "x$parallel_extension_ok" = "xyes"])
306
307 echo
308 echo ============================================================
309 echo testing optionnal products
310 echo ============================================================
311 echo
312
313 echo
314 echo ---------------------------------------------
315 echo Testing Batch
316 echo ---------------------------------------------
317 echo
318
319 dnl Several batch systems (OpenPBS, LSF, ...) can be operated using
320 dnl the Batch classes library integrated in the KERNEL module. The
321 dnl checking process tests here the presence of underlying batch
322 dnl softwares. If none is detected, the KERNEL is declared to be
323 dnl "without batch". 
324
325 echo testing OpenPBS
326 echo ---------------
327 openpbs_ok=no
328 CHECK_OPENPBS
329 dnl openpbs_ok is set to yes by CHECK_OPENPBS
330
331 echo testing LSF
332 echo -----------
333 lsf_ok=no
334 CHECK_LSF
335 dnl lsf_ok is set to yes by CHECK_LSF
336 echo lsf = $lsf_ok
337
338 echo testing Local batch system
339 echo --------------------------
340 localbatch_ok=no
341 CHECK_LOCAL
342 dnl localbatch_ok is set to yes by CHECK_LOCAL
343
344 WITH_BATCH=no
345 test x$openpbs_ok = xyes || test x$lsf_ok = xyes || test x$localbatch_ok = xyes && WITH_BATCH=yes
346
347 AC_ARG_ENABLE(batch,
348   [AC_HELP_STRING([--enable-batch],[Batch [default=yes]])],
349   [case "${enableval}" in
350      yes) test x$openpbs_ok = xyes || test x$lsf_ok = xyes || test x$localbatch_ok = xyes && WITH_BATCH=yes;;
351      no)  WITH_BATCH=no ;;
352      *) AC_MSG_ERROR(bad value ${enableval} for --enable-batch) ;;
353   esac],[test x$openpbs_ok = xyes || test x$lsf_ok = xyes || test x$localbatch_ok = xyes && WITH_BATCH=yes])
354
355 echo Batch mode = $WITH_BATCH
356
357 AC_SUBST(WITH_BATCH)
358 AM_CONDITIONAL(WITH_BATCH, [test x"$WITH_BATCH" = xyes])
359
360 echo
361 echo ----------------------------------------------
362 echo testing CPPUNIT only required for unit testing
363 echo ----------------------------------------------
364 echo
365 CHECK_CPPUNIT
366
367 echo
368 echo ============================================================
369 echo testing products required only for documentation generation
370 echo ============================================================
371 echo
372
373 echo
374 echo ---------------------------------------------
375 echo Testing html generators
376 echo ---------------------------------------------
377 echo
378
379 CHECK_HTML_GENERATORS
380
381 echo
382 echo ============================================================
383 echo Summary
384 echo ============================================================
385 echo
386
387 # This function displays the values of each variable given in arguments 
388 function summary {
389   variables=$*
390   for var in $variables
391   do
392     eval toto=\$$var
393     if test x$toto != "x"; then
394       printf "   %10s : " `echo \$var | sed -e "s,_ok,,"`
395       eval echo \$$var
396     fi
397   done
398 }
399
400 # --------------------------------------
401
402 function check_fatal_error {
403   variables=$*
404   for var in $variables
405   do
406     eval toto=\$$var
407     if test x$toto != "xyes"; then
408         echo "FATAL ERROR: some mandatory products are missing."
409         echo "Installing the missing products is required before running the configure script".
410         exit 1
411     fi
412   done  
413 }
414
415 # --------------------------------------
416
417 if test x$corba_gen = xtrue; then
418   basic_mandatory_products="cc_ok threads_ok python_ok swig_ok hdf5_ok"
419 else
420   basic_mandatory_products="cc_ok threads_ok hdf5_ok"
421 fi
422
423 echo --- General mandatory products - Light configuration:
424 summary $basic_mandatory_products
425 check_fatal_error $basic_mandatory_products
426 echo
427
428 corba_mandatory_products="omniORB_ok boost_ok libxml_ok"
429 if test x$corba_gen = xtrue; then
430   echo --- CORBA mandatory products - default configuration:
431   summary $corba_mandatory_products
432   check_fatal_error $corba_mandatory_products
433 else
434   echo --- CORBA products not required - option --disable-corba-gen
435   if test x"$WITH_BATCH" = xyes; then
436     echo --- BATCH mode mandatory products - default configuration:
437     summary "python_ok"
438     check_fatal_error "python_ok"
439   else 
440     echo --- Python not required - option --enable-batch=no
441   fi
442 fi
443 echo
444
445 parallel_products="mpi_ok PaCO_ok parallel_extension_ok"
446 echo --- Kernel parallel extensions:
447 summary $parallel_products
448 echo
449
450 optional_products="cppunit_ok openpbs_ok lsf_ok"
451 echo --- Optional products:
452 echo ["    These products are optional because the KERNEL functions"]
453 echo ["    using them are built only if the products are detected."]
454 summary $optional_products
455 echo
456
457 htmldoc_products="doxygen_ok graphviz_ok rst2html_ok"
458
459 echo --- Html documentation products: only required for doc production
460 summary $htmldoc_products
461 echo
462
463 echo
464 echo "Default ORB   : $DEFAULT_ORB"
465 echo
466
467 dnl generals files which could be included in every makefile
468
469 AC_SUBST_FILE(COMMENCE) COMMENCE=salome_adm/unix/make_commence
470 AC_SUBST_FILE(CONCLUDE) CONCLUDE=salome_adm/unix/make_conclude
471 AC_SUBST_FILE(MODULE) MODULE=salome_adm/unix/make_module
472
473 dnl les dependences
474 AC_SUBST_FILE(DEPEND) DEPEND=salome_adm/unix/depend
475
476 dnl We don t need to say when we re entering directories if we re using
477 dnl GNU make becuase make does it for us.
478 if test "X$GMAKE" = "Xyes"; then
479    AC_SUBST(SETX) SETX=":"
480 else
481    AC_SUBST(SETX) SETX="set -x"
482 fi
483
484 echo 
485 echo ---------------------------------------------
486 echo copying resource files, shell scripts, and 
487 echo xml files
488 echo ---------------------------------------------
489 echo
490
491
492 mkdir -p bin/salome
493 cd bin/salome
494 for i in  `find $ROOT_SRCDIR/bin`
495 do
496   local_bin=`echo $i | sed -e "s,$ROOT_SRCDIR/bin,.,"`
497   case "$local_bin" in
498         *.in | *~) ;;
499         . | */CVS | */CVS/* | ./salome) ;;
500         ./appliskel |./appliskel/env.d) $INSTALL -d $local_bin ; echo $local_bin ;;
501         *) $INSTALL $i $local_bin; echo $local_bin ;;
502   esac
503 done
504 cd $ROOT_BUILDDIR
505
506 echo
507 echo ---------------------------------------------
508 echo generating Makefiles and configure files
509 echo ---------------------------------------------
510 echo
511
512 AC_OUTPUT_COMMANDS([ \
513         chmod +x ./bin/*; \
514         chmod +x ./bin/salome/* \
515 ])
516
517 # This list is initiated using autoscan and must be updated manually
518 # when adding a new file <filename>.in to manage. When you execute
519 # autoscan, the Makefile list is generated in the output file configure.scan.
520 # This could be helpfull to update de configuration.
521 AC_OUTPUT([ \
522         ./KERNEL_version.h \
523         ./salome_adm/unix/SALOMEconfig.ref \
524         ./salome_adm/Makefile \
525         ./salome_adm/unix/Makefile \
526         ./salome_adm/unix/config_files/Makefile \
527         Makefile \
528         ./bin/Makefile \
529         ./bin/VERSION \
530         ./bin/runIDLparser \
531         ./doc/Makefile \
532         ./doc/salome/Makefile \
533         ./doc/salome/tui/Makefile \
534         ./doc/salome/tui/INPUT/doxyuser:./doc/salome/tui/KERNEL/doxyuser.in \
535         ./doc/salome/tui/INPUT/doxydev:./doc/salome/tui/KERNEL/doxydev.in \
536         ./doc/salome/tui/INPUT/sources/static/tree.js:./doc/salome/tui/KERNEL/sources/static/tree.js.in \
537         ./idl/Makefile \
538         ./resources/Makefile \
539         ./resources/KERNELCatalog.xml \
540         ./resources/CatalogResources.xml \
541         ./resources/DEPRECATED/Plugin \
542         ./src/Makefile \
543         ./src/Basics/Makefile \
544         ./src/Basics/Test/Makefile \
545         ./src/Batch/Makefile \
546         ./src/Batch_SWIG/Makefile \
547         ./src/Communication/Makefile \
548         ./src/Communication_SWIG/Makefile \
549         ./src/Container/Makefile \
550         ./src/ParallelContainer/Makefile \
551         ./src/DF/Makefile \
552         ./src/DSC/Makefile \
553         ./src/DSC/DSC_Basic/Makefile \
554         ./src/DSC/DSC_User/Makefile \
555         ./src/DSC/DSC_User/Basic/Makefile \
556         ./src/DSC/DSC_User/Datastream/Makefile \
557         ./src/DSC/DSC_User/Datastream/Palm/Makefile \
558         ./src/DSC/DSC_User/Datastream/Calcium/Makefile \
559         ./src/DSC/ParallelDSC/Makefile \
560         ./src/DSC/DSC_Python/Makefile \
561         ./src/GenericObj/Makefile \
562         ./src/HDFPersist/Makefile \
563         ./src/KERNEL_PY/Makefile \
564         ./src/Launcher/Makefile \
565         ./src/LifeCycleCORBA/Makefile \
566         ./src/LifeCycleCORBA/Test/Makefile \
567         ./src/LifeCycleCORBA_SWIG/Makefile \
568         ./src/LifeCycleCORBA_SWIG/Test/Makefile \
569         ./src/Logger/Makefile \
570         ./src/Logger/Test/Makefile \
571         ./src/ModuleCatalog/Makefile \
572         ./src/ModuleGenerator/Makefile \
573         ./src/ModuleGenerator/testIDLparser \
574         ./src/MPIContainer/Makefile \
575         ./src/NamingService/Makefile \
576         ./src/NamingService/Test/Makefile \
577         ./src/Notification/Makefile \
578         ./src/NOTIFICATION_SWIG/Makefile \
579         ./src/Registry/Makefile \
580         ./src/ResourcesManager/Makefile \
581         ./src/SALOMEDS/Makefile \
582         ./src/SALOMEDS/Test/Makefile \
583         ./src/SALOMEDSClient/Makefile \
584         ./src/SALOMEDSImpl/Makefile \
585         ./src/SALOMEDSImpl/Test/Makefile \
586         ./src/SALOMELocalTrace/Makefile \
587         ./src/SALOMELocalTrace/Test/Makefile \
588         ./src/SALOMETraceCollector/Makefile \
589         ./src/SALOMETraceCollector/Test/Makefile \
590         ./src/TestContainer/Makefile \
591         ./src/TestMPIContainer/Makefile \
592         ./src/TOOLSDS/Makefile \
593         ./src/UnitTests/Makefile \
594         ./src/Utils/Makefile \
595         ./src/Utils/Test/Makefile \
596 ])
597