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