-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.in
374 lines (318 loc) · 11.5 KB
/
configure.in
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
# ----------------------------------------------------------------------
### preludes
# ----------------------------------------------------------------------
AC_INIT([libeegtools], [0.6.3], [ihrke@nld.ds.mpg.de])
AM_INIT_AUTOMAKE([-Wall -Werror foreign])
#AC_DISABLE_SHARED
# for additional m4 macros
m4_include([m4/ax_python_devel.m4])
m4_include([m4/ax_pkg_swig.m4])
m4_include([m4/ax_swig_enable_cxx.m4])
m4_include([m4/ax_swig_multi_module_support.m4])
m4_include([m4/ax_swig_python.m4])
m4_include([m4/ax_python_module.m4])
m4_include([m4/pkg.m4])
# ----------------------------------------------------------------------
### check for programs
# ----------------------------------------------------------------------
## with macros
#AC_LANG_CPLUSPLUS
#AC_PROG_CXX
AC_PROG_CC
AM_PROG_LIBTOOL
## or manually, here for tar
# AC_CHECK_PROGS(VAR, PROGS, [VAL-IF-NOT-FOUND])
AC_CHECK_PROGS([TAR], [tar gtar], [:])
if test "$TAR" = :; then
AC_MSG_ERROR([This package needs tar.])
# AC_MSG_WARN([This package needs tar.]) # or warn only
fi
uname=`uname`
if test x$uname == xDarwin ; then
CC=gcc
CXX=$CC
CFLAGS="-arch `arch`"
fi
# ----------------------------------------------------------------------
### check for libraries
# ----------------------------------------------------------------------
dnl From GSL we need only the 'gsl-config' script
dnl It can tell us where the libraries and includes are.
AC_ARG_WITH(gsl-config,
[ --with-gsl-config=PROG PROG is the gsl-config script],
GSL_CONFIG_NAME="$withval",
GSL_CONFIG_NAME='gsl-config')
AC_PATH_PROG( GSL_CONFIG, $GSL_CONFIG_NAME, $GSL_CONFIG_NAME, "" )
if test z${GSL_CONFIG} = z; then
AC_MSG_ERROR([configure could not find the gsl-config at ${GSL_CONFIG_NAME} script. Aborting.])
fi
GSL_CFLAGS=`$GSL_CONFIG --cflags`
GSL_LIBS=`$GSL_CONFIG --libs`
AC_SUBST(GSL_CFLAGS)
AC_SUBST(GSL_LIBS)
AC_CHECK_LIB([m], [pow], [], \
["You need the standard math-library."
exit -1])
##------ DEBUG SUPPORT -----#
AC_ARG_ENABLE(debug,
[ --enable-debug enable debugging mode (default "no")],
[with_debug=$enableval],
[with_debug=no]
)
DEF_DEBUG="NODEBUG"
DEBUG_FLAGS=""
if test "x${with_debug}" = xyes; then
DEF_DEBUG="DEBUG"
DEBUG_FLAGS="-g"
fi
AC_SUBST(DEF_DEBUG)
AC_SUBST(DEBUG_FLAGS)
##------ Experimental SUPPORT -----#
AC_ARG_ENABLE(experimental,
[ --enable-experimental enable experimental code (default "no")],
[with_experimental=$enableval],
[with_experimental=no]
)
DEF_EXPERIMENTAL="NOEXPERIMENTAL"
if test "x${with_experimental}" = xyes; then
DEF_EXPERIMENTAL="EXPERIMENTAL"
fi
AC_SUBST(DEF_EXPERIMENTAL)
AM_CONDITIONAL(EXPERIMENTAL_SUPPORT, test "x${with_experimental}" = xyes )
##------ COLOURED PRINTING SUPPORT -----#
AC_ARG_ENABLE(color,
[ --enable-color enable colored printing (default "yes")],
[with_color=$enableval],
[with_color=yes]
)
DEF_ANSI_ESCAPE_CODES="NOESCAPECODES"
if test "x${with_color}" = xyes; then
DEF_ANSI_ESCAPE_CODES="_WITH_ANSI_ESCAPE_CODES"
fi
AC_SUBST(DEF_ANSI_ESCAPE_CODES)
##------ MATLAB SUPPORT -----#
AC_ARG_ENABLE(matlab,
[ --enable-matlab enable MATLAB (default="no")],
[with_matlab=$enableval],
[with_matlab=no]
)
MEX=mex
MEXEXT_PROG=mexext
MATLAB_PROG=matlab
AC_ARG_WITH(matlab_basedir,
[ --with-matlab-basedir MATLAB top-level directory],
MATLAB_SRCDIR=$withval)
if test "${prefix}" = "NONE"; then
MATLAB_DIR=`eval echo "/usr/local/share/${PACKAGE}/matlab"`
else
MATLAB_DIR=`eval echo "${datadir}/${PACKAGE}/matlab"`
fi
AC_DEFINE_UNQUOTED( [PCG_DATADIR], "$PCG_DATADIR", [Directory where data files are located.])
AC_ARG_WITH(matlab-destdir,
[ --with-matlab-destdir destination path for MATLAB files],
MATLAB_DIR=$withval)
DEF_MATLAB="NOMATLAB"
MATLAB_INCLUDES=""
MATLAB_PATH=""
if ! test "x${MATLAB_SRCDIR}" = x; then
MEX="$MATLAB_SRCDIR/bin/$MEX"
MEXEXT_PROG="$MATLAB_SRCDIR/bin/$MEXEXT_PROG"
MATLAB_PROG="$MATLAB_SRCDIR/bin/$MATLAB_PROG"
fi
if test "x${with_matlab}" = xyes; then
AC_PATH_PROG(MEX, $MEX)
if ! test -n "$MEX" && ! $MEX -v 2>/dev/null | grep MATLAB >/dev/null; then
if test -n "$MEX"; then
AC_MSG_WARN([mex script does not seem to come from matlab (could be Octave mex script). Pass the path to matlab mex using --with-mex option.])
else
AC_MSG_WARN([no matlab mex found in the path])
fi
with_matlab=no;
else
MEXEXT=`$MEXEXT_PROG`;
DEF_MATLAB="MATLAB"
MATLAB_PATH=`$MATLAB_PROG -e|grep MATLAB=|sed s/MATLAB=//`
MATLAB_INCLUDES="-I $MATLAB_PATH/extern/include"
fi
fi
AC_SUBST(DEF_MATLAB)
AC_SUBST(MATLAB_INCLUDES)
AC_SUBST(MATLAB_PATH)
AC_SUBST(MATLAB_DIR)
AC_SUBST(MEX)
AC_SUBST(MEXEXT)
AM_CONDITIONAL(MATLAB_SUPPORT, test "x${with_matlab}" = xyes )
##------ PLOTTER SUPPORT -----#
AC_ARG_ENABLE(plotter,
[ --enable-plotter enable plotter support (default "no")],
[with_plotter=$enableval],
[with_plotter=no]
)
DEF_PLOTTER="NOPLOTTER"
PLOTTER_CONFIG=""
PLOTTER_CFLAGS=""
if test "x${with_plotter}" = xyes; then
DEF_PLOTTER="PLOTTER"
AC_ARG_WITH(plotter-config,
[ --with-plotter-config=PROG PROG is the plotter-config script],
PLOTTER_CONFIG_NAME="$withval",
PLOTTER_CONFIG_NAME='plotter-config')
AC_ARG_WITH([plotter],
[ --with-plotter=DIR DIR is the plotter root directory],
[plotter_dir="$withval"],
[plotter_dir=no])
AC_PATH_PROG(PLOTTER_CONFIG, ${PLOTTER_CONFIG_NAME},, ${plotter_dir}${plotter_dir:+/bin:}$PATH)
if test z${PLOTTER_CONFIG} == z; then
AC_MSG_WARN([[configure could not find the ${PLOTTER_CONFIG_NAME} script. no Plotting.]])
DEF_PLOTTER="NOPLOTTER"
else
AC_DEFINE([HAVE_LIBPLOTTER], 1, "plotter-library")
PLOTTER_CFLAGS="`${PLOTTER_CONFIG} --with-capi --cflags`"
PLOTTER_LDFLAGS="`${PLOTTER_CONFIG} --with-capi --ldflags`"
fi
fi
AC_SUBST(PLOTTER_CFLAGS)
AC_SUBST(PLOTTER_LDFLAGS)
AC_SUBST(DEF_PLOTTER)
# ----------------------------------------------------------------------
### check for SWIG
# ----------------------------------------------------------------------
AC_ARG_ENABLE(python,
[ --enable-python enable python-bindings (default "yes")],
[with_python=$enableval],
[with_python=yes]
)
enable_python=no
if test "x${with_python}" = xyes; then
AX_PKG_SWIG([], [echo "Found SWIG."], [echo "SWIG is required to build."])
# AX_SWIG_ENABLE_CXX
# AX_SWIG_MULTI_MODULE_SUPPORT
AX_SWIG_PYTHON
AX_PYTHON_MODULE([numpy])
if test "x$HAVE_PYMOD_NUMPY" = xyes; then
enable_python=yes
fi
fi
AM_CONDITIONAL([BUILD_PYAPI], [test "x$enable_python" = xyes] )
# ----------------------------------------------------------------------
### check for headers
# ----------------------------------------------------------------------
AC_HEADER_STDC # standard library headers, stdlib.h, stdarg.h, string.h, and float.h
# check for typedefs etc.
# check for library functions
##------ UNIT-TEST SUPPORT with libcheck -----#
AC_ARG_ENABLE(unittest,
[ --enable-unittest Unit-testing support (default "no")],
[with_unittest=$enableval],
[with_unittest=no]
)
AC_CHECK_LIB([check], [srunner_create], [], [
echo "LibCheck not installed, no unit-tests."
with_unittest=no
])
#AC_SEARCH_LIBS([], [libcheck], [with_unittest=yes])
AC_CHECK_HEADERS([check.h], [], [with_unittest=no])
# test/Makefile is compiled only if unittests are enabled
AM_CONDITIONAL([BUILD_CHECKS], [test "x$with_unittest" = xyes] )
##-------- MAT-IO ----------------##
DEF_MATIO="NOMATIO"
PKG_CHECK_MODULES(MATIO, matio >= 1.3, [with_matio=yes; DEF_MATIO="MATIO"],
[echo "MatIO not installed, no support for matlab files."
with_matio=no])
AC_SUBST(MATIO_CFLAGS)
AC_SUBST(MATIO_LIBS)
AC_SUBST(DEF_MATIO)
#AC_CHECK_LIB([matio], [Mat_Create], [with_matio=yes],
# [
# echo "MatIO not installed, no support for matlab files."
# with_matio=no])
# ----------------------------------------------------------------------
# for setup.py.in
SRCDIR=${srcdir}
AC_SUBST(SRCDIR)
# ----------------------------------------------------------------------
### subprojects
# ----------------------------------------------------------------------
## e.g. add fltk2
#AC_CONFIG_SUBDIRS([fltk2])
# ----------------------------------------------------------------------
### config files
# ----------------------------------------------------------------------
AM_CONFIG_HEADER([config.h])
AC_OUTPUT(Makefile src/Makefile misc/Makefile programs/Makefile examples/Makefile)
AC_OUTPUT(src/definitions.h matlab/Makefile matlab/mex/Makefile)
AC_OUTPUT(test/Makefile eeglab_plugin/Makefile scipy/Makefile R/Makefile)
AC_OUTPUT(pythonapi/setup.py)
AC_OUTPUT(pythonapi/Makefile)
AC_OUTPUT(libeegtools.pc)
echo "--------------------------------------------------------------"
echo " Installation Summary: LibEEGTools"
echo "--------------------------------------------------------------"
echo "Found gsl-config in ${GSL_CONFIG_NAME}"
echo " gsl-config --prefix : `${GSL_CONFIG_NAME} --prefix`"
echo " gsl-config --version: `${GSL_CONFIG_NAME} --version`"
echo " gsl-config --cflags : `${GSL_CONFIG_NAME} --cflags`"
echo " gsl-config --libs : `${GSL_CONFIG_NAME} --libs`"
echo ""
if test z${PLOTTER_CONFIG} != z; then
echo "Found plotter-config in ${PLOTTER_CONFIG_NAME}"
echo " plotter-config --with-capi --prefix : `${PLOTTER_CONFIG_NAME} --with-capi --prefix`"
echo " plotter-config --with-capi --version: `${PLOTTER_CONFIG_NAME} --with-capi --version`"
echo " plotter-config --with-capi --cflags : `${PLOTTER_CONFIG_NAME} --with-capi --cflags`"
echo " plotter-config --with-capi --ldflags: `${PLOTTER_CONFIG_NAME} --with-capi --ldflags`"
echo " plotter-config --with-capi --libs : `${PLOTTER_CONFIG_NAME} --with-capi --libs`"
fi
if test "z${with_matlab}" = zyes; then
echo ""
echo "MATLAB enabled"
echo " MATLAB_PATH ='${MATLAB_PATH}'"
echo " MATLAB_INCLUDES ='${MATLAB_INCLUDES}'"
echo " MEX = '${MEX}'"
echo " MEXEXT = '${MEXEXT}'"
echo " matlab executable = $MATLAB_PROG"
echo " MATLAB_DIR = '${MATLAB_DIR}'"
fi
if test "z${enable_python}" != zno; then
if test "z${SWIG}" != z; then
echo ""
echo "Building Python bindings using"
echo "swig: '${SWIG}'"
echo "with options"
echo "CFLAGS : '${AX_SWIG_PYTHON_CPPFLAGS}'"
echo "OPTFLAGS: '${AX_SWIG_PYTHON_OPT}'"
echo "Python options ${PYTHON_VERSION}"
echo "CFLAGS : ${PYTHON_CPPFLAGS}"
echo "LDFLAGS: ${PYTHON_LDFLAGS}"
else
echo "WARNING: requested Python Modules, but cannot build"
echo " SWIG is missing."
fi
fi
if test "x${with_matio}" = xyes; then
echo ""
echo "Using MatIO library for MATLAB file support"
echo " CFLAGS ='${MATIO_CFLAGS}'"
echo " LIBS ='${MATIO_LIBS}'"
else
echo ""
echo "Did not find MatIO library, no support for MATLAB/EEGlab files"
echo " -> https://sourceforge.net/projects/matio/"
fi
if test "x${with_unittest}" = xyes; then
echo ""
echo "Unit-Testing is enabled"
echo " using libcheck"
fi
if test "x${with_experimental}" = xyes; then
echo ""
echo "WARNING: Experimental code is enabled"
echo " If the library does not compile, try reconfiguring with"
echo " --disable-experimental"
fi
echo ""
echo "Debugging Output enabled: '${with_debug}'"
echo "Colored printing enabled: '${with_color}'"
echo "Installing to: '${prefix}'"
echo "--------------------------------------------------------------"
echo " Run 'make install' to install the library"
echo "--------------------------------------------------------------"