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