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
|
# Init autoconf
AC_INIT(dolfin, 0.5.12, dolfin@fenics.org)
# Init automake
AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
# Tell automake not to generate Makefile.in unless asked to.
# This way the code can be installed on systems without automake installed.
AM_MAINTAINER_MODE
# Option --enable-debug
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],
[Turn on debugging and warnings (this is the default)]),
enable_debug=yes)
# Option --enable-optimization
AC_ARG_ENABLE(optimization,
AC_HELP_STRING([--enable-optimization],
[Turn on optimization]),
enable_optimization=yes)
# Option --disable-curses
AC_ARG_ENABLE(curses,
AC_HELP_STRING([--disable-curses],
[Compile without curses]),
disable_curses=yes)
# Option --disable-mpi
AC_ARG_ENABLE(mpi,
AC_HELP_STRING([--disable-mpi],
[Compile without MPI (assuming PETSc does not use MPI)]),
disable_mpi=yes)
# Option --with-petsc-dir
AC_ARG_WITH(petsc-dir,
AC_HELP_STRING([--with-petsc-dir=<path>],
[Specify path to PETSc]),
[PETSC_DIR=$with_petsc_dir],)
# Option --enable-pydolfin
AC_ARG_ENABLE(pydolfin,
AC_HELP_STRING([--enable-pydolfin],
[Turn on compilation of PyDOLFIN]),
enable_pydolfin=yes)
# Standard tests
AC_PROG_CC
AC_PROG_CXX
AC_PROG_RANLIB
AC_PROG_AWK
AC_PROG_INSTALL
AC_PROG_LN_S
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
# Test for PyDOLFIN
if test x$enable_pydolfin = xyes; then
AM_PATH_PYTHON(2.3)
AC_PYTHON_DEVEL
AC_PROG_SWIG(1.3.25)
SWIG_ENABLE_CXX
SWIG_PYTHON
fi
# Make debug option default so developers don't forget it
echo "turning on debugging and warnings (use --enable-optimization to avoid this)."
enable_debug="yes"
# Handle option --enable-debug
if test x$enable_debug = xyes; then
echo "enabling debugging compiler flags"
CXXFLAGS='-DDEBUG=1 -g -O2 -Wall -Werror -ansi -std=c++98'
# We should also add -pedantic, but then we get an error when we try
# to include mpio.h (long long not supported by ISO C++)
fi
# Handle option --enable-optimization
if test x$enable_optimization = xyes; then
echo "enabling optimizing compiler flags"
CXXFLAGS='-O3 -Wall -Werror -ansi -std=c++98'
fi
# Add '-Wno-uninitialized' due to a Cygwin gcc 3.4 bug.
if test `uname -o` = Cygwin; then
echo "adding compiler flags for cygwin"
CXXFLAGS=$CXXFLAGS' -Wno-uninitialized '
fi
# Add '-fPIC' for AMD 64 bit system
if test `uname -m` = x86_64; then
echo "adding -fPIC to compiler flags"
CXXFLAGS=$CXXFLAGS' -fPIC'
fi
# Handle option --disable-curses
if test x$disable_curses = x; then
echo "enabling curses, use --disable-curses to disable"
AC_SEARCH_LIBS(wbkgdset, ncurses,,
echo "*** Unable to find ncurses on your system. "
echo "*** Try ./configure --disable-curses or install ncurses." ; exit 1)
CURSES_CFLAGS=''
CURSES_LIBS='-lncurses'
else
echo "disabling curses"
CURSES_CFLAGS='-DNO_CURSES=1'
CURSES_LIBS=''
fi
# Handle option --with-petsc-dir=<path>
if test x$PETSC_DIR = x; then
echo "assuming path to PETSc is /usr/local/lib/petsc"
PETSC_DIR="/usr/local/lib/petsc/"
else
echo "using PETSC_DIR=$PETSC_DIR"
fi
# Handle option --enable-pydolfin
AM_CONDITIONAL(COMPILE_PYDOLFIN, test x$enable_pydolfin = xyes)
if test x$enable_pydolfin = xyes; then
echo "enabling compilation of PyDOLFIN"
else
echo "disabling compilation of PyDOLFIN"
fi
# Check for PETSc
AC_CHECK_PROG(petsc_found, configarch, yes, no, $PATH:$PETSC_DIR/bin)
if test $petsc_found = yes; then
# Extract PETSc variables from PETSC_DIR/bmake/common/variables
PETSC_CFLAGS=`make -s -C $PETSC_DIR getincludedirs PETSC_DIR=$PETSC_DIR`
PETSC_LIBS=`make -s -C $PETSC_DIR getlinklibs PETSC_DIR=$PETSC_DIR`
else
echo "*** Unable to find PETSc 2.3.0 on your system."
echo "*** Use --with-petsc-dir=<path> to specify the correct path for PETSc,"
echo "*** or set the environment variable PETSC_DIR to the correct path."
echo "*** PETSc is available at http://www-unix.mcs.anl.gov/petsc/petsc-2/"
exit 1
fi
# Check for MPI (needed by PETSc)
if test x$disable_mpi = x; then
AC_CHECK_PROG(mpi_found, mpirun, yes, no)
if test $mpi_found = yes; then
DIR=`which mpirun | sed 's/bin\/mpirun/include/'`
if [ test -d $DIR/mpi ]; then
MPI_CFLAGS="-I$DIR/mpi"
else
MPI_CFLAGS="-I$DIR"
fi
else
echo "*** Unable to find MPI on your system."
echo "*** Perhaps you need to install the package mpich?"
exit 1
fi
else
echo "disabling MPI (might not work if PETSc uses MPI)"
fi
# Check for libxml2
AC_CHECK_PROG(libxml2_found, xml2-config, yes, no)
if test $libxml2_found = yes; then
XML2_CFLAGS=`xml2-config --cflags`
XML2_LIBS=`xml2-config --libs`
else
echo "*** Unable to find libxml2 development files on your system."
echo "*** Perhaps you need to install the package libxml2-dev?"
exit 1
fi
# List of DOLFIN module libraries
DOLFIN_MODULES="elasticity elasticity-updated convdiff navierstokes poisson stokes heat"
# List of DOLFIN kernel libraries
DOLFIN_KERNEL="common fem form function io la main math mesh nls ode quadrature parameter log"
# Generate include path for kernel
KERNEL_CFLAGS=""
for f in $DOLFIN_KERNEL; do
KERNEL_CFLAGS="$KERNEL_CFLAGS -I\$(top_builddir)/src/kernel/$f"
done
KERNEL_CFLAGS="$KERNEL_CFLAGS $CURSES_CFLAGS $PETSC_CFLAGS $MPI_CFLAGS $XML2_CFLAGS"
AC_SUBST(KERNEL_CFLAGS)
# Generate include path for modules
MODULE_CFLAGS="$KERNEL_CFLAGS -I\$(top_builddir)/src/modules/"
AC_SUBST(MODULE_CFLAGS)
# Generate include path for main (including also module code)
MAIN_CFLAGS=""
for f in $DOLFIN_MODULES; do
MAIN_CFLAGS="$MAIN_CFLAGS -I\$(top_builddir)/src/modules/$f "
done
DOLFIN_CFLAGS="$KERNEL_CFLAGS $MAIN_CFLAGS"
AC_SUBST(DOLFIN_CFLAGS)
# Generate library list for linking in the correct order.
# FIXME: Not very pretty to list the libraries multiple times
DOLFIN_LIBS=""
DIRS="$DOLFIN_MODULES $DOLFIN_KERNEL $DOLFIN_KERNEL $DOLFIN_KERNEL $DOLFIN_KERNEL"
for f in $DIRS; do
DOLFIN_LIBS="$DOLFIN_LIBS -ldolfin-$f"
done
DOLFIN_LIBS="$DOLFIN_LIBS $CURSES_LIBS $PETSC_LIBS $XML2_LIBS"
AC_SUBST(DOLFIN_LIBS)
# Export variables to makefiles
AC_SUBST(PACKAGE_VERSION)
AC_SUBST(PACKAGE_NAME)
# Create Makefiles, seems like automake cannot handle a variable
# containing the list of files, so this cannot be done
# automatically. We have to list all the files.
AC_OUTPUT( Makefile \
src/Makefile \
src/pre/Makefile \
src/kernel/Makefile \
src/kernel/common/Makefile \
src/kernel/common/dolfin/Makefile \
src/kernel/fem/Makefile \
src/kernel/fem/dolfin/Makefile \
src/kernel/function/Makefile \
src/kernel/function/dolfin/Makefile \
src/kernel/form/Makefile \
src/kernel/form/dolfin/Makefile \
src/kernel/io/Makefile \
src/kernel/io/dolfin/Makefile \
src/kernel/la/Makefile \
src/kernel/la/dolfin/Makefile \
src/kernel/main/Makefile \
src/kernel/main/dolfin/Makefile \
src/kernel/math/Makefile \
src/kernel/math/dolfin/Makefile \
src/kernel/mesh/Makefile \
src/kernel/mesh/dolfin/Makefile \
src/kernel/nls/Makefile \
src/kernel/nls/dolfin/Makefile \
src/kernel/ode/Makefile \
src/kernel/ode/dolfin/Makefile \
src/kernel/parameter/Makefile \
src/kernel/parameter/dolfin/Makefile \
src/kernel/quadrature/Makefile \
src/kernel/quadrature/dolfin/Makefile \
src/kernel/log/Makefile \
src/kernel/log/dolfin/Makefile \
src/modules/Makefile \
src/modules/dolfin/Makefile \
src/modules/convdiff/Makefile \
src/modules/convdiff/dolfin/Makefile \
src/modules/elasticity/Makefile \
src/modules/elasticity/dolfin/Makefile \
src/modules/elasticity-updated/Makefile \
src/modules/elasticity-updated/dolfin/Makefile \
src/modules/navierstokes/Makefile \
src/modules/navierstokes/dolfin/Makefile \
src/modules/poisson/Makefile \
src/modules/poisson/dolfin/Makefile \
src/modules/heat/Makefile \
src/modules/heat/dolfin/Makefile \
src/modules/stokes/Makefile \
src/modules/stokes/dolfin/Makefile \
src/pydolfin/Makefile \
src/config/Makefile \
src/post/Makefile \
src/demo/Makefile \
src/demo/fem/Makefile \
src/demo/nls/Makefile \
src/demo/solvers/Makefile \
src/demo/solvers/navierstokes/Makefile \
src/demo/solvers/ode/Makefile \
src/demo/solvers/ode/modeling/Makefile \
src/demo/solvers/ode/homotopy/Makefile \
src/demo/scripting/Makefile \
src/utils/Makefile \
src/utils/inp2dx/Makefile \
src/greeting/Makefile )
# Display some configuration options
echo '---------------------------------------------------------'
echo 'Configuration of DOLFIN finished. Now type'
echo ''
echo ' make'
echo ' make install'
echo ''
echo 'to install DOLFIN on your system. After DOLFIN has been'
echo 'installed, you can compile all the demo programs in the'
echo 'subdirectory src/demo by running'
echo ''
echo ' make demo'
echo ''
echo 'Note that you may need to be root in order to install.'
echo 'To specify an alternative installation directory, rerun'
echo 'configure with option --prefix=<path>. You may also run'
echo './configure.local to configure for a local installation'
echo 'in the DOLFIN source tree.'
echo '---------------------------------------------------------'
# Check that the installation directory is set up correctly
__BINDIR=`echo $prefix/bin | sed -e 's/\//-/g'`
__PATH=`echo $PATH | sed -e 's/\//-/g'`
if test "$__PATH" = "`echo $__PATH | sed s/$__BINDIR//`"; then
echo 'Warning: installation directory is not in PATH.'
echo ''
echo 'To compile a program against DOLFIN (including the demos)'
echo 'you need to add the bin subdirectory of the installation'
echo 'diretory to your PATH which you can do with the command'
echo ''
echo " export PATH=\"$prefix/bin:\$PATH\" (bash)"
echo " setenv PATH $prefix/bin:\${PATH} (tcsh)"
echo ''
fi
|