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 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413
|
define([libint_mmm_version],[2.3.0])
define([libint_buildid],[beta.3])
define([libint_so_version],[2:2:0])
dnl --------- Begin ---------
dnl Process this file with autoconf to produce a configure script.
define([AC_CACHE_LOAD], )dnl for debugging configure.in
define([AC_CACHE_SAVE], )dnl for debugging configure.in
AC_PREREQ(2.57)
AC_INIT([Libint2],[libint_mmm_version],[libint@valeyev.net],[libint2])
AC_CONFIG_SRCDIR(include/libint2.h)
AC_CONFIG_HEADER(include/libint2/config.h)
AC_CONFIG_AUX_DIR(bin)
AC_CONFIG_MACRO_DIR([lib/autoconf])
dnl --- Can only compile in-place!!! ---
abs_builddir=`pwd -P`
rel_srcdir=`dirname $0`
abs_srcdir=`cd $rel_srcdir; pwd -P`
if test "X$abs_builddir" != "X$abs_srcdir"; then
AC_MSG_ERROR([** Only in-place build is supported for exported libraries!])
fi
dnl --- Compiling C++ only ---
AC_LANG(C++)
AC_CANONICAL_TARGET
define([default_prefix_dash],ifelse(libint_buildid, ,[],[-]))
define([default_prefix],"/usr/local")
LIBINT_MMM_VERSION=libint_mmm_version
LIBINT_BUILDID=libint_buildid
AC_SUBST(LIBINT_MMM_VERSION)
AC_SUBST(LIBINT_BUILDID)
changequote(<<, >>)dnl
LIBINT_MAJOR_VERSION=`echo $LIBINT_MMM_VERSION|sed 's/\([0-9]*\)\.[0-9]*\.[0-9]*/\1/'`
LIBINT_MINOR_VERSION=`echo $LIBINT_MMM_VERSION|sed 's/[0-9]*\.\([0-9]*\)\.[0-9]*/\1/'`
LIBINT_MICRO_VERSION=`echo $LIBINT_MMM_VERSION|sed 's/[0-9]*\.[0-9]*\.\([0-9]*\)/\1/'`
changequote([, ])dnl
AC_SUBST(LIBINT_MAJOR_VERSION)
AC_SUBST(LIBINT_MINOR_VERSION)
AC_SUBST(LIBINT_MICRO_VERSION)
LIBINT_SO_VERSION=libint_so_version
AC_SUBST(LIBINT_SO_VERSION)
dnl --------- Features ---------
AC_ARG_ENABLE(debug,
[ --enable-debug Compile with debugging options],
[
case $enableval in
yes)
DEBUG=yes
;;
no)
DEBUG=no
;;
opt)
DEBUG=opt
;;
*)
AC_MSG_ERROR([Invalid value for --enable-debug ($enableval)])
;;
esac
],[
DEBUG=no
]
)
BUILDID="libint_buildid"
AC_ARG_WITH(build-id,
[ --with-build-id Gives an identifier for the build.],
BUILDID=$withval
)
AC_SUBST(BUILDID)
AC_DEFINE_UNQUOTED(LIBINT2_BUILDID,"$BUILDID")
if test "$BUILDID"; then
LIBINT_VERSION="$LIBINT_MMM_VERSION-$BUILDID"
else
LIBINT_VERSION="$LIBINT_MMM_VERSION"
fi
AC_DEFINE_UNQUOTED(LIBINT2_VERSION, "$LIBINT_VERSION")
AC_SUBST(LIBINT_VERSION)
ac_default_prefix="/usr/local/libint/$LIBINT_VERSION"
AC_ARG_WITH(cxx,
[ --with-cxx Gives the name of the C++ compiler to use.],
CXX=$withval
)
CXXFLAGS_OPT=
AC_ARG_WITH(cxx-optflags,
[ --with-cxx-optflags Gives optimization flags for the C++ compiler.],
if test "X$withval" != "Xyes" -a "X$withval" = "Xno"; then
CXXFLAGS_OPT=$withval
fi
)
AC_ARG_WITH(ranlib,
[ --with-ranlib Gives the name of the ranlib program.],
RANLIB=$withval
)
AC_ARG_WITH(ar,
[ --with-ar Names the archive creator.],
AR=$withval
)
ARFLAGS=r
AC_ARG_WITH(ar-flags,
[ --with-ar-flags Flags for the the archive creator.],
ARFLAGS=$withval
)
AC_SUBST(ARFLAGS)
AC_ARG_WITH(ld,
[ --with-ld Names the object linker.],
LD=$withval
)
libintincludedir=$includedir
AC_ARG_WITH(libint-includedir,
[ --with-libint-includedir Specifies include file install subdir.],
libintincludedir=$withval
)
AC_SUBST(libintincludedir)
AC_ARG_WITH(incdirs,
[ --with-incdirs Specifies include directories (-Idir1 -Idir2).],
EXTRAINCDIRS=$withval
CPPFLAGS=$withval
echo Using extra include directories: $withval
)
AC_ARG_WITH(libs,
[ --with-libs Specifies libraries (-llib1 -llib2).],
LIBS=$withval
echo Using extra libraries: $withval
)
AC_ARG_WITH(libdirs,
[ --with-libdirs Specifies library directories (-Ldir1 -Ldir2).],
LIBDIRS=$withval
LDFLAGS=$withval
echo Using extra library directories: $withval
)
PKGCONFIGDIR='$(libdir)/pkgconfig'
AC_ARG_WITH(pkgconfigdir,
[ --with-pkgconfigdir Specifies the location to put pkg-config's data file. Default is $(libdir)/pkgconfig.],
PKGCONFIGDIR=$withval
)
AC_SUBST(PKGCONFIGDIR)
dnl --------- Want absolute path for srcdir, not relative. ---------
if test X$ac_srcdir_defaulted = Xyes; then
case $srcdir in
../*)
srcdir=`(cd $srcdir; pwd)`
#srcdir=`(cd $srcdir; echo $PWD)`
;;
esac
fi
dnl --------- Checks for programs. ---------
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_PROG_RANLIB
# if not given a C++ compiler
if test "X$CXX" = "X"; then
AC_MSG_WARN([No C++ compiler was given! Will try to find one, but not guaranteed to be the best choice...])
AC_CHECK_PROGS(CXX, clang++ icpc xlC_r g++ c++ CC, g++)
fi
# discard CXXFLAGS provided by the C++ detection macros
initial_CXXFLAGS="$CXXFLAGS"
AC_PROG_CXX
AC_PROG_CXXCPP
CXXFLAGS="$initial_CXXFLAGS"
AC_CHECK_PROG(AR,ar,ar)
dnl -------- Checks for compiler/linker options. ----------
# set the optimization default if neither CXXFLAGS or --with-*-optflags were given
if test "X$CXXFLAGS_OPT" = X -a "X$CXXFLAGS" = X; then
AC_MSG_WARN([C++ optimization options are not given! For optimum performance give CXXFLAGS or use --with-cxx-optflags configure option])
CXXFLAGS_OPT="-O2 -DNDEBUG"
fi
# options needed only for debugging
CXXFLAGS_DBG=-g
# options that are always needed
CXXFLAGS_MISC=
# now form CXXFLAGS ...
if test $DEBUG = yes; then
CXXFLAGS="$CXXFLAGS $CXXFLAGS_DBG $CXXFLAGS_MISC"
LDFLAGS="$LDFLAGS -g"
elif test $DEBUG = opt; then
CXXFLAGS="$CXXFLAGS $CXXFLAGS_DBG $CXXFLAGS_OPT $CXXFLAGS_MISC"
LDFLAGS="$LDFLAGS -g"
else
CXXFLAGS="$CXXFLAGS $CXXFLAGS_OPT $CXXFLAGS_MISC"
fi
OBJSUF=o
LIBSUF=a
dnl -- check how dependency information is built --
# The GNU compilers work with:
CXXDEPENDSUF=none
CXXDEPENDFLAGS=-M
/bin/rm -f depcheck.u depcheck.c depcheck.o
# Check for an IBM visual age C++ compiler
echo "#include <iostream>" > depcheck.cc
$CXX $CPPFLAGS $CXXFLAGS -M -E depcheck.cc > /dev/null 2>&1
if test -f depcheck.u; then
CXXDEPENDSUF=u
CXXDEPENDFLAGS="-M -E"
fi
/bin/rm -f depcheck.u depcheck.c depcheck.o
dnl -- special architecture options --
if test "X$CXXFLAGS_OPT" = X; then
AC_MSG_WARN([C++ optimization options are not given! For optimum performance use --with-cxx-optflags configure option])
fi
dnl -- language options --
ACX_CHECK_CPP11_GENERAL
AC_SUBST(LIBINT_HAS_CXX11,$acx_have_cxx11)
dnl ------------------ Check for Eigen library -----------------------
ACX_CHECK_EIGEN
if test "X$acx_have_eigen" = "Xyes"; then
AC_SUBST(LIBINT_HAS_EIGEN,$acx_have_eigen)
fi
dnl -- other options --
AC_MSG_CHECKING([GNU c++ library/template flags])
if test X$GXX = Xyes; then
AC_MSG_RESULT([GNU])
else
case $target in
*)
AC_MSG_RESULT([generic non GNU])
;;
esac
fi
AC_SUBST(EXTRAINCLUDE)
AC_SUBST(CXX)
AC_SUBST(CXXFLAGS)
AC_SUBST(LIBDIRS)
AC_SUBST(LD)
AC_SUBST(LDFLAGS)
AC_SUBST(OBJSUF)
AC_SUBST(LIBSUF)
AC_SUBST(CXXDEPENDSUF)
AC_SUBST(CXXDEPENDFLAGS)
dnl -------- Checks for architecture specific features. --------
dnl (Doesn't work for cross compilation.)
dnl AC_CHECK_SIZEOF(void*)
AC_SUBST(EXTRADEFINES)
dnl ---------- Checks for header files. -----------
AC_HEADER_STDC
AC_CHECK_HEADERS(limits.h stdint.h)
dnl -- Checks for typedefs, structures, and compiler characteristics. --
AC_TYPE_SIZE_T
dnl ---------- Check for posix_memalign ----------------------
AC_CHECK_FUNC(posix_memalign,[have_posix_memalign=1 AC_DEFINE(HAVE_POSIX_MEMALIGN)],[have_posix_memalign=0])
if test "X$have_posix_memalign" != "X0"; then
# control memory alignment if posix_memalign is found
# if vectorization is off (default) then let the default alignment be determined by the system
# if vectorization is on then the default alignment is veclen * sizeof(LIBINT2_REALTYPE)
# see default_params.cc to see this logic in action
LIBINT_ALIGN_SIZE=default # this will be interpreted as "use the default alignment"
AC_ARG_WITH(align-size,
[ --with-align-size (EXPERT) if posix_memalign is available, this will specify alignment of Libint data, in units of sizeof(LIBINT2_REALTYPE). Default is to use built-in heuristics.],
[
if test "X$withval" != "Xdefault"; then
LIBINT_ALIGN_SIZE=$withval
if test $LIBINT_ALIGN_SIZE -lt 1; then
AC_MSG_ERROR([Invalid alignment: $LIBINT_ALIGN_SIZE])
fi
fi
]
)
if test "X$LIBINT_ALIGN_SIZE" != "Xdefault"; then
AC_MSG_RESULT([will use custom memory alignment: $LIBINT_ALIGN_SIZE * sizeof(LIBINT2_REALTYPE)])
else
LIBINT_ALIGN_SIZE=0
fi
AC_DEFINE_UNQUOTED(LIBINT2_ALIGN_SIZE,[$LIBINT_ALIGN_SIZE])
else # no posix_memalign = death
echo "did not find posix_memalign ... this SHOULD NOT happen. Cannot proceed."
exit 1
fi
dnl ------------------ Check for real type. If given, check if it is usable -----------------------
AC_ARG_WITH(real-type,
[ --with-real-type Compute all integrals using the given real type.],
[
AC_DEFINE_UNQUOTED(LIBINT2_REALTYPE,[$withval])
libint_user_defined_real=$withval
AC_MSG_RESULT([Using real type: $withval])
],
[
AC_DEFINE_UNQUOTED(LIBINT2_REALTYPE,[double])
]
)
# extra includes may be needed in that case!
if test "X$libint_user_defined_real" != "X"; then
copy_CXX=$CXX
copy_CXXFLAGS=$CXXFLAGS
CXXFLAGS="$CXXFLAGS -Iinclude"
AC_ARG_WITH(real-type-includes,
[ --with-real-type-includes Additional includes necessary to use the real type (default: none).],
[
AC_DEFINE_UNQUOTED(LIBINT2_REALTYPE_INCLUDES,"$withval")
libint_user_defined_real_includes=$withval
]
)
AC_MSG_CHECKING([if Libint real type is usable])
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <libint2/util/vector.h>
$libint_user_defined_real_includes
]],
[[
$libint_user_defined_real x1;
$libint_user_defined_real x2 = 2.0;
$libint_user_defined_real x3 = x2;
$libint_user_defined_real x4 = x2 + x3;
$libint_user_defined_real x5 = x2 - x3;
$libint_user_defined_real x6 = x2 * x3;
$libint_user_defined_real x7 = 2 * x2;
$libint_user_defined_real x8 = x2 * 3;
x6 += x2 * x3;
x7 -= 3 * x3;
]]
)
],
[AC_MSG_RESULT([yes])
],
[AC_MSG_RESULT([no])
AC_MSG_ERROR([[Libint real type is not usable, perhaps extra -I directories or extra #include's are needed?]])
]
)
CXXFLAGS="$copy_CXXFLAGS"
fi
CPPFLAGS="$CPPFLAGS" \
LD="$LD" LDFLAGS="$LDFLAGS" LIBS="-lm $LIBS $FLIBS" \
LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB"
dnl --------- expand some variables -----------
DATADIR_ABSOLUTE=`eval echo $datarootdir`/libint/$LIBINT_VERSION
echo $DATADIR_ABSOLUTE
AC_SUBST(DATADIR_ABSOLUTE)
dnl --------- Check for documentation tools ---------
AC_PATH_PROG(DOXYGEN,doxygen,,$PATH:/usr/local/bin:/opt/local/bin)
AC_PATH_PROG(PDFLATEX,pdflatex,,$PATH:/usr/local/bin:/opt/local/bin)
AC_PATH_PROG(PSLATEX,pslatex,,$PATH:/usr/local/bin:/opt/local/bin)
AC_PATH_PROG(DVIPS,dvips,,$PATH:/usr/local/bin:/opt/local/bin)
AC_PATH_PROG(LATEX,latex,,$PATH:/usr/local/bin:/opt/local/bin)
AC_PATH_PROG(LATEX2HTML,latex2html,,$PATH:/usr/local/bin:/opt/local/bin)
AC_PATH_PROG(BIBTEX,bibtex,,$PATH:/usr/local/bin:/opt/local/bin)
AC_CHECK_PROGS(PYTHON,python python3 python2 python2.7,python)
dnl --------- Shared library configuration. ---------
dnl by default make only static libraries
LT_INIT([disable-shared])
LT_LANG([C++])
OBJSUF=lo
LIBSUF=la
ENABLESHARED=yes
AC_SUBST(ENABLESHARED)
AC_CONFIG_FILES(MakeVars MakeRules MakeSuffixRules doc/Makefile include/libint2/basis.h libint2.pc)
dnl --------- Done! ---------
AC_OUTPUT
|