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.

197 lines
6.4KB

  1. # Process this file with autoconf to produce a configure script.
  2. AC_INIT(RtAudio, 4.1, 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. # Set paths if prefix is defined
  38. if test "x$prefix" != "x" && test "x$prefix" != "xNONE"; then
  39. LIBS="$LIBS -L$prefix/lib"
  40. CPPFLAGS="$CPPFLAGS -I$prefix/include"
  41. fi
  42. # For -I and -D flags
  43. CPPFLAGS="$CPPFLAGS $cppflag"
  44. # For debugging and optimization ... overwrite default because it has both -g and -O2
  45. #CXXFLAGS="$CXXFLAGS $cxxflag"
  46. CXXFLAGS="$cxxflag"
  47. # Check compiler and use -Wall if gnu.
  48. if [test $GXX = "yes" ;] then
  49. AC_SUBST( cxxflag, ["-Wall -Wextra"] )
  50. fi
  51. CXXFLAGS="$CXXFLAGS $cxxflag"
  52. AC_CANONICAL_HOST
  53. AC_SUBST( sharedlib, ["librtaudio.so"] )
  54. AC_SUBST( sharedname, ["librtaudio.so.\$(RELEASE)"] )
  55. AC_SUBST( libflags, ["-shared -Wl,-soname,\$(SHARED).\$(MAJOR) -o \$(SHARED).\$(RELEASE)"] )
  56. case $host in
  57. *-apple*)
  58. AC_SUBST( sharedlib, ["librtaudio.dylib"] )
  59. AC_SUBST( sharedname, ["librtaudio.\$(RELEASE).dylib"] )
  60. AC_SUBST( libflags, ["-dynamiclib -o librtaudio.\$(RELEASE).dylib"] )
  61. esac
  62. # Checks for package options and external software
  63. AC_SUBST( api, [""] )
  64. AC_SUBST( req, [""] )
  65. AC_MSG_CHECKING(for audio API)
  66. case $host in
  67. *-*-netbsd*)
  68. AC_MSG_RESULT(using OSS)
  69. api="$api -D__LINUX_OSS__"
  70. LIBS="$LIBS -lossaudio"
  71. AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))
  72. ;;
  73. *-*-linux*)
  74. AC_ARG_WITH(jack, [ --with-jack = choose JACK server support (mac and linux only)], [
  75. api="$api -D__UNIX_JACK__"
  76. AC_MSG_RESULT(using JACK)
  77. AC_CHECK_LIB(jack, jack_client_open, , AC_MSG_ERROR(JACK support requires the jack library!))
  78. AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(Jack support also requires the asound library!))], )
  79. # Look for ALSA flag
  80. AC_ARG_WITH(alsa, [ --with-alsa = choose native ALSA API support (linux only)], [
  81. api="$api -D__LINUX_ALSA__"
  82. req="$req alsa"
  83. AC_MSG_RESULT(using ALSA)
  84. AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(ALSA support requires the asound library!))], )
  85. # Look for PULSE flag
  86. AC_ARG_WITH(pulse, [ --with-pulse = choose PulseAudio API support (linux only)], [
  87. api="$api -D__LINUX_PULSE__"
  88. req="$req libpulse-simple"
  89. AC_MSG_RESULT(using PulseAudio)
  90. AC_CHECK_LIB(pulse-simple, pa_simple_flush, , AC_MSG_ERROR(PulseAudio support requires the pulse-simple library!))], )
  91. # Look for OSS flag
  92. AC_ARG_WITH(oss, [ --with-oss = choose OSS API support (linux only)], [
  93. api="$api -D__LINUX_OSS__"
  94. AC_MSG_RESULT(using OSS)], )
  95. # If no audio api flags specified, use ALSA
  96. if [test "$api" == "";] then
  97. AC_MSG_RESULT(using ALSA)
  98. AC_SUBST( api, [-D__LINUX_ALSA__] )
  99. req="$req alsa"
  100. AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(ALSA support requires the asound library!))
  101. fi
  102. AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))
  103. ;;
  104. *-apple*)
  105. AC_ARG_WITH(jack, [ --with-jack = choose JACK server support (unix only)], [
  106. api="$api -D__UNIX_JACK__"
  107. AC_MSG_RESULT(using JACK)
  108. AC_CHECK_LIB(jack, jack_client_open, , AC_MSG_ERROR(JACK support requires the jack library!))], )
  109. # AC_CHECK_HEADER(jack/jack.h, [], [AC_MSG_ERROR(Jack header file not found!)] )
  110. # LIBS="$LIBS -framework jackmp" ], )
  111. # Look for Core flag
  112. AC_ARG_WITH(core, [ --with-core = choose CoreAudio API support (mac only)], [
  113. api="$api -D__MACOSX_CORE__"
  114. AC_MSG_RESULT(using CoreAudio)
  115. AC_CHECK_HEADER(CoreAudio/CoreAudio.h, [], [AC_MSG_ERROR(CoreAudio header files not found!)] )
  116. LIBS="$LIBS -framework CoreAudio -framework CoreFoundation" ], )
  117. # If no audio api flags specified, use CoreAudio
  118. if [test "$api" == ""; ] then
  119. AC_SUBST( api, [-D__MACOSX_CORE__] )
  120. AC_MSG_RESULT(using CoreAudio)
  121. AC_CHECK_HEADER(CoreAudio/CoreAudio.h,
  122. [],
  123. [AC_MSG_ERROR(CoreAudio header files not found!)] )
  124. AC_SUBST( LIBS, ["-framework CoreAudio -framework CoreFoundation"] )
  125. fi
  126. AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))
  127. ;;
  128. *-mingw32*)
  129. AC_ARG_WITH(asio, [ --with-asio = choose ASIO API support (windoze only)], [
  130. api="$api -D__WINDOWS_ASIO__"
  131. AC_MSG_RESULT(using ASIO)
  132. AC_SUBST( objects, ["asio.o asiodrivers.o asiolist.o iasiothiscallresolver.o"] ) ], )
  133. # Look for DirectSound flag
  134. AC_ARG_WITH(ds, [ --with-ds = choose DirectSound API support (windoze only)], [
  135. api="$api -D__WINDOWS_DS__"
  136. AC_MSG_RESULT(using DirectSound)
  137. LIBS="-ldsound -lwinmm $LIBS" ], )
  138. # Look for WASAPI flag
  139. AC_ARG_WITH(wasapi, [ --with-wasapi = choose Windows Audio Session API support (windoze only)], [
  140. api="$api -D__WINDOWS_WASAPI__"
  141. AC_MSG_RESULT(using WASAPI)
  142. LIBS="-lwinmm -luuid -lksuser $LIBS" ], )
  143. # If no audio api flags specified, use DS
  144. if [test "$api" == "";] then
  145. AC_SUBST( api, [-D__WINDOWS_DS__] )
  146. AC_MSG_RESULT(using DirectSound)
  147. LIBS="-ldsound -lwinmm $LIBS"
  148. fi
  149. LIBS="-lole32 $LIBS"
  150. ;;
  151. *)
  152. # Default case for unknown realtime systems.
  153. AC_MSG_ERROR(Unknown system type for realtime support!)
  154. ;;
  155. esac
  156. CPPFLAGS="$CPPFLAGS $api"
  157. AC_OUTPUT
  158. chmod oug+x rtaudio-config