forked from gyzhao060/sparselab
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
118 lines (95 loc) · 3.79 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
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
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
#-------------------------------------------------------------------------------
AC_PREREQ([2.69])
AC_INIT([Sparselab], [0.0.1], [[email protected]])
AC_CONFIG_SRCDIR([src/mfista/blas.h])
#-------------------------------------------------------------------------------
# Checks for programs.
#-------------------------------------------------------------------------------
# C Compiler
: ${CFLAGS=""}
AC_PROG_CC
# Fortran Compiler
: ${FCFLAGS=""}
AC_PROG_FC
# CPP Compiler
: ${CXXFLAGS=""}
AC_PROG_CXX
# f2py in numpy
AC_CHECK_PROGS([F2PY],
[f2py],
[f2py])
AC_LANG([Fortran])
#-------------------------------------------------------------------------------
# PKG CONFIG
#-------------------------------------------------------------------------------
PKG_PROG_PKG_CONFIG
PKG_CONFIG="$PKG_CONFIG --static"
PKG_CHECK_MODULES(OPENBLAS, openblas)
AC_MSG_RESULT("CFLAGS: $OPENBLAS_CFLAGS")
AC_MSG_RESULT("LIBS: $OPENBLAS_LIBS")
#-------------------------------------------------------------------------------
# Check FFTW3
#-------------------------------------------------------------------------------
PKG_CHECK_MODULES(FFTW3, fftw3)
AC_MSG_RESULT("CFLAGS: $FFTW3_CFLAGS")
AC_MSG_RESULT("LIBS: $FFTW3_LIBS")
AC_LANG_PUSH(C)
CFLAGS_tmp=$CFLAGS
CFLAGS="$FFTW3_CFLAGS"
AC_CHECK_LIB(fftw3_omp $FFTW3_LIBS -fopenmp, fftw_init_threads,
[FFTW3TH_LIBS="-lfftw3_omp"],
[AC_CHECK_LIB(fftw3_threads $FFTW3_LIBS -lpthread, fftw_init_threads,
[FFTW3TH_LIBS="-lfftw3_threads"],
[AC_MSG_ERROR([fftw3_threads nor fftw3_omp was not found.])]
)]
)
AC_SUBST([FFTW3TH_LIBS])
CFLAGS=$CFLAGS_tmp
AC_LANG_POP(C)
#-------------------------------------------------------------------------------
# Check Lapack
#-------------------------------------------------------------------------------
AC_LANG_PUSH(Fortran)
PKG_CHECK_MODULES(LAPACK, lapack,
[],
[AC_CHECK_LIB(lapack, dgesv,
[LAPACK_LIBS="-llapack"],
[AC_MSG_ERROR([lapack was not found.])])])
AC_SUBST([LAPACK_LIBS])
AC_LANG_POP(Fortran)
#-------------------------------------------------------------------------------
# Check CPP libraries.
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Checks for header files.
#-------------------------------------------------------------------------------
# AC_CHECK_HEADERS([limits.h stdlib.h string.h sys/time.h])
#-------------------------------------------------------------------------------
# Checks for typedefs, structures, and compiler characteristics.
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Checks for library functions.
#-------------------------------------------------------------------------------
#AC_FUNC_MALLOC
#AC_CHECK_FUNCS([clock_gettime floor gettimeofday memset pow sqrt])
#-------------------------------------------------------------------------------
# Command Options
#-------------------------------------------------------------------------------
# debug options
AC_ARG_ENABLE([dbg],
[AC_HELP_STRING([--enable-dbg],
[Compile source files with DEBUG options])],
[dbg_flag="True"],
[dbg_flag="False"])
AC_SUBST([dbg_flag])
#-------------------------------------------------------------------------------
# Makefiles
AC_CONFIG_FILES([makefile
src/lbfgsb/makefile
src/slsqp/makefile
src/finufft/makefile
src/fortlib/makefile
src/mfista/makefile])
AC_OUTPUT