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