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