From bcffb6bd0a88100b61ac9ee66b52ff96ab8caac2 Mon Sep 17 00:00:00 2001 From: rossb Date: Tue, 8 Dec 2009 09:40:09 +0000 Subject: [PATCH] Update to Makefile.in and Configure.in from Stelios Bounanos: Pretty-print help strings, Support multiple APIs on win32 with mingw, Output a configuration summary at the end, Remove ASIO build configuration from OSX --- Makefile.in | 14 ++- configure.in | 287 ++++++++++++++++++++++++++++++--------------------- 2 files changed, 182 insertions(+), 119 deletions(-) diff --git a/Makefile.in b/Makefile.in index 0ca2d01..58c95cd 100644 --- a/Makefile.in +++ b/Makefile.in @@ -3,6 +3,7 @@ # # Dominic Mazzoni # Modifications by Mikael Magnusson +# Modifications by Stelios Bounanos # top_srcdir = @top_srcdir@ @@ -16,6 +17,7 @@ bindir = @bindir@ libdir = @libdir@ includedir = @includedir@ CC = @CC@ +CXX = @CXX@ CFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src/common -I$(top_srcdir)/src/os/unix @CFLAGS@ @DEFS@ LIBS = @LIBS@ AR = @AR@ @@ -40,7 +42,7 @@ PALIB = libportaudio.la PAINC = include/portaudio.h PA_LDFLAGS = $(LDFLAGS) $(SHARED_FLAGS) -rpath $(libdir) -no-undefined \ - -export-symbols-regex "(Pa|PaMacCore|PaJack|PaAlsa)_.*" \ + -export-symbols-regex "(Pa|PaMacCore|PaJack|PaAlsa|PaAsio)_.*" \ -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) COMMON_OBJS = \ @@ -142,11 +144,14 @@ all: lib/$(PALIB) all-recursive tests tests: bin-stamp $(TESTS) +# With ASIO enabled we must link libportaudio and all test programs with CXX lib/$(PALIB): lib-stamp $(LTOBJS) $(MAKEFILE) $(PAINC) - $(LIBTOOL) --mode=link $(CC) $(PA_LDFLAGS) -o lib/$(PALIB) $(LTOBJS) $(DLL_LIBS) + @WITH_ASIO_FALSE@ $(LIBTOOL) --mode=link $(CC) $(PA_LDFLAGS) -o lib/$(PALIB) $(LTOBJS) $(DLL_LIBS) + @WITH_ASIO_TRUE@ $(LIBTOOL) --mode=link --tag=CXX $(CXX) $(PA_LDFLAGS) -o lib/$(PALIB) $(LTOBJS) $(DLL_LIBS) $(ALL_TESTS): bin/%: lib/$(PALIB) $(MAKEFILE) $(PAINC) test/%.c - $(LIBTOOL) --mode=link $(CC) -o $@ $(CFLAGS) $(top_srcdir)/test/$*.c lib/$(PALIB) $(LIBS) + @WITH_ASIO_FALSE@ $(LIBTOOL) --mode=link $(CC) -o $@ $(CFLAGS) $(top_srcdir)/test/$*.c lib/$(PALIB) $(LIBS) + @WITH_ASIO_TRUE@ $(LIBTOOL) --mode=link --tag=CXX $(CXX) -o $@ $(CXXFLAGS) $(top_srcdir)/test/$*.c lib/$(PALIB) $(LIBS) install: lib/$(PALIB) portaudio-2.0.pc @@ -187,6 +192,9 @@ distclean: clean %.lo: %.c $(MAKEFILE) $(PAINC) $(LIBTOOL) --mode=compile $(CC) -c $(CFLAGS) $< -o $@ +%.lo: %.cpp $(MAKEFILE) $(PAINC) + $(LIBTOOL) --mode=compile --tag=CXX $(CXX) -c $(CXXFLAGS) $< -o $@ + %.o: %.cpp $(MAKEFILE) $(PAINC) $(CXX) -c $(CXXFLAGS) $< -o $@ diff --git a/configure.in b/configure.in index 749e3a4..087ff71 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ dnl dnl portaudio V19 configure.in script dnl -dnl Dominic Mazzoni, Arve Knudsen +dnl Dominic Mazzoni, Arve Knudsen, Stelios Bounanos dnl dnl Require autoconf >= 2.13 @@ -11,63 +11,87 @@ dnl Init autoconf and make sure configure is being called dnl from the right directory AC_INIT([include/portaudio.h]) +dnl Define build, build_cpu, build_vendor, build_os +AC_CANONICAL_BUILD +dnl Define host, host_cpu, host_vendor, host_os +AC_CANONICAL_HOST +dnl Define target, target_cpu, target_vendor, target_os +AC_CANONICAL_TARGET + dnl Specify options -AC_ARG_WITH(alsa, - [ --with-alsa (default=yes)], - with_alsa=$withval, with_alsa="yes") +AC_ARG_WITH(alsa, + AS_HELP_STRING([--with-alsa], [Enable support for ALSA @<:@autodetect@:>@]), + [with_alsa=$withval]) -AC_ARG_WITH(jack, - [ --with-jack (default=yes)], - with_jack=$withval, with_jack="yes") +AC_ARG_WITH(jack, + AS_HELP_STRING([--with-jack], [Enable support for JACK @<:@autodetect@:>@]), + [with_jack=$withval]) -AC_ARG_WITH(oss, - [ --with-oss (default=yes)], - with_oss=$withval, with_oss="yes") +AC_ARG_WITH(oss, + AS_HELP_STRING([--with-oss], [Enable support for OSS @<:@autodetect@:>@]), + [with_oss=$withval]) AC_ARG_WITH(asihpi, - [ --with-asihpi (default=auto)], - with_asihpi=$withval, with_asihpi="yes") - -AC_ARG_WITH(host_os, - [ --with-host_os (no default)], - host_os=$withval) + AS_HELP_STRING([--with-asihpi], [Enable support for ASIHPI @<:@autodetect@:>@]), + [with_asihpi=$withval]) AC_ARG_WITH(winapi, - [ --with-winapi ((wmme/directx/asio) default=wmme)], - with_winapi=$withval, with_winapi="wmme") - -dnl Mac API added for ASIO, can have other api's listed -AC_ARG_WITH(macapi, - [ --with-macapi ((asio/core/sm) default=core)], - with_macapi=$withval, with_macapi="core") + AS_HELP_STRING([--with-winapi], + [Select Windows API support (@<:@wmme|directx|asio|wdmks@:>@@<:@,...@:>@) @<:@wmme@:>@]), + [with_winapi=$withval], [with_winapi="wmme"]) +case "$target_os" in *mingw* | *cygwin*) + with_wmme=no + with_directx=no + with_asio=no + with_wdmks=no + for api in $(echo $with_winapi | sed 's/,/ /g'); do + case "$api" in + wmme|directx|asio|wdmks) + eval with_$api=yes + ;; + *) + AC_MSG_ERROR([unknown Windows API \"$api\" (do you need --help?)]) + ;; + esac + done + ;; +esac AC_ARG_WITH(asiodir, - [ --with-asiodir (default=/usr/local/asiosdk2)], + AS_HELP_STRING([--with-asiodir], [ASIO directory @<:@/usr/local/asiosdk2@:>@]), with_asiodir=$withval, with_asiodir="/usr/local/asiosdk2") AC_ARG_WITH(dxdir, - [ --with-dxdir (default=/usr/local/dx7sdk)], + AS_HELP_STRING([--with-dxdir], [DirectX directory @<:@/usr/local/dx7sdk@:>@]), with_dxdir=$withval, with_dxdir="/usr/local/dx7sdk") +debug_output=no AC_ARG_ENABLE(debug-output, - [ --enable-debug-output], - [if test x$enableval != xno ; then - AC_DEFINE(PA_ENABLE_DEBUG_OUTPUT,,[Enable debugging messages]) - fi - ]) + AS_HELP_STRING([--enable-debug-output], [Enable debug output @<:@no@:>@]), + [if test "x$enableval" != "xno" ; then + AC_DEFINE(PA_ENABLE_DEBUG_OUTPUT,,[Enable debugging messages]) + debug_output=yes + fi + ]) AC_ARG_ENABLE(cxx, - [ --enable-cxx (default=no)], - enable_cxx=$enableval, enable_cxx="no") + AS_HELP_STRING([--enable-cxx], [Enable C++ bindings @<:@no@:>@]), + enable_cxx=$enableval, enable_cxx="no") AC_ARG_ENABLE(mac-debug, - [ --enable-mac-debug (default=no)], - enable_mac_debug=$enableval, enable_mac_debug="no") + AS_HELP_STRING([--enable-mac-debug], [Enable Mac debug @<:@no@:>@]), + enable_mac_debug=$enableval, enable_mac_debug="no") AC_ARG_ENABLE(mac-universal, - [ --enable-mac-universal (default=yes)], - enable_mac_universal=$enableval, enable_mac_universal="yes") + AS_HELP_STRING([--enable-mac-universal], [Build Mac universal binaries @<:@yes@:>@]), + enable_mac_universal=$enableval, enable_mac_universal="yes") + +dnl Continue to accept --host_os for compatibility but do not document +dnl it (the correct way to change host_os is with --host=...). Moved +dnl here because the empty help string generates a blank line which we +dnl can use to separate PA options from libtool options. +AC_ARG_WITH(host_os, [], host_os=$withval) dnl Checks for programs. @@ -87,20 +111,27 @@ AC_C_BIGENDIAN dnl checks for various host APIs and arguments to configure that dnl turn them on or off -AC_CHECK_LIB(asound, snd_pcm_open, have_alsa=yes, have_alsa=no) -AC_CHECK_LIB(hpi, HPI_SubSysCreate, have_asihpi=yes, have_asihpi=no, -lm) -AC_CHECK_LIB(ossaudio, _oss_ioctl, have_libossaudio=yes, have_libossaudio=no) - -dnl Determine the host description for the subsequent test. -dnl PKG_CHECK_MODULES seems to check and set the host variable also, but -dnl that then requires pkg-config availability which is not standard on -dnl MinGW systems and can be a pain to install. -dnl AC_CANONICAL_HOST - -PKG_CHECK_MODULES(JACK, jack, have_jack=yes, have_jack=no) +have_alsa=no +if test "x$with_alsa" != "xno"; then + AC_CHECK_LIB(asound, snd_pcm_open, have_alsa=yes, have_alsa=no) +fi +have_asihpi=no +if test "x$with_asihpi" != "xno"; then + AC_CHECK_LIB(hpi, HPI_SubSysCreate, have_asihpi=yes, have_asihpi=no, -lm) +fi +have_libossaudio=no +have_oss=no +if test "x$with_oss" != "xno"; then + AC_CHECK_HEADERS([sys/soundcard.h linux/soundcard.h machine/soundcard.h], [have_oss=yes]) + if test "x$have_oss" = "xyes"; then + AC_CHECK_LIB(ossaudio, _oss_ioctl, have_libossaudio=yes, have_libossaudio=no) + fi +fi +have_jack=no +if test "x$with_jack" != "xno"; then + PKG_CHECK_MODULES(JACK, jack, have_jack=yes, have_jack=no) +fi -dnl checks for header files -AC_CHECK_HEADERS([sys/soundcard.h linux/soundcard.h machine/soundcard.h]) dnl sizeof checks: we will need a 16-bit and a 32-bit type @@ -149,6 +180,13 @@ else CFLAGS="$CFLAGS -DPA_LITTLE_ENDIAN" fi +add_objects() +{ + for o in $@; do + test "${OTHER_OBJS#*${o}*}" = "${OTHER_OBJS}" && OTHER_OBJS="$OTHER_OBJS $o" + done +} + case "${host_os}" in darwin* ) dnl Mac OS X configuration @@ -176,81 +214,50 @@ case "${host_os}" in CFLAGS="-std=c99 $CFLAGS $mac_arches $mac_sysroot $mac_version_min" OTHER_OBJS="src/os/unix/pa_unix_hostapis.o src/os/unix/pa_unix_util.o src/hostapi/coreaudio/pa_mac_core.o src/hostapi/coreaudio/pa_mac_core_utilities.o src/hostapi/coreaudio/pa_mac_core_blocking.o src/common/pa_ringbuffer.o" PADLL="libportaudio.dylib" - if [[ $with_macapi = "asio" ]] ; then - if [[ $with_asiodir ]] ; then - ASIODIR="$with_asiodir" - else - ASIODIR="/usr/local/asiosdk2" - fi - echo "ASIODIR: $ASIODIR" - - OTHER_OBJS="src/hostapi/asio/iasiothiscallresolver.o $ASIODIR/host/asiodrivers.o $ASIODIR/common/asio.o $ASIODIR/host/mac/asioshlib.o" - CFLAGS="$CFLAGS -I\$(top_srcdir)/src/hostapi/asio -I$ASIODIR/host/mac -I$ASIODIR/common" - CXXFLAGS="$CFLAGS" - fi ;; mingw* ) dnl MingW configuration - echo "WINAPI: $with_winapi" - if [[ $with_winapi = "directx" ]] ; then - if [[ $with_dxdir ]] ; then - DXDIR="$with_dxdir" - else - DXDIR="/usr/local/dx7sdk" - fi - echo "DXDIR: $DXDIR" - OTHER_OBJS="src/hostapi/dsound/pa_win_ds.o src/hostapi/dsound/pa_win_ds_dynlink.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_waveformat.o" + PADLL="portaudio.dll" + THREAD_CFLAGS="-mthreads" + SHARED_FLAGS="-shared" + CFLAGS="$CFLAGS -I\$(top_srcdir)/include -DPA_NO_WMME -DPA_NO_ASIO -DPA_NO_WDMKS -DPA_NO_DS" + + if [[ "x$with_directx" = "xyes" ]]; then + DXDIR="$with_dxdir" + add_objects src/hostapi/dsound/pa_win_ds.o src/hostapi/dsound/pa_win_ds_dynlink.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_waveformat.o LIBS="-lwinmm -lm -ldsound -lole32" - PADLL="portaudio.dll" - THREAD_CFLAGS="-mthreads" - SHARED_FLAGS="-shared" - DLL_LIBS="${DLL_LIBS} -lwinmm -lm -L./dx7sdk/lib -ldsound -lole32" + DLL_LIBS="${DLL_LIBS} -lwinmm -lm -L$DXDIR/lib -ldsound -lole32" #VC98="\"/c/Program Files/Microsoft Visual Studio/VC98/Include\"" #CFLAGS="$CFLAGS -I$VC98 -DPA_NO_WMME -DPA_NO_ASIO" - CFLAGS="$CFLAGS -I\$(top_srcdir)/include -I$DXDIR/include -DPA_NO_WMME -DPA_NO_ASIO" -DPA_NO_WDMKS - elif [[ $with_winapi = "asio" ]] ; then - if [[ $with_asiodir ]] ; then - ASIODIR="$with_asiodir" - else - ASIODIR="/usr/local/asiosdk2" - fi - echo "ASIODIR: $ASIODIR" - - - OTHER_OBJS="src/hostapi/asio/pa_asio.o src/common/pa_ringbuffer.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/hostapi/asio/iasiothiscallresolver.o $ASIODIR/common/asio.o $ASIODIR/host/asiodrivers.o $ASIODIR/host/pc/asiolist.o" - LIBS="-lwinmm -lm -lstdc++ -lole32 -luuid" - PADLL="portaudio.dll" - THREAD_CFLAGS="-mthreads" - SHARED_FLAGS="-shared" - DLL_LIBS="${DLL_LIBS} -lwinmm -lm -lstdc++ -lole32 -luuid" - CFLAGS="$CFLAGS -ffast-math -fomit-frame-pointer -I\$(top_srcdir)/src/common -I\$(top_srcdir)/src/hostapi/asio -I$ASIODIR/host/pc -I$ASIODIR/common -I$ASIODIR/host -DPA_NO_WMME -DPA_NO_DS -DPA_NO_WDMKS -DWINDOWS" + CFLAGS="$CFLAGS -I\$(top_srcdir)/src/os/win -I$DXDIR/include -UPA_NO_DS" + fi + + if [[ "x$with_asio" = "xyes" ]]; then + ASIODIR="$with_asiodir" + add_objects src/hostapi/asio/pa_asio.o src/common/pa_ringbuffer.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/hostapi/asio/iasiothiscallresolver.o $ASIODIR/common/asio.o $ASIODIR/host/asiodrivers.o $ASIODIR/host/pc/asiolist.o + LIBS="-lwinmm -lm -lole32 -luuid" + DLL_LIBS="${DLL_LIBS} -lwinmm -lm -lole32 -luuid" + CFLAGS="$CFLAGS -ffast-math -fomit-frame-pointer -I\$(top_srcdir)/src/common -I\$(top_srcdir)/src/hostapi/asio -I$ASIODIR/host/pc -I$ASIODIR/common -I$ASIODIR/host -UPA_NO_ASIO -DWINDOWS" CXXFLAGS="$CFLAGS" - elif [[ $with_winapi = "wdmks" ]] ; then - if [[ $with_dxdir ]] ; then - DXDIR="$with_dxdir" - else - DXDIR="/usr/local/dx7sdk" - fi - echo "DXDIR: $DXDIR" - OTHER_OBJS="src/hostapi/wdmks/pa_win_wdmks.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o" + fi + + if [[ "x$with_wdmks" = "xyes" ]]; then + DXDIR="$with_dxdir" + add_objects src/hostapi/wdmks/pa_win_wdmks.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o LIBS="-lwinmm -lm -luuid -lsetupapi -lole32" - PADLL="portaudio.dll" - THREAD_CFLAGS="-mthreads" - SHARED_FLAGS="-shared" - DLL_LIBS="${DLL_LIBS} -lwinmm -lm -L./dx7sdk/lib -luuid -lsetupapi -lole32" + DLL_LIBS="${DLL_LIBS} -lwinmm -lm -L$DXDIR/lib -luuid -lsetupapi -lole32" #VC98="\"/c/Program Files/Microsoft Visual Studio/VC98/Include\"" #CFLAGS="$CFLAGS -I$VC98 -DPA_NO_WMME -DPA_NO_ASIO" - CFLAGS="$CFLAGS -I\$(top_srcdir)/src/common -I$DXDIR/include -DPA_NO_WMME -DPA_NO_DS -DPA_NO_ASIO" - else # WMME default - OTHER_OBJS="src/hostapi/wmme/pa_win_wmme.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_waveformat.o" - LIBS="-lwinmm -lm -lstdc++ -lole32 -luuid" - PADLL="portaudio.dll" - THREAD_CFLAGS="-mthreads" - SHARED_FLAGS="-shared" + CFLAGS="$CFLAGS -I\$(top_srcdir)/src/common -I$DXDIR/include -UPA_NO_WDMKS" + fi + + if [[ "x$with_wmme" = "xyes" ]]; then + add_objects src/hostapi/wmme/pa_win_wmme.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_waveformat.o + LIBS="-lwinmm -lm -lole32 -luuid" DLL_LIBS="${DLL_LIBS} -lwinmm" - CFLAGS="$CFLAGS -I\$(top_srcdir)/src/common -DPA_NO_DS -DPA_NO_ASIO -DPA_NO_WDMKS" + CFLAGS="$CFLAGS -I\$(top_srcdir)/src/common -UPA_NO_WMME" fi ;; @@ -298,30 +305,30 @@ case "${host_os}" in AC_CHECK_LIB(pthread, pthread_create,[have_pthread="yes"], AC_MSG_ERROR([libpthread not found!])) - if [[ $have_alsa = "yes" ] && [ $with_alsa != "no" ]] ; then + if [[ "$have_alsa" = "yes" ] && [ "$with_alsa" != "no" ]] ; then DLL_LIBS="$DLL_LIBS -lasound" LIBS="$LIBS -lasound" OTHER_OBJS="$OTHER_OBJS src/hostapi/alsa/pa_linux_alsa.o" AC_DEFINE(PA_USE_ALSA) fi - if [[ $have_jack = "yes" ] && [ $with_jack != "no" ]] ; then + if [[ "$have_jack" = "yes" ] && [ "$with_jack" != "no" ]] ; then DLL_LIBS="$DLL_LIBS $JACK_LIBS" CFLAGS="$CFLAGS $JACK_CFLAGS" OTHER_OBJS="$OTHER_OBJS src/hostapi/jack/pa_jack.o src/common/pa_ringbuffer.o" AC_DEFINE(PA_USE_JACK) fi - if [[ $with_oss != "no" ]] ; then + if [[ "$with_oss" != "no" ]] ; then OTHER_OBJS="$OTHER_OBJS src/hostapi/oss/pa_unix_oss.o" - if [[ $have_libossaudio = "yes" ]] ; then + if [[ "$have_libossaudio" = "yes" ]] ; then DLL_LIBS="$DLL_LIBS -lossaudio" LIBS="$LIBS -lossaudio" fi AC_DEFINE(PA_USE_OSS) fi - if [[ $have_asihpi = "yes" ] && [ $with_asihpi != "no" ]] ; then + if [[ "$have_asihpi" = "yes" ] && [ "$with_asihpi" != "no" ]] ; then LIBS="$LIBS -lhpi" DLL_LIBS="$DLL_LIBS -lhpi" OTHER_OBJS="$OTHER_OBJS src/hostapi/asihpi/pa_linux_asihpi.o" @@ -359,4 +366,52 @@ fi AC_SUBST(ENABLE_CXX_TRUE) AC_SUBST(ENABLE_CXX_FALSE) +if test "x$with_asio" = "xyes"; then + WITH_ASIO_TRUE="" + WITH_ASIO_FALSE="@ #" +else + WITH_ASIO_TRUE="@ #" + WITH_ASIO_FALSE="" +fi +AC_SUBST(WITH_ASIO_TRUE) +AC_SUBST(WITH_ASIO_FALSE) + AC_OUTPUT([Makefile portaudio-2.0.pc]) + +AC_MSG_RESULT([ +Configuration summary: + + Target ...................... $target + C++ bindings ................ $enable_cxx + Debug output ................ $debug_output]) + +case "$target_os" in *linux*) + AC_MSG_RESULT([ + ALSA ........................ $have_alsa + ASIHPI ...................... $have_asihpi]) + ;; +esac +case "$target_os" in + *mingw* | *cygwin*) + test "x$with_directx" = "xyes" && with_directx="$with_directx (${with_dxdir})" + test "x$with_wdmks" = "xyes" && with_wdmks="$with_wdmks (${with_dxdir})" + test "x$with_asio" = "xyes" && with_asio="$with_asio (${with_asiodir})" + AC_MSG_RESULT([ + WMME ........................ $with_wmme + DSound ...................... $with_directx + WDMKS ....................... $with_wdmks + ASIO ........................ $with_asio +]) + ;; + *darwin*) + AC_MSG_RESULT([ + Mac debug flags ............. $enable_mac_debug +]) + ;; + *) + AC_MSG_RESULT([ + OSS ......................... $have_oss + JACK ........................ $have_jack +]) + ;; +esac -- 2.43.0