File: configure.ac

package info (click to toggle)
bagel 0.0~git20170109-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 114,600 kB
  • sloc: cpp: 1,066,140; python: 1,424; ansic: 674; makefile: 237; php: 29; sh: 25
file content (182 lines) | stat: -rw-r--r-- 8,059 bytes parent folder | download
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
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.69)
AC_INIT([BAGEL], 1.0, [shiozaki@northwestern.edu], [], [http://www.nubakery.org])
AM_INIT_AUTOMAKE
AM_PATH_PYTHON
AC_CONFIG_SRCDIR([src/main.cc])
AC_CONFIG_HEADERS([bagel_config.h])
# since pyconfig.h sometimes needs to be compiled by the C compiler
AC_LANG([C])

AC_PREFIX_DEFAULT(["/usr/local/bagel"])

m4_include([m4/acx_mpi.m4])

AC_PROG_CC([gcc])
AC_PROG_CXX([g++])

AC_ARG_WITH(mpi, [AS_HELP_STRING([--with-mpi],[Use MPI. Please make sure mpicxx and mpif90 are in $PATH])], [with_mpi=$withval], [with_mpi=no])
if test x${with_mpi} = xopenmpi ; then
    echo "..openmpi requested.."
elif test x${with_mpi} = xintel ; then
    echo "..Intel mpi requested.."
elif test x${with_mpi} = xmvapich ; then
    echo "..mvapich requested.."
elif test x${with_mpi} != xno ; then
    AC_MSG_ERROR("Please specify MPI implementation (openmpi, intel, mvapich)")
fi
if test x${with_mpi} != xno; then
    ACX_MPI
    AC_PROG_CC([$MPICC])
    AC_PROG_CXX([$MPICXX])
    LIBS="${MPILIBS} ${LIBS}"
    CXXFLAGS="${CXXFLAGS}"
fi
AX_CXX_COMPILE_STDCXX_11([noext])

LT_INIT([disable-static])
AC_CONFIG_MACRO_DIR([m4])

AC_ARG_WITH([include], [AS_HELP_STRING([--with-include],[include flags])], [with_include=$withval], [with_include=no])
if test "x${with_include}" != xno; then
    CFLAGS="${with_include} ${CFLAGS}"
    CXXFLAGS="${with_include} ${CXXFLAGS}"
    CPPFLAGS="${with_include} ${CPPFLAGS}"
fi

AC_ARG_WITH([slater], [AS_HELP_STRING([--with-slater],[build F12 methods])], [slater=yes], [slater=no])
AC_ARG_WITH([libxc], [AS_HELP_STRING([--with-libxc],[build DFT with libxc])], [libxc=yes], [libxc=no])

#lapack and blas
AC_ARG_ENABLE(mkl, [AS_HELP_STRING([--enable-mkl],[enable MKL extensions.])], [use_mkl=yes], [use_mkl=no])
AC_ARG_ENABLE(scalapack, [AS_HELP_STRING([--disable-scalapack],[disable scalapack.])], [use_scalapack=no], [use_scalapack=yes])

if test "x${use_scalapack}" = xyes; then
    if test "x${with_mpi}" != xno; then
        AH_TEMPLATE([HAVE_SCALAPACK], [a scalapack library will be linked.])
        if test "x${use_mkl}" = xno; then
            AC_CHECK_LIB(scalapack, main,  [AC_DEFINE([HAVE_SCALAPACK]) LIBS="-lscalapack $LIBS"], [AC_MSG_ERROR("Linking against scalapack library failed.")])
        fi
    fi
fi

AX_BOOST_BASE([1.53], [], [AC_MSG_ERROR("BOOST version >= 1.53.0 required.")])

# on some platforms boost shared libs will depend on C++ shared libraries ... switch to C++
AC_LANG_PUSH([C++])

AC_CHECK_LIB(boost_serialization-gcc-mt, main, , [
    AC_CHECK_LIB(boost_serialization-mt, main, , [
        AC_CHECK_LIB(boost_serialization, main, , [
            AC_MSG_ERROR("Linking against boost::serialization library failed.") ])])])
echo -n "checking if boost::serialization works... "
AC_RUN_IFELSE([AC_LANG_PROGRAM([[@%:@include<fstream>
                                 @%:@include<boost/archive/binary_oarchive.hpp>
                                 @%:@include<boost/archive/binary_iarchive.hpp>
                                 @%:@include<boost/serialization/string.hpp>
                                 @%:@include<cstdlib>]],
                               [[std::string s("test");{std::ofstream ofs("config.bagel");boost::archive::binary_oarchive oa(ofs);oa<<s;}
                                 std::string t;        {std::ifstream ifs("config.bagel");boost::archive::binary_iarchive ia(ifs);ia>>t;}
                                 std::system("rm config.bagel");return (t==s?0:1)]])], [serialization_result="yes"], [serialization_result="no"])
echo $serialization_result
if test "x${serialization_result}" = xno; then
AC_MSG_WARN([

test boost::serialization failed. Make sure that boost was compiled by the same compiler.
])
fi
AC_CHECK_LIB(boost_regex-gcc-mt, main, , [
    AC_CHECK_LIB(boost_regex-mt, main, , [
        AC_CHECK_LIB(boost_regex, main, , [
            AC_MSG_ERROR("Linking against boost::regex library failed.") ])])])

AC_CHECK_LIB(boost_unit_test_framework-gcc-mt, main, , [
    AC_CHECK_LIB(boost_unit_test_framework-mt, main, , [
        AC_CHECK_LIB(boost_unit_test_framework, main, , [
            AC_MSG_ERROR("Linking against boost::unit_test_framework library failed.") ])])])


# srootlist.h need to be compiled with C++11
if test "x${slater}" = xyes; then
  AC_CHECK_HEADERS([srootlist.h], [], [AC_MSG_ERROR(["srootlist.h not found"])], [])
  AC_CHECK_LIB(slater, main, , AC_MSG_ERROR(["libslater not found"]))
fi

if test "x${libxc}" = xyes; then
  AC_CHECK_HEADERS([xc.h], [], [AC_MSG_ERROR([xc.h not found or not working])], [])
  AC_CHECK_LIB(xc, main, , AC_MSG_ERROR([libxc not found]))
fi

#toggle for smith
AC_ARG_ENABLE(smith, [AS_HELP_STRING([--enable-smith],[enable SMITH code.])], [compile_smith=yes], [compile_smith=no])
if test "x${compile_smith}" != xno; then
  if test "x${with_mpi}" = xno; then
    AC_MSG_ERROR("SMITH requires MPI")
  fi
  AC_DEFINE([COMPILE_SMITH], [], [Compile SMITH generated code])
fi

AC_LANG_POP()

if test "x${use_mkl}" = xyes; then
    AC_CHECK_HEADERS([mkl.h], [], [AC_MSG_ERROR([mkl.h not found or not working])], [])
    AC_CHECK_LIB([mkl_intel_lp64], main, LIBS="-lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm $LIBS",
        AC_MSG_ERROR([Cannot find Intel Math Kernel Library]), [-lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm])

    if test "x${use_scalapack}" = xyes; then
        if test "x${with_mpi}" = xopenmpi; then
            AC_CHECK_LIB([mkl_scalapack_lp64], main, AC_DEFINE([HAVE_SCALAPACK]) LIBS="-lmkl_scalapack_lp64 -lmkl_blacs_openmpi_lp64 $LIBS",
                [AC_CHECK_LIB(scalapack, main,  [AC_DEFINE([HAVE_SCALAPACK]) LIBS="-lscalapack $LIBS"], [AC_MSG_ERROR("Linking against scalapack library failed.")])],
                [-lmkl_scalapack_lp64 -lmkl_blacs_openmpi_lp64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm])
        elif test "x${with_mpi}" != xno; then
            AC_CHECK_LIB([mkl_scalapack_lp64], main, AC_DEFINE([HAVE_SCALAPACK]) LIBS="-lmkl_scalapack_lp64 -lmkl_blacs_intelmpi_lp64 $LIBS",
                [AC_CHECK_LIB(scalapack, main,  [AC_DEFINE([HAVE_SCALAPACK]) LIBS="-lscalapack $LIBS"], [AC_MSG_ERROR("Linking against scalapack library failed.")])],
                [-lmkl_scalapack_lp64 -lmkl_blacs_intelmpi_lp64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm])
        fi
    fi
fi

# ZGEMM3M is provided by MKL, OpenBLAS and perhaps others.
AC_CHECK_FUNC([zgemm3m_], [AC_DEFINE([HAVE_ZGEMM3M], [1], [Define if zgemm3m_ is present in BLAS .])])

if test "x${with_mpi}" != xno; then
    AC_CHECK_HEADERS([mpi.h], [], [AC_MSG_ERROR([mpi.h not found or not working])], [])
fi

AC_CONFIG_FILES([Makefile
                 src/Makefile
                 src/util/Makefile
                 src/util/input/Makefile
                 src/util/io/Makefile
                 src/util/parallel/Makefile
                 src/util/math/Makefile
                 src/asd/multisite/Makefile
                 src/asd/dimer/Makefile
                 src/asd/dmrg/Makefile
                 src/asd/orbital/Makefile
                 src/asd/Makefile
                 src/wfn/Makefile
                 src/grad/Makefile
                 src/integral/Makefile
                 src/scf/Makefile
                 src/df/Makefile
                 src/prop/Makefile
                 src/smith/Makefile
                 src/molecule/Makefile
                 src/pt2/Makefile
                 src/ci/Makefile
                 src/ci/ciutil/Makefile
                 src/ci/fci/Makefile
                 src/ci/zfci/Makefile
                 src/ci/ras/Makefile
                 src/multi/Makefile
                 src/multi/casscf/Makefile
                 src/multi/zcasscf/Makefile
                 src/mat1e/Makefile
                 src/periodic/Makefile
                 src/opt/Makefile
                 src/alglib/Makefile
                 src/basis/Makefile])
AC_OUTPUT