-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
452 lines (369 loc) · 15.7 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
AC_INIT([medio],[1.0],[mohd-afeef.badri@cea.fr])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
AC_CONFIG_HEADERS([config.h])
dnl ---------------------------------------------------------------
dnl Small macro to print out a nice, pretty section title.
dnl ---------------------------------------------------------------
define(SECTION_TITLE,
[
echo >& AS_MESSAGE_FD
echo ' $1 ' | sed -e's/./-/g' >&AS_MESSAGE_FD
echo ' $1' >& AS_MESSAGE_FD
echo ' $1 ' | sed -e's/./-/g' >&AS_MESSAGE_FD
])
AU_ALIAS([ACX_FF], [AX_FF])
AC_DEFUN([AX_FF], [
AC_PREREQ([2.50])
AC_ARG_VAR(FF,[FreeFEM compiler command])
AC_CHECK_PROG(FF,[FreeFem++],[FreeFem++],[no])
])
AU_ALIAS([ACX_FFCXX], [AX_FFCXX])
AC_DEFUN([AX_FFCXX], [
AC_PREREQ([2.50])
AC_ARG_VAR(FFCXX,[FreeFEM compiler command])
AC_CHECK_PROG(FFCXX,[ff-c++],[ff-c++],[no])
])
AU_ALIAS([ACX_FFCXXDEP], [AX_FFCXXDEP])
AC_DEFUN([AX_FFCXXDEP], [
AC_PREREQ([2.50])
AC_ARG_VAR(FFCXXDEP,[ff-c++ compiler dependencies])
AC_CHECK_PROG(FFCXXDEP,[ff-get-dep],[ff-get-dep],[no])
])
AU_ALIAS([ACX_FFMPI], [AX_FFMPI])
AC_DEFUN([AX_FFMPI], [
AC_PREREQ([2.50])
AC_ARG_VAR(FFMPI,[FreeFEM compiler command])
AC_CHECK_PROG(FFMPI,[ff-mpirun],[ff-mpirun],[no])
])
AC_ARG_VAR(MPIRUN,[MPIRUN command])
AC_CHECK_PROGS(MPIRUN, mpirun mpiexec srun ccc_mprun, $MPIRUN)
AC_ARG_WITH(FreeFEM,
[ --with-FreeFEM= FreeFEM installation path : (e.g. --with-FreeFEM=/opt/FreeFem/bin)],
FF="${withval}/FreeFem++"
FFCXX="${withval}/ff-c++"
FFCXXDEP="${withval}/ff-get-dep"
FFMPI="${withval}/ff-mpirun")
AC_ARG_WITH([hdf5],
[ --with-hdf5= hdf5 root path : (e.g. --with-hdf5=/home/salome/INSTALL/hdf5)],
[hdf5="$withval"], [hdf5="no"])
AC_ARG_WITH([medfile],
[ --with-medfile= medfile root path : (e.g. --with-medfile=/home/salome/INSTALL/medfile)],
[medfile="$withval"], [medfile="no"])
AC_ARG_WITH([medcoupling],
[ --with-medcoupling= medcoupling root path : (e.g. --with-salome=/home/salome/INSTALL/MEDCOUPLING)],
[medcoupling="$withval"], [medcoupling="no"])
AC_ARG_WITH([dependencies],
[ --with-dependencies= Dependencies installation : (e.g. --with-dependencies=yes)],
[dependencies="$withval"], [dependencies="no"])
AC_ARG_WITH([med_MPI],
[ --with-med_MPI= Med and medCoupling MPI version : (e.g. --with-med_MPI=yes)],
[med_MPI="$withval"], [med_MPI="no"])
AC_SUBST([dependencies])
AM_CONDITIONAL([BUILDDEPENDENCIES], [test $dependencies != no])
test "$dependencies" == "no" && AC_MSG_WARN([
medio can automatically compile its dependencies
MedCoupling, Medfile, Hdf5 for you.
In order to do so
--with-dependencies=yes
The wget command will be used to download these,
if you wish to provided already downloaded files,
simply add the MEDCOUPLING-$$VERSION.tar.gz
in /ext folder.
])
AU_ALIAS([ACX_MPI], [AX_MPI])
AC_DEFUN([AX_MPI], [
AC_PREREQ([2.50])
AC_LANG_CASE(
[C], [
AC_REQUIRE([AC_PROG_CC])
AC_ARG_VAR(MPICC,[MPI C compiler command])
AC_CHECK_PROGS(MPICC, mpicc hcc mpxlc_r mpxlc mpcc cmpicc, $CC)
ax_mpi_save_CC="$CC"
CC="$MPICC"
AC_SUBST(MPICC)
],
[C++], [
AC_REQUIRE([AC_PROG_CXX])
AC_ARG_VAR(MPICXX,[MPI C++ compiler command])
AC_CHECK_PROGS(MPICXX, mpic++ mpicxx mpiCC hcp mpxlC_r mpxlC mpCC cmpic++, $CXX)
ax_mpi_save_CXX="$CXX"
CXX="$MPICXX"
AC_SUBST(MPICXX)
],
[Fortran 77], [
AC_REQUIRE([AC_PROG_F77])
AC_ARG_VAR(MPIF77,[MPI Fortran 77 compiler command])
AC_CHECK_PROGS(MPIF77, mpif77 hf77 mpxlf_r mpxlf mpf77 cmpifc, $F77)
ax_mpi_save_F77="$F77"
F77="$MPIF77"
AC_SUBST(MPIF77)
],
[Fortran], [
AC_REQUIRE([AC_PROG_FC])
AC_ARG_VAR(MPIFC,[MPI Fortran compiler command])
AC_CHECK_PROGS(MPIFC, mpif90 mpxlf95_r mpxlf90_r mpxlf95 mpxlf90 mpf90 cmpif90c, $FC)
ax_mpi_save_FC="$FC"
FC="$MPIFC"
AC_SUBST(MPIFC)
])
if test x = x"$MPILIBS"; then
AC_LANG_CASE([C], [AC_CHECK_FUNC(MPI_Init, [MPILIBS=" "])],
[C++], [AC_CHECK_FUNC(MPI_Init, [MPILIBS=" "])],
[Fortran 77], [AC_MSG_CHECKING([for MPI_Init])
AC_LINK_IFELSE([AC_LANG_PROGRAM([],[ call MPI_Init])],[MPILIBS=" "
AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])],
[Fortran], [AC_MSG_CHECKING([for MPI_Init])
AC_LINK_IFELSE([AC_LANG_PROGRAM([],[ call MPI_Init])],[MPILIBS=" "
AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])])
fi
AC_LANG_CASE([Fortran 77], [
if test x = x"$MPILIBS"; then
AC_CHECK_LIB(fmpi, MPI_Init, [MPILIBS="-lfmpi"])
fi
if test x = x"$MPILIBS"; then
AC_CHECK_LIB(fmpich, MPI_Init, [MPILIBS="-lfmpich"])
fi
],
[Fortran], [
if test x = x"$MPILIBS"; then
AC_CHECK_LIB(fmpi, MPI_Init, [MPILIBS="-lfmpi"])
fi
if test x = x"$MPILIBS"; then
AC_CHECK_LIB(mpichf90, MPI_Init, [MPILIBS="-lmpichf90"])
fi
])
if test x = x"$MPILIBS"; then
AC_CHECK_LIB(mpi, MPI_Init, [MPILIBS="-lmpi"])
fi
if test x = x"$MPILIBS"; then
AC_CHECK_LIB(mpich, MPI_Init, [MPILIBS="-lmpich"])
fi
dnl We have to use AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[],[]) and not AC_CHECK_HEADER because the
dnl latter uses $CPP, not $CC (which may be mpicc).
AC_LANG_CASE([C], [if test x != x"$MPILIBS"; then
AC_MSG_CHECKING([for mpi.h])
AC_TRY_COMPILE([#include <mpi.h>],[],[AC_MSG_RESULT(yes)], [MPILIBS=""
AC_MSG_RESULT(no)])
fi],
[C++], [if test x != x"$MPILIBS"; then
AC_MSG_CHECKING([for mpi.h])
AC_TRY_COMPILE([#include <mpi.h>],[],[AC_MSG_RESULT(yes)], [MPILIBS=""
AC_MSG_RESULT(no)])
fi],
[Fortran 77], [if test x != x"$MPILIBS"; then
AC_MSG_CHECKING([for mpif.h])
AC_TRY_COMPILE([#include <mpif.h>],[],[AC_MSG_RESULT(yes)], [MPILIBS=""
AC_MSG_RESULT(no)])
fi],
[Fortran], [if test x != x"$MPILIBS"; then
AC_MSG_CHECKING([for mpif.h])
AC_TRY_COMPILE([#include <mpif.h>],[],[AC_MSG_RESULT(yes)], [MPILIBS=""
AC_MSG_RESULT(no)])
fi])
AC_LANG_CASE([C], [CC="$ax_mpi_save_CC"],
[C++], [CXX="$ax_mpi_save_CXX"],
[Fortran 77], [F77="$ax_mpi_save_F77"],
[Fortran], [FC="$ax_mpi_save_FC"])
AC_SUBST(MPILIBS)
# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
if test x = x"$MPILIBS"; then
$2
:
else
ifelse([$1],,[AC_DEFINE(HAVE_MPI,1,[Define if you have the MPI library.])],[$1])
:
fi
])
SECTION_TITLE([ checking for a C++/MPIC++ compilers ])
AC_PROG_CXX
AC_LANG(C++)
AX_MPI
SECTION_TITLE([ checking for a C/MPIC compilers ])
AC_PROG_CC
AC_LANG(C)
AX_MPI
AC_ARG_WITH(MPICXX,
[ --with-MPICXX= path of the MPI C++ compiler to be used
(e.g. --with-MPICXX=your/MPIC++/Install/path/bin/mpic++)],
MPICXX="${withval}")
AC_ARG_WITH(MPICC,
[ --with-MPICC= path of the MPI C compiler to be used
(e.g. --with-MPICC=your/MPIC++/Install/path/bin/mpicc)],
MPICC="${withval}")
AC_ARG_WITH(MPIRUN,
[ --with-MPIRUN= path of the MPIRUN to be used
(e.g. --with-MPIRUN=your/Install/path/bin/mpirun)],
MPIRUN="${withval}")
test "$MPICXX" == "$CXX" && AC_MSG_ERROR([
Required MPI C++ compilers were not found. If you are
sure that MPI C++ compiler is present on you operating
system you might use the ./configure flag:
'--with-MPICXX=your/MPIC++/Install/path/bin/mpic++'
to provide the location of MPI C++ compiler.
])
test "$MPICC" == "$CC" && AC_MSG_ERROR([
Required MPI C compilers were not found. If you are
sure that MPI C compiler is present on you operating
system you might use the ./configure flag:
'--with-MPICC=your/MPIC/Install/path/bin/mpicc'
to provide the location of MPI C compiler.
])
SECTION_TITLE([ checking for a FF++ compilers ])
AX_FF
test "$FF" == "no" && AC_MSG_ERROR([
Required program 'FreeFem++' not found.
If 'FreeFem++' is not present in /usr/bin
or in /usr/local/bin consider using the
'--with-FreeFEM=your/FreeFEM/path/bin' flag
with ./configure command.
])
AX_FFCXX
test "$FFCXX" == "no" && AC_MSG_ERROR([
Required program 'ff-++' not found.
If 'ff-++' is not present in /usr/bin
or in /usr/local/bin consider using the
'--with-FreeFEM=your/FreeFEM/path/bin' flag
with ./configure command.
])
AX_FFCXXDEP
test "$FFCXXDEP" == "no" && AC_MSG_ERROR([
Required program 'ff-get-dep' not found.
If 'ff-get-dep' is not present in /usr/bin
or in /usr/local/bin consider using the
'--with-FreeFEM=your/FreeFEM/path/bin' flag
with ./configure command.
])
AX_FFMPI
test "$FFMPI" == "no" && AC_MSG_ERROR([
Required program 'ff-mpirun' not found.
If 'ff-mpirun' is not present in /usr/bin
or in /usr/local/bin consider using the
'--with-FreeFEM=your/FreeFEM/path/bin' flag
with ./configure command.
])
dnl ---------------------------------------------------------------
dnl Did the user provide salome/medcoupling
dnl ---------------------------------------------------------------
SECTION_TITLE([ checking for a med support ])
AC_SUBST([hdf5])
AC_SUBST([medfile])
AC_SUBST([medcoupling])
AM_CONDITIONAL([HAVEMED], [test $hdf5 != no -a $medfile != no -a $medcoupling != no])
AC_MSG_RESULT([])
test $hdf5 != no && AC_MSG_RESULT([checking for hdf5... yes])
test $hdf5 == no && AC_MSG_RESULT([checking for hdf5... no])
test $medfile != no && AC_MSG_RESULT([checking for medfile... yes])
test $medfile == no && AC_MSG_RESULT([checking for medfile... no])
test $medcoupling != no && AC_MSG_RESULT([checking for medcoupling... yes])
test $medcoupling == no && AC_MSG_RESULT([checking for medcoupling... no])
test $hdf5 != no -a $medfile != no -a $medcoupling != no && AC_MSG_RESULT([med support... yes])
AC_MSG_RESULT([])
dnl CXXFLAGS_MED="-I${hdf5}/include -I${medfile}/include -I${medcoupling}/include ${CXXFLAGS}"
dnl LDFLAGS_MED="-L${hdf5}/lib -L${medfile}/lib -L${medcoupling}/lib ${LDFLAGS}"
dnl LIBS_MED="-lhdf5 -lmedC -lmedloader -lmedcoupling -linterpkernel -lmedcouplingremapper ${LIBS}"
test $hdf5 != no -a $medfile != no -a $medcoupling != no && AC_SUBST(CXXFLAGS_MED,"-I${hdf5}/include -I${medfile}/include -I${medcoupling}/include ${CXXFLAGS}" )
test $hdf5 != no -a $medfile != no -a $medcoupling != no && AC_SUBST(LDFLAGS_MED,"-L${hdf5}/lib -L${medfile}/lib -L${medcoupling}/lib ${LDFLAGS}" )
test $hdf5 != no -a $medfile != no -a $medcoupling != no && AC_SUBST(LIBS_MED,"-lhdf5 -lmedC -lmedloader -lmedcoupling -linterpkernel -lmedcouplingremapper ${LIBS}" )
AM_CONDITIONAL([MPI_MED], [test $med_MPI != no])
test $med_MPI != no && AC_SUBST(MPI_MED,"-MPI")
AC_SUBST(SALOME_VERSION,["9.12.0"])
test $dependencies != no && AC_SUBST(CXXFLAGS_MED,"-I$(pwd)/ext/MEDCOUPLING-${SALOME_VERSION}${MPI_MED}/BINARIES-CO7/hdf5/include -I$(pwd)/ext/MEDCOUPLING-${SALOME_VERSION}${MPI_MED}/BINARIES-CO7/medfile/include -I$(pwd)/ext/MEDCOUPLING-${SALOME_VERSION}${MPI_MED}/INSTALL/MEDCOUPLING/include ${CXXFLAGS}" )
test $dependencies != no && AC_SUBST(LDFLAGS_MED,"-L$(pwd)/ext/MEDCOUPLING-${SALOME_VERSION}${MPI_MED}/BINARIES-CO7/hdf5/lib -L$(pwd)/ext/MEDCOUPLING-${SALOME_VERSION}${MPI_MED}/BINARIES-CO7/medfile/lib -L$(pwd)/ext/MEDCOUPLING-${SALOME_VERSION}${MPI_MED}/INSTALL/MEDCOUPLING/lib ${LDFLAGS}" )
test $dependencies != no && AC_SUBST(LIBS_MED,"-lhdf5 -lmedC -lmedloader -lmedcoupling -linterpkernel -lmedcouplingremapper ${LIBS}" )
test $dependencies != no && AC_SUBST(MEDIO_MEDCOUPLING_DIR,"$(pwd)/ext/MEDCOUPLING-${SALOME_VERSION}${MPI_MED}/INSTALL/MEDCOUPLING" )
test $dependencies != no && AC_SUBST(MEDIO_HDF5_DIR,"$(pwd)/ext/MEDCOUPLING-${SALOME_VERSION}${MPI_MED}/BINARIES-CO7/hdf5" )
test $dependencies != no && AC_SUBST(MEDIO_MEDFILE_DIR,"$(pwd)/ext/MEDCOUPLING-${SALOME_VERSION}${MPI_MED}/BINARIES-CO7/medfile" )
AC_MSG_RESULT([])
AC_SUBST(CXXFLAGS_MED,[$CXXFLAGS_MED])
AC_SUBST(LDFLAGS_MED,[$LDFLAGS_MED])
AC_SUBST(LIBS_MED,[$LIBS_MED])
AC_SUBST(MPI_MED,[$MPI_MED])
AC_MSG_RESULT([ CXXFLAGS_MED FLAGS : '$CXXFLAGS_MED'])
AC_MSG_RESULT([])
AC_MSG_RESULT([ LDFLAGS_MED FLAGS : '$LDFLAGS_MED'])
AC_MSG_RESULT([])
AC_MSG_RESULT([ LIBS_MED FLAGS : '$LIBS_MED'])
AC_MSG_RESULT([])
test $hdf5 == no -o $medfile == no -o $medcoupling == no && AC_MSG_WARN([
medio will is not configured with med support,
you did not provide the flags:
--with-hdf5
--with-medfile
--with-medcoupling
])
dnl ---------------------------------------------------------------
dnl ---------------------------------------------------------------
dnl Associate appropriate suffix for different os
dnl ---------------------------------------------------------------
SECTION_TITLE([ checking for operating system type ])
os_uname=`uname`
case $os_uname in
CYGWIN*|MINGW*|MSYS_NT*)
os_type="windows";;
Darwin)
os_type="mac";;
Linux)
os_type="linux";;
*)
os_type="unknown";;
esac
AC_MSG_RESULT([])
test "$os_type" == "windows" && AC_MSG_RESULT([ OS identified: Windows])
test "$os_type" == "mac" && AC_MSG_RESULT([ OS identified: MacOs])
test "$os_type" == "linux" && AC_MSG_RESULT([ OS identified: Linux])
test "$os_type" == "unknown" && AC_MSG_ERROR([
For the moment medio is only built on Linux or MacOS
please contact mohd-afeef.badri@cea.fr for help
regarding to building medio on your OS.
])
AM_CONDITIONAL([WINDOWS], [test "$os_type" == "windows"])
AM_CONDITIONAL([MAC], [test "$os_type" == "mac"])
AM_CONDITIONAL([LINUX], [test "$os_type" == "linux"])
test "$os_type" == "windows" && AC_SUBST(SO_SUFFIX,"dll" )
test "$os_type" == "mac" && AC_SUBST(SO_SUFFIX,"dylib")
test "$os_type" == "linux" && AC_SUBST(SO_SUFFIX,"so" )
AC_MSG_RESULT([ Shared object sufix : '$SO_SUFFIX'])
dnl ---------------------------------------------------------------
SECTION_TITLE([ generating the required makefiles ])
AC_CONFIG_FILES([
Makefile
ext/Makefile
src/Makefile
test/Makefile
test/FreeFEM/Makefile
test/unit/Makefile
])
AC_OUTPUT
SECTION_TITLE([ status ])
dnl Print results
AC_MSG_RESULT([])
AC_MSG_RESULT([ medio version $VERSION configured successfully.])
AC_MSG_RESULT([])
AC_MSG_RESULT([ install path : '$prefix'])
AC_MSG_RESULT([])
AC_MSG_RESULT([ C++ compiler : '$CXX'])
AC_MSG_RESULT([ C compiler : '$CC'])
AC_MSG_RESULT([ C/C++ flags : '$CXXFLAGS'])
AC_MSG_RESULT([])
AC_MSG_RESULT([ MPIRUN : '$MPIRUN'])
AC_MSG_RESULT([ MPIC++ compiler : '$MPICXX'])
AC_MSG_RESULT([ MPIC compiler : '$MPICC'])
AC_MSG_RESULT([])
AC_MSG_RESULT([ FreeFEM compiler : '$FF'])
test "$LDFLAGS" != "" && AC_MSG_RESULT([ Building with '$LDFLAGS' for linker flags.])
test "$LIBS" != "" && AC_MSG_RESULT([ Building with '$LIBS' libraries.])
AC_MSG_RESULT([])
test "$dependencies" == "no" && AC_MSG_RESULT([ Dependencies compilation : DISABLE])
test "$dependencies" != "no" && AC_MSG_RESULT([ Dependencies compilation : ENABLED])
AC_MSG_RESULT([])
test "$hdf5" != "no" && AC_MSG_RESULT([ Hdf5 : YES $hdf5])
test "$hdf5" == "no" -a "$dependencies" == "no" && AC_MSG_RESULT([ Hdf5 : NO])
test "$dependencies" != "no" && AC_MSG_RESULT([ Hdf5 : YES $MEDIO_HDF5_DIR])
test "$medfile" != "no" && AC_MSG_RESULT([ medfile : YES $medfile])
test "$medfile" == "no" -a "$dependencies" == "no" && AC_MSG_RESULT([ medfile : NO])
test "$dependencies" != "no" && AC_MSG_RESULT([ medfile : YES $MEDIO_MEDFILE_DIR])
test "$medcoupling" != "no" && AC_MSG_RESULT([ medcoupling : YES $medcoupling])
test "$medcoupling" == "no" -a "$dependencies" == "no" && AC_MSG_RESULT([ medcoupling : NO])
test "$dependencies" != "no" && AC_MSG_RESULT([ medcoupling : YES $MEDIO_MEDCOUPLING_DIR])
AC_MSG_RESULT([])
SECTION_TITLE([ END ])