forked from cran/AnalyzeFMRI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
73 lines (67 loc) · 2.47 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
AC_INIT(src/analyzeFMRI.c)
: ${R_HOME=`R RHOME`}
if test -z "${R_HOME}"; then
echo "could not determine R_HOME"
exit 1
fi
CC=`${R_HOME}/bin/R CMD config CC`
CFLAGS=`${R_HOME}/bin/R CMD config CFLAGS`
FLIBS=`${R_HOME}/bin/R CMD config FLIBS`
BLAS_LIBS=`${R_HOME}/bin/R CMD config BLAS_LIBS`
LAPACK_LIBS=`${R_HOME}/bin/R CMD config LAPACK_LIBS`
# dummy
AC_CHECK_HEADERS(math.h)
if test -n "`grep HAVE_F77_UNDERSCORE ${R_HOME}/include/Rconfig.h | \
grep '#define'`"; then
have_f77_underscore=true
elif test -n "`grep F77 ${R_HOME}/include/Rconfig.h | grep '_$'`"; then
have_f77_underscore=true
fi
if ${have_f77_underscore}; then
scopy_func=scopy_
sdot_func=sdot_
lsame_func=lsame_
sgesdd_func=sgesdd_
xerbla=xerbla_
else
scopy_func=scopy
sdot_func=sdot
lsame_func=lsame
sgesdd_func=sgesdd
xerbla=xerbla
fi
if test -z "${BLAS_LIBS}"; then
echo "it seems you are not using a BLAS library: using our BLAS and LAPACK routines"
(cd src; ln -s sblas.unused sblas.f; ln -s lsame.unused lsame.f; ln -s slapack.unused slapack.f; ln -s slamc.unused slamc.f)
else
LIBS="${BLAS_LIBS} ${FLIBS}"
AC_MSG_CHECKING([for scopy in ${BLAS_LIBS}])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[[void ${xerbla}(char *srname, int *info){}]]],[[${scopy_func}()]])], [blas_ok=yes], [blas_ok=no])
AC_MSG_RESULT([${blas_ok}])
AC_MSG_CHECKING([for sdot in ${BLAS_LIBS}])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[[void ${xerbla}(char *srname, int *info){}]]],[[${sdot_func}()]])], [blas_ok_sdot=yes], [blas_ok_sdot=no])
AC_MSG_RESULT([${blas_ok_sdot}])
if test "${blas_ok_sdot}" = no; then
blas_ok=no
fi
if test "${blas_ok}" = no; then
AC_MSG_WARN([could not find scopy or sdot in your BLAS library, using our BLAS and LAPACK routines])
(cd src; ln -s sblas.unused sblas.f; ln -s lsame.unused lsame.f; ln -s slapack.unused slapack.f; ln -s slamc.unused slamc.f)
else
LIBS="${LAPACK_LIBS} ${BLAS_LIBS} ${FLIBS}"
AC_CHECK_FUNC(${sgesdd_func}, BLAS_LIBS="${LAPACK_LIBS} ${BLAS_LIBS}",
NO_LIBLAPACK=1)
if test ${NO_LIBLAPACK}; then
AC_MSG_WARN([could not find sgesdd: using our LAPACK routines])
(cd src; ln -s slapack.unused slapack.f; ln -s slamc.unused slamc.f)
fi
AC_CHECK_FUNC(${lsame_func}, , NO_LSAME=1)
if test ${NO_LSAME}; then
AC_MSG_WARN([could not find lsame in your BLAS or LAPACK library, using our copy])
(cd src; ln -s lsame.unused lsame.f)
fi
fi
fi
AC_SUBST(BLAS_LIBS)
AC_CONFIG_FILES(src/Makevars)
AC_OUTPUT