Salome HOME
Merge from V6_main 01/04/2013
[plugins/hexoticplugin.git] / configure.ac
1 #!/bin/bash
2 # Copyright (C) 2007-2013  CEA/DEN, EDF R&D
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20
21 # ---
22 # File   : configure.ac
23 # Author : Vadim SANDLER, Open CASCADE S.A.S (vadim.sandler@opencascade.com)
24 # ---
25 #
26 AC_INIT([Salome2 Project HexoticPLUGIN module], [6.6.0], [webmaster.salome@opencascade.com], [SalomeHexoticPLUGIN])
27 AC_CONFIG_AUX_DIR(adm_local/unix/config_files)
28 AC_CANONICAL_HOST
29 AC_CANONICAL_TARGET
30 AM_INIT_AUTOMAKE([-Wno-portability])
31
32 XVERSION=`echo $VERSION | awk -F. '{printf("0x%02x%02x%02x",$1,$2,$3)}'`
33 AC_SUBST(XVERSION)
34 VERSION_DEV=1
35 AC_SUBST(VERSION_DEV)
36
37 # set up MODULE_NAME variable for dynamic construction of directories (resources, etc.)
38 MODULE_NAME=hexoticplugin
39 AC_SUBST(MODULE_NAME)
40
41 dnl
42 dnl Initialize source and build root directories
43 dnl
44
45 ROOT_BUILDDIR=`pwd`
46 ROOT_SRCDIR=`echo $0 | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
47 cd $ROOT_SRCDIR
48 ROOT_SRCDIR=`pwd`
49 cd $ROOT_BUILDDIR
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 echo
58 echo
59
60 if test -z "$AR"; then
61    AC_CHECK_PROGS(AR,ar xar,:,$PATH)
62 fi
63 AC_SUBST(AR)
64
65 dnl Export the AR macro so that it will be placed in the libtool file
66 dnl correctly.
67 export AR
68
69 echo
70 echo ---------------------------------------------
71 echo testing make
72 echo ---------------------------------------------
73 echo
74
75 AC_PROG_MAKE_SET
76 AC_PROG_INSTALL
77 dnl 
78 dnl libtool macro check for CC, LD, NM, LN_S, RANLIB, STRIP + pour les librairies dynamiques !
79
80 AC_ENABLE_DEBUG(yes)
81 AC_DISABLE_PRODUCTION
82
83 echo ---------------------------------------------
84 echo testing libtool
85 echo ---------------------------------------------
86
87 dnl first, we set static to no!
88 dnl if we want it, use --enable-static
89 AC_ENABLE_STATIC(no)
90
91 AC_LIBTOOL_DLOPEN
92 AC_PROG_LIBTOOL
93
94 dnl Fix up the INSTALL macro if it s a relative path. We want the
95 dnl full-path to the binary instead.
96 case "$INSTALL" in
97    *install-sh*)
98       INSTALL='\${KERNEL_ROOT_DIR}'/adm_local/unix/config_files/install-sh
99       ;;
100 esac
101
102 echo
103 echo ---------------------------------------------
104 echo testing C/C++
105 echo ---------------------------------------------
106 echo
107
108 cc_ok=no
109 dnl inutil car libtool
110 dnl AC_PROG_CC
111 AC_PROG_CXX
112 AC_DEPEND_FLAG
113 # AC_CC_WARNINGS([ansi])
114 cc_ok=yes
115
116 echo
117 echo ---------------------------------------------
118 echo testing Fortran
119 echo ---------------------------------------------
120 echo
121
122 fortran_ok=no
123 AC_PROG_F77
124 AC_F77_LIBRARY_LDFLAGS
125 AC_PROG_FC
126 AC_FC_LIBRARY_LDFLAGS
127 if test "X$FC" != "X" ; then
128    fortran_ok=yes
129 fi
130
131 dnl Library libdl :
132 AC_CHECK_LIB(dl,dlopen)
133
134 dnl add library libm :
135 AC_CHECK_LIB(m,ceil)
136
137 dnl 
138 dnl Well we use sstream which is not in gcc pre-2.95.3
139 dnl We must test if it exists. If not, add it in include !
140 dnl
141
142 AC_CXX_HAVE_SSTREAM
143
144 echo
145 echo ---------------------------------------------
146 echo BOOST Library
147 echo ---------------------------------------------
148 echo
149
150 CHECK_BOOST
151
152 dnl
153 dnl ---------------------------------------------
154 dnl testing MPICH
155 dnl ---------------------------------------------
156 dnl
157
158 dnl CHECK_MPICH
159
160 echo
161 echo ---------------------------------------------
162 echo testing MPI
163 echo ---------------------------------------------
164 echo
165
166 CHECK_MPI
167
168 echo
169 echo ---------------------------------------------
170 echo testing LEX \& YACC
171 echo ---------------------------------------------
172 echo
173
174 lex_yacc_ok=no
175 AC_PROG_YACC
176 AC_PROG_LEX
177 lex_yacc_ok=yes
178
179 echo
180 echo ---------------------------------------------
181 echo testing python
182 echo ---------------------------------------------
183 echo
184
185 CHECK_PYTHON
186
187 AM_PATH_PYTHON(2.3)
188
189 dnl echo
190 dnl echo ---------------------------------------------
191 dnl echo testing java
192 dnl echo ---------------------------------------------
193 dnl echo
194
195 dnl CHECK_JAVA
196
197 echo
198 echo ---------------------------------------------
199 echo testing swig
200 echo ---------------------------------------------
201 echo
202
203 CHECK_SWIG
204
205 echo
206 echo ---------------------------------------------
207 echo testing threads
208 echo ---------------------------------------------
209 echo
210
211 ENABLE_PTHREADS
212
213 echo
214 echo ---------------------------------------------
215 echo testing omniORB
216 echo ---------------------------------------------
217 echo
218
219 CHECK_OMNIORB
220
221 dnl echo
222 dnl echo ---------------------------------------------
223 dnl echo testing mico
224 dnl echo ---------------------------------------------
225 dnl echo
226
227 dnl CHECK_MICO
228
229 echo
230 echo ---------------------------------------------
231 echo default ORB : omniORB
232 echo ---------------------------------------------
233 echo
234
235 DEFAULT_ORB=omniORB
236 CHECK_CORBA
237
238 AC_SUBST_FILE(CORBA)
239 corba=make_$ORB
240 CORBA=adm_local/unix/$corba
241
242 echo
243 echo ---------------------------------------------
244 echo Testing GUI
245 echo ---------------------------------------------
246 echo
247
248 CHECK_GUI_MODULE
249
250 gui_ok=no
251 if test "${SalomeGUI_need}" != "no" -a "${FullGUI_ok}" = "yes" ; then 
252   gui_ok=yes
253 fi
254
255 AM_CONDITIONAL(HEXOTICPLUGIN_ENABLE_GUI, [test "${gui_ok}" = "yes"])
256
257 if test "${SalomeGUI_need}" == "yes"; then
258   if test "${FullGUI_ok}" != "yes"; then
259     AC_MSG_WARN(For configure HexoticPLUGIN module necessary full GUI!)
260   fi
261 elif test "${SalomeGUI_need}" == "auto"; then
262   if test "${FullGUI_ok}" != "yes"; then
263     AC_MSG_WARN(Full GUI not found. Build will be done without GUI!)
264   fi
265 elif test "${SalomeGUI_need}" == "no"; then
266   echo Build without GUI option has been chosen
267 fi
268
269 if test "${gui_ok}" = "yes"; then
270     echo
271     echo ---------------------------------------------
272     echo testing openGL
273     echo ---------------------------------------------
274     echo
275
276     CHECK_OPENGL
277
278     echo
279     echo ---------------------------------------------
280     echo testing QT
281     echo ---------------------------------------------
282     echo
283
284     CHECK_QT
285 fi
286
287 echo
288 echo ---------------------------------------------
289 echo testing VTK
290 echo ---------------------------------------------
291 echo
292
293 CHECK_VTK
294
295 echo
296 echo ---------------------------------------------
297 echo testing HDF5
298 echo ---------------------------------------------
299 echo
300
301 CHECK_HDF5
302
303 echo
304 echo ---------------------------------------------
305 echo Testing OpenCascade
306 echo ---------------------------------------------
307 echo
308
309 CHECK_CAS
310
311 echo
312 echo ---------------------------------------------
313 echo Testing html generators
314 echo ---------------------------------------------
315 echo
316
317 CHECK_HTML_GENERATORS
318
319 echo
320 echo ---------------------------------------------
321 echo Testing Hexotic
322 echo ---------------------------------------------
323 echo
324
325 CHECK_HEXOTIC
326
327 echo
328 echo ---------------------------------------------
329 echo Testing Kernel
330 echo ---------------------------------------------
331 echo
332
333 CHECK_KERNEL
334
335 echo
336 echo ---------------------------------------------
337 echo Testing Geom
338 echo ---------------------------------------------
339 echo
340
341 CHECK_GEOM
342
343 echo
344 echo ---------------------------------------------
345 echo Testing Med
346 echo ---------------------------------------------
347 echo
348  
349 CHECK_MED
350
351 echo
352 echo ---------------------------------------------
353 echo Testing SMesh
354 echo ---------------------------------------------
355 echo
356
357 CHECK_SMESH
358
359 echo
360 echo ---------------------------------------------
361 echo Testing BLSURFPlugin
362 echo ---------------------------------------------
363 echo
364
365 CHECK_BLSURFPLUGIN
366 if test "${BLSURFplugin_ok}" = "yes"; then
367   AC_DEFINE(WITH_BLSURFPLUGIN)
368 fi
369 AM_CONDITIONAL(HEXOTICPLUGIN_ENABLE_BLSURFPLUGIN, [test "${BLSURFplugin_ok}" = "yes"])
370
371 echo
372 echo ---------------------------------------------
373 echo Summary
374 echo ---------------------------------------------
375 echo
376
377 #AM_CONDITIONAL( USE_GFORTRAN, [test "$F77" = "gfortran"])
378
379 if test "${gui_ok}" = "yes"; then
380   variables="cc_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok vtk_ok hdf5_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok Geom_ok Med_ok SMesh_ok gui_ok"
381   opt_variables="Hexotic_ok BLSURFplugin_ok"
382 elif test "${SalomeGUI_need}" != "no"; then
383   variables="cc_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok vtk_ok hdf5_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok Geom_ok Med_ok SMesh_ok gui_ok"
384   opt_variables="Hexotic_ok BLSURFplugin_ok"
385 else
386   variables="cc_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok vtk_ok hdf5_ok omniORB_ok occ_ok doxygen_ok graphviz_ok Kernel_ok Geom_ok Med_ok SMesh_ok"
387   opt_variables="Hexotic_ok BLSURFplugin_ok"
388 fi
389
390 echo
391 echo --- Mandatory products :
392 echo
393
394 for var in $variables
395 do
396    printf "   %10s : " `echo \$var | sed -e "s,_ok,,"`
397    eval echo \$$var
398 done
399
400 echo
401 echo --- Optional products :
402 echo
403
404 for var in $opt_variables
405 do
406    printf "   %10s : " `echo \$var | sed -e "s,_ok,,"`
407    eval echo \$$var
408 done
409
410
411 echo
412 echo "Default ORB   : $DEFAULT_ORB"
413 echo
414
415 dnl We don t need to say when we re entering directories if we re using
416 dnl GNU make becuase make does it for us.
417 if test "X$GMAKE" = "Xyes"; then
418    AC_SUBST(SETX) SETX=":"
419 else
420    AC_SUBST(SETX) SETX="set -x"
421 fi
422
423 dnl Build with SMESH cancel compute feature
424 AC_DEFINE(WITH_SMESH_CANCEL_COMPUTE)
425
426 dnl copy shells and utilities contained in the bin directory
427 dnl excluding .in files (treated in AC-OUTPUT below) and CVS
428 dnl directory
429
430 echo
431 echo ---------------------------------------------
432 echo generating Makefiles and configure files
433 echo ---------------------------------------------
434 echo
435
436 #AC_OUTPUT_COMMANDS([ \
437 #  chmod +x ./bin/*; \
438 #  chmod +x ./bin/salome/*;
439 #])
440
441 AC_HACK_LIBTOOL
442 AC_CONFIG_COMMANDS([hack_libtool],[
443 sed -i "s%^CC=\"\(.*\)\"%hack_libtool (){ \n\
444   $(pwd)/hack_libtool \1 \"\$[@]\" \n\
445 }\n\
446 CC=\"hack_libtool\"%g" libtool
447 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
448 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
449 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
450 ],[])
451
452 # This list is initiated using autoscan and must be updated manually
453 # when adding a new file <filename>.in to manage. When you execute
454 # autoscan, the Makefile list is generated in the output file configure.scan.
455 # This could be helpfull to update de configuration.
456 AC_OUTPUT([ \
457   adm_local/Makefile \
458   adm_local/unix/Makefile \
459   adm_local/unix/config_files/Makefile \
460   bin/VERSION \
461   bin/Makefile \
462   idl/Makefile \
463   resources/Makefile \
464   src/Makefile \
465   src/HexoticPlugin/Makefile \
466   src/GUI/Makefile \
467   src/GUI/resources/Makefile \
468   HexoticPLUGIN_version.h \
469   doc/Makefile \
470   doc/salome/Makefile \
471   doc/salome/gui/Makefile \
472   doc/salome/gui/HexoticPLUGIN/Makefile \
473   doc/salome/gui/HexoticPLUGIN/doxyfile \
474   doc/salome/gui/HexoticPLUGIN/doxyfile_py \
475   doc/salome/gui/HexoticPLUGIN/static/header.html \
476   doc/salome/gui/HexoticPLUGIN/static/header_py.html \
477   Makefile \
478 ])