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.

250 lines
8.9KB

  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-config 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. # Checks for programs.
  52. AC_PROG_CXX(g++ CC c++ cxx)
  53. AM_PROG_AR
  54. AC_PATH_PROG(AR, ar, no)
  55. if [[ $AR = "no" ]] ; then
  56. AC_MSG_ERROR("Could not find ar - needed to create a library");
  57. fi
  58. # Initialize libtool
  59. LT_INIT([win32-dll])
  60. AC_CONFIG_MACRO_DIR([m4])
  61. # Checks for header files.
  62. AC_HEADER_STDC
  63. AC_CHECK_HEADERS(sys/ioctl.h unistd.h)
  64. # Check for debug
  65. AC_MSG_CHECKING(whether to compile debug version)
  66. AC_ARG_ENABLE(debug,
  67. [ --enable-debug = enable various debug output],
  68. [AC_SUBST( cppflag, [-D__RTAUDIO_DEBUG__] ) AC_SUBST( cxxflag, [-g] ) AC_SUBST( object_path, [Debug] ) AC_MSG_RESULT(yes)],
  69. [AC_SUBST( cppflag, [] ) AC_SUBST( cxxflag, [-O2] ) AC_SUBST( object_path, [Release] ) AC_MSG_RESULT(no)])
  70. # Checks for functions
  71. AC_CHECK_FUNC(gettimeofday, [cppflag="$cppflag -DHAVE_GETTIMEOFDAY"], )
  72. # Set paths if prefix is defined
  73. if test "x$prefix" != "x" && test "x$prefix" != "xNONE"; then
  74. LIBS="$LIBS -L$prefix/lib"
  75. CPPFLAGS="$CPPFLAGS -I$prefix/include"
  76. fi
  77. # For -I and -D flags
  78. CPPFLAGS="$CPPFLAGS $cppflag"
  79. # For debugging and optimization ... overwrite default because it has both -g and -O2
  80. #CXXFLAGS="$CXXFLAGS $cxxflag"
  81. CXXFLAGS="$cxxflag"
  82. # Check compiler and use -Wall if gnu.
  83. if [test $GXX = "yes" ;] then
  84. AC_SUBST( cxxflag, ["-Wall -Wextra"] )
  85. fi
  86. CXXFLAGS="$CXXFLAGS $cxxflag"
  87. # Checks for doxygen
  88. AC_CHECK_PROG( DOXYGEN, [doxygen], [doxygen] )
  89. AM_CONDITIONAL( MAKE_DOC, [test "x${DOXYGEN}" != x] )
  90. # Copy doc files to build dir if necessary
  91. AC_CONFIG_LINKS( [doc/release.txt:doc/release.txt] )
  92. AC_CONFIG_LINKS( [doc/doxygen/footer.html:doc/doxygen/footer.html] )
  93. AC_CONFIG_LINKS( [doc/doxygen/error.txt:doc/doxygen/error.txt] )
  94. AC_CONFIG_LINKS( [doc/doxygen/tutorial.txt:doc/doxygen/tutorial.txt] )
  95. AC_CONFIG_LINKS( [doc/doxygen/compiling.txt:doc/doxygen/compiling.txt] )
  96. AC_CONFIG_LINKS( [doc/doxygen/acknowledge.txt:doc/doxygen/acknowledge.txt] )
  97. AC_CONFIG_LINKS( [doc/doxygen/license.txt:doc/doxygen/license.txt] )
  98. AC_CONFIG_LINKS( [doc/doxygen/header.html:doc/doxygen/header.html] )
  99. AC_CONFIG_LINKS( [doc/doxygen/duplex.txt:doc/doxygen/duplex.txt] )
  100. AC_CONFIG_LINKS( [doc/doxygen/settings.txt:doc/doxygen/settings.txt] )
  101. AC_CONFIG_LINKS( [doc/doxygen/probe.txt:doc/doxygen/probe.txt] )
  102. AC_CONFIG_LINKS( [doc/doxygen/playback.txt:doc/doxygen/playback.txt] )
  103. AC_CONFIG_LINKS( [doc/doxygen/multi.txt:doc/doxygen/multi.txt] )
  104. AC_CONFIG_LINKS( [doc/doxygen/recording.txt:doc/doxygen/recording.txt] )
  105. AC_CONFIG_LINKS( [doc/doxygen/apinotes.txt:doc/doxygen/apinotes.txt] )
  106. AC_CONFIG_LINKS( [doc/images/mcgill.gif:doc/images/mcgill.gif] )
  107. AC_CONFIG_LINKS( [doc/images/ccrma.gif:doc/images/ccrma.gif] )
  108. # Checks for package options and external software
  109. AC_CANONICAL_HOST
  110. AC_SUBST( api, [""] )
  111. AC_SUBST( req, [""] )
  112. AC_MSG_CHECKING(for audio API)
  113. case $host in
  114. *-*-netbsd*)
  115. AC_MSG_RESULT(using OSS)
  116. api="$api -D__LINUX_OSS__"
  117. LIBS="$LIBS -lossaudio"
  118. AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))
  119. ;;
  120. *-*-linux*)
  121. AC_ARG_WITH(jack, [ --with-jack = choose JACK server support (mac and linux only)], [
  122. api="$api -D__UNIX_JACK__"
  123. AC_MSG_RESULT(using JACK)
  124. AC_CHECK_LIB(jack, jack_client_open, , AC_MSG_ERROR(JACK support requires the jack library!))
  125. AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(Jack support also requires the asound library!))], )
  126. # Look for ALSA flag
  127. AC_ARG_WITH(alsa, [ --with-alsa = choose native ALSA API support (linux only)], [
  128. api="$api -D__LINUX_ALSA__"
  129. req="$req alsa"
  130. AC_MSG_RESULT(using ALSA)
  131. AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(ALSA support requires the asound library!))], )
  132. # Look for PULSE flag
  133. AC_ARG_WITH(pulse, [ --with-pulse = choose PulseAudio API support (linux only)], [
  134. api="$api -D__LINUX_PULSE__"
  135. req="$req libpulse-simple"
  136. AC_MSG_RESULT(using PulseAudio)
  137. AC_CHECK_LIB(pulse-simple, pa_simple_flush, , AC_MSG_ERROR(PulseAudio support requires the pulse-simple library!))], )
  138. # Look for OSS flag
  139. AC_ARG_WITH(oss, [ --with-oss = choose OSS API support (linux only)], [
  140. api="$api -D__LINUX_OSS__"
  141. AC_MSG_RESULT(using OSS)], )
  142. # If no audio api flags specified, use ALSA
  143. if [test "$api" == "";] then
  144. AC_MSG_RESULT(using ALSA)
  145. AC_SUBST( api, [-D__LINUX_ALSA__] )
  146. req="$req alsa"
  147. AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(ALSA support requires the asound library!))
  148. fi
  149. AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))
  150. ;;
  151. *-apple*)
  152. AC_ARG_WITH(jack, [ --with-jack = choose JACK server support (unix only)], [
  153. api="$api -D__UNIX_JACK__"
  154. AC_MSG_RESULT(using JACK)
  155. AC_CHECK_LIB(jack, jack_client_open, , AC_MSG_ERROR(JACK support requires the jack library!))], )
  156. # AC_CHECK_HEADER(jack/jack.h, [], [AC_MSG_ERROR(Jack header file not found!)] )
  157. # LIBS="$LIBS -framework jackmp" ], )
  158. # Look for Core flag
  159. AC_ARG_WITH(core, [ --with-core = choose CoreAudio API support (mac only)], [
  160. api="$api -D__MACOSX_CORE__"
  161. AC_MSG_RESULT(using CoreAudio)
  162. AC_CHECK_HEADER(CoreAudio/CoreAudio.h, [], [AC_MSG_ERROR(CoreAudio header files not found!)] )
  163. LIBS="$LIBS -framework CoreAudio -framework CoreFoundation" ], )
  164. # If no audio api flags specified, use CoreAudio
  165. if [test "$api" == ""; ] then
  166. AC_SUBST( api, [-D__MACOSX_CORE__] )
  167. AC_MSG_RESULT(using CoreAudio)
  168. AC_CHECK_HEADER(CoreAudio/CoreAudio.h,
  169. [],
  170. [AC_MSG_ERROR(CoreAudio header files not found!)] )
  171. AC_SUBST( LIBS, ["-framework CoreAudio -framework CoreFoundation"] )
  172. fi
  173. AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))
  174. ;;
  175. *-mingw32*)
  176. AC_ARG_WITH(asio, [ --with-asio = choose ASIO API support (windoze only)], [
  177. api="$api -D__WINDOWS_ASIO__"
  178. AC_MSG_RESULT(using ASIO)
  179. AC_SUBST( objects, ["asio.o asiodrivers.o asiolist.o iasiothiscallresolver.o"] ) ], )
  180. # Look for DirectSound flag
  181. AC_ARG_WITH(ds, [ --with-ds = choose DirectSound API support (windoze only)], [
  182. api="$api -D__WINDOWS_DS__"
  183. AC_MSG_RESULT(using DirectSound)
  184. LIBS="-ldsound -lwinmm $LIBS" ], )
  185. # Look for WASAPI flag
  186. AC_ARG_WITH(wasapi, [ --with-wasapi = choose Windows Audio Session API support (windoze only)], [
  187. api="$api -D__WINDOWS_WASAPI__"
  188. AC_MSG_RESULT(using WASAPI)
  189. LIBS="-lwinmm -luuid -lksuser $LIBS" ], )
  190. # If no audio api flags specified, use DS
  191. if [test "$api" == "";] then
  192. AC_SUBST( api, [-D__WINDOWS_DS__] )
  193. AC_MSG_RESULT(using DirectSound)
  194. LIBS="-ldsound -lwinmm $LIBS"
  195. fi
  196. LIBS="-lole32 $LIBS"
  197. ;;
  198. *)
  199. # Default case for unknown realtime systems.
  200. AC_MSG_ERROR(Unknown system type for realtime support!)
  201. ;;
  202. esac
  203. CPPFLAGS="$CPPFLAGS $api"
  204. AC_OUTPUT
  205. chmod oug+x rtaudio-config