Salome HOME
PR: synchro V7_main tag mergefrom_V6_main_28Feb13
[plugins/blsurfplugin.git] / configure.ac
1 #!/bin/bash
2 # Copyright (C) 2007-2012  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 BLSURFPLUGIN module], [7.0.0], [webmaster.salome@opencascade.com], [SalomeBLSURFPLUGIN])
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=blsurfplugin
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 AC_LOCAL_INSTALL
78 dnl 
79 dnl libtool macro check for CC, LD, NM, LN_S, RANLIB, STRIP + pour les librairies dynamiques !
80
81 AC_ENABLE_DEBUG(yes)
82 AC_DISABLE_PRODUCTION
83
84 echo ---------------------------------------------
85 echo testing libtool
86 echo ---------------------------------------------
87
88 dnl first, we set static to no!
89 dnl if we want it, use --enable-static
90 AC_ENABLE_STATIC(no)
91
92 AC_LIBTOOL_DLOPEN
93 AC_PROG_LIBTOOL
94
95 dnl Fix up the INSTALL macro if it s a relative path. We want the
96 dnl full-path to the binary instead.
97 case "$INSTALL" in
98    *install-sh*)
99       INSTALL='\${KERNEL_ROOT_DIR}'/adm_local/unix/config_files/install-sh
100       ;;
101 esac
102
103 echo
104 echo ---------------------------------------------
105 echo testing C/C++
106 echo ---------------------------------------------
107 echo
108
109 cc_ok=no
110 dnl inutil car libtool
111 dnl AC_PROG_CC
112 AC_PROG_CXX
113 AC_DEPEND_FLAG
114 # AC_CC_WARNINGS([ansi])
115 cc_ok=yes
116
117 echo
118 echo ---------------------------------------------
119 echo testing Fortran
120 echo ---------------------------------------------
121 echo
122
123 fortran_ok=no
124 AC_PROG_F77
125 AC_F77_LIBRARY_LDFLAGS
126 AC_PROG_FC
127 AC_FC_LIBRARY_LDFLAGS
128 if test "X$FC" != "X" ; then
129    fortran_ok=yes
130 fi
131
132 dnl Library libdl :
133 AC_CHECK_LIB(dl,dlopen)
134
135 dnl add library libm :
136 AC_CHECK_LIB(m,ceil)
137
138 dnl 
139 dnl Well we use sstream which is not in gcc pre-2.95.3
140 dnl We must test if it exists. If not, add it in include !
141 dnl
142
143 AC_CXX_HAVE_SSTREAM
144
145 echo
146 echo ---------------------------------------------
147 echo BOOST Library
148 echo ---------------------------------------------
149 echo
150
151 CHECK_BOOST
152
153 dnl
154 dnl ---------------------------------------------
155 dnl testing MPICH
156 dnl ---------------------------------------------
157 dnl
158
159 dnl CHECK_MPICH
160
161 echo
162 echo ---------------------------------------------
163 echo testing MPI
164 echo ---------------------------------------------
165 echo
166
167 CHECK_MPI
168
169 echo
170 echo ---------------------------------------------
171 echo testing LEX \& YACC
172 echo ---------------------------------------------
173 echo
174
175 lex_yacc_ok=no
176 AC_PROG_YACC
177 AC_PROG_LEX
178 lex_yacc_ok=yes
179
180 echo
181 echo ---------------------------------------------
182 echo testing python
183 echo ---------------------------------------------
184 echo
185
186 CHECK_PYTHON
187
188 AM_PATH_PYTHON(2.3)
189
190 dnl echo
191 dnl echo ---------------------------------------------
192 dnl echo testing java
193 dnl echo ---------------------------------------------
194 dnl echo
195
196 dnl CHECK_JAVA
197
198 echo
199 echo ---------------------------------------------
200 echo testing swig
201 echo ---------------------------------------------
202 echo
203
204 CHECK_SWIG
205
206 echo
207 echo ---------------------------------------------
208 echo testing threads
209 echo ---------------------------------------------
210 echo
211
212 ENABLE_PTHREADS
213
214 echo
215 echo ---------------------------------------------
216 echo testing omniORB
217 echo ---------------------------------------------
218 echo
219
220 CHECK_OMNIORB
221
222 dnl echo
223 dnl echo ---------------------------------------------
224 dnl echo testing mico
225 dnl echo ---------------------------------------------
226 dnl echo
227
228 dnl CHECK_MICO
229
230 echo
231 echo ---------------------------------------------
232 echo default ORB : omniORB
233 echo ---------------------------------------------
234 echo
235
236 DEFAULT_ORB=omniORB
237 CHECK_CORBA
238
239 AC_SUBST_FILE(CORBA)
240 corba=make_$ORB
241 CORBA=adm_local/unix/$corba
242
243 echo
244 echo ---------------------------------------------
245 echo Testing GUI
246 echo ---------------------------------------------
247 echo
248
249 CHECK_GUI_MODULE
250
251 gui_ok=no
252 if test "${SalomeGUI_need}" != "no" -a "${FullGUI_ok}" = "yes" ; then 
253   gui_ok=yes
254 fi
255
256 AM_CONDITIONAL(BLSURFPLUGIN_ENABLE_GUI, [test "${gui_ok}" = "yes"])
257
258 if test "${SalomeGUI_need}" == "yes"; then
259   if test "${FullGUI_ok}" != "yes"; then
260     AC_MSG_WARN(For configure BLSURFPLUGIN module necessary full GUI!)
261   fi
262 elif test "${SalomeGUI_need}" == "auto"; then
263   if test "${FullGUI_ok}" != "yes"; then
264     AC_MSG_WARN(Full GUI not found. Build will be done without GUI!)
265   fi
266 elif test "${SalomeGUI_need}" == "no"; then
267   echo Build without GUI option has been chosen
268 fi
269
270 if test "${gui_ok}" = "yes"; then
271     echo
272     echo ---------------------------------------------
273     echo testing openGL
274     echo ---------------------------------------------
275     echo
276
277     CHECK_OPENGL
278
279     echo
280     echo ---------------------------------------------
281     echo testing QT
282     echo ---------------------------------------------
283     echo
284
285     CHECK_QT
286 fi
287
288 echo
289 echo ---------------------------------------------
290 echo testing VTK
291 echo ---------------------------------------------
292 echo
293
294 CHECK_VTK
295
296 echo
297 echo ---------------------------------------------
298 echo testing HDF5
299 echo ---------------------------------------------
300 echo
301
302 CHECK_HDF5
303
304 echo
305 echo ---------------------------------------------
306 echo Testing OpenCascade
307 echo ---------------------------------------------
308 echo
309
310 CHECK_CAS
311
312 echo
313 echo ---------------------------------------------
314 echo Testing html generators
315 echo ---------------------------------------------
316 echo
317
318 CHECK_HTML_GENERATORS
319
320 dnl echo
321 dnl echo ---------------------------------------------
322 dnl echo Testing BLSURF
323 dnl echo ---------------------------------------------
324 dnl echo
325 dnl 
326 dnl CHECK_BLSURF
327
328 echo
329 echo ---------------------------------------------
330 echo Testing MeshGems-CADSurf
331 echo ---------------------------------------------
332 echo
333
334 CHECK_MESHGEMS_CADSURF
335
336 echo
337 echo ---------------------------------------------
338 echo Testing Kernel
339 echo ---------------------------------------------
340 echo
341
342 CHECK_KERNEL
343
344 echo
345 echo ---------------------------------------------
346 echo Testing Geom
347 echo ---------------------------------------------
348 echo
349
350 CHECK_GEOM
351
352 echo
353 echo ---------------------------------------------
354 echo Testing Med
355 echo ---------------------------------------------
356 echo
357  
358 CHECK_MED
359
360 echo
361 echo ---------------------------------------------
362 echo Testing SMesh
363 echo ---------------------------------------------
364 echo
365
366 CHECK_SMESH
367
368 echo
369 echo ---------------------------------------------
370 echo Summary
371 echo ---------------------------------------------
372 echo
373
374 #AM_CONDITIONAL( USE_GFORTRAN, [test "$F77" = "gfortran"])
375
376 echo Configure
377
378 if test "${gui_ok}" = "yes"; then
379   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 CADSURF_ok"
380 elif test "${SalomeGUI_need}" != "no"; then
381   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 CADSURF_ok"
382 else
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 CADSURF_ok"
384 fi
385
386 for var in $variables
387 do
388    printf "   %10s : " `echo \$var | sed -e "s,_ok,,"`
389    eval echo \$$var
390 done
391
392 echo
393 echo "Default ORB   : $DEFAULT_ORB"
394 echo
395
396 dnl We don t need to say when we re entering directories if we re using
397 dnl GNU make becuase make does it for us.
398 if test "X$GMAKE" = "Xyes"; then
399    AC_SUBST(SETX) SETX=":"
400 else
401    AC_SUBST(SETX) SETX="set -x"
402 fi
403
404 dnl Build with SMESH cancel compute feature
405 AC_DEFINE(WITH_SMESH_CANCEL_COMPUTE)
406
407 dnl copy shells and utilities contained in the bin directory
408 dnl excluding .in files (treated in AC-OUTPUT below) and CVS
409 dnl directory
410
411 echo
412 echo ---------------------------------------------
413 echo generating Makefiles and configure files
414 echo ---------------------------------------------
415 echo
416
417 #AC_OUTPUT_COMMANDS([ \
418 #  chmod +x ./bin/*; \
419 #  chmod +x ./bin/salome/*;
420 #])
421
422 AC_HACK_LIBTOOL
423 AC_CONFIG_COMMANDS([hack_libtool],[
424 sed -i "s%^CC=\"\(.*\)\"%hack_libtool (){ \n\
425   $(pwd)/hack_libtool \1 \"\$[@]\" \n\
426 }\n\
427 CC=\"hack_libtool\"%g" libtool
428 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
429 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
430 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
431 ],[])
432
433 # This list is initiated using autoscan and must be updated manually
434 # when adding a new file <filename>.in to manage. When you execute
435 # autoscan, the Makefile list is generated in the output file configure.scan.
436 # This could be helpfull to update de configuration.
437 AC_OUTPUT([ \
438   adm_local/Makefile \
439   adm_local/unix/Makefile \
440   adm_local/unix/config_files/Makefile \
441   adm_local/cmake_files/Makefile \
442   doc/Makefile \
443   doc/salome/Makefile \
444   doc/salome/gui/Makefile \
445   doc/salome/gui/BLSURFPLUGIN/Makefile \
446   doc/salome/gui/BLSURFPLUGIN/doxyfile \
447   doc/salome/gui/BLSURFPLUGIN/doxyfile_py \
448   doc/salome/gui/BLSURFPLUGIN/static/header.html \
449   doc/salome/gui/BLSURFPLUGIN/static/header_py.html \
450   doc/salome/tui/Makefile \
451   doc/salome/tui/doxyfile \
452   bin/VERSION \
453   bin/Makefile \
454   idl/Makefile \
455   resources/Makefile \
456   src/Makefile \
457   src/BLSURFPlugin/Makefile \
458   src/GUI/Makefile \
459   BLSURFPLUGIN_version.h \
460   Makefile \
461 ])