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