forked from scwatts/fastspar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
62 lines (48 loc) · 2.19 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
# Initialisation
AC_INIT([fastspar], [0.0.10], [[email protected]])
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([foreign -Wall -Werror])
# Add option for static compilation and option to not use Arma wrapper
AC_ARG_ENABLE([static-compile], AS_HELP_STRING([--enable-static-compile], [Compile static binary; forces --disable-arma-wrapper]),
[case "${enableval}" in
no) static_compile=false ;;
*) static_compile=true ;;
esac], [static_compile=false])
AC_ARG_ENABLE([arma-wrapper], AS_HELP_STRING([--disable-arma-wrapper], [Disables use of the Armadillo wrapper]),
[case "${enableval}" in
*) arma_wrapper=false;;
esac], [arma_wrapper=true])
# Check that the Armadillo runtime library is installed if we need it
AS_IF([test "x$static_compile" = "xfalse" && test "x$arma_wrapper" = "xtrue"],
[AC_CHECK_LIB([armadillo], [main],
[], AC_MSG_ERROR([could not find the library Armadillo]))])
# Set conditionals to use in the Makefile.am
AM_CONDITIONAL([ARMA_DONT_USE_WRAPPER],
[test "x$static_compile" = "xtrue" || test "x$arma_wrapper" = "xfalse"])
AM_CONDITIONAL([STATIC_COMPILE],
[test "x$static_compile" = "xtrue"])
# Check required compilers and utilities
AC_PROG_CXX
AC_PROG_F77
AC_PROG_RANLIB
AM_PROG_AR
# Check dependencies
AC_CHECK_LIB([gomp], [main],
[], [AC_MSG_ERROR([could not find the library OpenMP])])
AC_CHECK_LIB([m], [cos],
[], [AC_MSG_ERROR([could not find the library LibM])])
AC_CHECK_LIB([gslcblas], [cblas_dgemm],
[], [AC_MSG_ERROR([could not find the library GSL \(gslcblas\)])])
AC_CHECK_LIB([gsl], [gsl_ran_dirichlet],
[], [AC_MSG_ERROR([could not find the library GSL])])
AC_CHECK_LIB([quadmath], [quadmath_snprintf],
[], [AC_MSG_ERROR([could not find the library quadmath])])
AC_CHECK_LIB([gfortran], [main],
[], [AC_MSG_ERROR([could not find the library gfortran])])
AX_BLAS([], [AC_MSG_ERROR([could not find the library BLAS])])
# Set libraries as specified by AX_BLAS documentation
LIBS="$BLAS_LIBS $LIBS $FLIBS"
# Set config headers and makefiles
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile src/Makefile tests/Makefile])
AC_OUTPUT