configure.ac 67 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261
  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.15.3], [[email protected]])
  9. dnl Increment API_VERSION when the API gets changes (new functions).
  10. API_VERSION=37
  11. LIB_PATCHLEVEL=1
  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. AM_CONFIG_HEADER(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. integers=fast
  343. AC_ARG_ENABLE(int-quality,
  344. [ --enable-int-quality=[yes/no] use rounding instead of fast truncation for integer output, where possible ],
  345. [
  346. if test "x$enableval" = xyes; then
  347. integers=quality
  348. AC_DEFINE(ACCURATE_ROUNDING, 1, [ Define to use proper rounding. ])
  349. fi
  350. ], [])
  351. int16=enabled
  352. AC_ARG_ENABLE(16bit,
  353. [ --disable-16bit=[no/yes] no 16 bit integer output ],
  354. [
  355. if test "x$enableval" = xno; then
  356. int16="disabled"
  357. fi
  358. ], [])
  359. int8=enabled
  360. AC_ARG_ENABLE(8bit,
  361. [ --disable-8bit=[no/yes] no 8 bit integer output ],
  362. [
  363. if test "x$enableval" = xno; then
  364. int8="disabled"
  365. fi
  366. ], [])
  367. int32=enabled
  368. AC_ARG_ENABLE(32bit,
  369. [ --disable-32bit=[no/yes] no 32 bit integer output (also 24 bit) ],
  370. [
  371. if test "x$enableval" = xno; then
  372. int32="disabled"
  373. fi
  374. ], [])
  375. real=enabled
  376. AC_ARG_ENABLE(real,
  377. [ --disable-real=[no/yes] no real (floating point) output ],
  378. [
  379. if test "x$enableval" = xno; then
  380. real="disabled"
  381. fi
  382. ], [])
  383. AC_ARG_WITH([cpu], [
  384. --with-cpu=generic[_fpu] Use generic processor code with floating point arithmetic
  385. --with-cpu=generic_float Plain alias to generic_fpu now... float output is a normal runtime option!
  386. --with-cpu=generic_nofpu Use generic processor code with fixed point arithmetic (p.ex. ARM, experimental)
  387. --with-cpu=generic_dither Use generic processor code with floating point arithmetic and dithering for 1to1 16bit decoding.
  388. --with-cpu=i386[_fpu] Use code optimized for i386 processors with floating point arithmetic
  389. --with-cpu=i386_nofpu Use code optimized for i386 processors with fixed point arithmetic (experimental)
  390. --with-cpu=i486 Use code optimized for i486 processors (only usable alone!)
  391. --with-cpu=i586 Use code optimized for i586 processors
  392. --with-cpu=i586_dither Use code optimized for i586 processors with dithering (noise shaping), adds 256K to binary size
  393. --with-cpu=3dnow Use code optimized for 3DNow processors
  394. --with-cpu=3dnowext Use code optimized for 3DNowExt processors (K6-3+, Athlon)
  395. --with-cpu=3dnowext_alone Really only 3DNowExt decoder, without 3DNow fallback for flexible rate
  396. --with-cpu=mmx Use code optimized for MMX processors
  397. --with-cpu=mmx_alone Really only MMX decoder, without i586 fallback for flexible rate
  398. --with-cpu=sse Use code optimized for SSE processors
  399. --with-cpu=sse_alone Really only SSE decoder, without i586 fallback for flexible rate
  400. --with-cpu=x86 Pack all x86 opts into one binary (excluding i486, including dither)
  401. --with-cpu=x86-64 Use code optimized for x86-64 processors (AMD64 and Intel64, including dithered generic)
  402. --with-cpu=altivec Use code optimized for Altivec processors (PowerPC G4 and G5)
  403. --with-cpu=ppc_nofpu Use code optimized for PowerPC processors with fixed point arithmetic (experimental)
  404. --with-cpu=neon Use code optimized for ARM NEON SIMD engine (Cortex-A series)
  405. --with-cpu=arm_nofpu Use code optimized for ARM processors with fixed point arithmetic (experimental)
  406. ])
  407. # opt-in for IEEE754 floating point action
  408. # 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.
  409. # It _should_ be fine for about all computers still out there, but we play safe.
  410. ieee=no
  411. case $host in
  412. i?86-*|x86_64-*|powerpc*|sparc*)
  413. ieee=yes
  414. ;;
  415. esac
  416. if test "x$ieee" = xyes; then
  417. echo "We assume IEEE754 floating point format."
  418. AC_DEFINE(IEEE_FLOAT, 1, [ Define to indicate that float storage follows IEEE754. ])
  419. fi
  420. newoldwritesample=disabled
  421. case $host in
  422. arm*-*-linux*)
  423. # check that... perhaps we are better off on arm with kernel math emulation
  424. cpu_type="arm_nofpu"
  425. ;;
  426. i386-*-linux*|i386-*-kfreebsd*-gnu)
  427. cpu_type="i386_fpu"
  428. newoldwritesample=enabled
  429. ;;
  430. i486-*-linux*|i486-*-kfreebsd*-gnu)
  431. cpu_type="i486"
  432. newoldwritesample=enabled
  433. ;;
  434. i586-*-linux*|i586-*-kfreebsd*-gnu)
  435. cpu_type="x86"
  436. newoldwritesample=enabled
  437. ;;
  438. i686-*-linux*|i686-*-kfreebsd*-gnu)
  439. cpu_type="x86"
  440. newoldwritesample=enabled
  441. ;;
  442. x86_64-*-linux*|x86_64-*-kfreebsd*-gnu)
  443. cpu_type="x86-64"
  444. ;;
  445. *-*-linux*|*-*-kfreebsd*-gnu)
  446. cpu_type="generic_fpu"
  447. ;;
  448. i386-apple-darwin10*)
  449. AC_MSG_CHECKING([if CPU type supports x86-64])
  450. case `sysctl -n hw.optional.x86_64` in
  451. 1)
  452. AC_MSG_RESULT([yes])
  453. cpu_type="x86-64"
  454. ;;
  455. *)
  456. AC_MSG_RESULT([no])
  457. cpu_type="x86"
  458. newoldwritesample=enabled
  459. ;;
  460. esac
  461. ;;
  462. i386-apple-darwin*)
  463. cpu_type="x86"
  464. newoldwritesample=enabled
  465. ;;
  466. x86_64-apple-darwin*)
  467. cpu_type="x86-64"
  468. ;;
  469. *-apple-darwin*)
  470. AC_MSG_CHECKING([if CPU type supports AltiVec])
  471. case `machine` in
  472. ppc7400 | ppc7450 | ppc970)
  473. AC_MSG_RESULT([yes])
  474. cpu_type="altivec"
  475. ;;
  476. *)
  477. AC_MSG_RESULT([no])
  478. cpu_type="generic_fpu"
  479. ;;
  480. esac
  481. ;;
  482. i?86-*-dragonfly* | i?86-*-freebsd* | i?86-*-midnightbsd* | i?86-*-mirbsd* | i?86-*-netbsd* | i?86-*-openbsd*)
  483. cpu_type="x86"
  484. newoldwritesample=enabled
  485. ;;
  486. x86_64-*-dragonfly* | x86_64-*-freebsd* | x86_64-*-midnightbsd* | x86_64-*-mirbsd* | x86_64-*-netbsd* | x86_64-*-openbsd*)
  487. cpu_type="x86-64"
  488. ;;
  489. *-*-dragonfly* | *-*-freebsd* | *-*-midnightbsd* | *-*-mirbsd* | *-*-netbsd* | *-*-openbsd*)
  490. cpu_type="generic_fpu"
  491. ;;
  492. i386-*-solaris*)
  493. cpu_type=x86
  494. newoldwritesample=enabled
  495. ;;
  496. x86_64-*-solaris*)
  497. cpu_type=x86-64
  498. ;;
  499. *-*-solaris*)
  500. cpu_type="generic_fpu"
  501. ;;
  502. # os2-emx = OS/2 with some Unix fun; so p.ex. buffer works.
  503. # Till we sorted out the assembler troubles, generic CPU is default.
  504. i386-pc-os2-emx)
  505. cpu_type=generic_fpu
  506. newoldwritesample=enabled
  507. ;;
  508. x86_64-pc-os2-emx)
  509. # We are optimistic hat the future knows OS/2 on x86-64;-)
  510. cpu_type=generic_fpu
  511. ;;
  512. *-pc-os2-emx)
  513. cpu_type="generic_fpu"
  514. ;;
  515. *-dec-osf*)
  516. cpu_type="generic_fpu"
  517. ;;
  518. x86_64-pc-cygwin*)
  519. cpu_type="x86-64"
  520. ;;
  521. i686-pc-cygwin*)
  522. cpu_type="x86"
  523. newoldwritesample=enabled
  524. ;;
  525. i586-pc-cygwin*)
  526. cpu_type="x86"
  527. newoldwritesample=enabled
  528. ;;
  529. i486-pc-cygwin*)
  530. cpu_type="i486"
  531. newoldwritesample=enabled
  532. ;;
  533. i386-pc-cygwin*)
  534. cpu_type="i386"
  535. newoldwritesample=enabled
  536. ;;
  537. *-pc-cygwin*)
  538. cpu_type="generic_fpu"
  539. ;;
  540. i@<:@3-7@:>@86-*-mingw32*)
  541. LIBS="$LIBS"
  542. buffer=disabled
  543. cpu_type="x86"
  544. newoldwritesample=enabled
  545. ;;
  546. x86_64-*-mingw32*)
  547. LIBS="$LIBS"
  548. buffer=disabled
  549. cpu_type="x86-64"
  550. ;;
  551. i386-*-nto-qnx*)
  552. cpu_type="x86"
  553. newoldwritesample=enabled
  554. ;;
  555. i386-*)
  556. AC_MSG_WARN([Unknown host operating system])
  557. cpu_type="i386"
  558. buffer=disabled
  559. ADD_CPPFLAGS="-DGENERIC $ADD_CPPFLAGS"
  560. newoldwritesample=enabled
  561. ;;
  562. i486-*)
  563. AC_MSG_WARN([Unknown host operating system])
  564. cpu_type="i486"
  565. buffer=disabled
  566. ADD_CPPFLAGS="-DGENERIC $ADD_CPPFLAGS"
  567. newoldwritesample=enabled
  568. ;;
  569. i586-*)
  570. AC_MSG_WARN([Unknown host operating system])
  571. cpu_type="x86"
  572. buffer=disabled
  573. ADD_CPPFLAGS="-DGENERIC $ADD_CPPFLAGS"
  574. newoldwritesample=enabled
  575. ;;
  576. i686-*)
  577. AC_MSG_WARN([Unknown host operating system])
  578. cpu_type="x86"
  579. buffer=disabled
  580. ADD_CPPFLAGS="-DGENERIC $ADD_CPPFLAGS"
  581. newoldwritesample=enabled
  582. ;;
  583. x86_64-*)
  584. AC_MSG_WARN([Unknown host operating system])
  585. cpu_type="x86-64"
  586. buffer=disabled
  587. ADD_CPPFLAGS="-DGENERIC $ADD_CPPFLAGS"
  588. ;;
  589. *)
  590. AC_MSG_WARN([Unknown host operating system])
  591. cpu_type="generic_fpu"
  592. buffer=disabled
  593. ADD_CPPFLAGS="-DGENERIC $ADD_CPPFLAGS"
  594. ;;
  595. esac
  596. AC_ARG_ENABLE(buffer,
  597. [ --enable-buffer=[yes/no] disable audio buffer code (default uses system whitelist... proper checks later) ],
  598. [
  599. if test "x$enableval" = xyes
  600. then
  601. echo "Note: Enabling buffer per request... perhaps it will not build anyway."
  602. buffer="enabled"
  603. else
  604. echo "Note: Disabling buffer per request."
  605. buffer="disabled"
  606. fi
  607. ]
  608. )
  609. AC_ARG_ENABLE(newoldwritesample,
  610. [ --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)],
  611. [
  612. if test "x$enableval" = xyes
  613. then
  614. newoldwritesample=enabled
  615. else
  616. newoldwritesample=disabled
  617. fi
  618. ])
  619. dnl Did user choose other CPU type ?
  620. if test "x$with_cpu" != "x"; then
  621. cpu_type=$with_cpu
  622. fi
  623. if test "x$cpu_type" = "xgeneric_nofpu"; then
  624. real=disabled
  625. int32=disabled
  626. fi
  627. if test "x$cpu_type" = "xi386_nofpu"; then
  628. real=disabled
  629. int32=disabled
  630. fi
  631. if test "x$cpu_type" = "xppc_nofpu"; then
  632. real=disabled
  633. int32=disabled
  634. fi
  635. if test "x$cpu_type" = "xarm_nofpu"; then
  636. real=disabled
  637. int32=disabled
  638. fi
  639. if test "x$int16" = "xdisabled"; then
  640. AC_DEFINE(NO_16BIT, 1, [ Define to disable 16 bit integer output. ])
  641. else
  642. DECODER_OBJ="$DECODER_OBJ synth.\$(OBJEXT)"
  643. DECODER_LOBJ="$DECODER_LOBJ synth.lo"
  644. fi
  645. # 8bit works only through 16bit
  646. if test "x$int16" = "xdisabled"; then
  647. int8=disabled
  648. fi
  649. if test "x$int8" = "xdisabled"; then
  650. AC_DEFINE(NO_8BIT, 1, [ Define to disable 8 bit integer output. ])
  651. else
  652. DECODER_OBJ="$DECODER_OBJ synth_8bit.\$(OBJEXT)"
  653. DECODER_LOBJ="$DECODER_LOBJ synth_8bit.lo"
  654. fi
  655. if test "x$int32" = "xdisabled"; then
  656. AC_DEFINE(NO_32BIT, 1, [ Define to disable 32 bit and 24 bit integer output. ])
  657. else
  658. s_fpu="$s_fpu synth_s32"
  659. fi
  660. if test "x$real" = "xdisabled"; then
  661. AC_DEFINE(NO_REAL, 1, [ Define to disable real output. ])
  662. else
  663. s_fpu="$s_fpu synth_real"
  664. fi
  665. layer1=enabled
  666. AC_ARG_ENABLE(layer1,
  667. [ --disable-layer1=[no/yes] no layer I decoding ],
  668. [
  669. if test "x$enableval" = xno; then
  670. layer1="disabled"
  671. fi
  672. ], [])
  673. if test "x$layer1" = "xdisabled"; then
  674. AC_DEFINE(NO_LAYER1, 1, [ Define to disable layer I. ])
  675. else
  676. # layer1 needs code in layer2
  677. DECODER_OBJ="$DECODER_OBJ layer1.\$(OBJEXT) layer2.\$(OBJEXT)"
  678. DECODER_LOBJ="$DECODER_LOBJ layer1.lo layer2.lo"
  679. fi
  680. layer2=enabled
  681. AC_ARG_ENABLE(layer2,
  682. [ --disable-layer2=[no/yes] no layer II decoding ],
  683. [
  684. if test "x$enableval" = xno; then
  685. layer2="disabled"
  686. fi
  687. ], [])
  688. if test "x$layer2" = "xdisabled"; then
  689. AC_DEFINE(NO_LAYER2, 1, [ Define to disable layer II. ])
  690. else
  691. # layer1 may have added the objects already
  692. if test "x$layer1" = "xdisabled"; then
  693. DECODER_OBJ="$DECODER_OBJ layer2.\$(OBJEXT)"
  694. DECODER_LOBJ="$DECODER_LOBJ layer2.lo"
  695. fi
  696. fi
  697. layer3=enabled
  698. AC_ARG_ENABLE(layer3,
  699. [ --disable-layer3=[no/yes] no layer III decoding ],
  700. [
  701. if test "x$enableval" = xno; then
  702. layer3="disabled"
  703. fi
  704. ], [])
  705. if test "x$layer3" = "xdisabled"; then
  706. AC_DEFINE(NO_LAYER3, 1, [ Define to disable layer III. ])
  707. else
  708. DECODER_OBJ="$DECODER_OBJ layer3.\$(OBJEXT)"
  709. DECODER_LOBJ="$DECODER_LOBJ layer3.lo"
  710. fi
  711. AC_ARG_WITH([audio], [
  712. --with-audio=<list of modules> Select a list (or only one) of audio output modules (comma or space separated list).
  713. ])
  714. AC_ARG_WITH([default-audio], [
  715. --with-default-audio=aix Use AIX as default audio output sub-system
  716. --with-default-audio=alib Use Alib as default audio output sub-system (for HPUX)
  717. --with-default-audio=alsa Use ALSA as default audio output sub-system
  718. --with-default-audio=arts Use aRts as default audio output sub-system (KDE sound server)
  719. --with-default-audio=dummy Use dummy as default audio (when no sound card is available)
  720. --with-default-audio=esd Use ESoundD as default audio output sub-system
  721. --with-default-audio=hp Use HP as default audio output sub-system
  722. --with-default-audio=jack Use JACK as default low-latency audio server
  723. --with-default-audio=coreaudio Use Mac OS X as default audio output sub-system (CoreAudio)
  724. --with-default-audio=mint Use MinT as default audio output sub-system (Atari)
  725. --with-default-audio=nas Use NAS as default audio output (Network Audio System)
  726. --with-default-audio=os2 Use OS2 as default audio output sub-system
  727. --with-default-audio=oss Use OSS as default audio output sub-system (/dev/dsp)
  728. --with-default-audio=portaudio Use PortAudio as default audio output sub-system
  729. --with-default-audio=pulse Use Pulse audio server as default audio output sub-system
  730. --with-default-audio=qsa Use QSA as default audio output sub-system
  731. --with-default-audio=sdl Use SDL as default audio output sub-system (Simple DirectMedia Layer)
  732. --with-default-audio=sgi Use SGI as default audio output sub-system (IRIX)
  733. --with-default-audio=sndio Use OpenBSD's sndio as default audio output sub-system
  734. --with-default-audio=sun Use Sun as default audio output sub-system (/dev/audio)
  735. --with-default-audio=win32 Use Win32 audio as default audio output sub-system
  736. ])
  737. AC_ARG_WITH([optimization], [
  738. --with-optimization=0 No Optimization
  739. --with-optimization=1 Limited Optimization (-O) (for gcc)
  740. --with-optimization=2 Default Optimization (-O2 ...) (for gcc)
  741. --with-optimization=3 More Optimize than default (-O3 ...) (for gcc)
  742. --with-optimization=4 Optimize yet more (-O4 ...) (for gcc)
  743. ])
  744. AC_ARG_WITH([seektable], [
  745. --with-seektable=<size> choose size of seek index table (0 disables it), default 1000
  746. ])
  747. dnl ############## Modules
  748. # Dummy audio output module is always supported
  749. output_modules="dummy"
  750. # Decide on module file suffix. Setting it != .la allows removal of .la files.
  751. AC_ARG_WITH([module-suffix], [
  752. --with-module-suffix=.la (default) Use libtool's .la files for loading modules.
  753. --with-module-suffix=[.so|.dll|...] Specify the native module file suffix to bypass .la files.
  754. ])
  755. if test x"$with_module_suffix" = x; then
  756. with_module_suffix=.la
  757. fi
  758. AC_DEFINE_UNQUOTED( MODULE_FILE_SUFFIX, "$with_module_suffix", [The suffix for module files.] )
  759. dnl ############## Assembler, compiler properties
  760. # based on posting from John Dalgliesh <[email protected]> on ffmpeg (LGPL) mailing list
  761. # extended to use balign if present
  762. AC_MSG_CHECKING([if .balign is present])
  763. echo '.balign 4' > conftest.s
  764. if $CCAS -c -o conftest.o conftest.s 1>/dev/null 2>&1; then
  765. AC_MSG_RESULT([yes])
  766. AC_DEFINE(ASMALIGN_BALIGN, 1, [ Define if .balign is present. ])
  767. else
  768. AC_MSG_RESULT([no])
  769. # find if .align arg is power-of-two or not
  770. asmalign_exp="unknown"
  771. if test x"$asmalign_exp" = xunknown; then
  772. AC_MSG_CHECKING([if .align takes 2-exponent])
  773. asmalign_exp="no"
  774. echo '.align 3' > conftest.s
  775. if $CCAS -c -o conftest.o conftest.s 1>/dev/null 2>&1; then
  776. asmalign_exp="yes"
  777. AC_MSG_RESULT([yes])
  778. else
  779. AC_MSG_RESULT([no])
  780. fi
  781. rm -f conftest.o conftest.s
  782. fi
  783. if test x"$asmalign_exp" = xyes; then
  784. AC_DEFINE(ASMALIGN_EXP, 1, [ Define if .align takes 3 for alignment of 2^3=8 bytes instead of 8. ])
  785. else
  786. AC_DEFINE(ASMALIGN_BYTE, 1, [ Define if .align just takes byte count. ])
  787. fi
  788. fi
  789. ccalign="unknown"
  790. if test x"$ccalign" = xunknown; then
  791. AC_MSG_CHECKING([__attribute__((aligned(16)))])
  792. ccalign="no"
  793. echo '__attribute__((aligned(16))) float var;' > conftest.c
  794. if $CC -c -o conftest.o conftest.c >/dev/null 2>&1; then
  795. ccalign="yes"
  796. AC_MSG_RESULT([yes])
  797. else
  798. AC_MSG_RESULT([no])
  799. fi
  800. rm -f conftest.o conftest.c
  801. fi
  802. dnl We apply alignment hints only to cpus that need it.
  803. dnl See further below for the definition of CCALIGN
  804. dnl ############## Really basic headers, needed for other checks.
  805. AC_HEADER_STDC
  806. dnl Is it too paranoid to specifically check for stdint.h and limits.h?
  807. 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])
  808. dnl ############## Types
  809. dnl Large file support stuff needs cleanup. There are superfluous variables.
  810. dnl Detect large file support, enable switches if needed.
  811. AC_SYS_LARGEFILE
  812. dnl If we do have a switch for large files, rename off_t-aware API calls.
  813. dnl Using the file_offset_bits variable here is fine for linux (possibly Solaris),
  814. dnl Others... we'll have to see.
  815. dnl Note: I started writing this with with multiline replacements.
  816. dnl Does not work. Automake insists on putting these into Makefiles where they break things.
  817. if test "x$ac_cv_sys_file_offset_bits" = x || echo "$ac_cv_sys_file_offset_bits" | $GREP '@<:@^0-9@:>@' > /dev/null; then
  818. dnl if it has non-numeric chars or is empty... ignore...
  819. LFS_LOBJ=
  820. else
  821. # Add dual-mode wrapper code.
  822. LFS_LOBJ=lfs_wrap.lo
  823. fi
  824. # Using the lower level macros instead of AC_TYPE_* for compatibility with not freshest autoconf.
  825. AC_CHECK_TYPE(size_t, unsigned long)
  826. AC_CHECK_TYPE(uintptr_t, unsigned long)
  827. AC_CHECK_TYPE(ssize_t, long)
  828. AC_CHECK_TYPE(off_t, long int)
  829. AC_CHECK_TYPE(int32_t, int)
  830. AC_CHECK_TYPE(uint32_t, unsigned int)
  831. AC_CHECK_TYPE(int16_t, short)
  832. AC_CHECK_TYPE(uint16_t, unsigned short)
  833. AC_CHECK_SIZEOF(size_t,4)
  834. AC_CHECK_SIZEOF(ssize_t,4)
  835. AC_CHECK_SIZEOF(off_t,4)
  836. AC_CHECK_SIZEOF(int32_t)
  837. AC_CHECK_SIZEOF(long,4)
  838. # The alias functions want to know the native off_t bits.
  839. # "Native" also means large file offsets, if enabled, it's what is native to the mpg123 library.
  840. if test "x$ac_cv_sizeof_long" = "x"; then
  841. AC_MSG_ERROR([Cannot determine sizeof(long)?])
  842. else
  843. LFS_ALIAS_BITS=`expr "$ac_cv_sizeof_long" "*" "8"`
  844. AC_DEFINE_UNQUOTED([LFS_ALIAS_BITS], $LFS_ALIAS_BITS,
  845. [Define this to the size of long type in bits, used for LFS small/native alias functions.])
  846. fi
  847. lfs_alias=enabled
  848. AC_ARG_ENABLE(lfs-alias,
  849. [ --disable-lfs-alias disable alias wrappers for largefile bitness (mpg123_seek_32 in addition to mpg123_seek, mpg123_seek_64 as alias on x86-64) ],
  850. [
  851. if test "x$enableval" = xno; then
  852. lfs_alias="disabled"
  853. fi
  854. ],
  855. [
  856. case $host in
  857. *-cygwin*)
  858. lfs_alias="disabled"
  859. AC_MSG_NOTICE([lfs-alias disabled for Cygwin, use --enable-lfs-alias explicitly to enable, only if you know what you are doing])
  860. ;;
  861. esac
  862. ])
  863. AC_MSG_CHECKING([if we want to enable alias wrappers for largefile])
  864. if test "x$lfs_alias" = "xenabled"; then
  865. AC_MSG_RESULT([yes])
  866. LFS_LOBJ="$LFS_LOBJ lfs_alias.lo"
  867. else
  868. AC_MSG_RESULT([no])
  869. fi
  870. AC_SUBST(LFS_LOBJ)
  871. dnl ############## Function Checks
  872. AC_FUNC_MMAP
  873. # Check if system supports termios
  874. AC_SYS_POSIX_TERMIOS
  875. if test "x$ac_cv_sys_posix_termios" = "xyes"; then
  876. AC_DEFINE_UNQUOTED([HAVE_TERMIOS], 1,
  877. [Define this if you have the POSIX termios library])
  878. fi
  879. AC_CHECK_FUNCS( random )
  880. # Check for sched_setscheduler
  881. AC_CHECK_FUNCS( sched_setscheduler setuid getuid)
  882. # Check for setpriority
  883. AC_CHECK_FUNCS( setpriority )
  884. AC_CHECK_FUNCS( strerror )
  885. AC_CHECK_FUNCS( setlocale nl_langinfo )
  886. AC_CHECK_FUNCS( strdup )
  887. AC_CHECK_FUNCS( atoll )
  888. AC_CHECK_FUNCS( mkfifo, [ have_mkfifo=yes ], [ have_mkfifo=no ] )
  889. dnl ############## Header and Library Checks
  890. # locale headers
  891. AC_CHECK_HEADERS([locale.h langinfo.h])
  892. # Headers for network (http) stuff
  893. network_type=Unknown
  894. AC_CHECK_HEADERS([netdb.h sys/param.h sys/socket.h netinet/in.h arpa/inet.h])
  895. if test "x$ac_cv_header_netdb_h" = "xyes" &&
  896. test "x$ac_cv_header_sys_param_h" = "xyes" &&
  897. test "x$ac_cv_header_sys_socket_h" = "xyes" &&
  898. test "x$ac_cv_header_netinet_in_h" = "xyes" &&
  899. test "x$ac_cv_header_arpa_inet_h" = "xyes"; then
  900. have_network=yes
  901. network_type=Posix
  902. else
  903. have_network=no
  904. fi
  905. dnl trying to get that socket lib settled in one line
  906. AC_SEARCH_LIBS(gethostbyname, nsl socket)
  907. dnl OK, two lines... Solaris needs -lnsl -lsocket
  908. AC_SEARCH_LIBS(socket, socket)
  909. AC_CHECK_FUNCS( getaddrinfo, [ have_ipv6=yes ], [ have_ipv6=no ] )
  910. APR_CHECK_GETADDRINFO_ADDRCONFIG()
  911. # Substitutions for the installable mpg123.h header
  912. if test "x$ac_cv_header_stdio_h" = "xyes"; then
  913. INCLUDE_STDIO_H="#include <stdio.h>"
  914. else
  915. INCLUDE_STDIO_H="/* #include <stdio.h> is not available on this system */"
  916. fi
  917. AC_SUBST(INCLUDE_STDIO_H)
  918. if test "x$ac_cv_header_stdlib_h" = "xyes"; then
  919. INCLUDE_STDLIB_H="#include <stdlib.h>"
  920. else
  921. INCLUDE_STDLIB_H="/* #include <stdlib.h> is not available on this system */"
  922. fi
  923. AC_SUBST(INCLUDE_STDLIB_H)
  924. if test "x$ac_cv_header_sys_types_h" = "xyes"; then
  925. INCLUDE_SYS_TYPE_H="#include <sys/types.h>"
  926. else
  927. INCLUDE_SYS_TYPE_H="/* #include <sys/types.h> is not available on this system */"
  928. fi
  929. AC_SUBST(INCLUDE_SYS_TYPE_H)
  930. # Checks for maths libraries.
  931. AC_CHECK_LIB([m], [sqrt])
  932. AC_CHECK_LIB([mx], [powf])
  933. # attempt to make the signal stuff work... also with GENERIC - later
  934. #if test x"$ac_cv_header_sys_signal_h" = xyes; then
  935. # AC_CHECK_FUNCS( sigemptyset sigaddset sigprocmask sigaction )
  936. # if test x"$ac_cv_func_sigemptyset" = xyes &&
  937. # test x"$ac_cv_func_sigaddset" = xyes &&
  938. # test x"$ac_cv_func_sigprocmask" = xyes &&
  939. # test x"$ac_cv_func_sigaction" = xyes; then
  940. # AC_DEFINE(
  941. #fi
  942. dnl ############## Choose compiler flags and CPU
  943. # do not assume gcc here, so no flags by default
  944. ADD_CFLAGS=""
  945. ADD_CPPFLAGS=""
  946. ADD_LDFLAGS=""
  947. LIBS="$LIBS"
  948. # Consider moving that stuff.
  949. AC_CHECK_HEADER([os2.h], [ADD_CPPFLAGS="$ADD_CPPFLAGS -DOS2"])
  950. # On OS/2, we need to link to os2term to make terminal control actually work.
  951. AC_CHECK_LIB([os2term], [tcsetattr], [ADD_LDFLAGS="$ADD_LDFLAGS -los2term"])
  952. # If debugging is enabled then make warnings errors
  953. if test x"$debugging" = xenabled; then
  954. ADD_CFLAGS="-g"
  955. # gcc specific...
  956. if test x"$GCC" = xyes; then
  957. ADD_CFLAGS="$ADD_CFLAGS -Wall -fno-strict-aliasing"
  958. if test x"$nagging" = xenabled; then
  959. ADD_CFLAGS="$ADD_CFLAGS -Werror -pedantic -DPLAIN_C89"
  960. fi
  961. fi
  962. fi
  963. dnl Only try the attribute_align_arg mumbo-jumbo on x86, x86-64 warns/errors out on that attribute.
  964. dnl ...dunno even what about other architectures.
  965. case $host in
  966. i?86-*)
  967. 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... ])
  968. ;;
  969. esac
  970. s_altivec="synth_altivec dct64_altivec"
  971. s_i386="dct64_i386"
  972. s_i486="$s_i386 synth_i486 dct64_i486"
  973. s_i586="$s_i386 synth_i586"
  974. s_i586d="$s_i386 synth_i586_dither"
  975. s_3dnow="$s_i386 synth_3dnow dct64_3dnow equalizer_3dnow"
  976. s_3dnowext="$s_i386 dct64_3dnowext tabinit_mmx synth_3dnowext"
  977. if test "x$layer3" = "xenabled"; then
  978. s_3dnow="$s_3dnow dct36_3dnow"
  979. s_3dnowext="$s_3dnowext dct36_3dnowext"
  980. fi
  981. s_mmx="$s_i386 dct64_mmx tabinit_mmx synth_mmx"
  982. s_sse="$s_i386 tabinit_mmx dct64_sse dct64_sse_float synth_sse_float synth_stereo_sse_float synth_sse_s32 synth_stereo_sse_s32 "
  983. s_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"
  984. s_x86multi="getcpuflags"
  985. s_dither="dither"
  986. s_neon="dct64_neon dct64_neon_float synth_neon_float synth_neon_s32 synth_stereo_neon_float synth_stereo_neon_s32"
  987. # choose optimized 16bit decoder for SSE, quality or fast
  988. # note: supporting deactivation of output formats for these decoders would need more logic here
  989. if test "x$integers" = "xquality"; then
  990. s_sse="$s_sse synth_sse_accurate synth_stereo_sse_accurate"
  991. s_x86_64="$s_x86_64 synth_x86_64_accurate synth_stereo_x86_64_accurate"
  992. s_arm="synth_arm_accurate"
  993. s_neon="$s_neon synth_neon_accurate synth_stereo_neon_accurate"
  994. else
  995. s_sse="$s_sse synth_sse" # no stereo
  996. s_x86_64="$s_x86_64 synth_x86_64 synth_stereo_x86_64"
  997. s_arm="synth_arm"
  998. s_neon="$s_neon synth_neon synth_stereo_neon"
  999. fi
  1000. dnl CPU specific compiler flags and sources
  1001. case $cpu_type in
  1002. generic)
  1003. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_GENERIC -DREAL_IS_FLOAT"
  1004. more_sources="$s_fpu"
  1005. ccalign=no
  1006. ;;
  1007. generic_dither)
  1008. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_GENERIC_DITHER -DREAL_IS_FLOAT"
  1009. more_sources="$s_fpu $s_dither"
  1010. ccalign=no
  1011. ;;
  1012. dnl Not disabling buffer for float mode... check that this is OK now!
  1013. generic_fpu | generic_float)
  1014. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_GENERIC -DREAL_IS_FLOAT"
  1015. more_sources="$s_fpu"
  1016. ccalign=no
  1017. ;;
  1018. generic_nofpu)
  1019. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_GENERIC -DREAL_IS_FIXED"
  1020. more_sources=
  1021. ccalign=no
  1022. ;;
  1023. ppc_nofpu)
  1024. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_PPC -DREAL_IS_FIXED"
  1025. more_sources=
  1026. ccalign=no
  1027. ;;
  1028. arm_nofpu)
  1029. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_ARM -DREAL_IS_FIXED"
  1030. more_sources="$s_arm"
  1031. ccalign=no
  1032. ;;
  1033. altivec)
  1034. ADD_CFLAGS="$ADD_CFLAGS -maltivec"
  1035. ADD_CPPFLAGS="$ADD_CPPFLAGS -DREAL_IS_FLOAT -DOPT_ALTIVEC"
  1036. more_sources="$s_altivec $s_fpu"
  1037. AC_MSG_CHECKING([if $CC accepts -faltivec])
  1038. touch conftest.c
  1039. if $CC -faltivec -c -o conftest.o conftest.c >/dev/null 2>&1; then
  1040. ADD_CFLAGS="$ADD_CFLAGS -faltivec"
  1041. AC_MSG_RESULT([yes])
  1042. else
  1043. AC_MSG_RESULT([no])
  1044. fi
  1045. rm -f conftest.o conftest.c
  1046. ;;
  1047. neon)
  1048. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_NEON -DREAL_IS_FLOAT"
  1049. more_sources="$s_neon $s_fpu"
  1050. ;;
  1051. i386)
  1052. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_I386 -DREAL_IS_FLOAT"
  1053. more_sources="$s_fpu $s_i386"
  1054. ccalign=no
  1055. ;;
  1056. i386_fpu)
  1057. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_I386 -DREAL_IS_FLOAT"
  1058. more_sources="$s_fpu $s_i386"
  1059. ccalign=no
  1060. ;;
  1061. i386_nofpu)
  1062. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_I386 -DREAL_IS_FIXED"
  1063. more_sources="$s_i386"
  1064. ccalign=no
  1065. ;;
  1066. i486)
  1067. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_I486 -DREAL_IS_FLOAT"
  1068. more_sources="$s_fpu $s_i486"
  1069. ccalign=no
  1070. ;;
  1071. i586)
  1072. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_I586 -DREAL_IS_FLOAT"
  1073. more_sources="$s_fpu $s_i586"
  1074. ;;
  1075. i586_dither)
  1076. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_I586_DITHER -DREAL_IS_FLOAT"
  1077. more_sources="$s_fpu $s_i586d $s_dither"
  1078. ;;
  1079. 3dnow)
  1080. # legacy 3dnow had the 3dnow paired with i586...
  1081. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_MULTI -DOPT_I586 -DOPT_3DNOW -DREAL_IS_FLOAT"
  1082. more_sources="$s_fpu $s_i586 $s_3dnow $s_x86multi "
  1083. ;;
  1084. 3dnow_alone)
  1085. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_3DNOW -DREAL_IS_FLOAT"
  1086. more_sources="$s_fpu $s_3dnow"
  1087. ;;
  1088. 3dnowext_alone)
  1089. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_3DNOWEXT -DREAL_IS_FLOAT"
  1090. more_sources="$s_fpu $s_3dnowext"
  1091. ;;
  1092. 3dnowext)
  1093. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_MULTI -DOPT_3DNOW -DOPT_3DNOWEXT -DREAL_IS_FLOAT"
  1094. more_sources="$s_fpu $s_3dnowext $s_3dnow $s_x86multi"
  1095. ;;
  1096. mmx_alone|mmx)
  1097. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_MMX -DREAL_IS_FLOAT"
  1098. more_sources="$s_fpu $s_mmx"
  1099. ;;
  1100. sse_alone|sse)
  1101. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_SSE -DREAL_IS_FLOAT"
  1102. more_sources="$s_fpu $s_sse"
  1103. ;;
  1104. x86|x86_dither)
  1105. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_MULTI -DOPT_GENERIC -DOPT_GENERIC_DITHER -DOPT_I386 -DOPT_I586 -DOPT_I586_DITHER -DOPT_MMX -DOPT_3DNOW -DOPT_3DNOWEXT -DOPT_SSE -DREAL_IS_FLOAT"
  1106. more_sources="$s_fpu $s_i386 $s_i586 $s_i586d $s_mmx $s_3dnow $s_3dnowext $s_sse $s_x86multi $s_dither"
  1107. ;;
  1108. x86-64_alone)
  1109. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_X86_64 -DREAL_IS_FLOAT"
  1110. more_sources="$s_fpu $s_x86_64"
  1111. ;;
  1112. x86-64|x86-64_all|x86-64_dither)
  1113. ADD_CPPFLAGS="$ADD_CPPFLAGS -DOPT_MULTI -DOPT_X86_64 -DOPT_GENERIC -DOPT_GENERIC_DITHER -DREAL_IS_FLOAT"
  1114. more_sources="$s_fpu $s_x86_64 $s_dither"
  1115. ;;
  1116. *)
  1117. AC_MSG_ERROR([Unknown CPU type '$cpu_type'])
  1118. ;;
  1119. esac
  1120. # Mac OS X specific linker flags
  1121. case $cpu_type in
  1122. 3dnow|3dnow_alone|3dnowext|3dnowext_alone|mmx|mmx_alone|sse|sse_alone|x86|x86_dither)
  1123. case $host in
  1124. i386-apple-darwin8*|*-apple-darwin10*)
  1125. ADD_LDFLAGS="$ADD_LDFLAGS -Wl,-read_only_relocs,suppress"
  1126. ;;
  1127. i386-apple-darwin9*)
  1128. ADD_CFLAGS="$ADD_CFLAGS -mmacosx-version-min=10.4 -isysroot /Developer/SDKs/MacOSX10.4u.sdk"
  1129. ADD_LDFLAGS="$ADD_LDFLAGS -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -Wl,-classic_linker -Wl,-read_only_relocs,suppress"
  1130. ;;
  1131. esac
  1132. ;;
  1133. esac
  1134. # Check if we want feature report function.
  1135. AC_MSG_CHECKING([if we want feature report function])
  1136. feature_report=enabled
  1137. AC_ARG_ENABLE(feature_report,
  1138. [ --disable-feature_report Disable feature report function ],
  1139. [
  1140. if test "x$enableval" = xno; then
  1141. AC_MSG_RESULT([no])
  1142. feature_report=disabled
  1143. else
  1144. AC_MSG_RESULT([yes])
  1145. fi
  1146. ],
  1147. [AC_MSG_RESULT([yes])])
  1148. if test "x$feature_report" = xenabled; then
  1149. more_sources="$more_sources feature"
  1150. fi
  1151. # Return 0 if first arg appears in list of following arguments.
  1152. # Return 1 otherwise.
  1153. word_in_list() {
  1154. word=$1
  1155. shift
  1156. # Avoid naming conflict with the outside!
  1157. # Is local not POSIX sh?
  1158. for given_word in "$@"
  1159. do
  1160. if test "x$word" = "x$given_word"; then
  1161. return 0
  1162. fi
  1163. done
  1164. return 1
  1165. }
  1166. for i in $more_sources
  1167. do
  1168. # Make sure every file is only once in the list.
  1169. word_in_list "$i.\$(OBJEXT)" $DECODER_OBJ || DECODER_OBJ="$DECODER_OBJ $i.\$(OBJEXT)"
  1170. word_in_list "$i.lo" $DECODER_LOBJ || DECODER_LOBJ="$DECODER_LOBJ $i.lo"
  1171. done
  1172. AC_SUBST(DECODER_OBJ)
  1173. AC_SUBST(DECODER_LOBJ)
  1174. dnl Finally insert the code switch for alignment, above cpu selection having possibly changed the setting.
  1175. if test x"$ccalign" = xyes; then
  1176. AC_DEFINE(CCALIGN, 1, [ Define if __attribute__((aligned(16))) shall be used ])
  1177. fi
  1178. dnl ############## Output module choice
  1179. # The full list of supported modules to check, first come, first serve.
  1180. check_modules="alsa oss coreaudio sndio sun win32 os2 esd jack portaudio pulse sdl nas arts openal dummy"
  1181. # Only check qsa before all else on QNX.
  1182. # It would mask ALSA otherwise.
  1183. case $host in
  1184. *-nto-qnx*)
  1185. check_modules="qsa $check_modules"
  1186. ;;
  1187. esac
  1188. # The final list.
  1189. output_modules=
  1190. check_forced=no
  1191. check_failed=no
  1192. if test "x$with_audio" != "x"; then
  1193. check_modules="`echo $with_audio|tr , ' '` dummy"
  1194. echo "Limiting outputs to build according to your preference: $check_modules"
  1195. check_forced=yes
  1196. fi
  1197. PKG_PROG_PKG_CONFIG([])
  1198. # Now go through the modules to check and do the chores.
  1199. for m in $check_modules
  1200. do
  1201. case "$m" in
  1202. dummy)
  1203. AC_MSG_CHECKING([if you are too dumbing dumb for the dummy])
  1204. AC_MSG_RESULT([no])
  1205. output_modules="$output_modules dummy"
  1206. HAVE_DUMMY=yes
  1207. ;;
  1208. oss)
  1209. AC_CHECK_HEADERS([sys/soundcard.h linux/soundcard.h machine/soundcard.h])
  1210. if test "x${ac_cv_header_sys_soundcard_h}" = "xyes" \
  1211. -o "x${ac_cv_header_linux_soundcard_h}" = "xyes" \
  1212. -o "x${ac_cv_header_machine_soundcard_h}" = "xyes";
  1213. then
  1214. output_modules="$output_modules oss"
  1215. HAVE_OSS="yes"
  1216. else
  1217. check_failed=yes
  1218. fi
  1219. ;;
  1220. # QSA and ALSA are not distinguishable in these tests, need to block
  1221. # each other and play with test order depending on platform.
  1222. alsa)
  1223. if test "x$HAVE_QSA" = xyes; then
  1224. HAVE_ALSA=no
  1225. else
  1226. ALSA_LIBS="-lasound"
  1227. # Check for ALSA
  1228. AC_CHECK_LIB( [asound], [snd_pcm_open],
  1229. [ AC_CHECK_HEADER( [alsa/asoundlib.h],
  1230. [ output_modules="$output_modules alsa" HAVE_ALSA="yes"],
  1231. [ AC_MSG_WARN([Found ALSA library but NOT header files on your system]) ] )
  1232. ]
  1233. )
  1234. if test "x$HAVE_ALSA" != xyes; then
  1235. check_failed=yes
  1236. fi
  1237. fi # HAVE_QSA
  1238. ;;
  1239. qsa)
  1240. if test "x$HAVE_ALSA" = xyes; then
  1241. HAVE_QSA=no
  1242. else
  1243. QSA_LIBS="-lasound"
  1244. # Check for QSA
  1245. AC_CHECK_LIB( [asound], [snd_pcm_open],
  1246. [ AC_CHECK_HEADER( [sys/asoundlib.h],
  1247. [ output_modules="$output_modules qsa" HAVE_QSA="yes"],
  1248. [ AC_MSG_WARN([Found QSA library but NOT header files on your system]) ] )
  1249. ]
  1250. )
  1251. if test "x$HAVE_QSA" != xyes; then
  1252. check_failed=yes
  1253. fi
  1254. fi # HAVE_ALSA
  1255. ;;
  1256. jack)
  1257. PKG_CHECK_MODULES(JACK, jack, output_modules="$output_modules jack" HAVE_JACK="yes", HAVE_JACK="no" check_failed=yes)
  1258. ;;
  1259. pulse)
  1260. PKG_CHECK_MODULES(PULSE, libpulse-simple, output_modules="$output_modules pulse" HAVE_PULSE="yes", HAVE_PULSE="no" check_failed=yes)
  1261. ;;
  1262. esd)
  1263. PKG_CHECK_MODULES(ESD, esound, output_modules="$output_modules esd" HAVE_ESD="yes", HAVE_ESD="no" check_failed=yes)
  1264. ;;
  1265. portaudio)
  1266. # Remember: This looks only insane because you chose an insane tab width!
  1267. PORTAUDIO_LIBS="-lportaudio"
  1268. PORTAUDIO_CFLAGS=
  1269. case $host in
  1270. *-*-mingw32)
  1271. # We tested portaudio with MME
  1272. if test "x$HAVE_PORTAUDIO" != "xyes"; then
  1273. AC_CHECK_LIB( [portaudio], [Pa_Initialize],
  1274. [ AC_CHECK_HEADER( [portaudio.h],
  1275. [ output_modules="$output_modules portaudio" HAVE_PORTAUDIO_WINMM="yes" HAVE_PORTAUDIO="yes" ],
  1276. [ AC_MSG_WARN([Found PortAudio library but NOT header files on your system]) ] )
  1277. PORTAUDIO_LIBS="$PORTAUDIO_LIBS -lwinmm"
  1278. ],
  1279. [ HAVE_PORTAUDIO="no"],
  1280. [ -lwinmm ]
  1281. )
  1282. fi
  1283. ;;
  1284. *)
  1285. AC_CHECK_LIB( [portaudio], [Pa_Initialize],
  1286. [ AC_CHECK_HEADER( [portaudio.h],
  1287. [ output_modules="$output_modules portaudio" HAVE_PORTAUDIO="yes" ],
  1288. [ AC_MSG_WARN([Found PortAudio library but NOT header files on your system]) ] )
  1289. ]
  1290. )
  1291. ;;
  1292. esac
  1293. if test "x$HAVE_PORTAUDIO" != xyes; then
  1294. check_failed=yes
  1295. else
  1296. # See if we have v19 or v18
  1297. AC_CHECK_LIB( [portaudio], [Pa_GetVersion], [:], [AC_DEFINE( [PORTAUDIO18], 1, [Define if portaudio v18 API is wanted.]) ], [$PORTAUDIO_LIBS] )
  1298. fi
  1299. ;;
  1300. sdl)
  1301. PKG_CHECK_MODULES(SDL, sdl, output_modules="$output_modules sdl" HAVE_SDL="yes", HAVE_SDL="no" check_failed=yes)
  1302. ;;
  1303. nas)
  1304. NAS_LIBS=-laudio
  1305. AC_CHECK_LIB( [audio], [AuOpenServer],
  1306. [ AC_CHECK_HEADER( [audio/audiolib.h],
  1307. [ output_modules="$output_modules nas" HAVE_NAS="yes"],
  1308. [ AC_MSG_WARN([Found NAS library but NOT header files on your system]) ] )
  1309. ]
  1310. )
  1311. if test "x$HAVE_NAS" != xyes; then
  1312. check_failed=yes
  1313. fi
  1314. ;;
  1315. win32)
  1316. # Check for windows ... and win32 audio
  1317. # Does not work... instead just check for header
  1318. # AC_CHECK_LIB( [winmm], [waveOutOpen] )
  1319. WIN32_LIBS=-lwinmm
  1320. AC_CHECK_HEADERS([windows.h], output_modules="$output_modules win32" HAVE_WIN32=yes, HAVE_WIN32=no check_failed=yes)
  1321. ;;
  1322. sndio)
  1323. SNDIO_LIBS=-lsndio
  1324. AC_CHECK_LIB([sndio], [sio_open],
  1325. [AC_CHECK_HEADERS([sndio.h],
  1326. [output_modules="$output_modules sndio" HAVE_SNDIO="yes"])
  1327. ]
  1328. )
  1329. if test "x$HAVE_SNDIO" != xyes; then
  1330. check_failed=yes
  1331. fi
  1332. ;;
  1333. sun)
  1334. AC_CHECK_HEADERS([sun/audioio.h sys/audioio.h asm/audioio.h sys/audio.h])
  1335. if test "x${ac_cv_header_sun_audioio_h}" = "xyes" \
  1336. -o "x${ac_cv_header_sys_audioio_h}" = "xyes" \
  1337. -o "x${ac_cv_header_asm_audioio_h}" = "xyes";
  1338. then
  1339. output_modules="$output_modules sun"
  1340. HAVE_SUN="yes"
  1341. else
  1342. check_failed=yes
  1343. fi
  1344. ;;
  1345. coreaudio)
  1346. COREAUDIO_LIBS="-framework AudioToolbox -framework AudioUnit -framework CoreServices"
  1347. AC_CHECK_HEADERS([AudioUnit/AudioUnit.h CoreServices/CoreServices.h AudioToolbox/AudioToolbox.h])
  1348. if test "x${ac_cv_header_AudioUnit_AudioUnit_h}" = "xyes" \
  1349. -a "x${ac_cv_header_CoreServices_CoreServices_h}" = "xyes" \
  1350. -a "x${ac_cv_header_AudioToolbox_AudioToolbox_h}" = "xyes";
  1351. then
  1352. if test x"$modules" = xdisabled; then
  1353. AC_MSG_WARN([Disabling buffer because of directly linked CoreAudio! Use the module if you need the buffer.])
  1354. buffer=disabled
  1355. fi
  1356. output_modules="$output_modules coreaudio"
  1357. HAVE_COREAUDIO="yes"
  1358. else
  1359. check_failed=yes
  1360. fi
  1361. ;;
  1362. arts)
  1363. AC_MSG_CHECKING([for artsc])
  1364. if artsc-config; then
  1365. AC_MSG_RESULT([yes])
  1366. output_modules="$output_modules arts"
  1367. HAVE_ARTS=yes
  1368. ARTS_LIBS=`artsc-config --libs`
  1369. ARTS_CFLAGS=`artsc-config --cflags`
  1370. else
  1371. AC_MSG_RESULT([no])
  1372. check_failed=yes
  1373. fi
  1374. ;;
  1375. openal)
  1376. AC_CHECK_HEADERS([OpenAL/al.h OpenAL/alc.h AL/al.h AL/alc.h al.h alc.h])
  1377. if test "x${ac_cv_header_OpenAL_al_h}" = "xyes" \
  1378. -a "x${ac_cv_header_OpenAL_alc_h}" = "xyes";
  1379. then #Mac OS X
  1380. output_modules="$output_modules openal"
  1381. OPENAL_LIBS="-framework OpenAL"
  1382. OPENAL_CFLAGS="-DOPENAL_SUBDIR_OPENAL"
  1383. HAVE_OPENAL="yes"
  1384. elif test "x${ac_cv_header_AL_al_h}" = "xyes" \
  1385. -a "x${ac_cv_header_AL_alc_h}" = "xyes";
  1386. then #Linux
  1387. output_modules="$output_modules openal"
  1388. OPENAL_LIBS="-lopenal"
  1389. OPENAL_CFLAGS="-DOPENAL_SUBDIR_AL"
  1390. HAVE_OPENAL="yes"
  1391. elif test "x${ac_cv_header_al_h}" = "xyes" \
  1392. -a "x${ac_cv_header_alc_h}" = "xyes";
  1393. then #Windows?
  1394. output_modules="$output_modules openal"
  1395. OPENAL_LIBS="-lopenal"
  1396. OPENAL_CFLAGS=""
  1397. HAVE_OPENAL="yes"
  1398. else
  1399. check_failed=yes
  1400. fi
  1401. ;;
  1402. os2)
  1403. OS2_LIBS="-los2me -lmmpm2 -lsocket"
  1404. AC_CHECK_HEADERS([os2.h])
  1405. # os2me.h depends on os2.h
  1406. # Yes, that way of coding it is ugly.
  1407. if test "x${ac_cv_header_os2_h}" = xyes
  1408. then
  1409. # We mimick exactly the way how the header will be used.
  1410. # It seems to be picky...
  1411. AC_CHECK_HEADERS([os2me.h], [], [], [#define INCL_OS2MM
  1412. #define INCL_DOS
  1413. #define INCL_VIO
  1414. #define INCL_KBD
  1415. #include <os2.h>
  1416. #])
  1417. fi
  1418. if test "x${ac_cv_header_os2_h}" = xyes \
  1419. -a "x${ac_cv_header_os2me_h}" = xyes
  1420. then
  1421. output_modules="$output_modules os2"
  1422. HAVE_OS2=yes
  1423. else
  1424. check_failed=yes
  1425. fi
  1426. ;;
  1427. # from here on only forced tests, untested code
  1428. hp)
  1429. # What's the deal with that and alib?
  1430. UNSUPPORTED_AUDIO=yes
  1431. AC_CHECK_HEADER([sys/audio.h], [output_modules="$output_modules hp" HAVE_HP=yes], [check_failed=yes])
  1432. ;;
  1433. alib)
  1434. UNSUPPORTED_AUDIO=yes
  1435. # ALIB_CFLAGS="-I/opt/audio/include"
  1436. ALIB_LIBS=-lAlib
  1437. # These headers may not be all about audio but they are used.
  1438. AC_CHECK_HEADERS([ Alib.h CUlib.h netdb.h netinet/in.h netinet/tcp.h])
  1439. if test "x${ac_cv_header_Alib_h}" = xyes \
  1440. -a "x${ac_cv_header_CUlib_h}" = xyes \
  1441. -a "x${ac_cv_header_netdb_h}" = xyes \
  1442. -a "x${ac_cv_header_netinet_in_h}" = xyes \
  1443. -a "x${ac_cv_header_netinet_tcp_h}" = xyes
  1444. then
  1445. output_modules="$output_modules alib"
  1446. HAVE_ALIB=yes
  1447. else
  1448. check_failed=yes
  1449. fi
  1450. ;;
  1451. mint)
  1452. UNSUPPORTED_AUDIO=yes
  1453. AC_CHECK_HEADERS([audios.h], [output_modules="$output_modules mint" HAVE_MINT=yes], [check_failes=yes])
  1454. ;;
  1455. aix)
  1456. UNSUPPORTED_AUDIO=yes
  1457. AC_CHECK_HEADERS([sys/audio.h], [output_modules="$output_modules aix" HAVE_AIX=yes], [check_failed=yes])
  1458. ;;
  1459. sgi)
  1460. UNSUPPORTED_AUDIO=yes
  1461. SGI_LIBS=-laudio
  1462. AC_CHECK_HEADER([dmedia/audio.h], [output_modules="$output_modules sgi" HAVE_SGI=yes], [check_failed=yes])
  1463. ;;
  1464. *)
  1465. AC_MSG_ERROR([Unsupported/-known output '$m' demanded!])
  1466. ;;
  1467. esac
  1468. done
  1469. if test "x$check_forced" = xyes -a "x$UNSUPPORTED_AUDIO" = xyes; then
  1470. AC_MSG_WARN([You requested bulding of an unsupported audio module. Be prepared for happy hacking and please tell us about your experience!])
  1471. fi
  1472. if test "x$check_forced" = xyes -a "x$check_failed" = "xyes"; then
  1473. AC_MSG_ERROR([One/some of your requested audio modules failed the test!])
  1474. fi
  1475. # When you extend check_modules, you should extend this:
  1476. #for i in alsa oss coreaudio sndio sun win32 esd jack portaudio pulse sdl nas aix alib arts hp os2 sgi mint openal dummy; do echo $i; done |
  1477. #perl -ne 'chomp; $big = uc($_); print <<EOT;
  1478. #AC_SUBST(${big}_LIBS)
  1479. #AC_SUBST(${big}_LDFLAGS)
  1480. #AC_SUBST(${big}_CFLAGS)
  1481. #AM_CONDITIONAL( [HAVE_$big], [test "x\$HAVE_$big" = xyes] )
  1482. #EOT
  1483. #'
  1484. AC_SUBST(ALSA_LIBS)
  1485. AC_SUBST(ALSA_LDFLAGS)
  1486. AC_SUBST(ALSA_CFLAGS)
  1487. AM_CONDITIONAL( [HAVE_ALSA], [test "x$HAVE_ALSA" = xyes] )
  1488. AC_SUBST(QSA_LIBS)
  1489. AC_SUBST(QSA_LDFLAGS)
  1490. AC_SUBST(QSA_CFLAGS)
  1491. AM_CONDITIONAL( [HAVE_QSA], [test "x$HAVE_QSA" = xyes] )
  1492. AC_SUBST(OSS_LIBS)
  1493. AC_SUBST(OSS_LDFLAGS)
  1494. AC_SUBST(OSS_CFLAGS)
  1495. AM_CONDITIONAL( [HAVE_OSS], [test "x$HAVE_OSS" = xyes] )
  1496. AC_SUBST(COREAUDIO_LIBS)
  1497. AC_SUBST(COREAUDIO_LDFLAGS)
  1498. AC_SUBST(COREAUDIO_CFLAGS)
  1499. AM_CONDITIONAL( [HAVE_COREAUDIO], [test "x$HAVE_COREAUDIO" = xyes] )
  1500. AC_SUBST(SNDIO_LIBS)
  1501. AC_SUBST(SNDIO_LDFLAGS)
  1502. AC_SUBST(SNDIO_CFLAGS)
  1503. AM_CONDITIONAL( [HAVE_SNDIO], [test "x$HAVE_SNDIO" = xyes] )
  1504. AC_SUBST(SUN_LIBS)
  1505. AC_SUBST(SUN_LDFLAGS)
  1506. AC_SUBST(SUN_CFLAGS)
  1507. AM_CONDITIONAL( [HAVE_SUN], [test "x$HAVE_SUN" = xyes] )
  1508. AC_SUBST(WIN32_LIBS)
  1509. AC_SUBST(WIN32_LDFLAGS)
  1510. AC_SUBST(WIN32_CFLAGS)
  1511. AM_CONDITIONAL( [HAVE_WIN32], [test "x$HAVE_WIN32" = xyes] )
  1512. AC_SUBST(ESD_LIBS)
  1513. AC_SUBST(ESD_LDFLAGS)
  1514. AC_SUBST(ESD_CFLAGS)
  1515. AM_CONDITIONAL( [HAVE_ESD], [test "x$HAVE_ESD" = xyes] )
  1516. AC_SUBST(JACK_LIBS)
  1517. AC_SUBST(JACK_LDFLAGS)
  1518. AC_SUBST(JACK_CFLAGS)
  1519. AM_CONDITIONAL( [HAVE_JACK], [test "x$HAVE_JACK" = xyes] )
  1520. AC_SUBST(PORTAUDIO_LIBS)
  1521. AC_SUBST(PORTAUDIO_LDFLAGS)
  1522. AC_SUBST(PORTAUDIO_CFLAGS)
  1523. AM_CONDITIONAL( [HAVE_PORTAUDIO], [test "x$HAVE_PORTAUDIO" = xyes] )
  1524. AC_SUBST(PULSE_LIBS)
  1525. AC_SUBST(PULSE_LDFLAGS)
  1526. AC_SUBST(PULSE_CFLAGS)
  1527. AM_CONDITIONAL( [HAVE_PULSE], [test "x$HAVE_PULSE" = xyes] )
  1528. AC_SUBST(SDL_LIBS)
  1529. AC_SUBST(SDL_LDFLAGS)
  1530. AC_SUBST(SDL_CFLAGS)
  1531. AM_CONDITIONAL( [HAVE_SDL], [test "x$HAVE_SDL" = xyes] )
  1532. AC_SUBST(NAS_LIBS)
  1533. AC_SUBST(NAS_LDFLAGS)
  1534. AC_SUBST(NAS_CFLAGS)
  1535. AM_CONDITIONAL( [HAVE_NAS], [test "x$HAVE_NAS" = xyes] )
  1536. AC_SUBST(AIX_LIBS)
  1537. AC_SUBST(AIX_LDFLAGS)
  1538. AC_SUBST(AIX_CFLAGS)
  1539. AM_CONDITIONAL( [HAVE_AIX], [test "x$HAVE_AIX" = xyes] )
  1540. AC_SUBST(ALIB_LIBS)
  1541. AC_SUBST(ALIB_LDFLAGS)
  1542. AC_SUBST(ALIB_CFLAGS)
  1543. AM_CONDITIONAL( [HAVE_ALIB], [test "x$HAVE_ALIB" = xyes] )
  1544. AC_SUBST(ARTS_LIBS)
  1545. AC_SUBST(ARTS_LDFLAGS)
  1546. AC_SUBST(ARTS_CFLAGS)
  1547. AM_CONDITIONAL( [HAVE_ARTS], [test "x$HAVE_ARTS" = xyes] )
  1548. AC_SUBST(HP_LIBS)
  1549. AC_SUBST(HP_LDFLAGS)
  1550. AC_SUBST(HP_CFLAGS)
  1551. AM_CONDITIONAL( [HAVE_HP], [test "x$HAVE_HP" = xyes] )
  1552. AC_SUBST(OS2_LIBS)
  1553. AC_SUBST(OS2_LDFLAGS)
  1554. AC_SUBST(OS2_CFLAGS)
  1555. AM_CONDITIONAL( [HAVE_OS2], [test "x$HAVE_OS2" = xyes] )
  1556. AC_SUBST(SGI_LIBS)
  1557. AC_SUBST(SGI_LDFLAGS)
  1558. AC_SUBST(SGI_CFLAGS)
  1559. AM_CONDITIONAL( [HAVE_SGI], [test "x$HAVE_SGI" = xyes] )
  1560. AC_SUBST(MINT_LIBS)
  1561. AC_SUBST(MINT_LDFLAGS)
  1562. AC_SUBST(MINT_CFLAGS)
  1563. AM_CONDITIONAL( [HAVE_MINT], [test "x$HAVE_MINT" = xyes] )
  1564. AC_SUBST(OPENAL_LIBS)
  1565. AC_SUBST(OPENAL_LDFLAGS)
  1566. AC_SUBST(OPENAL_CFLAGS)
  1567. AM_CONDITIONAL( [HAVE_OPENAL], [test "x$HAVE_OPENAL" = xyes] )
  1568. AC_SUBST(DUMMY_LIBS)
  1569. AC_SUBST(DUMMY_LDFLAGS)
  1570. AC_SUBST(DUMMY_CFLAGS)
  1571. AM_CONDITIONAL( [HAVE_DUMMY], [test "x$HAVE_DUMMY" = xyes] )
  1572. # Did user choose default audio subsystem ?
  1573. if test "x$with_default_audio" != "x"; then
  1574. default_output_module=$with_default_audio
  1575. else
  1576. default_output_module=`echo "$output_modules" | $AWK '{ print $1 }'`
  1577. fi
  1578. # That's (beginning of) the list for mpg123's internal default.
  1579. default_output_modules=$default_output_module
  1580. OUTPUT_OBJ=
  1581. OUTPUT_MOD=
  1582. OUTPUT_CFLAGS=
  1583. OUTPUT_LIBS=
  1584. OUTPUT_LDFLAGS=
  1585. # Setup the static build.
  1586. if test "x$modules" = xdisabled
  1587. then
  1588. echo "Preparing static output $default_output_module"
  1589. OUTPUT_MOD="$default_output_module"
  1590. OUTPUT_OBJ="output/$default_output_module.\$(OBJEXT)"
  1591. OUTPUT_CFLAGS=
  1592. OUTPUT_LIBS=
  1593. # That feels stupid... what about hashed arrays?
  1594. case $OUTPUT_MOD in
  1595. # Here's a script for that tedious list, perhaps to be outsourced together with the one in src/output/Makefile.am
  1596. #for i in alsa coreaudio esd jack nas oss portaudio pulse sdl sndio sun win32 aix alib arts hp os2 sgi mint; do echo $i; done |
  1597. #perl -ne 'chomp; $big = uc($_); print <<EOT;
  1598. # $_)
  1599. # OUTPUT_LIBS="\$${big}_LIBS"
  1600. # OUTPUT_LDFLAGS="\$${big}_LDFLAGS"
  1601. # OUTPUT_CFLAGS="\$${big}_CFLAGS"
  1602. # ;;
  1603. #EOT
  1604. #'
  1605. alsa)
  1606. OUTPUT_LIBS="$ALSA_LIBS"
  1607. OUTPUT_LDFLAGS="$ALSA_LDFLAGS"
  1608. OUTPUT_CFLAGS="$ALSA_CFLAGS"
  1609. ;;
  1610. qsa)
  1611. OUTPUT_LIBS="$QSA_LIBS"
  1612. OUTPUT_LDFLAGS="$QSA_LDFLAGS"
  1613. OUTPUT_CFLAGS="$QSA_CFLAGS"
  1614. ;;
  1615. coreaudio)
  1616. OUTPUT_LIBS="$COREAUDIO_LIBS"
  1617. OUTPUT_LDFLAGS="$COREAUDIO_LDFLAGS"
  1618. OUTPUT_CFLAGS="$COREAUDIO_CFLAGS"
  1619. ;;
  1620. esd)
  1621. OUTPUT_LIBS="$ESD_LIBS"
  1622. OUTPUT_LDFLAGS="$ESD_LDFLAGS"
  1623. OUTPUT_CFLAGS="$ESD_CFLAGS"
  1624. ;;
  1625. jack)
  1626. OUTPUT_LIBS="$JACK_LIBS"
  1627. OUTPUT_LDFLAGS="$JACK_LDFLAGS"
  1628. OUTPUT_CFLAGS="$JACK_CFLAGS"
  1629. ;;
  1630. nas)
  1631. OUTPUT_LIBS="$NAS_LIBS"
  1632. OUTPUT_LDFLAGS="$NAS_LDFLAGS"
  1633. OUTPUT_CFLAGS="$NAS_CFLAGS"
  1634. ;;
  1635. oss)
  1636. OUTPUT_LIBS="$OSS_LIBS"
  1637. OUTPUT_LDFLAGS="$OSS_LDFLAGS"
  1638. OUTPUT_CFLAGS="$OSS_CFLAGS"
  1639. ;;
  1640. portaudio)
  1641. OUTPUT_LIBS="$PORTAUDIO_LIBS"
  1642. OUTPUT_LDFLAGS="$PORTAUDIO_LDFLAGS"
  1643. OUTPUT_CFLAGS="$PORTAUDIO_CFLAGS"
  1644. ;;
  1645. pulse)
  1646. OUTPUT_LIBS="$PULSE_LIBS"
  1647. OUTPUT_LDFLAGS="$PULSE_LDFLAGS"
  1648. OUTPUT_CFLAGS="$PULSE_CFLAGS"
  1649. ;;
  1650. sdl)
  1651. OUTPUT_LIBS="$SDL_LIBS"
  1652. OUTPUT_LDFLAGS="$SDL_LDFLAGS"
  1653. OUTPUT_CFLAGS="$SDL_CFLAGS"
  1654. ;;
  1655. sndio)
  1656. OUTPUT_LIBS="$SNDIO_LIBS"
  1657. OUTPUT_LDFLAGS="$SNDIO_LDFLAGS"
  1658. OUTPUT_CFLAGS="$SNDIO_CFLAGS"
  1659. ;;
  1660. sun)
  1661. OUTPUT_LIBS="$SUN_LIBS"
  1662. OUTPUT_LDFLAGS="$SUN_LDFLAGS"
  1663. OUTPUT_CFLAGS="$SUN_CFLAGS"
  1664. ;;
  1665. win32)
  1666. OUTPUT_LIBS="$WIN32_LIBS"
  1667. OUTPUT_LDFLAGS="$WIN32_LDFLAGS"
  1668. OUTPUT_CFLAGS="$WIN32_CFLAGS"
  1669. ;;
  1670. aix)
  1671. OUTPUT_LIBS="$AIX_LIBS"
  1672. OUTPUT_LDFLAGS="$AIX_LDFLAGS"
  1673. OUTPUT_CFLAGS="$AIX_CFLAGS"
  1674. ;;
  1675. alib)
  1676. OUTPUT_LIBS="$ALIB_LIBS"
  1677. OUTPUT_LDFLAGS="$ALIB_LDFLAGS"
  1678. OUTPUT_CFLAGS="$ALIB_CFLAGS"
  1679. ;;
  1680. arts)
  1681. OUTPUT_LIBS="$ARTS_LIBS"
  1682. OUTPUT_LDFLAGS="$ARTS_LDFLAGS"
  1683. OUTPUT_CFLAGS="$ARTS_CFLAGS"
  1684. ;;
  1685. hp)
  1686. OUTPUT_LIBS="$HP_LIBS"
  1687. OUTPUT_LDFLAGS="$HP_LDFLAGS"
  1688. OUTPUT_CFLAGS="$HP_CFLAGS"
  1689. ;;
  1690. os2)
  1691. OUTPUT_LIBS="$OS2_LIBS"
  1692. OUTPUT_LDFLAGS="$OS2_LDFLAGS"
  1693. OUTPUT_CFLAGS="$OS2_CFLAGS"
  1694. ;;
  1695. sgi)
  1696. OUTPUT_LIBS="$SGI_LIBS"
  1697. OUTPUT_LDFLAGS="$SGI_LDFLAGS"
  1698. OUTPUT_CFLAGS="$SGI_CFLAGS"
  1699. ;;
  1700. mint)
  1701. OUTPUT_LIBS="$MINT_LIBS"
  1702. OUTPUT_LDFLAGS="$MINT_LDFLAGS"
  1703. OUTPUT_CFLAGS="$MINT_CFLAGS"
  1704. ;;
  1705. openal)
  1706. OUTPUT_LIBS="$OPENAL_LIBS"
  1707. OUTPUT_LDFLAGS="$OPENAL_LDFLAGS"
  1708. OUTPUT_CFLAGS="$OPENAL_CFLAGS"
  1709. ;;
  1710. esac
  1711. else
  1712. # Now make a comma-separated list again... eliminating the possible duplicate and dummy.
  1713. for i in $output_modules
  1714. do
  1715. if test $i != $default_output_module && test $i != dummy; then
  1716. default_output_modules=$default_output_modules,$i
  1717. fi
  1718. done
  1719. fi
  1720. AC_DEFINE_UNQUOTED( DEFAULT_OUTPUT_MODULE, "$default_output_modules", [The default audio output module(s) to use] )
  1721. AC_SUBST(OUTPUT_OBJ)
  1722. AC_SUBST(OUTPUT_MOD)
  1723. AC_SUBST(OUTPUT_CFLAGS)
  1724. AC_SUBST(OUTPUT_LIBS)
  1725. AC_SUBST(OUTPUT_LDFLAGS)
  1726. dnl ############## Compiler Optimizations
  1727. CFLAGS="$ADD_CFLAGS $CFLAGS"
  1728. if test x"$buffer" = xdisabled; then
  1729. ADD_CPPFLAGS="$ADD_CPPFLAGS -DNOXFERMEM"
  1730. fi
  1731. if test x"$newoldwritesample" = xenabled; then
  1732. ADD_CPPFLAGS="$ADD_CPPFLAGS -DNEWOLD_WRITE_SAMPLE"
  1733. fi
  1734. CPPFLAGS="$ADD_CPPFLAGS $CPPFLAGS"
  1735. LDFLAGS="$ADD_LDFLAGS $LDFLAGS"
  1736. # None chosen?
  1737. if test "x$with_optimization" = "x"; then
  1738. if test x"$debugging" = xenabled; then
  1739. with_optimization="0"
  1740. else
  1741. # enable (gcc specific) default opts only with gcc
  1742. if test "x$GCC" = xyes; then
  1743. with_optimization="2"
  1744. else
  1745. with_optimization="0"
  1746. fi
  1747. fi
  1748. fi
  1749. case $with_optimization in
  1750. 0)
  1751. # No Optimizations
  1752. CFLAGS="$CFLAGS"
  1753. ;;
  1754. 1)
  1755. CFLAGS="-O $CFLAGS"
  1756. ;;
  1757. 2)
  1758. CFLAGS="-O2 -fomit-frame-pointer -funroll-all-loops -finline-functions -ffast-math $CFLAGS"
  1759. ;;
  1760. 3)
  1761. CFLAGS="-O3 -fomit-frame-pointer -funroll-all-loops -finline-functions -ffast-math $CFLAGS"
  1762. ;;
  1763. 4)
  1764. CFLAGS="-O4 -fomit-frame-pointer -funroll-all-loops -finline-functions -ffast-math $CFLAGS"
  1765. ;;
  1766. *)
  1767. AC_MSG_ERROR([Unknown optimizations level '$with_optimization'])
  1768. ;;
  1769. esac
  1770. dnl If using gcc, prevent a bad alignment option from breaking things.
  1771. dnl Let's default to safe 16-byte alignment for any special x86 or altivec stuff.
  1772. if test "x$GCC" = xyes && echo "$CFLAGS" | $GREP 'mpreferred-stack-boundary=' > /dev/null; then
  1773. case $cpu_type in
  1774. x86 | i586* | mmx | sse | 3dnow* | altivec)
  1775. AC_MSG_WARN( [ You are trying to mess with stack alignment. I know better. ] )
  1776. CFLAGS="$CFLAGS -mpreferred-stack-boundary=4"
  1777. ;;
  1778. esac
  1779. fi
  1780. dnl ############## Seektable size
  1781. if test "x$with_seektable" = "x"; then
  1782. seektable=1000
  1783. else
  1784. seektable=$with_seektable
  1785. fi
  1786. if test "$seektable" -gt 0; then
  1787. AC_DEFINE(FRAME_INDEX, 1, [ Define if frame index should be used. ])
  1788. fi
  1789. # Define that always... also without frame index enabled.
  1790. AC_DEFINE_UNQUOTED(INDEX_SIZE, $seektable, [size of the frame index seek table])
  1791. dnl ############## Win32 function checks
  1792. # Check if we want Unicode for Win32. Cygwin does not need _wopen
  1793. win32_specific_codes=disabled
  1794. win32_unicode=unneeded
  1795. win32_sockets=disabled
  1796. win32_sockets_working=no
  1797. win32_wide_working=no
  1798. win32_winver_bump=no
  1799. AC_CHECK_HEADERS([windows.h], [win32_specific_codes=enabled])
  1800. if test "x$win32_specific_codes" = xenabled && test "x$host_os" != "xcygwin"; then
  1801. #### Check for Wide functions
  1802. AC_CHECK_FUNC([_wopen], [win32_unicode=enabled],[win32_unicode=disabled])
  1803. AC_MSG_CHECKING([if we want Unicode File Open for Win32])
  1804. if test "x$win32_unicode" = xenabled; then
  1805. AC_MSG_RESULT([yes])
  1806. AC_MSG_CHECKING([if Unicode functions working])
  1807. AC_LINK_IFELSE([AC_LANG_SOURCE([
  1808. #include <windows.h>
  1809. #include <stdlib.h>
  1810. int main()
  1811. {
  1812. MultiByteToWideChar (0, 0, NULL, 0, NULL, 0);
  1813. WideCharToMultiByte (0, 0, NULL, 0, NULL, 0, NULL, NULL);
  1814. return 0;
  1815. }
  1816. ])], [win32_wide_working=yes], [win32_winver_bump=yes])
  1817. if test "x$win32_wide_working" = xno; then
  1818. AC_LINK_IFELSE([AC_LANG_SOURCE([
  1819. #define WINVER 0x501
  1820. #define _WIN32_WINNT 0x501
  1821. #include <windows.h>
  1822. #include <stdlib.h>
  1823. int main()
  1824. {
  1825. MultiByteToWideChar (0, 0, NULL, 0, NULL, 0);
  1826. WideCharToMultiByte (0, 0, NULL, 0, NULL, 0, NULL, NULL);
  1827. return 0;
  1828. }
  1829. ])], [win32_wide_working=yes], [AC_MSG_RESULT([no])])
  1830. fi
  1831. if test "x$win32_wide_working" = xyes; then
  1832. AC_MSG_RESULT([yes])
  1833. AC_DEFINE([WANT_WIN32_UNICODE], [1], [ Define to use Unicode for Windows ])
  1834. fi
  1835. else
  1836. AC_MSG_WARN([Unicode File Open for Win32 disabled])
  1837. fi
  1838. #### Check for Network functions
  1839. AC_CHECK_HEADERS([ws2tcpip.h], [win32_sockets=enabled], [AC_MSG_WARN([Please update your headers to support winsock 2.2.])])
  1840. AC_MSG_CHECKING([if we want Win32 sockets])
  1841. if test "x$win32_sockets" = "xenabled" && test "x$network" != "xdisabled"; then
  1842. AC_MSG_RESULT([yes])
  1843. AC_MSG_CHECKING([if winsock2 API is available])
  1844. wsoldlibs="$LIBS"
  1845. LIBS="$LIBS -lws2_32"
  1846. AC_LINK_IFELSE([AC_LANG_SOURCE([
  1847. #include <winsock2.h>
  1848. #include <ws2tcpip.h>
  1849. #include <stdlib.h>
  1850. int main()
  1851. {
  1852. getaddrinfo(NULL, NULL, NULL, NULL);
  1853. freeaddrinfo(NULL);
  1854. return 0;
  1855. }
  1856. ])], [win32_sockets_working=yes], [win32_winver_bump=yes])
  1857. if test "x$win32_sockets_working" = "xno"; then
  1858. AC_MSG_CHECKING([deeper if winsock2 API is available])
  1859. AC_LINK_IFELSE([AC_LANG_SOURCE([
  1860. #define WINVER 0x501
  1861. #define _WIN32_WINNT 0x501
  1862. #include <winsock2.h>
  1863. #include <ws2tcpip.h>
  1864. #include <stdlib.h>
  1865. int main()
  1866. {
  1867. getaddrinfo(NULL, NULL, NULL, NULL);
  1868. freeaddrinfo(NULL);
  1869. return 0;
  1870. }
  1871. ])], [win32_sockets_working=yes], [AC_MSG_RESULT([no])])
  1872. fi
  1873. if test "x$win32_sockets_working" = "xyes"; then
  1874. AC_MSG_RESULT([yes])
  1875. AC_DEFINE([WANT_WIN32_SOCKETS], [1], [ Define to use Win32 sockets ])
  1876. network_type=Winsock2
  1877. have_network=yes
  1878. have_ipv6=yes
  1879. else
  1880. LIBS="$wsoldlibs"
  1881. AC_MSG_WARN([Please update your headers to support winsock 2.2.])
  1882. fi
  1883. else
  1884. AC_MSG_RESULT([no])
  1885. fi
  1886. #### Check for Win32 Named Pipe functions
  1887. win32_fifo_working=no
  1888. if test x$win32_specific_codes = xenabled; then
  1889. AC_MSG_CHECKING([if we have Named Pipes])
  1890. if test "x$fifo" != "xdisabled"; then
  1891. AC_LINK_IFELSE([AC_LANG_SOURCE([
  1892. #include <windows.h>
  1893. int main(){
  1894. CreateNamedPipeA(NULL,PIPE_ACCESS_DUPLEX|FILE_FLAG_OVERLAPPED,PIPE_TYPE_BYTE,1,255,255,0,NULL);
  1895. CreateNamedPipeW(NULL,PIPE_ACCESS_DUPLEX|FILE_FLAG_OVERLAPPED,PIPE_TYPE_BYTE,1,255,255,0,NULL);
  1896. return 0;
  1897. }])],[win32_fifo_working=yes],[win32_winver_bump=yes])
  1898. if test "x$win32_fifo_working" != "xyes"; then
  1899. AC_LINK_IFELSE([AC_LANG_SOURCE([
  1900. #define WINVER 0x501
  1901. #define _WIN32_WINNT 0x501
  1902. #include <windows.h>
  1903. int main(){
  1904. CreateNamedPipeA(NULL,PIPE_ACCESS_DUPLEX|FILE_FLAG_OVERLAPPED,PIPE_TYPE_BYTE,1,255,255,0,NULL);
  1905. CreateNamedPipeW(NULL,PIPE_ACCESS_DUPLEX|FILE_FLAG_OVERLAPPED,PIPE_TYPE_BYTE,1,255,255,0,NULL);
  1906. return 0;
  1907. }])],[win32_fifo_working=yes],[win32_fifo_working=no])
  1908. fi
  1909. fi
  1910. have_mkfifo=$win32_fifo_working
  1911. if test "x$win32_fifo_working" = "xyes"; then
  1912. AC_MSG_RESULT([yes])
  1913. AC_DEFINE([WANT_WIN32_FIFO], [1], [ Define to use Win32 named pipes ])
  1914. else
  1915. AC_MSG_RESULT([no])
  1916. fi
  1917. fi
  1918. #### WINVER Bump
  1919. if test x$win32_specific_codes = xenabled; then
  1920. AC_MSG_CHECKING([if WINVER and _WIN32_WINNT needs version bumps])
  1921. if test "x$win32_winver_bump" = "xyes"; then
  1922. AC_MSG_RESULT([yes])
  1923. AC_DEFINE([WINVER], [0x0501], [ WinXP and above for ipv6 ])
  1924. AC_DEFINE([_WIN32_WINNT], [0x0501], [ WinXP and above for ipv6 ])
  1925. # getaddrinfo and freeaddrinfo are available for Win2K and above
  1926. # Bug: MinGW.org w32api ws2tcpip.h incorrectly wants (_WIN32_WINNT >= 0x0501) for getaddrinfo and freeaddrinfo
  1927. # MultiByteToWideChar and WideCharToMultiByte are available for Win2K and above
  1928. else
  1929. AC_MSG_RESULT([no])
  1930. fi
  1931. fi
  1932. fi #END OF WIN32 CHECKS
  1933. #### Check mingw.org for EOVERFLOW
  1934. AC_MSG_CHECKING([if we have EOVERFLOW macro])
  1935. AC_COMPILE_IFELSE([AC_LANG_SOURCE([
  1936. #include <errno.h>
  1937. int i = (EOVERFLOW) + 0;
  1938. ])],[eoverflow_present=yes],[eoverflow_present=no])
  1939. AC_MSG_RESULT([$eoverflow_present])
  1940. AS_IF([test "x$eoverflow_present" = "xyes"],[],[AC_DEFINE([EOVERFLOW],[EFBIG],[Use EFBIG as substitude for EOVERFLOW, mingw.org may lack the latter])])
  1941. #### Use Win32 support codes
  1942. AM_CONDITIONAL([WIN32_CODES], [ test "x$win32_specific_codes" = xenabled ])
  1943. if test x"$network" = xauto; then
  1944. if test x"$have_network" = xyes; then
  1945. network=enabled
  1946. else
  1947. network=disabled
  1948. fi
  1949. fi
  1950. if test x"$ipv6" = xauto; then
  1951. if test x"$have_ipv6" = xyes; then
  1952. ipv6=enabled
  1953. else
  1954. ipv6=disabled
  1955. fi
  1956. fi
  1957. dnl ############## FIFO enable
  1958. if test x"$fifo" = xauto; then
  1959. if test x"$have_mkfifo" = xyes; then
  1960. fifo=enabled
  1961. else
  1962. fifo=disabled
  1963. fi
  1964. fi
  1965. if test x"$fifo" = xenabled; then
  1966. AC_DEFINE(FIFO, 1, [ Define if FIFO support is enabled. ])
  1967. if test x"$have_mkfifo" = xno; then
  1968. AC_MSG_WARN( [ You forced FIFO code while I think there is no mkfifo() available! ] )
  1969. fi
  1970. fi
  1971. dnl ############## Network enable
  1972. if test x"$network" = xenabled; then
  1973. AC_DEFINE(NETWORK, 1, [ Define if network support is enabled. ])
  1974. if test x"$have_network" = xno; then
  1975. AC_MSG_WARN( [ You forced network code while I think there is support missing! ] )
  1976. fi
  1977. fi
  1978. if test x"$ipv6" = xenabled; then
  1979. AC_DEFINE(IPV6, 1, [ Define if IPV6 support is enabled. ])
  1980. if test x"$have_ipv6" = xno; then
  1981. AC_MSG_WARN( [ You forced IPv6 code while I think there is no getaddrinfo() available! ] )
  1982. fi
  1983. fi
  1984. dnl ############## Final Output
  1985. # Do that here to prevent the above tests usign -lltdl...
  1986. if test "x$modules" = xenabled; then
  1987. LIBS="-lltdl $LIBS"
  1988. fi
  1989. AC_CONFIG_FILES([
  1990. Makefile
  1991. libmpg123.pc
  1992. mpg123.spec
  1993. doc/Makefile
  1994. src/Makefile
  1995. src/output/Makefile
  1996. src/libmpg123/Makefile
  1997. src/libmpg123/mpg123.h
  1998. ])
  1999. AC_OUTPUT
  2000. dnl ############## Display Message
  2001. echo "
  2002. $PACKAGE_NAME $PACKAGE_VERSION
  2003. Install path ............ $prefix
  2004. CPU Optimization ........ $cpu_type
  2005. Compiler Optimization ... $with_optimization
  2006. Gapless Support ......... $gapless
  2007. Debugging ............... $debugging
  2008. Seek table size ......... $seektable
  2009. FIFO support ............ $fifo
  2010. Buffer .................. $buffer
  2011. Network (http streams) .. $network
  2012. Network Sockets ......... $network_type
  2013. IPv6 (getaddrinfo) ...... $ipv6"
  2014. if test x"$LARGEFILE_BITS" = x; then
  2015. echo " File offsets ............ default"
  2016. else
  2017. echo " File offsets ............ $LARGEFILE_BITS"
  2018. echo " The lib will (try to) support default offset size, too."
  2019. fi
  2020. echo " LFS alias symbols ....... $lfs_alias ($LFS_ALIAS_BITS)"
  2021. echo -n "
  2022. Core libmpg123 features:
  2023. Integer conversion ...... $integers
  2024. New/old WRITE_SAMPLE .... $newoldwritesample
  2025. Layer I ................. $layer1
  2026. Layer II ................ $layer2
  2027. Layer III ............... $layer3
  2028. NtoM resampling ......... $ntom
  2029. downsampled decoding .... $downsample
  2030. Feeder/buffered input ... $feeder
  2031. ID3v2 parsing ........... $id3v2
  2032. String API .............. $string
  2033. ICY parsing/conversion .. $icy
  2034. Error/warning messages .. $messages
  2035. Win32 Unicode File Open.. $win32_unicode
  2036. Feature Report Function.. $feature_report
  2037. Output formats (nofpu will disable all but 16 or 8 bit!):
  2038. 8 bit integer ........... $int8
  2039. 16 bit integer .......... $int16
  2040. 32/24 bit integer ....... $int32
  2041. real (32 bit float) ..... $real
  2042. 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.
  2043. "
  2044. # just an empty line
  2045. echo
  2046. echo " Modules ................. $modules"
  2047. echo " Module suffix ........... $with_module_suffix"
  2048. echo " Checked audio modules ... $check_modules
  2049. Detected audio support ..$output_modules
  2050. Default output module ... $default_output_module
  2051. "
  2052. if test x"$modules" = xdisabled; then
  2053. echo "The _single_ active output module is being statically linked in.
  2054. "
  2055. fi
  2056. if test x"$with_optimization" = x0; then
  2057. echo "No optimization flags chosen, make sure you have something basic in your CFLAGS at least...
  2058. "
  2059. fi
  2060. if test x"$debugging" = xenabled; then
  2061. echo "CFLAGS='$CFLAGS'"
  2062. echo "LIBS='$LIBS'"
  2063. else
  2064. echo "Next type 'make' and then 'make install'."
  2065. fi