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.

396 satır
9.4KB

  1. # Configuration script for sndlib (taken from Snd)
  2. AC_INIT(sndlib, 22, bil@ccrma.stanford.edu, ftp://ccrma-ftp.stanford.edu/pub/Lisp/sndlib.tar.gz)
  3. SNDLIB_VERSION=22
  4. AC_CONFIG_SRCDIR(io.c)
  5. AC_CANONICAL_HOST
  6. AC_CONFIG_FILES(makefile)
  7. AC_CONFIG_FILES(sndlib.pc)
  8. AC_CONFIG_FILES(sndins/Makefile)
  9. AC_CONFIG_HEADERS(unix-config.h)
  10. AC_CONFIG_FILES(sndlib-config, [chmod +x sndlib-config])
  11. AC_PROG_CC
  12. # AC_HEADER_STDC
  13. AC_PROG_INSTALL
  14. AC_C_BIGENDIAN
  15. AC_CHECK_SIZEOF(void *)
  16. AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  17. #--------------------------------------------------------------------------------
  18. # configuration options
  19. # --disable-shared don't try to make a .so file
  20. # --with-alsa use ALSA if possible
  21. # --with-audio without-audio to stub out all audio
  22. # --with-forth use Forth as extension language
  23. # --with-gsl include GSL
  24. # --with-jack use Jack
  25. # --with-oss use OSS if possible
  26. # --with-portaudio use portaudio
  27. # --with-ruby use Ruby as the extension language
  28. # --with-s7 use S7 as the extension language (default = yes)
  29. #--------------------------------------------------------------------------------
  30. AC_ARG_ENABLE(shared, [ --disable_shared don't build or install the shared library])
  31. AC_ARG_WITH(alsa, [ --with-alsa use ALSA])
  32. AC_ARG_WITH(audio, [ --without-audio don't include any audio functionality])
  33. AC_ARG_WITH(forth, [ --with-forth use Forth as the extension language])
  34. AC_ARG_WITH(gsl, [ --with-gsl use GSL, default=yes])
  35. AC_ARG_WITH(jack, [ --with-jack use JACK])
  36. AC_ARG_WITH(oss, [ --with-oss use OSS])
  37. AC_ARG_WITH(portaudio, [ --with-portaudio use portaudio, default=no])
  38. AC_ARG_WITH(ruby, [ --with-ruby use Ruby as the extension language])
  39. AC_ARG_WITH(s7, [ --with-s7 use s7, default=yes])
  40. AUDIO_SYSTEM="None"
  41. LIBS=""
  42. #--------------------------------------------------------------------------------
  43. # GSL
  44. #--------------------------------------------------------------------------------
  45. GSL_LIBS=""
  46. GSL_CFLAGS=""
  47. if test "$with_gsl" != no; then
  48. AC_MSG_CHECKING(for gsl)
  49. if test x$PKG_CONFIG != xno ; then
  50. if $PKG_CONFIG gsl --exists ; then
  51. GSL_LIBS="`$PKG_CONFIG gsl --libs`"
  52. GSL_CFLAGS="`$PKG_CONFIG gsl --cflags`"
  53. AC_DEFINE(HAVE_GSL)
  54. OPTIONAL_LIBRARIES="$OPTIONAL_LIBRARIES gsl"
  55. AC_MSG_RESULT(yes)
  56. else
  57. AC_MSG_RESULT(no)
  58. fi
  59. fi
  60. fi
  61. AC_SUBST(GSL_LIBS)
  62. AC_SUBST(GSL_CFLAGS)
  63. #--------------------------------------------------------------------------------
  64. # language
  65. #--------------------------------------------------------------------------------
  66. # language choice: ruby if --with-ruby and we can find one of ruby-2.0.pc, ruby-1.9.pc, or ruby-1.8.pc
  67. # forth if --with-forth
  68. # none if --without-extension-language
  69. # s7 otherwise
  70. XEN_LIBS=""
  71. XEN_CFLAGS=""
  72. ac_snd_extension_language=none
  73. SNDLIB_LANGUAGE="None"
  74. #--------------------------------------------------------------------------------
  75. # Ruby
  76. #--------------------------------------------------------------------------------
  77. if test "$with_ruby" = yes ; then
  78. if test x$PKG_CONFIG != xno ; then
  79. m4_foreach([ruby_version], [[ruby-2.1], [ruby-2.0], [ruby], [ruby-1.9.3], [ruby-1.9], [ruby-1.8]],
  80. [
  81. if test "$ac_snd_extension_language" = none ; then
  82. if $PKG_CONFIG ruby_version --exists ; then
  83. AC_DEFINE(HAVE_RUBY)
  84. XEN_CFLAGS="`$PKG_CONFIG ruby_version --cflags`"
  85. XEN_LIBS="`$PKG_CONFIG ruby_version --libs`"
  86. LOCAL_LANGUAGE="Ruby"
  87. ac_snd_extension_language=Ruby
  88. fi
  89. fi
  90. ])
  91. fi
  92. fi
  93. #--------------------------------------------------------------------------------
  94. # Forth
  95. #--------------------------------------------------------------------------------
  96. if test "$with_forth" = yes ; then
  97. AC_PATH_PROG([FTH], [fth], [no])
  98. AC_MSG_CHECKING([for Forth])
  99. if test "${FTH}" != no ; then
  100. XEN_CFLAGS=`${FTH} --no-init-file --eval .cflags`
  101. XEN_LIBS=`${FTH} --no-init-file --eval .libs`
  102. AC_MSG_RESULT([yes])
  103. AC_DEFINE(HAVE_FORTH)
  104. ac_snd_extension_language=Forth
  105. SNDLIB_LANGUAGE="Forth"
  106. else
  107. AC_MSG_RESULT([no])
  108. fi
  109. fi
  110. #--------------------------------------------------------------------------------
  111. # s7 (the default)
  112. #--------------------------------------------------------------------------------
  113. if test "$with_s7" != no && test "$ac_snd_extension_language" = none ; then
  114. AC_DEFINE(HAVE_SCHEME)
  115. ac_snd_extension_language=s7
  116. SNDLIB_LANGUAGE="s7"
  117. S7_LIB="s7.o"
  118. AC_SUBST(S7_LIB)
  119. fi
  120. AC_SUBST(XEN_LIBS)
  121. AC_SUBST(XEN_CFLAGS)
  122. #--------------------------------------------------------------------------------
  123. # Audio library
  124. #--------------------------------------------------------------------------------
  125. AUDIO_LIB=""
  126. JACK_LIBS=""
  127. JACK_FLAGS=""
  128. if test "$with_audio" != no ; then
  129. if test "$with_pulseaudio" = yes ; then
  130. AC_DEFINE(MUS_PULSEAUDIO)
  131. AUDIO_LIB="-lpulse-simple"
  132. AUDIO_SYSTEM=pulseaudio
  133. fi
  134. if test "$with_portaudio" = yes ; then
  135. AC_DEFINE(MUS_PORTAUDIO)
  136. AUDIO_SYSTEM=portaudio
  137. AUDIO_LIB="-lportaudio"
  138. fi
  139. if test "$with_jack" = yes ; then
  140. AUDIO_SYSTEM=JACK
  141. AC_DEFINE(MUS_JACK)
  142. if test x$PKG_CONFIG != xno ; then
  143. if $PKG_CONFIG jack --exists ; then
  144. JACK_LIBS="`$PKG_CONFIG jack --libs`"
  145. JACK_FLAGS="`$PKG_CONFIG jack --cflags`"
  146. if $PKG_CONFIG samplerate --exists ; then
  147. JACK_LIBS="$JACK_LIBS `$PKG_CONFIG samplerate --libs`"
  148. JACK_FLAGS="$JACK_FLAGS `$PKG_CONFIG samplerate --cflags`"
  149. else
  150. JACK_LIBS="$JACK_LIBS -lsamplerate"
  151. fi
  152. else
  153. JACK_LIBS="-ljack -lsamplerate"
  154. fi
  155. else
  156. JACK_LIBS="-ljack -lsamplerate"
  157. fi
  158. fi
  159. if test "$with_alsa" = yes ; then
  160. AC_DEFINE(HAVE_ALSA)
  161. AUDIO_LIB="-lasound"
  162. AUDIO_SYSTEM=ALSA
  163. fi
  164. if test "$with_oss" = yes ; then
  165. AC_DEFINE(HAVE_OSS)
  166. AUDIO_SYSTEM=OSS
  167. fi
  168. if test "$AUDIO_SYSTEM" = None ; then
  169. case "$host" in
  170. *-*-linux*)
  171. AUDIO_SYSTEM=ALSA
  172. AC_DEFINE(HAVE_ALSA)
  173. AUDIO_LIB="-lasound"
  174. ;;
  175. *-*-sunos4*)
  176. AUDIO_SYSTEM=Sun
  177. ;;
  178. *-*-solaris*)
  179. AUDIO_SYSTEM=Sun
  180. ;;
  181. *-*-hpux*)
  182. AUDIO_SYSTEM=Hpux
  183. ;;
  184. *-*-bsdi*)
  185. AC_DEFINE(HAVE_OSS)
  186. AUDIO_SYSTEM=OSS
  187. ;;
  188. *-*-freebsd*)
  189. AC_DEFINE(HAVE_OSS)
  190. AUDIO_SYSTEM=OSS
  191. ;;
  192. *-*-openbsd*)
  193. AUDIO_SYSTEM=OpenBSD
  194. ;;
  195. *-*-netbsd*)
  196. AUDIO_SYSTEM=NetBSD
  197. ;;
  198. *-*-cygwin*)
  199. if test "$with_jack" != yes ; then
  200. AUDIO_SYSTEM=Windows
  201. fi
  202. ;;
  203. *-*-mingw*)
  204. audio_system=Windows
  205. ;;
  206. *-apple-*)
  207. if test "$with_jack" != yes ; then
  208. AUDIO_SYSTEM=MacOSX
  209. AUDIO_LIB="-framework CoreAudio -framework CoreFoundation -framework CoreMIDI"
  210. else
  211. AUDIO_SYSTEM=JACK
  212. JACK_LIBS="-framework CoreAudio -framework CoreServices -framework AudioUnit -L/usr/local/lib -ljack -lsamplerate"
  213. JACK_FLAGS="-I/usr/local/include"
  214. fi
  215. ;;
  216. esac
  217. fi
  218. fi
  219. AC_MSG_CHECKING([for audio system])
  220. AC_MSG_RESULT($AUDIO_SYSTEM)
  221. if test "$AUDIO_SYSTEM" != None ; then
  222. AC_DEFINE(WITH_AUDIO)
  223. fi
  224. AC_SUBST(AUDIO_LIB)
  225. AC_SUBST(JACK_LIBS)
  226. AC_SUBST(JACK_FLAGS)
  227. #--------------------------------------------------------------------------------
  228. # compiler/loader flags
  229. #--------------------------------------------------------------------------------
  230. LDSO_FLAGS=""
  231. SO_FLAGS=""
  232. SO_LD="ld"
  233. SO_INSTALL="install"
  234. A_INSTALL="install"
  235. # A_LD="ld"
  236. # A_LD_FLAGS=""
  237. A_LD="ar"
  238. A_LD_FLAGS="-rc"
  239. SO_NAME="libsndlib.so"
  240. RANLIB=":"
  241. LD_FLAGS="-r"
  242. case "$host" in
  243. *-*-linux*)
  244. LDSO_FLAGS="-shared"
  245. LIBS="$LIBS -lm -ldl"
  246. if test "$GCC" = yes ; then
  247. SO_FLAGS="-fPIC $SO_FLAGS"
  248. SO_LD="$CC"
  249. fi
  250. if test "$with_jack" = yes ; then
  251. A_INSTALL=":"
  252. A_LD=":"
  253. fi
  254. ;;
  255. *-*-sunos4*)
  256. LIBS="$LIBS -lm"
  257. ;;
  258. *-*-solaris*)
  259. LIBS="$LIBS -lm"
  260. LDSO_FLAGS="-G"
  261. ;;
  262. *-*-hpux*)
  263. LDSO_FLAGS="+z -Ae +DA1.1"
  264. if test "$GCC" = yes ; then
  265. SO_FLAGS="-fPIC $SO_FLAGS"
  266. fi
  267. ;;
  268. *-*-bsdi*)
  269. LIBS="$LIBS -lm"
  270. if test "$GCC" = yes ; then
  271. SO_FLAGS="-fPIC $SO_FLAGS"
  272. fi
  273. ;;
  274. *-*-freebsd*)
  275. LIBS="$LIBS -lm"
  276. if test "$GCC" = yes ; then
  277. SO_LD="$CC"
  278. SO_FLAGS="-fPIC $SO_FLAGS"
  279. LDSO_FLAGS="-shared"
  280. fi
  281. ;;
  282. *-*-openbsd*)
  283. LIBS="$LIBS -lm"
  284. if test "$GCC" = yes ; then
  285. SO_LD="$CC"
  286. SO_FLAGS="-fPIC $SO_FLAGS"
  287. CFLAGS="-ftrampolines $CFLAGS"
  288. LDSO_FLAGS="-shared"
  289. fi
  290. ;;
  291. *-*-netbsd*)
  292. LIBS="$LIBS -lm"
  293. if test "$GCC" = yes ; then
  294. SO_LD="$CC"
  295. SO_FLAGS="-fPIC $SO_FLAGS"
  296. LDSO_FLAGS="-shared"
  297. fi
  298. ;;
  299. *-*-cygwin*)
  300. A_LD_FLAGS="-rc"
  301. SO_INSTALL=":"
  302. SO_LD=":"
  303. ;;
  304. *-*-mingw*)
  305. LIBS="$LIBS -lwinmm -lwsock32"
  306. LDFLAGS="$LDFLAGS -mwindows"
  307. SO_INSTALL=":"
  308. SO_LD=":"
  309. ;;
  310. *-apple-*)
  311. SO_LD="$CC"
  312. LDSO_FLAGS="-dynamic -bundle -undefined suppress -flat_namespace"
  313. ;;
  314. esac
  315. if test "$enable_shared" = no; then
  316. SO_LD=":"
  317. SO_INSTALL=":"
  318. fi
  319. AUDIO_CHOICE="$AUDIO_SYSTEM"
  320. CFLAGS="-I. $CFLAGS"
  321. AC_SUBST(LDSO_FLAGS)
  322. AC_SUBST(SO_FLAGS)
  323. AC_SUBST(SO_INSTALL)
  324. AC_SUBST(A_INSTALL)
  325. AC_SUBST(SO_LD)
  326. AC_SUBST(A_LD)
  327. AC_SUBST(A_LD_FLAGS)
  328. AC_SUBST(LD_FLAGS)
  329. AC_SUBST(SNDLIB_VERSION)
  330. AC_SUBST(SNDLIB_LANGUAGE)
  331. AC_SUBST(SO_NAME)
  332. AC_SUBST(JACK_LIBS)
  333. AC_SUBST(JACK_FLAGS)
  334. AC_SUBST(RANLIB)
  335. AC_SUBST(AUDIO_CHOICE)
  336. AC_OUTPUT