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