AC_CONFIG_HEADERS(src/config.h)
AC_CONFIG_FILES(aubio.pc)
+AM_CONDITIONAL(MINGW, false)
+AM_CONDITIONAL(DARWIN, false)
case "${host_os}" in
*mingw*)
mingw32_support="yes"
AC_CHECK_HEADER(windows.h)
+ AM_CONDITIONAL(MINGW, true)
;;
*darwin*)
dnl on macosx, cosf went to -lmx
dnl as long double doesn't sit well with -Wall -Werror
AUBIO_CFLAGS="$AUBIO_CFLAGS -Wno-long-double"
AC_ISC_POSIX
+ AM_CONDITIONAL(DARWIN, true)
;;
*)
AC_ISC_POSIX
AM_CONDITIONAL(SWIGFOUND, test "${SWIG}" != "no")
AM_PATH_PYTHON
AM_CONDITIONAL(PYTHONFOUND, test "${PYTHON}" != "no")
-#
-#if PYTHONFOUND
-case "${host_os}" in
-*darwin*)
- SWCFLAGS="-Wno-long-double"
- SWLDFLAGS="-bundle -framework python -L${prefix}/lib/python${PYTHON_VERSION}/config -lpython${PYTHON_VERSION}"
- ;;
-*)
- SWLDFLAGS="-shared"
- ;;
-esac
-#
-AC_SUBST(SWCFLAGS)
-AC_SUBST(SWLDFLAGS)
dnl Check for docbook-to-man
AC_PATH_PROG(DOCBOOK_TO_MAN,docbook-to-man,no)
SUFFIXES = .pd_linux
PDDIR = $(prefix)/lib/pd
pddir = $(PDDIR)
-#SUBDIRS = ladspa vst win
## Make and install the shared library.
pdinstalldir = $(pddir)/extra
pdinstallrefdir = $(pddir)/doc/5.reference
pdinstallexpdir = $(pddir)/doc/aubio
-# Automake won't accept something ending in ".pd_linux" as a library
-pdinstall_PROGRAMS = aubio.pd_linux
+if MINGW
+PDEXT = aubio.dll
+else
+if DARWIN
+PDEXT = aubio.pd_darwin
+else
+PDEXT = aubio.pd_linux
+endif
+endif
-aubio_pd_linux_SOURCES = \
+pdinstall_PROGRAMS = $(PDEXT)
+
+ALLSOURCES = \
aubio_setup.c \
aubioonset~.c \
aubiotempo~.c \
aubioquiet~.c \
aubiopitch~.c
-pdincludedir = $(pddir)/src
-
-LIBTOOL=$(SHELL) $(srcdir)/libtoolkludge
+aubio_pd_linux_SOURCES = $(ALLSOURCES)
+aubio_pd_darwin_SOURCES = $(ALLSOURCES)
+aubio_dll_SOURCES = $(ALLSOURCES)
-INCLUDES = -I$(top_srcdir)/src -I$(pdincludedir)
+pdincludedir = $(pddir)/src
-AM_CFLAGS = -DPD -fPIC -DPIC
+AM_CFLAGS = -I$(top_srcdir)/src -I$(pdincludedir) -DPD -fPIC -DPIC @AUBIO_CFLAGS@
+if MINGW
+AM_LDFLAGS = -L$(top_builddir)/src/.libs -laubio -export_dynamic -shared
+else
+if DARWIN
AM_LDFLAGS = -L$(top_builddir)/src/.libs -laubio -export_dynamic -shared
+else
+AM_LDFLAGS = -L$(top_builddir)/src/.libs -laubio -export_dynamic -shared
+endif
+endif
+
## Install the documentation.
pdinstallexp_DATA = \
examples/onset-cam.pd
-## My kludge
-noinst_SCRIPTS = libtoolkludge
-
-EXTRA_DIST = $(pdinstallref_DATA) $(pdinstallexp_DATA) $(noinst_SCRIPTS)
-
+EXTRA_DIST = $(pdinstallref_DATA) $(pdinstallexp_DATA)
nodist_pkgpython_PYTHON = aubiowrapper.py _aubiowrapper.so
-CLEANFILES = *.pyc *.so *.o aubio_wrap.c aubiowrapper.py
+_aubiowrapper.so: _aubiowrapper.la
+
+if MINGW
+SWLDFLAGS = ""
+else
+if DARWIN
+SWLDFLAGS = "-bundle -framework Python"
+else
+SWLDFLAGS = "-shared"
+endif
+endif
-all: _aubiowrapper.so
+CLEANFILES = *.pyc *.so *.o aubio_wrap.c aubiowrapper.py
NOWARN_CFLAGS = -Wno-missing-prototypes -Wno-missing-declarations \
-Wno-strict-aliasing
-AM_CFLAGS = $(SWCFLAGS) -fPIC -DPIC \
+AM_CFLAGS = @AUBIO_CFLAGS@ $(NOWARN_CFLAGS) $(SWCFLAGS) \
-I$(top_builddir)/src -I$(top_srcdir)/src -I$(top_srcdir)/ext \
-I/usr/include/python${PYTHON_VERSION} \
-I${prefix}/include/python${PYTHON_VERSION} \
-I/usr/include \
-I${prefix}/include
-AM_LDFLAGS = $(SWLDFLAGS) \
+AUBIO_LDFLAGS = $(SWLDFLAGS) \
-L$(top_builddir)/ext/.libs -laubioext \
-L$(top_builddir)/src/.libs -laubio
-aubio_wrap.c:
- $(SWIG) -outdir . -o aubio_wrap.c -python $(top_srcdir)/swig/aubio.i
+python_DATA = aubiowrapper.py
+python_LTLIBRARIES = _aubiowrapper.la
+
+_aubiowrapper_la_LDFLAGS = -no-undefined -module -avoid-version $(AUBIO_LDFLAGS)
+_aubiowrapper_la_SOURCES = aubio_wrap.c
-_aubiowrapper.so: aubio_wrap.c
- $(CC) $(AM_CFLAGS) $(CFLAGS) $(NOWARN_CFLAGS) -c aubio_wrap.c
- $(CC) $(AM_LDFLAGS) $(LDFLAGS) aubio_wrap.o -o _aubiowrapper.so
+aubio_wrap.c aubiowrapper.py:
+ $(SWIG) -outdir . -o aubio_wrap.c -python $(top_srcdir)/swig/aubio.i