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.

133 lines
4.6KB

  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_SRCDIR(RtAudio.cpp)
  4. AC_CONFIG_FILES([rtaudio-config Makefile tests/Makefile])
  5. # Fill GXX with something before test.
  6. AC_SUBST( GXX, ["no"] )
  7. # Checks for programs.
  8. AC_PROG_CC
  9. AC_PROG_CXX(g++ CC c++ cxx)
  10. AC_PROG_RANLIB
  11. AC_PATH_PROG(AR, ar, no)
  12. if [[ $AR = "no" ]] ; then
  13. AC_MSG_ERROR("Could not find ar - needed to create a library");
  14. fi
  15. # Checks for libraries.
  16. AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))
  17. # Checks for header files.
  18. AC_HEADER_STDC
  19. AC_CHECK_HEADERS(sys/ioctl.h unistd.h)
  20. # Checks for typedefs, structures, and compiler characteristics.
  21. AC_C_CONST
  22. # Check for debug
  23. AC_MSG_CHECKING(whether to compile debug version)
  24. AC_ARG_ENABLE(debug,
  25. [ --enable-debug = enable various debug output],
  26. [AC_SUBST( debug, [-D__RTAUDIO_DEBUG__] ) AC_SUBST( cflags, [-g] ) AC_SUBST( object_path, [Debug] ) AC_MSG_RESULT(yes)],
  27. [AC_SUBST( debug, [] ) AC_SUBST( cflags, [-O2] ) AC_SUBST( object_path, [Release] ) AC_MSG_RESULT(no)])
  28. # Checks for functions
  29. AC_CHECK_FUNC(gettimeofday, [cflags=$cflags" -DHAVE_GETTIMEOFDAY"], )
  30. # Check compiler and use -Wall if gnu.
  31. if [test $GXX = "yes" ;] then
  32. AC_SUBST( warn, [-Wall] )
  33. fi
  34. # Checks for package options and external software
  35. AC_CANONICAL_HOST
  36. AC_MSG_CHECKING(for audio API)
  37. case $host in
  38. *-*-netbsd*)
  39. AC_SUBST( sound_api, [-D__LINUX_OSS__] )
  40. AC_MSG_RESULT(using OSS)
  41. AC_SUBST( audio_apis, [-D__LINUX_OSS__] )
  42. cflags=$cflags" -lossaudio"
  43. ;;
  44. *-*-linux*)
  45. AC_SUBST( sound_api, [_NO_API_] )
  46. AC_ARG_WITH(jack, [ --with-jack = choose JACK server support (mac and linux only)], [AC_SUBST( sound_api, [-D__UNIX_JACK__] ) AC_MSG_RESULT(using JACK)], )
  47. if [test $sound_api = -D__UNIX_JACK__;] then
  48. TEMP_LIBS=$LIBS
  49. AC_CHECK_LIB(jack, jack_client_new, , AC_MSG_ERROR(JACK support requires the jack library!))
  50. AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(Jack support also requires the asound library!))
  51. LIBS="`pkg-config --cflags --libs jack` $TEMP_LIBS -lasound"
  52. audio_apis="-D__UNIX_JACK__"
  53. fi
  54. # Look for Alsa flag
  55. AC_ARG_WITH(alsa, [ --with-alsa = choose native ALSA API support (linux only)], [AC_SUBST( sound_api, [-D__LINUX_ALSA__] ) AC_MSG_RESULT(using ALSA)], )
  56. if [test $sound_api = -D__LINUX_ALSA__;] then
  57. AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(ALSA support requires the asound library!))
  58. audio_apis="-D__LINUX_ALSA__ $audio_apis"
  59. fi
  60. # Look for OSS flag
  61. AC_ARG_WITH(oss, [ --with-oss = choose OSS API support (linux only)], [AC_SUBST( sound_api, [-D__LINUX_OSS__] ) AC_MSG_RESULT(using OSS)], )
  62. if test $sound_api = -D__LINUX_OSS__; then
  63. audio_apis="-D__LINUX_OSS__ $audio_apis"
  64. fi
  65. # If no audio api flags specified, use OSS
  66. if [test $sound_api = _NO_API_;] then
  67. AC_SUBST( sound_api, [-D__LINUX_OSS__] )
  68. AC_MSG_RESULT(using OSS)
  69. AC_SUBST( audio_apis, [-D__LINUX_OSS__] )
  70. fi
  71. ;;
  72. *-sgi*)
  73. AC_SUBST( audio_apis, ["-D__IRIX_AL__ -LANG:std -w"] )
  74. AC_MSG_RESULT(using IRIX AL)
  75. AC_CHECK_LIB(audio, alOpenPort, , AC_MSG_ERROR(IRIX audio support requires the audio library!) )
  76. ;;
  77. *-apple*)
  78. AC_SUBST( sound_api, [_NO_API_] )
  79. AC_ARG_WITH(jack, [ --with-jack = choose JACK server support (unix only)], [AC_SUBST( sound_api, [-D__UNIX_JACK__] ) AC_MSG_RESULT(using JACK)], )
  80. if [test $sound_api = -D__UNIX_JACK__;] then
  81. AC_CHECK_LIB(jack, jack_client_new, , AC_MSG_ERROR(JACK support requires the jack library!))
  82. audio_apis="-D__UNIX_JACK__"
  83. fi
  84. # Look for Core flag
  85. AC_ARG_WITH(core, [ --with-core = choose CoreAudio API support (mac only)], [AC_SUBST( sound_api, [-D__MACOSX_CORE__] ) AC_MSG_RESULT(using CoreAudio)], )
  86. if test $sound_api = -D__MACOSX_CORE__; then
  87. AC_CHECK_HEADER(CoreAudio/CoreAudio.h, [], [AC_MSG_ERROR(CoreAudio header files not found!)] )
  88. AC_SUBST( frameworks, ["-framework CoreAudio -framework CoreFoundation"] )
  89. audio_apis="-D__MACOSX_CORE__ $audio_apis"
  90. fi
  91. # If no audio api flags specified, use CoreAudio
  92. if [test $sound_api = _NO_API_;] then
  93. AC_SUBST( sound_api, [-D__MACOSX_CORE__] )
  94. AC_MSG_RESULT(using CoreAudio)
  95. AC_CHECK_HEADER(CoreAudio/CoreAudio.h,
  96. [AC_SUBST( audio_apis, [-D__MACOSX_CORE__] )],
  97. [AC_MSG_ERROR(CoreAudio header files not found!)] )
  98. AC_SUBST( frameworks, ["-framework CoreAudio -framework CoreFoundation"] )
  99. fi
  100. ;;
  101. *)
  102. # Default case for unknown realtime systems.
  103. AC_MSG_ERROR(Unknown system type for realtime support!)
  104. ;;
  105. esac
  106. # Checks for library functions.
  107. AC_PROG_GCC_TRADITIONAL
  108. AC_OUTPUT
  109. chmod oug+x rtaudio-config