-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathconfigure.ac
81 lines (66 loc) · 2.83 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
AC_PREREQ(2.59)
# keep version the same in debyer/debyer.ggo and debyer/version.h
AC_INIT([debyer], [0.4], [])
AC_CONFIG_AUX_DIR(build-aux)
AC_CONFIG_SRCDIR([debyer/debyer.c])
AC_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE([1.11 foreign subdir-objects silent-rules -Wall])
AM_MAINTAINER_MODE(enable)
### MPI or not
AC_ARG_ENABLE(mpi, AS_HELP_STRING([--enable-mpi],
[compile for parallel runs using MPI]))
AC_ARG_ENABLE(single, AS_HELP_STRING([--enable-single],
[use single precision for atom coordinates]))
# optional zlib and bzlib libraries
AC_ARG_WITH(zlib, AS_HELP_STRING([--without-zlib],
[disable zlib support (reading .gz files)]))
AC_ARG_WITH(bzlib, AS_HELP_STRING([--without-bzlib],
[disable bzlib support (reading .bz2 files)]))
# We are checking for compilers in the same way as GROMACS does. They say:
# We cannot set that [MPICC] in the PROG_CC macro [...],
# since autoconf checks that the created file can be executed. This would
# fail on platforms where MPI executables can only be run through a batchqueue.
#
# This creates a problem when only mpi compilers are installed. In this case
# use CC and CXX options for configure.
# Checks for programs.
AC_PROG_CC
AC_PROG_CXX
AC_PROG_RANLIB
AM_PROG_AR
AS_IF(test x$enable_mpi = xyes, [
AC_CHECK_PROGS(MPICC, mpicc hcc mpcc mpcc_r mpxlc cmpicc, $CC)
AC_CHECK_PROGS(MPICXX, mpic++ mpiCC mpicxx mpCC hcp mpxlC mpxlC_r cmpic++, $CXX)
# now change the normal cc to the MPI one - see the comment above.
CC=$MPICC
CXX=$MPICXX
AC_MSG_CHECKING([whether the MPI cc command works]) # be paranoid
AC_TRY_LINK([#include <mpi.h>],
[int argc; char **argv; MPI_Init(&argc,&argv);],
AC_MSG_RESULT([yes]),
AC_MSG_ERROR([Cannot compile and link MPI code with $CC]))
AC_DEFINE(USE_MPI, 1, [Make a parallel version of Debyer using MPI])
],[
AC_OPENMP
])
if test x$enable_single = xyes; then
AC_DEFINE(USE_SINGLE, 1, [Use single precision for atom coordinates])
fi
AC_SEARCH_LIBS(cos, m, , AC_MSG_ERROR([no math library]))
if test x$with_zlib != xno; then
AC_CHECK_LIB(z, gzopen, , AC_MSG_ERROR([
zlib library was not found.
Either use flag --without-zlib or install the library.]))
AC_CHECK_HEADER(zlib.h, [dummy=yes], AC_MSG_ERROR([
zlib.h header was not found. Either use flag --without-zlib or install
the zlib library including header files.]))
fi
if test x$with_bzlib != xno; then
AC_CHECK_LIB(bz2, BZ2_bzReadOpen, , AC_MSG_ERROR([
bzlib library was not found.
Either use flag --without-bzlib or install the library.]))
AC_CHECK_HEADER(bzlib.h, [dummy=yes], AC_MSG_ERROR([
bzlib.h header was not found. Either use flag --without-bzlib or install
bzlib library including header files.]))
fi
AC_OUTPUT(Makefile debyer/Makefile)