Salome HOME
Increment version number: 3.2.2
[modules/kernel.git] / configure.ac
1 #
2 # ================================================================
3 # Process this file with autoconf to produce a configure script
4 # ================================================================
5 #
6 #AC_PREREQ(2.59)
7 #AC_INIT(src)
8 AC_INIT([Salome2 Project], [3.2.1], [gboulant@CS], [salome])
9
10 # AC_CONFIG_AUX_DIR defines an alternative directory where to find the auxiliary
11 # scripts such as config.guess, install-sh, ...
12 AC_CONFIG_AUX_DIR(salome_adm/unix/config_files)
13 AC_CANONICAL_HOST
14 AC_CANONICAL_TARGET
15 AM_INIT_AUTOMAKE
16 #AC_CONFIG_HEADER([config.h])
17
18 PACKAGE=salome
19 AC_SUBST(PACKAGE)
20
21 VERSION=3.2.2
22 XVERSION=0x030202
23 AC_SUBST(VERSION)
24 AC_SUBST(XVERSION)
25
26 # set up MODULE_NAME variable for dynamic construction of directories (resources, etc.)
27 MODULE_NAME=kernel
28 AC_SUBST(MODULE_NAME)
29
30 echo
31 echo ---------------------------------------------
32 echo Initialize source and build root directories
33 echo ---------------------------------------------
34 echo
35
36 #
37 # This function return on stdout the absolute path of the filename in
38 # argument. Exemple:
39 # $ filename="../KERNEL_SRC/configure
40 # $ absfilename=`absolute_path $filename`
41 function absolute_path {
42     filename=$1
43     here=`pwd`
44     apath=`dirname $filename`
45     cd $apath
46     apath=`pwd`
47     cd $here
48     echo $apath
49 }
50
51 # Build directory, where the configure script is executed.
52 ROOT_BUILDDIR=`pwd`
53 # Source directory, where the configure script is located.
54 ROOT_SRCDIR=`absolute_path $0`
55
56 AC_SUBST(ROOT_SRCDIR)
57 AC_SUBST(ROOT_BUILDDIR)
58
59 echo
60 echo Source root directory : $ROOT_SRCDIR
61 echo Build  root directory : $ROOT_BUILDDIR
62
63 # ----------------------------------------------------------------------------
64 # --- test options
65
66 AC_ARG_ENABLE(corba_gen,
67   [AC_HELP_STRING([--enable-corba-gen],[Generate CORBA stuff [default=yes]])],
68   [case "${enableval}" in
69      yes) corba_gen=true ;;
70      no)  corba_gen=false ;;
71      *) AC_MSG_ERROR(bad value ${enableval} for --enable-corba-gen) ;;
72   esac],[corba_gen=true])
73 AM_CONDITIONAL(CORBA_GEN, test x$corba_gen = xtrue)
74
75 # ----------------------------------------------------------------------------
76
77 echo
78 echo
79 echo ============================================================
80 echo testing general mandatory products - for all configurations
81 echo ============================================================
82 echo
83
84 dnl Modification B. Secher portage sur osf
85 AC_CHECK_PROG(SHELL,sh)
86 AC_SUBST(SHELL)
87
88 if test -z "$AR"; then
89    AC_CHECK_PROGS(AR,ar xar,:,$PATH)
90 fi
91 AC_SUBST(AR)
92
93 echo
94 echo ---------------------------------------------
95 echo testing make
96 echo ---------------------------------------------
97 echo
98 AC_PROG_MAKE_SET
99 AC_PROG_INSTALL
100
101 echo
102 echo ---------------------------------------------
103 echo Configuring production
104 echo ---------------------------------------------
105 echo
106 # production.m4
107 AC_ENABLE_DEBUG(yes)
108 AC_DISABLE_PRODUCTION
109
110 echo
111 echo ---------------------------------------------
112 echo testing libtool
113 echo ---------------------------------------------
114 echo
115
116 dnl first, we set static to no!
117 dnl if we want it, use --enable-static
118 AC_ENABLE_STATIC(no)
119 AC_LIBTOOL_DLOPEN
120 AC_PROG_LIBTOOL
121
122 echo
123 echo ---------------------------------------------
124 echo testing C/C++
125 echo ---------------------------------------------
126 echo
127
128 cc_ok=no
129 AC_PROG_CC
130 AC_PROG_CXX
131 AC_CXX_WARNINGS
132 AC_CXX_TEMPLATE_OPTIONS
133 AC_DEPEND_FLAG
134 # AC_CC_WARNINGS([ansi])
135 cc_ok=yes
136
137 dnl Library libdl :
138 AC_CHECK_LIB(dl,dlopen)
139
140 dnl Library librt : for alpha/osf
141 AC_CHECK_LIB(rt,nanosleep)
142
143 dnl add library libm :
144 AC_CHECK_LIB(m,ceil)
145
146 # _CS_gbo We should add all dependent libraries
147
148 AC_CXX_USE_STD_IOSTREAM
149
150 AC_CXX_HAVE_SSTREAM
151
152 # Testing linker
153 AC_LINKER_OPTIONS
154
155 echo
156 echo ---------------------------------------------
157 echo testing threads
158 echo ---------------------------------------------
159 echo
160
161 ENABLE_PTHREADS
162
163 echo
164 echo ---------------------------------------------
165 echo testing python
166 echo ---------------------------------------------
167 echo
168
169 CHECK_PYTHON
170
171 echo
172 echo ---------------------------------------------
173 echo testing swig
174 echo ---------------------------------------------
175 echo
176
177 dnl _CS_gbo We should use here a variable given from the CHECK_PYTHON
178 AM_PATH_PYTHON(2.3)
179 CHECK_SWIG
180
181 echo
182 echo ---------------------------------------------
183 echo testing HDF5
184 echo ---------------------------------------------
185 echo
186
187 CHECK_HDF5
188
189 echo
190 echo ---------------------------------------------
191 echo Testing OpenCascade
192 echo ---------------------------------------------
193 echo
194
195 CHECK_CAS
196
197 # ----------------------------------------------------------------------------
198 # --- test corba
199
200 if test x$corba_gen = xtrue; then
201
202 echo
203 echo ============================================================
204 echo testing mandatory products for CORBA configurations
205 echo ============================================================
206 echo
207
208 dnl
209 dnl ---------------------------------------------
210 dnl testing sockets
211 dnl ---------------------------------------------
212 dnl
213
214 CHECK_SOCKETS
215
216 echo
217 echo ---------------------------------------------
218 echo Configuration of the ORB
219 echo ---------------------------------------------
220 echo
221
222 echo Testing OMNIORB ...
223 CHECK_OMNIORB
224
225 echo Selecting the default ORB
226 DEFAULT_ORB=omniORB
227 echo DEFAULT_ORB : $DEFAULT_ORB
228 CHECK_CORBA
229
230 CORBA=salome_adm/unix/make_$ORB
231 AC_SUBST_FILE(CORBA)
232
233 # _CS_gbo:
234 # The CORBA variable defines the file name that
235 # implements the building rules to be included by Makefile to process
236 # idl files and CORBA specific dependencies (ex: the file
237 # salome_adm/unix/make_omniorb is the default for SALOME). The value
238 # of ORB is defined by CHECK_CORBA.
239
240 # Note that this checking process is no longer relevant for SALOME
241 # because the possibility of changing the ORB as a plugin is probably
242 # deprecated. The software configuration is clearly omniorb for CORBA
243 # communication. This could be simplify in a near futur.
244
245 echo
246 echo ---------------------------------------------
247 echo Testing QT
248 echo ---------------------------------------------
249 echo
250 # Qt must be kept because kernel makes use of qxml and some other
251 # non-graphical stuff.
252 CHECK_QT
253
254 echo
255 echo ---------------------------------------------
256 echo BOOST Library
257 echo ---------------------------------------------
258 echo
259
260 CHECK_BOOST
261
262 fi 
263 # --- end test corba
264 # ----------------------------------------------------------------------------
265
266 echo
267 echo ============================================================
268 echo testing optionnal products
269 echo ============================================================
270 echo
271
272 echo
273 echo ---------------------------------------------
274 echo checking if MPI is requested by user
275 echo ---------------------------------------------
276 echo
277
278 CHECK_MPI
279
280 echo
281 echo ---------------------------------------------
282 echo Testing Batch
283 echo ---------------------------------------------
284 echo
285
286 dnl Several batch systems (OpenPBS, LSF, ...) can be operated using
287 dnl the Batch classes library integrated in the KERNEL module. The
288 dnl checking process tests here the presence of underlying batch
289 dnl softwares. If none is detected, the KERNEL is declared to be
290 dnl "without batch". 
291
292 echo testing OpenPBS
293 echo ---------------
294 openpbs_ok=no
295 CHECK_OPENPBS
296 dnl openpbs_ok is set to yes by CHECK_OPENPBS
297
298 echo testing LSF
299 echo -----------
300 lsf_ok=no
301 CHECK_LSF
302 dnl lsf_ok is set to yes by CHECK_LSF
303 echo lsf = $lsf_ok
304
305 echo testing Local batch system
306 echo --------------------------
307 localbatch_ok=no
308 CHECK_LOCAL
309 dnl localbatch_ok is set to yes by CHECK_LOCAL
310
311 WITH_BATCH=no
312 test x$openpbs_ok = xyes || test x$lsf_ok = xyes || test x$localbatch_ok = xyes && WITH_BATCH=yes
313
314 AC_ARG_ENABLE(batch,
315   [AC_HELP_STRING([--enable-batch],[Batch [default=yes]])],
316   [case "${enableval}" in
317      yes) test x$openpbs_ok = xyes || test x$lsf_ok = xyes || test x$localbatch_ok = xyes && WITH_BATCH=yes;;
318      no)  WITH_BATCH=no ;;
319      *) AC_MSG_ERROR(bad value ${enableval} for --enable-batch) ;;
320   esac],[test x$openpbs_ok = xyes || test x$lsf_ok = xyes || test x$localbatch_ok = xyes && WITH_BATCH=yes])
321
322 echo Batch mode = $WITH_BATCH
323
324 AC_SUBST(WITH_BATCH)
325 AM_CONDITIONAL(WITH_BATCH, [test x"$WITH_BATCH" = xyes])
326
327 echo
328 echo ----------------------------------------------
329 echo testing CPPUNIT only required for unit testing
330 echo ----------------------------------------------
331 echo
332 CHECK_CPPUNIT
333
334 echo
335 echo ============================================================
336 echo testing products required only for documentation generation
337 echo ============================================================
338 echo
339
340 echo
341 echo ---------------------------------------------
342 echo Testing html generators
343 echo ---------------------------------------------
344 echo
345
346 CHECK_HTML_GENERATORS
347
348 echo
349 echo ============================================================
350 echo Summary
351 echo ============================================================
352 echo
353
354 # This function displays the values of each variable given in arguments 
355 function summary {
356   variables=$*
357   for var in $variables
358   do
359     eval toto=\$$var
360     if test x$toto != "x"; then
361       printf "   %10s : " `echo \$var | sed -e "s,_ok,,"`
362       eval echo \$$var
363     fi
364   done
365 }
366
367 # --------------------------------------
368
369 function check_fatal_error {
370   variables=$*
371   for var in $variables
372   do
373     eval toto=\$$var
374     if test x$toto != "xyes"; then
375         echo "FATAL ERROR: some mandatory products are missing."
376         echo "Installing the missing products is required before running the configure script".
377         exit 1
378     fi
379   done  
380 }
381
382 # --------------------------------------
383
384 if test x$corba_gen = xtrue; then
385   basic_mandatory_products="cc_ok threads_ok python_ok swig_ok hdf5_ok occ_ok"
386 else
387   basic_mandatory_products="cc_ok threads_ok hdf5_ok occ_ok"
388 fi
389
390 echo --- General mandatory products - Light configuration:
391 summary $basic_mandatory_products
392 check_fatal_error $basic_mandatory_products
393 echo
394
395 corba_mandatory_products="omniORB_ok qt_ok boost_ok"
396 if test x$corba_gen = xtrue; then
397   echo --- CORBA mandatory products - default configuration:
398   summary $corba_mandatory_products
399   check_fatal_error $corba_mandatory_products
400 else
401   echo --- CORBA products not required - option --disable-corba-gen
402   if test x"$WITH_BATCH" = xyes; then
403     echo --- BATCH mode mandatory products - default configuration:
404     summary "python_ok"
405     check_fatal_error "python_ok"
406   else 
407     echo --- Python not required - option --enable-batch=no
408   fi
409 fi
410 echo
411
412 if test x$MPIREQUESTED = xyes; then
413   requested_products="mpi_ok"
414   echo --- products requested by user
415   summary $requested_products
416   check_fatal_error $requested_products
417   echo
418 fi
419
420 optional_products="cppunit_ok openpbs_ok lsf_ok"
421 echo --- Optional products:
422 echo ["    These products are optional because the KERNEL functions"]
423 echo ["    using them are built only if the products are detected."]
424 summary $optional_products
425 echo
426
427 htmldoc_products="doxygen_ok graphviz_ok rst2html_ok"
428
429 echo --- Html documentation products: only required for doc production
430 summary $htmldoc_products
431 echo
432
433 echo
434 echo "Default ORB   : $DEFAULT_ORB"
435 echo
436
437 dnl generals files which could be included in every makefile
438
439 AC_SUBST_FILE(COMMENCE) COMMENCE=salome_adm/unix/make_commence
440 AC_SUBST_FILE(CONCLUDE) CONCLUDE=salome_adm/unix/make_conclude
441 AC_SUBST_FILE(MODULE) MODULE=salome_adm/unix/make_module
442
443 dnl les dependences
444 AC_SUBST_FILE(DEPEND) DEPEND=salome_adm/unix/depend
445
446 dnl We don t need to say when we re entering directories if we re using
447 dnl GNU make becuase make does it for us.
448 if test "X$GMAKE" = "Xyes"; then
449    AC_SUBST(SETX) SETX=":"
450 else
451    AC_SUBST(SETX) SETX="set -x"
452 fi
453
454 echo 
455 echo ---------------------------------------------
456 echo copying resource files, shell scripts, and 
457 echo xml files
458 echo ---------------------------------------------
459 echo
460
461
462 mkdir -p bin/salome
463 cd bin/salome
464 for i in  `find $ROOT_SRCDIR/bin`
465 do
466   local_bin=`echo $i | sed -e "s,$ROOT_SRCDIR/bin,.,"`
467   case "$local_bin" in
468         *.in | *~) ;;
469         . | */CVS | */CVS/* | ./salome) ;;
470         ./appliskel |./appliskel/env.d) $INSTALL -d $local_bin ; echo $local_bin ;;
471         *) $INSTALL $i $local_bin; echo $local_bin ;;
472   esac
473 done
474 cd $ROOT_BUILDDIR
475
476 echo
477 echo ---------------------------------------------
478 echo generating Makefiles and configure files
479 echo ---------------------------------------------
480 echo
481
482 AC_OUTPUT_COMMANDS([ \
483         chmod +x ./bin/*; \
484         chmod +x ./bin/salome/* \
485 ])
486
487 # This list is initiated using autoscan and must be updated manually
488 # when adding a new file <filename>.in to manage. When you execute
489 # autoscan, the Makefile list is generated in the output file configure.scan.
490 # This could be helpfull to update de configuration.
491 AC_OUTPUT([ \
492         ./KERNEL_version.h \
493         ./salome_adm/unix/SALOMEconfig.ref \
494         ./salome_adm/Makefile \
495         ./salome_adm/unix/Makefile \
496         ./salome_adm/unix/config_files/Makefile \
497         ./Makefile \
498         ./bin/Makefile \
499         ./bin/VERSION \
500         ./bin/runIDLparser \
501         ./doc/Makefile \
502         ./doc/salome/Makefile \
503         ./doc/salome/tui/Makefile \
504         ./doc/salome/tui/INPUT/doxyuser:./doc/salome/tui/KERNEL/doxyuser.in \
505         ./doc/salome/tui/INPUT/doxydev:./doc/salome/tui/KERNEL/doxydev.in \
506         ./doc/salome/tui/INPUT/sources/static/tree.js:./doc/salome/tui/KERNEL/sources/static/tree.js.in \
507         ./idl/Makefile \
508         ./resources/Makefile \
509         ./resources/KERNELCatalog.xml \
510         ./resources/CatalogResources.xml \
511         ./resources/DEPRECATED/Plugin \
512         ./src/Makefile \
513         ./src/Basics/Makefile \
514         ./src/Basics/Test/Makefile \
515         ./src/Batch/Makefile \
516         ./src/Batch_SWIG/Makefile \
517         ./src/CASCatch/Makefile \
518         ./src/Communication/Makefile \
519         ./src/Communication_SWIG/Makefile \
520         ./src/Container/Makefile \
521         ./src/GenericObj/Makefile \
522         ./src/HDFPersist/Makefile \
523         ./src/KERNEL_PY/Makefile \
524         ./src/LifeCycleCORBA/Makefile \
525         ./src/LifeCycleCORBA/Test/Makefile \
526         ./src/LifeCycleCORBA_SWIG/Makefile \
527         ./src/LifeCycleCORBA_SWIG/Test/Makefile \
528         ./src/Logger/Makefile \
529         ./src/Logger/Test/Makefile \
530         ./src/ModuleCatalog/Makefile \
531         ./src/ModuleGenerator/Makefile \
532         ./src/ModuleGenerator/testIDLparser \
533         ./src/MPIContainer/Makefile \
534         ./src/NamingService/Makefile \
535         ./src/NamingService/Test/Makefile \
536         ./src/Notification/Makefile \
537         ./src/NOTIFICATION_SWIG/Makefile \
538         ./src/Registry/Makefile \
539         ./src/ResourcesManager/Makefile \
540         ./src/SALOMEDS/Makefile \
541         ./src/SALOMEDS/Test/Makefile \
542         ./src/SALOMEDSClient/Makefile \
543         ./src/SALOMEDSImpl/Makefile \
544         ./src/SALOMEDSImpl/Test/Makefile \
545         ./src/SALOMELocalTrace/Makefile \
546         ./src/SALOMELocalTrace/Test/Makefile \
547         ./src/SALOMETraceCollector/Makefile \
548         ./src/SALOMETraceCollector/Test/Makefile \
549         ./src/TestContainer/Makefile \
550         ./src/TestMPIContainer/Makefile \
551         ./src/TOOLSDS/Makefile \
552         ./src/UnitTests/Makefile \
553         ./src/Utils/Makefile \
554         ./src/Utils/Test/Makefile \
555 ])
556