You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

255 lines
8.6KB

  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])
  7. # libtool version: current:revision:age
  8. #
  9. # If the library source code has changed at all since the last update, then
  10. # increment revision (`c:r:a' becomes `c:r+1:a').
  11. #
  12. # If any interfaces have been added, removed, or changed since the last update,
  13. # increment current, and set revision to 0.
  14. #
  15. # If any interfaces have been added since the last public release, then
  16. # increment age.
  17. #
  18. # If any interfaces have been removed since the last public release, then set
  19. # age to 0.
  20. m4_define([lt_current], 6)
  21. m4_define([lt_revision], 0)
  22. m4_define([lt_age], 0)
  23. m4_define([lt_version_info], [lt_current:lt_revision:lt_age])
  24. m4_define([lt_current_minus_age], [m4_eval(lt_current - lt_age)])
  25. SO_VERSION=lt_version_info
  26. AC_SUBST(SO_VERSION)
  27. AC_SUBST(api)
  28. AC_SUBST(req)
  29. api=""
  30. req=""
  31. # Check version number coherency between RtAudio.h and configure.ac
  32. AC_MSG_CHECKING([that version numbers are coherent])
  33. RTAUDIO_VERSION=`sed -n 's/#define RTAUDIO_VERSION "\(.*\)"/\1/p' $srcdir/RtAudio.h`
  34. AS_IF(
  35. [test "x$RTAUDIO_VERSION" != "x$PACKAGE_VERSION"],
  36. [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.])]
  37. )
  38. # Enable some nice automake features if they are available
  39. m4_ifdef([AM_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
  40. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  41. # Fill GXX with something before test.
  42. GXX = "no"
  43. dnl Check for pkg-config program, used for configuring some libraries.
  44. m4_define_default([PKG_PROG_PKG_CONFIG],
  45. [AC_MSG_CHECKING([pkg-config])
  46. AC_MSG_RESULT([no])])
  47. PKG_PROG_PKG_CONFIG
  48. dnl If the pkg-config autoconf support isn't installed, define its
  49. dnl autoconf macro to disable any packages depending on it.
  50. m4_define_default([PKG_CHECK_MODULES],
  51. [AC_MSG_CHECKING([$1])
  52. AC_MSG_RESULT([no])
  53. $4])
  54. # Check for debug
  55. AC_MSG_CHECKING(whether to compile debug version)
  56. AC_ARG_ENABLE(debug,
  57. [AS_HELP_STRING([--enable-debug],[enable various debug output])],
  58. [: ${CXXFLAGS="-g -O0"};] [AC_DEFINE([__RTAUDIO_DEBUG__])],
  59. [: ${CXXFLAGS="-O3"}])
  60. # Checks for programs.
  61. AC_PROG_CXX(g++ CC c++ cxx)
  62. AM_PROG_AR
  63. AC_PATH_PROG(AR, ar, no)
  64. AS_IF([test "x${AR} = "xno" ], [
  65. AC_MSG_ERROR("Could not find ar - needed to create a library");
  66. ])
  67. # Initialize libtool
  68. LT_INIT([win32-dll])
  69. AC_CONFIG_MACRO_DIR([m4])
  70. # Checks for header files.
  71. AC_HEADER_STDC
  72. AC_CHECK_HEADERS(sys/ioctl.h unistd.h)
  73. # Check compiler and use -Wall if gnu
  74. AS_IF([test "x${GXX} = "xyes" ], [
  75. CXXFLAGS="${CXXFLAGS} -Wall -Wextra"
  76. # Add -Werror in debug mode
  77. if test x"${enable_debug+set}" = xset; then
  78. CXXFLAGS="${CXXFLAGS} -Werror"
  79. fi
  80. ])
  81. # Checks for functions
  82. AC_CHECK_FUNC(gettimeofday, [cppflag="$cppflag -DHAVE_GETTIMEOFDAY"], )
  83. # Checks for doxygen
  84. AC_CHECK_PROG( DOXYGEN, [doxygen], [doxygen] )
  85. AM_CONDITIONAL( MAKE_DOC, [test "x${DOXYGEN}" != x] )
  86. # Copy doc files to build dir if necessary
  87. AC_CONFIG_LINKS( [doc/release.txt:doc/release.txt] )
  88. AC_CONFIG_LINKS( [doc/doxygen/footer.html:doc/doxygen/footer.html] )
  89. AC_CONFIG_LINKS( [doc/doxygen/error.txt:doc/doxygen/error.txt] )
  90. AC_CONFIG_LINKS( [doc/doxygen/tutorial.txt:doc/doxygen/tutorial.txt] )
  91. AC_CONFIG_LINKS( [doc/doxygen/compiling.txt:doc/doxygen/compiling.txt] )
  92. AC_CONFIG_LINKS( [doc/doxygen/acknowledge.txt:doc/doxygen/acknowledge.txt] )
  93. AC_CONFIG_LINKS( [doc/doxygen/license.txt:doc/doxygen/license.txt] )
  94. AC_CONFIG_LINKS( [doc/doxygen/header.html:doc/doxygen/header.html] )
  95. AC_CONFIG_LINKS( [doc/doxygen/duplex.txt:doc/doxygen/duplex.txt] )
  96. AC_CONFIG_LINKS( [doc/doxygen/settings.txt:doc/doxygen/settings.txt] )
  97. AC_CONFIG_LINKS( [doc/doxygen/probe.txt:doc/doxygen/probe.txt] )
  98. AC_CONFIG_LINKS( [doc/doxygen/playback.txt:doc/doxygen/playback.txt] )
  99. AC_CONFIG_LINKS( [doc/doxygen/multi.txt:doc/doxygen/multi.txt] )
  100. AC_CONFIG_LINKS( [doc/doxygen/recording.txt:doc/doxygen/recording.txt] )
  101. AC_CONFIG_LINKS( [doc/doxygen/apinotes.txt:doc/doxygen/apinotes.txt] )
  102. AC_CONFIG_LINKS( [doc/images/mcgill.gif:doc/images/mcgill.gif] )
  103. AC_CONFIG_LINKS( [doc/images/ccrma.gif:doc/images/ccrma.gif] )
  104. # Checks for package options and external software
  105. AC_CANONICAL_HOST
  106. AC_MSG_CHECKING(for audio API)
  107. AC_ARG_WITH(jack, [ --with-jack = choose JACK server support (mac and linux only)])
  108. AS_IF([test "x$with_jack" = "xyes"], [
  109. AC_MSG_RESULT(using JACK)
  110. AC_CHECK_LIB(jack, jack_client_open, , AC_MSG_ERROR(JACK support requires the jack library!))
  111. api="$api -D__UNIX_JACK__"
  112. ])
  113. case $host in
  114. *-*-netbsd*)
  115. AS_IF([test "x$api" = "x"], [
  116. AC_MSG_RESULT(using OSS)
  117. api="$api -D__LINUX_OSS__"
  118. AC_CHECK_LIB(ossaudio, main, , AC_MSG_ERROR([RtAudio requires the ossaudio library]))
  119. AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))
  120. ])
  121. ;;
  122. *-*-freebsd*)
  123. AS_IF([test "x$api" = "x"], [
  124. AC_MSG_RESULT(using OSS)
  125. api="$api -D__LINUX_OSS__"
  126. AC_CHECK_LIB(ossaudio, main, , AC_MSG_ERROR([RtAudio requires the ossaudio library]))
  127. AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))
  128. ])
  129. ;;
  130. *-*-linux*)
  131. # Look for ALSA flag
  132. AC_ARG_WITH(alsa, [ --with-alsa = choose native ALSA API support (linux only)])
  133. AS_IF([test "x$with_alsa" = "xyes"], [
  134. AC_MSG_RESULT(using ALSA)
  135. api="$api -D__LINUX_ALSA__"
  136. req="$req alsa"
  137. AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(ALSA support requires the asound library!))
  138. ])
  139. # Look for PULSE flag
  140. AC_ARG_WITH(pulse, [ --with-pulse = choose PulseAudio API support (linux only)])
  141. AS_IF([test "x$with_pulse" = "xyes"], [
  142. AC_MSG_RESULT(using PulseAudio)
  143. api="$api -D__LINUX_PULSE__"
  144. req="$req libpulse-simple"
  145. AC_CHECK_LIB(pulse-simple, pa_simple_flush, , AC_MSG_ERROR(PulseAudio support requires the pulse-simple library!))
  146. ])
  147. # Look for OSS flag
  148. AC_ARG_WITH(oss, [ --with-oss = choose OSS API support (unixes)])
  149. AS_IF([test "x$with_oss" = "xyes"], [
  150. AC_MSG_RESULT(using OSS)
  151. api="$api -D__LINUX_OSS__"
  152. ])
  153. # If no audio api flags specified, use ALSA
  154. AS_IF([test "x$api" = "x" ], [
  155. AC_MSG_RESULT(using ALSA)
  156. api="${api} -D__LINUX_ALSA__"
  157. req="${req} alsa"
  158. AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(ALSA support requires the asound library!))
  159. ])
  160. AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))
  161. ;;
  162. *-apple*)
  163. # Look for Core flag
  164. AC_ARG_WITH(core, [ --with-core = choose CoreAudio API support (mac only)])
  165. AS_IF([test "x$with_core" = "xyes"], [
  166. AC_MSG_RESULT(using CoreAudio)
  167. api="$api -D__MACOSX_CORE__"
  168. AC_CHECK_HEADER(CoreAudio/CoreAudio.h, [], [AC_MSG_ERROR(CoreAudio header files not found!)] )
  169. LIBS="$LIBS -framework CoreAudio -framework CoreFoundation"
  170. ])
  171. # If no audio api flags specified, use CoreAudio
  172. AS_IF([test "x$api" = "x" ], [
  173. AC_MSG_RESULT(using CoreAudio)
  174. api="${api} -D__MACOSX_CORE__"
  175. AC_CHECK_HEADER(CoreAudio/CoreAudio.h,
  176. [],
  177. [AC_MSG_ERROR(CoreAudio header files not found!)] )
  178. LIBS="LIBS -framework CoreAudio -framework CoreFoundation"
  179. ])
  180. AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))
  181. ;;
  182. *-mingw32*)
  183. AC_ARG_WITH(asio, [ --with-asio = choose ASIO API support (windoze only)])
  184. AS_IF([test "x$with_asio" = "xyes" ], [
  185. AC_MSG_RESULT(using ASIO)
  186. api="$api -D__WINDOWS_ASIO__"
  187. AC_SUBST( objects, ["asio.o asiodrivers.o asiolist.o iasiothiscallresolver.o"] )
  188. ])
  189. # Look for DirectSound flag
  190. AC_ARG_WITH(ds, [ --with-ds = choose DirectSound API support (windoze only)])
  191. AS_IF([test "x$with_ds" = "xyes" ], [
  192. AC_MSG_RESULT(using DirectSound)
  193. api="$api -D__WINDOWS_DS__"
  194. LIBS="-ldsound -lwinmm $LIBS"
  195. ])
  196. # Look for WASAPI flag
  197. AC_ARG_WITH(wasapi, [ --with-wasapi = choose Windows Audio Session API support (windoze only)])
  198. AS_IF([test "x$with_wasapi" = "xyes"], [
  199. AC_MSG_RESULT(using WASAPI)
  200. api="$api -D__WINDOWS_WASAPI__"
  201. LIBS="-lwinmm -luuid -lksuser $LIBS"
  202. ])
  203. # If no audio api flags specified, use DS
  204. AS_IF([test "x$api" = "x" ], [
  205. AC_MSG_RESULT(using DirectSound)
  206. api="$api -D__WINDOWS_DS__"
  207. LIBS="-ldsound -lwinmm $LIBS"
  208. ])
  209. LIBS="-lole32 $LIBS"
  210. ;;
  211. *)
  212. # Default case for unknown realtime systems.
  213. AC_MSG_ERROR(Unknown system type for realtime support!)
  214. ;;
  215. esac
  216. CPPFLAGS="$CPPFLAGS $api"
  217. AC_OUTPUT