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