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