1 |
dnl |
2 |
dnl portaudio V19 configure.in script |
3 |
dnl |
4 |
dnl Dominic Mazzoni, Arve Knudsen, Stelios Bounanos |
5 |
dnl |
6 |
|
7 |
dnl Require autoconf >= 2.13 |
8 |
AC_PREREQ(2.13) |
9 |
|
10 |
dnl Init autoconf and make sure configure is being called |
11 |
dnl from the right directory |
12 |
AC_INIT([include/portaudio.h]) |
13 |
|
14 |
dnl Define build, build_cpu, build_vendor, build_os |
15 |
AC_CANONICAL_BUILD |
16 |
dnl Define host, host_cpu, host_vendor, host_os |
17 |
AC_CANONICAL_HOST |
18 |
dnl Define target, target_cpu, target_vendor, target_os |
19 |
AC_CANONICAL_TARGET |
20 |
|
21 |
dnl Specify options |
22 |
|
23 |
AC_ARG_WITH(alsa, |
24 |
AS_HELP_STRING([--with-alsa], [Enable support for ALSA @<:@autodetect@:>@]), |
25 |
[with_alsa=$withval]) |
26 |
|
27 |
AC_ARG_WITH(jack, |
28 |
AS_HELP_STRING([--with-jack], [Enable support for JACK @<:@autodetect@:>@]), |
29 |
[with_jack=$withval]) |
30 |
|
31 |
AC_ARG_WITH(oss, |
32 |
AS_HELP_STRING([--with-oss], [Enable support for OSS @<:@autodetect@:>@]), |
33 |
[with_oss=$withval]) |
34 |
|
35 |
AC_ARG_WITH(asihpi, |
36 |
AS_HELP_STRING([--with-asihpi], [Enable support for ASIHPI @<:@autodetect@:>@]), |
37 |
[with_asihpi=$withval]) |
38 |
|
39 |
AC_ARG_WITH(winapi, |
40 |
AS_HELP_STRING([--with-winapi], |
41 |
[Select Windows API support (@<:@wmme|directx|asio|wasapi|wdmks@:>@@<:@,...@:>@) @<:@wmme@:>@]), |
42 |
[with_winapi=$withval], [with_winapi="wmme"]) |
43 |
case "$target_os" in *mingw* | *cygwin*) |
44 |
with_wmme=no |
45 |
with_directx=no |
46 |
with_asio=no |
47 |
with_wasapi=no |
48 |
with_wdmks=no |
49 |
for api in $(echo $with_winapi | sed 's/,/ /g'); do |
50 |
case "$api" in |
51 |
wmme|directx|asio|wasapi|wdmks) |
52 |
eval with_$api=yes |
53 |
;; |
54 |
*) |
55 |
AC_MSG_ERROR([unknown Windows API \"$api\" (do you need --help?)]) |
56 |
;; |
57 |
esac |
58 |
done |
59 |
;; |
60 |
esac |
61 |
|
62 |
AC_ARG_WITH(asiodir, |
63 |
AS_HELP_STRING([--with-asiodir], [ASIO directory @<:@/usr/local/asiosdk2@:>@]), |
64 |
with_asiodir=$withval, with_asiodir="/usr/local/asiosdk2") |
65 |
|
66 |
AC_ARG_WITH(dxdir, |
67 |
AS_HELP_STRING([--with-dxdir], [DirectX directory @<:@/usr/local/dx7sdk@:>@]), |
68 |
with_dxdir=$withval, with_dxdir="/usr/local/dx7sdk") |
69 |
|
70 |
debug_output=no |
71 |
AC_ARG_ENABLE(debug-output, |
72 |
AS_HELP_STRING([--enable-debug-output], [Enable debug output @<:@no@:>@]), |
73 |
[if test "x$enableval" != "xno" ; then |
74 |
AC_DEFINE(PA_ENABLE_DEBUG_OUTPUT,,[Enable debugging messages]) |
75 |
debug_output=yes |
76 |
fi |
77 |
]) |
78 |
|
79 |
AC_ARG_ENABLE(cxx, |
80 |
AS_HELP_STRING([--enable-cxx], [Enable C++ bindings @<:@no@:>@]), |
81 |
enable_cxx=$enableval, enable_cxx="no") |
82 |
|
83 |
AC_ARG_ENABLE(mac-debug, |
84 |
AS_HELP_STRING([--enable-mac-debug], [Enable Mac debug @<:@no@:>@]), |
85 |
enable_mac_debug=$enableval, enable_mac_debug="no") |
86 |
|
87 |
AC_ARG_ENABLE(mac-universal, |
88 |
AS_HELP_STRING([--enable-mac-universal], [Build Mac universal binaries @<:@yes@:>@]), |
89 |
enable_mac_universal=$enableval, enable_mac_universal="yes") |
90 |
|
91 |
dnl Continue to accept --host_os for compatibility but do not document |
92 |
dnl it (the correct way to change host_os is with --host=...). Moved |
93 |
dnl here because the empty help string generates a blank line which we |
94 |
dnl can use to separate PA options from libtool options. |
95 |
AC_ARG_WITH(host_os, [], host_os=$withval) |
96 |
|
97 |
dnl Checks for programs. |
98 |
|
99 |
AC_PROG_CC |
100 |
AC_LIBTOOL_WIN32_DLL |
101 |
AC_PROG_LIBTOOL |
102 |
AC_PROG_INSTALL |
103 |
AC_PROG_LN_S |
104 |
AC_PATH_PROG(AR, ar, no) |
105 |
if [[ $AR = "no" ]] ; then |
106 |
AC_MSG_ERROR("Could not find ar - needed to create a library") |
107 |
fi |
108 |
|
109 |
dnl This must be one of the first tests we do or it will fail... |
110 |
AC_C_BIGENDIAN |
111 |
|
112 |
dnl checks for various host APIs and arguments to configure that |
113 |
dnl turn them on or off |
114 |
|
115 |
have_alsa=no |
116 |
if test "x$with_alsa" != "xno"; then |
117 |
AC_CHECK_LIB(asound, snd_pcm_open, have_alsa=yes, have_alsa=no) |
118 |
fi |
119 |
have_asihpi=no |
120 |
if test "x$with_asihpi" != "xno"; then |
121 |
AC_CHECK_LIB(hpi, HPI_SubSysCreate, have_asihpi=yes, have_asihpi=no, -lm) |
122 |
fi |
123 |
have_libossaudio=no |
124 |
have_oss=no |
125 |
if test "x$with_oss" != "xno"; then |
126 |
AC_CHECK_HEADERS([sys/soundcard.h linux/soundcard.h machine/soundcard.h], [have_oss=yes]) |
127 |
if test "x$have_oss" = "xyes"; then |
128 |
AC_CHECK_LIB(ossaudio, _oss_ioctl, have_libossaudio=yes, have_libossaudio=no) |
129 |
fi |
130 |
fi |
131 |
have_jack=no |
132 |
if test "x$with_jack" != "xno"; then |
133 |
PKG_CHECK_MODULES(JACK, jack, have_jack=yes, have_jack=no) |
134 |
fi |
135 |
|
136 |
|
137 |
dnl sizeof checks: we will need a 16-bit and a 32-bit type |
138 |
|
139 |
AC_CHECK_SIZEOF(short) |
140 |
AC_CHECK_SIZEOF(int) |
141 |
AC_CHECK_SIZEOF(long) |
142 |
|
143 |
save_LIBS="${LIBS}" |
144 |
AC_CHECK_LIB(rt, clock_gettime, [rt_libs=" -lrt"]) |
145 |
LIBS="${LIBS}${rt_libs}" |
146 |
DLL_LIBS="${DLL_LIBS}${rt_libs}" |
147 |
AC_CHECK_FUNCS([clock_gettime nanosleep]) |
148 |
LIBS="${save_LIBS}" |
149 |
|
150 |
dnl LT_RELEASE=19 |
151 |
LT_CURRENT=2 |
152 |
LT_REVISION=0 |
153 |
LT_AGE=0 |
154 |
|
155 |
AC_SUBST(LT_CURRENT) |
156 |
AC_SUBST(LT_REVISION) |
157 |
AC_SUBST(LT_AGE) |
158 |
|
159 |
dnl extra variables |
160 |
AC_SUBST(OTHER_OBJS) |
161 |
AC_SUBST(PADLL) |
162 |
AC_SUBST(SHARED_FLAGS) |
163 |
AC_SUBST(THREAD_CFLAGS) |
164 |
AC_SUBST(DLL_LIBS) |
165 |
AC_SUBST(CXXFLAGS) |
166 |
AC_SUBST(NASM) |
167 |
AC_SUBST(NASMOPT) |
168 |
|
169 |
dnl -g is optional on darwin |
170 |
if ( echo "${host_os}" | grep ^darwin >> /dev/null ) && |
171 |
[[ "$enable_mac_universal" = "yes" ] && |
172 |
[ "$enable_mac_debug" != "yes" ]] ; then |
173 |
CFLAGS="-O2 -Wall -pedantic -pipe -fPIC -DNDEBUG" |
174 |
else |
175 |
CFLAGS=${CFLAGS:-"-g -O2 -Wall -pedantic -pipe -fPIC"} |
176 |
fi |
177 |
|
178 |
if [[ $ac_cv_c_bigendian = "yes" ]] ; then |
179 |
CFLAGS="$CFLAGS -DPA_BIG_ENDIAN" |
180 |
else |
181 |
CFLAGS="$CFLAGS -DPA_LITTLE_ENDIAN" |
182 |
fi |
183 |
|
184 |
add_objects() |
185 |
{ |
186 |
for o in $@; do |
187 |
test "${OTHER_OBJS#*${o}*}" = "${OTHER_OBJS}" && OTHER_OBJS="$OTHER_OBJS $o" |
188 |
done |
189 |
} |
190 |
|
191 |
case "${host_os}" in |
192 |
darwin* ) |
193 |
dnl Mac OS X configuration |
194 |
|
195 |
AC_DEFINE(PA_USE_COREAUDIO) |
196 |
|
197 |
CFLAGS="$CFLAGS -Werror" |
198 |
LIBS="-framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon" |
199 |
|
200 |
if test "x$enable_mac_universal" = "xyes" ; then |
201 |
mac_version_min="-mmacosx-version-min=10.3" |
202 |
if [[ -d /Developer/SDKs/MacOSX10.5.sdk ]] ; then |
203 |
mac_arches="-arch i386 -arch ppc -arch x86_64 -arch ppc64" |
204 |
mac_sysroot="-isysroot /Developer/SDKs/MacOSX10.5.sdk" |
205 |
else |
206 |
mac_arches="-arch i386 -arch ppc" |
207 |
mac_sysroot="-isysroot /Developer/SDKs/MacOSX10.4u.sdk" |
208 |
fi |
209 |
else |
210 |
mac_arches="" |
211 |
mac_sysroot="" |
212 |
mac_version="" |
213 |
fi |
214 |
SHARED_FLAGS="$LIBS -dynamiclib $mac_arches $mac_sysroot $mac_version_min" |
215 |
CFLAGS="-std=c99 $CFLAGS $mac_arches $mac_sysroot $mac_version_min" |
216 |
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" |
217 |
PADLL="libportaudio.dylib" |
218 |
;; |
219 |
|
220 |
mingw* ) |
221 |
dnl MingW configuration |
222 |
|
223 |
PADLL="portaudio.dll" |
224 |
THREAD_CFLAGS="-mthreads" |
225 |
SHARED_FLAGS="-shared" |
226 |
CFLAGS="$CFLAGS -I\$(top_srcdir)/include -DPA_NO_WMME -DPA_NO_ASIO -DPA_NO_WDMKS -DPA_NO_DS -DPA_NO_WASAPI" |
227 |
|
228 |
if [[ "x$with_directx" = "xyes" ]]; then |
229 |
DXDIR="$with_dxdir" |
230 |
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 |
231 |
LIBS="-lwinmm -lm -ldsound -lole32" |
232 |
DLL_LIBS="${DLL_LIBS} -lwinmm -lm -L$DXDIR/lib -ldsound -lole32" |
233 |
#VC98="\"/c/Program Files/Microsoft Visual Studio/VC98/Include\"" |
234 |
#CFLAGS="$CFLAGS -I$VC98 -DPA_NO_WMME -DPA_NO_ASIO" |
235 |
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/os/win -I$DXDIR/include -UPA_NO_DS" |
236 |
fi |
237 |
|
238 |
if [[ "x$with_asio" = "xyes" ]]; then |
239 |
ASIODIR="$with_asiodir" |
240 |
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 |
241 |
LIBS="-lwinmm -lm -lole32 -luuid" |
242 |
DLL_LIBS="${DLL_LIBS} -lwinmm -lm -lole32 -luuid" |
243 |
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" |
244 |
CXXFLAGS="$CFLAGS" |
245 |
fi |
246 |
|
247 |
if [[ "x$with_wdmks" = "xyes" ]]; then |
248 |
DXDIR="$with_dxdir" |
249 |
add_objects src/hostapi/wdmks/pa_win_wdmks.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o |
250 |
LIBS="-lwinmm -lm -luuid -lsetupapi -lole32" |
251 |
DLL_LIBS="${DLL_LIBS} -lwinmm -lm -L$DXDIR/lib -luuid -lsetupapi -lole32" |
252 |
#VC98="\"/c/Program Files/Microsoft Visual Studio/VC98/Include\"" |
253 |
#CFLAGS="$CFLAGS -I$VC98 -DPA_NO_WMME -DPA_NO_ASIO" |
254 |
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/common -I$DXDIR/include -UPA_NO_WDMKS" |
255 |
fi |
256 |
|
257 |
if [[ "x$with_wmme" = "xyes" ]]; then |
258 |
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 |
259 |
LIBS="-lwinmm -lm -lole32 -luuid" |
260 |
DLL_LIBS="${DLL_LIBS} -lwinmm" |
261 |
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/common -UPA_NO_WMME" |
262 |
fi |
263 |
|
264 |
if [[ "x$with_wasapi" = "xyes" ]]; then |
265 |
add_objects src/hostapi/wasapi/pa_win_wasapi.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_waveformat.o |
266 |
LIBS="-lwinmm -lm -lole32 -luuid" |
267 |
DLL_LIBS="${DLL_LIBS} -lwinmm" |
268 |
CFLAGS="$CFLAGS -I\$(top_srcdir)/src/common -I\$(top_srcdir)/src/hostapi/wasapi/mingw-include -UPA_NO_WASAPI" |
269 |
fi |
270 |
;; |
271 |
|
272 |
cygwin* ) |
273 |
dnl Cygwin configuration |
274 |
|
275 |
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" |
276 |
CFLAGS="$CFLAGS -DPA_NO_DS -DPA_NO_WDMKS -DPA_NO_ASIO -DPA_NO_WASAPI" |
277 |
LIBS="-lwinmm -lm" |
278 |
PADLL="portaudio.dll" |
279 |
THREAD_CFLAGS="-mthreads" |
280 |
SHARED_FLAGS="-shared" |
281 |
DLL_LIBS="${DLL_LIBS} -lwinmm" |
282 |
;; |
283 |
|
284 |
irix* ) |
285 |
dnl SGI IRIX audio library (AL) configuration (Pieter, oct 2-13, 2003). |
286 |
dnl The 'dmedia' library is needed to read the Unadjusted System Time (UST). |
287 |
dnl |
288 |
AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR([IRIX posix thread library not found!])) |
289 |
AC_CHECK_LIB(audio, alOpenPort, , AC_MSG_ERROR([IRIX audio library not found!])) |
290 |
AC_CHECK_LIB(dmedia, dmGetUST, , AC_MSG_ERROR([IRIX digital media library not found!])) |
291 |
|
292 |
dnl See the '#ifdef PA_USE_SGI' in file pa_unix/pa_unix_hostapis.c |
293 |
dnl which selects the appropriate PaXXX_Initialize() function. |
294 |
dnl |
295 |
AC_DEFINE(PA_USE_SGI) |
296 |
|
297 |
dnl The _REENTRANT option for pthread safety. Perhaps not necessary but it 'll do no harm. |
298 |
dnl |
299 |
THREAD_CFLAGS="-D_REENTRANT" |
300 |
|
301 |
OTHER_OBJS="pa_sgi/pa_sgi.o src/os/unix/pa_unix_hostapis.o src/os/unix/pa_unix_util.o" |
302 |
|
303 |
dnl SGI books say -lpthread should be the last of the libs mentioned. |
304 |
dnl |
305 |
LIBS="-lm -ldmedia -laudio -lpthread" |
306 |
PADLL="libportaudio.so" |
307 |
SHARED_FLAGS="" |
308 |
;; |
309 |
|
310 |
*) |
311 |
dnl Unix configuration |
312 |
|
313 |
AC_CHECK_LIB(pthread, pthread_create,[have_pthread="yes"], |
314 |
AC_MSG_ERROR([libpthread not found!])) |
315 |
|
316 |
if [[ "$have_alsa" = "yes" ] && [ "$with_alsa" != "no" ]] ; then |
317 |
DLL_LIBS="$DLL_LIBS -lasound" |
318 |
LIBS="$LIBS -lasound" |
319 |
OTHER_OBJS="$OTHER_OBJS src/hostapi/alsa/pa_linux_alsa.o" |
320 |
AC_DEFINE(PA_USE_ALSA) |
321 |
fi |
322 |
|
323 |
if [[ "$have_jack" = "yes" ] && [ "$with_jack" != "no" ]] ; then |
324 |
DLL_LIBS="$DLL_LIBS $JACK_LIBS" |
325 |
CFLAGS="$CFLAGS $JACK_CFLAGS" |
326 |
OTHER_OBJS="$OTHER_OBJS src/hostapi/jack/pa_jack.o src/common/pa_ringbuffer.o" |
327 |
AC_DEFINE(PA_USE_JACK) |
328 |
fi |
329 |
|
330 |
if [[ "$with_oss" != "no" ]] ; then |
331 |
OTHER_OBJS="$OTHER_OBJS src/hostapi/oss/pa_unix_oss.o" |
332 |
if [[ "$have_libossaudio" = "yes" ]] ; then |
333 |
DLL_LIBS="$DLL_LIBS -lossaudio" |
334 |
LIBS="$LIBS -lossaudio" |
335 |
fi |
336 |
AC_DEFINE(PA_USE_OSS) |
337 |
fi |
338 |
|
339 |
if [[ "$have_asihpi" = "yes" ] && [ "$with_asihpi" != "no" ]] ; then |
340 |
LIBS="$LIBS -lhpi" |
341 |
DLL_LIBS="$DLL_LIBS -lhpi" |
342 |
OTHER_OBJS="$OTHER_OBJS src/hostapi/asihpi/pa_linux_asihpi.o" |
343 |
AC_DEFINE(PA_USE_ASIHPI) |
344 |
fi |
345 |
|
346 |
DLL_LIBS="$DLL_LIBS -lm -lpthread" |
347 |
LIBS="$LIBS -lm -lpthread" |
348 |
PADLL="libportaudio.so" |
349 |
|
350 |
## support sun cc compiler flags |
351 |
case "${host_os}" in |
352 |
solaris*) |
353 |
SHARED_FLAGS="-G" |
354 |
THREAD_CFLAGS="-mt" |
355 |
;; |
356 |
*) |
357 |
SHARED_FLAGS="-shared -fPIC" |
358 |
THREAD_CFLAGS="-pthread" |
359 |
;; |
360 |
esac |
361 |
|
362 |
OTHER_OBJS="$OTHER_OBJS src/os/unix/pa_unix_hostapis.o src/os/unix/pa_unix_util.o" |
363 |
esac |
364 |
CFLAGS="$CFLAGS $THREAD_CFLAGS" |
365 |
|
366 |
if test "$enable_cxx" = "yes"; then |
367 |
AC_CONFIG_SUBDIRS([bindings/cpp]) |
368 |
ENABLE_CXX_TRUE="" |
369 |
ENABLE_CXX_FALSE="#" |
370 |
else |
371 |
ENABLE_CXX_TRUE="#" |
372 |
ENABLE_CXX_FALSE="" |
373 |
fi |
374 |
AC_SUBST(ENABLE_CXX_TRUE) |
375 |
AC_SUBST(ENABLE_CXX_FALSE) |
376 |
|
377 |
if test "x$with_asio" = "xyes"; then |
378 |
WITH_ASIO_TRUE="" |
379 |
WITH_ASIO_FALSE="@ #" |
380 |
else |
381 |
WITH_ASIO_TRUE="@ #" |
382 |
WITH_ASIO_FALSE="" |
383 |
fi |
384 |
AC_SUBST(WITH_ASIO_TRUE) |
385 |
AC_SUBST(WITH_ASIO_FALSE) |
386 |
|
387 |
AC_OUTPUT([Makefile portaudio-2.0.pc]) |
388 |
|
389 |
AC_MSG_RESULT([ |
390 |
Configuration summary: |
391 |
|
392 |
Target ...................... $target |
393 |
C++ bindings ................ $enable_cxx |
394 |
Debug output ................ $debug_output]) |
395 |
|
396 |
case "$target_os" in *linux*) |
397 |
AC_MSG_RESULT([ |
398 |
ALSA ........................ $have_alsa |
399 |
ASIHPI ...................... $have_asihpi]) |
400 |
;; |
401 |
esac |
402 |
case "$target_os" in |
403 |
*mingw* | *cygwin*) |
404 |
test "x$with_directx" = "xyes" && with_directx="$with_directx (${with_dxdir})" |
405 |
test "x$with_wdmks" = "xyes" && with_wdmks="$with_wdmks (${with_dxdir})" |
406 |
test "x$with_asio" = "xyes" && with_asio="$with_asio (${with_asiodir})" |
407 |
test "x$with_wasapi" = "xyes" |
408 |
AC_MSG_RESULT([ |
409 |
WMME ........................ $with_wmme |
410 |
DSound ...................... $with_directx |
411 |
ASIO ........................ $with_asio |
412 |
WASAPI ...................... $with_wasapi |
413 |
WDMKS ....................... $with_wdmks |
414 |
]) |
415 |
;; |
416 |
*darwin*) |
417 |
AC_MSG_RESULT([ |
418 |
Mac debug flags ............. $enable_mac_debug |
419 |
]) |
420 |
;; |
421 |
*) |
422 |
AC_MSG_RESULT([ |
423 |
OSS ......................... $have_oss |
424 |
JACK ........................ $have_jack |
425 |
]) |
426 |
;; |
427 |
esac |