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