Salome HOME
unlink needs this include
[modules/kernel.git] / configure.ac
1 # Copyright (C) 2007-2012  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], [7.0.0], [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 VERSION_DEV=1
41 AC_SUBST(VERSION_DEV)
42
43 # set up MODULE_NAME variable for dynamic construction of directories (resources, etc.)
44 MODULE_NAME=kernel
45 AC_SUBST(MODULE_NAME)
46
47 echo
48 echo ---------------------------------------------
49 echo Initialize source and build root directories
50 echo ---------------------------------------------
51 echo
52
53 #
54 # This function return on stdout the absolute path of the filename in
55 # argument. Exemple:
56 # $ filename="../KERNEL_SRC/configure
57 # $ absfilename=`absolute_path $filename`
58 function absolute_path {
59     filename=$1
60     here=`pwd`
61     apath=`dirname $filename`
62     cd $apath
63     apath=`pwd`
64     cd $here
65     echo $apath
66 }
67
68 # Build directory, where the configure script is executed.
69 ROOT_BUILDDIR=`pwd`
70 # Source directory, where the configure script is located.
71 ROOT_SRCDIR=`absolute_path $0`
72
73 AC_SUBST(ROOT_SRCDIR)
74 AC_SUBST(ROOT_BUILDDIR)
75
76 echo
77 echo Source root directory : $ROOT_SRCDIR
78 echo Build  root directory : $ROOT_BUILDDIR
79
80 # ----------------------------------------------------------------------------
81 # --- test options
82
83 AC_ARG_ENABLE(corba_gen,
84   [AC_HELP_STRING([--enable-corba-gen],[Generate CORBA stuff [default=yes]])],
85   [case "${enableval}" in
86      yes) corba_gen=true ;;
87      no)  corba_gen=false ;;
88      *) AC_MSG_ERROR(bad value ${enableval} for --enable-corba-gen) ;;
89   esac],[corba_gen=true])
90 AM_CONDITIONAL(CORBA_GEN, test x$corba_gen = xtrue)
91
92 # ---- option to build only launcher and resources manager
93 AC_ARG_WITH(onlylauncher,
94         [AC_HELP_STRING([--with-onlylauncher],[Build only launcher and resources manager [default=no]])],
95         [],
96         [with_onlylauncher="no"])
97 AM_CONDITIONAL(WITHONLYLAUNCHER, test x$with_onlylauncher = xyes)
98 if test "$with_onlylauncher" != "yes"; then
99   AC_DEFINE([HAVE_SALOME_CONFIG], [], [True if SALOMEconfig.h file is used])
100 fi
101
102 # ----------------------------------------------------------------------------
103
104 echo
105 echo
106 echo ============================================================
107 echo testing general mandatory products - for all configurations
108 echo ============================================================
109 echo
110
111 dnl Modification B. Secher portage sur osf
112 AC_CHECK_PROG(SHELL,sh)
113 AC_SUBST(SHELL)
114
115 if test -z "$AR"; then
116    AC_CHECK_PROGS(AR,ar xar,:,$PATH)
117 fi
118 AC_SUBST(AR)
119
120 echo
121 echo ---------------------------------------------
122 echo testing make
123 echo ---------------------------------------------
124 echo
125 AC_PROG_MAKE_SET
126 AC_PROG_INSTALL
127 AC_LOCAL_INSTALL
128
129 echo
130 echo ---------------------------------------------
131 echo Configuring production
132 echo ---------------------------------------------
133 echo
134 # production.m4
135 AC_ENABLE_DEBUG(no)
136 AC_ENABLE_PRODUCTION(no)
137 AC_ENABLE_MPI_SEQ_CONTAINER(no)
138
139 # _GBO_SALOME_PYTHON_PACKAGING_
140 if test "X$enable_debug" = "Xyes"; then
141   PYLOGLEVEL=DEBUG
142 else
143   PYLOGLEVEL=WARNING
144 fi
145 AC_SUBST(PYLOGLEVEL)
146
147 echo
148 echo ---------------------------------------------
149 echo testing libtool
150 echo ---------------------------------------------
151 echo
152
153 dnl first, we set static to no!
154 dnl if we want it, use --enable-static
155 AC_ENABLE_STATIC(no)
156 AC_LIBTOOL_DLOPEN
157 AC_PROG_LIBTOOL
158
159 echo
160 echo ---------------------------------------------
161 echo testing C/C++
162 echo ---------------------------------------------
163 echo
164
165 cc_ok=no
166 AC_PROG_CC
167 AC_PROG_CXX
168 AC_LANG(C++)
169 AC_CXX_WARNINGS
170 AC_CXX_TEMPLATE_OPTIONS
171 AC_DEPEND_FLAG
172 # AC_CC_WARNINGS([ansi])
173 cc_ok=yes
174
175 dnl Library libdl :
176 AC_CHECK_LIB(dl,dlopen)
177
178 dnl Library librt : for alpha/osf
179 AC_CHECK_LIB(rt,nanosleep)
180
181 dnl add library libm :
182 AC_CHECK_LIB(m,ceil)
183
184 AC_CXX_USE_STD_IOSTREAM
185
186 AC_CXX_HAVE_SSTREAM
187
188 # Testing linker
189 AC_LINKER_OPTIONS
190
191 echo
192 echo ---------------------------------------------
193 echo testing Fortran INTEGER size for CALCIUM 
194 echo ---------------------------------------------
195 echo
196
197 CHECK_CALCIUM
198
199 echo
200 echo ---------------------------------------------
201 echo testing threads
202 echo ---------------------------------------------
203 echo
204
205 ENABLE_PTHREADS
206
207 echo
208 echo ---------------------------------------------
209 echo testing python
210 echo ---------------------------------------------
211 echo
212
213 CHECK_PYTHON
214
215 echo
216 echo ---------------------------------------------
217 echo testing swig
218 echo ---------------------------------------------
219 echo
220
221 # _GBO_ This definition is required. Without this definition, the pythondir
222 # would not be defined. The version doesn't matter.
223 AM_PATH_PYTHON(2.4)
224 CHECK_SWIG
225
226 echo
227 echo ---------------------------------------------
228 echo Testing libxml2
229 echo ---------------------------------------------
230 echo
231
232 CHECK_LIBXML
233
234 echo
235 echo ---------------------------------------------
236 echo checking if MPI is requested by user
237 echo ---------------------------------------------
238 echo
239
240 CHECK_MPI
241
242 if test x$with_onlylauncher = xno; then
243 echo
244 echo ---------------------------------------------
245 echo testing HDF5
246 echo ---------------------------------------------
247 echo
248
249 CHECK_HDF5
250
251 # ----------------------------------------------------------------------------
252 # --- test corba
253
254 if test x$corba_gen = xtrue; then
255
256 echo
257 echo ============================================================
258 echo testing mandatory products for CORBA configurations
259 echo ============================================================
260 echo
261
262 dnl
263 dnl ---------------------------------------------
264 dnl testing sockets
265 dnl ---------------------------------------------
266 dnl
267
268 CHECK_SOCKETS
269
270 echo
271 echo ---------------------------------------------
272 echo Configuration of the ORB
273 echo ---------------------------------------------
274 echo
275
276 echo Testing OMNIORB ...
277 CHECK_OMNIORB
278
279 echo Selecting the default ORB
280 DEFAULT_ORB=omniORB
281 echo DEFAULT_ORB : $DEFAULT_ORB
282 CHECK_CORBA
283
284 CORBA=salome_adm/unix/make_$ORB
285 AC_SUBST_FILE(CORBA)
286
287 # _CS_gbo:
288 # The CORBA variable defines the file name that
289 # implements the building rules to be included by Makefile to process
290 # idl files and CORBA specific dependencies (ex: the file
291 # salome_adm/unix/make_omniorb is the default for SALOME). The value
292 # of ORB is defined by CHECK_CORBA.
293
294 # Note that this checking process is no longer relevant for SALOME
295 # because the possibility of changing the ORB as a plugin is probably
296 # deprecated. The software configuration is clearly omniorb for CORBA
297 # communication. This could be simplify in a near futur.
298
299 echo
300 echo ---------------------------------------------
301 echo BOOST Library
302 echo ---------------------------------------------
303 echo
304
305 CHECK_BOOST
306
307 fi 
308 # --- end test corba
309 # ----------------------------------------------------------------------------
310
311 fi 
312 # --- end test ONLYLAUNCHER
313 # ----------------------------------------------------------------------------
314
315 echo
316 echo ============================================================
317 echo testing parallel products
318 echo ============================================================
319 echo
320
321 echo
322 echo ---------------------------------------------
323 echo checking if PaCO++ is requested by user
324 echo ---------------------------------------------
325 echo
326
327 CHECK_PACO
328
329 echo
330 echo ------------------------------------------------------------
331 echo checking if parallel kernel extensions are requested by user
332 echo ------------------------------------------------------------
333 echo
334
335 AC_MSG_CHECKING(whether to enable parallel kernel extension)
336 AC_ARG_ENABLE(parallel_extension, 
337               AC_HELP_STRING([--enable-parallel_extension], [parallel kernel extension = [no/yes] (default is no)]),
338               parallel_extension_ok=$enableval,                
339               parallel_extension_ok=no)
340 if test "x$parallel_extension_ok" = "xyes"
341 then
342   if test "x$PaCO_ok" = "xno"
343   then
344     parallel_extension_ok=no
345   fi
346 fi
347
348 if test "x$parallel_extension_ok" = "xyes"
349 then
350   AC_MSG_RESULT([yes])
351 else
352   AC_MSG_RESULT([no])
353 fi
354
355 AM_CONDITIONAL([WITH_PACO_PARALLEL], [test "x$parallel_extension_ok" = "xyes"])
356
357 echo
358 echo ============================================================
359 echo testing optionnal products
360 echo ============================================================
361 echo
362
363 echo
364 echo ----------------------------------------------
365 echo testing CPPUNIT only required for unit testing
366 echo ----------------------------------------------
367 echo
368 CHECK_CPPUNIT
369
370 echo
371 echo --------------------------------------------------------------
372 echo Testing libBatch only required for batch functions in Launcher
373 echo --------------------------------------------------------------
374 echo
375
376 CHECK_LIBBATCH
377 AM_CONDITIONAL(WITH_LIBBATCH, [test x"$libbatch_ok" = xyes])
378
379 echo
380 echo ============================================================
381 echo testing products required only for documentation generation
382 echo ============================================================
383 echo
384
385 echo
386 echo ---------------------------------------------
387 echo Testing html generators
388 echo ---------------------------------------------
389 echo
390
391 CHECK_HTML_GENERATORS
392
393 # Additional conditional to avoid compilation of non-portable code
394 AM_CONDITIONAL(WINDOWS, [ test ])
395
396 echo
397 echo ---------------------------------------------
398 echo testing sphinx
399 echo ---------------------------------------------
400 echo
401 CHECK_SPHINX
402
403 echo
404 echo ---------------------------------------------
405 echo testing SimanIO
406 echo ---------------------------------------------
407 echo
408
409 CHECK_SIMANIO
410
411 # Additional conditional to avoid compilation errors
412 AM_CONDITIONAL(WITH_SIMANIO, [test x"$simanio_ok" = xyes])
413
414 echo
415 echo ============================================================
416 echo Summary
417 echo ============================================================
418 echo
419
420 # This function displays the values of each variable given in arguments 
421 function summary {
422   variables=$*
423   for var in $variables
424   do
425     eval toto=\$$var
426     if test x$toto != "x"; then
427       printf "   %10s : " `echo \$var | sed -e "s,_ok,,"`
428       eval echo \$$var
429     fi
430   done
431 }
432
433 # --------------------------------------
434
435 function check_fatal_error {
436   variables=$*
437   for var in $variables
438   do
439     eval toto=\$$var
440     if test x$toto != "xyes"; then
441         echo "FATAL ERROR: some mandatory products are missing."
442         echo "Installing the missing products is required before running the configure script".
443         exit 1
444     fi
445   done  
446 }
447
448 # --------------------------------------
449
450 if test x$with_onlylauncher = xno; then
451   if test x$corba_gen = xtrue; then
452     basic_mandatory_products="cc_ok threads_ok python_ok swig_ok hdf5_ok libxml_ok"
453   else
454     basic_mandatory_products="cc_ok threads_ok hdf5_ok libxml_ok"
455   fi
456 else
457   basic_mandatory_products="cc_ok threads_ok libxml_ok"
458 fi
459
460 echo --- General mandatory products - Light configuration:
461 summary $basic_mandatory_products
462 check_fatal_error $basic_mandatory_products
463 echo
464
465 if test x$with_onlylauncher = xno; then
466   corba_mandatory_products="omniORB_ok omniORBpy_ok boost_ok"
467   if test x$corba_gen = xtrue; then
468     echo --- CORBA mandatory products - default configuration:
469     summary $corba_mandatory_products
470     check_fatal_error $corba_mandatory_products
471   else
472     echo --- CORBA products not required - option --disable-corba-gen
473   fi
474 fi
475 echo
476
477 parallel_products="mpi_ok PaCO_ok parallel_extension_ok"
478 echo --- Kernel parallel extensions:
479 summary $parallel_products
480 echo
481
482 optional_products="cppunit_ok numpy_ok libbatch_ok simanio_ok"
483 echo --- Optional products:
484 echo ["    These products are optional because the KERNEL functions"]
485 echo ["    using them are built only if the products are detected."]
486 summary $optional_products
487 echo
488 if test x$libbatch_ok = xno; then
489   echo ["    Warning: Batch functions will not be available in"]
490   echo ["    Salome Launcher because they require libBatch."]
491   echo
492 fi
493
494 htmldoc_products="doxygen_ok graphviz_ok rst2html_ok sphinx_ok"
495
496 echo --- Html documentation products: only required for doc production
497 summary $htmldoc_products
498 echo
499
500 if test x$with_onlylauncher = xno; then
501 echo
502 echo "Default ORB   : $DEFAULT_ORB"
503 echo
504 fi
505
506 dnl generals files which could be included in every makefile
507
508 AC_SUBST_FILE(COMMENCE) COMMENCE=salome_adm/unix/make_commence
509 AC_SUBST_FILE(CONCLUDE) CONCLUDE=salome_adm/unix/make_conclude
510 AC_SUBST_FILE(MODULE) MODULE=salome_adm/unix/make_module
511
512 dnl les dependences
513 AC_SUBST_FILE(DEPEND) DEPEND=salome_adm/unix/depend
514
515 dnl We don t need to say when we re entering directories if we re using
516 dnl GNU make becuase make does it for us.
517 if test "X$GMAKE" = "Xyes"; then
518    AC_SUBST(SETX) SETX=":"
519 else
520    AC_SUBST(SETX) SETX="set -x"
521 fi
522
523 echo
524 echo ---------------------------------------------
525 echo generating Makefiles and configure files
526 echo ---------------------------------------------
527 echo
528
529 AC_HACK_LIBTOOL
530 AC_CONFIG_COMMANDS([hack_libtool],[
531 sed -i "s%^CC=\"\(.*\)\"%hack_libtool (){ \n\
532   $(pwd)/hack_libtool \1 \"\$[@]\" \n\
533 }\n\
534 CC=\"hack_libtool\"%g" libtool
535 sed -i "s%\(\s*\)for searchdir in \$newlib_search_path \$lib_search_path \$sys_lib_search_path \$shlib_search_path; do%\1searchdirs=\"\$newlib_search_path \$lib_search_path \$sys_lib_search_path \$shlib_search_path\"\n\1for searchdir in \$searchdirs; do%g" libtool
536 sed -i "s%\(\s*\)searchdirs=\"\$newlib_search_path \$lib_search_path \(.*\)\"%\1searchdirs=\"\$newlib_search_path \$lib_search_path\"\n\1sss_beg=\"\"\n\1sss_end=\"\2\"%g" libtool
537 sed -i "s%\(\s*\)\(for searchdir in \$searchdirs; do\)%\1for sss in \$searchdirs; do\n\1  if ! test -d \$sss; then continue; fi\n\1  ssss=\$(cd \$sss; pwd)\n\1  if test \"\$ssss\" != \"\" \&\& test -d \$ssss; then\n\1    case \$ssss in\n\1      /usr/lib | /usr/lib64 ) ;;\n\1      * ) sss_beg=\"\$sss_beg \$ssss\" ;;\n\1    esac\n\1  fi\n\1done\n\1searchdirs=\"\$sss_beg \$sss_end\"\n\1\2%g" libtool
538 ],[])
539
540 # This list is initiated using autoscan and must be updated manually
541 # when adding a new file <filename>.in to manage. When you execute
542 # autoscan, the Makefile list is generated in the output file configure.scan.
543 # This could be helpfull to update de configuration.
544 AC_OUTPUT([ \
545   KERNEL_version.h \
546   salome_adm/SALOMEconfig.ref \
547   salome_adm/Makefile \
548   salome_adm/cmake_files/Makefile \
549   salome_adm/unix/Makefile \
550   salome_adm/unix/config_files/Makefile \
551   Makefile \
552   bin/Makefile \
553   bin/appliskel/Makefile \
554   bin/VERSION \
555   doc/Makefile \
556   doc/docutils/conf.py \
557   doc/salome/Makefile \
558   doc/salome/tui/Makefile \
559   doc/salome/tui/doxyfile \
560   doc/salome/tui/static/header.html \
561   doc/salome/gui/Makefile \
562   doc/salome/gui/doxyfile \
563   doc/salome/gui/static/header.html \
564   doc/docutils/Makefile \
565   idl/Makefile \
566   idl/Calcium_Ports.idl \
567   resources/Makefile \
568   resources/KERNELCatalog.xml \
569   resources/CatalogResources.xml \
570   src/Makefile \
571   src/Basics/Makefile \
572   src/Basics/Test/Makefile \
573   src/Communication/Makefile \
574   src/Communication_SWIG/Makefile \
575   src/Container/Makefile \
576   src/ParallelContainer/Makefile \
577   src/DF/Makefile \
578   src/DSC/Makefile \
579   src/DSC/DSC_Basic/Makefile \
580   src/DSC/DSC_User/Makefile \
581   src/DSC/DSC_User/Basic/Makefile \
582   src/DSC/DSC_User/Datastream/Makefile \
583   src/DSC/DSC_User/Datastream/Palm/Makefile \
584   src/DSC/DSC_User/Datastream/Calcium/Makefile \
585   src/DSC/DSC_User/Datastream/Calcium/calcium_integer_port_uses.hxx \
586   src/DSC/DSC_User/Datastream/Calcium/CalciumProvidesPort.hxx \
587   src/DSC/DSC_User/Datastream/Calcium/CalciumFortranInt.h \
588   src/DSC/ParallelDSC/Makefile \
589   src/DSC/DSC_Python/Makefile \
590   src/GenericObj/Makefile \
591   src/HDFPersist/Makefile \
592   src/KERNEL_PY/Makefile \
593   src/KERNEL_PY/kernel/Makefile \
594   src/KERNEL_PY/kernel/kernelpy_autotest.sh \
595   src/KERNEL_PY/kernel/logconfig.py \
596   src/KERNEL_PY/kernel/parametric/Makefile \
597   src/Launcher/Makefile \
598   src/LifeCycleCORBA/Makefile \
599   src/LifeCycleCORBA/Test/Makefile \
600   src/LifeCycleCORBA_SWIG/Makefile \
601   src/LifeCycleCORBA_SWIG/Test/Makefile \
602   src/Logger/Makefile \
603   src/Logger/Test/Makefile \
604   src/ModuleCatalog/Makefile \
605   src/ModuleGenerator/Makefile \
606   src/ModuleGenerator/testIDLparser \
607   src/MPIContainer/Makefile \
608   src/NamingService/Makefile \
609   src/NamingService/Test/Makefile \
610   src/Notification/Makefile \
611   src/NOTIFICATION_SWIG/Makefile \
612   src/Registry/Makefile \
613   src/ResourcesManager/Makefile \
614   src/SALOMEDS/Makefile \
615   src/SALOMEDS/Test/Makefile \
616   src/SALOMEDSClient/Makefile \
617   src/SALOMEDSImpl/Makefile \
618   src/SALOMEDSImpl/Test/Makefile \
619   src/SALOMELocalTrace/Makefile \
620   src/SALOMELocalTrace/Test/Makefile \
621   src/SALOMETraceCollector/Makefile \
622   src/SALOMETraceCollector/Test/Makefile \
623   src/TestContainer/Makefile \
624   src/TestMPIContainer/Makefile \
625   src/TOOLSDS/Makefile \
626   src/UnitTests/Makefile \
627   src/Utils/Makefile \
628   src/Utils/Test/Makefile \
629   src/KernelHelpers/Makefile \
630   src/KernelHelpers/Test/Makefile \
631 ])