-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
99 lines (86 loc) · 2.54 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
dnl Process this file with autoconf to produce a configure script
AC_INIT
AC_CONFIG_SRCDIR([DESCRIPTION])
dnl Check chmod
chmod +x ./inst/test_intface/00_make.*
dnl Determine R_HOME.
: ${R_HOME=‘R RHOME‘}
if test -z "${R_HOME}"; then
echo "could not determine R_HOME"
exit 1
fi
R_SCMD="${R_HOME}/bin/Rscript -e"
dnl Check other CC/FC.
if test "X${CC}" = "X"; then
CC=`"${R_HOME}/bin/R" CMD config CC`
if test "X$CC" = "X" ; then
# Our best guess...
CC="gcc -std=gnu99"
fi
fi
if test "X${FC}" = "X"; then
FC=`"${R_HOME}/bin/R" CMD config FC`
if test "X$FC" = "X" ; then
# Our best guess...
FC="gfortran"
fi
fi
dnl Set EXT_LDFLAGS, otherwise default LDFLAGS, OBJS, and LIBS will be set.
AC_ARG_VAR(EXT_LDFLAGS, [ external linking flags of external libraries ])
AS_VAR_SET_IF(EXT_LDFLAGS, [], [ AS_VAR_SET(EXT_LDFLAGS, "") ])
if test "X$EXT_LDFLAGS" = "X" ; then
EXT_LDFLAGS="\$(LAPACK_LIBS) \$(BLAS_LIBS)"
EXT_OBJS="\$(R_SLAP)"
EXT_LIBS="userLibrary"
else
EXT_OBJS=""
EXT_LIBS=""
fi
dnl C and Fortran interface
dnl CDEFS should be one of "-DAdd_", "-DNoChange", "-Df77IsF2C", or "-DUpCase"
dnl which is determined by "../inst/test_intface/00_make.sh".
dnl For GNU make, gcc, and gfortran, the default is "-DAdd_".
AC_ARG_VAR(CDEFS, [ intface of C and Fortran ])
AS_VAR_SET_IF(CDEFS, [], [ AS_VAR_SET(CDEFS, "") ])
if test "X$CDEFS" = "X" ; then
CDEFS=-D`${R_SCMD} "invisible(system('cd ./inst/test_intface/;./00_make.sh'))"`
CDEFS_CHECK=TRUE
fi
dnl The best guess when "00_make.sh" fails.
if test "X$CDEFS" = "X-D" ; then
CDEFS=-DAdd_
CDEFS_CHECK=FALSE
fi
dnl pbdMPI
SPMD_CPPFLAGS=`${R_SCMD} "source('./R/get_conf.r');get.conf('PKG_CPPFLAGS','"${R_ARCH}"')"`
SPMD_LDFLAGS=`${R_SCMD} "source('./R/get_conf.r');get.conf('PKG_LIBS','"${R_ARCH}"')"`
dnl Report
echo " "
echo "****************** Results of pbdSLAP package configure *****************"
echo " "
echo ">> CC = ${CC}"
echo ">> F77 = ${FC}"
echo ">> FC = ${FC}"
echo ">> EXT_LDFLAGS = ${EXT_LDFLAGS}"
echo ">> EXT_OBJS = ${EXT_OBJS}"
echo ">> EXT_LIBS = ${EXT_LIBS}"
echo ">> CDEFS = ${CDEFS}"
echo ">> CDEFS_CHECK = ${CDEFS_CHECK}"
echo ">> SPMD_CPPFLAGS = ${SPMD_CPPFLAGS}"
echo ">> SPMD_LDFLAGS = ${SPMD_LDFLAGS}"
echo " "
echo "*************************************************************************"
echo " "
dnl Start to substitute templates
AC_SUBST(CC)
# AC_SUBST(F77)
AC_SUBST(FC)
AC_SUBST(EXT_LDFLAGS)
AC_SUBST(EXT_OBJS)
AC_SUBST(EXT_LIBS)
AC_SUBST(CDEFS)
AC_SUBST(CDEFS_CHECK)
AC_SUBST(SPMD_CPPFLAGS)
AC_SUBST(SPMD_LDFLAGS)
AC_CONFIG_FILES([src/Makevars])
AC_OUTPUT