1 # Process this file with autoconf to produce a configure script.
2 AC_INIT(RtAudio, 4.0, gary@music.mcgill.ca, rtaudio)
3 AC_CONFIG_SRCDIR(RtAudio.cpp)
4 AC_CONFIG_FILES([rtaudio-config Makefile tests/Makefile])
6 # Fill GXX with something before test.
7 AC_SUBST( GXX, ["no"] )
11 AC_PROG_CXX(g++ CC c++ cxx)
13 AC_PATH_PROG(AR, ar, no)
14 if [[ $AR = "no" ]] ; then
15 AC_MSG_ERROR("Could not find ar - needed to create a library");
18 # Checks for header files.
20 AC_CHECK_HEADERS(sys/ioctl.h unistd.h)
22 # Checks for typedefs, structures, and compiler characteristics.
26 AC_MSG_CHECKING(whether to compile debug version)
28 [ --enable-debug = enable various debug output],
29 [AC_SUBST( debug, [-D__RTAUDIO_DEBUG__] ) AC_SUBST( cflags, [-g] ) AC_SUBST( object_path, [Debug] ) AC_MSG_RESULT(yes)],
30 [AC_SUBST( debug, [] ) AC_SUBST( cflags, [-O2] ) AC_SUBST( object_path, [Release] ) AC_MSG_RESULT(no)])
32 # Checks for functions
33 AC_CHECK_FUNC(gettimeofday, [CFLAGS=$CFLAGS" -DHAVE_GETTIMEOFDAY"], )
35 # Check compiler and use -Wall if gnu.
36 if [test $GXX = "yes" ;] then
37 AC_SUBST( warn, [-Wall] )
40 CFLAGS="$CFLAGS $cflags"
42 # Checks for package options and external software
44 AC_MSG_CHECKING(for audio API)
47 AC_SUBST( sound_api, [-D__LINUX_OSS__] )
48 AC_MSG_RESULT(using OSS)
49 AC_SUBST( audio_apis, [-D__LINUX_OSS__] )
50 CFLAGS=$CFLAGS" -lossaudio"
51 AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))
55 AC_SUBST( sound_api, [_NO_API_] )
56 AC_ARG_WITH(jack, [ --with-jack = choose JACK server support (mac and linux only)], [AC_SUBST( sound_api, [-D__UNIX_JACK__] ) AC_MSG_RESULT(using JACK)], )
57 if [test $sound_api = -D__UNIX_JACK__;] then
59 AC_CHECK_LIB(jack, jack_client_new, , AC_MSG_ERROR(JACK support requires the jack library!))
60 AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(Jack support also requires the asound library!))
61 LIBS="`pkg-config --CFLAGS --libs jack` $TEMP_LIBS -lasound"
62 audio_apis="-D__UNIX_JACK__"
66 AC_ARG_WITH(alsa, [ --with-alsa = choose native ALSA API support (linux only)], [AC_SUBST( sound_api, [-D__LINUX_ALSA__] ) AC_MSG_RESULT(using ALSA)], )
67 if [test $sound_api = -D__LINUX_ALSA__;] then
68 AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(ALSA support requires the asound library!))
69 audio_apis="-D__LINUX_ALSA__ $audio_apis"
73 AC_ARG_WITH(oss, [ --with-oss = choose OSS API support (linux only)], [AC_SUBST( sound_api, [-D__LINUX_OSS__] ) AC_MSG_RESULT(using OSS)], )
74 if test $sound_api = -D__LINUX_OSS__; then
75 audio_apis="-D__LINUX_OSS__ $audio_apis"
78 # If no audio api flags specified, use ALSA
79 if [test $sound_api = _NO_API_;] then
80 AC_MSG_RESULT(using ALSA)
81 AC_SUBST( audio_apis, [-D__LINUX_ALSA__] )
82 AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(ALSA support requires the asound library!))
85 AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))
89 AC_SUBST( sound_api, [_NO_API_] )
90 AC_ARG_WITH(jack, [ --with-jack = choose JACK server support (unix only)], [AC_SUBST( sound_api, [-D__UNIX_JACK__] ) AC_MSG_RESULT(using JACK)], )
91 if [test $sound_api = -D__UNIX_JACK__;] then
92 AC_CHECK_LIB(jack, jack_client_new, , AC_MSG_ERROR(JACK support requires the jack library!))
93 audio_apis="-D__UNIX_JACK__"
97 AC_ARG_WITH(core, [ --with-core = choose CoreAudio API support (mac only)], [AC_SUBST( sound_api, [-D__MACOSX_CORE__] ) AC_MSG_RESULT(using CoreAudio)], )
98 if test $sound_api = -D__MACOSX_CORE__; then
99 AC_CHECK_HEADER(CoreAudio/CoreAudio.h, [], [AC_MSG_ERROR(CoreAudio header files not found!)] )
100 AC_SUBST( frameworks, ["-framework CoreAudio -framework CoreFoundation"] )
101 audio_apis="-D__MACOSX_CORE__ $audio_apis"
104 # If no audio api flags specified, use CoreAudio
105 if [test $sound_api = _NO_API_;] then
106 AC_SUBST( sound_api, [-D__MACOSX_CORE__] )
107 AC_MSG_RESULT(using CoreAudio)
108 AC_CHECK_HEADER(CoreAudio/CoreAudio.h,
109 [AC_SUBST( audio_apis, [-D__MACOSX_CORE__] )],
110 [AC_MSG_ERROR(CoreAudio header files not found!)] )
111 AC_SUBST( frameworks, ["-framework CoreAudio -framework CoreFoundation"] )
114 AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))
118 AC_SUBST( sound_api, [_NO_API_] )
119 AC_ARG_WITH(asio, [ --with-asio = choose ASIO API support (windoze only)], [AC_SUBST( sound_api, [-D__WINDOWS_ASIO__] ) AC_MSG_RESULT(using ASIO)], )
120 if [test $sound_api = -D__WINDOWS_ASIO__;] then
121 audio_apis="-D__WINDOWS_ASIO__"
122 AC_SUBST( objects, ["asio.o asiodrivers.o asiolist.o iasiothiscallresolver.o"] )
125 # Look for DirectSound flag
126 AC_ARG_WITH(ds, [ --with-ds = choose DirectSound API support (windoze only)], [AC_SUBST( sound_api, [-D__WINDOWS_DS__] ) AC_MSG_RESULT(using DirectSound)], )
127 if test $sound_api = -D__WINDOWS_DS__; then
128 audio_apis="-D__WINDOWS_DS__ $audio_apis"
129 LIBS="-ldsound -lwinmm $LIBS"
132 # If no audio api flags specified, use DirectSound
133 if [test $sound_api = _NO_API_;] then
134 AC_SUBST( sound_api, [-D__WINDOWS_DS__] )
135 AC_MSG_RESULT(using DirectSound)
136 audio_apis="-D__WINDOWS_DS__"
137 LIBS="-ldsound -lwinmm $LIBS"
144 # Default case for unknown realtime systems.
145 AC_MSG_ERROR(Unknown system type for realtime support!)
149 # Checks for library functions.
150 AC_PROG_GCC_TRADITIONAL
154 chmod oug+x rtaudio-config