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.

260 lines
9.2KB

  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. use_asio=""
  32. # configure flags
  33. AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug],[enable various debug output])])
  34. AC_ARG_WITH(jack, [AS_HELP_STRING([--with-jack], [choose JACK server support (mac and linux only)])])
  35. AC_ARG_WITH(alsa, [AS_HELP_STRING([--with-alsa], [choose native ALSA API support (linux only)])])
  36. AC_ARG_WITH(pulse, [AS_HELP_STRING([--with-pulse], [choose PulseAudio API support (linux only)])])
  37. AC_ARG_WITH(oss, [AS_HELP_STRING([--with-oss], [choose OSS API support (unixes)])])
  38. AC_ARG_WITH(core, [AS_HELP_STRING([--with-core], [choose CoreAudio API support (mac only)])])
  39. AC_ARG_WITH(asio, [AS_HELP_STRING([--with-asio], [choose ASIO API support (win32 only)])])
  40. AC_ARG_WITH(ds, [AS_HELP_STRING([--with-ds], [choose DirectSound API support (win32 only)])])
  41. AC_ARG_WITH(wasapi, [AS_HELP_STRING([--with-wasapi], [choose Windows Audio Session API support (win32 only)])])
  42. # Check version number coherency between RtAudio.h and configure.ac
  43. AC_MSG_CHECKING([that version numbers are coherent])
  44. RTAUDIO_VERSION=`sed -n 's/#define RTAUDIO_VERSION "\(.*\)"/\1/p' $srcdir/RtAudio.h`
  45. AS_IF([test "x$RTAUDIO_VERSION" != "x$PACKAGE_VERSION"],[
  46. AC_MSG_RESULT([no])
  47. 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.])
  48. ],[
  49. AC_MSG_RESULT([yes])
  50. ])
  51. # Enable some nice automake features if they are available
  52. m4_ifdef([AM_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
  53. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
  54. # Fill GXX with something before test.
  55. GXX="no"
  56. # if the user did not provide any CXXFLAGS, we can override them
  57. AS_IF([test "x$CXXFLAGS" = "x" ], [override_cxx=yes], [override_cxx=no])
  58. AS_IF([test "x$CFLAGS" = "x" ], [override_c=yes], [override_c=no])
  59. # Checks for programs.
  60. AC_PROG_CXX(g++ CC c++ cxx)
  61. AM_PROG_AR
  62. AC_PATH_PROG(AR, ar, no)
  63. AS_IF([test "x${AR}" = "xno" ], [
  64. AC_MSG_ERROR([Could not find ar - needed to create a library])
  65. ])
  66. # Initialize libtool
  67. LT_INIT([win32-dll])
  68. AC_CONFIG_MACRO_DIR([m4])
  69. # Checks for header files.
  70. AC_HEADER_STDC
  71. AC_CHECK_HEADERS(sys/ioctl.h unistd.h)
  72. # Check compiler and use -Wall if gnu
  73. AS_IF([test "x${GXX}" = "xyes" ], [
  74. CXXFLAGS="-Wall -Wextra ${CXXFLAGS}"
  75. AS_IF([ test "x${enable_debug}" = "xyes" ], [
  76. # Add -Werror in debug mode
  77. CXXFLAGS="-Werror ${CXXFLAGS}"
  78. ], [
  79. # hide private symbols in non-debug mode
  80. visibility="-fvisibility=hidden"
  81. ])
  82. ])
  83. # Check for debug
  84. AC_MSG_CHECKING([whether to compile debug version])
  85. debugflags=""
  86. AS_CASE([${enable_debug}],
  87. [ yes ], [
  88. AC_MSG_RESULT([yes])
  89. AC_DEFINE([__RTAUDIO_DEBUG__])
  90. debugflags="${debugflags} -g -O0"
  91. object_path=Debug
  92. ],
  93. [ no ], [
  94. AC_MSG_RESULT([no!])
  95. debugflags="${debugflags} -O3"
  96. ], [
  97. AC_MSG_RESULT([no])
  98. ])
  99. # For debugging and optimization ... overwrite default because it has both -g and -O2
  100. AS_IF([test "x$debugflags" != x],
  101. AS_IF([test "x$override_cxx" = "xyes" ], CXXFLAGS="$CXXFLAGS $debugflags", CXXFLAGS="$debugflags $CXXFLAGS")
  102. AS_IF([test "x$override_c" = "xyes" ], CFLAGS="$CFLAGS $debugflags", CFLAGS="$debugflags $CFLAGS")
  103. )
  104. # Checks for functions
  105. AC_CHECK_FUNC(gettimeofday, [cppflag="$cppflag -DHAVE_GETTIMEOFDAY"], )
  106. # Checks for doxygen
  107. AC_CHECK_PROG( DOXYGEN, [doxygen], [doxygen] )
  108. AM_CONDITIONAL( MAKE_DOC, [test "x${DOXYGEN}" != x ] )
  109. # Copy doc files to build dir if necessary
  110. AC_CONFIG_LINKS( [doc/release.txt:doc/release.txt] )
  111. AC_CONFIG_LINKS( [doc/doxygen/footer.html:doc/doxygen/footer.html] )
  112. AC_CONFIG_LINKS( [doc/doxygen/error.txt:doc/doxygen/error.txt] )
  113. AC_CONFIG_LINKS( [doc/doxygen/tutorial.txt:doc/doxygen/tutorial.txt] )
  114. AC_CONFIG_LINKS( [doc/doxygen/compiling.txt:doc/doxygen/compiling.txt] )
  115. AC_CONFIG_LINKS( [doc/doxygen/acknowledge.txt:doc/doxygen/acknowledge.txt] )
  116. AC_CONFIG_LINKS( [doc/doxygen/license.txt:doc/doxygen/license.txt] )
  117. AC_CONFIG_LINKS( [doc/doxygen/header.html:doc/doxygen/header.html] )
  118. AC_CONFIG_LINKS( [doc/doxygen/duplex.txt:doc/doxygen/duplex.txt] )
  119. AC_CONFIG_LINKS( [doc/doxygen/settings.txt:doc/doxygen/settings.txt] )
  120. AC_CONFIG_LINKS( [doc/doxygen/probe.txt:doc/doxygen/probe.txt] )
  121. AC_CONFIG_LINKS( [doc/doxygen/playback.txt:doc/doxygen/playback.txt] )
  122. AC_CONFIG_LINKS( [doc/doxygen/multi.txt:doc/doxygen/multi.txt] )
  123. AC_CONFIG_LINKS( [doc/doxygen/recording.txt:doc/doxygen/recording.txt] )
  124. AC_CONFIG_LINKS( [doc/doxygen/apinotes.txt:doc/doxygen/apinotes.txt] )
  125. AC_CONFIG_LINKS( [doc/images/mcgill.gif:doc/images/mcgill.gif] )
  126. AC_CONFIG_LINKS( [doc/images/ccrma.gif:doc/images/ccrma.gif] )
  127. # Checks for package options and external software
  128. AC_CANONICAL_HOST
  129. AC_MSG_CHECKING([for audio API])
  130. AS_IF([test "x$with_jack" = "xyes"], [
  131. AC_MSG_RESULT([using JACK])
  132. AC_CHECK_LIB(jack, jack_client_open, , AC_MSG_ERROR([JACK support requires the jack library!]))
  133. api="$api -D__UNIX_JACK__"
  134. ])
  135. AS_CASE([$host],
  136. [*-*-netbsd*],
  137. AS_IF([test "x$api" = "x"], [
  138. AC_MSG_RESULT([using OSS])
  139. api="$api -D__LINUX_OSS__"
  140. AC_CHECK_LIB(ossaudio, main, , AC_MSG_ERROR([RtAudio requires the ossaudio library]))
  141. AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR([RtAudio requires the pthread library!]))
  142. ]),
  143. [*-*-freebsd*],
  144. AS_IF([test "x$api" = "x"], [
  145. AC_MSG_RESULT([using OSS])
  146. api="$api -D__LINUX_OSS__"
  147. AC_CHECK_LIB(ossaudio, main, , AC_MSG_ERROR([RtAudio requires the ossaudio library]))
  148. AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR([RtAudio requires the pthread library!]))
  149. ]),
  150. [*-*-linux*], [
  151. # Look for ALSA flag
  152. AS_IF([test "x$with_alsa" = "xyes"], [
  153. AC_MSG_RESULT([using ALSA])
  154. api="$api -D__LINUX_ALSA__"
  155. req="$req alsa"
  156. AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR([ALSA support requires the asound library!]))
  157. ])
  158. # Look for PULSE flag
  159. AS_IF([test "x$with_pulse" = "xyes"], [
  160. AC_MSG_RESULT([using PulseAudio])
  161. api="$api -D__LINUX_PULSE__"
  162. req="$req libpulse-simple"
  163. AC_CHECK_LIB(pulse-simple, pa_simple_flush, , AC_MSG_ERROR([PulseAudio support requires the pulse-simple library!]))
  164. ])
  165. # Look for OSS flag
  166. AS_IF([test "x$with_oss" = "xyes"], [
  167. AC_MSG_RESULT([using OSS])
  168. api="$api -D__LINUX_OSS__"
  169. ])
  170. # If no audio api flags specified, use ALSA
  171. AS_IF([test "x$api" = "x" ], [
  172. AC_MSG_RESULT([using ALSA])
  173. api="${api} -D__LINUX_ALSA__"
  174. req="${req} alsa"
  175. AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR([ALSA support requires the asound library!]))
  176. ])
  177. AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR([RtAudio requires the pthread library!]))
  178. ],
  179. [*-apple*],[
  180. # Look for Core flag
  181. AS_IF([test "x$with_core" = "xyes"], [
  182. AC_MSG_RESULT([using CoreAudio])
  183. api="$api -D__MACOSX_CORE__"
  184. AC_CHECK_HEADER(CoreAudio/CoreAudio.h, [], [AC_MSG_ERROR([CoreAudio header files not found!])] )
  185. LIBS="$LIBS -framework CoreAudio -framework CoreFoundation"
  186. ])
  187. # If no audio api flags specified, use CoreAudio
  188. AS_IF([test "x$api" = "x" ], [
  189. AC_MSG_RESULT([using CoreAudio])
  190. api="${api} -D__MACOSX_CORE__"
  191. AC_CHECK_HEADER(CoreAudio/CoreAudio.h,
  192. [],
  193. [AC_MSG_ERROR([CoreAudio header files not found!])] )
  194. LIBS="LIBS -framework CoreAudio -framework CoreFoundation"
  195. ])
  196. AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR([RtAudio requires the pthread library!]))
  197. ],
  198. [*-mingw32*],[
  199. AS_IF([test "x$with_asio" = "xyes" ], [
  200. AC_MSG_RESULT([using ASIO])
  201. api="$api -D__WINDOWS_ASIO__"
  202. use_asio=yes
  203. ])
  204. # Look for DirectSound flag
  205. AS_IF([test "x$with_ds" = "xyes" ], [
  206. AC_MSG_RESULT([using DirectSound])
  207. api="$api -D__WINDOWS_DS__"
  208. LIBS="-ldsound -lwinmm $LIBS"
  209. ])
  210. # Look for WASAPI flag
  211. AS_IF([test "x$with_wasapi" = "xyes"], [
  212. AC_MSG_RESULT([using WASAPI])
  213. api="$api -D__WINDOWS_WASAPI__"
  214. LIBS="-lwinmm -luuid -lksuser $LIBS"
  215. ])
  216. # If no audio api flags specified, use DS
  217. AS_IF([test "x$api" = "x" ], [
  218. AC_MSG_RESULT([using DirectSound])
  219. api="$api -D__WINDOWS_DS__"
  220. LIBS="-ldsound -lwinmm $LIBS"
  221. ])
  222. LIBS="-lole32 $LIBS"
  223. ],[
  224. AC_MSG_RESULT([none])
  225. # Default case for unknown realtime systems.
  226. AC_MSG_ERROR([Unknown system type for realtime support!])
  227. ]
  228. )
  229. AM_CONDITIONAL( ASIO, [test "x${use_asio}" = "xyes" ])
  230. CPPFLAGS="$CPPFLAGS $api"
  231. AC_OUTPUT