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.

226 lines
7.1KB

  1. # Process this file with autoconf to produce a configure script.
  2. AC_INIT(STK, 4.6.0, gary@music.mcgill.ca, stk)
  3. AC_CONFIG_AUX_DIR(config)
  4. AC_CONFIG_SRCDIR(src/Stk.cpp)
  5. AC_CONFIG_FILES(Makefile src/Makefile projects/demo/Makefile projects/effects/Makefile projects/ragamatic/Makefile projects/examples/Makefile projects/examples/libMakefile projects/eguitar/Makefile)
  6. # Fill GXX with something before test.
  7. AC_SUBST( GXX, ["no"] )
  8. # Checks for programs.
  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 header files.
  16. AC_HEADER_STDC
  17. AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h termio.h unistd.h)
  18. # Checks for typedefs, structures, and compiler characteristics.
  19. AC_C_CONST
  20. AC_TYPE_SIZE_T
  21. AC_HEADER_TIME
  22. AC_C_BIGENDIAN
  23. AC_EGREP_CPP(yes,
  24. [#ifndef WORDS_BIGENDIAN
  25. yes
  26. #endif
  27. ], [AC_SUBST( byte_order, [-D__LITTLE_ENDIAN__] )] )
  28. AC_MSG_CHECKING(for RAWWAVE_PATH argument)
  29. AC_SUBST( rawwaves, $RAWWAVE_PATH )
  30. AC_MSG_RESULT($RAWWAVE_PATH)
  31. AC_MSG_CHECKING(for INCLUDE_PATH argument)
  32. AC_SUBST( include, $INCLUDE_PATH )
  33. AC_MSG_RESULT($INCLUDE_PATH)
  34. # Check for realtime support disable
  35. AC_MSG_CHECKING(whether to compile realtime support)
  36. AC_ARG_ENABLE(realtime,
  37. [ --disable-realtime = only compile generic non-realtime classes],
  38. realtime=$enableval)
  39. if test "$realtime" = "no"; then
  40. AC_SUBST( sound_api, [] )
  41. else
  42. AC_SUBST( realtime, [yes] )
  43. fi
  44. AC_MSG_RESULT($realtime)
  45. AC_MSG_CHECKING(whether to build the static library)
  46. AC_ARG_ENABLE(static,
  47. [ --disable-static = do not compile static library ],
  48. build_static=$enableval,
  49. build_static=yes)
  50. AC_SUBST(build_static)
  51. AC_MSG_RESULT($build_static)
  52. AC_MSG_CHECKING(whether to build the shared library)
  53. AC_ARG_ENABLE(shared,
  54. [ --enable-shared = compile the shared library ],
  55. build_shared=$enableval,
  56. build_shared=no)
  57. AC_SUBST(build_shared)
  58. AC_MSG_RESULT($build_shared)
  59. if test x$build_static = xno -a x$build_shared = xno ; then
  60. AC_MSG_ERROR([ both static and shared libraries are disabled], 1)
  61. fi
  62. # Check for math library
  63. AC_CHECK_LIB(m, cos, , AC_MSG_ERROR(math library is needed!))
  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. debug=$enableval)
  69. if test "$debug" = "yes"; then
  70. AC_SUBST( cppflag, ["-D_STK_DEBUG_ -D__RTAUDIO_DEBUG__ -D__RTMIDI_DEBUG__"] )
  71. AC_SUBST( cxxflag, ["-g"] )
  72. AC_SUBST( object_path, [Debug] )
  73. else
  74. AC_SUBST( debug, [no] )
  75. AC_SUBST( cppflag, [] )
  76. AC_SUBST( cxxflag, [-O3] )
  77. AC_SUBST( object_path, [Release] )
  78. fi
  79. AC_MSG_RESULT($debug)
  80. # Checks for functions
  81. if test $realtime = yes; then
  82. AC_CHECK_FUNCS(select socket)
  83. AC_CHECK_FUNC(gettimeofday, [cppflag="$cppflag -DHAVE_GETTIMEOFDAY"], )
  84. fi
  85. # For -I and -D flags
  86. CPPFLAGS="$CPPFLAGS $cppflag"
  87. # For debugging and optimization ... overwrite default because it has both -g and -O2
  88. CXXFLAGS="$cxxflag"
  89. # Check compiler and use -Wall if gnu.
  90. if [test $GXX = "yes" ;] then
  91. AC_SUBST( cxxflag, [-Wall] )
  92. fi
  93. CXXFLAGS="$CXXFLAGS $cxxflag"
  94. AC_CANONICAL_HOST
  95. basesharedname="libstk-\$(RELEASE)"
  96. AC_SUBST( sharedlib, ["libstk.so"] )
  97. AC_SUBST( sharedname, [${basesharedname}.so] )
  98. AC_SUBST( libflags, ["-shared -Wl,-soname,${basesharedname}.so -o $sharedname"] )
  99. case $host in
  100. *-apple*)
  101. AC_SUBST( sharedlib, ["libstk.dylib"] )
  102. AC_SUBST( sharedname, ["${basesharedname}.dylib"] )
  103. AC_SUBST( libflags, ["-dynamiclib -o ${basesharedname}.dylib"] )
  104. esac
  105. if test $realtime = yes; then
  106. # Checks for package options and external software
  107. AC_MSG_CHECKING(for audio API)
  108. AC_ARG_WITH(jack, [ --with-jack = choose JACK server support (mac and linux only)])
  109. AS_IF([test "x$with_jack" == "xyes"], [
  110. api="$api -D__UNIX_JACK__"
  111. AC_MSG_RESULT(using JACK)
  112. AC_CHECK_LIB(jack, jack_client_open, , AC_MSG_ERROR(JACK support requires the jack library!))])
  113. case $host in
  114. *-*-linux*)
  115. # Look for ALSA flag
  116. AC_ARG_WITH(alsa, [ --with-alsa = choose native ALSA API support (linux only)])
  117. AS_IF([test "x$with_alsa" == "xyes"], [
  118. api="$api -D__LINUX_ALSA__"
  119. AC_MSG_RESULT(using ALSA)
  120. AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(ALSA support requires the asound library!))])
  121. # Look for OSS flag
  122. AC_ARG_WITH(oss, [ --with-oss = choose OSS API support (unixes only)])
  123. AS_IF([test "x$with_oss" == "xyes"], [
  124. api="$api -D__LINUX_OSS__ -D__LINUX_ALSA__"
  125. AC_MSG_RESULT(using OSS)
  126. AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(OSS support requires ALSA for RtMidi!))])
  127. # If no audio api flags specified, use ALSA
  128. AS_IF([test "$api" == ""], [
  129. AC_MSG_RESULT(using ALSA)
  130. AC_SUBST( api, [-D__LINUX_ALSA__] )
  131. AC_CHECK_LIB(asound, snd_pcm_open, , AC_MSG_ERROR(ALSA support requires the asound library!))
  132. ])
  133. AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))
  134. ;;
  135. *-apple*)
  136. # Look for Core flag
  137. AC_ARG_WITH(core, [ --with-core = choose CoreAudio API support (mac only)])
  138. AS_IF([test "x$with_core" == "xyes"], [
  139. api="$api -D__MACOSX_CORE__"
  140. AC_MSG_RESULT(using CoreAudio)
  141. AC_CHECK_HEADER(CoreAudio/CoreAudio.h, [], [AC_MSG_ERROR(CoreAudio header files not found!)] )
  142. LIBS="$LIBS -framework CoreAudio -framework CoreFoundation -framework CoreMIDI" ])
  143. # If no audio api flags specified, use CoreAudio
  144. AS_IF([test "$api" == ""], [
  145. AC_SUBST( api, [-D__MACOSX_CORE__] )
  146. AC_MSG_RESULT(using CoreAudio)
  147. AC_CHECK_HEADER(CoreAudio/CoreAudio.h,
  148. [],
  149. [AC_MSG_ERROR(CoreAudio header files not found!)] )
  150. AC_SUBST( LIBS, ["-framework CoreAudio -framework CoreFoundation -framework CoreMIDI"] )
  151. ])
  152. AC_CHECK_LIB(pthread, pthread_create, , AC_MSG_ERROR(RtAudio requires the pthread library!))
  153. ;;
  154. *-mingw32*)
  155. AC_ARG_WITH(asio, [ --with-asio = choose ASIO API support (windoze only)])
  156. AS_IF([test "x$with_asio" == "xyes"], [
  157. api="$api -D__WINDOWS_ASIO__"
  158. AC_MSG_RESULT(using ASIO)
  159. AC_SUBST( objects, ["asio.o asiodrivers.o asiolist.o iasiothiscallresolver.o"] ) ])
  160. # Look for DirectSound flag
  161. AC_ARG_WITH(ds, [ --with-ds = choose DirectSound API support (windoze only)])
  162. AS_IF([test "x$with_ds" == "xyes"], [
  163. api="$api -D__WINDOWS_DS__"
  164. AC_MSG_RESULT(using DirectSound)
  165. LIBS="-ldsound $LIBS" ])
  166. # Look for WASAPI flag
  167. AC_ARG_WITH(wasapi, [ --with-wasapi = choose Windows Audio Session API support (windoze only)])
  168. AS_IF([test "x$with_wasapi" == "xyes"], [
  169. api="$api -D__WINDOWS_WASAPI__"
  170. AC_MSG_RESULT(using WASAPI)
  171. LIBS="-luuid -lksuser $LIBS" ])
  172. # If no audio api flags specified, use DirectSound
  173. AS_IF([test "$api" == ""], [
  174. AC_SUBST( api, [-D__WINDOWS_DS__] )
  175. AC_MSG_RESULT(using DirectSound)
  176. LIBS="-ldsound -lwinmm $LIBS"
  177. ])
  178. api="$api -D__WINDOWS_MM__"
  179. LIBS="-lole32 -lwinmm -lwsock32 $LIBS"
  180. ;;
  181. *)
  182. # Default case for unknown realtime systems.
  183. AC_MSG_ERROR(Unknown system type for realtime support ... try --disable-realtime argument!)
  184. ;;
  185. esac
  186. CPPFLAGS="$CPPFLAGS $api"
  187. fi
  188. AC_OUTPUT