Salome HOME
Merge from V6_4_BR 05/12/2011
[modules/homard.git] / configure.ac
1 # Copyright (C) 2011  CEA/DEN, EDF R&D
2 #
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License.
7 #
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 # Lesser General Public License for more details.
12 #
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19 # Author : Marc Tajchman (CEA)
20 # Date : 28/06/2001
21 # Modified by : Patrick GOLDBRONN (CEA)
22 # Modified by : Marc Tajchman (CEA)
23 # Modified by : Alexander BORODIN (OCN) - autotools usage
24 # Created from configure.in.base
25 #
26 AC_INIT([Salome2 Project HOMARD module], [6.4.0], [webmaster.salome@opencascade.com], [SalomeHOMARD])
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 SHORT_VERSION=`echo $VERSION | awk -F. '{printf("%d.%d",$1,$2)}'`
33 AC_SUBST(SHORT_VERSION)
34 XVERSION=`echo $VERSION | awk -F. '{printf("0x%02x%02x%02x",$1,$2,$3)}'`
35 AC_SUBST(XVERSION)
36
37 # set up MODULE_NAME variable for dynamic construction of directories (resources, etc.)
38 MODULE_NAME=homard
39 AC_SUBST(MODULE_NAME)
40
41 echo
42 echo ---------------------------------------------
43 echo Initialize source and build root directories
44 echo ---------------------------------------------
45 echo
46
47 dnl
48 dnl Initialize source and build root directories
49 dnl
50
51 ROOT_BUILDDIR=`pwd`
52 ROOT_SRCDIR=`echo $0 | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
53 cd $ROOT_SRCDIR
54 ROOT_SRCDIR=`pwd`
55 cd $ROOT_BUILDDIR
56
57 AC_SUBST(ROOT_SRCDIR)
58 AC_SUBST(ROOT_BUILDDIR)
59
60 echo
61 echo Source root directory : $ROOT_SRCDIR
62 echo Build  root directory : $ROOT_BUILDDIR
63 echo
64 echo
65
66 if test -z "$AR"; then
67    AC_CHECK_PROGS(AR,ar xar,:,$PATH)
68 fi
69 AC_SUBST(AR)
70
71 dnl Export the AR macro so that it will be placed in the libtool file
72 dnl correctly.
73 export AR
74
75 echo
76 echo ---------------------------------------------
77 echo testing make
78 echo ---------------------------------------------
79 echo
80
81 AC_PROG_MAKE_SET
82 AC_PROG_INSTALL
83 dnl
84 dnl libtool macro check for CC, LD, NM, LN_S, RANLIB, STRIP + pour les librairies dynamiques !
85
86 echo
87 echo ---------------------------------------------
88 echo Coniguring production
89 echo ---------------------------------------------
90 echo
91 AC_ENABLE_DEBUG(yes)
92 AC_DISABLE_PRODUCTION
93
94 echo ---------------------------------------------
95 echo testing libtool
96 echo ---------------------------------------------
97
98 dnl first, we set static to no!
99 dnl if we want it, use --enable-static
100 AC_ENABLE_STATIC(no)
101
102 AC_LIBTOOL_DLOPEN
103 AC_PROG_LIBTOOL
104
105 dnl Fix up the INSTALL macro if it s a relative path. We want the
106 dnl full-path to the binary instead.
107 case "$INSTALL" in
108    *install-sh*)
109       INSTALL='\${ROOT_BUILDDIR}'/adm_local/unix/config_files/install-sh
110       ;;
111 esac
112
113 echo
114 echo ---------------------------------------------
115 echo testing C/C++
116 echo ---------------------------------------------
117 echo
118
119 cc_ok=no
120 dnl inutil car libtool
121 dnl AC_PROG_CC
122 AC_PROG_CXX
123 AC_CXX_WARNINGS
124 AC_CXX_TEMPLATE_OPTIONS
125 AC_DEPEND_FLAG
126 # AC_CC_WARNINGS([ansi])
127 cc_ok=yes
128
129 echo
130 echo ---------------------------------------------
131 echo testing Fortran
132 echo ---------------------------------------------
133 echo
134
135 fortran_ok=no
136 AC_PROG_F77
137 AC_F77_LIBRARY_LDFLAGS
138 AC_PROG_FC
139 AC_FC_LIBRARY_LDFLAGS
140 if test "X$FC" != "X" ; then
141    fortran_ok=yes
142    F77=$FC
143 fi
144
145 dnl AM_CONDITIONAL( USE_GFORTRAN, [test "$F77" = "gfortran"])
146
147 echo
148
149 dnl Library libdl :
150 AC_CHECK_LIB(dl,dlopen)
151
152 dnl add library libm :
153 AC_CHECK_LIB(m,ceil)
154
155 dnl
156 dnl Well we use sstream which is not in gcc pre-2.95.3
157 dnl We must test if it exists. If not, add it in include !
158 dnl
159
160 AC_CXX_HAVE_SSTREAM
161
162 echo
163 echo ---------------------------------------------
164 echo testing python
165 echo ---------------------------------------------
166 echo
167
168 CHECK_PYTHON
169
170 echo
171 echo ---------------------------------------------
172 echo testing swig
173 echo ---------------------------------------------
174 echo
175
176 AM_PATH_PYTHON(2.3)
177 CHECK_SWIG
178
179 echo
180 echo ---------------------------------------------
181 echo testing threads
182 echo ---------------------------------------------
183 echo
184
185 ENABLE_PTHREADS
186
187 HOMARD_WITH_GUI=yes
188
189 AM_CONDITIONAL(HOMARD_ENABLE_GUI, [test "${HOMARD_WITH_GUI}" = "yes"])
190
191 if test "x${GUI_DISABLE_CORBA}" != "xyes" ; then
192     echo
193     echo ---------------------------------------------
194     echo testing omniORB
195     echo ---------------------------------------------
196     echo
197
198     CHECK_OMNIORB
199
200     echo
201     echo ---------------------------------------------
202     echo default ORB : omniORB
203     echo ---------------------------------------------
204     echo
205
206     DEFAULT_ORB=omniORB
207
208     echo
209     echo ---------------------------------------------
210     echo testing Corba
211     echo ---------------------------------------------
212     echo
213
214     CHECK_CORBA
215
216     AC_SUBST_FILE(CORBA)
217     corba=make_$ORB
218     CORBA=adm_local/unix/$corba
219
220 fi
221
222 if test "${HOMARD_WITH_GUI}" = "yes"; then
223     echo
224     echo ---------------------------------------------
225     echo testing openGL
226     echo ---------------------------------------------
227     echo
228
229     CHECK_OPENGL
230
231     echo
232     echo ---------------------------------------------
233     echo testing QT
234     echo ---------------------------------------------
235     echo
236
237     CHECK_QT
238
239     echo
240     echo ---------------------------------------------
241     echo Testing GUI
242     echo ---------------------------------------------
243     echo
244
245     CHECK_SALOME_GUI
246
247     echo
248     echo ---------------------------------------------
249     echo Testing full GUI
250     echo ---------------------------------------------
251     echo
252
253     CHECK_CORBA_IN_GUI
254     if test "x${CORBA_IN_GUI}" != "xyes"; then
255       echo "failed : For configure HOMARD module necessary full GUI !"
256       exit
257     fi
258 fi
259
260 echo
261 echo ---------------------------------------------
262 echo testing HDF5
263 echo ---------------------------------------------
264 echo
265
266 CHECK_HDF5
267
268 echo
269 echo ---------------------------------------------
270 echo BOOST Library
271 echo ---------------------------------------------
272 echo
273
274 CHECK_BOOST
275
276 echo
277 echo ---------------------------------------------
278 echo Testing OpenCascade
279 echo ---------------------------------------------
280 echo
281
282 CHECK_CAS
283
284
285 echo
286 echo ---------------------------------------------
287 echo Testing Kernel
288 echo ---------------------------------------------
289 echo
290
291 CHECK_KERNEL
292 CHECK_MPI
293
294 echo
295 echo ---------------------------------------------
296 echo Testing Med
297 echo ---------------------------------------------
298 echo
299
300 CHECK_MED2
301
302
303 echo
304 echo ---------------------------------------------
305 echo Testing Med Module
306 echo ---------------------------------------------
307 echo
308
309 CHECK_MED
310
311 echo
312 echo ---------------------------------------------
313 echo Testing Smesh
314 echo ---------------------------------------------
315 echo
316
317 CHECK_SMESH
318
319
320 echo
321 echo ---------------------------------------------
322 echo Testing sphinx
323 echo ---------------------------------------------
324 echo
325
326 CHECK_SPHINX
327
328
329 echo
330 echo ---------------------------------------------
331 echo Summary
332 echo ---------------------------------------------
333 echo
334
335 echo Configure
336 if test "${HOMARD_WITH_GUI}" = "yes"; then
337 variables="cc_ok fortran_ok boost_ok python_ok swig_ok threads_ok OpenGL_ok qt_ok  hdf5_ok omniORB_ok Kernel_ok med2_ok SalomeGUI_ok Med_ok SMesh_ok  sphinx_ok"
338 fi
339
340 if test "${HOMARD_WITH_GUI}" = "no"; then
341 variables="cc_ok fortran_ok boost_ok lex_yacc_ok python_ok swig_ok threads_ok hdf5_ok omniORB_ok  doxygen_ok graphviz_ok Kernel_ok Geom_ok Med_ok SMesh_ok  sphinx_ok"
342 fi
343
344 for var in $variables
345 do
346    printf "   %10s : " `echo \$var | sed -e "s,_ok,,"`
347    eval echo \$$var
348 done
349
350 echo
351 echo "Default ORB   : $DEFAULT_ORB"
352 echo
353
354 dnl We don t need to say when we re entering directories if we re using
355 dnl GNU make becuase make does it for us.
356 if test "X$GMAKE" = "Xyes"; then
357    AC_SUBST(SETX) SETX=":"
358 else
359    AC_SUBST(SETX) SETX="set -x"
360 fi
361
362 dnl AM_CONDITIONAL(GUI_ENABLE_CORBA, [test "$GUI_DISABLE_CORBA" = no])
363 dnl AM_CONDITIONAL(ENABLE_PYCONSOLE, [test "$DISABLE_PYCONSOLE" = no])
364 dnl AM_CONDITIONAL(ENABLE_GLVIEWER, [test "$DISABLE_GLVIEWER" = no])
365 dnl AM_CONDITIONAL(ENABLE_PLOT2DVIEWER, [test "$DISABLE_PLOT2DVIEWER" = no])
366 dnl AM_CONDITIONAL(ENABLE_SUPERVGRAPHVIEWER, [test "$DISABLE_SUPERVGRAPHVIEWER" = no])
367 dnl AM_CONDITIONAL(ENABLE_OCCVIEWER, [test "$DISABLE_OCCVIEWER" = no])
368 dnl AM_CONDITIONAL(ENABLE_VTKVIEWER, [test "$DISABLE_VTKVIEWER" = no])
369 dnl AM_CONDITIONAL(ENABLE_SALOMEOBJECT, [test "$DISABLE_SALOMEOBJECT" = no])
370
371 echo
372 echo ---------------------------------------------
373 echo generating Makefiles and configure files
374 echo ---------------------------------------------
375 echo
376
377 #AC_OUTPUT_COMMANDS([ \
378 #  chmod +x ./bin/*; \
379 #  chmod +x ./bin/salome/*; \
380 #])
381
382 AC_HACK_LIBTOOL
383 AC_CONFIG_COMMANDS([hack_libtool],[
384                     sed -i "s%^CC=\"\(.*\)\"%hack_libtool (){ \n\
385                           $(pwd)/hack_libtool \1 \"\$[@]\" \n\
386                           }\n\
387                           CC=\"hack_libtool\"%g" libtool
388                     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
389                     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
390                     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
391                     ],[])
392
393 # This list is initiated using autoscan and must be updated manually
394 # when adding a new file <filename>.in to manage. When you execute
395 # autoscan, the Makefile list is generated in the output file configure.scan.
396 # This could be helpfull to update de configuration.
397 AC_OUTPUT([ \
398         Makefile \
399         idl/Makefile \
400         adm_local/Makefile \
401         adm_local/unix/Makefile \
402         adm_local/unix/config_files/Makefile \
403         doc/Makefile \
404         doc/conf.py \
405         HOMARD_version.h \
406         src/Makefile \
407         src/HOMARD_I/Makefile \
408         src/HOMARD/Makefile \
409         src/HOMARDGUI/Makefile \
410         src/HOMARD_SWIG/Makefile \
411         resources/Makefile \
412         resources/HOMARDCatalog.xml \
413         resources/SalomeApp.xml \
414         tests/Makefile \
415 ])