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