1
# Copyright (C) 2006 Imperial College London and others.
3
# Please see the AUTHORS file in the main source directory for a full list
4
# of copyright holders.
7
# Applied Modelling and Computation Group
8
# Department of Earth Science and Engineering
9
# Imperial College London
11
# amcgsoftware@imperial.ac.uk
13
# This library is free software; you can redistribute it and/or
14
# modify it under the terms of the GNU Lesser General Public
15
# License as published by the Free Software Foundation,
16
# version 2.1 of the License.
18
# This library is distributed in the hope that it will be useful,
19
# but WITHOUT ANY WARRANTY; without even the implied warranty of
20
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21
# Lesser General Public License for more details.
23
# You should have received a copy of the GNU Lesser General Public
24
# License along with this library; if not, write to the Free Software
25
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
28
dnl Process this file with autoconf to produce a configure script.
29
AC_INIT(vtkfortran.cpp)
30
AC_CONFIG_HEADERS(config.h)
32
echo "Hostname: `hostname`"
34
# Store enviroment variables
35
AC_ARG_ENABLE(debugging,
36
[AC_HELP_STRING([--enable-debugging],
37
[turns on debugging flags])])
42
# Set fortran compiler
43
AC_PROG_FC(ifort ifc efc sunf95 gfortran pgf95 pathf95 g95 f90,,f90,$PATH)
45
fccompiler=`basename $FC`
47
AC_PROG_CXX(icpc icc ecc sunCC pgCC g++ CC)
58
# Check for standard libraries
60
AC_CHECK_LIB(stdc++,main,,)
61
AC_CHECK_LIB(m,main,,)
62
AC_CHECK_LIB(pthread,main,,)
65
[AC_HELP_STRING([--enable-shared],
66
[Compile objects with -fPIC to enable the 'make shared' target.])])
67
if test "$enable_shared" = "yes" ; then
69
CXXFLAGS="$CXXFLAGS $PIC_FLAG"
70
FCFLAGS="$FCFLAGS $PIC_FLAG"
76
## What fortran compiler options work
78
if test "$FC" = "g95"; then
79
FCFLAGS="-ffast-math -fno-second-underscore $FCFLAGS"
82
if test "$FC" == "gfortran" || test "$FC" == "gfortran-4.4"; then
88
if test "$USING_GFORTRAN" = "yes"; then
89
if test "$enable_debugging" = "yes" ; then
90
FCFLAGS="-frecord-marker=4 $FCFLAGS"
92
FCFLAGS="-ffast-math -frecord-marker=4 $FCFLAGS"
94
cat >> confdefs.h << EOF
95
#define USING_GFORTRAN 1
100
AC_CHECK_PROG(MAKE, gmake, gmake, make, $PATH)
102
# Set default for ARFLAGS, since autoconf does not have a macro for
103
# it. This allows people to set it when running configure or make.
104
AC_CHECK_PROG(AR, ar, ar, ,$PATH)
105
test -n "$ARFLAGS" || ARFLAGS="cr"
108
AC_ARG_ENABLE(verbose,
109
[AC_HELP_STRING([--enable-verbose],
110
[turns on super verbosity])])
112
if test "$enable_verbose" = "yes" ; then
113
cat >> confdefs.h << EOF
114
#define VERBOSE_MESSAGES 1
118
if test "$enable_debugging" = "yes" ; then
119
CXXFLAGS="-g -O0 `echo $CXXFLAGS | sed 's/-O2//g'`"
120
FCFLAGS="-g -O0 `echo $FCFLAGS | sed 's/-O2//g'`"
121
cat >> confdefs.h << EOF
127
AC_MSG_CHECKING(what voodoo is required to get 64 bit reals....)
129
AC_LANG_PUSH([Fortran])
130
old_fcflags="$FCFLAGS"
131
if test -z "$FORTRAN_REAL_8" ; then
133
FORTRAN_REAL_8="-fdefault-real-8"
134
FCFLAGS="$FCFLAGS $FORTRAN_REAL_8"
135
AC_RUN_IFELSE([AC_LANG_PROGRAM([], [
140
if(kind(a).ne.kind(b)) then
144
[AC_MSG_RESULT($FORTRAN_REAL_8)],
145
[FCFLAGS="$old_fc_flags" ; FORTRAN_REAL_8=""])
146
FCFLAGS="$old_fcflags"
148
if test -z "$FORTRAN_REAL_8" ; then
149
# Intel compiler suite
151
FCFLAGS="$FCFLAGS $FORTRAN_REAL_8"
152
AC_RUN_IFELSE([AC_LANG_PROGRAM([], [
157
if(kind(a).ne.kind(b)) then
161
[AC_MSG_RESULT($FORTRAN_REAL_8)],
162
[FCFLAGS="$old_fc_flags" ; FORTRAN_REAL_8=""])
163
FCFLAGS="$old_fcflags"
165
if test -z "$FORTRAN_REAL_8" ; then
167
FORTRAN_REAL_8="-xtypemap=real:64,double:64"
168
FCFLAGS="$FCFLAGS $FORTRAN_REAL_8"
169
AC_RUN_IFELSE([AC_LANG_PROGRAM([], [
174
if(kind(a).ne.kind(b)) then
178
[AC_MSG_RESULT($FORTRAN_REAL_8)],
179
[FCFLAGS="$old_fc_flags" ; FORTRAN_REAL_8=""])
180
FCFLAGS="$old_fcflags"
182
if test -z "$FORTRAN_REAL_8" ; then
184
old_fcflags="$FCFLAGS"
186
FORTRAN_REAL_8="-Mr8"
187
FCFLAGS="$FCFLAGS $FORTRAN_REAL_8"
188
AC_RUN_IFELSE([AC_LANG_PROGRAM([], [
193
if(kind(a).ne.kind(b)) then
197
[AC_MSG_RESULT($FORTRAN_REAL_8)],
198
[FCFLAGS="$old_fc_flags" ; FORTRAN_REAL_8=""])
200
if test -z "$FORTRAN_REAL_8" ; then
201
AC_MSG_ERROR(none found)
204
AC_LANG_POP([Fortran])
206
AC_ARG_ENABLE(real-8,
207
[AC_HELP_STRING([--enable-real-8],
208
[Compile for 8 byte reals.])])
209
if test "x$enable_real_8" = "yes" ; then
210
cat >> confdefs.h << EOF
214
if test "x$enable_real_8" = "xno"
217
AC_MSG_NOTICE([Selecting 4 byte floating point numbers])
219
AC_MSG_NOTICE([Turning on double 8 byte floating point numbers])
220
if test -n "$enable_real_8" ; then
221
if test "$enable_real_8" != "yes" ; then
222
FORTRAN_REAL_8="$enable_real_8"
227
cat >> confdefs.h << EOF
230
FFLAGS="$FFLAGS $FORTRAN_REAL_8"
231
FCFLAGS="$FCFLAGS $FORTRAN_REAL_8"
234
##########################################
236
##########################################
242
[AC_HELP_STRING([--enable-mpi],
243
[turns on MPI support])])
245
# various synonyms accepted to disable MPI
246
if test "$with_mpi" = no ; then enable_mpi=no; fi
247
if test "$with_MPI" = no ; then enable_mpi=no; fi
248
if test "$enable_MPI" = no ; then enable_mpi=no; fi
249
if test "$enable_mpi" != "no" ; then
250
AC_CHECK_PROGS(MPIF90, mpif90 mpf90, $FC, $PATH)
251
AC_CHECK_PROGS(MPICXX, mpicxx mpiCC mpCC, $CXX, $PATH)
256
AC_MSG_CHECKING([if we can compile and link without using -lmpi])
263
MPI_Initialized(&flag);
274
AC_MSG_WARN([mpi disabled])
278
if test "$check_for_lmpi" = "yes" ; then
279
AC_MSG_CHECKING([if we can compile and link using -lmpi])
286
MPI_Initialized(&flag);
289
LIBS="$LIBS $LIBS_bck"
294
check_for_mpich="yes"
298
if test "$check_for_mpich" = "yes" ; then
299
AC_MSG_CHECKING([if we can compile and link using mpich libs])
303
CPPFLAGS_bck="$CPPFLAGS"
304
CPPFLAGS="$CPPFLAGS $MPICH_INCLUDES"
310
MPI_Initialized(&flag);
313
LIBS="$LIBS $LIBS_bck"
318
CPPFLAGS="$CPPFLAGS_bck"
322
if test "$mpi" = "yes" ; then
323
cat >> confdefs.h << EOF
325
#define HAVE_MPI_CXX 1
326
#define _MPI_CPP_BINDINGS 1
330
AC_MSG_WARN([no mpi support found on system])
334
AC_SUBST(OPTIMIZATION_FFLAGS)
337
dnl Specific -D options
344
vtk_header_relative_path=""
345
AC_ARG_ENABLE(vtk,[AC_HELP_STRING([--enable-vtk], [Only use to disable vtk])])
346
# various synonyms accepted for disabling VTK
347
if test "$with_vtk" = no ; then enable_vtk=no; fi
348
if test "$with_VTK" = no ; then enable_vtk=no; fi
349
if test "$enable_VTK" = no ; then enable_vtk=no; fi
350
if test "$enable_vtk" != "no" ; then
351
AC_MSG_NOTICE([Checking for VTK automagic.])
355
#include <vtkVersion.h>
356
#include <vtkUnstructuredGrid.h>
359
vtkVersion::GetVTKMajorVersion();
360
vtkUnstructuredGrid *ug=vtkUnstructuredGrid::New();
364
AC_MSG_NOTICE([VTK automagic works.])
365
CPPFLAGS="$CPPFLAGS -DHAVE_VTK"
370
AC_MSG_NOTICE([No VTK automagic])
374
if test "x$search_for_vtk" == "xyes" ; then
375
# Usually the location of the libraries is not a mystery. The
376
# header files are another matter.
377
AC_CHECK_LIB(dl, main)
378
AC_CHECK_LIB(vtksys, main)
379
AC_CHECK_LIB(vtkCommon, main, [],
380
[if test "x$VTK_LIBS" != "x" ; then
381
LIBS="$LIBS -L$VTK_LIBS"
382
unset ac_cv_lib_vtkCommon_main
383
AC_CHECK_LIB(vtkCommon, main, [],
385
AC_MSG_ERROR([Cannot find vtk installation.])
389
AC_MSG_ERROR([Cannot find vtk installation.])
393
AC_CHECK_LIB(vtkzlib, main)
394
AC_CHECK_LIB(vtkexpat, main)
395
AC_CHECK_LIB(vtkFiltering, main)
396
AC_CHECK_LIB(vtkGraphics, main)
397
AC_CHECK_LIB(vtkIO, main)
399
# check at the usual places:
400
for i in $(ls -d /usr/include/vtk*) $VTK_INCLUDE; do
401
if test -r $i/vtkCellData.h; then
402
CPPFLAGS="-I$i $CPPFLAGS"
405
AC_CHECK_HEADER(vtkCellData.h,
406
[CPPFLAGS="$CPPFLAGS -DHAVE_VTK=1"
409
[AC_CHECK_HEADER(vtk-5.0/vtkCellData.h,
410
[CPPFLAGS="$CPPFLAGS -DHAVE_VTK=1"
412
vtk_header_relative_path="vtk-5.0/"
415
AC_MSG_ERROR([Cannot find vtk installation.])
421
cat > include/vtk.h <<EOF
426
#include <${vtk_header_relative_path}vtkBMPWriter.h>
427
#include <${vtk_header_relative_path}vtkCellData.h>
428
#include <${vtk_header_relative_path}vtkCellDataToPointData.h>
429
#include <${vtk_header_relative_path}vtkCellDerivatives.h>
430
#include <${vtk_header_relative_path}vtkCell.h>
431
#include <${vtk_header_relative_path}vtkCellType.h>
432
#include <${vtk_header_relative_path}vtkClipDataSet.h>
433
#include <${vtk_header_relative_path}vtkContourGrid.h>
434
#include <${vtk_header_relative_path}vtkDataArray.h>
435
#include <${vtk_header_relative_path}vtkDataObject.h>
436
#include <${vtk_header_relative_path}vtkDataSet.h>
437
#include <${vtk_header_relative_path}vtkDataSetReader.h>
438
#include <${vtk_header_relative_path}vtkDoubleArray.h>
439
#include <${vtk_header_relative_path}vtkFloatArray.h>
440
#include <${vtk_header_relative_path}vtkGenericCell.h>
441
#include <${vtk_header_relative_path}vtkHexahedron.h>
442
#include <${vtk_header_relative_path}vtkIdList.h>
443
#include <${vtk_header_relative_path}vtkImageData.h>
444
#include <${vtk_header_relative_path}vtkIntArray.h>
445
#include <${vtk_header_relative_path}vtkPointData.h>
446
#include <${vtk_header_relative_path}vtkPointLocator.h>
447
#include <${vtk_header_relative_path}vtkPolyData.h>
448
#include <${vtk_header_relative_path}vtkShortArray.h>
449
#include <${vtk_header_relative_path}vtkStructuredGrid.h>
450
#include <${vtk_header_relative_path}vtkTetra.h>
451
#include <${vtk_header_relative_path}vtkUnsignedCharArray.h>
452
#include <${vtk_header_relative_path}vtkUnsignedIntArray.h>
453
#include <${vtk_header_relative_path}vtkUnstructuredGrid.h>
454
#include <${vtk_header_relative_path}vtkUnstructuredGridReader.h>
455
#include <${vtk_header_relative_path}vtkXMLImageDataWriter.h>
456
#include <${vtk_header_relative_path}vtkXMLPolyDataWriter.h>
457
#include <${vtk_header_relative_path}vtkXMLPUnstructuredGridReader.h>
458
#include <${vtk_header_relative_path}vtkXMLPUnstructuredGridWriter.h>
459
#include <${vtk_header_relative_path}vtkXMLStructuredGridWriter.h>
460
#include <${vtk_header_relative_path}vtkXMLUnstructuredGridReader.h>
461
#include <${vtk_header_relative_path}vtkXMLUnstructuredGridWriter.h>
462
#include <${vtk_header_relative_path}vtkZLibDataCompressor.h>
464
#ifndef vtkFloatingPointType
465
#define vtkFloatingPointType vtkFloatingPointType
466
typedef float vtkFloatingPointType;
474
AC_SUBST(MODINC_FLAG)
476
# It appears this is not good practice but...go sue me
477
#cat confdefs.h | grep -v std > include/confdefs.h <-- see below...
478
cat confdefs.h | grep DOUBLEP > include/confdefs.h
479
cat confdefs.h | grep F77_FUNC >> include/confdefs.h
480
cat confdefs.h | grep VTK >> include/confdefs.h
481
cat confdefs.h | grep MPI >> include/confdefs.h
482
cat confdefs.h | grep "^#[dua][enl][fdl][ieo][nfw]" >> include/confdefs.h