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