1 # Process this file with autoconf to produce a configure script.
2 AC_INIT(RtAudio, 5.0.0, gary@music.mcgill.ca, rtaudio)
3 AC_CONFIG_AUX_DIR(config)
4 AC_CONFIG_SRCDIR(RtAudio.cpp)
5 AC_CONFIG_FILES([rtaudio.pc Makefile tests/Makefile doc/Makefile doc/doxygen/Doxyfile])
6 AM_INIT_AUTOMAKE([1.14 -Wall -Werror foreign subdir-objects])
8 # libtool version: current:revision:age
10 # If the library source code has changed at all since the last update, then
11 # increment revision (`c:r:a' becomes `c:r+1:a').
13 # If any interfaces have been added, removed, or changed since the last update,
14 # increment current, and set revision to 0.
16 # If any interfaces have been added since the last public release, then
19 # If any interfaces have been removed since the last public release, then set
21 m4_define([lt_current], 6)
22 m4_define([lt_revision], 0)
23 m4_define([lt_age], 0)
25 m4_define([lt_version_info], [lt_current:lt_revision:lt_age])
26 m4_define([lt_current_minus_age], [m4_eval(lt_current - lt_age)])
28 SO_VERSION=lt_version_info
36 # Check version number coherency between RtAudio.h and configure.ac
37 AC_MSG_CHECKING([that version numbers are coherent])
39 [AC_LANG_PROGRAM([#include <string.h>
40 `grep "define RTAUDIO_VERSION" $srcdir/RtAudio.h`],
41 [return strcmp(RTAUDIO_VERSION, PACKAGE_VERSION);])],
42 [AC_MSG_RESULT([yes])],
43 [AC_MSG_FAILURE([testing RTAUDIO_VERSION==PACKAGE_VERSION failed, check that RtAudio.h defines RTAUDIO_VERSION as "$PACKAGE_VERSION" or that the first line of configure.ac has been updated.])])
45 # Enable some nice automake features if they are available
46 m4_ifdef([AM_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
47 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
49 # Fill GXX with something before test.
52 dnl Check for pkg-config program, used for configuring some libraries.
53 m4_define_default([PKG_PROG_PKG_CONFIG],
54 [AC_MSG_CHECKING([pkg-config])
59 dnl If the pkg-config autoconf support isn't installed, define its
60 dnl autoconf macro to disable any packages depending on it.
61 m4_define_default([PKG_CHECK_MODULES],
62 [AC_MSG_CHECKING([$1])
67 AC_MSG_CHECKING(whether to compile debug version)
69 [AS_HELP_STRING([--enable-debug],[enable various debug output])],
70 [: ${CXXFLAGS="-g -O0"};] [AC_DEFINE([__RTAUDIO_DEBUG__])],
71 [: ${CXXFLAGS="-O3"}])
73 # Checks for programs.
74 AC_PROG_CXX(g++ CC c++ cxx)
76 AC_PATH_PROG(AR, ar, no)
77 AS_IF([test "x${AR} = "xno" ], [
78 AC_MSG_ERROR("Could not find ar - needed to create a library");
83 AC_CONFIG_MACRO_DIR([m4])
85 # Checks for header files.
87 AC_CHECK_HEADERS(sys/ioctl.h unistd.h)
89 # Check compiler and use -Wall if gnu
90 AS_IF([test "x${GXX} = "xyes" ], [
91 CXXFLAGS="${CXXFLAGS} -Wall -Wextra"
92 # Add -Werror in debug mode
93 if test x"${enable_debug+set}" = xset; then
94 CXXFLAGS="${CXXFLAGS} -Werror"
98 # Checks for functions
99 AC_CHECK_FUNC(gettimeofday, [cppflag="$cppflag -DHAVE_GETTIMEOFDAY"], )
102 AC_CHECK_PROG( DOXYGEN, [doxygen], [doxygen] )
103 AM_CONDITIONAL( MAKE_DOC, [test "x${DOXYGEN}" != x] )
105 # Copy doc files to build dir if necessary
106 AC_CONFIG_LINKS( [doc/release.txt:doc/release.txt] )
107 AC_CONFIG_LINKS( [doc/doxygen/footer.html:doc/doxygen/footer.html] )
108 AC_CONFIG_LINKS( [doc/doxygen/error.txt:doc/doxygen/error.txt] )
109 AC_CONFIG_LINKS( [doc/doxygen/tutorial.txt:doc/doxygen/tutorial.txt] )
110 AC_CONFIG_LINKS( [doc/doxygen/compiling.txt:doc/doxygen/compiling.txt] )
111 AC_CONFIG_LINKS( [doc/doxygen/acknowledge.txt:doc/doxygen/acknowledge.txt] )
112 AC_CONFIG_LINKS( [doc/doxygen/license.txt:doc/doxygen/license.txt] )
113 AC_CONFIG_LINKS( [doc/doxygen/header.html:doc/doxygen/header.html] )
114 AC_CONFIG_LINKS( [doc/doxygen/duplex.txt:doc/doxygen/duplex.txt] )
115 AC_CONFIG_LINKS( [doc/doxygen/settings.txt:doc/doxygen/settings.txt] )
116 AC_CONFIG_LINKS( [doc/doxygen/probe.txt:doc/doxygen/probe.txt] )
117 AC_CONFIG_LINKS( [doc/doxygen/playback.txt:doc/doxygen/playback.txt] )
118 AC_CONFIG_LINKS( [doc/doxygen/multi.txt:doc/doxygen/multi.txt] )
119 AC_CONFIG_LINKS( [doc/doxygen/recording.txt:doc/doxygen/recording.txt] )
120 AC_CONFIG_LINKS( [doc/doxygen/apinotes.txt:doc/doxygen/apinotes.txt] )
121 AC_CONFIG_LINKS( [doc/images/mcgill.gif:doc/images/mcgill.gif] )
122 AC_CONFIG_LINKS( [doc/images/ccrma.gif:doc/images/ccrma.gif] )
124 # Checks for package options and external software
127 AC_MSG_CHECKING(for audio API)
129 AC_ARG_WITH(jack, [ --with-jack = choose JACK server support (mac and linux only)])
130 AS_IF([test "x$with_jack" == "xyes"], [
131 api="$api -D__UNIX_JACK__"
132 AC_MSG_RESULT(using JACK)
133 AC_CHECK_LIB(jack, jack_client_open, , AC_MSG_ERROR(JACK support requires the jack library!))])
137 AS_IF([test "$api" == ""], [
138 AC_MSG_RESULT(using OSS)
139 api="$api -D__LINUX_OSS__"
140 LIBS="$LIBS -lossaudio"
141 AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))])
145 AS_IF([test "$api" == ""], [
146 AC_MSG_RESULT(using OSS)
147 api="$api -D__LINUX_OSS__"
148 LIBS="$LIBS -lossaudio"
149 AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))])
154 AC_ARG_WITH(alsa, [ --with-alsa = choose native ALSA API support (linux only)])
155 AS_IF([test "x$with_alsa" == "xyes"], [
156 api="$api -D__LINUX_ALSA__"
158 AC_MSG_RESULT(using ALSA)
159 AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(ALSA support requires the asound library!))])
161 # Look for PULSE flag
162 AC_ARG_WITH(pulse, [ --with-pulse = choose PulseAudio API support (linux only)])
163 AS_IF([test "x$with_pulse" == "xyes"], [
164 api="$api -D__LINUX_PULSE__"
165 req="$req libpulse-simple"
166 AC_MSG_RESULT(using PulseAudio)
167 AC_CHECK_LIB(pulse-simple, pa_simple_flush, , AC_MSG_ERROR(PulseAudio support requires the pulse-simple library!))])
170 AC_ARG_WITH(oss, [ --with-oss = choose OSS API support (unixes)])
171 AS_IF([test "x$with_oss" == "xyes"], [
172 api="$api -D__LINUX_OSS__"
173 AC_MSG_RESULT(using OSS)])
175 # If no audio api flags specified, use ALSA
176 AS_IF([test "x$api" = "x" ], [
177 AC_MSG_RESULT(using ALSA)
178 api="${api} -D__LINUX_ALSA__"
180 AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(ALSA support requires the asound library!))
182 AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))
187 AC_ARG_WITH(core, [ --with-core = choose CoreAudio API support (mac only)])
188 AS_IF([test "x$with_core" == "xyes"], [
189 api="$api -D__MACOSX_CORE__"
190 AC_MSG_RESULT(using CoreAudio)
191 AC_CHECK_HEADER(CoreAudio/CoreAudio.h, [], [AC_MSG_ERROR(CoreAudio header files not found!)] )
192 LIBS="$LIBS -framework CoreAudio -framework CoreFoundation" ])
194 # If no audio api flags specified, use CoreAudio
195 AS_IF([test "x$api" = "x" ], [
196 AC_MSG_RESULT(using CoreAudio)
197 api="${api} -D__MACOSX_CORE__"
198 AC_CHECK_HEADER(CoreAudio/CoreAudio.h,
200 [AC_MSG_ERROR(CoreAudio header files not found!)] )
201 LIBS="LIBS -framework CoreAudio -framework CoreFoundation"
204 AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))
208 AC_ARG_WITH(asio, [ --with-asio = choose ASIO API support (windoze only)])
209 AS_IF([test "x$with_asio" == "xyes"], [
210 api="$api -D__WINDOWS_ASIO__"
211 AC_MSG_RESULT(using ASIO)
212 AC_SUBST( objects, ["asio.o asiodrivers.o asiolist.o iasiothiscallresolver.o"] ) ])
214 # Look for DirectSound flag
215 AC_ARG_WITH(ds, [ --with-ds = choose DirectSound API support (windoze only)])
216 AS_IF([test "x$with_ds" == "xyes"], [
217 api="$api -D__WINDOWS_DS__"
218 AC_MSG_RESULT(using DirectSound)
219 LIBS="-ldsound -lwinmm $LIBS" ])
221 # Look for WASAPI flag
222 AC_ARG_WITH(wasapi, [ --with-wasapi = choose Windows Audio Session API support (windoze only)])
223 AS_IF([test "x$with_wasapi" == "xyes"], [
224 api="$api -D__WINDOWS_WASAPI__"
225 AC_MSG_RESULT(using WASAPI)
226 LIBS="-lwinmm -luuid -lksuser $LIBS" ])
228 # If no audio api flags specified, use DS
229 AS_IF([test "x$api" = "x" ], [
230 AC_MSG_RESULT(using DirectSound)
231 api="$api -D__WINDOWS_DS__"
232 LIBS="-ldsound -lwinmm $LIBS"
239 # Default case for unknown realtime systems.
240 AC_MSG_ERROR(Unknown system type for realtime support!)
244 CPPFLAGS="$CPPFLAGS $api"