-
Notifications
You must be signed in to change notification settings - Fork 8
/
configure.ac
167 lines (150 loc) · 6.1 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
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
AC_PREREQ(2.13)
AC_INIT([flowClust], 1.x, [[email protected]], [flowClust])
# We want the following logic
# Per default, use the included gsl and set GSL_DIR, GSL_VERSTR and do compilation of gsl
# Otherwise, specify location of gsl using --with-gsl
AC_ARG_ENABLE(bundled-gsl,
[AS_HELP_STRING([--enable-bundled-gsl=yes/no],
[wether to use bundled gsl library.]
)
],
[GSL_BUNDLED=$enableval],
[GSL_BUNDLED=yes])
AC_ARG_WITH(gsl,
[AS_HELP_STRING([--with-gsl=DIR],
[root directory of GSL installation (defaults to /usr/local)])],
[GSL_DIR="${with_gsl}"],
[GSL_DIR=yes])
if test "${GSL_BUNDLED}" = "yes" ; then
AC_MSG_NOTICE([Using bundled GSL.])
BUILD_DIR="`pwd`"
AC_MSG_NOTICE([Searching for the compilers specified by R.])
: ${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`
CPPFLAGS=`"${R_HOME}/bin/R" CMD config CPPFLAGS`
LDFLAGS=`"${R_HOME}/bin/R" CMD config LDFLAGS`
MAKE=`"${R_HOME}/bin/R" CMD config MAKE`
AC_PROG_CC
AC_PROG_CPP
BASENAME="gsl-1.13"
TGZNAME=trim-${BASENAME}.tar.gz
cd src
if test -d ./${BASENAME};
then
echo 'found ' $BASENAME ' sources and tar archive;using what is there.'
else
echo "untarring gsl...";
gunzip -dc ${TGZNAME} | tar xf -;
fi;
cd ../
AC_MSG_NOTICE([Preparing to compile GSL.])
cd src/${BASENAME}
touch configure
BUILD_INSTALL_DIR="${BUILD_DIR}/src/gslbuild"
rm -rf ${BUILD_INSTALL_DIR}
AC_MSG_NOTICE([Configuring bundled GSL.])
./configure CC="${CC}" \
CPP="${CPP}" \
CFLAGS="${CFLAGS}" \
CPPFLAGS="${CPPFLAGS}" \
LDFLAGS="${LDFLAGS}" \
CPICFLAGS="${CPICFLAGS}" \
--prefix="${BUILD_INSTALL_DIR}" \
--libdir="${BUILD_INSTALL_DIR}/lib" \
--includedir="${BUILD_INSTALL_DIR}/include"\
--enable-shared\
--disable-static
cp */*.h gsl/
cp *.h gsl/
${MAKE} install
cd "${BUILD_DIR}"
BUILD_INCLUDE_DIR="${BUILD_INSTALL_DIR}/include"
#BUILD_LIB_DIR="${BUILD_INSTALL_DIR}/lib"
#cp "${BUILD_LIB_DIR}"/* "${BUILD_DIR}"/src
cp -r "${BUILD_DIR}/src/$BASENAME/gsl" "$BUILD_INCLUDE_DIR"
GSL_VERSION="1.13.0"
PKG_CFLAGS="${PKG_CFLAGS} -I${BUILD_INCLUDE_DIR}"
FLOWCLUST_DEFS="-DGSL_MAJOR=1 -DGSL_MINOR=13 -DGSL_STATIC"
else
AC_MSG_NOTICE([Using external GSL.])
# The logic is as follows:
# Either the user specifically points us to gsl using --with-gsl='/something'
# Or the intention to use external gsl is indicated by --with-gsl
if test "${GSL_DIR}" = "yes"; then
dnl Since the user did not specify a directory, we first try pkg-config and then we will use /usr/local
AC_MSG_NOTICE([No directory was specified for --with-gsl. Trying to find GSL using other methods.])
if test -z "${PKG_CONFIG}" ; then
AC_PATH_PROG(PKG_CONFIG, pkg-config)
fi
if ! test -z "${PKG_CONFIG}" ; then
GSL_CONFIG="${PKG_CONFIG} libgsl"
GSL_VERSION="`${GSL_CONFIG} --modversion || echo ''`"
if test -z "${GSL_VERSION}" ; then
AC_MSG_NOTICE([pkg-config was not able to find the GSL library libgsl.])
AC_MSG_NOTICE([Trying gsl-config."])
GSL_CONFIG="gsl-config"
GSL_VERSION="`${GSL_CONFIG} --version || echo ''`"
if test -z "${GSL_VERSION}" ; then
AC_MSG_NOTICE([gsl-config was not able to find the GSL library. This either indicates that GSL is old or that something is wrong. Verify GSL is installed and that PKG_CONFIG_PATH is correct.])
AC_MSG_NOTICE([Trying with /usr/local anyway."])
GSL_DIR="/usr/local"
else
PKG_CFLAGS="`${GSL_CONFIG} --cflags`"
PKG_LIBS="`${GSL_CONFIG} --libs`"
fi
else
PKG_CFLAGS="`${GSL_CONFIG} --cflags`"
PKG_LIBS="`${GSL_CONFIG} --libs`"
fi
fi
fi
# At this point, either GSL_DIR is yes (using pkg-config/or gsl-config worked) or
# it is set to something else, in which case we use dot to get the version number
if ! test "${GSL_DIR}" = "yes"; then
AC_MSG_NOTICE([Using GSL dir '${GSL_DIR}'])
gsl_config="${GSL_DIR}/bin/gsl-config"
if ! test -x "${gsl_config}" ; then
AC_MSG_ERROR([$gsl_config not found. Check GSL installation.])
exit 1
fi
GSL_VERSION="`${gsl_config} --version`"
PKG_CFLAGS="`${gsl_config} --cflags`"
PKG_LIBS="`${gsl_config} --libs`"
fi
# At this point GSL_VERSION ought to exist, we do computations on it to infer MAJOR and MINOR version
if test -z ${GSL_VERSION} ; then
AC_MSG_ERROR([Unable to determine GSL version. Report to flowClust maintainer.])
exit 1
fi
AC_MSG_NOTICE([Found GSL version '${GSL_VERSION}'.])
MAJOR=`echo ${GSL_VERSION} | cut -f1 -d"."`
MINOR=`echo ${GSL_VERSION} | cut -f2 -d"."`
if test -z ${MAJOR} || test -z ${MINOR} ; then
AC_MSG_ERROR([Unable to infer GSL major and minor version, report to flowClust maintainer])
exit 1
fi
AC_MSG_NOTICE([GSL major version is '${MAJOR}' and minor version is '${MINOR}'.])
if (test ${MAJOR} -lt "1") || (test ${MAJOR} -eq "1" && test ${MINOR} -lt "6") ; then
AC_MSG_ERROR([Need GSL >= 1.6])
exit 1
fi
PKG_CFLAGS="${PKG_CFLAGS} -DGSL_MAJOR=${MAJOR} -DGSL_MINOR=${MINOR}"
fi
AC_MSG_NOTICE([Using the following compilation and linking flags for flowClust])
AC_MSG_NOTICE([ PKG_CFLAGS=${PKG_CFLAGS}])
AC_SUBST(PKG_CFLAGS)
AC_MSG_NOTICE([ PKG_LIBS=${PKG_LIBS}])
AC_SUBST(PKG_LIBS)
AC_MSG_NOTICE([ FLOWCLUST_DEFS=${FLOWCLUST_DEFS}])
AC_SUBST(FLOWCLUST_DEFS)
AC_MSG_NOTICE([Compiling using GSL version: '${GSL_VERSION}'.])
AC_MSG_NOTICE([Using bundled GSL: '${GSL_BUNDLED}'.])
AC_SUBST(GSL_VERSION)
AC_SUBST(GSL_BUNDLED)
AC_CONFIG_FILES([src/Makevars])
AC_OUTPUT