[go: up one dir, main page]

File: configure.ac

package info (click to toggle)
stimfit 0.13.19-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 8,896 kB
  • ctags: 10,926
  • sloc: cpp: 45,185; sh: 12,204; ansic: 7,739; python: 1,695; makefile: 523
file content (351 lines) | stat: -rw-r--r-- 11,570 bytes parent folder | download
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
AC_INIT([stimfit],[0.13.19])
AC_CONFIG_SRCDIR(src/stimfit/gui/main.cpp)
AM_INIT_AUTOMAKE([1.11])
AM_SILENT_RULES([yes])
AC_CONFIG_MACRO_DIR([m4])

AC_PROG_CC
AC_PROG_INSTALL

_LT_SET_OPTION([LT_INIT],[dlopen])
AC_DIAGNOSE([obsolete],[AC_LIBTOOL_DLOPEN: Remove this warning and the call to _LT_SET_OPTION when you
put the `dlopen' option into LT_INIT's first parameter.])

LT_INIT
AC_PROG_CPP
AC_PROG_AWK
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_MKDIR_P
AC_PROG_CXX
AC_PROG_LIBTOOL

# BUILDDATE=`date`

# Build a standalone python module
AC_ARG_ENABLE([module], AS_HELP_STRING([--enable-module],[build a standalone python module; implies --enable-python]),[])
AM_CONDITIONAL(BUILD_MODULE, test "$enable_module" = "yes")

# pbuilder debian package build
AC_ARG_ENABLE([debian], AS_HELP_STRING([--enable-debian],[special build for pbuilder]),[])
AM_CONDITIONAL(BUILD_DEBIAN, test "$enable_debian" = "yes")

AC_MSG_CHECKING(for kernel)
case `uname` in 
    Darwin)
        AC_MSG_RESULT(darwin)
        CXXFLAGS="${CXXFLAGS} -fPIC"
        CFLAGS="${CFLAGS} -fPIC"
        STFKERNEL="darwin"
    ;;
    *)  
        # treat everything else (kfreebsd, hurd) as linux
        AC_MSG_RESULT(linux or similar)
        CXXFLAGS="-fPIC"
        CFLAGS="-fPIC"
        STFKERNEL="linux"
    ;;
esac
AM_CONDITIONAL([ISDARWIN], [test $STFKERNEL = "darwin"])

# Checks for python libraries.
AC_ARG_ENABLE([python], 
  AS_HELP_STRING(
    [--enable-python],
    [enable python console (default="yes")]),,
    [enable_python="yes"])

AM_CONDITIONAL(BUILD_PYTHON, test "$enable_python" = "yes")
if (test "$enable_python" = "yes") || (test "$enable_module" = "yes"); then
    AC_PYTHON_DEVEL
    AC_PROG_SWIG(1.3.17)
    SWIG_ENABLE_CXX
    SWIG_PYTHON
    AC_SUBST(SWIG)
    CXXFLAGS="${CXXFLAGS}"
    CFLAGS="${CFLAGS}"
    LIBPYTHON_LDFLAGS=$PYTHON_LDFLAGS 
    LIBPYTHON_INCLUDES=$PYTHON_CPPFLAGS
    LIBNUMPY_INCLUDES=$PYTHON_NUMPY_INCLUDE
else
    LIBPYTHON_LDFLAGS= 
    LIBPYTHON_INCLUDES= 
    LIBNUMPY_INCLUDES= 
fi
AC_SUBST(LIBPYTHON_LDFLAGS)
AC_SUBST(LIBPYTHON_INCLUDES)
AC_SUBST(LIBNUMPY_INCLUDES)

AC_MSG_CHECKING(for kernel)
case ${STFKERNEL} in 
    darwin)
        LIBSTF_LDFLAGS="-avoid-version"
        if test "$enable_module" = "yes" ; then
            CPPFLAGS="${CPPFLAGS} -DMODULE_ONLY"
        else
            CPPFLAGS="${CPPFLAGS}"
        fi
        STF_PYTHON_LIBNAME="libpystf.dylib"
        STFIO_PYTHON_LIBNAME="libpystfio.dylib"
        ARCH_FLAGS=""
        CFLAGS="${CFLAGS} ${ARCH_FLAGS}"
        CXXFLAGS="${CXXFLAGS} ${ARCH_FLAGS}"
        LDFLAGS="${LDFLAGS} ${ARCH_FLAGS}"
        OBJCFLAGS="${OBJCFLAGS} ${ARCH_FLAGS}"
        OBJCXXFLAGS="${OBJCXXFLAGS} ${ARCH_FLAGS}"
    ;;
    *)
        if test "$enable_module" = "yes" ; then
            LIBSTF_LDFLAGS="-avoid-version"
            CPPFLAGS="${CPPFLAGS} -DMODULE_ONLY"
        else
            if test "$enable_debian" = "yes" ; then
              LIBSTF_LDFLAGS="-Wl,-rpath,/usr/lib/stimfit -avoid-version"
            else
              LIBSTF_LDFLAGS="-Wl,-rpath,${prefix}/lib/stimfit -avoid-version"
            fi
            CPPFLAGS="${CPPFLAGS}"
        fi
        if test "$enable_debian" = "yes" ; then
            CPPFLAGS="${CPPFLAGS} `dpkg-buildflags --get CPPFLAGS`"
            CFLAGS="${CFLAGS} `dpkg-buildflags --get CFLAGS`"
            CXXFLAGS="${CXXFLAGS} `dpkg-buildflags --get CXXFLAGS`"
            LDFLAGS="${LDFLAGS} `dpkg-buildflags --get LDFLAGS`"
        fi
        STF_PYTHON_LIBNAME="libpystf.so"
        STFIO_PYTHON_LIBNAME="libpystfio.so"
    ;;
esac
AC_SUBST(LIBSTF_LDFLAGS)
AC_SUBST(STF_PYTHON_LIBNAME)
AC_SUBST(STFIO_PYTHON_LIBNAME)

# Checks for python libraries.
if test "$enable_python" = "yes" ; then
    CPPFLAGS="${CPPFLAGS} -DWITH_PYTHON"
fi

AC_ARG_ENABLE([ipython], AS_HELP_STRING([--enable-ipython],[enable ipython as the default shell (experimental); implies --enable-python]),[])
if test "$enable_ipython" = "yes" ; then
    CPPFLAGS="${CPPFLAGS} -DIPYTHON"
fi

# Build the exotic Stimfit flavour with Slope cursors
AC_ARG_WITH([pslope], AS_HELP_STRING([--with-pslope],[include slope measure cursors]),[])
if test "$with_pslope" = "yes" ; then
    CPPFLAGS="${CPPFLAGS} -DWITH_PSLOPE"
fi

AC_ARG_WITH([biosig], AS_HELP_STRING([--with-biosig],[build with libbiosig support - better tested than --with-biosig2]),[])
AM_CONDITIONAL(WITH_BIOSIG, test "$with_biosig" = "yes")

AC_ARG_WITH([biosig2], AS_HELP_STRING([--with-biosig2],[alternative to --with-biosig - eventually, this will provide better ABI compatibility when upgrading libbiosig; currently it's in a testing state; requires libbiosig2 v1.5.6 or higher]),[])
AM_CONDITIONAL(WITH_BIOSIG2, test "$with_biosig2" = "yes")

if test "$with_biosig2" = "yes" ; then
    CPPFLAGS="${CPPFLAGS} -DWITH_BIOSIG2"
    LIBBIOSIG_LDFLAGS="-lbiosig2 -lcholmod"
elif test "$with_biosig" = "yes" ; then
    CPPFLAGS="${CPPFLAGS} -DWITH_BIOSIG"
    LIBBIOSIG_LDFLAGS="-lbiosig -lcholmod"
fi
AC_SUBST(LIBBIOSIG_LDFLAGS)

AC_ARG_WITH([lapack-lib],
AS_HELP_STRING([--with-lapack-lib=LAPACKLIB],[Provide full path to custom lapack library]),
[
    if test "$withval" != "yes" -a "$withval" != ""; then
        LAPACKLIB=$withval
        LIBLAPACK_LDFLAGS="$LAPACKLIB"
        CPPFLAGS="${CPPFLAGS} -DHAVE_LAPACK" 
    fi
])

# stuff not required for standalone module
if test "$enable_module" != "yes"; then
    # Checks for libraries.
    AC_CHECK_LIB([fftw3], [fftw_malloc], HAVE_FFTW3="yes")
    if test "${HAVE_FFTW3}" != "yes" ; then
        AC_MSG_ERROR([Couldn't find fftw3.])
    fi

    if test "$LAPACKLIB" = ""; then
        if test "$STFKERNEL" = "darwin" ; then
            # System LAPACK
            LIBLAPACK_LDFLAGS="/usr/lib/liblapack.dylib -framework Accelerate"
            CPPFLAGS="${CPPFLAGS} -DHAVE_LAPACK -DHAVE_LAPACK_SUFFIX" 
        else
            AC_CHECK_LIB([lapack], [dgemm_], HAVE_LAPACKX="yes")
            if test "${HAVE_LAPACKX}" != "yes" ; then
                AC_CHECK_LIB([lapack3], [dgemm_], HAVE_LAPACK3="yes")
                if test "${HAVE_LAPACK3}" != "yes" ; then
                    AC_CHECK_LIB([lapack-3], [dgemm_], HAVE_LAPACK_3="yes")
                        if test "${HAVE_LAPACK_3}" != "yes" ; then
                            AC_CHECK_LIB([blas], [dgemm_], HAVE_ATLAS="yes")
                            if test "${HAVE_ATLAS}" != "yes" ; then
                                AC_MSG_ERROR([Couldn't find lapack.])
                            else
                                LIBLAPACK_LDFLAGS="-llapack -lblas"
                                CPPFLAGS="${CPPFLAGS} -DHAVE_LAPACK " 
                            fi
                        else
                            LIBLAPACK_LDFLAGS="-llapack-3"
                            CPPFLAGS="${CPPFLAGS} -DHAVE_LAPACK " 
                        fi
                else
                    LIBLAPACK_LDFLAGS=-llapack3
                    CPPFLAGS="${CPPFLAGS} -DHAVE_LAPACK " 
                fi
            else
                LIBLAPACK_LDFLAGS="-llapack -lblas"
                CPPFLAGS="${CPPFLAGS} -DHAVE_LAPACK " 
            fi
        fi
    fi
    AC_SUBST(LIBLAPACK_LDFLAGS)



    # Optionally enables aui for doc/view architecture
    AC_ARG_ENABLE([aui], AS_HELP_STRING([--enable-aui],[enable AUI for the doc/view architecture (experimental)]),[])
    if test "$enable_aui" = "yes" ; then
        CPPFLAGS="${CPPFLAGS} -DWITH_AUIDOCVIEW"
    fi

    WXCONFIG=wx-config
    AC_ARG_WITH(wx-config,
    [[  --with-wx-config=FILE     Use the given path to wx-config when determining
                                wxWidgets configuration; defaults to "wx-config"]],
    [
        if test "$withval" != "yes" -a "$withval" != ""; then
            WXCONFIG=$withval
        fi
    ])

    wxversion=0

    AC_DEFUN([WXTEST],
    [
            AC_REQUIRE([AC_PROG_AWK])
            AC_MSG_CHECKING([wxWidgets version])
            if wxversion=`$WXCONFIG --version`; then
                    AC_MSG_RESULT([$wxversion])
            else
                    AC_MSG_RESULT([not found])
                    AC_MSG_ERROR([wxWidgets is required. Try --with-wx-config.])
            fi])

    # Call WXTEST func
    WXTEST

    # Verify minimus requires
    AC_MSG_CHECKING(for wxWidgets libraries)
    vers=`echo $wxversion | $AWK 'BEGIN { FS = "."; } { printf "% d", ($1 * 1000 + $2) * 1000 + $3;}'`
    if test -n "$vers" && test "$vers" -ge 2008000; then
            WX_CPPFLAGS="`$WXCONFIG --cppflags`"
            WX_CXXFLAGS="`$WXCONFIG --cxxflags`"
            if test "$STFKERNEL" = "darwin" ; then
                if test "${PY_AC_VERSION:0:1}" -ge 3; then
                    WX_LIBS="`$WXCONFIG --libs base`"
                else
                    WX_LIBS="`$WXCONFIG --libs propgrid,aui,adv,core,net,base`"
                fi
            else
                WX_LIBS="`$WXCONFIG --libs base,core,adv,aui,net`"
            fi
            AC_MSG_RESULT([$WX_LIBS])
    else
            AC_MSG_ERROR([wxWidgets 2.8.0 or newer is required])
    fi

    # CPPFLAGS="$CPPFLAGS $WX_CPPFLAGS"
    # CXXFLAGS="$CXXFLAGS $WX_CXXFLAGS" dnl included in cppflags

    AC_SUBST(WX_LIBS)
    AC_SUBST(WX_CPPFLAGS)
    AC_SUBST(WX_CXXFLAGS)
dnl default value is to (silently) do nothing in the makefile
POSTLINK_COMMAND="@true"
MACSETFILE="@true"

AC_MSG_CHECKING(for wxWidgets platform)
WX_BASENAME="`$WXCONFIG --basename`"
case $WX_BASENAME in 
    *wx_osx*)
        AC_MSG_RESULT($WX_BASENAME)
        AC_CHECK_PROG(REZ, Rez, Rez, /Developer/Tools/Rez)
        POSTLINK_COMMAND="\$(REZ) -d __DARWIN__ -t APPL -o"
        AC_CHECK_PROG(SETFILE, SetFile, SetFile, /Developer/Tools/SetFile)
        MACSETFILE="\$(SETFILE)"
    ;;
    *wx_mac*)
        AC_MSG_RESULT($WX_BASENAME)
        AC_CHECK_PROG(REZ, Rez, Rez, /Developer/Tools/Rez)
        POSTLINK_COMMAND="\$(REZ) -d __DARWIN__ -t APPL -o"
        AC_CHECK_PROG(SETFILE, SetFile, SetFile, /Developer/Tools/SetFile)
        MACSETFILE="\$(SETFILE)"
    ;;
    *) 
        AC_MSG_RESULT(other)
    ;;
esac

AC_SUBST(POSTLINK_COMMAND)
AC_SUBST(MACSETFILE)

fi

# Checks for hdf5 libraries.
AC_ARG_WITH([hdf5-prefix],
AS_HELP_STRING([--with-hdf5-prefix=HDF5_PREFIX],[Provide full path to hdf5 prefix]),
[
    if test "$withval" != "yes" -a "$withval" != ""; then
        HDF5_PREFIX=${withval}
        LDFLAGS="${LDFLAGS} -L${HDF5_PREFIX}/lib"
        CPPFLAGS="${CPPFLAGS} -I${HDF5_PREFIX}/include" 
    fi
])

AC_CHECK_HEADER([hdf5.h], [], [AC_MSG_ERROR([Couldn't find hdf5 header])])
AC_CHECK_LIB([hdf5],[H5Fopen],HAVE_HDF5="yes")
if test "${HAVE_HDF5}" != "yes" ; then
    AC_MSG_ERROR([Couldn't find hdf5 libraries.])
else
    CPPFLAGS="${CPPFLAGS} -DH5_USE_16_API"
    LIBHDF5_LDFLAGS="-lhdf5 -lhdf5_hl"
fi
AC_SUBST(LIBHDF5_LDFLAGS)

AC_ARG_ENABLE([debug],
        AS_HELP_STRING([--enable-debug],[build stimfit in debug mode]),[
])
    if test "$enable_debug" = "yes" ; then
        CPPFLAGS="${CPPFLAGS} -D_STFDEBUG "
        OPT_CXXFLAGS="-O0 -g3"
        CFLAGS="${CFLAGS} -O0 -g3"
    else
        OPT_CXXFLAGS="-O2 -g"
        CFLAGS="${CFLAGS} -O2 -g"
    fi
AC_SUBST(OPT_CXXFLAGS)

# gtest
GT_CPPFLAGS=""
GT_CXXFLAGS=""
GT_LIBS="-lpthread"
GT_LDFLAGS=""

AC_SUBST(GT_CPPFLAGS)
AC_SUBST(GT_CXXFLAGS)
AC_SUBST(GT_LIBS)
AC_SUBST(GT_LDFLAGS)
# end gtest

# CPPFLAGS="${CPPFLAGS} -DSTFDATE='\"${BUILDDATE}\"'"
CXXFLAGS="${CXXFLAGS} -Wall"

AC_CONFIG_HEADERS([stfconf.h])

AC_CONFIG_FILES([Makefile src/Makefile src/libstfio/Makefile src/pystfio/Makefile src/stimfit/Makefile src/stimfit/py/Makefile dist/macosx/stimfit.plist])

AC_OUTPUT