~njansson/dolfin/hpc

237 by logg
Tailorized "2003-09-03 10:04:08 by logg"
1
# Init autoconf
1568 by hoffman
Tailorized "2005-12-22 17:01:51 by hoffman"
2
AC_INIT(dolfin, 0.5.12, dolfin@fenics.org)
237 by logg
Tailorized "2003-09-03 10:04:08 by logg"
3
4
# Init automake
5
AM_INIT_AUTOMAKE($PACKAGE, $VERSION, no-define)
6
7
# Tell automake not to generate Makefile.in unless asked to.
8
# This way the code can be installed on systems without automake installed.
9
AM_MAINTAINER_MODE
10
257 by logg
Tailorized "2003-09-09 15:13:15 by logg"
11
# Option --enable-debug
237 by logg
Tailorized "2003-09-03 10:04:08 by logg"
12
AC_ARG_ENABLE(debug,
13
              AC_HELP_STRING([--enable-debug],
823 by logg
Tailorized "2005-01-27 16:11:10 by logg"
14
                             [Turn on debugging and warnings (this is the default)]),
425 by logg
Tailorized "2004-01-19 15:44:53 by logg"
15
              enable_debug=yes)
237 by logg
Tailorized "2003-09-03 10:04:08 by logg"
16
533 by logg
Tailorized "2004-03-03 08:03:22 by logg"
17
# Option --enable-optimization
18
AC_ARG_ENABLE(optimization,
19
              AC_HELP_STRING([--enable-optimization],
20
                             [Turn on optimization]),
21
              enable_optimization=yes)
22
279 by logg
Tailorized "2003-09-17 11:32:56 by logg"
23
# Option --disable-curses
24
AC_ARG_ENABLE(curses,
25
              AC_HELP_STRING([--disable-curses],
26
                             [Compile without curses]),
970 by logg
Tailorized "2005-03-29 22:30:46 by logg"
27
              disable_curses=yes)
425 by logg
Tailorized "2004-01-19 15:44:53 by logg"
28
1081 by logg
Tailorized "2005-05-23 15:03:21 by logg"
29
# Option --disable-mpi
30
AC_ARG_ENABLE(mpi,
1355 by johanjan
Tailorized "2005-10-24 20:29:09 by johanjan"
31
              AC_HELP_STRING([--disable-mpi],
1081 by logg
Tailorized "2005-05-23 15:03:21 by logg"
32
                             [Compile without MPI (assuming PETSc does not use MPI)]),
33
              disable_mpi=yes)
34
909 by fenics
Tailorized "2005-02-22 20:19:44 by fenics"
35
# Option --with-petsc-dir
920 by johanjan
Tailorized "2005-03-02 15:45:22 by johanjan"
36
AC_ARG_WITH(petsc-dir,
909 by fenics
Tailorized "2005-02-22 20:19:44 by fenics"
37
            AC_HELP_STRING([--with-petsc-dir=<path>],
905 by logg
Tailorized "2005-02-18 17:43:11 by logg"
38
                           [Specify path to PETSc]),
909 by fenics
Tailorized "2005-02-22 20:19:44 by fenics"
39
            [PETSC_DIR=$with_petsc_dir],)
40
1455 by logg
Tailorized "2005-11-15 20:56:35 by logg"
41
# Option --enable-pydolfin
1355 by johanjan
Tailorized "2005-10-24 20:29:09 by johanjan"
42
AC_ARG_ENABLE(pydolfin,
43
              AC_HELP_STRING([--enable-pydolfin],
44
                             [Turn on compilation of PyDOLFIN]),
45
              enable_pydolfin=yes)
46
755 by logg
Tailorized "2004-11-30 04:07:05 by logg"
47
# Standard tests
237 by logg
Tailorized "2003-09-03 10:04:08 by logg"
48
AC_PROG_CC
49
AC_PROG_CXX
50
AC_PROG_RANLIB
51
AC_PROG_AWK
52
AC_PROG_INSTALL
53
AC_PROG_LN_S
54
AC_C_CONST
55
AC_C_INLINE
56
AC_TYPE_SIZE_T
57
1361 by logg
Tailorized "2005-10-25 23:19:15 by logg"
58
# Test for PyDOLFIN
1455 by logg
Tailorized "2005-11-15 20:56:35 by logg"
59
if test x$enable_pydolfin = xyes; then
60
    AM_PATH_PYTHON(2.3)
61
    AC_PYTHON_DEVEL
62
    AC_PROG_SWIG(1.3.25)
63
    SWIG_ENABLE_CXX
64
    SWIG_PYTHON
65
fi
1348 by johanjan
Tailorized "2005-10-24 15:08:07 by johanjan"
66
823 by logg
Tailorized "2005-01-27 16:11:10 by logg"
67
# Make debug option default so developers don't forget it
905 by logg
Tailorized "2005-02-18 17:43:11 by logg"
68
echo "turning on debugging and warnings (use --enable-optimization to avoid this)."
823 by logg
Tailorized "2005-01-27 16:11:10 by logg"
69
enable_debug="yes"
70
755 by logg
Tailorized "2004-11-30 04:07:05 by logg"
71
# Handle option --enable-debug
425 by logg
Tailorized "2004-01-19 15:44:53 by logg"
72
if test x$enable_debug = xyes; then
905 by logg
Tailorized "2005-02-18 17:43:11 by logg"
73
    echo "enabling debugging compiler flags"
1320 by hoffman
Tailorized "2005-10-14 15:04:26 by hoffman"
74
    CXXFLAGS='-DDEBUG=1 -g -O2 -Wall -Werror -ansi -std=c++98'
909 by fenics
Tailorized "2005-02-22 20:19:44 by fenics"
75
    # We should also add -pedantic, but then we get an error when we try
76
    # to include mpio.h (long long not supported by ISO C++)
425 by logg
Tailorized "2004-01-19 15:44:53 by logg"
77
fi
78
755 by logg
Tailorized "2004-11-30 04:07:05 by logg"
79
# Handle option --enable-optimization
534 by logg
Tailorized "2004-03-03 08:05:19 by logg"
80
if test x$enable_optimization = xyes; then
905 by logg
Tailorized "2005-02-18 17:43:11 by logg"
81
    echo "enabling optimizing compiler flags"
968 by logg
Tailorized "2005-03-29 00:15:47 by logg"
82
    CXXFLAGS='-O3 -Wall -Werror -ansi -std=c++98'
533 by logg
Tailorized "2004-03-03 08:03:22 by logg"
83
fi
84
1550 by garth
Tailorized "2005-12-16 14:12:00 by garth"
85
# Add '-Wno-uninitialized' due to a Cygwin gcc 3.4 bug.
1217 by garth
Tailorized "2005-09-09 15:30:11 by garth"
86
if test `uname -o` = Cygwin; then
87
    echo "adding compiler flags for cygwin"
1550 by garth
Tailorized "2005-12-16 14:12:00 by garth"
88
    CXXFLAGS=$CXXFLAGS' -Wno-uninitialized '
1217 by garth
Tailorized "2005-09-09 15:30:11 by garth"
89
fi
90
1307 by johanjan
Tailorized "2005-10-11 16:16:06 by johanjan"
91
# Add '-fPIC' for AMD 64 bit system
92
if test `uname -m` = x86_64; then
93
    echo "adding -fPIC to compiler flags"
94
    CXXFLAGS=$CXXFLAGS' -fPIC'
95
fi
96
755 by logg
Tailorized "2004-11-30 04:07:05 by logg"
97
# Handle option --disable-curses
98
if test x$disable_curses = x; then
905 by logg
Tailorized "2005-02-18 17:43:11 by logg"
99
    echo "enabling curses, use --disable-curses to disable"
425 by logg
Tailorized "2004-01-19 15:44:53 by logg"
100
    AC_SEARCH_LIBS(wbkgdset, ncurses,,
101
                   echo "*** Unable to find ncurses on your system. "
102
                   echo "*** Try ./configure --disable-curses or install ncurses." ; exit 1)
755 by logg
Tailorized "2004-11-30 04:07:05 by logg"
103
    CURSES_CFLAGS=''
104
    CURSES_LIBS='-lncurses'
105
else
970 by logg
Tailorized "2005-03-29 22:30:46 by logg"
106
    echo "disabling curses"
755 by logg
Tailorized "2004-11-30 04:07:05 by logg"
107
    CURSES_CFLAGS='-DNO_CURSES=1'
108
    CURSES_LIBS=''
109
fi
110
909 by fenics
Tailorized "2005-02-22 20:19:44 by fenics"
111
# Handle option --with-petsc-dir=<path>
905 by logg
Tailorized "2005-02-18 17:43:11 by logg"
112
if test x$PETSC_DIR = x; then
910 by fenics
Tailorized "2005-02-22 21:46:01 by fenics"
113
    echo "assuming path to PETSc is /usr/local/lib/petsc"
114
    PETSC_DIR="/usr/local/lib/petsc/"
905 by logg
Tailorized "2005-02-18 17:43:11 by logg"
115
else
116
    echo "using PETSC_DIR=$PETSC_DIR"
117
fi
118
1355 by johanjan
Tailorized "2005-10-24 20:29:09 by johanjan"
119
# Handle option --enable-pydolfin
120
AM_CONDITIONAL(COMPILE_PYDOLFIN, test x$enable_pydolfin = xyes)
121
if test x$enable_pydolfin = xyes; then
122
    echo "enabling compilation of PyDOLFIN"
123
else
124
    echo "disabling compilation of PyDOLFIN"
125
fi
126
755 by logg
Tailorized "2004-11-30 04:07:05 by logg"
127
# Check for PETSc
966 by logg
Tailorized "2005-03-28 22:27:01 by logg"
128
AC_CHECK_PROG(petsc_found, configarch, yes, no, $PATH:$PETSC_DIR/bin)
129
if test $petsc_found = yes; then
130
    # Extract PETSc variables from PETSC_DIR/bmake/common/variables
1147 by logg
Tailorized "2005-07-04 11:30:21 by logg"
131
    PETSC_CFLAGS=`make -s -C $PETSC_DIR getincludedirs PETSC_DIR=$PETSC_DIR`
132
    PETSC_LIBS=`make -s -C $PETSC_DIR getlinklibs PETSC_DIR=$PETSC_DIR`
755 by logg
Tailorized "2004-11-30 04:07:05 by logg"
133
else
1147 by logg
Tailorized "2005-07-04 11:30:21 by logg"
134
    echo "*** Unable to find PETSc 2.3.0 on your system."
966 by logg
Tailorized "2005-03-28 22:27:01 by logg"
135
    echo "*** Use --with-petsc-dir=<path> to specify the correct path for PETSc,"
136
    echo "*** or set the environment variable PETSC_DIR to the correct path."
137
    echo "*** PETSc is available at http://www-unix.mcs.anl.gov/petsc/petsc-2/"
138
    exit 1
755 by logg
Tailorized "2004-11-30 04:07:05 by logg"
139
fi
140
141
# Check for MPI (needed by PETSc)
1081 by logg
Tailorized "2005-05-23 15:03:21 by logg"
142
if test x$disable_mpi = x; then
143
    AC_CHECK_PROG(mpi_found, mpirun, yes, no)
144
    if test $mpi_found = yes; then
145
        DIR=`which mpirun | sed 's/bin\/mpirun/include/'`
146
        if [ test -d $DIR/mpi ]; then
147
            MPI_CFLAGS="-I$DIR/mpi"
148
        else
149
	    MPI_CFLAGS="-I$DIR"
150
        fi
1030 by logg
Tailorized "2005-04-19 19:34:06 by logg"
151
    else
1081 by logg
Tailorized "2005-05-23 15:03:21 by logg"
152
        echo "*** Unable to find MPI on your system."
153
        echo "*** Perhaps you need to install the package mpich?"
154
        exit 1
1030 by logg
Tailorized "2005-04-19 19:34:06 by logg"
155
    fi
755 by logg
Tailorized "2004-11-30 04:07:05 by logg"
156
else
1081 by logg
Tailorized "2005-05-23 15:03:21 by logg"
157
    echo "disabling MPI (might not work if PETSc uses MPI)"
425 by logg
Tailorized "2004-01-19 15:44:53 by logg"
158
fi
159
237 by logg
Tailorized "2003-09-03 10:04:08 by logg"
160
# Check for libxml2
161
AC_CHECK_PROG(libxml2_found, xml2-config, yes, no)
162
if test $libxml2_found = yes; then	  
755 by logg
Tailorized "2004-11-30 04:07:05 by logg"
163
    XML2_CFLAGS=`xml2-config --cflags`
164
    XML2_LIBS=`xml2-config --libs`
237 by logg
Tailorized "2003-09-03 10:04:08 by logg"
165
else
755 by logg
Tailorized "2004-11-30 04:07:05 by logg"
166
    echo "*** Unable to find libxml2 development files on your system."
167
    echo "*** Perhaps you need to install the package libxml2-dev?"
168
    exit 1
237 by logg
Tailorized "2003-09-03 10:04:08 by logg"
169
fi
170
888 by logg
Tailorized "2005-02-14 17:12:38 by logg"
171
# List of DOLFIN module libraries
1399 by johanjan
Tailorized "2005-11-01 20:59:09 by johanjan"
172
DOLFIN_MODULES="elasticity elasticity-updated convdiff navierstokes poisson stokes heat"
888 by logg
Tailorized "2005-02-14 17:12:38 by logg"
173
174
# List of DOLFIN kernel libraries
1553 by logg
Tailorized "2005-12-19 22:45:31 by logg"
175
DOLFIN_KERNEL="common fem form function io la main math mesh nls ode quadrature parameter log"
237 by logg
Tailorized "2003-09-03 10:04:08 by logg"
176
755 by logg
Tailorized "2004-11-30 04:07:05 by logg"
177
# Generate include path for kernel
178
KERNEL_CFLAGS=""
1028 by logg
Tailorized "2005-04-19 16:22:28 by logg"
179
for f in $DOLFIN_KERNEL; do
180
    KERNEL_CFLAGS="$KERNEL_CFLAGS -I\$(top_builddir)/src/kernel/$f"
237 by logg
Tailorized "2003-09-03 10:04:08 by logg"
181
done
755 by logg
Tailorized "2004-11-30 04:07:05 by logg"
182
KERNEL_CFLAGS="$KERNEL_CFLAGS $CURSES_CFLAGS $PETSC_CFLAGS $MPI_CFLAGS $XML2_CFLAGS"
183
AC_SUBST(KERNEL_CFLAGS)
237 by logg
Tailorized "2003-09-03 10:04:08 by logg"
184
1028 by logg
Tailorized "2005-04-19 16:22:28 by logg"
185
# Generate include path for modules
186
MODULE_CFLAGS="$KERNEL_CFLAGS -I\$(top_builddir)/src/modules/"
187
AC_SUBST(MODULE_CFLAGS)
188
237 by logg
Tailorized "2003-09-03 10:04:08 by logg"
189
# Generate include path for main (including also module code)
755 by logg
Tailorized "2004-11-30 04:07:05 by logg"
190
MAIN_CFLAGS=""
1028 by logg
Tailorized "2005-04-19 16:22:28 by logg"
191
for f in $DOLFIN_MODULES; do
192
    MAIN_CFLAGS="$MAIN_CFLAGS -I\$(top_builddir)/src/modules/$f "
237 by logg
Tailorized "2003-09-03 10:04:08 by logg"
193
done
1081 by logg
Tailorized "2005-05-23 15:03:21 by logg"
194
DOLFIN_CFLAGS="$KERNEL_CFLAGS $MAIN_CFLAGS"
195
AC_SUBST(DOLFIN_CFLAGS)
237 by logg
Tailorized "2003-09-03 10:04:08 by logg"
196
197
# Generate library list for linking in the correct order.
755 by logg
Tailorized "2004-11-30 04:07:05 by logg"
198
# FIXME: Not very pretty to list the libraries multiple times
199
DOLFIN_LIBS=""
1028 by logg
Tailorized "2005-04-19 16:22:28 by logg"
200
DIRS="$DOLFIN_MODULES $DOLFIN_KERNEL $DOLFIN_KERNEL $DOLFIN_KERNEL $DOLFIN_KERNEL"
237 by logg
Tailorized "2003-09-03 10:04:08 by logg"
201
for f in $DIRS; do
1028 by logg
Tailorized "2005-04-19 16:22:28 by logg"
202
    DOLFIN_LIBS="$DOLFIN_LIBS -ldolfin-$f"
237 by logg
Tailorized "2003-09-03 10:04:08 by logg"
203
done
909 by fenics
Tailorized "2005-02-22 20:19:44 by fenics"
204
DOLFIN_LIBS="$DOLFIN_LIBS $CURSES_LIBS $PETSC_LIBS $XML2_LIBS"
755 by logg
Tailorized "2004-11-30 04:07:05 by logg"
205
AC_SUBST(DOLFIN_LIBS)
237 by logg
Tailorized "2003-09-03 10:04:08 by logg"
206
755 by logg
Tailorized "2004-11-30 04:07:05 by logg"
207
# Export variables to makefiles
237 by logg
Tailorized "2003-09-03 10:04:08 by logg"
208
AC_SUBST(PACKAGE_VERSION)
209
AC_SUBST(PACKAGE_NAME)
210
1361 by logg
Tailorized "2005-10-25 23:19:15 by logg"
211
# Create Makefiles, seems like automake cannot handle a variable
237 by logg
Tailorized "2003-09-03 10:04:08 by logg"
212
# containing the list of files, so this cannot be done
213
# automatically. We have to list all the files.
214
AC_OUTPUT( Makefile \
215
           src/Makefile \
216
           src/pre/Makefile \
217
           src/kernel/Makefile \
218
           src/kernel/common/Makefile \
219
           src/kernel/common/dolfin/Makefile \
220
           src/kernel/fem/Makefile \
221
           src/kernel/fem/dolfin/Makefile \
381 by logg
Tailorized "2003-11-28 09:30:18 by logg"
222
           src/kernel/function/Makefile \
223
           src/kernel/function/dolfin/Makefile \
334 by hoffman
Tailorized "2003-10-20 23:05:40 by hoffman"
224
           src/kernel/form/Makefile \
225
           src/kernel/form/dolfin/Makefile \
237 by logg
Tailorized "2003-09-03 10:04:08 by logg"
226
           src/kernel/io/Makefile \
227
           src/kernel/io/dolfin/Makefile \
228
           src/kernel/la/Makefile \
229
           src/kernel/la/dolfin/Makefile \
230
           src/kernel/main/Makefile \
231
           src/kernel/main/dolfin/Makefile \
232
           src/kernel/math/Makefile \
233
           src/kernel/math/dolfin/Makefile \
334 by hoffman
Tailorized "2003-10-20 23:05:40 by hoffman"
234
           src/kernel/mesh/Makefile \
235
           src/kernel/mesh/dolfin/Makefile \
1354 by garth
Tailorized "2005-10-24 20:07:32 by garth"
236
           src/kernel/nls/Makefile \
237
           src/kernel/nls/dolfin/Makefile \
334 by hoffman
Tailorized "2003-10-20 23:05:40 by hoffman"
238
           src/kernel/ode/Makefile \
239
           src/kernel/ode/dolfin/Makefile \
1553 by logg
Tailorized "2005-12-19 22:45:31 by logg"
240
           src/kernel/parameter/Makefile \
241
           src/kernel/parameter/dolfin/Makefile \
237 by logg
Tailorized "2003-09-03 10:04:08 by logg"
242
           src/kernel/quadrature/Makefile \
243
           src/kernel/quadrature/dolfin/Makefile \
244
           src/kernel/log/Makefile \
245
           src/kernel/log/dolfin/Makefile \
246
           src/modules/Makefile \
889 by logg
Tailorized "2005-02-15 03:41:20 by logg"
247
           src/modules/dolfin/Makefile \
237 by logg
Tailorized "2003-09-03 10:04:08 by logg"
248
           src/modules/convdiff/Makefile \
876 by hoffman
Tailorized "2005-02-14 10:14:48 by hoffman"
249
           src/modules/convdiff/dolfin/Makefile \
1025 by johanjan
Tailorized "2005-04-19 14:15:06 by johanjan"
250
           src/modules/elasticity/Makefile \
251
           src/modules/elasticity/dolfin/Makefile \
1080 by johanjan
Tailorized "2005-05-20 14:40:00 by johanjan"
252
           src/modules/elasticity-updated/Makefile \
253
           src/modules/elasticity-updated/dolfin/Makefile \
237 by logg
Tailorized "2003-09-03 10:04:08 by logg"
254
           src/modules/navierstokes/Makefile \
897 by hoffman
Tailorized "2005-02-16 15:52:16 by hoffman"
255
           src/modules/navierstokes/dolfin/Makefile \
1240 by logg
Tailorized "2005-09-20 18:38:47 by logg"
256
           src/modules/poisson/Makefile \
257
           src/modules/poisson/dolfin/Makefile \
1399 by johanjan
Tailorized "2005-11-01 20:59:09 by johanjan"
258
           src/modules/heat/Makefile \
259
           src/modules/heat/dolfin/Makefile \
1240 by logg
Tailorized "2005-09-20 18:38:47 by logg"
260
           src/modules/stokes/Makefile \
261
           src/modules/stokes/dolfin/Makefile \
1348 by johanjan
Tailorized "2005-10-24 15:08:07 by johanjan"
262
           src/pydolfin/Makefile \
237 by logg
Tailorized "2003-09-03 10:04:08 by logg"
263
           src/config/Makefile \
264
           src/post/Makefile \
265
           src/demo/Makefile \
1136 by logg
Tailorized "2005-06-28 11:05:37 by logg"
266
           src/demo/fem/Makefile \
1487 by garth
Tailorized "2005-12-01 13:46:40 by garth"
267
           src/demo/nls/Makefile \
237 by logg
Tailorized "2003-09-03 10:04:08 by logg"
268
           src/demo/solvers/Makefile \
558 by hoffman
Tailorized "2004-03-08 18:48:04 by hoffman"
269
           src/demo/solvers/navierstokes/Makefile \
237 by logg
Tailorized "2003-09-03 10:04:08 by logg"
270
           src/demo/solvers/ode/Makefile \
607 by logg
Tailorized "2004-04-04 18:40:38 by logg"
271
           src/demo/solvers/ode/modeling/Makefile \
846 by logg
Tailorized "2005-02-03 16:01:28 by logg"
272
           src/demo/solvers/ode/homotopy/Makefile \
1262 by johanjan
Tailorized "2005-09-29 15:34:03 by johanjan"
273
           src/demo/scripting/Makefile \
237 by logg
Tailorized "2003-09-03 10:04:08 by logg"
274
           src/utils/Makefile \
275
           src/utils/inp2dx/Makefile \
276
           src/greeting/Makefile )
1361 by logg
Tailorized "2005-10-25 23:19:15 by logg"
277
278
# Display some configuration options
279
echo '---------------------------------------------------------'
280
echo 'Configuration of DOLFIN finished. Now type'
281
echo ''
282
echo '   make'
283
echo '   make install'
284
echo ''
285
echo 'to install DOLFIN on your system. After DOLFIN has been'
286
echo 'installed, you can compile all the demo programs in the'
287
echo 'subdirectory src/demo by running'
288
echo ''
289
echo '   make demo'
290
echo ''
291
echo 'Note that you may need to be root in order to install.'
292
echo 'To specify an alternative installation directory, rerun'
293
echo 'configure with option --prefix=<path>. You may also run'
294
echo './configure.local to configure for a local installation'
295
echo 'in the DOLFIN source tree.'
296
echo '---------------------------------------------------------'
297
298
# Check that the installation directory is set up correctly
1550 by garth
Tailorized "2005-12-16 14:12:00 by garth"
299
__BINDIR=`echo $prefix/bin | sed -e 's/\//-/g'`
300
__PATH=`echo $PATH | sed -e 's/\//-/g'`
301
if test "$__PATH" = "`echo $__PATH | sed s/$__BINDIR//`"; then
1361 by logg
Tailorized "2005-10-25 23:19:15 by logg"
302
   echo 'Warning: installation directory is not in PATH.'
303
   echo ''
304
   echo 'To compile a program against DOLFIN (including the demos)'
305
   echo 'you need to add the bin subdirectory of the installation'
306
   echo 'diretory to your PATH which you can do with the command'
307
   echo ''
1405 by johanjan
Tailorized "2005-11-02 12:15:14 by johanjan"
308
   echo "    export PATH=\"$prefix/bin:\$PATH\"        (bash)"
309
   echo "    setenv PATH $prefix/bin:\${PATH}        (tcsh)"
1361 by logg
Tailorized "2005-10-25 23:19:15 by logg"
310
   echo ''
311
fi