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