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.

237 lines
8.4KB

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