comparison src/portaudio/configure.in @ 89:8a15ff55d9af

Add bzip2, zlib, liblo, portaudio sources
author Chris Cannam <cannam@all-day-breakfast.com>
date Wed, 20 Mar 2013 13:59:52 +0000
parents
children
comparison
equal deleted inserted replaced
88:fe7c3a0b0259 89:8a15ff55d9af
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 dnl ASIO and CXX bindings need a C++ compiler
101 if [[ "$with_asio" = "yes" ] || [ "$enable_cxx" = "yes" ]] ; then
102 AC_PROG_CXX
103 fi
104 AC_LIBTOOL_WIN32_DLL
105 AC_PROG_LIBTOOL
106 AC_PROG_INSTALL
107 AC_PROG_LN_S
108 AC_PATH_PROG(AR, ar, no)
109 if [[ $AR = "no" ]] ; then
110 AC_MSG_ERROR("Could not find ar - needed to create a library")
111 fi
112
113 dnl This must be one of the first tests we do or it will fail...
114 AC_C_BIGENDIAN
115
116 dnl checks for various host APIs and arguments to configure that
117 dnl turn them on or off
118
119 have_alsa=no
120 if test "x$with_alsa" != "xno"; then
121 AC_CHECK_LIB(asound, snd_pcm_open, have_alsa=yes, have_alsa=no)
122 fi
123 have_asihpi=no
124 if test "x$with_asihpi" != "xno"; then
125 AC_CHECK_LIB(hpi, HPI_SubSysCreate, have_asihpi=yes, have_asihpi=no, -lm)
126 fi
127 have_libossaudio=no
128 have_oss=no
129 if test "x$with_oss" != "xno"; then
130 AC_CHECK_HEADERS([sys/soundcard.h linux/soundcard.h machine/soundcard.h], [have_oss=yes])
131 if test "x$have_oss" = "xyes"; then
132 AC_CHECK_LIB(ossaudio, _oss_ioctl, have_libossaudio=yes, have_libossaudio=no)
133 fi
134 fi
135 have_jack=no
136 if test "x$with_jack" != "xno"; then
137 PKG_CHECK_MODULES(JACK, jack, have_jack=yes, have_jack=no)
138 fi
139
140
141 dnl sizeof checks: we will need a 16-bit and a 32-bit type
142
143 AC_CHECK_SIZEOF(short)
144 AC_CHECK_SIZEOF(int)
145 AC_CHECK_SIZEOF(long)
146
147 save_LIBS="${LIBS}"
148 AC_CHECK_LIB(rt, clock_gettime, [rt_libs=" -lrt"])
149 LIBS="${LIBS}${rt_libs}"
150 DLL_LIBS="${DLL_LIBS}${rt_libs}"
151 AC_CHECK_FUNCS([clock_gettime nanosleep])
152 LIBS="${save_LIBS}"
153
154 dnl LT_RELEASE=19
155 LT_CURRENT=2
156 LT_REVISION=0
157 LT_AGE=0
158
159 AC_SUBST(LT_CURRENT)
160 AC_SUBST(LT_REVISION)
161 AC_SUBST(LT_AGE)
162
163 dnl extra variables
164 AC_SUBST(OTHER_OBJS)
165 AC_SUBST(PADLL)
166 AC_SUBST(SHARED_FLAGS)
167 AC_SUBST(THREAD_CFLAGS)
168 AC_SUBST(DLL_LIBS)
169 AC_SUBST(CXXFLAGS)
170 AC_SUBST(NASM)
171 AC_SUBST(NASMOPT)
172 AC_SUBST(INCLUDES)
173
174 dnl -g is optional on darwin
175 if ( echo "${host_os}" | grep ^darwin >> /dev/null ) &&
176 [[ "$enable_mac_universal" = "yes" ] &&
177 [ "$enable_mac_debug" != "yes" ]] ; then
178 CFLAGS="-O2 -Wall -pedantic -pipe -fPIC -DNDEBUG"
179 else
180 CFLAGS=${CFLAGS:-"-g -O2 -Wall -pedantic -pipe -fPIC"}
181 fi
182
183 if [[ $ac_cv_c_bigendian = "yes" ]] ; then
184 CFLAGS="$CFLAGS -DPA_BIG_ENDIAN"
185 else
186 CFLAGS="$CFLAGS -DPA_LITTLE_ENDIAN"
187 fi
188
189 add_objects()
190 {
191 for o in $@; do
192 test "${OTHER_OBJS#*${o}*}" = "${OTHER_OBJS}" && OTHER_OBJS="$OTHER_OBJS $o"
193 done
194 }
195
196 INCLUDES=portaudio.h
197
198 dnl Include directories needed by all implementations
199 CFLAGS="$CFLAGS -I\$(top_srcdir)/include -I\$(top_srcdir)/src/common"
200
201 case "${host_os}" in
202 darwin* )
203 dnl Mac OS X configuration
204
205 AC_DEFINE(PA_USE_COREAUDIO,1)
206
207 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/os/unix -Werror"
208 LIBS="-framework CoreAudio -framework AudioToolbox -framework AudioUnit -framework Carbon"
209
210 if test "x$enable_mac_universal" = "xyes" ; then
211 if [[ -d /Developer/SDKs/MacOSX10.5.sdk ]] ; then
212 mac_version_min="-mmacosx-version-min=10.3"
213 mac_arches="-arch i386 -arch ppc -arch x86_64 -arch ppc64"
214 mac_sysroot="-isysroot /Developer/SDKs/MacOSX10.5.sdk"
215 elif [[ -d /Developer/SDKs/MacOSX10.6.sdk ]] ; then
216 mac_version_min="-mmacosx-version-min=10.4"
217 mac_arches="-arch i386 -arch x86_64"
218 mac_sysroot="-isysroot /Developer/SDKs/MacOSX10.6.sdk"
219 elif [[ -d /Developer/SDKs/MacOSX10.7.sdk ]] ; then
220 mac_version_min="-mmacosx-version-min=10.4"
221 mac_arches="-arch i386 -arch x86_64"
222 mac_sysroot="-isysroot /Developer/SDKs/MacOSX10.7.sdk"
223 else
224 mac_version_min="-mmacosx-version-min=10.3"
225 mac_arches="-arch i386 -arch ppc"
226 mac_sysroot="-isysroot /Developer/SDKs/MacOSX10.4u.sdk"
227 fi
228 else
229 mac_arches=""
230 mac_sysroot=""
231 mac_version=""
232 fi
233 SHARED_FLAGS="$LIBS -dynamiclib $mac_arches $mac_sysroot $mac_version_min"
234 CFLAGS="-std=c99 $CFLAGS $mac_arches $mac_sysroot $mac_version_min"
235 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"
236 PADLL="libportaudio.dylib"
237 ;;
238
239 mingw* )
240 dnl MingW configuration
241
242 PADLL="portaudio.dll"
243 THREAD_CFLAGS="-mthreads"
244 SHARED_FLAGS="-shared"
245 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/os/win -DPA_USE_WMME=0 -DPA_USE_ASIO=0 -DPA_USE_WDMKS=0 -DPA_USE_DS=0 -DPA_USE_WASAPI=0"
246
247 if [[ "x$with_directx" = "xyes" ]]; then
248 DXDIR="$with_dxdir"
249 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_coinitialize.o src/os/win/pa_win_waveformat.o
250 LIBS="-lwinmm -lm -ldsound -lole32"
251 DLL_LIBS="${DLL_LIBS} -lwinmm -lm -L$DXDIR/lib -ldsound -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$DXDIR/include -UPA_USE_DS -DPA_USE_DS=1"
255 fi
256
257 if [[ "x$with_asio" = "xyes" ]]; then
258 ASIODIR="$with_asiodir"
259 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/os/win/pa_win_coinitialize.o src/hostapi/asio/iasiothiscallresolver.o $ASIODIR/common/asio.o $ASIODIR/host/asiodrivers.o $ASIODIR/host/pc/asiolist.o
260 LIBS="-lwinmm -lm -lole32 -luuid"
261 DLL_LIBS="${DLL_LIBS} -lwinmm -lm -lole32 -luuid"
262 CFLAGS="$CFLAGS -ffast-math -fomit-frame-pointer -I\$(top_srcdir)/src/hostapi/asio -I$ASIODIR/host/pc -I$ASIODIR/common -I$ASIODIR/host -UPA_USE_ASIO -DPA_USE_ASIO=1 -DWINDOWS"
263
264 dnl Setting the windows version flags below resolves a conflict between Interlocked*
265 dnl definitions in mingw winbase.h and Interlocked* hacks in ASIO SDK combase.h
266 dnl combase.h is included by asiodrvr.h
267 dnl PortAudio does not actually require Win XP (winver 501) APIs
268 CFLAGS="$CFLAGS -D_WIN32_WINNT=0x0501 -DWINVER=0x0501"
269
270 CXXFLAGS="$CFLAGS"
271 fi
272
273 if [[ "x$with_wdmks" = "xyes" ]]; then
274 DXDIR="$with_dxdir"
275 add_objects src/hostapi/wdmks/pa_win_wdmks.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o
276 LIBS="-lwinmm -lm -luuid -lsetupapi -lole32"
277 DLL_LIBS="${DLL_LIBS} -lwinmm -lm -L$DXDIR/lib -luuid -lsetupapi -lole32"
278 #VC98="\"/c/Program Files/Microsoft Visual Studio/VC98/Include\""
279 #CFLAGS="$CFLAGS -I$VC98 -DPA_NO_WMME -DPA_NO_ASIO"
280 CFLAGS="$CFLAGS -I$DXDIR/include -UPA_USE_WDMKS -DPA_USE_WDMKS=1"
281 fi
282
283 if [[ "x$with_wmme" = "xyes" ]]; then
284 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
285 LIBS="-lwinmm -lm -lole32 -luuid"
286 DLL_LIBS="${DLL_LIBS} -lwinmm"
287 CFLAGS="$CFLAGS -UPA_USE_WMME -DPA_USE_WMME=1"
288 fi
289
290 if [[ "x$with_wasapi" = "xyes" ]]; then
291 add_objects src/hostapi/wasapi/pa_win_wasapi.o src/common/pa_ringbuffer.o src/os/win/pa_win_hostapis.o src/os/win/pa_win_util.o src/os/win/pa_win_coinitialize.o src/os/win/pa_win_waveformat.o
292 LIBS="-lwinmm -lm -lole32 -luuid"
293 DLL_LIBS="${DLL_LIBS} -lwinmm -lole32"
294 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/hostapi/wasapi/mingw-include -UPA_USE_WASAPI -DPA_USE_WASAPI=1"
295 fi
296 ;;
297
298 cygwin* )
299 dnl Cygwin configuration
300
301 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"
302 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/os/win -DPA_USE_DS=0 -DPA_USE_WDMKS=0 -DPA_USE_ASIO=0 -DPA_USE_WASAPI=0 -DPA_USE_WMME=1"
303 LIBS="-lwinmm -lm"
304 PADLL="portaudio.dll"
305 THREAD_CFLAGS="-mthreads"
306 SHARED_FLAGS="-shared"
307 DLL_LIBS="${DLL_LIBS} -lwinmm"
308 ;;
309
310 irix* )
311 dnl SGI IRIX audio library (AL) configuration (Pieter, oct 2-13, 2003).
312 dnl The 'dmedia' library is needed to read the Unadjusted System Time (UST).
313 dnl
314 AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR([IRIX posix thread library not found!]))
315 AC_CHECK_LIB(audio, alOpenPort, , AC_MSG_ERROR([IRIX audio library not found!]))
316 AC_CHECK_LIB(dmedia, dmGetUST, , AC_MSG_ERROR([IRIX digital media library not found!]))
317
318 dnl See the '#ifdef PA_USE_SGI' in file pa_unix/pa_unix_hostapis.c
319 dnl which selects the appropriate PaXXX_Initialize() function.
320 dnl
321 AC_DEFINE(PA_USE_SGI,1)
322
323 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/os/unix"
324
325 dnl The _REENTRANT option for pthread safety. Perhaps not necessary but it 'll do no harm.
326 dnl
327 THREAD_CFLAGS="-D_REENTRANT"
328
329 OTHER_OBJS="pa_sgi/pa_sgi.o src/os/unix/pa_unix_hostapis.o src/os/unix/pa_unix_util.o"
330
331 dnl SGI books say -lpthread should be the last of the libs mentioned.
332 dnl
333 LIBS="-lm -ldmedia -laudio -lpthread"
334 PADLL="libportaudio.so"
335 SHARED_FLAGS=""
336 ;;
337
338 *)
339 dnl Unix configuration
340
341 CFLAGS="$CFLAGS -I\$(top_srcdir)/src/os/unix"
342
343 AC_CHECK_LIB(pthread, pthread_create,[have_pthread="yes"],
344 AC_MSG_ERROR([libpthread not found!]))
345
346 if [[ "$have_alsa" = "yes" ] && [ "$with_alsa" != "no" ]] ; then
347 DLL_LIBS="$DLL_LIBS -lasound"
348 LIBS="$LIBS -lasound"
349 OTHER_OBJS="$OTHER_OBJS src/hostapi/alsa/pa_linux_alsa.o"
350 INCLUDES="$INCLUDES pa_linux_alsa.h"
351 AC_DEFINE(PA_USE_ALSA,1)
352 fi
353
354 if [[ "$have_jack" = "yes" ] && [ "$with_jack" != "no" ]] ; then
355 DLL_LIBS="$DLL_LIBS $JACK_LIBS"
356 CFLAGS="$CFLAGS $JACK_CFLAGS"
357 OTHER_OBJS="$OTHER_OBJS src/hostapi/jack/pa_jack.o src/common/pa_ringbuffer.o"
358 INCLUDES="$INCLUDES pa_jack.h"
359 AC_DEFINE(PA_USE_JACK,1)
360 fi
361
362 if [[ "$with_oss" != "no" ]] ; then
363 OTHER_OBJS="$OTHER_OBJS src/hostapi/oss/pa_unix_oss.o"
364 if [[ "$have_libossaudio" = "yes" ]] ; then
365 DLL_LIBS="$DLL_LIBS -lossaudio"
366 LIBS="$LIBS -lossaudio"
367 fi
368 AC_DEFINE(PA_USE_OSS,1)
369 fi
370
371 if [[ "$have_asihpi" = "yes" ] && [ "$with_asihpi" != "no" ]] ; then
372 LIBS="$LIBS -lhpi"
373 DLL_LIBS="$DLL_LIBS -lhpi"
374 OTHER_OBJS="$OTHER_OBJS src/hostapi/asihpi/pa_linux_asihpi.o"
375 AC_DEFINE(PA_USE_ASIHPI,1)
376 fi
377
378 DLL_LIBS="$DLL_LIBS -lm -lpthread"
379 LIBS="$LIBS -lm -lpthread"
380 PADLL="libportaudio.so"
381
382 ## support sun cc compiler flags
383 case "${host_os}" in
384 solaris*)
385 SHARED_FLAGS="-G"
386 THREAD_CFLAGS="-mt"
387 ;;
388 *)
389 SHARED_FLAGS="-fPIC"
390 THREAD_CFLAGS="-pthread"
391 ;;
392 esac
393
394 OTHER_OBJS="$OTHER_OBJS src/os/unix/pa_unix_hostapis.o src/os/unix/pa_unix_util.o"
395 esac
396 CFLAGS="$CFLAGS $THREAD_CFLAGS"
397
398 test "$enable_shared" != "yes" && SHARED_FLAGS=""
399
400 if test "$enable_cxx" = "yes"; then
401 AC_CONFIG_SUBDIRS([bindings/cpp])
402 ENABLE_CXX_TRUE=""
403 ENABLE_CXX_FALSE="#"
404 else
405 ENABLE_CXX_TRUE="#"
406 ENABLE_CXX_FALSE=""
407 fi
408 AC_SUBST(ENABLE_CXX_TRUE)
409 AC_SUBST(ENABLE_CXX_FALSE)
410
411 if test "x$with_asio" = "xyes"; then
412 WITH_ASIO_TRUE=""
413 WITH_ASIO_FALSE="@ #"
414 else
415 WITH_ASIO_TRUE="@ #"
416 WITH_ASIO_FALSE=""
417 fi
418 AC_SUBST(WITH_ASIO_TRUE)
419 AC_SUBST(WITH_ASIO_FALSE)
420
421 AC_OUTPUT([Makefile portaudio-2.0.pc])
422
423 AC_MSG_RESULT([
424 Configuration summary:
425
426 Target ...................... $target
427 C++ bindings ................ $enable_cxx
428 Debug output ................ $debug_output])
429
430 case "$target_os" in *linux*)
431 AC_MSG_RESULT([
432 ALSA ........................ $have_alsa
433 ASIHPI ...................... $have_asihpi])
434 ;;
435 esac
436 case "$target_os" in
437 *mingw* | *cygwin*)
438 test "x$with_directx" = "xyes" && with_directx="$with_directx (${with_dxdir})"
439 test "x$with_wdmks" = "xyes" && with_wdmks="$with_wdmks (${with_dxdir})"
440 test "x$with_asio" = "xyes" && with_asio="$with_asio (${with_asiodir})"
441 test "x$with_wasapi" = "xyes"
442 AC_MSG_RESULT([
443 WMME ........................ $with_wmme
444 DSound ...................... $with_directx
445 ASIO ........................ $with_asio
446 WASAPI ...................... $with_wasapi
447 WDMKS ....................... $with_wdmks
448 ])
449 ;;
450 *darwin*)
451 AC_MSG_RESULT([
452 Mac debug flags ............. $enable_mac_debug
453 ])
454 ;;
455 *)
456 AC_MSG_RESULT([
457 OSS ......................... $have_oss
458 JACK ........................ $have_jack
459 ])
460 ;;
461 esac