configure.ac 74 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467
  1. dnl configure.ac: source for the configure script
  2. dnl copyright by the mpg123 project - free software under the terms of the LGPL 2.1
  3. dnl see COPYING and AUTHORS files in distribution or http://mpg123.org
  4. dnl initially written by Nicholas J. Humfrey
  5. dnl Require autoconf version >= 2.57
  6. AC_PREREQ(2.57)
  7. dnl ############# Initialisation
  8. AC_INIT([mpg123], [1.17.0], [[email protected]])
  9. dnl Increment API_VERSION when the API gets changes (new functions).
  10. API_VERSION=38
  11. LIB_PATCHLEVEL=4
  12. dnl Since we want to be backwards compatible, both sides get set to API_VERSION.
  13. LIBMPG123_VERSION=$API_VERSION:$LIB_PATCHLEVEL:$API_VERSION
  14. AC_SUBST(LIBMPG123_VERSION)
  15. AC_SUBST(API_VERSION)
  16. AC_CONFIG_SRCDIR(src/mpg123.c)
  17. AC_CONFIG_AUX_DIR(build)
  18. AC_CONFIG_SRCDIR(doc)
  19. AC_CONFIG_MACRO_DIR([m4])
  20. AC_CANONICAL_HOST
  21. dnl Version 1.7 of automake is recommended
  22. AM_INIT_AUTOMAKE(1.7)
  23. AC_CONFIG_HEADERS([src/config.h])
  24. # You get strange symptoms like jack module build failing because the AC_C_CONST failed to detect the working const support.
  25. # In that case, the test failed because -Werror, not because no const there...
  26. # After looking again, there are possibly more tests being obscured by false failures.
  27. AC_MSG_CHECKING([for -Werror in CFLAGS (It breaks tests)])
  28. if echo "$CFLAGS" | grep Werror; then
  29. AC_MSG_RESULT([yes])
  30. AC_MSG_WARN([You have -Werror in CFLAGS. That may break some tests and make this configure bogus.
  31. If you want paranoid compilation, use --enable-nagging option, which adds -Werror for gcc.
  32. Also note that you shall not run make distcheck after configuring with --enable-nagging.
  33. distcheck uses the generated CFLAGS...
  34. Anyhow, continuing at your own risk.])
  35. else
  36. AC_MSG_RESULT([no])
  37. fi
  38. buffer=enabled # try to build with buffer by default
  39. dnl ############# Compiler and tools Checks
  40. LT_LDFLAGS=-export-dynamic
  41. EXEC_LT_LDFLAGS=
  42. be_static=no
  43. all_static=no
  44. AC_MSG_CHECKING([if you are up to something totally static with LDFLAGS/CFLAGS])
  45. for f in $LDFLAGS $CFLAGS
  46. do
  47. case "$f" in
  48. -all-static)
  49. be_static=yes
  50. all_static=yes
  51. ;;
  52. -static)
  53. be_static=yes
  54. ;;
  55. esac
  56. done
  57. if test "x$be_static" = xyes; then
  58. AC_MSG_RESULT([yes])
  59. LT_LDFLAGS=-all-static
  60. EXEC_LT_LDFLAGS="$LT_LDFLAGS"
  61. else
  62. AC_MSG_RESULT([no])
  63. fi
  64. if test "x$all_static" = xyes; then
  65. AC_MSG_WARN( Use -static in LDFLAGS for all-static linking! Your compiler may blow up on that -all-static. )
  66. fi
  67. AM_PROG_AS
  68. AC_PROG_CC
  69. AC_PROG_CPP
  70. AC_PROG_INSTALL
  71. dnl "Checking for egrep is broken after removal of libltdl stuff... checks use $EGREP, so searching it here."
  72. AC_PROG_EGREP
  73. AC_C_CONST
  74. AC_INLINE
  75. AC_C_BIGENDIAN
  76. dnl ############# Use Libtool for dynamic module loading
  77. modules=auto
  78. OUTPUT_OBJ="module.\$(OBJEXT)"
  79. AC_ARG_ENABLE(modules,
  80. [ --enable-modules=[no/yes] dynamically loadable output modules],
  81. [
  82. if test "x$enableval" = xyes
  83. then
  84. modules=enabled
  85. else
  86. modules=disabled
  87. fi
  88. ],
  89. [
  90. if test "x$be_static" = "xyes"; then
  91. modules=disabled
  92. else
  93. modules=auto
  94. fi
  95. ])
  96. dnl We only want shared libraries by default
  97. AC_DISABLE_STATIC
  98. AC_ENABLE_SHARED
  99. if test x"$enable_shared" = xno; then
  100. modules=disabled
  101. LT_LDFLAGS=
  102. else
  103. AC_DEFINE(DYNAMIC_BUILD, 1, [ Define if building with dynamcally linked libmpg123])
  104. fi
  105. if test x"$modules" = xdisabled
  106. then
  107. echo "Modules disabled, not checking for libltdl."
  108. else
  109. have_ltdl=no
  110. AC_CHECK_LIB( [ltdl], [lt_dlinit],
  111. [ AC_CHECK_HEADER( [ltdl.h],
  112. [
  113. have_ltdl=yes
  114. AC_DEFINE(HAVE_LTDL, 1, [ Define if libltdl is available ])
  115. ],
  116. [
  117. AC_MSG_WARN([Found ltdl library but NOT the header file on your system])
  118. ] )
  119. ],
  120. [
  121. AC_MSG_WARN([ltdl library not found])
  122. ]
  123. )
  124. if test x"$modules" = xenabled -a x"$have_ltdl" = xno; then
  125. AC_MSG_ERROR([Modules enabled but no libltdl found! This will not work...])
  126. fi
  127. if test x"$modules" = xauto; then
  128. if test x"$have_ltdl" = xyes; then
  129. modules=enabled
  130. echo "We found libltdl: Modules enabled."
  131. else
  132. echo "We did not find libltdl: Modules disabled."
  133. modules=disabled
  134. fi
  135. fi
  136. fi
  137. if test x"$modules" = xdisabled
  138. then
  139. echo "Modules disabled."
  140. else
  141. # Enable module support in source code
  142. AC_DEFINE( USE_MODULES, 1, [Define if modules are enabled] )
  143. fi
  144. dnl Configure libtool
  145. AC_LIBTOOL_WIN32_DLL
  146. AM_PROG_LIBTOOL
  147. if test x"$modules" = xdisabled
  148. then
  149. echo "Modules still disabled..."
  150. MODULE_OBJ="legacy_module.\$(OBJEXT)"
  151. else
  152. MODULE_OBJ="module.\$(OBJEXT)"
  153. fi
  154. AM_CONDITIONAL( [HAVE_MODULES], [test "x$modules" = xenabled] )
  155. AC_SUBST(MODULE_OBJ)
  156. AC_SUBST(LT_LDFLAGS)
  157. AC_SUBST(EXEC_LT_LDFLAGS)
  158. dnl ############## Configurable Options
  159. AC_ARG_ENABLE(debug,
  160. [ --enable-debug=[no/yes] turn on debugging],
  161. [
  162. if test "x$enableval" = xyes
  163. then
  164. debugging="enabled"
  165. else
  166. debugging="disabled"
  167. fi
  168. ],
  169. [ debugging="disabled" ]
  170. )
  171. AC_ARG_ENABLE(nagging,
  172. [ --enable-nagging=[no/yes] turn on GCC's pedantic nagging with error on warnings, also enables debugging ],
  173. [
  174. if test "x$enableval" = xyes
  175. then
  176. nagging="enabled"
  177. debugging="enabled"
  178. else
  179. nagging="disabled"
  180. fi
  181. ],
  182. [ nagging="disabled" ]
  183. )
  184. if test x"$debugging" = xenabled; then
  185. AC_DEFINE(DEBUG, 1, [ Define if debugging is enabled. ])
  186. fi
  187. AC_ARG_ENABLE(gapless,
  188. [ --enable-gapless=[no/yes] turn on gapless (enabled per default)],
  189. [
  190. if test "x$enableval" = xyes
  191. then
  192. gapless="enabled"
  193. AC_DEFINE(GAPLESS, 1, [ Define if gapless is enabled. ])
  194. else
  195. gapless="disabled"
  196. fi
  197. ],
  198. [
  199. gapless="enabled"
  200. AC_DEFINE(GAPLESS, 1, [ Define if gapless is enabled. ])
  201. ]
  202. )
  203. AC_ARG_ENABLE(fifo,
  204. [ --enable-fifo=[no/yes] FIFO support for control interface (auto-enabled on linux) ],
  205. [
  206. if test "x$enableval" = xyes
  207. then
  208. fifo="enabled"
  209. else
  210. fifo="disabled"
  211. fi
  212. ],
  213. [
  214. fifo="auto"
  215. ]
  216. )
  217. AC_ARG_ENABLE(ipv6,
  218. [ --enable-ipv6=[no/yes] IPv6 support (actually any protocol your libc does with getaddrinfo) ],
  219. [
  220. if test "x$enableval" = xyes
  221. then
  222. ipv6="enabled"
  223. else
  224. ipv6="disabled"
  225. fi
  226. ],
  227. [
  228. ipv6="auto"
  229. ]
  230. )
  231. AC_ARG_ENABLE(network,
  232. [ --enable-network=[no/yes] network support (http streams / webradio) ],
  233. [
  234. if test "x$enableval" = xyes
  235. then
  236. network="enabled"
  237. else
  238. network="disabled"
  239. fi
  240. ],
  241. [
  242. network="auto"
  243. ]
  244. )
  245. dnl Optional objects list, depends on decoder choice and core feature selection.
  246. dnl Not just for specific decoders anymore...
  247. s_fpu=
  248. DECODER_OBJ=
  249. DECODER_LOBJ=
  250. dnl Core features that can be disabled to reduce binary size.
  251. id3v2=enabled
  252. AC_ARG_ENABLE(id3v2,
  253. [ --disable-id3v2=[no/yes] no ID3v2 parsing ],
  254. [
  255. if test "x$enableval" = xno; then
  256. id3v2="disabled"
  257. fi
  258. ], [])
  259. # id3v2 depends on strings... so check that in between.
  260. string=enabled
  261. AC_ARG_ENABLE(string,
  262. [ --disable-string=[no/yes] no string API (this will disable ID3v2; main mpg123 won't build anymore) ],
  263. [
  264. if test "x$enableval" = xno; then
  265. string="disabled"
  266. fi
  267. ], [])
  268. if test "x$string" = "xdisabled"; then
  269. AC_DEFINE(NO_STRING, 1, [ Define to disable string functions. ])
  270. id3v2=disabled
  271. AC_MSG_WARN([ID3v2 support disabled because of string API being disabled.])
  272. else
  273. DECODER_OBJ="$DECODER_OBJ stringbuf.\$(OBJEXT)"
  274. DECODER_LOBJ="$DECODER_LOBJ stringbuf.lo"
  275. fi
  276. if test "x$id3v2" = "xdisabled"; then
  277. AC_DEFINE(NO_ID3V2, 1, [ Define to disable ID3v2 parsing. ])
  278. fi
  279. icy=enabled
  280. AC_ARG_ENABLE(icy,
  281. [ --disable-icy=[no/yes] no ICY metainfo parsing/conversion (main mpg123 won't build!) ],
  282. [
  283. if test "x$enableval" = xno; then
  284. icy="disabled"
  285. fi
  286. ], [])
  287. if test "x$icy" = "xdisabled"; then
  288. AC_DEFINE(NO_ICY, 1, [ Define to disable ICY handling. ])
  289. else
  290. DECODER_OBJ="$DECODER_OBJ icy.\$(OBJEXT) icy2utf8.\$(OBJEXT)"
  291. DECODER_LOBJ="$DECODER_LOBJ icy.lo icy2utf8.lo"
  292. fi
  293. ntom=enabled
  294. AC_ARG_ENABLE(ntom,
  295. [ --disable-ntom=[no/yes] no flexible resampling ],
  296. [
  297. if test "x$enableval" = xno; then
  298. ntom="disabled"
  299. fi
  300. ], [])
  301. if test "x$ntom" = "xdisabled"; then
  302. AC_DEFINE(NO_NTOM, 1, [ Define to disable ntom resampling. ])
  303. else
  304. DECODER_OBJ="$DECODER_OBJ ntom.\$(OBJEXT)"
  305. DECODER_LOBJ="$DECODER_LOBJ ntom.lo"
  306. fi
  307. downsample=enabled
  308. AC_ARG_ENABLE(downsample,
  309. [ --disable-downsample=[no/yes] no downsampled decoding ],
  310. [
  311. if test "x$enableval" = xno; then
  312. downsample="disabled"
  313. fi
  314. ], [])
  315. if test "x$downsample" = "xdisabled"; then
  316. AC_DEFINE(NO_DOWNSAMPLE, 1, [ Define to disable downsampled decoding. ])
  317. fi
  318. feeder=enabled
  319. AC_ARG_ENABLE(feeder,
  320. [ --disable-feeder=[no/yes] no feeder decoding, no buffered readers ],
  321. [
  322. if test "x$enableval" = xno; then
  323. feeder="disabled"
  324. fi
  325. ], [])
  326. if test "x$feeder" = "xdisabled"; then
  327. AC_DEFINE(NO_FEEDER, 1, [ Define to disable feeder and buffered readers. ])
  328. fi
  329. messages=enabled
  330. AC_ARG_ENABLE(messages,
  331. [ --disable-messages=[no/yes] no error/warning messages on the console ],
  332. [
  333. if test "x$enableval" = xno; then
  334. messages="disabled"
  335. fi
  336. ], [])
  337. if test "x$messages" = "xdisabled"; then
  338. AC_DEFINE(NO_WARNING, 1, [ Define to disable warning messages. ])
  339. AC_DEFINE(NO_ERRORMSG, 1, [ Define to disable error messages. ])
  340. AC_DEFINE(NO_ERETURN, 1, [ Define to disable error messages in combination with a return value (the return is left intact). ])
  341. fi
  342. newhuff=enabled
  343. AC_ARG_ENABLE(new-huffman,
  344. [ --enable-new-huffman=[yes/no] use new huffman decoding scheme by Taihei (faster on modern CPUs at least, so on by default) ],
  345. [
  346. if test "x$enableval" = xno; then
  347. newhuff=disabled
  348. fi
  349. ]
  350. , [])
  351. if test "x$newhuff" = "xenabled"; then
  352. AC_DEFINE(USE_NEW_HUFFTABLE, 1, [ Define for new Huffman decoding scheme. ])
  353. fi
  354. integers=fast
  355. AC_ARG_ENABLE(int-quality,
  356. [ --enable-int-quality=[yes/no] use rounding instead of fast truncation for integer output, where possible ],
  357. [
  358. if test "x$enableval" = xyes; then
  359. integers=quality
  360. AC_DEFINE(ACCURATE_ROUNDING, 1, [ Define to use proper rounding. ])
  361. fi
  362. ], [])
  363. int16=enabled
  364. AC_ARG_ENABLE(16bit,
  365. [ --disable-16bit=[no/yes] no 16 bit integer output ],
  366. [
  367. if test "x$enableval" = xno; then
  368. int16="disabled"
  369. fi
  370. ], [])
  371. int8=enabled
  372. AC_ARG_ENABLE(8bit,
  373. [ --disable-8bit=[no/yes] no 8 bit integer output ],
  374. [
  375. if test "x$enableval" = xno; then
  376. int8="disabled"
  377. fi
  378. ], [])
  379. int32=enabled
  380. AC_ARG_ENABLE(32bit,
  381. [ --disable-32bit=[no/yes] no 32 bit integer output (also 24 bit) ],
  382. [
  383. if test "x$enableval" = xno; then
  384. int32="disabled"
  385. fi
  386. ], [])
  387. real=enabled
  388. AC_ARG_ENABLE(real,
  389. [ --disable-real=[no/yes] no real (floating point) output ],
  390. [
  391. if test "x$enableval" = xno; then
  392. real="disabled"
  393. fi
  394. ], [])
  395. AC_ARG_WITH([cpu], [
  396. --with-cpu=generic[_fpu] Use generic processor code with floating point arithmetic
  397. --with-cpu=generic_float Plain alias to generic_fpu now... float output is a normal runtime option!
  398. --with-cpu=generic_nofpu Use generic processor code with fixed point arithmetic (p.ex. ARM, experimental)
  399. --with-cpu=generic_dither Use generic processor code with floating point arithmetic and dithering for 1to1 16bit decoding.
  400. --with-cpu=i386[_fpu] Use code optimized for i386 processors with floating point arithmetic
  401. --with-cpu=i386_nofpu Use code optimized for i386 processors with fixed point arithmetic (experimental)
  402. --with-cpu=i486 Use code optimized for i486 processors (only usable alone!)
  403. --with-cpu=i586 Use code optimized for i586 processors
  404. --with-cpu=i586_dither Use code optimized for i586 processors with dithering (noise shaping), adds 256K to binary size
  405. --with-cpu=3dnow Use code optimized for 3DNow processors
  406. --with-cpu=3dnow_vintage Use code optimized for older 3DNow processors (K6 family)
  407. --with-cpu=3dnowext Use code optimized for 3DNowExt processors (K6-3+, Athlon)
  408. --with-cpu=3dnowext_alone Really only 3DNowExt decoder, without 3DNow fallback for flexible rate
  409. --with-cpu=3dnow_vintage Use code optimized for older extended 3DNow processors (like K6-III+)
  410. --with-cpu=mmx Use code optimized for MMX processors
  411. --with-cpu=mmx_alone Really only MMX decoder, without i586 fallback for flexible rate
  412. --with-cpu=sse Use code optimized for SSE processors
  413. --with-cpu=sse_vintage Use code optimized for older SSE processors (plain C DCT36)
  414. --with-cpu=sse_alone Really only SSE decoder, without i586 fallback for flexible rate
  415. --with-cpu=avx Use code optimized for x86-64 with AVX processors
  416. --with-cpu=x86 Pack all x86 opts into one binary (excluding i486, including dither)
  417. --with-cpu=x86-64 Use code optimized for x86-64 processors (AMD64 and Intel64, including AVX and dithered generic)
  418. --with-cpu=altivec Use code optimized for Altivec processors (PowerPC G4 and G5)
  419. --with-cpu=ppc_nofpu Use code optimized for PowerPC processors with fixed point arithmetic (experimental)
  420. --with-cpu=neon Use code optimized for ARM NEON SIMD engine (Cortex-A series)
  421. --with-cpu=arm_nofpu Use code optimized for ARM processors with fixed point arithmetic (experimental)
  422. ])
  423. # opt-in for IEEE754 floating point action
  424. # We want to make sure not to apply hacks relying on IEEE754 storage format on platforms where we did not make sure that this actually is valid.
  425. # It _should_ be fine for about all computers still out there, but we play safe.
  426. ieee=no
  427. case $host in
  428. i?86-*|x86_64-*|powerpc*|sparc*)
  429. ieee=yes
  430. ;;
  431. esac
  432. if test "x$ieee" = xyes; then
  433. echo "We assume IEEE754 floating point format."
  434. AC_DEFINE(IEEE_FLOAT, 1, [ Define to indicate that float storage follows IEEE754. ])
  435. fi
  436. newoldwritesample=disabled
  437. case $host in
  438. arm*-*-linux*)
  439. # check that... perhaps we are better off on arm with kernel math emulation
  440. cpu_type="arm_nofpu"
  441. ;;
  442. i386-*-linux*|i386-*-kfreebsd*-gnu)
  443. cpu_type="i386_fpu"
  444. newoldwritesample=enabled
  445. ;;
  446. i486-*-linux*|i486-*-kfreebsd*-gnu)
  447. cpu_type="i486"
  448. newoldwritesample=enabled
  449. ;;
  450. i586-*-linux*|i586-*-kfreebsd*-gnu)
  451. cpu_type="x86"
  452. newoldwritesample=enabled
  453. ;;
  454. i686-*-linux*|i686-*-kfreebsd*-gnu)
  455. cpu_type="x86"
  456. newoldwritesample=enabled
  457. ;;
  458. x86_64-*-linux*|x86_64-*-kfreebsd*-gnu)
  459. cpu_type="x86-64"
  460. ;;
  461. *-*-linux*|*-*-kfreebsd*-gnu)
  462. cpu_type="generic_fpu"
  463. ;;
  464. i386-apple-darwin10*)
  465. AC_MSG_CHECKING([if CPU type supports x86-64])
  466. case `sysctl -n hw.optional.x86_64` in
  467. 1)
  468. AC_MSG_RESULT([yes])
  469. cpu_type="x86-64"
  470. ;;
  471. *)
  472. AC_MSG_RESULT([no])
  473. cpu_type="x86"
  474. newoldwritesample=enabled
  475. ;;
  476. esac
  477. ;;
  478. i386-apple-darwin*)
  479. cpu_type="x86"
  480. newoldwritesample=enabled
  481. ;;
  482. x86_64-apple-darwin*)
  483. cpu_type="x86-64"
  484. ;;
  485. *-apple-darwin*)
  486. AC_MSG_CHECKING([if CPU type supports AltiVec])
  487. case `machine` in
  488. ppc7400 | ppc7450 | ppc970)
  489. AC_MSG_RESULT([yes])
  490. cpu_type="altivec"
  491. ;;
  492. *)
  493. AC_MSG_RESULT([no])
  494. cpu_type="generic_fpu"
  495. ;;
  496. esac
  497. ;;
  498. i?86-*-dragonfly* | i?86-*-freebsd* | i?86-*-midnightbsd* | i?86-*-mirbsd* | i?86-*-netbsd* | i?86-*-openbsd*)
  499. cpu_type="x86"
  500. newoldwritesample=enabled
  501. ;;
  502. x86_64-*-dragonfly* | x86_64-*-freebsd* | x86_64-*-midnightbsd* | x86_64-*-mirbsd* | x86_64-*-netbsd* | x86_64-*-openbsd*)
  503. cpu_type="x86-64"
  504. ;;
  505. *-*-dragonfly* | *-*-freebsd* | *-*-midnightbsd* | *-*-mirbsd* | *-*-netbsd* | *-*-openbsd*)
  506. cpu_type="generic_fpu"
  507. ;;
  508. i386-*-solaris*)
  509. cpu_type=x86
  510. newoldwritesample=enabled
  511. ;;
  512. x86_64-*-solaris*)
  513. cpu_type=x86-64
  514. ;;
  515. *-*-solaris*)
  516. cpu_type="generic_fpu"
  517. ;;
  518. # os2-emx = OS/2 with some Unix fun; so p.ex. buffer works.
  519. # Till we sorted out the assembler troubles, generic CPU is default.
  520. i386-pc-os2-emx)
  521. cpu_type=generic_fpu
  522. newoldwritesample=enabled
  523. ;;
  524. x86_64-pc-os2-emx)
  525. # We are optimistic hat the future knows OS/2 on x86-64;-)
  526. cpu_type=generic_fpu
  527. ;;
  528. *-pc-os2-emx)
  529. cpu_type="generic_fpu"
  530. ;;
  531. *-dec-osf*)
  532. cpu_type="generic_fpu"
  533. ;;
  534. x86_64-*-cygwin*)
  535. cpu_type="x86-64"
  536. ;;
  537. i686-*-cygwin*)
  538. cpu_type="x86"
  539. newoldwritesample=enabled
  540. ;;
  541. i586-*-cygwin*)
  542. cpu_type="x86"
  543. newoldwritesample=enabled
  544. ;;
  545. i486-*-cygwin*)
  546. cpu_type="i486"
  547. newoldwritesample=enabled
  548. ;;
  549. i386-*-cygwin*)
  550. cpu_type="i386"
  551. newoldwritesample=enabled
  552. ;;
  553. *-cygwin*)
  554. cpu_type="generic_fpu"
  555. ;;
  556. i@<:@3-7@:>@86-*-mingw32*)
  557. LIBS="$LIBS"
  558. buffer=disabled
  559. cpu_type="x86"
  560. newoldwritesample=enabled
  561. ;;
  562. x86_64-*-mingw32*)
  563. LIBS="$LIBS"
  564. buffer=disabled
  565. cpu_type="x86-64"
  566. ;;
  567. i386-*-nto-qnx*)
  568. cpu_type="x86"
  569. newoldwritesample=enabled
  570. ;;
  571. i386-*)
  572. AC_MSG_WARN([Unknown host operating system])
  573. cpu_type="i386"
  574. buffer=disabled
  575. ADD_CPPFLAGS="-DGENERIC $ADD_CPPFLAGS"
  576. newoldwritesample=enabled
  577. ;;
  578. i486-*)
  579. AC_MSG_WARN([Unknown host operating system])
  580. cpu_type="i486"
  581. buffer=disabled
  582. ADD_CPPFLAGS="-DGENERIC $ADD_CPPFLAGS"
  583. newoldwritesample=enabled
  584. ;;
  585. i586-*)
  586. AC_MSG_WARN([Unknown host operating system])
  587. cpu_type="x86"
  588. buffer=disabled
  589. ADD_CPPFLAGS="-DGENERIC $ADD_CPPFLAGS"
  590. newoldwritesample=enabled
  591. ;;
  592. i686-*)
  593. AC_MSG_WARN([Unknown host operating system])
  594. cpu_type="x86"
  595. buffer=disabled
  596. ADD_CPPFLAGS="-DGENERIC $ADD_CPPFLAGS"
  597. newoldwritesample=enabled
  598. ;;
  599. x86_64-*)
  600. AC_MSG_WARN([Unknown host operating system])
  601. cpu_type="x86-64"
  602. buffer=disabled
  603. ADD_CPPFLAGS="-DGENERIC $ADD_CPPFLAGS"
  604. ;;
  605. *)
  606. AC_MSG_WARN([Unknown host operating system])
  607. cpu_type="generic_fpu"
  608. buffer=disabled
  609. ADD_CPPFLAGS="-DGENERIC $ADD_CPPFLAGS"
  610. ;;
  611. esac
  612. AC_ARG_ENABLE(buffer,
  613. [ --enable-buffer=[yes/no] disable audio buffer code (default uses system whitelist... proper checks later) ],
  614. [
  615. if test "x$enableval" = xyes
  616. then
  617. echo "Note: Enabling buffer per request... perhaps it will not build anyway."
  618. buffer="enabled"
  619. else
  620. echo "Note: Disabling buffer per request."
  621. buffer="disabled"
  622. fi
  623. ]
  624. )
  625. AC_ARG_ENABLE(newoldwritesample,
  626. [ --enable-newoldwritesample=[no/yes] enable new/old WRITE_SAMPLE macro for non-accurate 16 bit output, faster on certain CPUs (default on on x86-32)],
  627. [
  628. if test "x$enableval" = xyes
  629. then
  630. newoldwritesample=enabled
  631. else
  632. newoldwritesample=disabled
  633. fi
  634. ])
  635. dnl Did user choose other CPU type ?
  636. if test "x$with_cpu" != "x"; then
  637. cpu_type=$with_cpu
  638. fi
  639. if test "x$cpu_type" = "xgeneric_nofpu"; then
  640. real=disabled
  641. int32=disabled
  642. fi
  643. if test "x$cpu_type" = "xi386_nofpu"; then
  644. real=disabled
  645. int32=disabled
  646. fi
  647. if test "x$cpu_type" = "xppc_nofpu"; then
  648. real=disabled
  649. int32=disabled
  650. fi
  651. if test "x$cpu_type" = "xarm_nofpu"; then
  652. real=disabled
  653. int32=disabled
  654. fi
  655. if test "x$int16" = "xdisabled"; then
  656. AC_DEFINE(NO_16BIT, 1, [ Define to disable 16 bit integer output. ])
  657. else
  658. DECODER_OBJ="$DECODER_OBJ synth.\$(OBJEXT)"
  659. DECODER_LOBJ="$DECODER_LOBJ synth.lo"
  660. fi
  661. # 8bit works only through 16bit
  662. if test "x$int16" = "xdisabled"; then
  663. int8=disabled
  664. fi
  665. if test "x$int8" = "xdisabled"; then
  666. AC_DEFINE(NO_8BIT, 1, [ Define to disable 8 bit integer output. ])
  667. else
  668. DECODER_OBJ="$DECODER_OBJ synth_8bit.\$(OBJEXT)"
  669. DECODER_LOBJ="$DECODER_LOBJ synth_8bit.lo"
  670. fi
  671. if test "x$int32" = "xdisabled"; then
  672. AC_DEFINE(NO_32BIT, 1, [ Define to disable 32 bit and 24 bit integer output. ])
  673. else
  674. s_fpu="$s_fpu synth_s32"
  675. fi
  676. if test "x$real" = "xdisabled"; then
  677. AC_DEFINE(NO_REAL, 1, [ Define to disable real output. ])
  678. else
  679. s_fpu="$s_fpu synth_real"
  680. fi
  681. layer1=enabled
  682. AC_ARG_ENABLE(layer1,
  683. [ --disable-layer1=[no/yes] no layer I decoding ],
  684. [
  685. if test "x$enableval" = xno; then
  686. layer1="disabled"
  687. fi
  688. ], [])
  689. if test "x$layer1" = "xdisabled"; then
  690. AC_DEFINE(NO_LAYER1, 1, [ Define to disable layer I. ])
  691. else
  692. # layer1 needs code in layer2
  693. DECODER_OBJ="$DECODER_OBJ layer1.\$(OBJEXT) layer2.\$(OBJEXT)"
  694. DECODER_LOBJ="$DECODER_LOBJ layer1.lo layer2.lo"
  695. fi
  696. layer2=enabled
  697. AC_ARG_ENABLE(layer2,
  698. [ --disable-layer2=[no/yes] no layer II decoding ],
  699. [
  700. if test "x$enableval" = xno; then
  701. layer2="disabled"
  702. fi
  703. ], [])
  704. if test "x$layer2" = "xdisabled"; then
  705. AC_DEFINE(NO_LAYER2, 1, [ Define to disable layer II. ])
  706. else
  707. # layer1 may have added the objects already
  708. if test "x$layer1" = "xdisabled"; then
  709. DECODER_OBJ="$DECODER_OBJ layer2.\$(OBJEXT)"
  710. DECODER_LOBJ="$DECODER_LOBJ layer2.lo"
  711. fi
  712. fi
  713. layer3=enabled
  714. AC_ARG_ENABLE(layer3,
  715. [ --disable-layer3=[no/yes] no layer III decoding ],
  716. [
  717. if test "x$enableval" = xno; then
  718. layer3="disabled"
  719. fi
  720. ], [])
  721. if test "x$layer3" = "xdisabled"; then
  722. AC_DEFINE(NO_LAYER3, 1, [ Define to disable layer III. ])
  723. else
  724. DECODER_OBJ="$DECODER_OBJ layer3.\$(OBJEXT)"
  725. DECODER_LOBJ="$DECODER_LOBJ layer3.lo"
  726. fi
  727. AC_ARG_WITH([audio], [
  728. --with-audio=<list of modules> Select a list (or only one) of audio output modules (comma or space separated list).
  729. ])
  730. AC_ARG_WITH([default-audio], [
  731. --with-default-audio=aix Use AIX as default audio output sub-system
  732. --with-default-audio=alib Use Alib as default audio output sub-system (for HPUX)
  733. --with-default-audio=alsa Use ALSA as default audio output sub-system (libasound)
  734. --with-default-audio=tinyalsa Use ALSA as default audio output sub-system (tinyalsa)
  735. --with-default-audio=arts Use aRts as default audio output sub-system (KDE sound server)
  736. --with-default-audio=dummy Use dummy as default audio (when no sound card is available)
  737. --with-default-audio=esd Use ESoundD as default audio output sub-system
  738. --with-default-audio=hp Use HP as default audio output sub-system
  739. --with-default-audio=jack Use JACK as default low-latency audio server
  740. --with-default-audio=coreaudio Use Mac OS X as default audio output sub-system (CoreAudio)
  741. --with-default-audio=mint Use MinT as default audio output sub-system (Atari)
  742. --with-default-audio=nas Use NAS as default audio output (Network Audio System)
  743. --with-default-audio=os2 Use OS2 as default audio output sub-system
  744. --with-default-audio=oss Use OSS as default audio output sub-system (/dev/dsp)
  745. --with-default-audio=portaudio Use PortAudio as default audio output sub-system
  746. --with-default-audio=pulse Use Pulse audio server as default audio output sub-system
  747. --with-default-audio=qsa Use QSA as default audio output sub-system
  748. --with-default-audio=sdl Use SDL as default audio output sub-system (Simple DirectMedia Layer)
  749. --with-default-audio=sgi Use SGI as default audio output sub-system (IRIX)
  750. --with-default-audio=sndio Use OpenBSD's sndio as default audio output sub-system
  751. --with-default-audio=sun Use Sun as default audio output sub-system (/dev/audio)
  752. --with-default-audio=win32 Use Win32 audio as default audio output sub-system
  753. --with-default-audio=win32_wasapi Use Win32 wasapi audio as default audio output sub-system
  754. ])
  755. AC_ARG_WITH([optimization], [
  756. --with-optimization=0 No Optimization
  757. --with-optimization=1 Limited Optimization (-O) (for gcc)
  758. --with-optimization=2 Default Optimization (-O2 ...) (for gcc)
  759. --with-optimization=3 More Optimize than default (-O3 ...) (for gcc)
  760. --with-optimization=4 Optimize yet more (-O4 ...) (for gcc)
  761. ])
  762. AC_ARG_WITH([seektable], [
  763. --with-seektable=<size> choose size of seek index table (0 disables it), default 1000
  764. ])
  765. dnl ############## Modules
  766. # Dummy audio output module is always supported
  767. output_modules="dummy"
  768. # Decide on module file suffix. Setting it != .la allows removal of .la files.
  769. AC_ARG_WITH([module-suffix], [
  770. --with-module-suffix=.la (default) Use libtool's .la files for loading modules.
  771. --with-module-suffix=[.so|.dll|...] Specify the native module file suffix to bypass .la files.
  772. ])
  773. if test x"$with_module_suffix" = x; then
  774. with_module_suffix=.la
  775. fi
  776. AC_DEFINE_UNQUOTED( MODULE_FILE_SUFFIX, "$with_module_suffix", [The suffix for module files.] )
  777. dnl ############## Assembler, compiler properties
  778. # based on posting from John Dalgliesh <[email protected]> on ffmpeg (LGPL) mailing list
  779. # extended to use balign if present
  780. AC_MSG_CHECKING([if .balign is present])
  781. echo '.balign 4' > conftest.s
  782. if $CCAS -c -o conftest.o conftest.s 1>/dev/null 2>&1; then
  783. AC_MSG_RESULT([yes])
  784. AC_DEFINE(ASMALIGN_BALIGN, 1, [ Define if .balign is present. ])
  785. else
  786. AC_MSG_RESULT([no])
  787. # find if .align arg is power-of-two or not
  788. asmalign_exp="unknown"
  789. if test x"$asmalign_exp" = xunknown; then
  790. AC_MSG_CHECKING([if .align takes 2-exponent])
  791. asmalign_exp="no"
  792. echo '.align 3' > conftest.s
  793. if $CCAS -c -o conftest.o conftest.s 1>/dev/null 2>&1; then
  794. asmalign_exp="yes"
  795. AC_MSG_RESULT([yes])
  796. else
  797. AC_MSG_RESULT([no])
  798. fi
  799. rm -f conftest.o conftest.s
  800. fi
  801. if test x"$asmalign_exp" = xyes; then
  802. AC_DEFINE(ASMALIGN_EXP, 1, [ Define if .align takes 3 for alignment of 2^3=8 bytes instead of 8. ])
  803. else
  804. AC_DEFINE(ASMALIGN_BYTE, 1, [ Define if .align just takes byte count. ])
  805. fi
  806. fi
  807. ccalign="unknown"
  808. if test x"$ccalign" = xunknown; then
  809. AC_MSG_CHECKING([__attribute__((aligned(16)))])
  810. ccalign="no"
  811. echo '__attribute__((aligned(16))) float var;' > conftest.c
  812. if $CC -c -o conftest.o conftest.c >/dev/null 2>&1; then
  813. ccalign="yes"
  814. AC_MSG_RESULT([yes])
  815. else
  816. AC_MSG_RESULT([no])
  817. fi
  818. rm -f conftest.o conftest.c
  819. fi
  820. dnl We apply alignment hints only to cpus that need it.
  821. dnl See further below for the definition of CCALIGN
  822. avx_support="unknown"
  823. if test x"$avx_support" = xunknown; then
  824. AC_MSG_CHECKING([if assembler supports AVX instructions])
  825. avx_support="no"
  826. echo '.text' > conftest.s
  827. echo 'vaddps %ymm0,%ymm0,%ymm0' >> conftest.s
  828. if $CCAS -c -o conftest.o conftest.s 1>/dev/null 2>&1; then
  829. avx_support="yes"
  830. AC_MSG_RESULT([yes])
  831. else
  832. AC_MSG_RESULT([no])
  833. fi
  834. rm -f conftest.o conftest.s
  835. fi
  836. if test x"$avx_support" = xno; then
  837. AC_CHECK_PROGS(YASM,[yasm],no)
  838. if test x"$YASM" != xno; then
  839. AC_MSG_CHECKING([if $YASM supports GAS syntax and AVX instructions])
  840. echo '.text' > conftest.s
  841. echo 'vaddps %ymm0,%ymm0,%ymm0' >> conftest.s
  842. if $YASM -pgas -rcpp -o conftest.o conftest.s 1>/dev/null 2>&1; then
  843. avx_support="yes"
  844. YASMFLAGS="-pgas -rgas -mamd64"
  845. AC_MSG_RESULT([yes])
  846. else
  847. AC_MSG_RESULT([no])
  848. fi
  849. rm -f conftest.o conftest.s
  850. fi
  851. else
  852. YASM="no"
  853. fi
  854. if test "x$cpu_type" = "xavx"; then
  855. if test "x$avx_support" != "xyes"; then
  856. AC_MSG_ERROR([Assembler doesn't understand AVX instructions.])
  857. fi
  858. fi
  859. AC_SUBST(YASM)
  860. AC_SUBST(YASMFLAGS)
  861. dnl ############## Really basic headers, needed for other checks.
  862. AC_HEADER_STDC
  863. dnl Is it too paranoid to specifically check for stdint.h and limits.h?
  864. AC_CHECK_HEADERS([stdio.h stdlib.h string.h unistd.h sched.h sys/ioctl.h sys/types.h stdint.h limits.h inttypes.h sys/time.h sys/wait.h sys/resource.h sys/signal.h signal.h])
  865. dnl ############## Types
  866. dnl Large file support stuff needs cleanup. There are superfluous variables.
  867. dnl Detect large file support, enable switches if needed.
  868. AC_SYS_LARGEFILE
  869. dnl If we do have a switch for large files, rename off_t-aware API calls.
  870. dnl Using the file_offset_bits variable here is fine for linux (possibly Solaris),
  871. dnl Others... we'll have to see.
  872. dnl Note: I started writing this with with multiline replacements.
  873. dnl Does not work. Automake insists on putting these into Makefiles where they break things.
  874. dnl It is also assumed that a system that does not set file offset bits is not
  875. dnl sensitive to largefile changes, i.e. FreeBSD always using 64 bit off_t.
  876. if test "x$ac_cv_sys_file_offset_bits" = x || echo "$ac_cv_sys_file_offset_bits" | $GREP '@<:@^0-9@:>@' > /dev/null; then
  877. dnl if it has non-numeric chars or is empty... ignore...
  878. LFS_LOBJ=
  879. largefile_sensitive=no
  880. else
  881. # Add dual-mode wrapper code.
  882. LFS_LOBJ=lfs_wrap.lo
  883. largefile_sensitive=yes
  884. fi
  885. # Using the lower level macros instead of AC_TYPE_* for compatibility with not freshest autoconf.
  886. AC_CHECK_TYPE(size_t, unsigned long)
  887. AC_CHECK_TYPE(uintptr_t, unsigned long)
  888. AC_CHECK_TYPE(ssize_t, long)
  889. AC_CHECK_TYPE(off_t, long int)
  890. AC_CHECK_TYPE(int32_t, int)
  891. AC_CHECK_TYPE(uint32_t, unsigned int)
  892. AC_CHECK_TYPE(int16_t, short)
  893. AC_CHECK_TYPE(uint16_t, unsigned short)
  894. AC_CHECK_SIZEOF(size_t,4)
  895. AC_CHECK_SIZEOF(ssize_t,4)
  896. AC_CHECK_SIZEOF(off_t,4)
  897. AC_CHECK_SIZEOF(int32_t)
  898. AC_CHECK_SIZEOF(long,4)
  899. dnl The native type used for aliases is what off_t maps to without any largefile-
  900. dnl enabling switches. So, it's long int if the system is largefile-senstive,
  901. dnl but it is actual plain off_t if the system does not have such switches.
  902. if test "x$largefile_sensitive" = xyes; then
  903. lfs_alias_type=long
  904. lfs_alias_size=$ac_cv_sizeof_long
  905. else
  906. lfs_alias_type=off_t
  907. lfs_alias_size=$ac_cv_sizeof_off_t
  908. fi
  909. if test "x$lfs_alias_size" = "x"; then
  910. AC_MSG_ERROR([Cannot determine sizeof(lfs_alias_t)?])
  911. else
  912. LFS_ALIAS_BITS=`expr "$lfs_alias_size" "*" "8"`
  913. AC_DEFINE_UNQUOTED([lfs_alias_t], $lfs_alias_type,
  914. [Define to the native offset type (long or actually off_t).])
  915. AC_DEFINE_UNQUOTED([LFS_ALIAS_BITS], $LFS_ALIAS_BITS,
  916. [Define this to the size of native offset type in bits, used for LFS alias functions.])
  917. fi
  918. lfs_alias=enabled
  919. AC_ARG_ENABLE(lfs-alias,
  920. [ --disable-lfs-alias disable alias wrappers for largefile bitness (mpg123_seek_32 or mpg123_seek_64 in addition to mpg123_seek, or the other way around; It is a mess, do not play with this!) ],
  921. [
  922. if test "x$enableval" = xno; then
  923. lfs_alias="disabled"
  924. fi
  925. ],
  926. [
  927. case $host in
  928. *-cygwin*)
  929. lfs_alias="disabled"
  930. AC_MSG_NOTICE([lfs-alias disabled for Cygwin, use --enable-lfs-alias explicitly to enable, only if you know what you are doing])
  931. ;;
  932. esac
  933. ])
  934. AC_MSG_CHECKING([if we want to enable alias wrappers for largefile])
  935. if test "x$lfs_alias" = "xenabled"; then
  936. AC_MSG_RESULT([yes])
  937. LFS_LOBJ="$LFS_LOBJ lfs_alias.lo"
  938. else
  939. AC_MSG_RESULT([no])
  940. fi
  941. AC_SUBST(LFS_LOBJ)
  942. dnl ############## Function Checks
  943. AC_FUNC_MMAP
  944. # Check if system supports termios
  945. AC_SYS_POSIX_TERMIOS
  946. if test "x$ac_cv_sys_posix_termios" = "xyes"; then
  947. AC_DEFINE_UNQUOTED([HAVE_TERMIOS], 1,
  948. [Define this if you have the POSIX termios library])
  949. fi
  950. AC_CHECK_FUNCS( random )
  951. # Check for sched_setscheduler
  952. AC_CHECK_FUNCS( sched_setscheduler setuid getuid)
  953. # Check for setpriority
  954. AC_CHECK_FUNCS( setpriority )
  955. AC_CHECK_FUNCS( strerror )
  956. AC_CHECK_FUNCS( setlocale nl_langinfo )
  957. AC_CHECK_FUNCS( strdup )
  958. AC_CHECK_FUNCS( atoll )
  959. AC_CHECK_FUNCS( mkfifo, [ have_mkfifo=yes ], [ have_mkfifo=no ] )
  960. dnl ############## Header and Library Checks
  961. # locale headers
  962. AC_CHECK_HEADERS([locale.h langinfo.h])
  963. # Headers for network (http) stuff
  964. network_type=Unknown
  965. AC_CHECK_HEADERS([netdb.h sys/param.h sys/socket.h netinet/in.h arpa/inet.h])
  966. if test "x$ac_cv_header_netdb_h" = "xyes" &&
  967. test "x$ac_cv_header_sys_param_h" = "xyes" &&
  968. test "x$ac_cv_header_sys_socket_h" = "xyes" &&
  969. test "x$ac_cv_header_netinet_in_h" = "xyes" &&
  970. test "x$ac_cv_header_arpa_inet_h" = "xyes"; then
  971. have_network=yes
  972. network_type=Posix
  973. else
  974. have_network=no
  975. fi
  976. dnl trying to get that socket lib settled in one line
  977. AC_SEARCH_LIBS(gethostbyname, nsl socket)
  978. dnl OK, two lines... Solaris needs -lnsl -lsocket
  979. AC_SEARCH_LIBS(socket, socket)
  980. AC_CHECK_FUNCS( getaddrinfo, [ have_ipv6=yes ], [ have_ipv6=no ] )
  981. APR_CHECK_GETADDRINFO_ADDRCONFIG()
  982. # Substitutions for the installable mpg123.h header
  983. if test "x$ac_cv_header_stdio_h" = "xyes"; then
  984. INCLUDE_STDIO_H="#include <stdio.h>"
  985. else
  986. INCLUDE_STDIO_H="/* #include <stdio.h> is not available on this system */"
  987. fi
  988. AC_SUBST(INCLUDE_STDIO_H)
  989. if test "x$ac_cv_header_stdlib_h" = "xyes"; then
  990. INCLUDE_STDLIB_H="#include <stdlib.h>"
  991. else
  992. INCLUDE_STDLIB_H="/* #include <stdlib.h> is not available on this system */"
  993. fi
  994. AC_SUBST(INCLUDE_STDLIB_H)
  995. if test "x$ac_cv_header_sys_types_h" = "xyes"; then
  996. INCLUDE_SYS_TYPE_H="#include <sys/types.h>"
  997. else
  998. INCLUDE_SYS_TYPE_H="/* #include <sys/types.h> is not available on this system */"
  999. fi
  1000. AC_SUBST(INCLUDE_SYS_TYPE_H)
  1001. # Checks for maths libraries.
  1002. AC_CHECK_LIB([m], [sqrt])
  1003. AC_CHECK_LIB([mx], [powf])
  1004. # attempt to make the signal stuff work... also with GENERIC - later
  1005. #if test x"$ac_cv_header_sys_signal_h" = xyes; then
  1006. # AC_CHECK_FUNCS( sigemptyset sigaddset sigprocmask sigaction )
  1007. # if test x"$ac_cv_func_sigemptyset" = xyes &&
  1008. # test x"$ac_cv_func_sigaddset" = xyes &&
  1009. # test x"$ac_cv_func_sigprocmask" = xyes &&
  1010. # test x"$ac_cv_func_sigaction" = xyes; then
  1011. # AC_DEFINE(
  1012. #fi
  1013. dnl ############## Choose compiler flags and CPU
  1014. # do not assume gcc here, so no flags by default
  1015. ADD_CFLAGS=""
  1016. ADD_CPPFLAGS=""
  1017. ADD_LDFLAGS=""
  1018. LIBS="$LIBS"
  1019. # Consider moving that stuff.
  1020. AC_CHECK_HEADER([os2.h], [ADD_CPPFLAGS="$ADD_CPPFLAGS -DOS2"])
  1021. # On OS/2, we need to link to os2term to make terminal control actually work.
  1022. AC_CHECK_LIB([os2term], [tcsetattr], [ADD_LDFLAGS="$ADD_LDFLAGS -los2term"])
  1023. # If debugging is enabled then make warnings errors
  1024. if test x"$debugging" = xenabled; then
  1025. ADD_CFLAGS="-g"
  1026. # gcc specific...
  1027. if test x"$GCC" = xyes; then
  1028. ADD_CFLAGS="$ADD_CFLAGS -Wall -fno-strict-aliasing"
  1029. if test x"$nagging" = xenabled; then
  1030. ADD_CFLAGS="$ADD_CFLAGS -Werror -pedantic -DPLAIN_C89"
  1031. fi
  1032. fi
  1033. fi
  1034. dnl Only try the attribute_align_arg mumbo-jumbo on x86, x86-64 warns/errors out on that attribute.
  1035. dnl ...dunno even what about other architectures.
  1036. case $host in
  1037. i?86-*)
  1038. AC_DEFINE(ABI_ALIGN_FUN, 1, [ Define if your architecture wants/needs/can use attribute_align_arg and alignment checks. It is for 32bit x86... ])
  1039. ;;
  1040. esac
  1041. s_altivec="synth_altivec dct64_altivec"
  1042. s_i386="dct64_i386"
  1043. s_i486="$s_i386 synth_i486 dct64_i486"
  1044. s_i586="$s_i386 synth_i586"
  1045. s_i586d="$s_i386 synth_i586_dither"
  1046. s_3dnow="$s_i386 synth_3dnow dct64_3dnow equalizer_3dnow"
  1047. s_3dnowext="$s_i386 dct64_3dnowext tabinit_mmx synth_3dnowext"
  1048. s_3dnow_vintage=$s_3dnow
  1049. s_3dnowext_vintage=$s_3dnowext
  1050. if test "x$layer3" = "xenabled"; then
  1051. s_3dnow_vintage="$s_3dnow_vintage dct36_3dnow"
  1052. s_3dnowext_vintage="$s_3dnowext_vintage dct36_3dnowext"
  1053. fi
  1054. s_mmx="$s_i386 dct64_mmx tabinit_mmx synth_mmx"
  1055. s_sse_vintage="$s_i386 tabinit_mmx dct64_sse dct64_sse_float synth_sse_float synth_stereo_sse_float synth_sse_s32 synth_stereo_sse_s32 "
  1056. s_sse="$s_sse_vintage dct36_sse"
  1057. s_x86_64="dct36_x86_64 dct64_x86_64 dct64_x86_64_float synth_x86_64_float synth_x86_64_s32 synth_stereo_x86_64_float synth_stereo_x86_64_s32"
  1058. s_x86_64_mono_synths="synth_x86_64_float synth_x86_64_s32"
  1059. s_x86_64_avx="dct36_avx dct64_avx dct64_avx_float synth_stereo_avx_float synth_stereo_avx_s32"
  1060. s_x86multi="getcpuflags"
  1061. s_x86_64_multi="getcpuflags_x86_64"
  1062. s_dither="dither"
  1063. s_neon="dct64_neon dct64_neon_float synth_neon_float synth_neon_s32 synth_stereo_neon_float synth_stereo_neon_s32"
  1064. # choose optimized 16bit decoder for SSE, quality or fast
  1065. # note: supporting deactivation of output formats for these decoders would need more logic here
  1066. if test "x$integers" = "xquality"; then
  1067. s_sse="$s_sse synth_sse_accurate synth_stereo_sse_accurate"
  1068. s_sse_vintage="$s_sse_vintage synth_sse_accurate synth_stereo_sse_accurate"
  1069. s_x86_64="$s_x86_64 synth_x86_64_accurate synth_stereo_x86_64_accurate"
  1070. s_x86_64_mono_synths="$s_x86_64_mono_synths synth_x86_64_accurate"
  1071. s_x86_64_avx="$s_x86_64_avx synth_stereo_avx_accurate"
  1072. s_arm="synth_arm_accurate"
  1073. s_neon="$s_neon synth_neon_accurate synth_stereo_neon_accurate"
  1074. else
  1075. s_sse="$s_sse synth_sse" # no stereo
  1076. s_sse_vintage="$s_sse_vintage synth_sse" # no stereo
  1077. s_x86_64="$s_x86_64 synth_x86_64 synth_stereo_x86_64"
  1078. s_x86_64_mono_synths="$s_x86_64_mono_synths synth_x86_64"
  1079. s_x86_64_avx="$s_x86_64_avx synth_stereo_avx"
  1080. s_arm="synth_arm"
  1081. s_neon="$s_neon synth_neon synth_stereo_neon"
  1082. fi
  1083. dnl CPU specific compiler flags and sources
  1084. case $cpu_type in
  1085. generic)
  1086. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_GENERIC -DREAL_IS_FLOAT"
  1087. more_sources="$s_fpu"
  1088. ccalign=no
  1089. ;;
  1090. generic_dither)
  1091. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_GENERIC_DITHER -DREAL_IS_FLOAT"
  1092. more_sources="$s_fpu $s_dither"
  1093. ccalign=no
  1094. ;;
  1095. dnl Not disabling buffer for float mode... check that this is OK now!
  1096. generic_fpu | generic_float)
  1097. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_GENERIC -DREAL_IS_FLOAT"
  1098. more_sources="$s_fpu"
  1099. ccalign=no
  1100. ;;
  1101. generic_nofpu)
  1102. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_GENERIC -DREAL_IS_FIXED"
  1103. more_sources=
  1104. ccalign=no
  1105. ;;
  1106. ppc_nofpu)
  1107. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_PPC -DREAL_IS_FIXED"
  1108. more_sources=
  1109. ccalign=no
  1110. ;;
  1111. arm_nofpu)
  1112. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_ARM -DREAL_IS_FIXED"
  1113. more_sources="$s_arm"
  1114. ccalign=no
  1115. ;;
  1116. altivec)
  1117. ADD_CFLAGS="$ADD_CFLAGS -maltivec"
  1118. ADD_CPPFLAGS="$ADD_CPPFLAGS -DREAL_IS_FLOAT -DOPT_ALTIVEC"
  1119. more_sources="$s_altivec $s_fpu"
  1120. AC_MSG_CHECKING([if $CC accepts -faltivec])
  1121. touch conftest.c
  1122. if $CC -faltivec -c -o conftest.o conftest.c >/dev/null 2>&1; then
  1123. ADD_CFLAGS="$ADD_CFLAGS -faltivec"
  1124. AC_MSG_RESULT([yes])
  1125. else
  1126. AC_MSG_RESULT([no])
  1127. fi
  1128. rm -f conftest.o conftest.c
  1129. ;;
  1130. neon)
  1131. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_NEON -DREAL_IS_FLOAT"
  1132. more_sources="$s_neon $s_fpu"
  1133. ;;
  1134. i386)
  1135. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_I386 -DREAL_IS_FLOAT"
  1136. more_sources="$s_fpu $s_i386"
  1137. ccalign=no
  1138. ;;
  1139. i386_fpu)
  1140. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_I386 -DREAL_IS_FLOAT"
  1141. more_sources="$s_fpu $s_i386"
  1142. ccalign=no
  1143. ;;
  1144. i386_nofpu)
  1145. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_I386 -DREAL_IS_FIXED"
  1146. more_sources="$s_i386"
  1147. ccalign=no
  1148. ;;
  1149. i486)
  1150. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_I486 -DREAL_IS_FLOAT"
  1151. more_sources="$s_fpu $s_i486"
  1152. ccalign=no
  1153. ;;
  1154. i586)
  1155. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_I586 -DREAL_IS_FLOAT"
  1156. more_sources="$s_fpu $s_i586"
  1157. ;;
  1158. i586_dither)
  1159. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_I586_DITHER -DREAL_IS_FLOAT"
  1160. more_sources="$s_fpu $s_i586d $s_dither"
  1161. ;;
  1162. 3dnow)
  1163. # legacy 3dnow had the 3dnow paired with i586...
  1164. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_MULTI -DOPT_I586 -DOPT_3DNOW -DREAL_IS_FLOAT"
  1165. more_sources="$s_fpu $s_i586 $s_3dnow $s_x86multi "
  1166. ;;
  1167. 3dnow_vintage)
  1168. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_MULTI -DOPT_I586 -DOPT_3DNOW_VINTAGE -DREAL_IS_FLOAT"
  1169. more_sources="$s_fpu $s_i586 $s_3dnow_vintage $s_x86multi "
  1170. ;;
  1171. 3dnow_alone)
  1172. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_3DNOW -DREAL_IS_FLOAT"
  1173. more_sources="$s_fpu $s_3dnow"
  1174. ;;
  1175. 3dnowext_alone)
  1176. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_3DNOWEXT -DREAL_IS_FLOAT"
  1177. more_sources="$s_fpu $s_3dnowext"
  1178. ;;
  1179. 3dnowext_vintage)
  1180. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_MULTI -DOPT_3DNOW -DOPT_3DNOWEXT_VINTAGE -DREAL_IS_FLOAT"
  1181. more_sources="$s_fpu $s_3dnowext_vintage $s_3dnow $s_x86multi"
  1182. ;;
  1183. 3dnowext)
  1184. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_MULTI -DOPT_3DNOW -DOPT_3DNOWEXT -DREAL_IS_FLOAT"
  1185. more_sources="$s_fpu $s_3dnowext $s_3dnow $s_x86multi"
  1186. ;;
  1187. mmx_alone|mmx)
  1188. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_MMX -DREAL_IS_FLOAT"
  1189. more_sources="$s_fpu $s_mmx"
  1190. ;;
  1191. sse_alone|sse)
  1192. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_SSE -DREAL_IS_FLOAT"
  1193. more_sources="$s_fpu $s_sse"
  1194. ;;
  1195. sse_vintage)
  1196. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_SSE_VINTAGE -DREAL_IS_FLOAT"
  1197. more_sources="$s_fpu $s_sse_vintage"
  1198. ;;
  1199. avx)
  1200. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_AVX -DREAL_IS_FLOAT"
  1201. more_sources="$s_fpu $s_x86_64_avx $s_x86_64_mono_synths"
  1202. if test "x$YASM" != "xno"; then
  1203. use_yasm_for_avx="yes"
  1204. fi
  1205. ;;
  1206. x86|x86_dither)
  1207. # plain C dct36 always there, for vintage/non-vintage
  1208. # Selection of non-/vintage sources implies that
  1209. # $s_3dnow_vintage contains $s_3dnow,
  1210. # $s_sse contains $s_sse_vintage.
  1211. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_MULTI -DOPT_GENERIC -DOPT_GENERIC_DITHER -DOPT_I386 -DOPT_I586 -DOPT_I586_DITHER -DOPT_MMX -DOPT_3DNOW -DOPT_3DNOW_VINTAGE -DOPT_3DNOWEXT -DOPT_3DNOWEXT_VINTAGE -DOPT_SSE -DOPT_SSE_VINTAGE -DREAL_IS_FLOAT"
  1212. more_sources="$s_fpu $s_i386 $s_i586 $s_i586d $s_mmx $s_3dnow_vintage $s_3dnowext_vintage $s_sse $s_x86multi $s_dither"
  1213. ;;
  1214. x86-64_alone)
  1215. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_X86_64 -DREAL_IS_FLOAT"
  1216. more_sources="$s_fpu $s_x86_64"
  1217. ;;
  1218. x86-64|x86-64_all|x86-64_dither)
  1219. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_MULTI -DOPT_X86_64 -DOPT_GENERIC -DOPT_GENERIC_DITHER -DREAL_IS_FLOAT"
  1220. more_sources="$s_fpu $s_x86_64 $s_dither $s_x86_64_multi"
  1221. if test "x$avx_support" = "xyes"; then
  1222. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_AVX"
  1223. more_sources="$more_sources $s_x86_64_avx"
  1224. if test "x$YASM" != "xno"; then
  1225. use_yasm_for_avx="yes"
  1226. fi
  1227. fi
  1228. ;;
  1229. *)
  1230. AC_MSG_ERROR([Unknown CPU type '$cpu_type'])
  1231. ;;
  1232. esac
  1233. # Mac OS X specific linker flags
  1234. case $cpu_type in
  1235. 3dnow|3dnow_vintage|3dnow_alone|3dnowext|3dnowext_vintage|3dnowext_alone|mmx|mmx_alone|sse|sse_vintage|sse_alone|x86|x86_dither)
  1236. case $host in
  1237. i386-apple-darwin8*|*-apple-darwin10*)
  1238. ADD_LDFLAGS="$ADD_LDFLAGS -Wl,-read_only_relocs,suppress"
  1239. ;;
  1240. i386-apple-darwin9*)
  1241. ADD_CFLAGS="$ADD_CFLAGS -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk"
  1242. ADD_LDFLAGS="$ADD_LDFLAGS -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -Wl,-classic_linker -Wl,-read_only_relocs,suppress"
  1243. ;;
  1244. esac
  1245. ;;
  1246. esac
  1247. # Use yasm instead of the default assembler for AVX sources
  1248. if test "x$use_yasm_for_avx" = "xyes"; then
  1249. case $host_os in
  1250. *cygwin*|*mingw*)
  1251. YASM_FORMAT="-f win64"
  1252. ;;
  1253. *darwin*)
  1254. YASM_FORMAT="-f macho"
  1255. ;;
  1256. *)
  1257. YASM_FORMAT="-f elf"
  1258. ;;
  1259. esac
  1260. AC_DEFINE(USE_YASM_FOR_AVX, 1, [Define to use yasm for assemble AVX sources.])
  1261. fi
  1262. AM_CONDITIONAL( [USE_YASM_FOR_AVX], [test "x$use_yasm_for_avx" = xyes] )
  1263. AC_SUBST(YASM_FORMAT)
  1264. # Check if we want feature report function.
  1265. AC_MSG_CHECKING([if we want feature report function])
  1266. feature_report=enabled
  1267. AC_ARG_ENABLE(feature_report,
  1268. [ --disable-feature_report Disable feature report function ],
  1269. [
  1270. if test "x$enableval" = xno; then
  1271. AC_MSG_RESULT([no])
  1272. feature_report=disabled
  1273. else
  1274. AC_MSG_RESULT([yes])
  1275. fi
  1276. ],
  1277. [AC_MSG_RESULT([yes])])
  1278. if test "x$feature_report" = xenabled; then
  1279. more_sources="$more_sources feature"
  1280. fi
  1281. # Return 0 if first arg appears in list of following arguments.
  1282. # Return 1 otherwise.
  1283. word_in_list() {
  1284. word=$1
  1285. shift
  1286. # Avoid naming conflict with the outside!
  1287. # Is local not POSIX sh?
  1288. for given_word in "$@"
  1289. do
  1290. if test "x$word" = "x$given_word"; then
  1291. return 0
  1292. fi
  1293. done
  1294. return 1
  1295. }
  1296. for i in $more_sources
  1297. do
  1298. # Make sure every file is only once in the list.
  1299. word_in_list "$i.\$(OBJEXT)" $DECODER_OBJ || DECODER_OBJ="$DECODER_OBJ $i.\$(OBJEXT)"
  1300. word_in_list "$i.lo" $DECODER_LOBJ || DECODER_LOBJ="$DECODER_LOBJ $i.lo"
  1301. done
  1302. AC_SUBST(DECODER_OBJ)
  1303. AC_SUBST(DECODER_LOBJ)
  1304. dnl Finally insert the code switch for alignment, above cpu selection having possibly changed the setting.
  1305. if test x"$ccalign" = xyes; then
  1306. AC_DEFINE(CCALIGN, 1, [ Define if __attribute__((aligned(16))) shall be used ])
  1307. fi
  1308. dnl ############## Output module choice
  1309. # The full list of supported modules to check, first come, first serve.
  1310. check_modules="alsa tinyalsa oss coreaudio sndio sun win32 win32_wasapi os2 esd jack portaudio pulse sdl nas arts openal dummy"
  1311. # Only check qsa before all else on QNX.
  1312. # It would mask ALSA otherwise.
  1313. case $host in
  1314. *-nto-qnx*)
  1315. check_modules="qsa $check_modules"
  1316. ;;
  1317. esac
  1318. # The final list.
  1319. output_modules=
  1320. check_forced=no
  1321. check_failed=no
  1322. if test "x$with_audio" != "x"; then
  1323. check_modules="`echo $with_audio|tr , ' '` dummy"
  1324. echo "Limiting outputs to build according to your preference: $check_modules"
  1325. check_forced=yes
  1326. fi
  1327. PKG_PROG_PKG_CONFIG([])
  1328. # Now go through the modules to check and do the chores.
  1329. for m in $check_modules
  1330. do
  1331. case "$m" in
  1332. dummy)
  1333. AC_MSG_CHECKING([if you are too dumbing dumb for the dummy])
  1334. AC_MSG_RESULT([no])
  1335. output_modules="$output_modules dummy"
  1336. HAVE_DUMMY=yes
  1337. ;;
  1338. oss)
  1339. AC_CHECK_HEADERS([sys/soundcard.h linux/soundcard.h machine/soundcard.h])
  1340. if test "x${ac_cv_header_sys_soundcard_h}" = "xyes" \
  1341. -o "x${ac_cv_header_linux_soundcard_h}" = "xyes" \
  1342. -o "x${ac_cv_header_machine_soundcard_h}" = "xyes";
  1343. then
  1344. output_modules="$output_modules oss"
  1345. HAVE_OSS="yes"
  1346. else
  1347. check_failed=yes
  1348. fi
  1349. ;;
  1350. tinyalsa)
  1351. TINYALSA_LIBS="-ltinyalsa"
  1352. # Check for ALSA
  1353. AC_CHECK_LIB( [tinyalsa], [pcm_open],
  1354. [ AC_CHECK_HEADER( [tinyalsa/asoundlib.h],
  1355. [ output_modules="$output_modules tinyalsa" HAVE_TINYALSA="yes"],
  1356. [ AC_MSG_WARN([Found TINYALSA library but NOT header files on your system]) ] )
  1357. ]
  1358. )
  1359. if test "x$HAVE_TINYALSA" != xyes; then
  1360. check_failed=yes
  1361. fi
  1362. ;;
  1363. # QSA and ALSA are not distinguishable in these tests, need to block
  1364. # each other and play with test order depending on platform.
  1365. alsa)
  1366. if test "x$HAVE_QSA" = xyes; then
  1367. HAVE_ALSA=no
  1368. else
  1369. ALSA_LIBS="-lasound"
  1370. # Check for ALSA
  1371. AC_CHECK_LIB( [asound], [snd_pcm_open],
  1372. [ AC_CHECK_HEADER( [alsa/asoundlib.h],
  1373. [ output_modules="$output_modules alsa" HAVE_ALSA="yes"],
  1374. [ AC_MSG_WARN([Found ALSA library but NOT header files on your system]) ] )
  1375. ]
  1376. )
  1377. if test "x$HAVE_ALSA" != xyes; then
  1378. check_failed=yes
  1379. fi
  1380. fi # HAVE_QSA
  1381. ;;
  1382. qsa)
  1383. if test "x$HAVE_ALSA" = xyes; then
  1384. HAVE_QSA=no
  1385. else
  1386. QSA_LIBS="-lasound"
  1387. # Check for QSA
  1388. AC_CHECK_LIB( [asound], [snd_pcm_open],
  1389. [ AC_CHECK_HEADER( [sys/asoundlib.h],
  1390. [ output_modules="$output_modules qsa" HAVE_QSA="yes"],
  1391. [ AC_MSG_WARN([Found QSA library but NOT header files on your system]) ] )
  1392. ]
  1393. )
  1394. if test "x$HAVE_QSA" != xyes; then
  1395. check_failed=yes
  1396. fi
  1397. fi # HAVE_ALSA
  1398. ;;
  1399. jack)
  1400. PKG_CHECK_MODULES(JACK, jack, output_modules="$output_modules jack" HAVE_JACK="yes", HAVE_JACK="no" check_failed=yes)
  1401. ;;
  1402. pulse)
  1403. PKG_CHECK_MODULES(PULSE, libpulse-simple, output_modules="$output_modules pulse" HAVE_PULSE="yes", HAVE_PULSE="no" check_failed=yes)
  1404. ;;
  1405. esd)
  1406. PKG_CHECK_MODULES(ESD, esound, output_modules="$output_modules esd" HAVE_ESD="yes", HAVE_ESD="no" check_failed=yes)
  1407. ;;
  1408. portaudio)
  1409. # Remember: This looks only insane because you chose an insane tab width!
  1410. PORTAUDIO_LIBS="-lportaudio"
  1411. PORTAUDIO_CFLAGS=
  1412. case $host in
  1413. *-*-mingw32)
  1414. # We tested portaudio with MME
  1415. if test "x$HAVE_PORTAUDIO" != "xyes"; then
  1416. AC_CHECK_LIB( [portaudio], [Pa_Initialize],
  1417. [ AC_CHECK_HEADER( [portaudio.h],
  1418. [ output_modules="$output_modules portaudio" HAVE_PORTAUDIO_WINMM="yes" HAVE_PORTAUDIO="yes" ],
  1419. [ AC_MSG_WARN([Found PortAudio library but NOT header files on your system]) ] )
  1420. PORTAUDIO_LIBS="$PORTAUDIO_LIBS -lwinmm"
  1421. ],
  1422. [ HAVE_PORTAUDIO="no"],
  1423. [ -lwinmm ]
  1424. )
  1425. fi
  1426. ;;
  1427. *)
  1428. AC_CHECK_LIB( [portaudio], [Pa_Initialize],
  1429. [ AC_CHECK_HEADER( [portaudio.h],
  1430. [ output_modules="$output_modules portaudio" HAVE_PORTAUDIO="yes" ],
  1431. [ AC_MSG_WARN([Found PortAudio library but NOT header files on your system]) ] )
  1432. ]
  1433. )
  1434. ;;
  1435. esac
  1436. if test "x$HAVE_PORTAUDIO" != xyes; then
  1437. check_failed=yes
  1438. else
  1439. # See if we have v19 or v18
  1440. AC_CHECK_LIB( [portaudio], [Pa_GetVersion], [:], [AC_DEFINE( [PORTAUDIO18], 1, [Define if portaudio v18 API is wanted.]) ], [$PORTAUDIO_LIBS] )
  1441. fi
  1442. ;;
  1443. sdl)
  1444. PKG_CHECK_MODULES(SDL, sdl, output_modules="$output_modules sdl" HAVE_SDL="yes", HAVE_SDL="no" check_failed=yes)
  1445. ;;
  1446. nas)
  1447. NAS_LIBS=-laudio
  1448. AC_CHECK_LIB( [audio], [AuOpenServer],
  1449. [ AC_CHECK_HEADER( [audio/audiolib.h],
  1450. [ output_modules="$output_modules nas" HAVE_NAS="yes"],
  1451. [ AC_MSG_WARN([Found NAS library but NOT header files on your system]) ] )
  1452. ]
  1453. )
  1454. if test "x$HAVE_NAS" != xyes; then
  1455. check_failed=yes
  1456. fi
  1457. ;;
  1458. win32)
  1459. # Check for windows ... and win32 audio
  1460. # Does not work... instead just check for header
  1461. # AC_CHECK_LIB( [winmm], [waveOutOpen] )
  1462. WIN32_LIBS=-lwinmm
  1463. AC_CHECK_HEADERS([windows.h], output_modules="$output_modules win32" HAVE_WIN32=yes, HAVE_WIN32=no check_failed=yes)
  1464. ;;
  1465. win32_wasapi)
  1466. # Check for windows ... and win32 wasapi audio
  1467. # Does not work... instead just check for header
  1468. # AC_CHECK_LIB( [avrt], [] )
  1469. AC_MSG_CHECKING([if we have wasapi headers])
  1470. OLD_LIBS=$LIBS
  1471. LIBS="$LIBS -lole32 -lavrt"
  1472. AC_LINK_IFELSE([AC_LANG_SOURCE([
  1473. #define COBJMACROS 1
  1474. #define _WIN32_WINNT 0x601
  1475. #include <initguid.h>
  1476. #include <audioclient.h>
  1477. #include <mmdeviceapi.h>
  1478. #include <avrt.h>
  1479. int main(){
  1480. /* UUID Checks */
  1481. GUID *IDs[] = {
  1482. &CLSID_MMDeviceEnumerator,
  1483. &IID_IMMDeviceEnumerator,
  1484. &IID_IAudioClient,
  1485. &IID_IAudioRenderClient
  1486. };
  1487. return 0;
  1488. }
  1489. ])], [HAVE_WIN32_WASAPI=yes], [HAVE_WIN32_WASAPI=no])
  1490. LIBS=$OLD_LIBS
  1491. WIN32_WASAPI_LIBS="-lole32 -lavrt"
  1492. AC_MSG_RESULT([$HAVE_WIN32_WASAPI])
  1493. if test "x$HAVE_WIN32_WASAPI" = xyes; then
  1494. output_modules="$output_modules win32_wasapi"
  1495. else
  1496. check_failed=yes
  1497. fi
  1498. ;;
  1499. sndio)
  1500. SNDIO_LIBS=-lsndio
  1501. AC_CHECK_LIB([sndio], [sio_open],
  1502. [AC_CHECK_HEADERS([sndio.h],
  1503. [output_modules="$output_modules sndio" HAVE_SNDIO="yes"])
  1504. ]
  1505. )
  1506. if test "x$HAVE_SNDIO" != xyes; then
  1507. check_failed=yes
  1508. fi
  1509. ;;
  1510. sun)
  1511. AC_CHECK_HEADERS([sun/audioio.h sys/audioio.h asm/audioio.h sys/audio.h])
  1512. if test "x${ac_cv_header_sun_audioio_h}" = "xyes" \
  1513. -o "x${ac_cv_header_sys_audioio_h}" = "xyes" \
  1514. -o "x${ac_cv_header_asm_audioio_h}" = "xyes";
  1515. then
  1516. output_modules="$output_modules sun"
  1517. HAVE_SUN="yes"
  1518. else
  1519. check_failed=yes
  1520. fi
  1521. ;;
  1522. coreaudio)
  1523. COREAUDIO_LIBS="-framework AudioToolbox -framework AudioUnit -framework CoreServices"
  1524. AC_CHECK_HEADERS([AudioUnit/AudioUnit.h CoreServices/CoreServices.h AudioToolbox/AudioToolbox.h])
  1525. if test "x${ac_cv_header_AudioUnit_AudioUnit_h}" = "xyes" \
  1526. -a "x${ac_cv_header_CoreServices_CoreServices_h}" = "xyes" \
  1527. -a "x${ac_cv_header_AudioToolbox_AudioToolbox_h}" = "xyes";
  1528. then
  1529. if test x"$modules" = xdisabled; then
  1530. AC_MSG_WARN([Disabling buffer because of directly linked CoreAudio! Use the module if you need the buffer.])
  1531. buffer=disabled
  1532. fi
  1533. output_modules="$output_modules coreaudio"
  1534. HAVE_COREAUDIO="yes"
  1535. else
  1536. check_failed=yes
  1537. fi
  1538. ;;
  1539. arts)
  1540. AC_MSG_CHECKING([for artsc])
  1541. if artsc-config; then
  1542. AC_MSG_RESULT([yes])
  1543. output_modules="$output_modules arts"
  1544. HAVE_ARTS=yes
  1545. ARTS_LIBS=`artsc-config --libs`
  1546. ARTS_CFLAGS=`artsc-config --cflags`
  1547. else
  1548. AC_MSG_RESULT([no])
  1549. check_failed=yes
  1550. fi
  1551. ;;
  1552. openal)
  1553. AC_CHECK_HEADERS([OpenAL/al.h OpenAL/alc.h AL/al.h AL/alc.h al.h alc.h])
  1554. if test "x${ac_cv_header_OpenAL_al_h}" = "xyes" \
  1555. -a "x${ac_cv_header_OpenAL_alc_h}" = "xyes";
  1556. then #Mac OS X
  1557. output_modules="$output_modules openal"
  1558. OPENAL_LIBS="-framework OpenAL"
  1559. OPENAL_CFLAGS="-DOPENAL_SUBDIR_OPENAL"
  1560. HAVE_OPENAL="yes"
  1561. elif test "x${ac_cv_header_AL_al_h}" = "xyes" \
  1562. -a "x${ac_cv_header_AL_alc_h}" = "xyes";
  1563. then #Linux
  1564. output_modules="$output_modules openal"
  1565. OPENAL_LIBS="-lopenal"
  1566. OPENAL_CFLAGS="-DOPENAL_SUBDIR_AL"
  1567. HAVE_OPENAL="yes"
  1568. elif test "x${ac_cv_header_al_h}" = "xyes" \
  1569. -a "x${ac_cv_header_alc_h}" = "xyes";
  1570. then #Windows?
  1571. output_modules="$output_modules openal"
  1572. OPENAL_LIBS="-lopenal"
  1573. OPENAL_CFLAGS=""
  1574. HAVE_OPENAL="yes"
  1575. else
  1576. check_failed=yes
  1577. fi
  1578. ;;
  1579. os2)
  1580. OS2_LIBS="-los2me -lmmpm2 -lsocket"
  1581. AC_CHECK_HEADERS([os2.h])
  1582. # os2me.h depends on os2.h
  1583. # Yes, that way of coding it is ugly.
  1584. if test "x${ac_cv_header_os2_h}" = xyes
  1585. then
  1586. # We mimick exactly the way how the header will be used.
  1587. # It seems to be picky...
  1588. AC_CHECK_HEADERS([os2me.h], [], [], [#define INCL_OS2MM
  1589. #define INCL_DOS
  1590. #define INCL_VIO
  1591. #define INCL_KBD
  1592. #include <os2.h>
  1593. #])
  1594. fi
  1595. if test "x${ac_cv_header_os2_h}" = xyes \
  1596. -a "x${ac_cv_header_os2me_h}" = xyes
  1597. then
  1598. output_modules="$output_modules os2"
  1599. HAVE_OS2=yes
  1600. else
  1601. check_failed=yes
  1602. fi
  1603. ;;
  1604. # from here on only forced tests, untested code
  1605. hp)
  1606. # What's the deal with that and alib?
  1607. UNSUPPORTED_AUDIO=yes
  1608. AC_CHECK_HEADER([sys/audio.h], [output_modules="$output_modules hp" HAVE_HP=yes], [check_failed=yes])
  1609. ;;
  1610. alib)
  1611. UNSUPPORTED_AUDIO=yes
  1612. # ALIB_CFLAGS="-I/opt/audio/include"
  1613. ALIB_LIBS=-lAlib
  1614. # These headers may not be all about audio but they are used.
  1615. AC_CHECK_HEADERS([ Alib.h CUlib.h netdb.h netinet/in.h netinet/tcp.h])
  1616. if test "x${ac_cv_header_Alib_h}" = xyes \
  1617. -a "x${ac_cv_header_CUlib_h}" = xyes \
  1618. -a "x${ac_cv_header_netdb_h}" = xyes \
  1619. -a "x${ac_cv_header_netinet_in_h}" = xyes \
  1620. -a "x${ac_cv_header_netinet_tcp_h}" = xyes
  1621. then
  1622. output_modules="$output_modules alib"
  1623. HAVE_ALIB=yes
  1624. else
  1625. check_failed=yes
  1626. fi
  1627. ;;
  1628. mint)
  1629. UNSUPPORTED_AUDIO=yes
  1630. AC_CHECK_HEADERS([audios.h], [output_modules="$output_modules mint" HAVE_MINT=yes], [check_failes=yes])
  1631. ;;
  1632. aix)
  1633. UNSUPPORTED_AUDIO=yes
  1634. AC_CHECK_HEADERS([sys/audio.h], [output_modules="$output_modules aix" HAVE_AIX=yes], [check_failed=yes])
  1635. ;;
  1636. sgi)
  1637. UNSUPPORTED_AUDIO=yes
  1638. SGI_LIBS=-laudio
  1639. AC_CHECK_HEADER([dmedia/audio.h], [output_modules="$output_modules sgi" HAVE_SGI=yes], [check_failed=yes])
  1640. ;;
  1641. *)
  1642. AC_MSG_ERROR([Unsupported/-known output '$m' demanded!])
  1643. ;;
  1644. esac
  1645. done
  1646. if test "x$check_forced" = xyes -a "x$UNSUPPORTED_AUDIO" = xyes; then
  1647. AC_MSG_WARN([You requested bulding of an unsupported audio module. Be prepared for happy hacking and please tell us about your experience!])
  1648. fi
  1649. if test "x$check_forced" = xyes -a "x$check_failed" = "xyes"; then
  1650. AC_MSG_ERROR([One/some of your requested audio modules failed the test!])
  1651. fi
  1652. # When you extend check_modules, you should extend this:
  1653. #for i in alsa qsa oss coreaudio sndio sun win32 win32_wasapi esd jack portaudio pulse sdl nas aix alib arts hp os2 sgi mint openal dummy
  1654. #do echo $i; done |
  1655. #perl -ne 'chomp; $big = uc($_); print <<EOT;
  1656. #AC_SUBST(${big}_LIBS)
  1657. #AC_SUBST(${big}_LDFLAGS)
  1658. #AC_SUBST(${big}_CFLAGS)
  1659. #AM_CONDITIONAL( [HAVE_$big], [test "x\$HAVE_$big" = xyes] )
  1660. #EOT
  1661. #'
  1662. AC_SUBST(TINYALSA_LIBS)
  1663. AC_SUBST(TINYALSA_LDFLAGS)
  1664. AC_SUBST(TINYALSA_CFLAGS)
  1665. AM_CONDITIONAL( [HAVE_TINYALSA], [test "x$HAVE_TINYALSA" = xyes] )
  1666. AC_SUBST(ALSA_LIBS)
  1667. AC_SUBST(ALSA_LDFLAGS)
  1668. AC_SUBST(ALSA_CFLAGS)
  1669. AM_CONDITIONAL( [HAVE_ALSA], [test "x$HAVE_ALSA" = xyes] )
  1670. AC_SUBST(QSA_LIBS)
  1671. AC_SUBST(QSA_LDFLAGS)
  1672. AC_SUBST(QSA_CFLAGS)
  1673. AM_CONDITIONAL( [HAVE_QSA], [test "x$HAVE_QSA" = xyes] )
  1674. AC_SUBST(OSS_LIBS)
  1675. AC_SUBST(OSS_LDFLAGS)
  1676. AC_SUBST(OSS_CFLAGS)
  1677. AM_CONDITIONAL( [HAVE_OSS], [test "x$HAVE_OSS" = xyes] )
  1678. AC_SUBST(COREAUDIO_LIBS)
  1679. AC_SUBST(COREAUDIO_LDFLAGS)
  1680. AC_SUBST(COREAUDIO_CFLAGS)
  1681. AM_CONDITIONAL( [HAVE_COREAUDIO], [test "x$HAVE_COREAUDIO" = xyes] )
  1682. AC_SUBST(SNDIO_LIBS)
  1683. AC_SUBST(SNDIO_LDFLAGS)
  1684. AC_SUBST(SNDIO_CFLAGS)
  1685. AM_CONDITIONAL( [HAVE_SNDIO], [test "x$HAVE_SNDIO" = xyes] )
  1686. AC_SUBST(SUN_LIBS)
  1687. AC_SUBST(SUN_LDFLAGS)
  1688. AC_SUBST(SUN_CFLAGS)
  1689. AM_CONDITIONAL( [HAVE_SUN], [test "x$HAVE_SUN" = xyes] )
  1690. AC_SUBST(WIN32_LIBS)
  1691. AC_SUBST(WIN32_LDFLAGS)
  1692. AC_SUBST(WIN32_CFLAGS)
  1693. AM_CONDITIONAL( [HAVE_WIN32], [test "x$HAVE_WIN32" = xyes] )
  1694. AC_SUBST(WIN32_WASAPI_LIBS)
  1695. AC_SUBST(WIN32_WASAPI_LDFLAGS)
  1696. AC_SUBST(WIN32_WASAPI_CFLAGS)
  1697. AM_CONDITIONAL( [HAVE_WIN32_WASAPI], [test "x$HAVE_WIN32_WASAPI" = xyes] )
  1698. AC_SUBST(ESD_LIBS)
  1699. AC_SUBST(ESD_LDFLAGS)
  1700. AC_SUBST(ESD_CFLAGS)
  1701. AM_CONDITIONAL( [HAVE_ESD], [test "x$HAVE_ESD" = xyes] )
  1702. AC_SUBST(JACK_LIBS)
  1703. AC_SUBST(JACK_LDFLAGS)
  1704. AC_SUBST(JACK_CFLAGS)
  1705. AM_CONDITIONAL( [HAVE_JACK], [test "x$HAVE_JACK" = xyes] )
  1706. AC_SUBST(PORTAUDIO_LIBS)
  1707. AC_SUBST(PORTAUDIO_LDFLAGS)
  1708. AC_SUBST(PORTAUDIO_CFLAGS)
  1709. AM_CONDITIONAL( [HAVE_PORTAUDIO], [test "x$HAVE_PORTAUDIO" = xyes] )
  1710. AC_SUBST(PULSE_LIBS)
  1711. AC_SUBST(PULSE_LDFLAGS)
  1712. AC_SUBST(PULSE_CFLAGS)
  1713. AM_CONDITIONAL( [HAVE_PULSE], [test "x$HAVE_PULSE" = xyes] )
  1714. AC_SUBST(SDL_LIBS)
  1715. AC_SUBST(SDL_LDFLAGS)
  1716. AC_SUBST(SDL_CFLAGS)
  1717. AM_CONDITIONAL( [HAVE_SDL], [test "x$HAVE_SDL" = xyes] )
  1718. AC_SUBST(NAS_LIBS)
  1719. AC_SUBST(NAS_LDFLAGS)
  1720. AC_SUBST(NAS_CFLAGS)
  1721. AM_CONDITIONAL( [HAVE_NAS], [test "x$HAVE_NAS" = xyes] )
  1722. AC_SUBST(AIX_LIBS)
  1723. AC_SUBST(AIX_LDFLAGS)
  1724. AC_SUBST(AIX_CFLAGS)
  1725. AM_CONDITIONAL( [HAVE_AIX], [test "x$HAVE_AIX" = xyes] )
  1726. AC_SUBST(ALIB_LIBS)
  1727. AC_SUBST(ALIB_LDFLAGS)
  1728. AC_SUBST(ALIB_CFLAGS)
  1729. AM_CONDITIONAL( [HAVE_ALIB], [test "x$HAVE_ALIB" = xyes] )
  1730. AC_SUBST(ARTS_LIBS)
  1731. AC_SUBST(ARTS_LDFLAGS)
  1732. AC_SUBST(ARTS_CFLAGS)
  1733. AM_CONDITIONAL( [HAVE_ARTS], [test "x$HAVE_ARTS" = xyes] )
  1734. AC_SUBST(HP_LIBS)
  1735. AC_SUBST(HP_LDFLAGS)
  1736. AC_SUBST(HP_CFLAGS)
  1737. AM_CONDITIONAL( [HAVE_HP], [test "x$HAVE_HP" = xyes] )
  1738. AC_SUBST(OS2_LIBS)
  1739. AC_SUBST(OS2_LDFLAGS)
  1740. AC_SUBST(OS2_CFLAGS)
  1741. AM_CONDITIONAL( [HAVE_OS2], [test "x$HAVE_OS2" = xyes] )
  1742. AC_SUBST(SGI_LIBS)
  1743. AC_SUBST(SGI_LDFLAGS)
  1744. AC_SUBST(SGI_CFLAGS)
  1745. AM_CONDITIONAL( [HAVE_SGI], [test "x$HAVE_SGI" = xyes] )
  1746. AC_SUBST(MINT_LIBS)
  1747. AC_SUBST(MINT_LDFLAGS)
  1748. AC_SUBST(MINT_CFLAGS)
  1749. AM_CONDITIONAL( [HAVE_MINT], [test "x$HAVE_MINT" = xyes] )
  1750. AC_SUBST(OPENAL_LIBS)
  1751. AC_SUBST(OPENAL_LDFLAGS)
  1752. AC_SUBST(OPENAL_CFLAGS)
  1753. AM_CONDITIONAL( [HAVE_OPENAL], [test "x$HAVE_OPENAL" = xyes] )
  1754. AC_SUBST(DUMMY_LIBS)
  1755. AC_SUBST(DUMMY_LDFLAGS)
  1756. AC_SUBST(DUMMY_CFLAGS)
  1757. AM_CONDITIONAL( [HAVE_DUMMY], [test "x$HAVE_DUMMY" = xyes] )
  1758. # Did user choose default audio subsystem ?
  1759. if test "x$with_default_audio" != "x"; then
  1760. default_output_module=$with_default_audio
  1761. else
  1762. default_output_module=`echo "$output_modules" | $AWK '{ print $1 }'`
  1763. fi
  1764. # That's (beginning of) the list for mpg123's internal default.
  1765. default_output_modules=$default_output_module
  1766. OUTPUT_OBJ=
  1767. OUTPUT_MOD=
  1768. OUTPUT_CFLAGS=
  1769. OUTPUT_LIBS=
  1770. OUTPUT_LDFLAGS=
  1771. # Setup the static build.
  1772. if test "x$modules" = xdisabled
  1773. then
  1774. echo "Preparing static output $default_output_module"
  1775. OUTPUT_MOD="$default_output_module"
  1776. OUTPUT_OBJ="output/$default_output_module.\$(OBJEXT)"
  1777. OUTPUT_CFLAGS=
  1778. OUTPUT_LIBS=
  1779. # That feels stupid... what about hashed arrays?
  1780. case $OUTPUT_MOD in
  1781. # Here's a script for that tedious list, perhaps to be outsourced together with the one in src/output/Makefile.am
  1782. #for i in tinyalsa alsa qsa coreaudio esd jack nas oss portaudio pulse sdl sndio sun win32 win32_wasapi aix alib arts hp os2 sgi mint openal
  1783. #do echo $i; done |
  1784. #perl -ne 'chomp; $big = uc($_); print <<EOT;
  1785. # $_)
  1786. # OUTPUT_LIBS="\$${big}_LIBS"
  1787. # OUTPUT_LDFLAGS="\$${big}_LDFLAGS"
  1788. # OUTPUT_CFLAGS="\$${big}_CFLAGS"
  1789. # ;;
  1790. #EOT
  1791. #'
  1792. tinyalsa)
  1793. OUTPUT_LIBS="$TINYALSA_LIBS"
  1794. OUTPUT_LDFLAGS="$TINYALSA_LDFLAGS"
  1795. OUTPUT_CFLAGS="$TINYALSA_CFLAGS"
  1796. ;;
  1797. alsa)
  1798. OUTPUT_LIBS="$ALSA_LIBS"
  1799. OUTPUT_LDFLAGS="$ALSA_LDFLAGS"
  1800. OUTPUT_CFLAGS="$ALSA_CFLAGS"
  1801. ;;
  1802. qsa)
  1803. OUTPUT_LIBS="$QSA_LIBS"
  1804. OUTPUT_LDFLAGS="$QSA_LDFLAGS"
  1805. OUTPUT_CFLAGS="$QSA_CFLAGS"
  1806. ;;
  1807. coreaudio)
  1808. OUTPUT_LIBS="$COREAUDIO_LIBS"
  1809. OUTPUT_LDFLAGS="$COREAUDIO_LDFLAGS"
  1810. OUTPUT_CFLAGS="$COREAUDIO_CFLAGS"
  1811. ;;
  1812. esd)
  1813. OUTPUT_LIBS="$ESD_LIBS"
  1814. OUTPUT_LDFLAGS="$ESD_LDFLAGS"
  1815. OUTPUT_CFLAGS="$ESD_CFLAGS"
  1816. ;;
  1817. jack)
  1818. OUTPUT_LIBS="$JACK_LIBS"
  1819. OUTPUT_LDFLAGS="$JACK_LDFLAGS"
  1820. OUTPUT_CFLAGS="$JACK_CFLAGS"
  1821. ;;
  1822. nas)
  1823. OUTPUT_LIBS="$NAS_LIBS"
  1824. OUTPUT_LDFLAGS="$NAS_LDFLAGS"
  1825. OUTPUT_CFLAGS="$NAS_CFLAGS"
  1826. ;;
  1827. oss)
  1828. OUTPUT_LIBS="$OSS_LIBS"
  1829. OUTPUT_LDFLAGS="$OSS_LDFLAGS"
  1830. OUTPUT_CFLAGS="$OSS_CFLAGS"
  1831. ;;
  1832. portaudio)
  1833. OUTPUT_LIBS="$PORTAUDIO_LIBS"
  1834. OUTPUT_LDFLAGS="$PORTAUDIO_LDFLAGS"
  1835. OUTPUT_CFLAGS="$PORTAUDIO_CFLAGS"
  1836. ;;
  1837. pulse)
  1838. OUTPUT_LIBS="$PULSE_LIBS"
  1839. OUTPUT_LDFLAGS="$PULSE_LDFLAGS"
  1840. OUTPUT_CFLAGS="$PULSE_CFLAGS"
  1841. ;;
  1842. sdl)
  1843. OUTPUT_LIBS="$SDL_LIBS"
  1844. OUTPUT_LDFLAGS="$SDL_LDFLAGS"
  1845. OUTPUT_CFLAGS="$SDL_CFLAGS"
  1846. ;;
  1847. sndio)
  1848. OUTPUT_LIBS="$SNDIO_LIBS"
  1849. OUTPUT_LDFLAGS="$SNDIO_LDFLAGS"
  1850. OUTPUT_CFLAGS="$SNDIO_CFLAGS"
  1851. ;;
  1852. sun)
  1853. OUTPUT_LIBS="$SUN_LIBS"
  1854. OUTPUT_LDFLAGS="$SUN_LDFLAGS"
  1855. OUTPUT_CFLAGS="$SUN_CFLAGS"
  1856. ;;
  1857. win32)
  1858. OUTPUT_LIBS="$WIN32_LIBS"
  1859. OUTPUT_LDFLAGS="$WIN32_LDFLAGS"
  1860. OUTPUT_CFLAGS="$WIN32_CFLAGS"
  1861. ;;
  1862. win32_wasapi)
  1863. OUTPUT_LIBS="$WIN32_WASAPI_LIBS"
  1864. OUTPUT_LDFLAGS="$WIN32_WASAPI_LDFLAGS"
  1865. OUTPUT_CFLAGS="$WIN32_WASAPI_CFLAGS"
  1866. ;;
  1867. aix)
  1868. OUTPUT_LIBS="$AIX_LIBS"
  1869. OUTPUT_LDFLAGS="$AIX_LDFLAGS"
  1870. OUTPUT_CFLAGS="$AIX_CFLAGS"
  1871. ;;
  1872. alib)
  1873. OUTPUT_LIBS="$ALIB_LIBS"
  1874. OUTPUT_LDFLAGS="$ALIB_LDFLAGS"
  1875. OUTPUT_CFLAGS="$ALIB_CFLAGS"
  1876. ;;
  1877. arts)
  1878. OUTPUT_LIBS="$ARTS_LIBS"
  1879. OUTPUT_LDFLAGS="$ARTS_LDFLAGS"
  1880. OUTPUT_CFLAGS="$ARTS_CFLAGS"
  1881. ;;
  1882. hp)
  1883. OUTPUT_LIBS="$HP_LIBS"
  1884. OUTPUT_LDFLAGS="$HP_LDFLAGS"
  1885. OUTPUT_CFLAGS="$HP_CFLAGS"
  1886. ;;
  1887. os2)
  1888. OUTPUT_LIBS="$OS2_LIBS"
  1889. OUTPUT_LDFLAGS="$OS2_LDFLAGS"
  1890. OUTPUT_CFLAGS="$OS2_CFLAGS"
  1891. ;;
  1892. sgi)
  1893. OUTPUT_LIBS="$SGI_LIBS"
  1894. OUTPUT_LDFLAGS="$SGI_LDFLAGS"
  1895. OUTPUT_CFLAGS="$SGI_CFLAGS"
  1896. ;;
  1897. mint)
  1898. OUTPUT_LIBS="$MINT_LIBS"
  1899. OUTPUT_LDFLAGS="$MINT_LDFLAGS"
  1900. OUTPUT_CFLAGS="$MINT_CFLAGS"
  1901. ;;
  1902. openal)
  1903. OUTPUT_LIBS="$OPENAL_LIBS"
  1904. OUTPUT_LDFLAGS="$OPENAL_LDFLAGS"
  1905. OUTPUT_CFLAGS="$OPENAL_CFLAGS"
  1906. ;;
  1907. esac
  1908. else
  1909. # Now make a comma-separated list again... eliminating the possible duplicate and dummy.
  1910. for i in $output_modules
  1911. do
  1912. if test $i != $default_output_module && test $i != dummy; then
  1913. default_output_modules=$default_output_modules,$i
  1914. fi
  1915. done
  1916. fi
  1917. AC_DEFINE_UNQUOTED( DEFAULT_OUTPUT_MODULE, "$default_output_modules", [The default audio output module(s) to use] )
  1918. AC_SUBST(OUTPUT_OBJ)
  1919. AC_SUBST(OUTPUT_MOD)
  1920. AC_SUBST(OUTPUT_CFLAGS)
  1921. AC_SUBST(OUTPUT_LIBS)
  1922. AC_SUBST(OUTPUT_LDFLAGS)
  1923. dnl ############## Compiler Optimizations
  1924. CFLAGS="$ADD_CFLAGS $CFLAGS"
  1925. if test x"$buffer" = xdisabled; then
  1926. ADD_CPPFLAGS="$ADD_CPPFLAGS -DNOXFERMEM"
  1927. fi
  1928. if test x"$newoldwritesample" = xenabled; then
  1929. ADD_CPPFLAGS="$ADD_CPPFLAGS -DNEWOLD_WRITE_SAMPLE"
  1930. fi
  1931. CPPFLAGS="$ADD_CPPFLAGS $CPPFLAGS"
  1932. LDFLAGS="$ADD_LDFLAGS $LDFLAGS"
  1933. # None chosen?
  1934. if test "x$with_optimization" = "x"; then
  1935. if test x"$debugging" = xenabled; then
  1936. with_optimization="0"
  1937. else
  1938. # enable (gcc specific) default opts only with gcc
  1939. if test "x$GCC" = xyes; then
  1940. with_optimization="2"
  1941. else
  1942. with_optimization="0"
  1943. fi
  1944. fi
  1945. fi
  1946. case $with_optimization in
  1947. 0)
  1948. # No Optimizations
  1949. CFLAGS="$CFLAGS"
  1950. ;;
  1951. 1)
  1952. CFLAGS="-O $CFLAGS"
  1953. ;;
  1954. 2)
  1955. CFLAGS="-O2 -fomit-frame-pointer -funroll-all-loops -finline-functions -ffast-math $CFLAGS"
  1956. ;;
  1957. 3)
  1958. CFLAGS="-O3 -fomit-frame-pointer -funroll-all-loops -finline-functions -ffast-math $CFLAGS"
  1959. ;;
  1960. 4)
  1961. CFLAGS="-O4 -fomit-frame-pointer -funroll-all-loops -finline-functions -ffast-math $CFLAGS"
  1962. ;;
  1963. *)
  1964. AC_MSG_ERROR([Unknown optimizations level '$with_optimization'])
  1965. ;;
  1966. esac
  1967. dnl If using gcc, prevent a bad alignment option from breaking things.
  1968. dnl Let's default to safe 16-byte alignment for any special x86 or altivec stuff.
  1969. if test "x$GCC" = xyes && echo "$CFLAGS" | $GREP 'mpreferred-stack-boundary=' > /dev/null; then
  1970. case $cpu_type in
  1971. x86 | i586* | mmx | sse | 3dnow* | altivec)
  1972. AC_MSG_WARN( [ You are trying to mess with stack alignment. I know better. ] )
  1973. CFLAGS="$CFLAGS -mpreferred-stack-boundary=4"
  1974. ;;
  1975. esac
  1976. fi
  1977. dnl ############## Seektable size
  1978. if test "x$with_seektable" = "x"; then
  1979. seektable=1000
  1980. else
  1981. seektable=$with_seektable
  1982. fi
  1983. if test "$seektable" -gt 0; then
  1984. AC_DEFINE(FRAME_INDEX, 1, [ Define if frame index should be used. ])
  1985. fi
  1986. # Define that always... also without frame index enabled.
  1987. AC_DEFINE_UNQUOTED(INDEX_SIZE, $seektable, [size of the frame index seek table])
  1988. dnl ############## Win32 function checks
  1989. # Check if we want Unicode for Win32. Cygwin does not need _wopen
  1990. win32_specific_codes=disabled
  1991. win32_unicode=unneeded
  1992. win32_sockets=disabled
  1993. win32_sockets_working=no
  1994. win32_wide_working=no
  1995. win32_winver_bump=no
  1996. AC_CHECK_HEADERS([windows.h], [win32_specific_codes=enabled])
  1997. if test "x$win32_specific_codes" = xenabled && test "x$host_os" != "xcygwin"; then
  1998. #### Check for Wide functions
  1999. AC_CHECK_FUNC([_wopen], [win32_unicode=enabled],[win32_unicode=disabled])
  2000. AC_MSG_CHECKING([if we want Unicode File Open for Win32])
  2001. if test "x$win32_unicode" = xenabled; then
  2002. AC_MSG_RESULT([yes])
  2003. AC_MSG_CHECKING([if Unicode functions working])
  2004. AC_LINK_IFELSE([AC_LANG_SOURCE([
  2005. #include <windows.h>
  2006. #include <stdlib.h>
  2007. int main()
  2008. {
  2009. MultiByteToWideChar (0, 0, NULL, 0, NULL, 0);
  2010. WideCharToMultiByte (0, 0, NULL, 0, NULL, 0, NULL, NULL);
  2011. return 0;
  2012. }
  2013. ])], [win32_wide_working=yes], [win32_winver_bump=yes])
  2014. if test "x$win32_wide_working" = xno; then
  2015. AC_LINK_IFELSE([AC_LANG_SOURCE([
  2016. #define WINVER 0x501
  2017. #define _WIN32_WINNT 0x501
  2018. #include <windows.h>
  2019. #include <stdlib.h>
  2020. int main()
  2021. {
  2022. MultiByteToWideChar (0, 0, NULL, 0, NULL, 0);
  2023. WideCharToMultiByte (0, 0, NULL, 0, NULL, 0, NULL, NULL);
  2024. return 0;
  2025. }
  2026. ])], [win32_wide_working=yes], [AC_MSG_RESULT([no])])
  2027. fi
  2028. if test "x$win32_wide_working" = xyes; then
  2029. AC_MSG_RESULT([yes])
  2030. AC_DEFINE([WANT_WIN32_UNICODE], [1], [ Define to use Unicode for Windows ])
  2031. fi
  2032. else
  2033. AC_MSG_WARN([Unicode File Open for Win32 disabled])
  2034. fi
  2035. #### Check for Network functions
  2036. AC_CHECK_HEADERS([ws2tcpip.h], [win32_sockets=enabled], [AC_MSG_WARN([Please update your headers to support winsock 2.2.])])
  2037. AC_MSG_CHECKING([if we want Win32 sockets])
  2038. if test "x$win32_sockets" = "xenabled" && test "x$network" != "xdisabled"; then
  2039. AC_MSG_RESULT([yes])
  2040. AC_MSG_CHECKING([if winsock2 API is available])
  2041. wsoldlibs="$LIBS"
  2042. LIBS="$LIBS -lws2_32"
  2043. AC_LINK_IFELSE([AC_LANG_SOURCE([
  2044. #include <winsock2.h>
  2045. #include <ws2tcpip.h>
  2046. #include <stdlib.h>
  2047. int main()
  2048. {
  2049. getaddrinfo(NULL, NULL, NULL, NULL);
  2050. freeaddrinfo(NULL);
  2051. return 0;
  2052. }
  2053. ])], [win32_sockets_working=yes], [win32_winver_bump=yes])
  2054. if test "x$win32_sockets_working" = "xno"; then
  2055. AC_MSG_CHECKING([deeper if winsock2 API is available])
  2056. AC_LINK_IFELSE([AC_LANG_SOURCE([
  2057. #define WINVER 0x501
  2058. #define _WIN32_WINNT 0x501
  2059. #include <winsock2.h>
  2060. #include <ws2tcpip.h>
  2061. #include <stdlib.h>
  2062. int main()
  2063. {
  2064. getaddrinfo(NULL, NULL, NULL, NULL);
  2065. freeaddrinfo(NULL);
  2066. return 0;
  2067. }
  2068. ])], [win32_sockets_working=yes], [AC_MSG_RESULT([no])])
  2069. fi
  2070. if test "x$win32_sockets_working" = "xyes"; then
  2071. AC_MSG_RESULT([yes])
  2072. AC_DEFINE([WANT_WIN32_SOCKETS], [1], [ Define to use Win32 sockets ])
  2073. network_type=Winsock2
  2074. have_network=yes
  2075. have_ipv6=yes
  2076. else
  2077. LIBS="$wsoldlibs"
  2078. AC_MSG_WARN([Please update your headers to support winsock 2.2.])
  2079. fi
  2080. else
  2081. AC_MSG_RESULT([no])
  2082. fi
  2083. #### Check for Win32 Named Pipe functions
  2084. win32_fifo_working=no
  2085. if test x$win32_specific_codes = xenabled; then
  2086. AC_MSG_CHECKING([if we have Named Pipes])
  2087. if test "x$fifo" != "xdisabled"; then
  2088. AC_LINK_IFELSE([AC_LANG_SOURCE([
  2089. #include <windows.h>
  2090. int main(){
  2091. CreateNamedPipeA(NULL,PIPE_ACCESS_DUPLEX|FILE_FLAG_OVERLAPPED,PIPE_TYPE_BYTE,1,255,255,0,NULL);
  2092. CreateNamedPipeW(NULL,PIPE_ACCESS_DUPLEX|FILE_FLAG_OVERLAPPED,PIPE_TYPE_BYTE,1,255,255,0,NULL);
  2093. return 0;
  2094. }])],[win32_fifo_working=yes],[win32_winver_bump=yes])
  2095. if test "x$win32_fifo_working" != "xyes"; then
  2096. AC_LINK_IFELSE([AC_LANG_SOURCE([
  2097. #define WINVER 0x501
  2098. #define _WIN32_WINNT 0x501
  2099. #include <windows.h>
  2100. int main(){
  2101. CreateNamedPipeA(NULL,PIPE_ACCESS_DUPLEX|FILE_FLAG_OVERLAPPED,PIPE_TYPE_BYTE,1,255,255,0,NULL);
  2102. CreateNamedPipeW(NULL,PIPE_ACCESS_DUPLEX|FILE_FLAG_OVERLAPPED,PIPE_TYPE_BYTE,1,255,255,0,NULL);
  2103. return 0;
  2104. }])],[win32_fifo_working=yes],[win32_fifo_working=no])
  2105. fi
  2106. fi
  2107. have_mkfifo=$win32_fifo_working
  2108. if test "x$win32_fifo_working" = "xyes"; then
  2109. AC_MSG_RESULT([yes])
  2110. AC_DEFINE([WANT_WIN32_FIFO], [1], [ Define to use Win32 named pipes ])
  2111. else
  2112. AC_MSG_RESULT([no])
  2113. fi
  2114. fi
  2115. #### WINVER Bump
  2116. if test x$win32_specific_codes = xenabled; then
  2117. AC_MSG_CHECKING([if WINVER and _WIN32_WINNT needs version bumps])
  2118. if test "x$win32_winver_bump" = "xyes"; then
  2119. AC_MSG_RESULT([yes])
  2120. AC_DEFINE([WINVER], [0x0501], [ WinXP and above for ipv6 ])
  2121. AC_DEFINE([_WIN32_WINNT], [0x0501], [ WinXP and above for ipv6 ])
  2122. # getaddrinfo and freeaddrinfo are available for Win2K and above
  2123. # Bug: MinGW.org w32api ws2tcpip.h incorrectly wants (_WIN32_WINNT >= 0x0501) for getaddrinfo and freeaddrinfo
  2124. # MultiByteToWideChar and WideCharToMultiByte are available for Win2K and above
  2125. else
  2126. AC_MSG_RESULT([no])
  2127. fi
  2128. fi
  2129. fi #END OF WIN32 CHECKS
  2130. #### Check mingw.org for EOVERFLOW
  2131. AC_MSG_CHECKING([if we have EOVERFLOW macro])
  2132. AC_COMPILE_IFELSE([AC_LANG_SOURCE([
  2133. #include <errno.h>
  2134. int i = (EOVERFLOW) + 0;
  2135. ])],[eoverflow_present=yes],[eoverflow_present=no])
  2136. AC_MSG_RESULT([$eoverflow_present])
  2137. AS_IF([test "x$eoverflow_present" = "xyes"],[],[AC_DEFINE([EOVERFLOW],[EFBIG],[Use EFBIG as substitude for EOVERFLOW, mingw.org may lack the latter])])
  2138. #### Use Win32 support codes
  2139. AM_CONDITIONAL([WIN32_CODES], [ test "x$win32_specific_codes" = xenabled ])
  2140. if test x"$network" = xauto; then
  2141. if test x"$have_network" = xyes; then
  2142. network=enabled
  2143. else
  2144. network=disabled
  2145. fi
  2146. fi
  2147. if test x"$ipv6" = xauto; then
  2148. if test x"$have_ipv6" = xyes; then
  2149. ipv6=enabled
  2150. else
  2151. ipv6=disabled
  2152. fi
  2153. fi
  2154. dnl ############## FIFO enable
  2155. if test x"$fifo" = xauto; then
  2156. if test x"$have_mkfifo" = xyes; then
  2157. fifo=enabled
  2158. else
  2159. fifo=disabled
  2160. fi
  2161. fi
  2162. if test x"$fifo" = xenabled; then
  2163. AC_DEFINE(FIFO, 1, [ Define if FIFO support is enabled. ])
  2164. if test x"$have_mkfifo" = xno; then
  2165. AC_MSG_WARN( [ You forced FIFO code while I think there is no mkfifo() available! ] )
  2166. fi
  2167. fi
  2168. dnl ############## Network enable
  2169. if test x"$network" = xenabled; then
  2170. AC_DEFINE(NETWORK, 1, [ Define if network support is enabled. ])
  2171. if test x"$have_network" = xno; then
  2172. AC_MSG_WARN( [ You forced network code while I think there is support missing! ] )
  2173. fi
  2174. fi
  2175. if test x"$ipv6" = xenabled; then
  2176. AC_DEFINE(IPV6, 1, [ Define if IPV6 support is enabled. ])
  2177. if test x"$have_ipv6" = xno; then
  2178. AC_MSG_WARN( [ You forced IPv6 code while I think there is no getaddrinfo() available! ] )
  2179. fi
  2180. fi
  2181. dnl ############## Final Output
  2182. # Do that here to prevent the above tests usign -lltdl...
  2183. if test "x$modules" = xenabled; then
  2184. LIBS="-lltdl $LIBS"
  2185. fi
  2186. AC_CONFIG_FILES([
  2187. Makefile
  2188. libmpg123.pc
  2189. mpg123.spec
  2190. doc/Makefile
  2191. src/Makefile
  2192. src/output/Makefile
  2193. src/libmpg123/Makefile
  2194. src/libmpg123/mpg123.h
  2195. ])
  2196. AC_OUTPUT
  2197. dnl ############## Display Message
  2198. echo "
  2199. $PACKAGE_NAME $PACKAGE_VERSION
  2200. Install path ............ $prefix
  2201. CPU Optimization ........ $cpu_type
  2202. Compiler Optimization ... $with_optimization
  2203. Gapless Support ......... $gapless
  2204. Debugging ............... $debugging
  2205. Seek table size ......... $seektable
  2206. FIFO support ............ $fifo
  2207. Buffer .................. $buffer
  2208. Network (http streams) .. $network
  2209. Network Sockets ......... $network_type
  2210. IPv6 (getaddrinfo) ...... $ipv6"
  2211. if test x"$LARGEFILE_BITS" = x; then
  2212. echo " File offsets ............ default"
  2213. else
  2214. echo " File offsets ............ $LARGEFILE_BITS"
  2215. echo " The lib will (try to) support default offset size, too."
  2216. fi
  2217. echo " LFS alias symbols ....... $lfs_alias ($LFS_ALIAS_BITS)"
  2218. echo " LFS alias type .......... $lfs_alias_type"
  2219. echo -n "
  2220. Core libmpg123 features:
  2221. Layer I ................. $layer1
  2222. Layer II ................ $layer2
  2223. Layer III ............... $layer3
  2224. NtoM resampling ......... $ntom
  2225. downsampled decoding .... $downsample
  2226. Feeder/buffered input ... $feeder
  2227. ID3v2 parsing ........... $id3v2
  2228. String API .............. $string
  2229. ICY parsing/conversion .. $icy
  2230. Error/warning messages .. $messages
  2231. Win32 Unicode File Open.. $win32_unicode
  2232. Feature Report Function.. $feature_report
  2233. Output formats (nofpu will disable all but 16 or 8 bit!):
  2234. 8 bit integer ........... $int8
  2235. 16 bit integer .......... $int16
  2236. 32/24 bit integer ....... $int32
  2237. real (32 bit float) ..... $real
  2238. Optimization detail:
  2239. Integer conversion ...... $integers
  2240. New/old WRITE_SAMPLE .... $newoldwritesample
  2241. new Huffman scheme ...... $newhuff
  2242. Note: Disabling core features is not commonly done and some combinations might not build/work. If you encounter such a case, help yourself (and provide a patch) or just poke the maintainers.
  2243. "
  2244. # just an empty line
  2245. echo
  2246. echo " Modules ................. $modules"
  2247. echo " Module suffix ........... $with_module_suffix"
  2248. echo " Checked audio modules ... $check_modules
  2249. Detected audio support ..$output_modules
  2250. Default output module ... $default_output_module
  2251. "
  2252. if test x"$modules" = xdisabled; then
  2253. echo "The _single_ active output module is being statically linked in.
  2254. "
  2255. fi
  2256. if test x"$with_optimization" = x0; then
  2257. echo "No optimization flags chosen, make sure you have something basic in your CFLAGS at least...
  2258. "
  2259. fi
  2260. if test x"$debugging" = xenabled; then
  2261. echo "CFLAGS='$CFLAGS'"
  2262. echo "LIBS='$LIBS'"
  2263. else
  2264. echo "Next type 'make' and then 'make install'."
  2265. fi