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 libraries.
19 AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))
23 # Checks for header files.
25 AC_CHECK_HEADERS(sys/ioctl.h unistd.h)
27 # Checks for typedefs, structures, and compiler characteristics.
31 AC_MSG_CHECKING(whether to compile debug version)
33 [ --enable-debug = enable various debug output],
34 [AC_SUBST( debug, [-D__RTAUDIO_DEBUG__] ) AC_SUBST( cflags, [-g] ) AC_SUBST( object_path, [Debug] ) AC_MSG_RESULT(yes)],
35 [AC_SUBST( debug, [] ) AC_SUBST( cflags, [-O2] ) AC_SUBST( object_path, [Release] ) AC_MSG_RESULT(no)])
37 # Checks for functions
38 AC_CHECK_FUNC(gettimeofday, [cflags=$cflags" -DHAVE_GETTIMEOFDAY"], )
40 # Check compiler and use -Wall if gnu.
41 if [test $GXX = "yes" ;] then
42 AC_SUBST( warn, [-Wall] )
45 # Checks for package options and external software
47 AC_MSG_CHECKING(for audio API)
50 AC_SUBST( sound_api, [-D__LINUX_OSS__] )
51 AC_MSG_RESULT(using OSS)
52 AC_SUBST( audio_apis, [-D__LINUX_OSS__] )
53 cflags=$cflags" -lossaudio"
57 AC_SUBST( sound_api, [_NO_API_] )
58 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)], )
59 if [test $sound_api = -D__UNIX_JACK__;] then
61 AC_CHECK_LIB(jack, jack_client_new, , AC_MSG_ERROR(JACK support requires the jack library!))
62 AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(Jack support also requires the asound library!))
63 LIBS="`pkg-config --cflags --libs jack` $TEMP_LIBS -lasound"
64 audio_apis="-D__UNIX_JACK__"
68 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)], )
69 if [test $sound_api = -D__LINUX_ALSA__;] then
70 AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(ALSA support requires the asound library!))
71 audio_apis="-D__LINUX_ALSA__ $audio_apis"
75 AC_ARG_WITH(oss, [ --with-oss = choose OSS API support (linux only)], [AC_SUBST( sound_api, [-D__LINUX_OSS__] ) AC_MSG_RESULT(using OSS)], )
76 if test $sound_api = -D__LINUX_OSS__; then
77 audio_apis="-D__LINUX_OSS__ $audio_apis"
80 # If no audio api flags specified, use OSS
81 if [test $sound_api = _NO_API_;] then
82 AC_SUBST( sound_api, [-D__LINUX_OSS__] )
83 AC_MSG_RESULT(using OSS)
84 AC_SUBST( audio_apis, [-D__LINUX_OSS__] )
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"] )
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__UNIX_ASIO__;] then
119 audio_apis="-D__WINDOWS_ASIO__"
122 # Look for DirectSound flag
123 AC_ARG_WITH(ds, [ --with-ds = choose DirectSound API support (windoze only)], [AC_SUBST( sound_api, [-D__WINDOWS_DS__] ) AC_MSG_RESULT(using DirectSound)], )
124 if test $sound_api = -D__WINDOWS_DS__; then
125 audio_apis="-D__WINDOWS_DS__ $audio_apis"
126 LIBS="-ldsound -lwinmm $LIBS"
129 # If no audio api flags specified, use DirectSound
130 if [test $sound_api = _NO_API_;] then
131 AC_SUBST( sound_api, [-D__WINDOWS_DS__] )
132 AC_MSG_RESULT(using DirectSound)
133 audio_apis="-D__WINDOWS_DS__"
134 LIBS="-ldsound -lwinmm $LIBS"
139 # Default case for unknown realtime systems.
140 AC_MSG_ERROR(Unknown system type for realtime support!)
144 # Checks for library functions.
145 AC_PROG_GCC_TRADITIONAL
149 chmod oug+x rtaudio-config