1# 2# PortAudioCpp V19 autoconf input file 3# Shamelessly ripped from the PortAudio one by Dominic Mazzoni 4# Ludwig Schwardt 5# 6 7# Require autoconf >= 2.13 8AC_PREREQ(2.13) 9 10AC_INIT([PortAudioCpp], [12]) 11AC_CONFIG_SRCDIR([../../include/portaudiocpp/PortAudioCpp.hxx]) 12 13###### Top-level directory of pacpp 14###### This makes it easy to shuffle the build directories 15###### Also edit AC_CONFIG_SRCDIR above (wouldn't accept this variable)! 16PACPP_ROOT="../.." 17 18###### 19###### SET THIS TO PORTAUDIO DIRECTORY 20###### 21PORTAUDIO="$PACPP_ROOT/../portaudio" 22 23# Various other variables and flags 24 25PACPP_INC="$PACPP_ROOT/include" 26INCLUDES="-I$PACPP_INC -I$PORTAUDIO -I$PORTAUDIO/pa_common" 27CFLAGS="-g -O2 -Wall -ansi -pedantic $INCLUDES" 28CXXFLAGS="$CFLAGS" 29PALIBDIR="$PORTAUDIO/lib" 30 31# Checks for programs 32 33AC_PROG_CC 34AC_PROG_CXX 35AC_PROG_LN_S 36AC_PROG_RANLIB 37AC_PROG_INSTALL 38AC_PATH_PROG(AR, ar, no) 39if [[ $AR = "no" ]] ; then 40 AC_MSG_ERROR("Could not find ar - needed to create a library"); 41fi 42 43# This must be one of the first tests we do or it will fail... 44AC_C_BIGENDIAN 45 46# Transfer these variables to the Makefile 47AC_SUBST(PACPP_ROOT) 48AC_SUBST(PORTAUDIO) 49AC_SUBST(PADLL) 50AC_SUBST(PACPP_DLL) 51AC_SUBST(PACPP_INC) 52AC_SUBST(SHARED_FLAGS) 53AC_SUBST(DLL_LIBS) 54AC_SUBST(CXXFLAGS) 55 56##################### CHECK FOR INSTALLED PACKAGES ############################ 57 58# checks for various host APIs and arguments to configure that 59# turn them on or off 60 61AC_CHECK_LIB(asound, snd_pcm_open, have_alsa=yes, have_alsa=no) 62 63# Determine the host description for the subsequent test. 64# PKG_CHECK_MODULES seems to check and set the host variable also, but 65# that then requires pkg-config availability which is not standard on 66# MinGW systems and can be a pain to install. 67AC_CANONICAL_HOST 68 69PKG_CHECK_MODULES(JACK, jack, have_jack=yes, have_jack=no) 70 71AC_ARG_WITH(alsa, 72 [ --with-alsa (default=auto)], 73 with_alsa=$withval, with_alsa="yes") 74 75AC_ARG_WITH(jack, 76 [ --with-jack (default=auto)], 77 with_jack=$withval, with_jack="yes") 78 79AC_ARG_WITH(oss, 80 [ --with-oss (default=yes)], 81 with_oss=$withval, with_oss="yes") 82 83AC_ARG_WITH(host_os, 84 [ --with-host_os (no default)], 85 host_os=$withval) 86 87AC_ARG_WITH(winapi, 88 [ --with-winapi ((wmme/directx/asio) default=wmme)], 89 with_winapi=$withval, with_winapi="wmme") 90 91# Mac API added for ASIO, can have other api's listed 92AC_ARG_WITH(macapi, 93 [ --with-macapi (asio) default=asio)], 94 with_macapi=$withval, with_macapi="asio") 95 96AC_ARG_WITH(asiodir, 97 [ --with-asiodir (default=/usr/local/asiosdk2)], 98 with_asiodir=$withval, with_asiodir="/usr/local/asiosdk2") 99 100AC_ARG_WITH(dxdir, 101 [ --with-dxdir (default=/usr/local/dx7sdk)], 102 with_dxdir=$withval, with_dxdir="/usr/local/dx7sdk") 103 104 105##################### HOST-SPECIFIC LIBRARY SETTINGS ########################## 106 107case "${host_os}" in 108 darwin* ) 109 # Mac OS X configuration 110 111 LIBS="-framework AudioUnit -framework AudioToolbox -framework CoreAudio"; 112 PADLL="libportaudio.dylib"; 113 PACPP_DLL="libportaudiocpp.dylib"; 114 SHARED_FLAGS="-framework AudioUnit -framework AudioToolbox"; 115 SHARED_FLAGS="$SHARED_FLAGS -framework CoreAudio -dynamiclib"; 116 if [[ $with_macapi = "asio" ]] ; then 117 if [[ $with_asiodir ]] ; then 118 ASIODIR="$with_asiodir"; 119 else 120 ASIODIR="/usr/local/asiosdk2"; 121 fi 122 echo "ASIODIR: $ASIODIR"; 123 fi 124 ;; 125 126 mingw* ) 127 # MingW configuration 128 129 echo "WINAPI: $with_winapi" 130 if [[ $with_winapi = "directx" ]] ; then 131 if [[ $with_dxdir ]] ; then 132 DXDIR="$with_dxdir"; 133 else 134 DXDIR="/usr/local/dx7sdk"; 135 fi 136 echo "DXDIR: $DXDIR" 137 LIBS="-L$PALIBDIR -lportaudio" 138 LIBS="$LIBS -lwinmm -lm -ldsound -lole32"; 139 PADLL="portaudio.dll"; 140 PACPP_DLL="portaudiocpp.dll"; 141 SHARED_FLAGS="-shared -mthreads"; 142 DLL_LIBS="-lwinmm -lm -L./dx7sdk/lib -ldsound -lole32"; 143 CFLAGS="$CFLAGS -DPA_NO_WMME -DPA_NO_ASIO"; 144 CXXFLAGS="$CFLAGS" 145 elif [[ $with_winapi = "asio" ]] ; then 146 if [[ $with_asiodir ]] ; then 147 ASIODIR="$with_asiodir"; 148 else 149 ASIODIR="/usr/local/asiosdk2"; 150 fi 151 echo "ASIODIR: $ASIODIR" 152 153 LIBS="-L$PALIBDIR -lportaudio" 154 LIBS="$LIBS -lwinmm -lm -lstdc++ -lole32 -luuid"; 155 PADLL="portaudio.dll"; 156 PACPP_DLL="portaudiocpp.dll"; 157 SHARED_FLAGS="-shared -mthreads"; 158 DLL_LIBS="-lwinmm -lm -lstdc++ -lole32 -luuid"; 159 CFLAGS="$CFLAGS -ffast-math -fomit-frame-pointer -DPA_NO_WMME -DPA_NO_DS -DWINDOWS"; 160 CXXFLAGS="$CFLAGS"; 161 else # WMME default 162 LIBS="-L$PALIBDIR -lportaudio" 163 LIBS="$LIBS -lwinmm -lm -lstdc++ -lole32 -luuid"; 164 PADLL="portaudio.dll"; 165 PACPP_DLL="portaudiocpp.dll"; 166 SHARED_FLAGS="-shared -mthreads"; 167 DLL_LIBS="-lwinmm"; 168 CFLAGS="$CFLAGS -DPA_NO_DS -DPA_NO_ASIO"; 169 CXXFLAGS="$CFLAGS"; 170 fi 171 ;; 172 173 cygwin* ) 174 # Cygwin configuration 175 176 LIBS="-L$PALIBDIR -lportaudio" 177 LIBS="$LIBS -lwinmm -lm"; 178 PADLL="portaudio.dll"; 179 PACPP_DLL="portaudiocpp.dll"; 180 SHARED_FLAGS="-shared -mthreads"; 181 DLL_LIBS="-lwinmm"; 182 ;; 183 184 *) 185 # Unix OSS configuration 186 187 AC_CHECK_LIB(pthread, pthread_create, 188 , 189 AC_MSG_ERROR([libpthread not found!])) 190 191 LIBS="$LIBS -L$PALIBDIR -lportaudio" 192 193 if [[ $have_jack = "yes" ] && [ $with_jack != "no" ]] ; then 194 LIBS="$LIBS $JACK_LIBS" 195 CFLAGS="$CFLAGS $JACK_CFLAGS" 196 AC_DEFINE(PA_USE_JACK) 197 fi 198 199 if [[ $have_alsa = "yes" ] && [ $with_alsa != "no" ]] ; then 200 LIBS="$LIBS -lasound" 201 AC_DEFINE(PA_USE_ALSA) 202 fi 203 204 if [[ $with_oss != "no" ]] ; then 205 AC_DEFINE(PA_USE_OSS) 206 fi 207 LIBS="$LIBS -lm -lpthread"; 208 PADLL="libportaudio.so"; 209 PACPP_DLL="libportaudiocpp.so"; 210 SHARED_FLAGS="-shared"; 211esac 212 213AC_CONFIG_FILES([Makefile]) 214AC_OUTPUT 215