Salome HOME
Merge from V6_main 15/03/2013
[plugins/ghs3dprlplugin.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 GHS3DPRLPLUGIN module], [7.0.0], [webmaster.salome@opencascade.com], [SalomeGHS3DPRLPLUGIN])
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=ghs3dprlplugin
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(GHS3DPRLPLUGIN_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 GHS3DPRLPLUGIN 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 echo
321 echo ---------------------------------------------
322 echo Testing GHS3DPRL
323 echo ---------------------------------------------
324 echo
325
326 CHECK_GHS3DPRL
327
328 echo
329 echo ---------------------------------------------
330 echo Testing Kernel
331 echo ---------------------------------------------
332 echo
333
334 CHECK_KERNEL
335
336 echo
337 echo ---------------------------------------------
338 echo Testing Geom
339 echo ---------------------------------------------
340 echo
341
342 CHECK_GEOM
343
344 echo
345 echo ---------------------------------------------
346 echo Testing Med
347 echo ---------------------------------------------
348 echo
349  
350 CHECK_MED
351
352 echo
353 echo ---------------------------------------------
354 echo Testing SMesh
355 echo ---------------------------------------------
356 echo
357
358 CHECK_SMESH
359
360
361 echo
362 echo ---------------------------------------------
363 echo testing LIBXML2
364 echo ---------------------------------------------
365 echo libxml_ok=no
366 CHECK_LIBXML
367 dnl libxml_ok is set to yes by CHECK_LIBXML
368
369 echo
370 echo ---------------------------------------------
371 echo Summary
372 echo ---------------------------------------------
373 echo
374
375 #AM_CONDITIONAL( USE_GFORTRAN, [test "$F77" = "gfortran"])
376
377 if test "${gui_ok}" = "yes"; then
378   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 libxml_ok"
379   opt_variables="GHS3DPRL_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 libxml_ok"
382   opt_variables="GHS3DPRL_ok"
383 else
384   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 libxml_ok"
385   opt_variables="GHS3DPRL_ok"
386 fi
387
388 echo
389 echo --- Mandatory products :
390 echo
391
392 for var in $variables
393 do
394    printf "   %10s : " `echo \$var | sed -e "s,_ok,,"`
395    eval echo \$$var
396 done
397
398 echo
399 echo --- Optional products :
400 echo
401
402 for var in $opt_variables
403 do
404    printf "   %10s : " `echo \$var | sed -e "s,_ok,,"`
405    eval echo \$$var
406 done
407
408
409 echo
410 echo "Default ORB   : $DEFAULT_ORB"
411 echo
412
413 dnl We don t need to say when we re entering directories if we re using
414 dnl GNU make becuase make does it for us.
415 if test "X$GMAKE" = "Xyes"; then
416    AC_SUBST(SETX) SETX=":"
417 else
418    AC_SUBST(SETX) SETX="set -x"
419 fi
420
421 dnl copy shells and utilities contained in the bin directory
422 dnl excluding .in files (treated in AC-OUTPUT below) and CVS
423 dnl directory
424
425 echo
426 echo ---------------------------------------------
427 echo generating Makefiles and configure files
428 echo ---------------------------------------------
429 echo
430
431 #AC_OUTPUT_COMMANDS([ \
432 #  chmod +x ./bin/*; \
433 #  chmod +x ./bin/salome/*;
434 #])
435
436 AC_HACK_LIBTOOL
437 AC_CONFIG_COMMANDS([hack_libtool],[
438 sed -i "s%^CC=\"\(.*\)\"%hack_libtool (){ \n\
439   $(pwd)/hack_libtool \1 \"\$[@]\" \n\
440 }\n\
441 CC=\"hack_libtool\"%g" libtool
442 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
443 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
444 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
445 ],[])
446
447 # This list is initiated using autoscan and must be updated manually
448 # when adding a new file <filename>.in to manage. When you execute
449 # autoscan, the Makefile list is generated in the output file configure.scan.
450 # This could be helpfull to update de configuration.
451 AC_OUTPUT([ \
452   adm_local/Makefile \
453   adm_local/unix/Makefile \
454   adm_local/unix/config_files/Makefile \
455   bin/VERSION \
456   bin/Makefile \
457   idl/Makefile \
458   resources/Makefile \
459   doc/Makefile \
460   doc/salome/Makefile \
461   doc/salome/gui/Makefile \
462   doc/salome/gui/GHS3DPRLPLUGIN/Makefile \
463   doc/salome/gui/GHS3DPRLPLUGIN/doxyfile \
464   doc/salome/gui/GHS3DPRLPLUGIN/static/header.html \
465   doc/salome/gui/GHS3DPRLPLUGIN/doxyfile_py \
466   doc/salome/gui/GHS3DPRLPLUGIN/static/header_py.html \
467   src/Makefile \
468   src/GHS3DPRLPlugin/Makefile \
469   src/gui/Makefile \
470   src/tepal2med/Makefile \
471   src/tools/Makefile \
472   GHS3DPRLPLUGIN_version.h \
473   Makefile \
474 ])