Audio plugin host https://kx.studio/carla
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.

186 lines
6.1KB

  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_AUX_DIR(config)
  4. AC_CONFIG_SRCDIR(RtAudio.cpp)
  5. AC_CONFIG_FILES([rtaudio-config librtaudio.pc Makefile tests/Makefile])
  6. # Fill GXX with something before test.
  7. AC_SUBST( GXX, ["no"] )
  8. dnl Check for pkg-config program, used for configuring some libraries.
  9. m4_define_default([PKG_PROG_PKG_CONFIG],
  10. [AC_MSG_CHECKING([pkg-config])
  11. AC_MSG_RESULT([no])])
  12. PKG_PROG_PKG_CONFIG
  13. dnl If the pkg-config autoconf support isn't installed, define its
  14. dnl autoconf macro to disable any packages depending on it.
  15. m4_define_default([PKG_CHECK_MODULES],
  16. [AC_MSG_CHECKING([$1])
  17. AC_MSG_RESULT([no])
  18. $4])
  19. # Checks for programs.
  20. AC_PROG_CXX(g++ CC c++ cxx)
  21. AC_PROG_RANLIB
  22. AC_PATH_PROG(AR, ar, no)
  23. if [[ $AR = "no" ]] ; then
  24. AC_MSG_ERROR("Could not find ar - needed to create a library");
  25. fi
  26. # Checks for header files.
  27. AC_HEADER_STDC
  28. AC_CHECK_HEADERS(sys/ioctl.h unistd.h)
  29. # Check for debug
  30. AC_MSG_CHECKING(whether to compile debug version)
  31. AC_ARG_ENABLE(debug,
  32. [ --enable-debug = enable various debug output],
  33. [AC_SUBST( cppflag, [-D__RTAUDIO_DEBUG__] ) AC_SUBST( cxxflag, [-g] ) AC_SUBST( object_path, [Debug] ) AC_MSG_RESULT(yes)],
  34. [AC_SUBST( cppflag, [] ) AC_SUBST( cxxflag, [-O2] ) AC_SUBST( object_path, [Release] ) AC_MSG_RESULT(no)])
  35. # Checks for functions
  36. AC_CHECK_FUNC(gettimeofday, [cppflag="$cppflag -DHAVE_GETTIMEOFDAY"], )
  37. # For -I and -D flags
  38. CPPFLAGS="$CPPFLAGS $cppflag"
  39. # For debugging and optimization ... overwrite default because it has both -g and -O2
  40. #CXXFLAGS="$CXXFLAGS $cxxflag"
  41. CXXFLAGS="$cxxflag"
  42. # Check compiler and use -Wall if gnu.
  43. if [test $GXX = "yes" ;] then
  44. AC_SUBST( cxxflag, [-Wall] )
  45. fi
  46. CXXFLAGS="$CXXFLAGS $cxxflag"
  47. AC_CANONICAL_HOST
  48. AC_SUBST( sharedlib, ["librtaudio.so"] )
  49. AC_SUBST( sharedname, ["librtaudio.so.\$(RELEASE)"] )
  50. AC_SUBST( libflags, ["-shared -Wl,-soname,\$(SHARED).\$(MAJOR) -o \$(SHARED).\$(RELEASE)"] )
  51. case $host in
  52. *-apple*)
  53. AC_SUBST( sharedlib, ["librtaudio.dylib"] )
  54. AC_SUBST( sharedname, ["librtaudio.\$(RELEASE).dylib"] )
  55. AC_SUBST( libflags, ["-dynamiclib -o librtaudio.\$(RELEASE).dylib"] )
  56. esac
  57. # Checks for package options and external software
  58. AC_SUBST( api, [""] )
  59. AC_SUBST( req, [""] )
  60. AC_MSG_CHECKING(for audio API)
  61. case $host in
  62. *-*-netbsd*)
  63. AC_MSG_RESULT(using OSS)
  64. api="$api -D__LINUX_OSS__"
  65. LIBS="$LIBS -lossaudio"
  66. AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))
  67. ;;
  68. *-*-linux*)
  69. AC_ARG_WITH(jack, [ --with-jack = choose JACK server support (mac and linux only)], [
  70. api="$api -D__UNIX_JACK__"
  71. AC_MSG_RESULT(using JACK)
  72. AC_CHECK_LIB(jack, jack_client_open, , AC_MSG_ERROR(JACK support requires the jack library!))
  73. AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(Jack support also requires the asound library!))], )
  74. # Look for ALSA flag
  75. AC_ARG_WITH(alsa, [ --with-alsa = choose native ALSA API support (linux only)], [
  76. api="$api -D__LINUX_ALSA__"
  77. req="$req alsa"
  78. AC_MSG_RESULT(using ALSA)
  79. AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(ALSA support requires the asound library!))], )
  80. # Look for PULSE flag
  81. AC_ARG_WITH(pulse, [ --with-pulse = choose PulseAudio API support (linux only)], [
  82. api="$api -D__LINUX_PULSE__"
  83. req="$req libpulse-simple"
  84. AC_MSG_RESULT(using PulseAudio)
  85. PKG_CHECK_MODULES([PULSE], [libpulse-simple], , AC_MSG_ERROR(PulseAudio support requires the pulse-simple library!))
  86. LIBS="$LIBS `pkg-config --libs libpulse-simple`" ], )
  87. # Look for OSS flag
  88. AC_ARG_WITH(oss, [ --with-oss = choose OSS API support (linux only)], [
  89. api="$api -D__LINUX_OSS__"
  90. AC_MSG_RESULT(using OSS)], )
  91. # If no audio api flags specified, use ALSA
  92. if [test "$api" == "";] then
  93. AC_MSG_RESULT(using ALSA)
  94. AC_SUBST( api, [-D__LINUX_ALSA__] )
  95. req="$req alsa"
  96. AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(ALSA support requires the asound library!))
  97. fi
  98. AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))
  99. ;;
  100. *-apple*)
  101. AC_ARG_WITH(jack, [ --with-jack = choose JACK server support (unix only)], [
  102. api="$api -D__UNIX_JACK__"
  103. AC_MSG_RESULT(using JACK)
  104. AC_CHECK_LIB(jack, jack_client_open, , AC_MSG_ERROR(JACK support requires the jack library!))], )
  105. # AC_CHECK_HEADER(jack/jack.h, [], [AC_MSG_ERROR(Jack header file not found!)] )
  106. # LIBS="$LIBS -framework jackmp" ], )
  107. # Look for Core flag
  108. AC_ARG_WITH(core, [ --with-core = choose CoreAudio API support (mac only)], [
  109. api="$api -D__MACOSX_CORE__"
  110. AC_MSG_RESULT(using CoreAudio)
  111. AC_CHECK_HEADER(CoreAudio/CoreAudio.h, [], [AC_MSG_ERROR(CoreAudio header files not found!)] )
  112. LIBS="$LIBS -framework CoreAudio -framework CoreFoundation" ], )
  113. # If no audio api flags specified, use CoreAudio
  114. if [test "$api" == ""; ] then
  115. AC_SUBST( api, [-D__MACOSX_CORE__] )
  116. AC_MSG_RESULT(using CoreAudio)
  117. AC_CHECK_HEADER(CoreAudio/CoreAudio.h,
  118. [],
  119. [AC_MSG_ERROR(CoreAudio header files not found!)] )
  120. AC_SUBST( LIBS, ["-framework CoreAudio -framework CoreFoundation"] )
  121. fi
  122. AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))
  123. ;;
  124. *-mingw32*)
  125. AC_ARG_WITH(asio, [ --with-asio = choose ASIO API support (windoze only)], [
  126. api="$api -D__WINDOWS_ASIO__"
  127. AC_MSG_RESULT(using ASIO)
  128. AC_SUBST( objects, ["asio.o asiodrivers.o asiolist.o iasiothiscallresolver.o"] ) ], )
  129. # Look for DirectSound flag
  130. AC_ARG_WITH(ds, [ --with-ds = choose DirectSound API support (windoze only)], [
  131. api="$api -D__WINDOWS_DS__"
  132. AC_MSG_RESULT(using DirectSound)
  133. LIBS="-ldsound -lwinmm $LIBS" ], )
  134. # If no audio api flags specified, use DirectSound
  135. if [test "$api" == "";] then
  136. AC_SUBST( api, [-D__WINDOWS_DS__] )
  137. AC_MSG_RESULT(using DirectSound)
  138. LIBS="-ldsound -lwinmm $LIBS"
  139. fi
  140. LIBS="-lole32 $LIBS"
  141. ;;
  142. *)
  143. # Default case for unknown realtime systems.
  144. AC_MSG_ERROR(Unknown system type for realtime support!)
  145. ;;
  146. esac
  147. CPPFLAGS="$CPPFLAGS $api"
  148. AC_OUTPUT
  149. chmod oug+x rtaudio-config