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 # Checks for package options and external software
42 AC_MSG_CHECKING(for audio API)
45 AC_SUBST( sound_api, [-D__LINUX_OSS__] )
46 AC_MSG_RESULT(using OSS)
47 AC_SUBST( audio_apis, [-D__LINUX_OSS__] )
48 cflags=$cflags" -lossaudio"
49 AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))
53 AC_SUBST( sound_api, [_NO_API_] )
54 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)], )
55 if [test $sound_api = -D__UNIX_JACK__;] then
57 AC_CHECK_LIB(jack, jack_client_new, , AC_MSG_ERROR(JACK support requires the jack library!))
58 AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(Jack support also requires the asound library!))
59 LIBS="`pkg-config --cflags --libs jack` $TEMP_LIBS -lasound"
60 audio_apis="-D__UNIX_JACK__"
64 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)], )
65 if [test $sound_api = -D__LINUX_ALSA__;] then
66 AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(ALSA support requires the asound library!))
67 audio_apis="-D__LINUX_ALSA__ $audio_apis"
71 AC_ARG_WITH(oss, [ --with-oss = choose OSS API support (linux only)], [AC_SUBST( sound_api, [-D__LINUX_OSS__] ) AC_MSG_RESULT(using OSS)], )
72 if test $sound_api = -D__LINUX_OSS__; then
73 audio_apis="-D__LINUX_OSS__ $audio_apis"
76 # If no audio api flags specified, use ALSA
77 if [test $sound_api = _NO_API_;] then
78 AC_MSG_RESULT(using ALSA)
79 AC_SUBST( audio_apis, [-D__LINUX_ALSA__] )
80 AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(ALSA support requires the asound library!))
83 AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))
87 AC_SUBST( sound_api, [_NO_API_] )
88 AC_ARG_WITH(jack, [ --with-jack = choose JACK server support (unix only)], [AC_SUBST( sound_api, [-D__UNIX_JACK__] ) AC_MSG_RESULT(using JACK)], )
89 if [test $sound_api = -D__UNIX_JACK__;] then
90 AC_CHECK_LIB(jack, jack_client_new, , AC_MSG_ERROR(JACK support requires the jack library!))
91 audio_apis="-D__UNIX_JACK__"
95 AC_ARG_WITH(core, [ --with-core = choose CoreAudio API support (mac only)], [AC_SUBST( sound_api, [-D__MACOSX_CORE__] ) AC_MSG_RESULT(using CoreAudio)], )
96 if test $sound_api = -D__MACOSX_CORE__; then
97 AC_CHECK_HEADER(CoreAudio/CoreAudio.h, [], [AC_MSG_ERROR(CoreAudio header files not found!)] )
98 AC_SUBST( frameworks, ["-framework CoreAudio -framework CoreFoundation"] )
99 audio_apis="-D__MACOSX_CORE__ $audio_apis"
102 # If no audio api flags specified, use CoreAudio
103 if [test $sound_api = _NO_API_;] then
104 AC_SUBST( sound_api, [-D__MACOSX_CORE__] )
105 AC_MSG_RESULT(using CoreAudio)
106 AC_CHECK_HEADER(CoreAudio/CoreAudio.h,
107 [AC_SUBST( audio_apis, [-D__MACOSX_CORE__] )],
108 [AC_MSG_ERROR(CoreAudio header files not found!)] )
109 AC_SUBST( frameworks, ["-framework CoreAudio -framework CoreFoundation"] )
112 AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))
116 AC_SUBST( sound_api, [_NO_API_] )
117 AC_ARG_WITH(asio, [ --with-asio = choose ASIO API support (windoze only)], [AC_SUBST( sound_api, [-D__WINDOWS_ASIO__] ) AC_MSG_RESULT(using ASIO)], )
118 if [test $sound_api = -D__WINDOWS_ASIO__;] then
119 audio_apis="-D__WINDOWS_ASIO__"
120 AC_SUBST( objects, ["asio.o asiodrivers.o asiolist.o iasiothiscallresolver.o"] )
123 # Look for DirectSound flag
124 AC_ARG_WITH(ds, [ --with-ds = choose DirectSound API support (windoze only)], [AC_SUBST( sound_api, [-D__WINDOWS_DS__] ) AC_MSG_RESULT(using DirectSound)], )
125 if test $sound_api = -D__WINDOWS_DS__; then
126 audio_apis="-D__WINDOWS_DS__ $audio_apis"
127 LIBS="-ldsound -lwinmm $LIBS"
130 # If no audio api flags specified, use DirectSound
131 if [test $sound_api = _NO_API_;] then
132 AC_SUBST( sound_api, [-D__WINDOWS_DS__] )
133 AC_MSG_RESULT(using DirectSound)
134 audio_apis="-D__WINDOWS_DS__"
135 LIBS="-ldsound -lwinmm $LIBS"
142 # Default case for unknown realtime systems.
143 AC_MSG_ERROR(Unknown system type for realtime support!)
147 # Checks for library functions.
148 AC_PROG_GCC_TRADITIONAL
152 chmod oug+x rtaudio-config