configure.ac 184 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008
  1. dnl Process this file with autoconf to produce a configure script.
  2. AC_PREREQ([2.65])
  3. AC_INIT
  4. AC_CONFIG_SRCDIR([src/SDL.c])
  5. AC_CONFIG_HEADERS([include/SDL_config.h])
  6. AC_CONFIG_AUX_DIR([build-scripts])
  7. AC_CONFIG_MACRO_DIR([acinclude])
  8. dnl Save the CFLAGS to see whether they were passed in or generated
  9. orig_CFLAGS="$CFLAGS"
  10. dnl Set various version strings - taken gratefully from the GTk sources
  11. # See docs/release_checklist.md
  12. SDL_MAJOR_VERSION=2
  13. SDL_MINOR_VERSION=32
  14. SDL_MICRO_VERSION=8
  15. SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
  16. SDL_BINARY_AGE=`expr $SDL_MINOR_VERSION \* 100 + $SDL_MICRO_VERSION`
  17. AS_CASE(["$SDL_MINOR_VERSION"],
  18. [*@<:@02468@:>@],
  19. dnl Stable branch, 2.24.1 -> libSDL2-2.0.so.0.2400.1
  20. [SDL_INTERFACE_AGE="$SDL_MICRO_VERSION"],
  21. [*],
  22. dnl Development branch, 2.23.1 -> libSDL2-2.0.so.0.2301.0
  23. [SDL_INTERFACE_AGE=0])
  24. AC_SUBST(SDL_MAJOR_VERSION)
  25. AC_SUBST(SDL_MINOR_VERSION)
  26. AC_SUBST(SDL_MICRO_VERSION)
  27. AC_SUBST(SDL_INTERFACE_AGE)
  28. AC_SUBST(SDL_BINARY_AGE)
  29. AC_SUBST(SDL_VERSION)
  30. # libtool versioning
  31. LT_INIT([win32-dll])
  32. LT_LANG([Windows Resource])
  33. # For historical reasons, the library name redundantly includes the major
  34. # version twice: libSDL2-2.0.so.0.
  35. # TODO: in SDL 3, stop using -release, which will simplify it to libSDL3.so.0
  36. LT_RELEASE=2.0
  37. # Increment this if there is an incompatible change - but if that happens,
  38. # we should rename the library from SDL2 to SDL3, at which point this would
  39. # reset to 0 anyway.
  40. LT_MAJOR=0
  41. LT_AGE=`expr $SDL_BINARY_AGE - $SDL_INTERFACE_AGE`
  42. LT_CURRENT=`expr $LT_MAJOR + $LT_AGE`
  43. LT_REVISION=$SDL_INTERFACE_AGE
  44. m4_pattern_allow([^LT_])
  45. AC_SUBST(LT_RELEASE)
  46. AC_SUBST(LT_CURRENT)
  47. AC_SUBST(LT_REVISION)
  48. AC_SUBST(LT_AGE)
  49. dnl Detect the canonical build and host environments
  50. dnl AC_CANONICAL_HOST
  51. dnl Check for tools
  52. AC_PROG_AWK
  53. AC_PROG_CC
  54. AC_PROG_CXX
  55. AC_PROG_EGREP
  56. AC_PROG_FGREP
  57. AC_PROG_INSTALL
  58. AC_PROG_MAKE_SET
  59. PKG_PROG_PKG_CONFIG
  60. if [ test -z "$AWK" ]; then
  61. AC_MSG_ERROR([*** awk not found, aborting])
  62. fi
  63. AC_CHECK_PROGS([SORT], [gsort sort], [false])
  64. AS_IF([! "$SORT" -V </dev/null >/dev/null], [AC_MSG_WARN([sort(1) that supports the -V option is required to find dynamic libraries])])
  65. dnl 64-bit file offsets if possible unless --disable-largefile is specified
  66. AC_SYS_LARGEFILE
  67. dnl Make sure that srcdir is a full pathname
  68. case "$host" in
  69. *-*-mingw*)
  70. # Except on msys, where make can't handle full pathnames (bug 1972)
  71. ;;
  72. *)
  73. srcdir=`cd $srcdir && pwd`
  74. ;;
  75. esac
  76. dnl Set up the compiler and linker flags
  77. INCLUDE="-I$srcdir/include"
  78. dnl Don't use our khronos headers on QNX.
  79. case "$host" in
  80. *-*-nto-qnx*)
  81. ;;
  82. *)
  83. INCLUDE="$INCLUDE -idirafter $srcdir/src/video/khronos"
  84. ;;
  85. esac
  86. dnl use CXX for linker on Haiku
  87. case "$host" in
  88. *-*-haiku*)
  89. LINKER='$(CXX)'
  90. LIBTOOLLINKERTAG='CXX'
  91. ;;
  92. *)
  93. LINKER='$(CC)'
  94. LIBTOOLLINKERTAG='CC'
  95. ;;
  96. esac
  97. AC_SUBST(LINKER)
  98. AC_SUBST(LIBTOOLLINKERTAG)
  99. if test x$srcdir != x.; then
  100. INCLUDE="-Iinclude $INCLUDE"
  101. elif test -d .git; then
  102. AC_MSG_ERROR([
  103. *** When building from a git clone you should configure and build in a
  104. separate directory so you don't clobber SDL_config.h, SDL_revision.h
  105. ])
  106. fi
  107. BASE_CFLAGS=""
  108. BASE_LDFLAGS=""
  109. case "$host" in
  110. *-*-android*)
  111. BASE_LDFLAGS="-Wl,-z,max-page-size=16384 -Wl,-z,common-page-size=16384"
  112. ;;
  113. *-*-cygwin*)
  114. # We build SDL on cygwin without the UNIX emulation layer
  115. save_CFLAGS="$CFLAGS"
  116. have_no_cygwin=no
  117. AC_MSG_CHECKING(for GCC -mno-cygwin option)
  118. CFLAGS="$save_CFLAGS -mno-cygwin"
  119. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])], [have_no_cygwin=yes],[])
  120. AC_MSG_RESULT($have_no_cygwin)
  121. CFLAGS="$save_CFLAGS"
  122. if test x$have_no_cygwin = xyes; then
  123. BASE_CFLAGS="-mno-cygwin"
  124. BASE_LDFLAGS="-mno-cygwin"
  125. fi
  126. BASE_CFLAGS="$BASE_CFLAGS -I/usr/include/mingw"
  127. ;;
  128. esac
  129. # Uncomment the following line if you want to force SDL and applications
  130. # built with it to be compiled for a particular architecture.
  131. #AX_GCC_ARCHFLAG([no], [BASE_CFLAGS="$BASE_CFLAGS $ax_cv_gcc_archflag]")
  132. BUILD_CFLAGS="$CFLAGS $CPPFLAGS -DUSING_GENERATED_CONFIG_H"
  133. # The default optimization for SDL is -O3 (Bug #31)
  134. if test "x$orig_CFLAGS" = x; then
  135. BUILD_CFLAGS=`echo $BUILD_CFLAGS | sed 's/-O2/-O3/'`
  136. fi
  137. EXTRA_CFLAGS="$INCLUDE $BASE_CFLAGS"
  138. BUILD_LDFLAGS="$LDFLAGS"
  139. EXTRA_LDFLAGS="$BASE_LDFLAGS"
  140. ## These are common directories to find software packages
  141. #for path in /usr/freeware /usr/pkg /usr/X11R6 /usr/local; do
  142. # if test -d $path/include; then
  143. # EXTRA_CFLAGS="$EXTRA_CFLAGS -I$path/include"
  144. # fi
  145. # if test -d $path/lib; then
  146. # EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$path/lib"
  147. # fi
  148. #done
  149. SDL_CFLAGS="$BASE_CFLAGS"
  150. SDL_LIBS="-lSDL2"
  151. if test "x$BASE_LDFLAGS" != x; then
  152. SDL_LIBS="$SDL_LIBS $BASE_LDFLAGS"
  153. fi
  154. if test "x$EXTRA_CFLAGS" != x; then
  155. CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS"
  156. CFLAGS="$CFLAGS $EXTRA_CFLAGS"
  157. fi
  158. if test "x$EXTRA_LDFLAGS" != x; then
  159. LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
  160. fi
  161. dnl set this to use on systems that use lib64 instead of lib
  162. base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'`
  163. dnl Function to find a library in the compiler search path
  164. find_lib()
  165. {
  166. gcc_bin_path=[`$CC -print-search-dirs 2>/dev/null | $FGREP programs: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
  167. gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | $FGREP libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
  168. env_lib_path=[`echo $LIBS $LDFLAGS $* | sed 's/-L[ ]*//g'`]
  169. if test "$cross_compiling" = yes; then
  170. host_lib_path=""
  171. else
  172. host_lib_path="/usr/$base_libdir /usr/local/$base_libdir"
  173. fi
  174. for path in $env_lib_path $gcc_bin_path $gcc_lib_path $host_lib_path; do
  175. lib=[`ls -- $path/$1 2>/dev/null | sed 's,.*/,,' | "$SORT" -V -r | $AWK 'BEGIN{FS="."}{ print NF, $0 }' | "$SORT" -n -s | sed 's,[0-9]* ,,' | head -1`]
  176. if test x$lib != x; then
  177. echo $lib
  178. return
  179. fi
  180. done
  181. }
  182. dnl Check for compiler characteristics
  183. AC_C_CONST
  184. AC_C_INLINE
  185. AC_C_VOLATILE
  186. dnl See whether we want assertions for debugging/sanity checking SDL itself.
  187. AC_ARG_ENABLE(assertions,
  188. [AS_HELP_STRING([--enable-assertions],
  189. [Enable internal sanity checks (auto/disabled/release/enabled/paranoid) [default=auto]])],
  190. , enable_assertions=auto)
  191. case "$enable_assertions" in
  192. auto) # Use optimization settings to determine assertion level
  193. ;;
  194. disabled)
  195. AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 0, [ ])
  196. ;;
  197. release)
  198. AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 1, [ ])
  199. ;;
  200. enabled)
  201. AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 2, [ ])
  202. ;;
  203. paranoid)
  204. AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 3, [ ])
  205. ;;
  206. *)
  207. AC_MSG_ERROR([*** unknown assertion level. stop.])
  208. ;;
  209. esac
  210. dnl For use in static assertions
  211. EXTRA_CFLAGS="$EXTRA_CFLAGS -DSDL_BUILD_MAJOR_VERSION=$SDL_MAJOR_VERSION -DSDL_BUILD_MINOR_VERSION=$SDL_MINOR_VERSION -DSDL_BUILD_MICRO_VERSION=$SDL_MICRO_VERSION"
  212. dnl See whether we can use gcc style dependency tracking
  213. AC_ARG_ENABLE(dependency-tracking,
  214. [AS_HELP_STRING([--enable-dependency-tracking],
  215. [Use gcc -MMD -MT dependency tracking [default=yes]])],
  216. , enable_dependency_tracking=yes)
  217. if test x$enable_dependency_tracking = xyes; then
  218. have_gcc_mmd_mt=no
  219. AC_MSG_CHECKING(for GCC -MMD -MT option)
  220. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  221. #if !defined(__GNUC__) || __GNUC__ < 3
  222. #error Dependency tracking requires GCC 3.0 or newer
  223. #endif
  224. ]],[])], [have_gcc_mmd_mt=yes],[])
  225. AC_MSG_RESULT($have_gcc_mmd_mt)
  226. if test x$have_gcc_mmd_mt = xyes; then
  227. DEPENDENCY_TRACKING_OPTIONS="-MMD -MT \$@"
  228. fi
  229. fi
  230. AC_MSG_CHECKING(for linker option --no-undefined)
  231. have_no_undefined=no
  232. case "$host" in
  233. dnl Skip this on platforms where it is just simply busted.
  234. *-*-openbsd*)
  235. ;;
  236. *)
  237. save_LDFLAGS="$LDFLAGS"
  238. LDFLAGS="$LDFLAGS -Wl,--no-undefined"
  239. AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [
  240. have_no_undefined=yes
  241. BUILD_LDFLAGS="$BUILD_LDFLAGS -Wl,--no-undefined"
  242. ],[])
  243. LDFLAGS="$save_LDFLAGS"
  244. ;;
  245. esac
  246. AC_MSG_RESULT($have_no_undefined)
  247. AC_MSG_CHECKING(for linker option --dynamicbase)
  248. have_dynamicbase=no
  249. case "$host" in
  250. *)
  251. save_LDFLAGS="$LDFLAGS"
  252. LDFLAGS="$LDFLAGS -Wl,--dynamicbase"
  253. AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [
  254. have_dynamicbase=yes
  255. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,--dynamicbase"
  256. ],[])
  257. LDFLAGS="$save_LDFLAGS"
  258. ;;
  259. esac
  260. AC_MSG_RESULT($have_dynamicbase)
  261. AC_MSG_CHECKING(for linker option --nxcompat)
  262. have_nxcompat=no
  263. case "$host" in
  264. *)
  265. save_LDFLAGS="$LDFLAGS"
  266. LDFLAGS="$LDFLAGS -Wl,--nxcompat"
  267. AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [
  268. have_nxcompat=yes
  269. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,--nxcompat"
  270. ],[])
  271. LDFLAGS="$save_LDFLAGS"
  272. ;;
  273. esac
  274. AC_MSG_RESULT($have_nxcompat)
  275. AC_MSG_CHECKING(for linker option --high-entropy-va)
  276. have_high_entropy_va=no
  277. case "$host" in
  278. *)
  279. save_LDFLAGS="$LDFLAGS"
  280. LDFLAGS="$LDFLAGS -Wl,--high-entropy-va"
  281. AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [
  282. have_high_entropy_va=yes
  283. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,--high-entropy-va"
  284. ],[])
  285. LDFLAGS="$save_LDFLAGS"
  286. ;;
  287. esac
  288. AC_MSG_RESULT($have_high_entropy_va)
  289. dnl See whether we are allowed to use the system C library
  290. AC_ARG_ENABLE(libc,
  291. [AS_HELP_STRING([--enable-libc], [Use the system C library [default=yes]])],
  292. , enable_libc=yes)
  293. dnl See whether we are allowed to use system iconv
  294. enable_system_iconv_default=yes
  295. case "$host" in
  296. *-*-cygwin*|*-*-mingw*|*-*-darwin*|*-ios-*)
  297. enable_system_iconv_default=no
  298. ;;
  299. esac
  300. AC_ARG_ENABLE(system-iconv,
  301. [AS_HELP_STRING([--enable-system-iconv], [Use iconv() from system-installed libraries [default=no for windows, yes for others]])],
  302. , enable_system_iconv=$enable_system_iconv_default)
  303. dnl See whether we prefer libiconv over libc
  304. AC_ARG_ENABLE(libiconv,
  305. [AS_HELP_STRING([--enable-libiconv], [Prefer iconv() from libiconv, if available, over libc version [default=no]])],
  306. , enable_libiconv=no)
  307. if test x$enable_libc = xyes; then
  308. AC_DEFINE(HAVE_LIBC, 1, [ ])
  309. dnl Check for C library headers
  310. dnl AC_CHECK_INCLUDES_DEFAULT is an autoconf-2.7x thing where AC_HEADER_STDC is deprecated.
  311. m4_ifdef([AC_CHECK_INCLUDES_DEFAULT], [AC_CHECK_INCLUDES_DEFAULT], [AC_HEADER_STDC])
  312. AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h wchar.h inttypes.h stdint.h limits.h ctype.h math.h float.h iconv.h signal.h)
  313. dnl Check for typedefs, structures, etc.
  314. AC_TYPE_SIZE_T
  315. dnl Check for defines
  316. AC_CHECK_DEFINE(M_PI, math.h)
  317. AC_FUNC_ALLOCA
  318. dnl Checks for library functions.
  319. AC_CHECK_FUNC(mprotect,
  320. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  321. #include <sys/types.h>
  322. #include <sys/mman.h>
  323. ]],[])], [
  324. AC_DEFINE(HAVE_MPROTECT, 1, [ ])
  325. ],[]),
  326. )
  327. AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv bsearch qsort abs bcopy memset memcmp memcpy memmove wcslen wcslcpy wcslcat _wcsdup wcsdup wcsstr wcscmp wcsncmp wcscasecmp _wcsicmp wcsncasecmp _wcsnicmp strlen strlcpy strlcat _strrev _strupr _strlwr index rindex strchr strrchr strstr strtok_r itoa _ltoa _uitoa _ultoa strtod strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp strcasestr vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval elf_aux_info poll memfd_create posix_fallocate _Exit)
  328. AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
  329. AC_CHECK_FUNCS(acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf copysign copysignf cos cosf exp expf fabs fabsf floor floorf trunc truncf fmod fmodf log logf log10 log10f lround lroundf pow powf round roundf scalbn scalbnf sin sinf sqrt sqrtf tan tanf)
  330. if test x$enable_system_iconv = xyes; then
  331. AC_MSG_CHECKING(for iconv in libc)
  332. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  333. #define LIBICONV_PLUG 1 /* in case libiconv header is in include path */
  334. #include <stddef.h>
  335. #include <iconv.h>
  336. ]],[[
  337. iconv_open(NULL,NULL);
  338. ]])], [have_libc_iconv=yes],[have_libc_iconv=no])
  339. AC_MSG_RESULT($have_libc_iconv)
  340. AC_MSG_CHECKING(for iconv in libiconv)
  341. save_LIBS="$LIBS"
  342. LIBS="$LIBS -liconv"
  343. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  344. #include <stddef.h>
  345. #include <iconv.h>
  346. ]],[[
  347. iconv_open(NULL,NULL);
  348. ]])], [have_libiconv=yes],[have_libiconv=no])
  349. LIBS="$save_LIBS"
  350. AC_MSG_RESULT($have_libiconv)
  351. if test x$have_libc_iconv = xyes || test x$have_libiconv = xyes; then
  352. AC_DEFINE(HAVE_ICONV,1,[ ])
  353. if test x$have_libiconv = xyes; then
  354. if test x$have_libc_iconv != xyes; then
  355. use_libiconv=yes
  356. elif test x$enable_libiconv = xyes; then
  357. use_libiconv=yes
  358. fi
  359. fi
  360. if test x$use_libiconv = xyes; then
  361. AC_DEFINE(SDL_USE_LIBICONV,1,[ ])
  362. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"
  363. echo "-- Using iconv from libiconv"
  364. else
  365. echo "-- Using iconv from libc"
  366. fi
  367. fi
  368. fi
  369. AC_CHECK_MEMBER(struct sigaction.sa_sigaction,[AC_DEFINE([HAVE_SA_SIGACTION], 1, [ ])], ,[#include <signal.h>])
  370. dnl Check for additional non-standard headers
  371. AC_CHECK_HEADERS(libunwind.h)
  372. fi
  373. dnl AC_CHECK_SIZEOF(void*)
  374. dnl See whether we can use gcc atomic operations on this architecture
  375. AC_ARG_ENABLE(gcc-atomics,
  376. [AS_HELP_STRING([--enable-gcc-atomics],
  377. [Use gcc builtin atomics [default=yes]])],
  378. , enable_gcc_atomics=yes)
  379. if test x$enable_gcc_atomics = xyes; then
  380. have_gcc_atomics=no
  381. AC_MSG_CHECKING(for GCC builtin atomic operations)
  382. AC_LINK_IFELSE([AC_LANG_PROGRAM([],[[
  383. int a;
  384. void *x, *y, *z;
  385. __sync_lock_test_and_set(&a, 4);
  386. __sync_lock_test_and_set(&x, y);
  387. __sync_fetch_and_add(&a, 1);
  388. __sync_bool_compare_and_swap(&a, 5, 10);
  389. __sync_bool_compare_and_swap(&x, y, z);
  390. ]])],
  391. [have_gcc_atomics=yes],[])
  392. AC_MSG_RESULT($have_gcc_atomics)
  393. if test x$have_gcc_atomics = xyes; then
  394. AC_DEFINE(HAVE_GCC_ATOMICS, 1, [ ])
  395. else
  396. # See if we have the minimum operation needed for GCC atomics
  397. AC_LINK_IFELSE([AC_LANG_PROGRAM([],[[
  398. int a;
  399. __sync_lock_test_and_set(&a, 1);
  400. __sync_lock_release(&a);
  401. ]])], [have_gcc_sync_lock_test_and_set=yes],[])
  402. if test x$have_gcc_sync_lock_test_and_set = xyes; then
  403. AC_DEFINE(HAVE_GCC_SYNC_LOCK_TEST_AND_SET, 1, [ ])
  404. fi
  405. fi
  406. fi
  407. # Standard C sources
  408. SOURCES="$SOURCES $srcdir/src/*.c"
  409. SOURCES="$SOURCES $srcdir/src/atomic/*.c"
  410. SOURCES="$SOURCES $srcdir/src/audio/*.c"
  411. SOURCES="$SOURCES $srcdir/src/cpuinfo/*.c"
  412. SOURCES="$SOURCES $srcdir/src/dynapi/*.c"
  413. SOURCES="$SOURCES $srcdir/src/events/*.c"
  414. SOURCES="$SOURCES $srcdir/src/file/*.c"
  415. SOURCES="$SOURCES $srcdir/src/haptic/*.c"
  416. SOURCES="$SOURCES $srcdir/src/hidapi/*.c"
  417. SOURCES="$SOURCES $srcdir/src/joystick/*.c"
  418. SOURCES="$SOURCES $srcdir/src/libm/*.c"
  419. SOURCES="$SOURCES $srcdir/src/misc/*.c"
  420. SOURCES="$SOURCES $srcdir/src/power/*.c"
  421. #SOURCES="$SOURCES $srcdir/src/filesystem/*.c"
  422. SOURCES="$SOURCES $srcdir/src/render/*.c"
  423. SOURCES="$SOURCES $srcdir/src/render/*/*.c"
  424. SOURCES="$SOURCES $srcdir/src/sensor/*.c"
  425. SOURCES="$SOURCES $srcdir/src/stdlib/*.c"
  426. SOURCES="$SOURCES $srcdir/src/thread/*.c"
  427. SOURCES="$SOURCES $srcdir/src/timer/*.c"
  428. SOURCES="$SOURCES $srcdir/src/video/*.c"
  429. SOURCES="$SOURCES $srcdir/src/video/yuv2rgb/*.c"
  430. SOURCES="$SOURCES $srcdir/src/locale/*.c"
  431. dnl Enable/disable various subsystems of the SDL library
  432. case "$host" in
  433. *-*-emscripten*)
  434. default_atomic=no
  435. ;;
  436. *)
  437. default_atomic=yes
  438. ;;
  439. esac
  440. AC_ARG_ENABLE(atomic,
  441. [AS_HELP_STRING([--enable-atomic], [Enable the atomic operations subsystem [default=yes]])],
  442. , enable_atomic=$default_atomic)
  443. if test x$enable_atomic != xyes; then
  444. AC_DEFINE(SDL_ATOMIC_DISABLED, 1, [ ])
  445. else
  446. SUMMARY_modules="${SUMMARY_modules} atomic"
  447. fi
  448. AC_ARG_ENABLE(audio,
  449. [AS_HELP_STRING([--enable-audio], [Enable the audio subsystem [default=yes]])],
  450. , enable_audio=yes)
  451. if test x$enable_audio != xyes; then
  452. AC_DEFINE(SDL_AUDIO_DISABLED, 1, [ ])
  453. else
  454. SUMMARY_modules="${SUMMARY_modules} audio"
  455. fi
  456. AC_ARG_ENABLE(video,
  457. [AS_HELP_STRING([--enable-video], [Enable the video subsystem [default=yes]])],
  458. , enable_video=yes)
  459. if test x$enable_video != xyes; then
  460. AC_DEFINE(SDL_VIDEO_DISABLED, 1, [ ])
  461. else
  462. SUMMARY_modules="${SUMMARY_modules} video"
  463. fi
  464. AC_ARG_ENABLE(render,
  465. [AS_HELP_STRING([--enable-render], [Enable the render subsystem [default=yes]])],
  466. , enable_render=yes)
  467. if test x$enable_render != xyes; then
  468. AC_DEFINE(SDL_RENDER_DISABLED, 1, [ ])
  469. else
  470. SUMMARY_modules="${SUMMARY_modules} render"
  471. fi
  472. AC_ARG_ENABLE(events,
  473. [AS_HELP_STRING([--enable-events], [Enable the events subsystem [default=yes]])],
  474. , enable_events=yes)
  475. if test x$enable_events != xyes; then
  476. AC_DEFINE(SDL_EVENTS_DISABLED, 1, [ ])
  477. else
  478. SUMMARY_modules="${SUMMARY_modules} events"
  479. fi
  480. AC_ARG_ENABLE(joystick,
  481. [AS_HELP_STRING([--enable-joystick], [Enable the joystick subsystem [default=yes]])],
  482. , enable_joystick=yes)
  483. if test x$enable_joystick != xyes; then
  484. AC_DEFINE(SDL_JOYSTICK_DISABLED, 1, [ ])
  485. else
  486. SUMMARY_modules="${SUMMARY_modules} joystick"
  487. fi
  488. AC_ARG_ENABLE(haptic,
  489. [AS_HELP_STRING([--enable-haptic], [Enable the haptic (force feedback) subsystem [default=yes]])],
  490. , enable_haptic=yes)
  491. if test x$enable_haptic != xyes; then
  492. AC_DEFINE(SDL_HAPTIC_DISABLED, 1, [ ])
  493. else
  494. SUMMARY_modules="${SUMMARY_modules} haptic"
  495. fi
  496. AC_ARG_ENABLE(hidapi,
  497. [AS_HELP_STRING([--enable-hidapi], [Enable the HIDAPI subsystem [default=yes]])],
  498. , enable_hidapi=yes)
  499. if test x$enable_hidapi != xyes; then
  500. AC_DEFINE(SDL_HIDAPI_DISABLED, 1, [ ])
  501. else
  502. SUMMARY_modules="${SUMMARY_modules} hidapi"
  503. fi
  504. AC_ARG_ENABLE(sensor,
  505. [AS_HELP_STRING([--enable-sensor], [Enable the sensor subsystem [default=yes]])],
  506. , enable_sensor=yes)
  507. if test x$enable_sensor != xyes; then
  508. AC_DEFINE(SDL_SENSOR_DISABLED, 1, [ ])
  509. else
  510. SUMMARY_modules="${SUMMARY_modules} sensor"
  511. fi
  512. AC_ARG_ENABLE(power,
  513. [AS_HELP_STRING([--enable-power], [Enable the power subsystem [default=yes]])],
  514. , enable_power=yes)
  515. if test x$enable_power != xyes; then
  516. AC_DEFINE(SDL_POWER_DISABLED, 1, [ ])
  517. else
  518. SUMMARY_modules="${SUMMARY_modules} power"
  519. fi
  520. AC_ARG_ENABLE(filesystem,
  521. [AS_HELP_STRING([--enable-filesystem], [Enable the filesystem subsystem [default=yes]])],
  522. , enable_filesystem=yes)
  523. if test x$enable_filesystem != xyes; then
  524. AC_DEFINE(SDL_FILESYSTEM_DISABLED, 1, [ ])
  525. else
  526. SUMMARY_modules="${SUMMARY_modules} filesystem"
  527. fi
  528. # Many subsystems depend on threads, so leave them enabled by default
  529. #AC_ARG_ENABLE(threads,
  530. #[AS_HELP_STRING([--enable-threads], [Enable the threading subsystem [default=yes]])],
  531. # , enable_threads=yes)
  532. enable_threads=yes
  533. if test x$enable_threads != xyes; then
  534. AC_DEFINE(SDL_THREADS_DISABLED, 1, [ ])
  535. else
  536. SUMMARY_modules="${SUMMARY_modules} threads"
  537. fi
  538. AC_ARG_ENABLE(timers,
  539. [AS_HELP_STRING([--enable-timers], [Enable the timer subsystem [default=yes]])],
  540. , enable_timers=yes)
  541. if test x$enable_timers != xyes; then
  542. AC_DEFINE(SDL_TIMERS_DISABLED, 1, [ ])
  543. else
  544. SUMMARY_modules="${SUMMARY_modules} timers"
  545. fi
  546. AC_ARG_ENABLE(file,
  547. [AS_HELP_STRING([--enable-file], [Enable the file subsystem [default=yes]])],
  548. , enable_file=yes)
  549. if test x$enable_file != xyes; then
  550. AC_DEFINE(SDL_FILE_DISABLED, 1, [ ])
  551. else
  552. SUMMARY_modules="${SUMMARY_modules} file"
  553. fi
  554. AC_ARG_ENABLE(misc,
  555. [AS_HELP_STRING([--enable-misc], [Enable the misc subsystem [default=yes]])],
  556. , enable_misc=yes)
  557. if test x$enable_misc != xyes; then
  558. AC_DEFINE(SDL_MISC_DISABLED, 1, [ ])
  559. else
  560. SUMMARY_modules="${SUMMARY_modules} misc"
  561. fi
  562. AC_ARG_ENABLE(locale,
  563. [AS_HELP_STRING([--enable-locale], [Enable the locale subsystem [default=yes]])],
  564. , enable_locale=yes)
  565. if test x$enable_locale != xyes; then
  566. AC_DEFINE(SDL_LOCALE_DISABLED, 1, [ ])
  567. else
  568. SUMMARY_modules="${SUMMARY_modules} locale"
  569. fi
  570. AC_ARG_ENABLE(loadso,
  571. [AS_HELP_STRING([--enable-loadso], [Enable the shared object loading subsystem [default=yes]])],
  572. , enable_loadso=yes)
  573. if test x$enable_loadso != xyes; then
  574. AC_DEFINE(SDL_LOADSO_DISABLED, 1, [ ])
  575. else
  576. SUMMARY_modules="${SUMMARY_modules} loadso"
  577. fi
  578. AC_ARG_ENABLE(cpuinfo,
  579. [AS_HELP_STRING([--enable-cpuinfo], [Enable the cpuinfo subsystem [default=yes]])],
  580. , enable_cpuinfo=yes)
  581. if test x$enable_cpuinfo != xyes; then
  582. AC_DEFINE(SDL_CPUINFO_DISABLED, 1, [ ])
  583. else
  584. SUMMARY_modules="${SUMMARY_modules} cpuinfo"
  585. fi
  586. AC_ARG_ENABLE(assembly,
  587. [AS_HELP_STRING([--enable-assembly], [Enable assembly routines [default=yes]])],
  588. , enable_assembly=yes)
  589. if test x$enable_assembly = xyes; then
  590. SUMMARY_modules="${SUMMARY_modules} assembly"
  591. # Make sure that we don't generate floating point code that would
  592. # cause illegal instruction exceptions on older processors
  593. case "$host" in
  594. *-*-darwin*)
  595. # Don't need to worry about Apple hardware, it's all SSE capable
  596. default_ssemath=yes
  597. ;;
  598. *64-*-*)
  599. # x86 64-bit architectures all have SSE instructions
  600. default_ssemath=yes
  601. ;;
  602. *)
  603. default_ssemath=no
  604. ;;
  605. esac
  606. AC_ARG_ENABLE(ssemath,
  607. [AS_HELP_STRING([--enable-ssemath], [Allow GCC to use SSE floating point math [default=maybe]])],
  608. , enable_ssemath=$default_ssemath)
  609. if test x$enable_ssemath = xno; then
  610. if test x$have_gcc_sse = xyes -o x$have_gcc_sse2 = xyes -o x$have_gcc_sse3 = xyes; then
  611. EXTRA_CFLAGS="$EXTRA_CFLAGS -mfpmath=387"
  612. fi
  613. fi
  614. dnl Check for various instruction support
  615. AC_ARG_ENABLE(mmx,
  616. [AS_HELP_STRING([--enable-mmx], [use MMX assembly routines [default=yes]])],
  617. , enable_mmx=yes)
  618. if test x$enable_mmx = xyes; then
  619. save_CFLAGS="$CFLAGS"
  620. have_gcc_mmx=no
  621. AC_MSG_CHECKING(for GCC -mmmx option)
  622. mmx_CFLAGS="-mmmx"
  623. CFLAGS="$save_CFLAGS $mmx_CFLAGS"
  624. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  625. #ifdef __MINGW32__
  626. #include <_mingw.h>
  627. #ifdef __MINGW64_VERSION_MAJOR
  628. #include <intrin.h>
  629. #else
  630. #include <mmintrin.h>
  631. #endif
  632. #else
  633. #include <mmintrin.h>
  634. #endif
  635. #ifndef __MMX__
  636. #error Assembler CPP flag not enabled
  637. #endif
  638. ]],[])], [have_gcc_mmx=yes],[])
  639. AC_MSG_RESULT($have_gcc_mmx)
  640. CFLAGS="$save_CFLAGS"
  641. if test x$have_gcc_mmx = xyes; then
  642. EXTRA_CFLAGS="$EXTRA_CFLAGS $mmx_CFLAGS"
  643. SUMMARY_math="${SUMMARY_math} mmx"
  644. fi
  645. fi
  646. AC_ARG_ENABLE(3dnow,
  647. [AS_HELP_STRING([--enable-3dnow], [use 3DNow! assembly routines [default=no]])],
  648. , enable_3dnow=no)
  649. if test x$enable_3dnow = xyes; then
  650. save_CFLAGS="$CFLAGS"
  651. have_gcc_3dnow=no
  652. AC_MSG_CHECKING(for GCC -m3dnow option)
  653. amd3dnow_CFLAGS="-m3dnow"
  654. CFLAGS="$save_CFLAGS $amd3dnow_CFLAGS"
  655. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  656. #include <mm3dnow.h>
  657. #ifndef __3dNOW__
  658. #error Assembler CPP flag not enabled
  659. #endif
  660. ]], [[
  661. void *p = 0;
  662. _m_prefetch(p);
  663. ]])],
  664. [have_gcc_3dnow=yes],[])
  665. AC_MSG_RESULT($have_gcc_3dnow)
  666. CFLAGS="$save_CFLAGS"
  667. if test x$have_gcc_3dnow = xyes; then
  668. EXTRA_CFLAGS="$EXTRA_CFLAGS $amd3dnow_CFLAGS"
  669. SUMMARY_math="${SUMMARY_math} 3dnow"
  670. fi
  671. fi
  672. AC_ARG_ENABLE(sse,
  673. [AS_HELP_STRING([--enable-sse], [use SSE assembly routines [default=yes]])],
  674. , enable_sse=yes)
  675. if test x$enable_sse = xyes; then
  676. save_CFLAGS="$CFLAGS"
  677. have_gcc_sse=no
  678. AC_MSG_CHECKING(for GCC -msse option)
  679. sse_CFLAGS="-msse"
  680. CFLAGS="$save_CFLAGS $sse_CFLAGS"
  681. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  682. #ifdef __MINGW32__
  683. #include <_mingw.h>
  684. #ifdef __MINGW64_VERSION_MAJOR
  685. #include <intrin.h>
  686. #else
  687. #include <xmmintrin.h>
  688. #endif
  689. #else
  690. #include <xmmintrin.h>
  691. #endif
  692. #ifndef __SSE__
  693. #error Assembler CPP flag not enabled
  694. #endif
  695. ]],[])], [have_gcc_sse=yes],[])
  696. AC_MSG_RESULT($have_gcc_sse)
  697. CFLAGS="$save_CFLAGS"
  698. if test x$have_gcc_sse = xyes; then
  699. EXTRA_CFLAGS="$EXTRA_CFLAGS $sse_CFLAGS"
  700. SUMMARY_math="${SUMMARY_math} sse"
  701. fi
  702. fi
  703. AC_ARG_ENABLE(sse2,
  704. [AS_HELP_STRING([--enable-sse2], [use SSE2 assembly routines [default=maybe]])],
  705. , enable_sse2=$default_ssemath)
  706. if test x$enable_sse2 = xyes; then
  707. save_CFLAGS="$CFLAGS"
  708. have_gcc_sse2=no
  709. AC_MSG_CHECKING(for GCC -msse2 option)
  710. sse2_CFLAGS="-msse2"
  711. CFLAGS="$save_CFLAGS $sse2_CFLAGS"
  712. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  713. #ifdef __MINGW32__
  714. #include <_mingw.h>
  715. #ifdef __MINGW64_VERSION_MAJOR
  716. #include <intrin.h>
  717. #else
  718. #include <emmintrin.h>
  719. #endif
  720. #else
  721. #include <emmintrin.h>
  722. #endif
  723. #ifndef __SSE2__
  724. #error Assembler CPP flag not enabled
  725. #endif
  726. ]],[])], [have_gcc_sse2=yes],[])
  727. AC_MSG_RESULT($have_gcc_sse2)
  728. CFLAGS="$save_CFLAGS"
  729. if test x$have_gcc_sse2 = xyes; then
  730. EXTRA_CFLAGS="$EXTRA_CFLAGS $sse2_CFLAGS"
  731. SUMMARY_math="${SUMMARY_math} sse2"
  732. fi
  733. fi
  734. AC_ARG_ENABLE(sse3,
  735. [AS_HELP_STRING([--enable-sse3], [use SSE3 assembly routines [default=maybe]])],
  736. , enable_sse3=$default_ssemath)
  737. if test x$enable_sse3 = xyes; then
  738. save_CFLAGS="$CFLAGS"
  739. have_gcc_sse3=no
  740. AC_MSG_CHECKING(for GCC -msse3 option)
  741. sse3_CFLAGS="-msse3"
  742. CFLAGS="$save_CFLAGS $sse3_CFLAGS"
  743. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  744. #ifdef __MINGW32__
  745. #include <_mingw.h>
  746. #ifdef __MINGW64_VERSION_MAJOR
  747. #include <intrin.h>
  748. #else
  749. #include <pmmintrin.h>
  750. #endif
  751. #else
  752. #include <pmmintrin.h>
  753. #endif
  754. #ifndef __SSE2__
  755. #error Assembler CPP flag not enabled
  756. #endif
  757. ]],[])], [have_gcc_sse3=yes],[])
  758. AC_MSG_RESULT($have_gcc_sse3)
  759. CFLAGS="$save_CFLAGS"
  760. if test x$have_gcc_sse3 = xyes; then
  761. EXTRA_CFLAGS="$EXTRA_CFLAGS $sse3_CFLAGS"
  762. SUMMARY_math="${SUMMARY_math} sse3"
  763. fi
  764. fi
  765. AC_MSG_CHECKING(for immintrin.h)
  766. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <immintrin.h>]])],
  767. [have_immintrin_h_hdr=yes],[have_immintrin_h_hdr=no])
  768. AC_MSG_RESULT($have_immintrin_h_hdr)
  769. if test x$have_immintrin_h_hdr = xyes; then
  770. AC_DEFINE(HAVE_IMMINTRIN_H, 1, [ ])
  771. fi
  772. AC_ARG_ENABLE(altivec,
  773. [AS_HELP_STRING([--enable-altivec], [use Altivec assembly routines [default=yes]])],
  774. , enable_altivec=yes)
  775. if test x$enable_altivec = xyes; then
  776. save_CFLAGS="$CFLAGS"
  777. have_gcc_altivec=no
  778. have_altivec_h_hdr=no
  779. altivec_CFLAGS="-maltivec"
  780. CFLAGS="$save_CFLAGS $altivec_CFLAGS"
  781. AC_MSG_CHECKING(for Altivec with GCC altivec.h and -maltivec option)
  782. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  783. #include <altivec.h>
  784. vector unsigned int vzero() {
  785. return vec_splat_u32(0);
  786. }
  787. ]],[])], [
  788. have_gcc_altivec=yes
  789. have_altivec_h_hdr=yes
  790. ],[])
  791. AC_MSG_RESULT($have_gcc_altivec)
  792. if test x$have_gcc_altivec = xno; then
  793. AC_MSG_CHECKING(for Altivec with GCC -maltivec option)
  794. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  795. vector unsigned int vzero() {
  796. return vec_splat_u32(0);
  797. }
  798. ]],[])], [have_gcc_altivec=yes],[])
  799. AC_MSG_RESULT($have_gcc_altivec)
  800. fi
  801. if test x$have_gcc_altivec = xno; then
  802. AC_MSG_CHECKING(for Altivec with GCC altivec.h and -faltivec option)
  803. altivec_CFLAGS="-faltivec"
  804. CFLAGS="$save_CFLAGS $altivec_CFLAGS"
  805. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  806. #include <altivec.h>
  807. vector unsigned int vzero() {
  808. return vec_splat_u32(0);
  809. }
  810. ]],[])], [
  811. have_gcc_altivec=yes
  812. have_altivec_h_hdr=yes
  813. ],[])
  814. AC_MSG_RESULT($have_gcc_altivec)
  815. fi
  816. if test x$have_gcc_altivec = xno; then
  817. AC_MSG_CHECKING(for Altivec with GCC -faltivec option)
  818. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  819. vector unsigned int vzero() {
  820. return vec_splat_u32(0);
  821. }
  822. ]],[])], [have_gcc_altivec=yes],[])
  823. AC_MSG_RESULT($have_gcc_altivec)
  824. fi
  825. CFLAGS="$save_CFLAGS"
  826. if test x$have_gcc_altivec = xyes; then
  827. AC_DEFINE(SDL_ALTIVEC_BLITTERS, 1, [ ])
  828. if test x$have_altivec_h_hdr = xyes; then
  829. AC_DEFINE(HAVE_ALTIVEC_H, 1, [ ])
  830. fi
  831. EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS"
  832. SUMMARY_math="${SUMMARY_math} altivec"
  833. fi
  834. fi
  835. fi
  836. AC_ARG_ENABLE(lsx,
  837. [AS_HELP_STRING([--enable-lsx], [use LSX assembly routines [default=yes]])],
  838. , enable_lsx=yes)
  839. if test x$enable_lsx = xyes; then
  840. save_CFLAGS="$CFLAGS"
  841. have_gcc_lsx=no
  842. AC_MSG_CHECKING(for GCC -mlsx option)
  843. lsx_CFLAGS="-mlsx"
  844. CFLAGS="$save_CFLAGS $lsx_CFLAGS"
  845. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  846. #ifndef __loongarch_sx
  847. #error Assembler CPP flag not enabled
  848. #endif
  849. ]], [])], [have_gcc_lsx=yes], [])
  850. AC_MSG_RESULT($have_gcc_lsx)
  851. CFLAGS="$save_CFLAGS"
  852. if test x$have_gcc_lsx = xyes; then
  853. EXTRA_CFLAGS="$EXTRA_CFLAGS $lsx_CFLAGS"
  854. SUMMARY_math="${SUMMARY_math} lsx"
  855. fi
  856. fi
  857. AC_MSG_CHECKING(for lsxintrin.h)
  858. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <lsxintrin.h>]])],
  859. [have_lsxintrin_h_hdr=yes],[have_lsxintrin_h_hdr=no])
  860. AC_MSG_RESULT($have_lsxintrin_h_hdr)
  861. if test x$have_lsxintrin_h_hdr = xyes; then
  862. AC_DEFINE(HAVE_LSXINTRIN_H, 1, [ ])
  863. fi
  864. dnl See if the OSS audio interface is supported
  865. CheckOSS()
  866. {
  867. AC_ARG_ENABLE(oss,
  868. [AS_HELP_STRING([--enable-oss], [support the OSS audio API [default=maybe]])],
  869. , enable_oss=maybe)
  870. if test x$enable_oss = xmaybe; then
  871. enable_oss=yes
  872. fi
  873. if test x$enable_audio = xyes -a x$enable_oss = xyes; then
  874. AC_MSG_CHECKING(for OSS audio support)
  875. have_oss=no
  876. if test x$have_oss != xyes; then
  877. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  878. #include <sys/soundcard.h>
  879. ]], [[
  880. int arg = SNDCTL_DSP_SETFRAGMENT;
  881. ]])], [have_oss=yes],[])
  882. fi
  883. AC_MSG_RESULT($have_oss)
  884. if test x$have_oss = xyes; then
  885. SUMMARY_audio="${SUMMARY_audio} oss"
  886. AC_DEFINE(SDL_AUDIO_DRIVER_OSS, 1, [ ])
  887. SOURCES="$SOURCES $srcdir/src/audio/dsp/*.c"
  888. have_audio=yes
  889. # We may need to link with ossaudio emulation library
  890. case "$host" in
  891. *-*-netbsd*)
  892. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lossaudio";;
  893. esac
  894. fi
  895. fi
  896. }
  897. dnl See if the ALSA audio interface is supported
  898. CheckALSA()
  899. {
  900. AC_ARG_ENABLE(alsa,
  901. [AS_HELP_STRING([--enable-alsa], [support the ALSA audio API [default=yes]])],
  902. , enable_alsa=yes)
  903. if test x$enable_audio = xyes -a x$enable_alsa = xyes; then
  904. AM_PATH_ALSA(1.0.11, have_alsa=yes, have_alsa=no)
  905. # Restore all flags from before the ALSA detection runs
  906. CFLAGS="$alsa_save_CFLAGS"
  907. LDFLAGS="$alsa_save_LDFLAGS"
  908. LIBS="$alsa_save_LIBS"
  909. if test x$have_alsa = xyes; then
  910. AC_ARG_ENABLE(alsa-shared,
  911. [AS_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [default=yes]])],
  912. , enable_alsa_shared=yes)
  913. alsa_lib=[`find_lib "libasound.so.*" "$ALSA_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
  914. AC_DEFINE(SDL_AUDIO_DRIVER_ALSA, 1, [ ])
  915. SOURCES="$SOURCES $srcdir/src/audio/alsa/*.c"
  916. EXTRA_CFLAGS="$EXTRA_CFLAGS $ALSA_CFLAGS"
  917. if test x$have_loadso != xyes && \
  918. test x$enable_alsa_shared = xyes; then
  919. AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ALSA loading])
  920. fi
  921. if test x$have_loadso = xyes && \
  922. test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then
  923. echo "-- dynamic libasound -> $alsa_lib"
  924. AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ALSA_DYNAMIC, "$alsa_lib", [ ])
  925. SUMMARY_audio="${SUMMARY_audio} alsa(dynamic)"
  926. else
  927. EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ALSA_LIBS"
  928. SUMMARY_audio="${SUMMARY_audio} alsa"
  929. fi
  930. have_audio=yes
  931. fi
  932. fi
  933. }
  934. dnl Find JACK Audio
  935. CheckJACK()
  936. {
  937. AC_ARG_ENABLE(jack,
  938. [AS_HELP_STRING([--enable-jack], [use JACK audio [default=yes]])],
  939. , enable_jack=yes)
  940. if test x$enable_audio = xyes -a x$enable_jack = xyes; then
  941. PKG_CHECK_MODULES([JACK], [jack >= 0.125], audio_jack=yes, audio_jack=no)
  942. if test x$audio_jack = xyes; then
  943. AC_ARG_ENABLE(jack-shared,
  944. [AS_HELP_STRING([--enable-jack-shared], [dynamically load JACK audio support [default=yes]])],
  945. , enable_jack_shared=yes)
  946. jack_lib=[`find_lib "libjack.so.*" "$JACK_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
  947. AC_DEFINE(SDL_AUDIO_DRIVER_JACK, 1, [ ])
  948. SOURCES="$SOURCES $srcdir/src/audio/jack/*.c"
  949. EXTRA_CFLAGS="$EXTRA_CFLAGS $JACK_CFLAGS"
  950. if test x$have_loadso != xyes && \
  951. test x$enable_jack_shared = xyes; then
  952. AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic JACK audio loading])
  953. fi
  954. if test x$have_loadso = xyes && \
  955. test x$enable_jack_shared = xyes && test x$jack_lib != x; then
  956. echo "-- dynamic libjack -> $jack_lib"
  957. AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_JACK_DYNAMIC, "$jack_lib", [ ])
  958. SUMMARY_audio="${SUMMARY_audio} jack(dynamic)"
  959. case "$host" in
  960. # On Solaris, jack must be linked deferred explicitly
  961. # to prevent undefined symbol failures.
  962. *-*-solaris*)
  963. JACK_LIBS=`echo $JACK_LIBS | sed 's/\-l/-Wl,-l/g'`
  964. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-zdeferred $JACK_LIBS -Wl,-znodeferred"
  965. esac
  966. else
  967. EXTRA_LDFLAGS="$EXTRA_LDFLAGS $JACK_LIBS"
  968. SUMMARY_audio="${SUMMARY_audio} jack"
  969. fi
  970. have_audio=yes
  971. fi
  972. fi
  973. }
  974. dnl Find the ESD includes and libraries
  975. CheckESD()
  976. {
  977. AC_ARG_ENABLE(esd,
  978. [AS_HELP_STRING([--enable-esd], [support the Enlightened Sound Daemon [default=yes]])],
  979. , enable_esd=yes)
  980. if test x$enable_audio = xyes -a x$enable_esd = xyes; then
  981. PKG_CHECK_MODULES([ESD], [esound >= 0.2.8], have_esd=yes, have_esd=no)
  982. if test x$have_esd = xno; then
  983. AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no)
  984. fi
  985. if test x$have_esd = xyes; then
  986. AC_ARG_ENABLE(esd-shared,
  987. [AS_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [default=yes]])],
  988. , enable_esd_shared=yes)
  989. esd_lib=[`find_lib "libesd.so.*" "$ESD_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
  990. AC_DEFINE(SDL_AUDIO_DRIVER_ESD, 1, [ ])
  991. SOURCES="$SOURCES $srcdir/src/audio/esd/*.c"
  992. EXTRA_CFLAGS="$EXTRA_CFLAGS $ESD_CFLAGS"
  993. if test x$have_loadso != xyes && \
  994. test x$enable_esd_shared = xyes; then
  995. AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ESD loading])
  996. fi
  997. if test x$have_loadso = xyes && \
  998. test x$enable_esd_shared = xyes && test x$esd_lib != x; then
  999. echo "-- dynamic libesd -> $esd_lib"
  1000. AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ESD_DYNAMIC, "$esd_lib", [ ])
  1001. SUMMARY_audio="${SUMMARY_audio} esd(dynamic)"
  1002. else
  1003. EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ESD_LIBS"
  1004. SUMMARY_audio="${SUMMARY_audio} esd"
  1005. fi
  1006. have_audio=yes
  1007. fi
  1008. fi
  1009. }
  1010. dnl Find Pipewire
  1011. CheckPipewire()
  1012. {
  1013. AC_ARG_ENABLE(pipewire,
  1014. [AS_HELP_STRING([--enable-pipewire], [use Pipewire audio [default=yes]])],
  1015. , enable_pipewire=yes)
  1016. if test x$enable_audio = xyes -a x$enable_pipewire = xyes; then
  1017. PKG_CHECK_MODULES([PIPEWIRE], [libpipewire-0.3 >= 0.3.20], audio_pipewire=yes, audio_pipewire=no)
  1018. if test x$audio_pipewire = xyes; then
  1019. AC_ARG_ENABLE(pipewire-shared,
  1020. [AS_HELP_STRING([--enable-pipewire-shared], [dynamically load Pipewire support [default=yes]])],
  1021. , enable_pipewire_shared=yes)
  1022. pipewire_lib=[`find_lib "libpipewire-0.3.so.*" "$PIPEWIRE_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
  1023. AC_DEFINE(SDL_AUDIO_DRIVER_PIPEWIRE, 1, [ ])
  1024. SOURCES="$SOURCES $srcdir/src/audio/pipewire/*.c"
  1025. EXTRA_CFLAGS="$EXTRA_CFLAGS $PIPEWIRE_CFLAGS"
  1026. if test x$have_loadso != xyes && \
  1027. test x$enable_pipewire_shared = xyes; then
  1028. AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic Pipewire loading])
  1029. fi
  1030. if test x$have_loadso = xyes && \
  1031. test x$enable_pipewire_shared = xyes && test x$pipewire_lib != x; then
  1032. echo "-- dynamic libpipewire-0.3 -> $pipewire_lib"
  1033. AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_PIPEWIRE_DYNAMIC, "$pipewire_lib", [ ])
  1034. SUMMARY_audio="${SUMMARY_audio} pipewire(dynamic)"
  1035. else
  1036. EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PIPEWIRE_LIBS"
  1037. SUMMARY_audio="${SUMMARY_audio} pipewire"
  1038. fi
  1039. have_audio=yes
  1040. fi
  1041. fi
  1042. }
  1043. dnl Find PulseAudio
  1044. CheckPulseAudio()
  1045. {
  1046. AC_ARG_ENABLE(pulseaudio,
  1047. [AS_HELP_STRING([--enable-pulseaudio], [use PulseAudio [default=yes]])],
  1048. , enable_pulseaudio=yes)
  1049. if test x$enable_audio = xyes -a x$enable_pulseaudio = xyes; then
  1050. PKG_CHECK_MODULES([PULSEAUDIO], [libpulse >= 0.9.15], audio_pulseaudio=yes, audio_pulseaudio=no)
  1051. if test x$audio_pulseaudio = xyes; then
  1052. AC_ARG_ENABLE(pulseaudio-shared,
  1053. [AS_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio support [default=yes]])],
  1054. , enable_pulseaudio_shared=yes)
  1055. pulseaudio_lib=[`find_lib "libpulse.so.*" "$PULSEAUDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
  1056. AC_DEFINE(SDL_AUDIO_DRIVER_PULSEAUDIO, 1, [ ])
  1057. SOURCES="$SOURCES $srcdir/src/audio/pulseaudio/*.c"
  1058. EXTRA_CFLAGS="$EXTRA_CFLAGS $PULSEAUDIO_CFLAGS"
  1059. if test x$have_loadso != xyes && \
  1060. test x$enable_pulseaudio_shared = xyes; then
  1061. AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic PulseAudio loading])
  1062. fi
  1063. if test x$have_loadso = xyes && \
  1064. test x$enable_pulseaudio_shared = xyes && test x$pulseaudio_lib != x; then
  1065. echo "-- dynamic libpulse -> $pulseaudio_lib"
  1066. AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC, "$pulseaudio_lib", [ ])
  1067. SUMMARY_audio="${SUMMARY_audio} pulse(dynamic)"
  1068. case "$host" in
  1069. # On Solaris, pulseaudio must be linked deferred explicitly
  1070. # to prevent undefined symbol failures.
  1071. *-*-solaris*)
  1072. PULSEAUDIO_LIBS=`echo $PULSEAUDIO_LIBS | sed 's/\-l/-Wl,-l/g'`
  1073. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-zdeferred $PULSEAUDIO_LIBS -Wl,-znodeferred"
  1074. esac
  1075. else
  1076. EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PULSEAUDIO_LIBS"
  1077. SUMMARY_audio="${SUMMARY_audio} pulse"
  1078. fi
  1079. have_audio=yes
  1080. fi
  1081. fi
  1082. }
  1083. CheckARTSC()
  1084. {
  1085. AC_ARG_ENABLE(arts,
  1086. [AS_HELP_STRING([--enable-arts], [support the Analog Real Time Synthesizer [default=yes]])],
  1087. , enable_arts=yes)
  1088. if test x$enable_audio = xyes -a x$enable_arts = xyes; then
  1089. AC_PATH_PROG(ARTSCONFIG, artsc-config)
  1090. if test x$ARTSCONFIG = x -o x$ARTSCONFIG = x'"$ARTSCONFIG"'; then
  1091. : # arts isn't installed
  1092. else
  1093. ARTS_CFLAGS=`$ARTSCONFIG --cflags`
  1094. ARTS_LIBS=`$ARTSCONFIG --libs`
  1095. AC_MSG_CHECKING(for aRts development environment)
  1096. audio_arts=no
  1097. save_CFLAGS="$CFLAGS"
  1098. CFLAGS="$CFLAGS $ARTS_CFLAGS"
  1099. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  1100. #include <artsc.h>
  1101. ]], [[
  1102. arts_stream_t stream;
  1103. ]])], [audio_arts=yes],[])
  1104. CFLAGS="$save_CFLAGS"
  1105. AC_MSG_RESULT($audio_arts)
  1106. if test x$audio_arts = xyes; then
  1107. AC_ARG_ENABLE(arts-shared,
  1108. [AS_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [default=yes]])],
  1109. , enable_arts_shared=yes)
  1110. arts_lib=[`find_lib "libartsc.so.*" "$ARTS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
  1111. AC_DEFINE(SDL_AUDIO_DRIVER_ARTS, 1, [ ])
  1112. SOURCES="$SOURCES $srcdir/src/audio/arts/*.c"
  1113. EXTRA_CFLAGS="$EXTRA_CFLAGS $ARTS_CFLAGS"
  1114. if test x$have_loadso != xyes && \
  1115. test x$enable_arts_shared = xyes; then
  1116. AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ARTS loading])
  1117. fi
  1118. if test x$have_loadso = xyes && \
  1119. test x$enable_arts_shared = xyes && test x$arts_lib != x; then
  1120. echo "-- dynamic libartsc -> $arts_lib"
  1121. AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ARTS_DYNAMIC, "$arts_lib", [ ])
  1122. SUMMARY_audio="${SUMMARY_audio} arts(dynamic)"
  1123. else
  1124. EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ARTS_LIBS"
  1125. SUMMARY_audio="${SUMMARY_audio} arts"
  1126. fi
  1127. have_audio=yes
  1128. fi
  1129. fi
  1130. fi
  1131. }
  1132. dnl See if the NAS audio interface is supported
  1133. CheckNAS()
  1134. {
  1135. AC_ARG_ENABLE(nas,
  1136. [AS_HELP_STRING([--enable-nas], [support the NAS audio API [default=yes]])],
  1137. , enable_nas=yes)
  1138. if test x$enable_audio = xyes -a x$enable_nas = xyes; then
  1139. AC_CHECK_HEADER(audio/audiolib.h, have_nas_hdr=yes)
  1140. AC_CHECK_LIB(audio, AuOpenServer, have_nas_lib=yes)
  1141. AC_MSG_CHECKING(for NAS audio support)
  1142. have_nas=no
  1143. if test x$have_nas_hdr = xyes -a x$have_nas_lib = xyes; then
  1144. have_nas=yes
  1145. NAS_LIBS="-laudio"
  1146. elif test -r /usr/X11R6/include/audio/audiolib.h; then
  1147. have_nas=yes
  1148. NAS_CFLAGS="-I/usr/X11R6/include/"
  1149. NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt"
  1150. fi
  1151. AC_MSG_RESULT($have_nas)
  1152. if test x$have_nas = xyes; then
  1153. AC_ARG_ENABLE(nas-shared,
  1154. [AS_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [default=yes]])],
  1155. , enable_nas_shared=yes)
  1156. nas_lib=[`find_lib "libaudio.so.*" "$NAS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
  1157. if test x$have_loadso != xyes && \
  1158. test x$enable_nas_shared = xyes; then
  1159. AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic NAS loading])
  1160. fi
  1161. if test x$have_loadso = xyes && \
  1162. test x$enable_nas_shared = xyes && test x$nas_lib != x; then
  1163. echo "-- dynamic libaudio -> $nas_lib"
  1164. AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_NAS_DYNAMIC, "$nas_lib", [ ])
  1165. SUMMARY_audio="${SUMMARY_audio} nas(dynamic)"
  1166. else
  1167. EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS"
  1168. SUMMARY_audio="${SUMMARY_audio} nas"
  1169. fi
  1170. AC_DEFINE(SDL_AUDIO_DRIVER_NAS, 1, [ ])
  1171. SOURCES="$SOURCES $srcdir/src/audio/nas/*.c"
  1172. EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS"
  1173. have_audio=yes
  1174. fi
  1175. fi
  1176. }
  1177. dnl See if the sndio audio interface is supported
  1178. CheckSNDIO()
  1179. {
  1180. AC_ARG_ENABLE(sndio,
  1181. [AS_HELP_STRING([--enable-sndio], [support the sndio audio API [default=yes]])],
  1182. , enable_sndio=yes)
  1183. if test x$enable_audio = xyes -a x$enable_sndio = xyes; then
  1184. PKG_CHECK_MODULES([SNDIO], [sndio], audio_sndio=yes, audio_sndio=no)
  1185. if test x$audio_sndio = xyes; then
  1186. AC_ARG_ENABLE(sndio-shared,
  1187. [AS_HELP_STRING([--enable-sndio-shared], [dynamically load sndio audio support [default=yes]])],
  1188. , enable_sndio_shared=yes)
  1189. sndio_lib=[`find_lib "libsndio.so.*" "$SNDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
  1190. if test x$have_loadso != xyes && \
  1191. test x$enable_sndio_shared = xyes; then
  1192. AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic sndio loading])
  1193. fi
  1194. if test x$have_loadso = xyes && \
  1195. test x$enable_sndio_shared = xyes && test x$sndio_lib != x; then
  1196. echo "-- dynamic libsndio -> $sndio_lib"
  1197. AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_SNDIO_DYNAMIC, "$sndio_lib", [ ])
  1198. SUMMARY_audio="${SUMMARY_audio} sndio(dynamic)"
  1199. else
  1200. EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SNDIO_LIBS"
  1201. SUMMARY_audio="${SUMMARY_audio} sndio"
  1202. fi
  1203. AC_DEFINE(SDL_AUDIO_DRIVER_SNDIO, 1, [ ])
  1204. SOURCES="$SOURCES $srcdir/src/audio/sndio/*.c"
  1205. EXTRA_CFLAGS="$EXTRA_CFLAGS $SNDIO_CFLAGS"
  1206. have_audio=yes
  1207. fi
  1208. fi
  1209. }
  1210. dnl Find FusionSound
  1211. CheckFusionSound()
  1212. {
  1213. AC_ARG_ENABLE(fusionsound,
  1214. [AS_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [default=no]])],
  1215. , enable_fusionsound=no)
  1216. if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then
  1217. PKG_CHECK_MODULES([FUSIONSOUND], [fusionsound >= 1.1.1], fusionsound=yes, fusionsound=no)
  1218. if test x$fusionsound = xyes; then
  1219. AC_DEFINE(SDL_AUDIO_DRIVER_FUSIONSOUND, 1, [ ])
  1220. SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c"
  1221. EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS"
  1222. AC_ARG_ENABLE(fusionsound-shared,
  1223. [AS_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audio support [default=yes]])],
  1224. , enable_fusionsound_shared=yes)
  1225. fusionsound_shared=no
  1226. AC_MSG_CHECKING(for FusionSound dynamic loading support)
  1227. if test x$have_loadso != xyes && \
  1228. test x$enable_fusionsound_shared = xyes; then
  1229. AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic fusionsound loading])
  1230. fi
  1231. if test x$have_loadso = xyes && \
  1232. test x$enable_fusionsound_shared = xyes; then
  1233. AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC, "libfusionsound.so", [ ])
  1234. fusionsound_shared=yes
  1235. SUMMARY_audio="${SUMMARY_audio} fusionsound(dynamic)"
  1236. else
  1237. EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS"
  1238. SUMMARY_audio="${SUMMARY_audio} fusionsound"
  1239. fi
  1240. AC_MSG_RESULT($fusionsound_shared)
  1241. have_audio=yes
  1242. fi
  1243. fi
  1244. }
  1245. dnl rcg07142001 See if the user wants the disk writer audio driver...
  1246. CheckDiskAudio()
  1247. {
  1248. AC_ARG_ENABLE(diskaudio,
  1249. [AS_HELP_STRING([--enable-diskaudio], [support the disk writer audio driver [default=yes]])],
  1250. , enable_diskaudio=yes)
  1251. if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then
  1252. AC_DEFINE(SDL_AUDIO_DRIVER_DISK, 1, [ ])
  1253. SOURCES="$SOURCES $srcdir/src/audio/disk/*.c"
  1254. SUMMARY_audio="${SUMMARY_audio} disk"
  1255. have_audio=yes
  1256. fi
  1257. }
  1258. dnl rcg03142006 See if the user wants the dummy audio driver...
  1259. CheckDummyAudio()
  1260. {
  1261. AC_ARG_ENABLE(dummyaudio,
  1262. [AS_HELP_STRING([--enable-dummyaudio], [support the dummy audio driver [default=yes]])],
  1263. , enable_dummyaudio=yes)
  1264. if test x$enable_audio = xyes -a x$enable_dummyaudio = xyes; then
  1265. AC_DEFINE(SDL_AUDIO_DRIVER_DUMMY, 1, [ ])
  1266. SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c"
  1267. SUMMARY_audio="${SUMMARY_audio} dummy"
  1268. have_audio=yes
  1269. fi
  1270. }
  1271. dnl See if libsamplerate is available
  1272. CheckLibSampleRate()
  1273. {
  1274. AC_ARG_ENABLE(libsamplerate,
  1275. [AS_HELP_STRING([--enable-libsamplerate], [use libsamplerate for audio rate conversion [default=yes]])],
  1276. , enable_libsamplerate=yes)
  1277. if test x$enable_libsamplerate = xyes; then
  1278. AC_CHECK_HEADER(samplerate.h,
  1279. have_samplerate_h_hdr=yes,
  1280. have_samplerate_h_hdr=no)
  1281. if test x$have_samplerate_h_hdr = xyes; then
  1282. AC_DEFINE(HAVE_LIBSAMPLERATE_H, 1, [ ])
  1283. AC_ARG_ENABLE(libsamplerate-shared,
  1284. [AS_HELP_STRING([--enable-libsamplerate-shared], [dynamically load libsamplerate [default=yes]])],
  1285. , enable_libsamplerate_shared=yes)
  1286. samplerate_lib=[`find_lib "libsamplerate.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`]
  1287. if test x$have_loadso != xyes && \
  1288. test x$enable_libsamplerate_shared = xyes; then
  1289. AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic libsamplerate loading])
  1290. fi
  1291. if test x$have_loadso = xyes && \
  1292. test x$enable_libsamplerate_shared = xyes && test x$samplerate_lib != x; then
  1293. echo "-- dynamic libsamplerate -> $samplerate_lib"
  1294. AC_DEFINE_UNQUOTED(SDL_LIBSAMPLERATE_DYNAMIC, "$samplerate_lib", [ ])
  1295. else
  1296. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lsamplerate"
  1297. fi
  1298. fi
  1299. fi
  1300. }
  1301. dnl Check for ARM instruction support using gas syntax
  1302. CheckARM()
  1303. {
  1304. AC_ARG_ENABLE(arm-simd,
  1305. [AS_HELP_STRING([--enable-arm-simd], [use SIMD assembly blitters on ARM [default=no]])],
  1306. enable_arm_simd=$enableval, enable_arm_simd=no)
  1307. if test x$enable_video = xyes -a x$enable_assembly = xyes -a x$enable_arm_simd = xyes; then
  1308. save_CFLAGS="$CFLAGS"
  1309. have_arm_simd=no
  1310. CFLAGS="-x assembler-with-cpp $CFLAGS"
  1311. AC_MSG_CHECKING(for ARM SIMD)
  1312. AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
  1313. .text
  1314. .arch armv6
  1315. .object_arch armv4
  1316. .arm
  1317. .altmacro
  1318. #ifndef __ARM_EABI__
  1319. #error EABI is required (to be sure that calling conventions are compatible)
  1320. #endif
  1321. pld [r0]
  1322. uqadd8 r0, r0, r0
  1323. ]])], have_arm_simd=yes)
  1324. AC_MSG_RESULT($have_arm_simd)
  1325. CFLAGS="$save_CFLAGS"
  1326. if test x$have_arm_simd = xyes; then
  1327. AC_DEFINE(SDL_ARM_SIMD_BLITTERS, 1, [ ])
  1328. SOURCES="$SOURCES $srcdir/src/video/arm/pixman-arm-simd*.S"
  1329. WARN_ABOUT_ARM_SIMD_ASM_MIT="yes"
  1330. fi
  1331. fi
  1332. }
  1333. dnl Check for ARM NEON instruction support using gas syntax
  1334. CheckNEON()
  1335. {
  1336. AC_ARG_ENABLE(arm-neon,
  1337. [AS_HELP_STRING([--enable-arm-neon], [use NEON assembly blitters on ARM [default=no]])],
  1338. enable_arm_neon=$enableval, enable_arm_neon=no)
  1339. if test x$enable_video = xyes -a x$enable_assembly = xyes -a x$enable_arm_neon = xyes; then
  1340. save_CFLAGS="$CFLAGS"
  1341. have_arm_neon=no
  1342. CFLAGS="-x assembler-with-cpp $CFLAGS"
  1343. AC_MSG_CHECKING(for ARM NEON)
  1344. AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
  1345. .text
  1346. .fpu neon
  1347. .arch armv7a
  1348. .object_arch armv4
  1349. .eabi_attribute 10, 0
  1350. .arm
  1351. .altmacro
  1352. #ifndef __ARM_EABI__
  1353. #error EABI is required (to be sure that calling conventions are compatible)
  1354. #endif
  1355. pld [r0]
  1356. vmovn.u16 d0, q0
  1357. ]])], have_arm_neon=yes)
  1358. AC_MSG_RESULT($have_arm_neon)
  1359. CFLAGS="$save_CFLAGS"
  1360. if test x$have_arm_neon = xyes; then
  1361. AC_DEFINE(SDL_ARM_NEON_BLITTERS, 1, [ ])
  1362. SOURCES="$SOURCES $srcdir/src/video/arm/pixman-arm-neon*.S"
  1363. WARN_ABOUT_ARM_NEON_ASM_MIT="yes"
  1364. fi
  1365. fi
  1366. }
  1367. dnl See if clang's -fobjc-arc supported.
  1368. dnl Reference: https://github.com/libsdl-org/SDL/pull/5632
  1369. CheckObjectiveCARC()
  1370. {
  1371. AC_MSG_CHECKING(for clang -fobjc-arc option)
  1372. have_clang_objc_arc=no
  1373. save_CFLAGS="$CFLAGS"
  1374. CFLAGS="$save_CFLAGS -fobjc-arc"
  1375. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  1376. int x = 0;
  1377. ]],[])], [have_clang_objc_arc=yes],[])
  1378. AC_MSG_RESULT($have_clang_objc_arc)
  1379. CFLAGS="$save_CFLAGS"
  1380. if test x$have_clang_objc_arc = xyes; then
  1381. EXTRA_CFLAGS="$EXTRA_CFLAGS -fobjc-arc"
  1382. fi
  1383. }
  1384. dnl See if GCC's -gdwarf-4 is supported
  1385. dnl See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101377 for why this is needed on Windows
  1386. CheckGDwarf4()
  1387. {
  1388. AC_MSG_CHECKING(for GCC -gdwarf-4 option)
  1389. have_gcc_gdwarf4=no
  1390. save_CFLAGS="$CFLAGS"
  1391. CFLAGS="$save_CFLAGS -gdwarf-4"
  1392. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  1393. int x = 0;
  1394. ]],[])], [have_gcc_gdwarf4=yes],[])
  1395. AC_MSG_RESULT($have_gcc_gdwarf4)
  1396. CFLAGS="$save_CFLAGS"
  1397. if test x$have_gcc_gdwarf4 = xyes; then
  1398. EXTRA_CFLAGS="$EXTRA_CFLAGS -gdwarf-4"
  1399. fi
  1400. }
  1401. dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually).
  1402. dnl Details of this flag are here: http://gcc.gnu.org/wiki/Visibility
  1403. CheckVisibilityHidden()
  1404. {
  1405. AC_MSG_CHECKING(for GCC -fvisibility=hidden option)
  1406. have_gcc_fvisibility=no
  1407. visibility_CFLAGS="-fvisibility=hidden"
  1408. save_CFLAGS="$CFLAGS"
  1409. CFLAGS="$save_CFLAGS $visibility_CFLAGS -Werror"
  1410. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  1411. #if !defined(__GNUC__) || __GNUC__ < 4
  1412. #error SDL only uses visibility attributes in GCC 4 or newer
  1413. #endif
  1414. ]],[])], [have_gcc_fvisibility=yes],[])
  1415. AC_MSG_RESULT($have_gcc_fvisibility)
  1416. CFLAGS="$save_CFLAGS"
  1417. if test x$have_gcc_fvisibility = xyes; then
  1418. EXTRA_CFLAGS="$EXTRA_CFLAGS $visibility_CFLAGS"
  1419. fi
  1420. }
  1421. dnl See if GCC's -fno-strict-aliasingis supported.
  1422. dnl Reference: https://bugzilla.libsdl.org/show_bug.cgi?id=4254
  1423. CheckNoStrictAliasing()
  1424. {
  1425. AC_MSG_CHECKING(for GCC -fno-strict-aliasing option)
  1426. have_gcc_no_strict_aliasing=no
  1427. save_CFLAGS="$CFLAGS"
  1428. CFLAGS="$save_CFLAGS -fno-strict-aliasing"
  1429. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  1430. int x = 0;
  1431. ]],[])], [have_gcc_no_strict_aliasing=yes],[])
  1432. AC_MSG_RESULT($have_gcc_no_strict_aliasing)
  1433. CFLAGS="$save_CFLAGS"
  1434. if test x$have_gcc_no_strict_aliasing = xyes; then
  1435. EXTRA_CFLAGS="$EXTRA_CFLAGS -fno-strict-aliasing"
  1436. fi
  1437. }
  1438. dnl See if GCC's -Werror is supported.
  1439. CheckWerror()
  1440. {
  1441. AC_ARG_ENABLE(werror,
  1442. [AS_HELP_STRING([--enable-werror], [treat warnings as errors [default=no]])],
  1443. enable_werror=$enableval, enable_werror=no)
  1444. if test x$enable_werror = xyes; then
  1445. AC_MSG_CHECKING(for GCC -Werror option)
  1446. have_gcc_werror=no
  1447. save_CFLAGS="$CFLAGS"
  1448. CFLAGS="$save_CFLAGS -Werror"
  1449. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  1450. int x = 0;
  1451. ]],[])], [have_gcc_werror=yes],[])
  1452. AC_MSG_RESULT($have_gcc_werror)
  1453. CFLAGS="$save_CFLAGS"
  1454. if test x$have_gcc_werror = xyes; then
  1455. EXTRA_CFLAGS="$EXTRA_CFLAGS -Werror"
  1456. fi
  1457. fi
  1458. }
  1459. dnl See if GCC's -Wno-error=deprecated-declarations is supported.
  1460. CheckNoErrorDeprecatedDeclarationsWerror()
  1461. {
  1462. AC_MSG_CHECKING(for GCC -Wno-error=deprecated-declarations option)
  1463. have_gcc_no_werror_deprecated_declarations=no
  1464. save_CFLAGS="$CFLAGS"
  1465. CFLAGS="$save_CFLAGS -Wno-error=deprecated-declarations"
  1466. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  1467. int x = 0;
  1468. ]],[])], [have_gcc_no_werror_deprecated_declarations=yes],[])
  1469. AC_MSG_RESULT($have_gcc_werror)
  1470. CFLAGS="$save_CFLAGS"
  1471. if test x$have_gcc_no_werror_deprecated_declarations = xyes; then
  1472. EXTRA_CFLAGS="$EXTRA_CFLAGS -Wno-error=deprecated-declarations"
  1473. fi
  1474. }
  1475. dnl See if GCC's -Wdeclaration-after-statement is supported.
  1476. dnl This lets us catch things that would fail on a C89 compiler when using
  1477. dnl a modern GCC.
  1478. CheckDeclarationAfterStatement()
  1479. {
  1480. AC_MSG_CHECKING(for GCC -Wdeclaration-after-statement option)
  1481. have_gcc_declaration_after_statement=no
  1482. save_CFLAGS="$CFLAGS"
  1483. CFLAGS="$save_CFLAGS -Wdeclaration-after-statement -Werror=declaration-after-statement"
  1484. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  1485. int x = 0;
  1486. ]],[])], [have_gcc_declaration_after_statement=yes],[])
  1487. AC_MSG_RESULT($have_gcc_declaration_after_statement)
  1488. CFLAGS="$save_CFLAGS"
  1489. if test x$have_gcc_declaration_after_statement = xyes; then
  1490. EXTRA_CFLAGS="$EXTRA_CFLAGS -Wdeclaration-after-statement -Werror=declaration-after-statement"
  1491. fi
  1492. }
  1493. dnl See if GCC's -Wall is supported.
  1494. CheckWarnAll()
  1495. {
  1496. AC_MSG_CHECKING(for GCC -Wall option)
  1497. have_gcc_Wall=no
  1498. save_CFLAGS="$CFLAGS"
  1499. CFLAGS="$save_CFLAGS -Wall"
  1500. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  1501. int x = 0;
  1502. ]],[])], [have_gcc_Wall=yes],[])
  1503. AC_MSG_RESULT($have_gcc_Wall)
  1504. CFLAGS="$save_CFLAGS"
  1505. if test x$have_gcc_Wall = xyes; then
  1506. EXTRA_CFLAGS="$EXTRA_CFLAGS -Wall"
  1507. dnl Haiku headers use multicharacter constants all over the place. Ignore these warnings when using -Wall.
  1508. AC_MSG_CHECKING(for necessary GCC -Wno-multichar option)
  1509. need_gcc_Wno_multichar=no
  1510. case "$host" in
  1511. *-*-haiku*)
  1512. need_gcc_Wno_multichar=yes
  1513. ;;
  1514. esac
  1515. AC_MSG_RESULT($need_gcc_Wno_multichar)
  1516. if test x$need_gcc_Wno_multichar = xyes; then
  1517. EXTRA_CFLAGS="$EXTRA_CFLAGS -Wno-multichar"
  1518. fi
  1519. fi
  1520. }
  1521. dnl See if GCC's -Wunused-local-typedefs is supported and disable it
  1522. dnl because it triggers on gcc 4.8.4 for compile time asserts inside
  1523. dnl of functions.
  1524. CheckUnusedLocalTypedefs()
  1525. {
  1526. AC_MSG_CHECKING(for GCC -Wunused-local-typedefs option)
  1527. have_gcc_unused_local_typedefs=no
  1528. save_CFLAGS="$CFLAGS"
  1529. CFLAGS="$save_CFLAGS -Wunused-local-typedefs"
  1530. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  1531. int x = 0;
  1532. ]],[])], [have_gcc_unused_local_typedefs=yes],[])
  1533. AC_MSG_RESULT($have_gcc_unused_local_typedefs)
  1534. CFLAGS="$save_CFLAGS"
  1535. if test x$have_gcc_unused_local_typedefs = xyes; then
  1536. EXTRA_CFLAGS="$EXTRA_CFLAGS -Wno-unused-local-typedefs"
  1537. fi
  1538. }
  1539. dnl Check for Wayland
  1540. CheckWayland()
  1541. {
  1542. AC_ARG_ENABLE(video-wayland,
  1543. [AS_HELP_STRING([--enable-video-wayland], [use Wayland video driver [default=yes]])],
  1544. ,enable_video_wayland=yes)
  1545. AC_ARG_ENABLE(video-wayland-qt-touch,
  1546. [AS_HELP_STRING([--enable-video-wayland-qt-touch], [QtWayland server support for Wayland video driver [default=yes]])],
  1547. ,enable_video_wayland_qt_touch=yes)
  1548. if test x$enable_video = xyes -a x$enable_video_wayland = xyes; then
  1549. AC_MSG_CHECKING(for Wayland support)
  1550. video_wayland=no
  1551. if test x$video_opengl_egl = xyes && \
  1552. test x$video_opengles_v2 = xyes; then
  1553. if $PKG_CONFIG --exists 'wayland-client >= 1.18' wayland-scanner wayland-egl wayland-cursor egl 'xkbcommon >= 0.5.0'; then
  1554. WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor xkbcommon`
  1555. WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor xkbcommon`
  1556. WAYLAND_SCANNER=`$PKG_CONFIG --variable=wayland_scanner wayland-scanner`
  1557. AS_IF([$PKG_CONFIG --exists 'wayland-scanner >= 1.15'],
  1558. [WAYLAND_SCANNER_CODE_MODE=private-code],
  1559. [WAYLAND_SCANNER_CODE_MODE=code])
  1560. video_wayland=yes
  1561. fi
  1562. fi
  1563. AC_MSG_RESULT($video_wayland)
  1564. if test x$video_wayland = xyes; then
  1565. AC_DEFINE(SDL_VIDEO_DRIVER_WAYLAND, 1, [ ])
  1566. if test x$enable_video_wayland_qt_touch = xyes; then
  1567. AC_DEFINE(SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH, 1, [ ])
  1568. fi
  1569. WAYLAND_SOURCES="$srcdir/src/video/wayland/*.c"
  1570. SOURCES="$SOURCES $WAYLAND_SOURCES"
  1571. EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS -I\$(gen)"
  1572. AC_ARG_ENABLE(wayland-shared,
  1573. [AS_HELP_STRING([--enable-wayland-shared], [dynamically load Wayland support [default=maybe]])],
  1574. , enable_wayland_shared=maybe)
  1575. dnl FIXME: Do BSD and OS X need special cases?
  1576. case "$host" in
  1577. *)
  1578. wayland_client_lib=[`find_lib "libwayland-client.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
  1579. wayland_egl_lib=[`find_lib "libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
  1580. if test x$wayland_egl_lib = x; then
  1581. # This works in Ubuntu 13.10, maybe others
  1582. wayland_egl_lib=[`find_lib "mesa-egl/libwayland-egl.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
  1583. fi
  1584. wayland_cursor_lib=[`find_lib "libwayland-cursor.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
  1585. xkbcommon_lib=[`find_lib "libxkbcommon.so.*" "$WAYLAND_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
  1586. ;;
  1587. esac
  1588. if test x$enable_wayland_shared = xmaybe; then
  1589. enable_wayland_shared=yes
  1590. fi
  1591. if test x$have_loadso != xyes && \
  1592. test x$enable_wayland_shared = xyes; then
  1593. AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic Wayland loading])
  1594. enable_wayland_shared=no
  1595. fi
  1596. if test x$have_loadso = xyes && \
  1597. test x$enable_wayland_shared = xyes && \
  1598. test x$wayland_client_lib != x && \
  1599. test x$wayland_egl_lib != x && \
  1600. test x$wayland_cursor_lib != x && \
  1601. test x$xkbcommon_lib != x; then
  1602. echo "-- dynamic libwayland-client -> $wayland_client_lib"
  1603. echo "-- dynamic libwayland-egl -> $wayland_egl_lib"
  1604. echo "-- dynamic libwayland-cursor -> $wayland_cursor_lib"
  1605. echo "-- dynamic libxkbcommon -> $xkbcommon_lib"
  1606. AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC, "$wayland_client_lib", [ ])
  1607. AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL, "$wayland_egl_lib", [ ])
  1608. AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_CURSOR, "$wayland_cursor_lib", [ ])
  1609. AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_XKBCOMMON, "$xkbcommon_lib", [ ])
  1610. SUMMARY_video="${SUMMARY_video} wayland(dynamic)"
  1611. else
  1612. enable_wayland_shared=no
  1613. EXTRA_LDFLAGS="$EXTRA_LDFLAGS $WAYLAND_LIBS"
  1614. SUMMARY_video="${SUMMARY_video} wayland"
  1615. fi
  1616. have_video=yes
  1617. dnl See if libdecor is available
  1618. AC_ARG_ENABLE(libdecor,
  1619. [AS_HELP_STRING([--enable-libdecor], [use libdecor for Wayland client-side decorations [default=yes]])],, enable_libdecor=yes)
  1620. if test x$enable_libdecor = xyes; then
  1621. PKG_CHECK_MODULES([DECOR], [libdecor-0], video_libdecor=yes, video_libdecor=no)
  1622. if test x$video_libdecor = xyes; then
  1623. EXTRA_CFLAGS="$EXTRA_CFLAGS $DECOR_CFLAGS"
  1624. AC_DEFINE(HAVE_LIBDECOR_H, 1, [ ])
  1625. AC_ARG_ENABLE(libdecor-shared,
  1626. [AS_HELP_STRING([--enable-libdecor-shared], [dynamically load libdecor [default=yes]])],, enable_libdecor_shared=yes)
  1627. decor_lib=[`find_lib "libdecor-0.so.*" "$DECOR_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
  1628. if test x$enable_wayland_shared != xyes; then
  1629. enable_libdecor_shared=no
  1630. fi
  1631. if test x$have_loadso != xyes && \
  1632. test x$enable_libdecor_shared = xyes; then
  1633. AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic libdecor loading])
  1634. fi
  1635. if test x$have_loadso = xyes && \
  1636. test x$enable_libdecor_shared = xyes && test x$decor_lib != x; then
  1637. echo "-- dynamic libdecor -> $decor_lib"
  1638. AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_LIBDECOR, "$decor_lib", [ ])
  1639. else
  1640. EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DECOR_LIBS"
  1641. fi
  1642. saved_cflags=$CFLAGS
  1643. CFLAGS="$CFLAGS $DECOR_CFLAGS"
  1644. AC_CHECK_DECLS([libdecor_frame_get_min_content_size, libdecor_frame_get_max_content_size], [libdecor_get_min_max=yes], [ ], [[#include <libdecor.h>]])
  1645. if test x$libdecor_get_min_max = xyes; then
  1646. AC_DEFINE(SDL_HAVE_LIBDECOR_GET_MIN_MAX, 1, [ ])
  1647. fi
  1648. CFLAGS="$saved_cflags"
  1649. fi
  1650. fi
  1651. fi
  1652. fi
  1653. }
  1654. dnl Check for Native Client stuff
  1655. CheckNativeClient()
  1656. {
  1657. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  1658. #if !defined(__native_client__)
  1659. #error "NO NACL"
  1660. #endif
  1661. ]],[])], [
  1662. AC_DEFINE(SDL_VIDEO_DRIVER_NACL, 1, [ ])
  1663. AC_DEFINE(SDL_AUDIO_DRIVER_NACL, 1, [ ])
  1664. AC_DEFINE(HAVE_POW, 1, [ ])
  1665. AC_DEFINE(HAVE_OPENGLES2, 1, [ ])
  1666. AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
  1667. AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
  1668. SDL_LIBS="-lppapi_simple -lppapi_gles2 $SDL_LIBS"
  1669. SDLMAIN_SOURCES="$srcdir/src/main/nacl/*.c"
  1670. SOURCES="$SOURCES $srcdir/src/audio/nacl/*.c"
  1671. SUMMARY_audio="${SUMMARY_audio} nacl"
  1672. have_audio=yes
  1673. SOURCES="$SOURCES $srcdir/src/video/nacl/*.c"
  1674. SUMMARY_video="${SUMMARY_video} nacl opengles2"
  1675. have_video=yes
  1676. ],[])
  1677. }
  1678. CheckRPI()
  1679. {
  1680. AC_ARG_ENABLE(video-rpi,
  1681. [AS_HELP_STRING([--enable-video-rpi], [use Raspberry Pi 0-3 video driver [default=yes]])],
  1682. , enable_video_rpi=yes)
  1683. if test x$enable_video = xyes -a x$enable_video_rpi = xyes; then
  1684. PKG_CHECK_MODULES([RPI], [bcm_host], video_rpi=yes, video_rpi=no)
  1685. PKG_CHECK_MODULES([RPI_EGL], [brcmegl], video_rpi_egl=yes, video_rpi_egl=no)
  1686. if test x$video_rpi = xno; then
  1687. if test x$ARCH = xnetbsd; then
  1688. RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux"
  1689. RPI_LIBS="-L/usr/pkg/lib -lbcm_host"
  1690. else
  1691. RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
  1692. RPI_LIBS="-L/opt/vc/lib -lbcm_host"
  1693. fi
  1694. fi
  1695. if test x$video_rpi_egl = xno; then
  1696. if test x$ARCH = xnetbsd; then
  1697. RPI_EGL_LIBS="-Wl,-R/usr/pkg/lib"
  1698. else
  1699. RPI_EGL_LIBS="-Wl,-rpath,/opt/vc/lib"
  1700. fi
  1701. fi
  1702. # Save the original compiler flags and libraries
  1703. ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1704. # Add the Raspberry Pi compiler flags and libraries
  1705. CFLAGS="$CFLAGS $RPI_CFLAGS"; LIBS="$LIBS $RPI_EGL_LIBS $RPI_LIBS"
  1706. AC_MSG_CHECKING(for Raspberry Pi 0-3)
  1707. have_video_rpi=no
  1708. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  1709. #include <bcm_host.h>
  1710. ]], [[
  1711. bcm_host_init();
  1712. ]])], [have_video_rpi=yes],[])
  1713. AC_MSG_RESULT($have_video_rpi)
  1714. # Restore the compiler flags and libraries
  1715. CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1716. if test x$have_video_rpi = xyes; then
  1717. CFLAGS="$CFLAGS $RPI_CFLAGS"
  1718. SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
  1719. EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
  1720. EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_EGL_LIBS $RPI_LIBS"
  1721. SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
  1722. AC_DEFINE(SDL_VIDEO_DRIVER_RPI, 1, [ ])
  1723. SUMMARY_video="${SUMMARY_video} rpi"
  1724. have_video=yes
  1725. fi
  1726. fi
  1727. }
  1728. dnl Find the X11 include and library directories
  1729. CheckX11()
  1730. {
  1731. AC_ARG_ENABLE(video-x11,
  1732. [AS_HELP_STRING([--enable-video-x11], [use X11 video driver [default=maybe]])],
  1733. ,[
  1734. enable_video_x11=yes
  1735. case "$host" in
  1736. *-*-darwin*|*-ios-*)
  1737. enable_video_x11=no
  1738. ;;
  1739. esac])
  1740. if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
  1741. case "$host" in
  1742. *-*-darwin*)
  1743. # This isn't necessary for X11, but fixes GLX detection
  1744. if test "x$x_includes" = xNONE && \
  1745. test "x$x_libraries" = xNONE && \
  1746. test -d /opt/X11/include && \
  1747. test -d /opt/X11/lib; then
  1748. x_includes="/opt/X11/include"
  1749. x_libraries="/opt/X11/lib"
  1750. fi
  1751. ;;
  1752. esac
  1753. AC_PATH_X
  1754. AC_PATH_XTRA
  1755. if test x$have_x = xyes; then
  1756. AC_ARG_ENABLE(x11-shared,
  1757. [AS_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [default=maybe]])],
  1758. , enable_x11_shared=maybe)
  1759. case "$host" in
  1760. *-*-darwin*)
  1761. # Apple now puts this in /opt/X11
  1762. x11_lib='/opt/X11/lib/libX11.6.dylib'
  1763. x11ext_lib='/opt/X11/lib/libXext.6.dylib'
  1764. xcursor_lib='/opt/X11/lib/libXcursor.1.dylib'
  1765. xinput_lib='/opt/X11/lib/libXi.6.dylib'
  1766. xfixes_lib='/opt/X11/lib/libXfixes.3.dylib'
  1767. xrandr_lib='/opt/X11/lib/libXrandr.2.dylib'
  1768. xrender_lib='/opt/X11/lib/libXrender.1.dylib'
  1769. xss_lib='/opt/X11/lib/libXss.1.dylib'
  1770. ;;
  1771. *-*-openbsd*)
  1772. x11_lib='libX11.so'
  1773. x11ext_lib='libXext.so'
  1774. xcursor_lib='libXcursor.so'
  1775. xinput_lib='libXi.so'
  1776. xfixes_lib='libXfixes.so'
  1777. xrandr_lib='libXrandr.so'
  1778. xrender_lib='libXrender.so'
  1779. xss_lib='libXss.so'
  1780. ;;
  1781. *)
  1782. x11_lib=[`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1783. x11ext_lib=[`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1784. xcursor_lib=[`find_lib "libXcursor.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1785. xinput_lib=[`find_lib "libXi.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1786. xfixes_lib=[`find_lib "libXfixes.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1787. xrandr_lib=[`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1788. xrender_lib=[`find_lib "libXrender.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1789. xss_lib=[`find_lib "libXss.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1790. ;;
  1791. esac
  1792. if test x$ac_cv_func_shmat != xyes; then
  1793. X_CFLAGS="$X_CFLAGS -DNO_SHARED_MEMORY"
  1794. fi
  1795. CFLAGS="$CFLAGS $X_CFLAGS"
  1796. LDFLAGS="$LDFLAGS $X_LIBS"
  1797. AC_CHECK_HEADER(X11/extensions/Xext.h,
  1798. have_xext_h_hdr=yes,
  1799. have_xext_h_hdr=no,
  1800. [#include <X11/Xlib.h>
  1801. #include <X11/Xproto.h>
  1802. ])
  1803. if test x$have_xext_h_hdr != xyes; then
  1804. AC_MSG_ERROR([
  1805. *** Missing Xext.h, maybe you need to install the libxext-dev package?
  1806. ])
  1807. fi
  1808. AC_DEFINE(SDL_VIDEO_DRIVER_X11, 1, [ ])
  1809. SOURCES="$SOURCES $srcdir/src/video/x11/*.c"
  1810. EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS"
  1811. # Needed so SDL applications can include SDL_syswm.h
  1812. SDL_CFLAGS="$SDL_CFLAGS $X_CFLAGS"
  1813. if test x$enable_x11_shared = xmaybe; then
  1814. enable_x11_shared=yes
  1815. fi
  1816. if test x$have_loadso != xyes && \
  1817. test x$enable_x11_shared = xyes; then
  1818. AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic X11 loading])
  1819. enable_x11_shared=no
  1820. fi
  1821. if test x$have_loadso = xyes && \
  1822. test x$enable_x11_shared = xyes && test x$x11_lib != x && test x$x11ext_lib != x; then
  1823. echo "-- dynamic libX11 -> $x11_lib"
  1824. echo "-- dynamic libX11ext -> $x11ext_lib"
  1825. AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC, "$x11_lib", [ ])
  1826. AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib", [ ])
  1827. SUMMARY_video="${SUMMARY_video} x11(dynamic)"
  1828. else
  1829. enable_x11_shared=no
  1830. EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext"
  1831. SUMMARY_video="${SUMMARY_video} x11"
  1832. fi
  1833. have_video=yes
  1834. AC_MSG_CHECKING([for XGenericEvent])
  1835. have_XGenericEvent=no
  1836. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  1837. #include <X11/Xlib.h>
  1838. ]], [[
  1839. Display *display;
  1840. XEvent event;
  1841. XGenericEventCookie *cookie = &event.xcookie;
  1842. XNextEvent(display, &event);
  1843. XGetEventData(display, cookie);
  1844. XFreeEventData(display, cookie);
  1845. ]])], [
  1846. have_XGenericEvent=yes
  1847. AC_DEFINE([SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS], 1, [ ])
  1848. ],[])
  1849. AC_MSG_RESULT($have_XGenericEvent)
  1850. AC_CHECK_LIB(X11, XkbKeycodeToKeysym, AC_DEFINE(SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM, 1, [Have XkbKeycodeToKeysym]))
  1851. AC_ARG_ENABLE(video-x11-xcursor,
  1852. [AS_HELP_STRING([--enable-video-x11-xcursor], [enable X11 Xcursor support [default=yes]])],
  1853. , enable_video_x11_xcursor=yes)
  1854. if test x$enable_video_x11_xcursor = xyes; then
  1855. definitely_enable_video_x11_xcursor=no
  1856. AC_CHECK_HEADER(X11/Xcursor/Xcursor.h,
  1857. have_xcursor_h_hdr=yes,
  1858. have_xcursor_h_hdr=no,
  1859. [#include <X11/Xlib.h>
  1860. ])
  1861. if test x$have_xcursor_h_hdr = xyes; then
  1862. if test x$enable_x11_shared = xyes && test x$xcursor_lib != x ; then
  1863. echo "-- dynamic libXcursor -> $xcursor_lib"
  1864. AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR, "$xcursor_lib", [ ])
  1865. definitely_enable_video_x11_xcursor=yes
  1866. else
  1867. AC_CHECK_LIB(Xcursor, XcursorImageCreate, have_xcursor_lib=yes)
  1868. if test x$have_xcursor_lib = xyes ; then
  1869. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXcursor"
  1870. definitely_enable_video_x11_xcursor=yes
  1871. fi
  1872. fi
  1873. fi
  1874. fi
  1875. if test x$definitely_enable_video_x11_xcursor = xyes; then
  1876. AC_DEFINE(SDL_VIDEO_DRIVER_X11_XCURSOR, 1, [ ])
  1877. SUMMARY_video_x11="${SUMMARY_video_x11} xcursor"
  1878. fi
  1879. AC_ARG_ENABLE(video-x11-xdbe,
  1880. [AS_HELP_STRING([--enable-video-x11-xdbe], [enable X11 Xdbe support [default=yes]])],
  1881. , enable_video_x11_xdbe=yes)
  1882. if test x$enable_video_x11_xdbe = xyes; then
  1883. AC_CHECK_HEADER(X11/extensions/Xdbe.h,
  1884. have_dbe_h_hdr=yes,
  1885. have_dbe_h_hdr=no,
  1886. [#include <X11/Xlib.h>
  1887. ])
  1888. if test x$have_dbe_h_hdr = xyes; then
  1889. AC_DEFINE(SDL_VIDEO_DRIVER_X11_XDBE, 1, [ ])
  1890. SUMMARY_video_x11="${SUMMARY_video_x11} xdbe"
  1891. fi
  1892. fi
  1893. AC_ARG_ENABLE(video-x11-xinput,
  1894. [AS_HELP_STRING([--enable-video-x11-xinput], [enable X11 XInput extension for manymouse, tablets, etc [default=yes]])],
  1895. , enable_video_x11_xinput=yes)
  1896. if test x$enable_video_x11_xinput = xyes; then
  1897. definitely_enable_video_x11_xinput=no
  1898. AC_CHECK_HEADER(X11/extensions/XInput2.h,
  1899. have_xinput_h_hdr=yes,
  1900. have_xinput_h_hdr=no,
  1901. [#include <X11/Xlib.h>
  1902. ])
  1903. if test x$have_xinput_h_hdr = xyes; then
  1904. if test x$enable_x11_shared = xyes && test x$xinput_lib != x ; then
  1905. echo "-- dynamic libXi -> $xinput_lib"
  1906. AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2, "$xinput_lib", [ ])
  1907. definitely_enable_video_x11_xinput=yes
  1908. else
  1909. AC_CHECK_LIB(Xi, XOpenDevice, have_xinput_lib=yes)
  1910. if test x$have_xinput_lib = xyes ; then
  1911. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXi"
  1912. definitely_enable_video_x11_xinput=yes
  1913. fi
  1914. fi
  1915. fi
  1916. fi
  1917. if test x$definitely_enable_video_x11_xinput = xyes; then
  1918. SUMMARY_video_x11="${SUMMARY_video_x11} xinput2"
  1919. AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT2, 1, [ ])
  1920. AC_MSG_CHECKING(for xinput2 multitouch)
  1921. have_xinput2_multitouch=no
  1922. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  1923. #include <X11/Xlib.h>
  1924. #include <X11/Xproto.h>
  1925. #include <X11/extensions/XInput2.h>
  1926. ]], [[
  1927. int event_type = XI_TouchBegin;
  1928. XITouchClassInfo *t;
  1929. ]])], [
  1930. have_xinput2_multitouch=yes
  1931. AC_DEFINE([SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH], 1, [ ])
  1932. SUMMARY_video_x11="${SUMMARY_video_x11} xinput2_multitouch"
  1933. ],[])
  1934. AC_MSG_RESULT($have_xinput2_multitouch)
  1935. fi
  1936. AC_ARG_ENABLE(video-x11-xfixes,
  1937. [AS_HELP_STRING([--enable-video-x11-xfixes], [enable X11 Xfixes support [default=yes]])],
  1938. , enable_video_x11_xfixes=yes)
  1939. if test x$enable_video_x11_xfixes = xyes; then
  1940. definitely_enable_video_x11_xfixes=no
  1941. # check along with XInput2.h because we use Xfixes with XIBarrierReleasePointer
  1942. AC_MSG_CHECKING(for X11/extensions/Xfixes.h)
  1943. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  1944. #include <X11/Xlib.h>
  1945. #include <X11/Xproto.h>
  1946. #include <X11/extensions/XInput2.h>
  1947. #include <X11/extensions/Xfixes.h>]],
  1948. [BarrierEventID b;])],
  1949. [have_xfixes_h_hdr=yes],
  1950. [have_xfixes_h_hdr=no])
  1951. AC_MSG_RESULT($have_xfixes_h_hdr)
  1952. if test x$have_xfixes_h_hdr = xyes; then
  1953. if test x$enable_x11_shared = xyes && test x$xfixes_lib != x ; then
  1954. echo "-- dynamic libXfixes -> $xfixes_lib"
  1955. AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XFIXES, "$xfixes_lib", [ ])
  1956. definitely_enable_video_x11_xfixes=yes
  1957. else
  1958. AC_CHECK_LIB(Xfixes, XFixesCreatePointerBarrier, have_xfixes_lib=yes)
  1959. if test x$have_xfixes_lib = xyes ; then
  1960. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXfixes"
  1961. definitely_enable_video_x11_xfixes=yes
  1962. fi
  1963. fi
  1964. fi
  1965. fi
  1966. if test x$definitely_enable_video_x11_xfixes = xyes; then
  1967. AC_DEFINE(SDL_VIDEO_DRIVER_X11_XFIXES, 1, [ ])
  1968. SUMMARY_video_x11="${SUMMARY_video_x11} xfixes"
  1969. fi
  1970. AC_ARG_ENABLE(video-x11-xrandr,
  1971. [AS_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [default=yes]])],
  1972. , enable_video_x11_xrandr=yes)
  1973. if test x$enable_video_x11_xrandr = xyes; then
  1974. dnl XRRScreenResources is only present in Xrandr >= 1.2, we use that as a test.
  1975. definitely_enable_video_x11_xrandr=no
  1976. have_xrandr_h_hdr=no
  1977. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  1978. #include <X11/Xlib.h>
  1979. #include <X11/extensions/Xrandr.h>
  1980. ]], [[
  1981. XRRScreenResources *res = NULL;
  1982. ]])], [have_xrandr_h_hdr=yes],[])
  1983. if test x$have_xrandr_h_hdr = xyes; then
  1984. if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then
  1985. echo "-- dynamic libXrandr -> $xrandr_lib"
  1986. AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR, "$xrandr_lib", [ ])
  1987. definitely_enable_video_x11_xrandr=yes
  1988. else
  1989. AC_CHECK_LIB(Xrandr, XRRQueryExtension, have_xrandr_lib=yes)
  1990. if test x$have_xrandr_lib = xyes ; then
  1991. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrandr"
  1992. definitely_enable_video_x11_xrandr=yes
  1993. fi
  1994. fi
  1995. fi
  1996. fi
  1997. if test x$definitely_enable_video_x11_xrandr = xyes; then
  1998. AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRANDR, 1, [ ])
  1999. SUMMARY_video_x11="${SUMMARY_video_x11} xrandr"
  2000. fi
  2001. AC_ARG_ENABLE(video-x11-scrnsaver,
  2002. [AS_HELP_STRING([--enable-video-x11-scrnsaver], [enable X11 screensaver extension [default=yes]])],
  2003. , enable_video_x11_scrnsaver=yes)
  2004. if test x$enable_video_x11_scrnsaver = xyes; then
  2005. AC_CHECK_HEADER(X11/extensions/scrnsaver.h,
  2006. have_scrnsaver_h_hdr=yes,
  2007. have_scrnsaver_h_hdr=no,
  2008. [#include <X11/Xlib.h>
  2009. ])
  2010. if test x$have_scrnsaver_h_hdr = xyes; then
  2011. if test x$enable_x11_shared = xyes && test x$xss_lib != x ; then
  2012. echo "-- dynamic libXss -> $xss_lib"
  2013. AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS, "$xss_lib", [ ])
  2014. definitely_enable_video_x11_scrnsaver=yes
  2015. else
  2016. AC_CHECK_LIB(Xss, XScreenSaverSuspend, have_xss_lib=yes)
  2017. if test x$have_xss_lib = xyes ; then
  2018. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXss"
  2019. definitely_enable_video_x11_scrnsaver=yes
  2020. fi
  2021. fi
  2022. fi
  2023. fi
  2024. if test x$definitely_enable_video_x11_scrnsaver = xyes; then
  2025. AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSCRNSAVER, 1, [ ])
  2026. SUMMARY_video_x11="${SUMMARY_video_x11} xscrnsaver"
  2027. fi
  2028. AC_ARG_ENABLE(video-x11-xshape,
  2029. [AS_HELP_STRING([--enable-video-x11-xshape], [enable X11 XShape support [default=yes]])],
  2030. , enable_video_x11_xshape=yes)
  2031. if test x$enable_video_x11_xshape = xyes; then
  2032. AC_CHECK_HEADER(X11/extensions/shape.h,
  2033. have_shape_h_hdr=yes,
  2034. have_shape_h_hdr=no,
  2035. [#include <X11/Xlib.h>
  2036. ])
  2037. if test x$have_shape_h_hdr = xyes; then
  2038. AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSHAPE, 1, [ ])
  2039. SUMMARY_video_x11="${SUMMARY_video_x11} xshape"
  2040. fi
  2041. fi
  2042. fi
  2043. fi
  2044. if test x$have_x != xyes; then
  2045. # Prevent Mesa from including X11 headers
  2046. EXTRA_CFLAGS="$EXTRA_CFLAGS -DMESA_EGL_NO_X11_HEADERS -DEGL_NO_X11"
  2047. fi
  2048. }
  2049. dnl Set up the Vivante video driver if enabled
  2050. CheckVivanteVideo()
  2051. {
  2052. AC_ARG_ENABLE(video-vivante,
  2053. [AS_HELP_STRING([--enable-video-vivante], [use Vivante EGL video driver [default=yes]])],
  2054. , enable_video_vivante=yes)
  2055. if test x$enable_video = xyes -a x$enable_video_vivante = xyes; then
  2056. AC_MSG_CHECKING(for Vivante VDK API)
  2057. have_vivante_vdk=no
  2058. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  2059. #define LINUX
  2060. #define EGL_API_FB
  2061. #include <gc_vdk.h>
  2062. ]],[])], [have_vivante_vdk=yes],[])
  2063. AC_MSG_RESULT($have_vivante_vdk)
  2064. AC_MSG_CHECKING(for Vivante FB API)
  2065. have_vivante_egl=no
  2066. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  2067. #define LINUX
  2068. #define EGL_API_FB
  2069. #include <EGL/eglvivante.h>
  2070. ]],[])], [have_vivante_egl=yes],[])
  2071. AC_MSG_RESULT($have_vivante_egl)
  2072. if test x$have_vivante_vdk = xyes -o x$have_vivante_egl = xyes; then
  2073. AC_DEFINE(SDL_VIDEO_DRIVER_VIVANTE, 1, [ ])
  2074. EXTRA_CFLAGS="$EXTRA_CFLAGS -DLINUX -DEGL_API_FB"
  2075. if test x$have_vivante_vdk = xyes; then
  2076. AC_DEFINE(SDL_VIDEO_DRIVER_VIVANTE_VDK, 1, [ ])
  2077. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lVDK"
  2078. fi
  2079. SOURCES="$SOURCES $srcdir/src/video/vivante/*.c"
  2080. SUMMARY_video="${SUMMARY_video} vivante"
  2081. have_video=yes
  2082. fi
  2083. fi
  2084. }
  2085. dnl Set up the Haiku video driver if enabled
  2086. CheckHaikuVideo()
  2087. {
  2088. if test x$enable_video = xyes; then
  2089. AC_DEFINE(SDL_VIDEO_DRIVER_HAIKU, 1, [ ])
  2090. SOURCES="$SOURCES $srcdir/src/video/haiku/*.cc"
  2091. have_video=yes
  2092. SUMMARY_video="${SUMMARY_video} haiku"
  2093. fi
  2094. }
  2095. dnl Set up the Cocoa video driver for Mac OS X (but not Darwin)
  2096. CheckCOCOA()
  2097. {
  2098. AC_ARG_ENABLE(video-cocoa,
  2099. [AS_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [default=yes]])],
  2100. , enable_video_cocoa=yes)
  2101. if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
  2102. save_CFLAGS="$CFLAGS"
  2103. dnl Work around that we don't have Objective-C support in autoconf
  2104. CFLAGS="$CFLAGS -x objective-c"
  2105. AC_MSG_CHECKING(for Cocoa framework)
  2106. have_cocoa=no
  2107. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  2108. #import <Cocoa/Cocoa.h>
  2109. ]],[])], [have_cocoa=yes],[])
  2110. AC_MSG_RESULT($have_cocoa)
  2111. CFLAGS="$save_CFLAGS"
  2112. if test x$have_cocoa = xyes; then
  2113. AC_DEFINE(SDL_VIDEO_DRIVER_COCOA, 1, [ ])
  2114. SOURCES="$SOURCES $srcdir/src/video/cocoa/*.m"
  2115. SUMMARY_video="${SUMMARY_video} cocoa"
  2116. have_video=yes
  2117. fi
  2118. fi
  2119. }
  2120. CheckMETAL()
  2121. {
  2122. AC_ARG_ENABLE(video-metal,
  2123. [AS_HELP_STRING([--enable-video-metal], [include Metal support [default=yes]])],
  2124. , enable_video_metal=yes)
  2125. AC_ARG_ENABLE(render-metal,
  2126. [AS_HELP_STRING([--enable-render-metal], [enable the Metal render driver [default=yes]])],
  2127. , enable_render_metal=yes)
  2128. if test x$enable_video = xyes -a x$enable_video_metal = xyes; then
  2129. save_CFLAGS="$CFLAGS"
  2130. dnl Work around that we don't have Objective-C support in autoconf
  2131. CFLAGS="$CFLAGS -x objective-c"
  2132. AC_MSG_CHECKING(for Metal framework)
  2133. have_metal=no
  2134. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  2135. #import <Cocoa/Cocoa.h>
  2136. #import <Metal/Metal.h>
  2137. #import <QuartzCore/CAMetalLayer.h>
  2138. #if TARGET_CPU_X86
  2139. #error Metal doesn't work on this configuration
  2140. #endif
  2141. ]],[])], [have_metal=yes],[])
  2142. CFLAGS="$save_CFLAGS"
  2143. AC_MSG_RESULT($have_metal)
  2144. if test x$have_metal = xyes; then
  2145. AC_DEFINE(SDL_VIDEO_METAL, 1, [ ])
  2146. if test x$enable_render = xyes -a x$enable_render_metal = xyes; then
  2147. AC_DEFINE(SDL_VIDEO_RENDER_METAL, 1, [ ])
  2148. SOURCES="$SOURCES $srcdir/src/render/metal/*.m"
  2149. fi
  2150. SUMMARY_video="${SUMMARY_video} metal"
  2151. else
  2152. enable_video_metal=no
  2153. enable_render_metal=no
  2154. fi
  2155. fi
  2156. }
  2157. dnl Find DirectFB
  2158. CheckDirectFB()
  2159. {
  2160. AC_ARG_ENABLE(video-directfb,
  2161. [AS_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [default=no]])],
  2162. , enable_video_directfb=no)
  2163. if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
  2164. PKG_CHECK_MODULES([DIRECTFB], [directfb >= 1.0.0], video_directfb=yes, video_directfb=no)
  2165. if test x$video_directfb = xyes; then
  2166. # SuSE 11.1 installs directfb-config without directfb-devel
  2167. save_CPPFLAGS="$CPPFLAGS"
  2168. CPPFLAGS="$CPPFLAGS $DIRECTFB_CFLAGS"
  2169. AC_CHECK_HEADER(directfb.h, have_directfb_hdr=yes, have_directfb_hdr=no)
  2170. CPPFLAGS="$save_CPPFLAGS"
  2171. video_directfb=$have_directfb_hdr
  2172. fi
  2173. if test x$video_directfb = xyes; then
  2174. AC_ARG_ENABLE(directfb-shared,
  2175. [AS_HELP_STRING([--enable-directfb-shared], [dynamically load directfb support [default=yes]])],
  2176. , enable_directfb_shared=yes)
  2177. AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB, 1, [ ])
  2178. AC_DEFINE(SDL_VIDEO_RENDER_DIRECTFB, 1, [ ])
  2179. SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
  2180. EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS"
  2181. directfb_shared=no
  2182. directfb_lib=[`find_lib "libdirectfb*.so.*" "$DIRECTFB_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
  2183. if test x$have_loadso != xyes && \
  2184. test x$enable_directfb_shared = xyes; then
  2185. AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic directfb loading])
  2186. fi
  2187. if test x$have_loadso = xyes && \
  2188. test x$enable_directfb_shared = xyes && test x$directfb_lib != x; then
  2189. directfb_shared=yes
  2190. echo "-- dynamic libdirectfb -> $directfb_lib"
  2191. AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC, "$directfb_lib", [ ])
  2192. SUMMARY_video="${SUMMARY_video} directfb(dynamic)"
  2193. else
  2194. EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS"
  2195. SUMMARY_video="${SUMMARY_video} directfb"
  2196. fi
  2197. SDL_CFLAGS="$SDL_CFLAGS $DIRECTFB_CFLAGS"
  2198. have_video=yes
  2199. fi
  2200. fi
  2201. }
  2202. dnl Find KMSDRM
  2203. CheckKMSDRM()
  2204. {
  2205. AC_ARG_ENABLE(video-kmsdrm,
  2206. [AS_HELP_STRING([--enable-video-kmsdrm], [use KMSDRM video driver [default=yes]])],
  2207. , enable_video_kmsdrm=yes)
  2208. if test x$enable_video = xyes && \
  2209. test x$enable_video_kmsdrm = xyes && \
  2210. test x$video_opengl_egl = xyes; then
  2211. video_kmsdrm=no
  2212. PKG_CHECK_MODULES([LIBDRM], [libdrm >= 1.4.82], libdrm_avail=yes, libdrm_avail=no)
  2213. PKG_CHECK_MODULES([LIBGBM], [gbm >= 11.1.0], libgbm_avail=yes, libgbm_avail=no)
  2214. if test x$libdrm_avail = xyes -a x$libgbm_avail = xyes; then
  2215. video_kmsdrm=yes
  2216. fi
  2217. if test x$video_kmsdrm = xyes; then
  2218. AC_ARG_ENABLE(kmsdrm-shared,
  2219. [AS_HELP_STRING([--enable-kmsdrm-shared], [dynamically load kmsdrm support [default=yes]])],
  2220. , enable_kmsdrm_shared=yes)
  2221. AC_DEFINE(SDL_VIDEO_DRIVER_KMSDRM, 1, [ ])
  2222. SOURCES="$SOURCES $srcdir/src/video/kmsdrm/*.c"
  2223. EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBDRM_CFLAGS $LIBGBM_CFLAGS"
  2224. AC_MSG_CHECKING(for kmsdrm dynamic loading support)
  2225. kmsdrm_shared=no
  2226. drm_lib=[`find_lib "libdrm.so.*" "$LIBDRM_LIBS"`]
  2227. gbm_lib=[`find_lib "libgbm.so.*" "$LIBGBM_LIBS"`]
  2228. if test x$have_loadso != xyes && \
  2229. test x$enable_kmsdrm_shared = xyes; then
  2230. AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic kmsdrm loading])
  2231. fi
  2232. if test x$have_loadso = xyes && \
  2233. test x$enable_kmsdrm_shared = xyes && test x$drm_lib != x && test x$gbm_lib != x; then
  2234. kmsdrm_shared=yes
  2235. AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC, "$drm_lib", [ ])
  2236. AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM, "$gbm_lib", [ ])
  2237. AC_DEFINE_UNQUOTED(HAVE_KMSDRM_SHARED, "TRUE", [ ])
  2238. SUMMARY_video="${SUMMARY_video} kmsdrm(dynamic)"
  2239. else
  2240. EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBDRM_LIBS $LIBGBM_LIBS"
  2241. SUMMARY_video="${SUMMARY_video} kmsdrm"
  2242. fi
  2243. AC_MSG_RESULT($kmsdrm_shared)
  2244. if test x$kmsdrm_shared = xyes; then
  2245. echo "-- dynamic libdrm -> $drm_lib"
  2246. echo "-- dynamic libgbm -> $gbm_lib"
  2247. fi
  2248. have_video=yes
  2249. fi
  2250. fi
  2251. }
  2252. dnl rcg04172001 Set up the Null video driver.
  2253. CheckDummyVideo()
  2254. {
  2255. AC_ARG_ENABLE(video-dummy,
  2256. [AS_HELP_STRING([--enable-video-dummy], [use dummy video driver [default=yes]])],
  2257. , enable_video_dummy=yes)
  2258. if test x$enable_video_dummy = xyes; then
  2259. AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY, 1, [ ])
  2260. SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
  2261. have_video=yes
  2262. SUMMARY_video="${SUMMARY_video} dummy"
  2263. fi
  2264. }
  2265. CheckOffscreenVideo()
  2266. {
  2267. AC_ARG_ENABLE(video-offscreen,
  2268. [AS_HELP_STRING([--enable-video-offscreen], [use offscreen video driver [default=yes]])],
  2269. , enable_video_offscreen=yes)
  2270. if test x$enable_video_offscreen = xyes; then
  2271. AC_DEFINE(SDL_VIDEO_DRIVER_OFFSCREEN, 1, [ ])
  2272. SOURCES="$SOURCES $srcdir/src/video/offscreen/*.c"
  2273. have_video=yes
  2274. SUMMARY_video="${SUMMARY_video} offscreen"
  2275. fi
  2276. }
  2277. dnl Set up the QNX video driver if enabled
  2278. CheckQNXVideo()
  2279. {
  2280. if test x$enable_video = xyes; then
  2281. AC_DEFINE(SDL_VIDEO_DRIVER_QNX, 1, [ ])
  2282. SOURCES="$SOURCES $srcdir/src/video/qnx/*.c"
  2283. have_video=yes
  2284. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lscreen -lEGL -lGLESv2"
  2285. SUMMARY_video="${SUMMARY_video} qnx"
  2286. fi
  2287. }
  2288. dnl Set up the QNX audio driver if enabled
  2289. CheckQNXAudio()
  2290. {
  2291. if test x$enable_audio = xyes; then
  2292. AC_DEFINE(SDL_AUDIO_DRIVER_QSA, 1, [ ])
  2293. SOURCES="$SOURCES $srcdir/src/audio/qsa/*.c"
  2294. have_audio=yes
  2295. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound"
  2296. SUMMARY_audio="${SUMMARY_audio} qsa"
  2297. fi
  2298. }
  2299. dnl Check to see if OpenGL support is desired
  2300. AC_ARG_ENABLE(video-opengl,
  2301. [AS_HELP_STRING([--enable-video-opengl], [include OpenGL support [default=yes]])],
  2302. , enable_video_opengl=yes)
  2303. dnl Find GLX
  2304. CheckGLX()
  2305. {
  2306. if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  2307. AC_MSG_CHECKING(for GLX support)
  2308. video_opengl_glx=no
  2309. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  2310. #include <GL/glx.h>
  2311. ]],[])], [video_opengl_glx=yes],[])
  2312. AC_MSG_RESULT($video_opengl_glx)
  2313. if test x$video_opengl_glx = xyes; then
  2314. AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  2315. AC_DEFINE(SDL_VIDEO_OPENGL_GLX, 1, [ ])
  2316. fi
  2317. fi
  2318. }
  2319. dnl Check to see if OpenGL ES support is desired
  2320. AC_ARG_ENABLE(video-opengles,
  2321. [AS_HELP_STRING([--enable-video-opengles], [include OpenGL ES support [default=yes]])],
  2322. , enable_video_opengles=yes)
  2323. AC_ARG_ENABLE(video-opengles1,
  2324. [AS_HELP_STRING([--enable-video-opengles1], [include OpenGL ES 1.1 support [default=yes]])],
  2325. , enable_video_opengles1=yes)
  2326. AC_ARG_ENABLE(video-opengles2,
  2327. [AS_HELP_STRING([--enable-video-opengles2], [include OpenGL ES 2.0 support [default=yes]])],
  2328. , enable_video_opengles2=yes)
  2329. dnl Find EGL
  2330. CheckEGL()
  2331. {
  2332. if test x$enable_video = xyes -a x$enable_video_opengl = xyes || test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
  2333. AC_MSG_CHECKING(for EGL support)
  2334. video_opengl_egl=no
  2335. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  2336. #define LINUX
  2337. #define EGL_API_FB
  2338. #define MESA_EGL_NO_X11_HEADERS
  2339. #define EGL_NO_X11
  2340. #include <EGL/egl.h>
  2341. #include <EGL/eglext.h>
  2342. ]],[])], [video_opengl_egl=yes],[])
  2343. AC_MSG_RESULT($video_opengl_egl)
  2344. if test x$video_opengl_egl = xyes; then
  2345. AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
  2346. fi
  2347. fi
  2348. }
  2349. dnl Find OpenGL
  2350. CheckOpenGL()
  2351. {
  2352. if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  2353. AC_MSG_CHECKING(for OpenGL headers)
  2354. video_opengl=no
  2355. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  2356. #include <GL/gl.h>
  2357. #include <GL/glext.h>
  2358. ]],[])], [video_opengl=yes],[])
  2359. AC_MSG_RESULT($video_opengl)
  2360. if test x$video_opengl = xyes; then
  2361. AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  2362. AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
  2363. SUMMARY_video="${SUMMARY_video} opengl"
  2364. fi
  2365. fi
  2366. }
  2367. dnl Find OpenGL ES
  2368. CheckOpenGLES()
  2369. {
  2370. if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
  2371. if test x$enable_video_opengles1 = xyes; then
  2372. AC_MSG_CHECKING(for OpenGL ES v1 headers)
  2373. video_opengles_v1=no
  2374. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  2375. #include <GLES/gl.h>
  2376. #include <GLES/glext.h>
  2377. ]],[])], [video_opengles_v1=yes],[])
  2378. AC_MSG_RESULT($video_opengles_v1)
  2379. if test x$video_opengles_v1 = xyes; then
  2380. AC_DEFINE(SDL_VIDEO_OPENGL_ES, 1, [ ])
  2381. AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES, 1, [ ])
  2382. SUMMARY_video="${SUMMARY_video} opengl_es1"
  2383. fi
  2384. fi
  2385. if test x$enable_video_opengles2 = xyes; then
  2386. AC_MSG_CHECKING(for OpenGL ES v2 headers)
  2387. video_opengles_v2=no
  2388. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  2389. #include <GLES2/gl2.h>
  2390. #include <GLES2/gl2ext.h>
  2391. ]],[])], [video_opengles_v2=yes],[])
  2392. AC_MSG_RESULT($video_opengles_v2)
  2393. if test x$video_opengles_v2 = xyes; then
  2394. AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
  2395. AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
  2396. SUMMARY_video="${SUMMARY_video} opengl_es2"
  2397. fi
  2398. fi
  2399. fi
  2400. }
  2401. dnl Check for Windows OpenGL
  2402. CheckWINDOWSGL()
  2403. {
  2404. if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  2405. AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  2406. AC_DEFINE(SDL_VIDEO_OPENGL_WGL, 1, [ ])
  2407. AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
  2408. SUMMARY_video="${SUMMARY_video} opengl"
  2409. fi
  2410. }
  2411. dnl Check for Windows OpenGL
  2412. CheckWINDOWSGLES()
  2413. {
  2414. if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
  2415. AC_MSG_CHECKING(for EGL support)
  2416. video_opengl_egl=no
  2417. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  2418. #include <EGL/egl.h>
  2419. ]],[])], [video_opengl_egl=yes],[])
  2420. AC_MSG_RESULT($video_opengl_egl)
  2421. if test x$video_opengl_egl = xyes; then
  2422. AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  2423. AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
  2424. SUMMARY_video="${SUMMARY_video} opengl_es1"
  2425. fi
  2426. AC_MSG_CHECKING(for OpenGL ES v2 headers)
  2427. video_opengles_v2=no
  2428. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  2429. #include <GLES2/gl2.h>
  2430. #include <GLES2/gl2ext.h>
  2431. ]],[])], [video_opengles_v2=yes],[])
  2432. AC_MSG_RESULT($video_opengles_v2)
  2433. if test x$video_opengles_v2 = xyes; then
  2434. AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  2435. AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
  2436. AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
  2437. SUMMARY_video="${SUMMARY_video} opengl_es2"
  2438. fi
  2439. fi
  2440. }
  2441. dnl Check for Haiku OpenGL
  2442. CheckHaikuGL()
  2443. {
  2444. if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  2445. AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  2446. AC_DEFINE(SDL_VIDEO_OPENGL_HAIKU, 1, [ ])
  2447. AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
  2448. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
  2449. SUMMARY_video="${SUMMARY_video} opengl"
  2450. fi
  2451. }
  2452. dnl Check for MacOS OpenGL
  2453. CheckMacGL()
  2454. {
  2455. if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  2456. AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  2457. AC_DEFINE(SDL_VIDEO_OPENGL_CGL, 1, [ ])
  2458. AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
  2459. SUMMARY_video="${SUMMARY_video} opengl"
  2460. fi
  2461. }
  2462. dnl Check for MacOS OpenGLES
  2463. CheckMacGLES()
  2464. {
  2465. if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
  2466. video_opengl_egl=yes
  2467. AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
  2468. video_opengles_v2=yes
  2469. AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
  2470. AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
  2471. SUMMARY_video="${SUMMARY_video} opengl_es2"
  2472. fi
  2473. }
  2474. CheckEmscriptenGLES()
  2475. {
  2476. if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
  2477. AC_MSG_CHECKING(for EGL support)
  2478. video_opengl_egl=no
  2479. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  2480. #include <EGL/egl.h>
  2481. ]],[])], [video_opengl_egl=yes],[])
  2482. AC_MSG_RESULT($video_opengl_egl)
  2483. if test x$video_opengl_egl = xyes; then
  2484. AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
  2485. fi
  2486. AC_MSG_CHECKING(for OpenGL ES v2 headers)
  2487. video_opengles_v2=no
  2488. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  2489. #include <GLES2/gl2.h>
  2490. #include <GLES2/gl2ext.h>
  2491. ]],[])], [video_opengles_v2=yes],[])
  2492. AC_MSG_RESULT($video_opengles_v2)
  2493. if test x$video_opengles_v2 = xyes; then
  2494. AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
  2495. AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
  2496. SUMMARY_video="${SUMMARY_video} opengl_es2"
  2497. fi
  2498. fi
  2499. }
  2500. dnl Check to see if Vulkan support is desired
  2501. AC_ARG_ENABLE(video-vulkan,
  2502. [AS_HELP_STRING([--enable-video-vulkan], [include Vulkan support [default=yes]])],
  2503. , enable_video_vulkan=yes)
  2504. dnl Find Vulkan Header
  2505. CheckVulkan()
  2506. {
  2507. if test x$enable_video = xyes -a x$enable_video_vulkan = xyes; then
  2508. case "$host" in
  2509. *-*-android*)
  2510. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  2511. #if defined(__ARM_ARCH) && __ARM_ARCH < 7
  2512. #error Vulkan doesn't work on this configuration
  2513. #endif
  2514. ]],[])], [],[enable_video_vulkan=no])
  2515. ;;
  2516. *-*-solaris*)
  2517. dnl Strictly speaking, what's missing here is libxcb. Even without Vulkan support at the OS level, it should still compile if we had that.
  2518. enable_video_vulkan=no
  2519. ;;
  2520. *-*-darwin*)
  2521. save_CFLAGS="$CFLAGS"
  2522. dnl Work around that we don't have Objective-C support in autoconf
  2523. CFLAGS="$CFLAGS -x objective-c"
  2524. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  2525. #include <Cocoa/Cocoa.h>
  2526. #include <Metal/Metal.h>
  2527. #include <QuartzCore/CAMetalLayer.h>
  2528. #if TARGET_CPU_X86
  2529. #error Vulkan doesn't work on this configuration
  2530. #endif
  2531. ]],[])], [],[enable_video_vulkan=no])
  2532. CFLAGS="$save_CFLAGS"
  2533. ;;
  2534. *)
  2535. ;;
  2536. esac
  2537. if test x$enable_video_vulkan = xno; then
  2538. # For reasons I am totally unable to see, I get an undefined macro error if
  2539. # I put this in the AC_TRY_COMPILE.
  2540. AC_MSG_WARN([Vulkan does not work on this configuration.])
  2541. fi
  2542. fi
  2543. if test x$have_loadso != xyes; then
  2544. AC_MSG_WARN([Vulkan support is available, but disabled because there's no loadso.])
  2545. enable_video_vulkan=no
  2546. fi
  2547. if test x$enable_video_vulkan = xyes; then
  2548. AC_DEFINE(SDL_VIDEO_VULKAN, 1, [ ])
  2549. SUMMARY_video="${SUMMARY_video} vulkan"
  2550. fi
  2551. }
  2552. dnl See if we can use the new unified event interface in Linux 2.4
  2553. CheckInputEvents()
  2554. {
  2555. dnl Check for Linux 2.4 unified input event interface support
  2556. AC_CHECK_HEADERS(linux/input.h)
  2557. AC_MSG_CHECKING(for Linux 2.4 unified input interface)
  2558. use_input_events=no
  2559. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  2560. #include <linux/input.h>
  2561. ]], [[
  2562. #ifndef EVIOCGNAME
  2563. #error EVIOCGNAME() ioctl not available
  2564. #endif
  2565. ]])], [use_input_events=yes],[])
  2566. AC_MSG_RESULT($use_input_events)
  2567. if test x$use_input_events = xyes; then
  2568. AC_DEFINE(SDL_INPUT_LINUXEV, 1, [ ])
  2569. SUMMARY_input="${SUMMARY_input} linuxev"
  2570. fi
  2571. }
  2572. dnl See if we can use the kernel kd.h header
  2573. CheckInputKD()
  2574. {
  2575. AC_MSG_CHECKING(for Linux kd.h)
  2576. use_input_kd=no
  2577. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  2578. #include <linux/kd.h>
  2579. #include <linux/keyboard.h>
  2580. #include <sys/ioctl.h>
  2581. ]], [[
  2582. struct kbentry kbe;
  2583. kbe.kb_table = KG_CTRL;
  2584. ioctl(0, KDGKBENT, &kbe);
  2585. ]])], [use_input_kd=yes],[])
  2586. AC_MSG_RESULT($use_input_kd)
  2587. if test x$use_input_kd = xyes; then
  2588. AC_DEFINE(SDL_INPUT_LINUXKD, 1, [ ])
  2589. SUMMARY_input="${SUMMARY_input} linuxkd"
  2590. fi
  2591. }
  2592. dnl See if we can use the FreeBSD kernel kbio.h header
  2593. CheckInputKBIO()
  2594. {
  2595. AC_MSG_CHECKING(for FreeBSD kbio.h)
  2596. use_input_kbio=no
  2597. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  2598. #include <sys/kbio.h>
  2599. #include <sys/ioctl.h>
  2600. ]], [[
  2601. accentmap_t accTable;
  2602. ioctl(0, KDENABIO, 1);
  2603. ]])], [use_input_kbio=yes],[])
  2604. AC_MSG_RESULT($use_input_kbio)
  2605. if test x$use_input_kbio = xyes; then
  2606. AC_DEFINE(SDL_INPUT_FBSDKBIO, 1, [ ])
  2607. SUMMARY_input="${SUMMARY_input} fbsdkbio"
  2608. fi
  2609. }
  2610. dnl See if we can use the wscons input driver
  2611. CheckInputWSCONS()
  2612. {
  2613. AC_MSG_CHECKING(for OpenBSD wscons)
  2614. use_input_wscons=no
  2615. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  2616. #include <sys/time.h>
  2617. #include <dev/wscons/wsconsio.h>
  2618. #include <dev/wscons/wsksymdef.h>
  2619. #include <dev/wscons/wsksymvar.h>
  2620. #include <sys/ioctl.h>
  2621. ]], [[
  2622. struct wskbd_map_data data;
  2623. ioctl(0, WSKBDIO_GETMAP, &data);
  2624. ]])], [use_input_wscons=yes],[])
  2625. AC_MSG_RESULT($use_input_wscons)
  2626. if test x$use_input_wscons = xyes; then
  2627. AC_DEFINE(SDL_INPUT_WSCONS, 1, [ ])
  2628. SUMMARY_input="${SUMMARY_input} wscons"
  2629. fi
  2630. }
  2631. dnl See if the platform offers libudev for device enumeration and hotplugging.
  2632. CheckLibUDev()
  2633. {
  2634. AC_ARG_ENABLE(libudev,
  2635. [AS_HELP_STRING([--enable-libudev], [enable libudev support [default=yes]])],
  2636. , enable_libudev=yes)
  2637. if test x$enable_libudev = xyes; then
  2638. AC_CHECK_HEADER(libudev.h,
  2639. have_libudev_h_hdr=yes,
  2640. have_libudev_h_hdr=no)
  2641. if test x$have_libudev_h_hdr = xyes; then
  2642. AC_DEFINE(HAVE_LIBUDEV_H, 1, [ ])
  2643. udev_lib=[`find_lib "libudev.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`]
  2644. if test x$udev_lib != x; then
  2645. echo "-- dynamic udev -> $udev_lib"
  2646. AC_DEFINE_UNQUOTED(SDL_UDEV_DYNAMIC, "$udev_lib", [ ])
  2647. fi
  2648. fi
  2649. fi
  2650. }
  2651. dnl See if the platform offers libdbus for various IPC techniques.
  2652. CheckDBus()
  2653. {
  2654. AC_ARG_ENABLE(dbus,
  2655. [AS_HELP_STRING([--enable-dbus], [enable D-Bus support [default=yes]])],
  2656. , enable_dbus=yes)
  2657. if test x$enable_dbus = xyes; then
  2658. PKG_CHECK_MODULES([DBUS], [dbus-1], have_dbus=yes, have_dbus=no)
  2659. save_CPPFLAGS="$CPPFLAGS"
  2660. CPPFLAGS="$save_CPPFLAGS $DBUS_CFLAGS"
  2661. AC_CHECK_HEADER(dbus/dbus.h,
  2662. have_dbus_dbus_h_hdr=yes,
  2663. have_dbus_dbus_h_hdr=no)
  2664. CPPFLAGS="$save_CPPFLAGS"
  2665. if test x$have_dbus_dbus_h_hdr = xyes; then
  2666. AC_DEFINE(HAVE_DBUS_DBUS_H, 1, [ ])
  2667. EXTRA_CFLAGS="$EXTRA_CFLAGS $DBUS_CFLAGS"
  2668. SOURCES="$SOURCES $srcdir/src/core/linux/SDL_dbus.c"
  2669. fi
  2670. fi
  2671. }
  2672. dnl See if the platform wanna IME support.
  2673. CheckIME()
  2674. {
  2675. AC_ARG_ENABLE(ime,
  2676. [AS_HELP_STRING([--enable-ime], [enable IME support [default=yes]])],
  2677. , enable_ime=yes)
  2678. if test x$enable_ime = xyes; then
  2679. AC_DEFINE(SDL_USE_IME, 1, [ ])
  2680. SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ime.c"
  2681. fi
  2682. }
  2683. dnl Check inotify presense
  2684. CheckInotify()
  2685. {
  2686. save_LIBS="$LIBS"
  2687. case "$host" in
  2688. *-*-freebsd*|*-*dragonfly*) LIBS="$LIBS -linotify"
  2689. ;;
  2690. esac
  2691. AC_CHECK_HEADERS(sys/inotify.h, [have_inotify_inotify_h_hdr=yes])
  2692. AC_CHECK_FUNCS(inotify_init, [have_inotify=yes])
  2693. AC_CHECK_FUNCS(inotify_init1)
  2694. if test x$have_inotify_inotify_h_hdr = xyes -a x$have_inotify = xyes; then
  2695. AC_DEFINE(HAVE_INOTIFY, 1, [ ])
  2696. case "$host" in
  2697. *-*-freebsd*|*-*-dragonfly*)
  2698. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -linotify"
  2699. ;;
  2700. esac
  2701. fi
  2702. LIBS="$save_LIBS"
  2703. }
  2704. dnl See if the platform has libibus IME support.
  2705. CheckIBus()
  2706. {
  2707. AC_ARG_ENABLE(ibus,
  2708. [AS_HELP_STRING([--enable-ibus], [enable IBus support [default=yes]])],
  2709. , enable_ibus=yes)
  2710. if test x$enable_ibus = xyes; then
  2711. PKG_CHECK_MODULES([IBUS], [ibus-1.0], have_ibus=yes, have_ibus=no)
  2712. save_CPPFLAGS="$CPPFLAGS"
  2713. CPPFLAGS="$save_CPPFLAGS $IBUS_CFLAGS"
  2714. AC_CHECK_HEADER(ibus-1.0/ibus.h,
  2715. have_ibus_ibus_h_hdr=yes,
  2716. have_ibus_ibus_h_hdr=no)
  2717. CPPFLAGS="$save_CPPFLAGS"
  2718. if test x$have_ibus_ibus_h_hdr = xyes; then
  2719. if test x$enable_ime != xyes; then
  2720. AC_MSG_WARN([IME support is required for IBus.])
  2721. have_ibus_ibus_h_hdr=no
  2722. elif test x$enable_dbus != xyes; then
  2723. AC_MSG_WARN([DBus support is required for IBus.])
  2724. have_ibus_ibus_h_hdr=no
  2725. elif test x$have_inotify_inotify_h_hdr != xyes; then
  2726. AC_MSG_WARN([INotify support is required for IBus.])
  2727. have_ibus_ibus_h_hdr=no
  2728. else
  2729. AC_DEFINE(HAVE_IBUS_IBUS_H, 1, [ ])
  2730. EXTRA_CFLAGS="$EXTRA_CFLAGS $IBUS_CFLAGS"
  2731. SOURCES="$SOURCES $srcdir/src/core/linux/SDL_ibus.c"
  2732. fi
  2733. fi
  2734. fi
  2735. }
  2736. dnl See if the platform has fcitx IME support.
  2737. CheckFcitx()
  2738. {
  2739. AC_ARG_ENABLE(fcitx,
  2740. [AS_HELP_STRING([--enable-fcitx], [enable fcitx support [default=yes]])],
  2741. , enable_fcitx=yes)
  2742. if test x$enable_fcitx = xyes; then
  2743. AC_MSG_CHECKING(for fcitx support)
  2744. have_fcitx=no
  2745. if test x$enable_ime != xyes; then
  2746. AC_MSG_WARN([IME support is required for fcitx.])
  2747. elif test x$have_dbus_dbus_h_hdr != xyes; then
  2748. AC_MSG_WARN([DBus support is required for fcitx.])
  2749. else
  2750. have_fcitx=yes
  2751. AC_DEFINE(HAVE_FCITX, 1, [ ])
  2752. SOURCES="$SOURCES $srcdir/src/core/linux/SDL_fcitx.c"
  2753. fi
  2754. AC_MSG_RESULT($have_fcitx)
  2755. fi
  2756. }
  2757. dnl Check to see if GameController framework support is desired
  2758. CheckJoystickMFI()
  2759. {
  2760. AC_ARG_ENABLE(joystick-mfi,
  2761. [AS_HELP_STRING([--enable-joystick-mfi], [include macOS MFI joystick support [default=yes]])],
  2762. , enable_joystick_mfi=yes)
  2763. if test x$enable_joystick_mfi = xyes; then
  2764. save_CFLAGS="$CFLAGS"
  2765. save_LDFLAGS="$LDFLAGS"
  2766. dnl Work around that we don't have Objective-C support in autoconf
  2767. CFLAGS="$CFLAGS -x objective-c -fobjc-weak"
  2768. LDFLAGS="$LDFLAGS -Wl,-weak_framework,CoreHaptics -Wl,-weak_framework,GameController"
  2769. AC_MSG_CHECKING(for GameController framework)
  2770. enable_joystick_mfi=no
  2771. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  2772. #include <AvailabilityMacros.h>
  2773. #include <TargetConditionals.h>
  2774. #import <GameController/GameController.h>
  2775. ]], [[
  2776. #if MAC_OS_X_VERSION_MIN_REQUIRED < 1080
  2777. #error GameController framework doesn't work on this configuration
  2778. #endif
  2779. #if TARGET_CPU_X86
  2780. #error GameController framework doesn't work on this configuration
  2781. #endif
  2782. ]])], [enable_joystick_mfi=yes],[])
  2783. CFLAGS="$save_CFLAGS"
  2784. LDFLAGS="$save_LDFLAGS"
  2785. AC_MSG_RESULT($enable_joystick_mfi)
  2786. if test x$enable_joystick_mfi = xyes; then
  2787. AC_DEFINE(SDL_JOYSTICK_MFI, 1, [ ])
  2788. EXTRA_CFLAGS="$EXTRA_CFLAGS -fobjc-weak -Wno-unused-command-line-argument"
  2789. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-weak_framework,CoreHaptics -Wl,-weak_framework,GameController"
  2790. fi
  2791. fi
  2792. }
  2793. dnl See what type of thread model to use on Linux and Solaris
  2794. CheckPTHREAD()
  2795. {
  2796. dnl Check for pthread support
  2797. dnl Emscripten pthreads work, but you need to have a non-pthread fallback build
  2798. dnl for systems without support. It's not currently enough to not use
  2799. dnl pthread functions in a pthread-build; it won't start up on unsupported
  2800. dnl browsers. As such, you have to explicitly enable it on Emscripten builds
  2801. dnl for the time being. This default with change to ON once this becomes
  2802. dnl commonly supported in browsers or the Emscripten teams makes a single
  2803. dnl binary work everywhere.
  2804. case "$host" in
  2805. *-*-emscripten*)
  2806. enable_pthreads_default=no
  2807. ;;
  2808. *)
  2809. enable_pthreads_default=yes
  2810. ;;
  2811. esac
  2812. AC_ARG_ENABLE(pthreads,
  2813. [AS_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [default=maybe]])],
  2814. , enable_pthreads=maybe)
  2815. dnl This is used on Linux for glibc binary compatibility (Doh!)
  2816. AC_ARG_ENABLE(pthread-sem,
  2817. [AS_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [default=maybe]])],
  2818. , enable_pthread_sem=maybe)
  2819. if test x$enable_pthreads = xmaybe; then
  2820. enable_pthreads=$enable_pthreads_default
  2821. fi
  2822. if test x$enable_pthread_sem = xmaybe; then
  2823. enable_pthread_sem=$enable_pthreads
  2824. fi
  2825. case "$host" in
  2826. *-*-android*)
  2827. pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  2828. pthread_lib=""
  2829. ;;
  2830. *-*-linux*|*-*-uclinux*)
  2831. pthread_cflags="-D_REENTRANT"
  2832. pthread_lib="-lpthread"
  2833. ;;
  2834. *-*-bsdi*)
  2835. pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  2836. pthread_lib=""
  2837. ;;
  2838. *-*-darwin*)
  2839. pthread_cflags="-D_THREAD_SAFE"
  2840. # causes Carbon.p complaints?
  2841. # pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  2842. ;;
  2843. *-*-freebsd*|*-*-dragonfly*)
  2844. pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  2845. pthread_lib="-pthread"
  2846. ;;
  2847. *-*-netbsd*)
  2848. pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  2849. pthread_lib="-lpthread"
  2850. ;;
  2851. *-*-openbsd*)
  2852. pthread_cflags="-D_REENTRANT"
  2853. pthread_lib="-lpthread"
  2854. ;;
  2855. *-*-solaris2.9)
  2856. # From Solaris 9+, posix4's preferred name is rt.
  2857. pthread_cflags="-D_REENTRANT"
  2858. pthread_lib="-lpthread -lrt"
  2859. ;;
  2860. *-*-solaris2.10)
  2861. # Solaris 10+ merged pthread into libc.
  2862. pthread_cflags="-D_REENTRANT"
  2863. pthread_lib="-lrt"
  2864. ;;
  2865. *-*-solaris*)
  2866. # Solaris 11+ merged rt into libc.
  2867. pthread_cflags="-D_REENTRANT"
  2868. pthread_lib=""
  2869. ;;
  2870. *-*-sysv5*)
  2871. pthread_cflags="-D_REENTRANT -Kthread"
  2872. pthread_lib=""
  2873. ;;
  2874. *-*-aix*)
  2875. pthread_cflags="-D_REENTRANT -mthreads"
  2876. pthread_lib="-lpthread"
  2877. ;;
  2878. *-*-hpux11*)
  2879. pthread_cflags="-D_REENTRANT"
  2880. pthread_lib="-L/usr/lib -lpthread"
  2881. ;;
  2882. *-*-haiku*)
  2883. pthread_cflags="-D_REENTRANT"
  2884. pthread_lib=""
  2885. ;;
  2886. *-*-nto*)
  2887. pthread_cflags="-D_REENTRANT"
  2888. pthread_lib=""
  2889. ;;
  2890. *-*-emscripten*)
  2891. pthread_cflags="-D_REENTRANT -pthread"
  2892. pthread_lib="-pthread"
  2893. ;;
  2894. *)
  2895. pthread_cflags="-D_REENTRANT"
  2896. pthread_lib="-lpthread"
  2897. ;;
  2898. esac
  2899. if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then
  2900. # Save the original compiler flags and libraries
  2901. ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  2902. # Add the pthread compiler flags and libraries
  2903. CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  2904. # Check to see if we have pthread support on this system
  2905. AC_MSG_CHECKING(for pthreads)
  2906. use_pthreads=no
  2907. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  2908. #include <pthread.h>
  2909. ]], [[
  2910. pthread_attr_t type;
  2911. pthread_attr_init(&type);
  2912. ]])], [use_pthreads=yes],[])
  2913. AC_MSG_RESULT($use_pthreads)
  2914. # Restore the compiler flags and libraries
  2915. CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  2916. # Do futher testing if we have pthread support...
  2917. if test x$use_pthreads = xyes; then
  2918. AC_DEFINE(SDL_THREAD_PTHREAD, 1, [ ])
  2919. EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags"
  2920. EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib"
  2921. SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
  2922. # Save the original compiler flags and libraries
  2923. ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  2924. # Add the pthread compiler flags and libraries
  2925. CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  2926. # Check to see if recursive mutexes are available
  2927. AC_MSG_CHECKING(for recursive mutexes)
  2928. has_recursive_mutexes=no
  2929. if test x$has_recursive_mutexes = xno; then
  2930. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  2931. #define _GNU_SOURCE 1
  2932. #include <pthread.h>
  2933. ]], [[
  2934. pthread_mutexattr_t attr;
  2935. pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
  2936. ]])], [
  2937. has_recursive_mutexes=yes
  2938. AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX, 1, [ ])
  2939. ],[])
  2940. fi
  2941. if test x$has_recursive_mutexes = xno; then
  2942. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  2943. #define _GNU_SOURCE 1
  2944. #include <pthread.h>
  2945. ]], [[
  2946. pthread_mutexattr_t attr;
  2947. pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
  2948. ]])],[
  2949. has_recursive_mutexes=yes
  2950. AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP, 1, [ ])
  2951. ],[])
  2952. fi
  2953. AC_MSG_RESULT($has_recursive_mutexes)
  2954. # Check to see if pthread semaphore support is missing
  2955. if test x$enable_pthread_sem = xyes; then
  2956. AC_MSG_CHECKING(for pthread semaphores)
  2957. have_pthread_sem=no
  2958. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  2959. #include <pthread.h>
  2960. #include <semaphore.h>
  2961. ]],[])], [have_pthread_sem=yes],[])
  2962. AC_MSG_RESULT($have_pthread_sem)
  2963. fi
  2964. if test x$have_pthread_sem = xyes; then
  2965. AC_MSG_CHECKING(for sem_timedwait)
  2966. have_sem_timedwait=no
  2967. AC_LINK_IFELSE([AC_LANG_PROGRAM([[
  2968. #include <pthread.h>
  2969. #include <semaphore.h>
  2970. ]], [[
  2971. sem_timedwait(NULL, NULL);
  2972. ]])], [
  2973. have_sem_timedwait=yes
  2974. AC_DEFINE([HAVE_SEM_TIMEDWAIT], 1, [ ])
  2975. ],[])
  2976. AC_MSG_RESULT($have_sem_timedwait)
  2977. fi
  2978. AC_CHECK_HEADER(pthread_np.h, have_pthread_np_h=yes, have_pthread_np_h=no, [ #include <pthread.h> ])
  2979. if test x$have_pthread_np_h = xyes; then
  2980. AC_DEFINE(HAVE_PTHREAD_NP_H, 1, [ ])
  2981. fi
  2982. # Check to see if pthread naming is available
  2983. AC_MSG_CHECKING(for pthread_setname_np)
  2984. AC_TRY_LINK_FUNC(pthread_setname_np, [
  2985. has_pthread_setname_np=yes
  2986. AC_DEFINE(HAVE_PTHREAD_SETNAME_NP, 1, [ ])
  2987. ],[
  2988. has_pthread_setname_np=no
  2989. ])
  2990. AC_MSG_RESULT($has_pthread_setname_np)
  2991. AC_MSG_CHECKING(for pthread_set_name_np)
  2992. AC_TRY_LINK_FUNC(pthread_set_name_np, [
  2993. has_pthread_set_name_np=yes
  2994. AC_DEFINE(HAVE_PTHREAD_SET_NAME_NP, 1, [ ])
  2995. ],[
  2996. has_pthread_set_name_np=no
  2997. ])
  2998. AC_MSG_RESULT($has_pthread_set_name_np)
  2999. # Restore the compiler flags and libraries
  3000. CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  3001. # Basic thread creation functions
  3002. SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
  3003. # Semaphores
  3004. # We can fake these with mutexes and condition variables if necessary
  3005. if test x$have_pthread_sem = xyes; then
  3006. SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
  3007. else
  3008. SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
  3009. fi
  3010. # Mutexes
  3011. # We can fake these with semaphores if necessary
  3012. SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
  3013. # Condition variables
  3014. # We can fake these with semaphores and mutexes if necessary
  3015. SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
  3016. # Thread local storage
  3017. SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systls.c"
  3018. have_threads=yes
  3019. fi
  3020. fi
  3021. }
  3022. dnl Determine whether the compiler can produce Windows executables
  3023. CheckWINDOWS()
  3024. {
  3025. AC_MSG_CHECKING(Windows compiler)
  3026. have_win32_gcc=no
  3027. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  3028. #include <windows.h>
  3029. ]],[])], [have_win32_gcc=yes],[])
  3030. AC_MSG_RESULT($have_win32_gcc)
  3031. if test x$have_win32_gcc != xyes; then
  3032. AC_MSG_ERROR([
  3033. *** Your compiler ($CC) does not produce Windows executables!
  3034. ])
  3035. fi
  3036. AC_MSG_CHECKING(Windows CE)
  3037. have_wince=no
  3038. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  3039. #if !defined(_WIN32_WCE) && !defined(__MINGW32CE__)
  3040. #error This is not Windows CE
  3041. #endif
  3042. ]],[])], [
  3043. have_wince=yes
  3044. AC_MSG_ERROR([
  3045. *** Sorry, Windows CE is no longer supported.
  3046. ])
  3047. ],[])
  3048. AC_MSG_RESULT($have_wince)
  3049. # headers needed elsewhere
  3050. AC_CHECK_HEADER(tpcshrd.h,have_tpcshrd_h=yes)
  3051. if test x$have_tpcshrd_h = xyes; then
  3052. AC_DEFINE(HAVE_TPCSHRD_H, 1, [ ])
  3053. fi
  3054. AC_CHECK_HEADER(roapi.h,have_roapi_h=yes)
  3055. if test x$have_roapi_h = xyes; then
  3056. AC_DEFINE(HAVE_ROAPI_H, 1, [ ])
  3057. fi
  3058. AC_CHECK_HEADER(shellscalingapi.h,have_shellscalingapi_h=yes)
  3059. if test x$shellscalingapi_h = xyes; then
  3060. AC_DEFINE(HAVE_SHELLSCALINGAPI_H, 1, [ ])
  3061. fi
  3062. }
  3063. dnl Determine whether the compiler can produce OS/2 executables
  3064. CheckOS2()
  3065. {
  3066. AC_MSG_CHECKING(OS/2 compiler)
  3067. have_os2_gcc=no
  3068. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <os2.h>]],
  3069. [])],[have_os2_gcc=yes],[])
  3070. AC_MSG_RESULT($have_os2_gcc)
  3071. if test x$have_os2_gcc != xyes; then
  3072. AC_MSG_ERROR([
  3073. *** Your compiler ($CC) does not produce OS/2 executables!
  3074. ])
  3075. fi
  3076. }
  3077. dnl Find the DirectX includes and libraries
  3078. CheckDIRECTX()
  3079. {
  3080. AC_ARG_ENABLE(directx,
  3081. [AS_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [default=yes]])],
  3082. , enable_directx=yes)
  3083. if test x$enable_directx = xyes; then
  3084. AC_CHECK_HEADER(d3d9.h, have_d3d=yes)
  3085. AC_CHECK_HEADER(d3d11_1.h, have_d3d11=yes)
  3086. AC_MSG_CHECKING(for compatible d3d12 headers)
  3087. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  3088. #include <d3d12.h>
  3089. #include <d3d12sdklayers.h>
  3090. ID3D12Device1 *device;
  3091. ]])], [have_d3d12=yes],[have_d3d12=no])
  3092. AC_MSG_RESULT($have_d3d12)
  3093. AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
  3094. AC_CHECK_HEADER(dsound.h, have_dsound=yes)
  3095. AC_CHECK_HEADER(dinput.h, have_dinput=yes)
  3096. AC_CHECK_HEADER(dxgi.h, have_dxgi=yes)
  3097. if test x$have_ddraw = xyes; then
  3098. AC_DEFINE(HAVE_DDRAW_H, 1, [ ])
  3099. fi
  3100. if test x$have_dinput = xyes; then
  3101. AC_DEFINE(HAVE_DINPUT_H, 1, [ ])
  3102. fi
  3103. if test x$have_dsound = xyes; then
  3104. AC_DEFINE(HAVE_DSOUND_H, 1, [ ])
  3105. fi
  3106. if test x$have_dxgi = xyes; then
  3107. AC_DEFINE(HAVE_DXGI_H, 1, [ ])
  3108. fi
  3109. # FIXME: latest Cygwin finds dinput headers, but we die on other win32 headers.
  3110. # FIXME: ...so force it off for now.
  3111. case "$host" in
  3112. *-*-cygwin*)
  3113. have_dinput=false
  3114. ;;
  3115. esac
  3116. fi
  3117. AC_ARG_ENABLE(xinput,
  3118. [AS_HELP_STRING([--enable-xinput], [use Xinput for Windows [default=yes]])],
  3119. , enable_xinput=yes)
  3120. if test x$enable_xinput = xyes; then
  3121. AC_CHECK_HEADER(xinput.h, have_xinput=yes)
  3122. if test x$have_xinput = xyes; then
  3123. AC_DEFINE(HAVE_XINPUT_H, 1, [ ])
  3124. fi
  3125. fi
  3126. AC_MSG_CHECKING(for windows.gaming.input.h)
  3127. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  3128. #define COBJMACROS
  3129. #include <windows.gaming.input.h>
  3130. __x_ABI_CWindows_CGaming_CInput_CIGamepadStatics2 *s2;
  3131. ]],[])], [have_wgi=yes],[have_wgi=no])
  3132. AC_MSG_RESULT($have_wgi)
  3133. if test x$have_wgi = xyes; then
  3134. AC_DEFINE(HAVE_WINDOWS_GAMING_INPUT_H, 1, [ ])
  3135. fi
  3136. AC_CHECK_HEADER(mmdeviceapi.h, have_wasapi=yes)
  3137. if test x$have_wasapi = xyes; then
  3138. AC_DEFINE(HAVE_MMDEVICEAPI_H, 1, [ ])
  3139. fi
  3140. AC_CHECK_HEADER(audioclient.h,,have_wasapi=no)
  3141. if test x$have_wasapi = xyes; then
  3142. AC_DEFINE(HAVE_AUDIOCLIENT_H, 1, [ ])
  3143. fi
  3144. AC_ARG_ENABLE(wasapi,
  3145. [AS_HELP_STRING([--enable-wasapi], [use the Windows WASAPI audio driver [default=yes]])],
  3146. , enable_wasapi=yes)
  3147. }
  3148. dnl Check for the dlfcn.h interface for dynamically loading objects
  3149. dnl NOTE: CheckDLOPEN is called only for relevant platforms
  3150. CheckDLOPEN()
  3151. {
  3152. AC_DEFINE(DYNAPI_NEEDS_DLOPEN, 1, [ ])
  3153. AC_CHECK_HEADER(dlfcn.h,have_dlfcn_h=yes,have_dlfcn_h=no)
  3154. have_dlopen=no
  3155. AC_CHECK_LIB(c, dlopen, have_dlopen=yes,
  3156. AC_CHECK_LIB(dl, dlopen, [have_dlopen=yes; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl"]))
  3157. AC_MSG_CHECKING(for dlopen)
  3158. AC_MSG_RESULT($have_dlopen)
  3159. if test x$have_dlfcn_h = xyes -a x$have_dlopen = xyes; then
  3160. AC_DEFINE(HAVE_DLOPEN, 1, [ ])
  3161. if test x$enable_loadso = xyes; then
  3162. AC_DEFINE(SDL_LOADSO_DLOPEN, 1, [ ])
  3163. SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
  3164. have_loadso=yes
  3165. fi
  3166. fi
  3167. }
  3168. CheckO_CLOEXEC()
  3169. {
  3170. AC_MSG_CHECKING(for O_CLOEXEC)
  3171. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  3172. #include <fcntl.h>
  3173. int flag = O_CLOEXEC;
  3174. ]],[])], [have_o_cloexec=yes],[have_o_cloexec=no])
  3175. AC_MSG_RESULT($have_o_cloexec)
  3176. if test $have_o_cloexec = yes; then
  3177. AC_DEFINE(HAVE_O_CLOEXEC, 1, [ ])
  3178. fi
  3179. }
  3180. dnl Check for the usbhid(3) library on *BSD
  3181. CheckUSBHID()
  3182. {
  3183. case "$host" in
  3184. *-*-*bsd*|*-*-dragonfly*)
  3185. if test x$enable_joystick = xyes; then
  3186. AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
  3187. if test x$have_libusbhid = xyes; then
  3188. AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
  3189. AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
  3190. USB_LIBS="$USB_LIBS -lusbhid"
  3191. else
  3192. AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
  3193. AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
  3194. AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
  3195. fi
  3196. save_CFLAGS="$CFLAGS"
  3197. CFLAGS="$CFLAGS $USB_CFLAGS"
  3198. AC_MSG_CHECKING(for usbhid)
  3199. have_usbhid=no
  3200. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  3201. #include <sys/types.h>
  3202. #if defined(HAVE_USB_H)
  3203. #include <usb.h>
  3204. #endif
  3205. #ifdef __DragonFly__
  3206. # include <bus/u4b/usb.h>
  3207. # include <bus/u4b/usbhid.h>
  3208. #else
  3209. # include <dev/usb/usb.h>
  3210. # include <dev/usb/usbhid.h>
  3211. #endif
  3212. #if defined(HAVE_USBHID_H)
  3213. #include <usbhid.h>
  3214. #elif defined(HAVE_LIBUSB_H)
  3215. #include <libusb.h>
  3216. #elif defined(HAVE_LIBUSBHID_H)
  3217. #include <libusbhid.h>
  3218. #endif
  3219. ]], [[
  3220. struct report_desc *repdesc;
  3221. struct usb_ctl_report *repbuf;
  3222. hid_kind_t hidkind;
  3223. ]])], [have_usbhid=yes],[])
  3224. AC_MSG_RESULT($have_usbhid)
  3225. if test x$have_usbhid = xyes; then
  3226. AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
  3227. have_usbhid_ucr_data=no
  3228. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  3229. #include <sys/types.h>
  3230. #if defined(HAVE_USB_H)
  3231. #include <usb.h>
  3232. #endif
  3233. #ifdef __DragonFly__
  3234. # include <bus/u4b/usb.h>
  3235. # include <bus/u4b/usbhid.h>
  3236. #else
  3237. # include <dev/usb/usb.h>
  3238. # include <dev/usb/usbhid.h>
  3239. #endif
  3240. #if defined(HAVE_USBHID_H)
  3241. #include <usbhid.h>
  3242. #elif defined(HAVE_LIBUSB_H)
  3243. #include <libusb.h>
  3244. #elif defined(HAVE_LIBUSBHID_H)
  3245. #include <libusbhid.h>
  3246. #endif
  3247. ]], [[
  3248. struct usb_ctl_report buf;
  3249. if (buf.ucr_data) { }
  3250. ]])], [have_usbhid_ucr_data=yes],[])
  3251. if test x$have_usbhid_ucr_data = xyes; then
  3252. USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
  3253. fi
  3254. AC_MSG_RESULT($have_usbhid_ucr_data)
  3255. AC_MSG_CHECKING(for new usbhid API)
  3256. have_usbhid_new=no
  3257. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  3258. #include <sys/types.h>
  3259. #if defined(HAVE_USB_H)
  3260. #include <usb.h>
  3261. #endif
  3262. #ifdef __DragonFly__
  3263. #include <bus/u4b/usb.h>
  3264. #include <bus/u4b/usbhid.h>
  3265. #else
  3266. #include <dev/usb/usb.h>
  3267. #include <dev/usb/usbhid.h>
  3268. #endif
  3269. #if defined(HAVE_USBHID_H)
  3270. #include <usbhid.h>
  3271. #elif defined(HAVE_LIBUSB_H)
  3272. #include <libusb.h>
  3273. #elif defined(HAVE_LIBUSBHID_H)
  3274. #include <libusbhid.h>
  3275. #endif
  3276. ]], [[
  3277. report_desc_t d;
  3278. hid_start_parse(d, 1, 1);
  3279. ]])], [have_usbhid_new=yes],[])
  3280. if test x$have_usbhid_new = xyes; then
  3281. USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
  3282. fi
  3283. AC_MSG_RESULT($have_usbhid_new)
  3284. AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
  3285. have_machine_joystick=no
  3286. AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
  3287. #include <machine/joystick.h>
  3288. ]], [[
  3289. struct joystick t;
  3290. ]])], [have_machine_joystick=yes],[])
  3291. if test x$have_machine_joystick = xyes; then
  3292. AC_DEFINE(SDL_HAVE_MACHINE_JOYSTICK_H, 1, [ ])
  3293. fi
  3294. AC_MSG_RESULT($have_machine_joystick)
  3295. AC_DEFINE(SDL_JOYSTICK_USBHID, 1, [ ])
  3296. SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
  3297. EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
  3298. EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
  3299. have_joystick=yes
  3300. fi
  3301. CFLAGS="$save_CFLAGS"
  3302. fi
  3303. ;;
  3304. esac
  3305. }
  3306. dnl Check for HIDAPI joystick drivers
  3307. CheckHIDAPI()
  3308. {
  3309. AC_ARG_ENABLE(hidapi-joystick,
  3310. [AS_HELP_STRING([--enable-hidapi-joystick], [use HIDAPI for low level joystick drivers [default=yes]])],
  3311. , enable_hidapi_joystick=yes)
  3312. AC_ARG_ENABLE(hidapi-libusb,
  3313. [AS_HELP_STRING([--enable-hidapi-libusb], [use libusb for low level joystick drivers [default=maybe]])],
  3314. , enable_hidapi_libusb=maybe)
  3315. if test x$enable_hidapi = xyes; then
  3316. case "$host" in
  3317. # libusb does not support iOS
  3318. *-ios-* )
  3319. enable_hidapi_libusb=no
  3320. ;;
  3321. # On the other hand, *BSD specifically uses libusb only
  3322. *-*-*bsd* )
  3323. enable_hidapi_libusb=yes
  3324. require_hidapi_libusb=yes
  3325. ;;
  3326. *-*-os2* )
  3327. enable_hidapi_libusb=yes
  3328. ;;
  3329. esac
  3330. hidapi_support=yes
  3331. if test x$enable_hidapi_libusb = xyes; then
  3332. PKG_CHECK_MODULES([LIBUSB], [libusb-1.0], have_libusb=yes, have_libusb=no)
  3333. save_CPPFLAGS="$CPPFLAGS"
  3334. CPPFLAGS="$save_CPPFLAGS $LIBUSB_CFLAGS"
  3335. AC_CHECK_HEADER(libusb.h, have_libusb_h=yes, have_libusb_h=no)
  3336. CPPFLAGS="$save_CPPFLAGS"
  3337. if test x$have_libusb_h = xno && test x$require_hidapi_libusb = xyes; then
  3338. hidapi_support=no
  3339. fi
  3340. fi
  3341. if test x$hidapi_support = xyes; then
  3342. if test x$have_libusb_h = xyes; then
  3343. AC_DEFINE(HAVE_LIBUSB)
  3344. EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBUSB_CFLAGS"
  3345. if test x$require_hidapi_libusb = xyes; then
  3346. EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBUSB_LIBS"
  3347. else
  3348. if test x$have_loadso != xyes; then
  3349. AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic libusb loading])
  3350. fi
  3351. # libusb is loaded dynamically, so don't add it to LDFLAGS
  3352. libusb_lib=""
  3353. case "$host" in
  3354. *-*-darwin* )
  3355. libusb_lib="libusb-1.0.0.dylib"
  3356. ;;
  3357. *-*-cygwin* | *-*-mingw* )
  3358. libusb_lib="libusb-1.0.dll"
  3359. ;;
  3360. *-*-os2* )
  3361. libusb_lib="usb100.dll"
  3362. ;;
  3363. esac
  3364. if test x$libusb_lib = x; then
  3365. libusb_lib=[`find_lib "libusb-1.0.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`]
  3366. fi
  3367. AC_DEFINE_UNQUOTED(SDL_LIBUSB_DYNAMIC, "$libusb_lib", [ ])
  3368. fi
  3369. fi
  3370. fi
  3371. AC_MSG_CHECKING(for hidapi joystick support)
  3372. AC_MSG_RESULT($hidapi_support)
  3373. fi
  3374. if test x$enable_joystick = xyes -a x$hidapi_support = xyes -a x$enable_hidapi_joystick = xyes; then
  3375. AC_DEFINE(SDL_JOYSTICK_HIDAPI, 1, [ ])
  3376. SOURCES="$SOURCES $srcdir/src/joystick/hidapi/*.c"
  3377. fi
  3378. }
  3379. dnl Check for clock_gettime()
  3380. CheckClockGettime()
  3381. {
  3382. AC_ARG_ENABLE(clock_gettime,
  3383. [AS_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [default=yes]])],
  3384. , enable_clock_gettime=yes)
  3385. if test x$enable_clock_gettime = xyes; then
  3386. AC_CHECK_LIB(c, clock_gettime, have_clock_gettime=yes)
  3387. if test x$have_clock_gettime = xyes; then
  3388. AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ ])
  3389. else
  3390. AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
  3391. if test x$have_clock_gettime = xyes; then
  3392. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
  3393. AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ ])
  3394. fi
  3395. fi
  3396. fi
  3397. }
  3398. dnl Check for a valid linux/version.h
  3399. CheckLinuxVersion()
  3400. {
  3401. AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
  3402. if test x$have_linux_version_h = xyes; then
  3403. EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H"
  3404. fi
  3405. }
  3406. dnl Check if we want to use RPATH
  3407. CheckRPATH()
  3408. {
  3409. AC_ARG_ENABLE(rpath,
  3410. [AS_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [default=yes]])],
  3411. , enable_rpath=yes)
  3412. }
  3413. dnl Check if we want to use custom signals to fake iOS/Android's backgrounding
  3414. dnl events. These could be useful if you're building a custom embedded
  3415. dnl environment, etc, but most people don't need this.
  3416. CheckEventSignals()
  3417. {
  3418. AC_ARG_ENABLE(backgrounding-signal,
  3419. [AS_HELP_STRING([--enable-backgrounding-signal], [number to use for magic backgrounding signal or 'no' [default=no]])],
  3420. , enable_backgrounding_signal=no)
  3421. if test x$enable_backgrounding_signal != xno; then
  3422. EXTRA_CFLAGS="$EXTRA_CFLAGS -DSDL_BACKGROUNDING_SIGNAL=$enable_backgrounding_signal"
  3423. fi
  3424. AC_ARG_ENABLE(foregrounding-signal,
  3425. [AS_HELP_STRING([--enable-foregrounding-signal], [number to use for magic foregrounding signal or 'no' [default=no]])],
  3426. , enable_foregrounding_signal=no)
  3427. if test x$enable_foregrounding_signal != xno; then
  3428. EXTRA_CFLAGS="$EXTRA_CFLAGS -DSDL_FOREGROUNDING_SIGNAL=$enable_foregrounding_signal"
  3429. fi
  3430. }
  3431. dnl Set up the Virtual joystick driver.
  3432. CheckVirtualJoystick()
  3433. {
  3434. AC_ARG_ENABLE(joystick-virtual,
  3435. [AS_HELP_STRING([--enable-joystick-virtual], [enable virtual joystick APIs [default=yes]])],
  3436. , enable_joystick_virtual=yes)
  3437. if test x$enable_joystick = xyes -a x$enable_joystick_virtual = xyes; then
  3438. AC_DEFINE(SDL_JOYSTICK_VIRTUAL, 1, [ ])
  3439. SOURCES="$SOURCES $srcdir/src/joystick/virtual/*.c"
  3440. have_joystick_virtual=yes
  3441. fi
  3442. }
  3443. dnl Do this on all platforms, before everything else (other things might want to override it).
  3444. CheckWarnAll
  3445. CheckUnusedLocalTypedefs
  3446. CheckNoStrictAliasing
  3447. dnl Do this for every platform, but for some it doesn't mean anything, but better to catch it here anyhow.
  3448. CheckEventSignals
  3449. have_locale=no
  3450. dnl Set up the configuration based on the host platform!
  3451. case "$host" in
  3452. *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*|*-*-nto*)
  3453. case "$host" in
  3454. *-*-android*)
  3455. # Android
  3456. ARCH=android
  3457. ANDROID_CFLAGS="-DGL_GLEXT_PROTOTYPES"
  3458. CFLAGS="$CFLAGS $ANDROID_CFLAGS"
  3459. SDL_CFLAGS="$SDL_CFLAGS $ANDROID_CFLAGS"
  3460. EXTRA_CFLAGS="$EXTRA_CFLAGS $ANDROID_CFLAGS"
  3461. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl -lGLESv1_CM -lGLESv2 -llog -landroid"
  3462. SDLMAIN_SOURCES="$srcdir/src/main/android/*.c"
  3463. if test x$enable_video = xyes; then
  3464. SOURCES="$SOURCES $srcdir/src/core/android/*.c $srcdir/src/video/android/*.c"
  3465. AC_DEFINE(SDL_VIDEO_DRIVER_ANDROID, 1, [ ])
  3466. SUMMARY_video="${SUMMARY_video} android"
  3467. have_video=yes
  3468. fi
  3469. ;;
  3470. *-*-linux*) ARCH=linux ;;
  3471. *-*-uclinux*) ARCH=linux ;;
  3472. *-*-kfreebsd*-gnu) ARCH=kfreebsd-gnu ;;
  3473. *-*-knetbsd*-gnu) ARCH=knetbsd-gnu ;;
  3474. *-*-kopenbsd*-gnu) ARCH=kopenbsd-gnu ;;
  3475. *-*-gnu*) ARCH=gnu ;; # must be last of the gnu variants
  3476. *-*-bsdi*) ARCH=bsdi ;;
  3477. *-*-freebsd*) ARCH=freebsd ;;
  3478. *-*-dragonfly*) ARCH=freebsd ;;
  3479. *-*-netbsd*) ARCH=netbsd ;;
  3480. *-*-openbsd*) ARCH=openbsd ;;
  3481. *-*-sysv5*) ARCH=sysv5 ;;
  3482. *-*-solaris*) ARCH=solaris ;;
  3483. *-*-hpux*) ARCH=hpux ;;
  3484. *-*-aix*) ARCH=aix ;;
  3485. *-*-minix*) ARCH=minix ;;
  3486. *-*-nto*) ARCH=nto
  3487. CheckQNXVideo
  3488. ;;
  3489. esac
  3490. CheckVisibilityHidden
  3491. CheckWerror
  3492. CheckDeclarationAfterStatement
  3493. CheckDummyVideo
  3494. CheckOffscreenVideo
  3495. CheckDiskAudio
  3496. CheckDummyAudio
  3497. CheckDLOPEN
  3498. CheckARM
  3499. CheckNEON
  3500. CheckO_CLOEXEC
  3501. CheckOSS
  3502. CheckALSA
  3503. CheckPipewire
  3504. CheckPulseAudio
  3505. CheckJACK
  3506. CheckARTSC
  3507. CheckESD
  3508. CheckNAS
  3509. CheckSNDIO
  3510. CheckFusionSound
  3511. CheckLibSampleRate
  3512. # Need to check for Raspberry PI first and add platform specific compiler flags, otherwise the test for GLES fails!
  3513. CheckRPI
  3514. CheckX11
  3515. CheckDirectFB
  3516. # Need to check for EGL first because KMSDRM and Wayland depends on it.
  3517. CheckEGL
  3518. CheckKMSDRM
  3519. CheckGLX
  3520. CheckOpenGL
  3521. CheckOpenGLES
  3522. CheckVulkan
  3523. CheckWayland
  3524. CheckInputEvents
  3525. CheckLibUDev
  3526. CheckDBus
  3527. CheckIME
  3528. CheckInotify
  3529. CheckIBus
  3530. CheckFcitx
  3531. case $ARCH in
  3532. linux)
  3533. CheckInputKD
  3534. ;;
  3535. freebsd)
  3536. CheckInputKBIO
  3537. ;;
  3538. openbsd|netbsd)
  3539. CheckInputWSCONS
  3540. ;;
  3541. esac
  3542. CheckUSBHID
  3543. CheckHIDAPI
  3544. CheckPTHREAD
  3545. CheckClockGettime
  3546. CheckLinuxVersion
  3547. CheckRPATH
  3548. CheckVivanteVideo
  3549. # Set up files for the misc library
  3550. if test x$enable_misc = xyes; then
  3551. SOURCES="$SOURCES $srcdir/src/misc/unix/*.c"
  3552. have_misc=yes
  3553. fi
  3554. # Set up files for the locale library
  3555. if test x$enable_locale = xyes; then
  3556. SOURCES="$SOURCES $srcdir/src/locale/unix/*.c"
  3557. have_locale=yes
  3558. fi
  3559. # Set up files for the audio library
  3560. if test x$enable_audio = xyes; then
  3561. case $ARCH in
  3562. sysv5|solaris|hpux)
  3563. # Newer Solaris-based systems, like OpenIndiana, don't have this interface anymore. Check for the header first.
  3564. AC_CHECK_HEADER(sys/audioio.h, have_sys_audioio_h=yes, have_sys_audioio_h=no)
  3565. if test x$have_sys_audioio_h = xyes; then
  3566. AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO, 1, [ ])
  3567. SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
  3568. SUMMARY_audio="${SUMMARY_audio} sun"
  3569. have_audio=yes
  3570. fi
  3571. ;;
  3572. netbsd) # Don't use this on OpenBSD, it's busted.
  3573. AC_DEFINE(SDL_AUDIO_DRIVER_NETBSD, 1, [ ])
  3574. SOURCES="$SOURCES $srcdir/src/audio/netbsd/*.c"
  3575. SUMMARY_audio="${SUMMARY_audio} netbsd"
  3576. have_audio=yes
  3577. ;;
  3578. aix)
  3579. AC_DEFINE(SDL_AUDIO_DRIVER_PAUDIO, 1, [ ])
  3580. SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
  3581. SUMMARY_audio="${SUMMARY_audio} paudio"
  3582. have_audio=yes
  3583. ;;
  3584. android)
  3585. AC_DEFINE(SDL_AUDIO_DRIVER_ANDROID, 1, [ ])
  3586. SOURCES="$SOURCES $srcdir/src/audio/android/*.c"
  3587. SUMMARY_audio="${SUMMARY_audio} android"
  3588. AC_DEFINE(SDL_AUDIO_DRIVER_OPENSLES, 1, [ ])
  3589. SOURCES="$SOURCES $srcdir/src/audio/openslES/*.c"
  3590. SUMMARY_audio="${SUMMARY_audio} openslES"
  3591. AC_DEFINE(SDL_AUDIO_DRIVER_AAUDIO, 1, [ ])
  3592. SOURCES="$SOURCES $srcdir/src/audio/aaudio/*.c"
  3593. SUMMARY_audio="${SUMMARY_audio} aaudio"
  3594. have_audio=yes
  3595. ;;
  3596. nto)
  3597. CheckQNXAudio
  3598. ;;
  3599. esac
  3600. fi
  3601. # Set up files for the joystick library
  3602. if test x$enable_joystick = xyes; then
  3603. case $ARCH in
  3604. linux)
  3605. if test "x$ac_cv_header_linux_input_h" = xyes; then
  3606. AC_DEFINE(SDL_JOYSTICK_LINUX, 1, [ ])
  3607. SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
  3608. SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c"
  3609. have_joystick=yes
  3610. fi
  3611. ;;
  3612. freebsd)
  3613. if test x$use_input_events = xyes -a x$ac_cv_header_linux_input_h = xyes; then
  3614. AC_DEFINE(SDL_JOYSTICK_LINUX, 1, [ ])
  3615. SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
  3616. SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c"
  3617. have_joystick=yes
  3618. fi
  3619. ;;
  3620. android)
  3621. AC_DEFINE(SDL_JOYSTICK_ANDROID, 1, [ ])
  3622. SOURCES="$SOURCES $srcdir/src/joystick/android/*.c"
  3623. SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c"
  3624. have_joystick=yes
  3625. ;;
  3626. esac
  3627. fi
  3628. # Set up files for the haptic library
  3629. if test x$enable_haptic = xyes; then
  3630. case $ARCH in
  3631. linux|freebsd)
  3632. if test x$use_input_events = xyes; then
  3633. AC_DEFINE(SDL_HAPTIC_LINUX, 1, [ ])
  3634. SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c"
  3635. have_haptic=yes
  3636. fi
  3637. ;;
  3638. android)
  3639. AC_DEFINE(SDL_HAPTIC_ANDROID, 1, [ ])
  3640. SOURCES="$SOURCES $srcdir/src/haptic/android/*.c"
  3641. have_haptic=yes
  3642. ;;
  3643. esac
  3644. fi
  3645. # Set up files for the sensor library
  3646. if test x$enable_sensor = xyes; then
  3647. case $ARCH in
  3648. android)
  3649. AC_DEFINE(SDL_SENSOR_ANDROID, 1, [ ])
  3650. SOURCES="$SOURCES $srcdir/src/sensor/android/*.c"
  3651. have_sensor=yes
  3652. ;;
  3653. esac
  3654. fi
  3655. # Set up files for the power library
  3656. if test x$enable_power = xyes; then
  3657. case $ARCH in
  3658. linux)
  3659. AC_DEFINE(SDL_POWER_LINUX, 1, [ ])
  3660. SOURCES="$SOURCES $srcdir/src/power/linux/*.c"
  3661. have_power=yes
  3662. ;;
  3663. android)
  3664. AC_DEFINE(SDL_POWER_ANDROID, 1, [ ])
  3665. SOURCES="$SOURCES $srcdir/src/power/android/*.c"
  3666. have_power=yes
  3667. ;;
  3668. esac
  3669. fi
  3670. # Set up files for the filesystem library
  3671. if test x$enable_filesystem = xyes; then
  3672. case $ARCH in
  3673. android)
  3674. AC_DEFINE(SDL_FILESYSTEM_ANDROID, 1, [ ])
  3675. SOURCES="$SOURCES $srcdir/src/filesystem/android/*.c"
  3676. have_filesystem=yes
  3677. ;;
  3678. *)
  3679. AC_DEFINE(SDL_FILESYSTEM_UNIX, 1, [ ])
  3680. SOURCES="$SOURCES $srcdir/src/filesystem/unix/*.c"
  3681. have_filesystem=yes
  3682. ;;
  3683. esac
  3684. fi
  3685. # Set up files for the timer library
  3686. if test x$enable_timers = xyes; then
  3687. AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
  3688. SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  3689. have_timers=yes
  3690. fi
  3691. # Set up files for udev hotplugging support
  3692. if test x$enable_libudev = xyes && test x$have_libudev_h_hdr = xyes; then
  3693. SOURCES="$SOURCES $srcdir/src/core/linux/SDL_udev.c"
  3694. fi
  3695. # Set up files for evdev input
  3696. if test x$use_input_events = xyes; then
  3697. SOURCES="$SOURCES $srcdir/src/core/linux/SDL_evdev.c"
  3698. SOURCES="$SOURCES $srcdir/src/core/linux/SDL_evdev_kbd.c"
  3699. SOURCES="$SOURCES $srcdir/src/core/freebsd/SDL_evdev_kbd_freebsd.c"
  3700. fi
  3701. # Set up files for wscons input
  3702. if test x$use_input_wscons = xyes; then
  3703. SOURCES="$SOURCES $srcdir/src/core/openbsd/SDL_wscons_kbd.c"
  3704. SOURCES="$SOURCES $srcdir/src/core/openbsd/SDL_wscons_mouse.c"
  3705. fi
  3706. # Set up other core UNIX files
  3707. SOURCES="$SOURCES $srcdir/src/core/linux/SDL_evdev_capabilities.c"
  3708. SOURCES="$SOURCES $srcdir/src/core/linux/SDL_threadprio.c"
  3709. SOURCES="$SOURCES $srcdir/src/core/linux/SDL_sandbox.c"
  3710. SOURCES="$SOURCES $srcdir/src/core/unix/*.c"
  3711. ;;
  3712. *-*-cygwin* | *-*-mingw*)
  3713. ARCH=win32
  3714. if test "$build" != "$host"; then # cross-compiling
  3715. # Default cross-compile location
  3716. ac_default_prefix=/usr/local/cross-tools/$host
  3717. else
  3718. # Look for the location of the tools and install there
  3719. if test "$BUILD_PREFIX" != ""; then
  3720. ac_default_prefix=$BUILD_PREFIX
  3721. fi
  3722. fi
  3723. if test x$enable_loadso = xyes; then
  3724. have_loadso=yes
  3725. fi
  3726. CheckGDwarf4
  3727. CheckWerror
  3728. CheckDeclarationAfterStatement
  3729. CheckDummyVideo
  3730. CheckOffscreenVideo
  3731. CheckDiskAudio
  3732. CheckDummyAudio
  3733. CheckWINDOWS
  3734. CheckWINDOWSGL
  3735. CheckWINDOWSGLES
  3736. CheckVulkan
  3737. CheckDIRECTX
  3738. CheckHIDAPI
  3739. # Set up the core platform files
  3740. SOURCES="$SOURCES $srcdir/src/core/windows/*.c"
  3741. # Set up files for the misc library
  3742. if test x$enable_misc = xyes; then
  3743. SOURCES="$SOURCES $srcdir/src/misc/windows/*.c"
  3744. have_misc=yes
  3745. fi
  3746. # Use the Windows locale APIs.
  3747. if test x$enable_locale = xyes; then
  3748. SOURCES="$SOURCES $srcdir/src/locale/windows/*.c"
  3749. have_locale=yes
  3750. fi
  3751. # Set up files for the video library
  3752. if test x$enable_video = xyes; then
  3753. AC_DEFINE(SDL_VIDEO_DRIVER_WINDOWS, 1, [ ])
  3754. SOURCES="$SOURCES $srcdir/src/video/windows/*.c"
  3755. have_video=yes
  3756. AC_ARG_ENABLE(render-d3d,
  3757. [AS_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [default=yes]])],
  3758. , enable_render_d3d=yes)
  3759. if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
  3760. AC_DEFINE(SDL_VIDEO_RENDER_D3D, 1, [ ])
  3761. SUMMARY_video="${SUMMARY_video} d3d9"
  3762. fi
  3763. if test x$enable_render_d3d = xyes -a x$have_d3d11 = xyes; then
  3764. AC_DEFINE(SDL_VIDEO_RENDER_D3D11, 1, [ ])
  3765. SUMMARY_video="${SUMMARY_video} d3d11"
  3766. fi
  3767. if test x$enable_render_d3d = xyes -a x$have_d3d12 = xyes; then
  3768. AC_DEFINE(SDL_VIDEO_RENDER_D3D12, 1, [ ])
  3769. SUMMARY_video="${SUMMARY_video} d3d12"
  3770. fi
  3771. fi
  3772. # Set up files for the audio library
  3773. if test x$enable_audio = xyes; then
  3774. AC_DEFINE(SDL_AUDIO_DRIVER_WINMM, 1, [ ])
  3775. SUMMARY_audio="${SUMMARY_audio} winmm"
  3776. SOURCES="$SOURCES $srcdir/src/audio/winmm/*.c"
  3777. if test x$have_dsound = xyes; then
  3778. AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND, 1, [ ])
  3779. SUMMARY_audio="${SUMMARY_audio} directsound"
  3780. SOURCES="$SOURCES $srcdir/src/audio/directsound/*.c"
  3781. fi
  3782. if test x$have_wasapi = xyes -a x$enable_wasapi = xyes; then
  3783. AC_DEFINE(SDL_AUDIO_DRIVER_WASAPI, 1, [ ])
  3784. SUMMARY_audio="${SUMMARY_audio} wasapi"
  3785. SOURCES="$SOURCES $srcdir/src/audio/wasapi/*.c"
  3786. fi
  3787. have_audio=yes
  3788. fi
  3789. # Set up files for the joystick library
  3790. if test x$enable_joystick = xyes; then
  3791. AC_DEFINE(SDL_JOYSTICK_RAWINPUT, 1, [ ])
  3792. if test x$have_dinput = xyes -o x$have_xinput = xyes -o x$have_wgi = xyes; then
  3793. if test x$have_xinput = xyes; then
  3794. AC_DEFINE(SDL_JOYSTICK_XINPUT, 1, [ ])
  3795. fi
  3796. if test x$have_wgi = xyes; then
  3797. AC_DEFINE(SDL_JOYSTICK_WGI, 1, [ ])
  3798. fi
  3799. if test x$have_dinput = xyes; then
  3800. AC_DEFINE(SDL_JOYSTICK_DINPUT, 1, [ ])
  3801. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid -ldxerr8"
  3802. fi
  3803. fi
  3804. SOURCES="$SOURCES $srcdir/src/joystick/windows/*.c"
  3805. have_joystick=yes
  3806. fi
  3807. if test x$enable_haptic = xyes; then
  3808. if test x$have_dinput = xyes -o x$have_xinput = xyes; then
  3809. if test x$have_xinput = xyes; then
  3810. AC_DEFINE(SDL_HAPTIC_XINPUT, 1, [ ])
  3811. fi
  3812. if test x$have_dinput = xyes; then
  3813. AC_DEFINE(SDL_HAPTIC_DINPUT, 1, [ ])
  3814. fi
  3815. SOURCES="$SOURCES $srcdir/src/haptic/windows/*.c"
  3816. have_haptic=yes
  3817. fi
  3818. fi
  3819. # Set up files for the sensor library
  3820. AC_CHECK_HEADER(sensorsapi.h,have_winsensors=yes,have_winsensors=no)
  3821. if test x$have_winsensors = xyes; then
  3822. AC_DEFINE(HAVE_SENSORSAPI_H, 1, [ ])
  3823. fi
  3824. if test x$enable_sensor = xyes -a x$have_winsensors = xyes; then
  3825. AC_DEFINE(SDL_SENSOR_WINDOWS, 1, [ ])
  3826. SOURCES="$SOURCES $srcdir/src/sensor/windows/*.c"
  3827. have_sensor=yes
  3828. fi
  3829. # Set up files for the power library
  3830. if test x$enable_power = xyes; then
  3831. AC_DEFINE(SDL_POWER_WINDOWS, 1, [ ])
  3832. SOURCES="$SOURCES $srcdir/src/power/windows/SDL_syspower.c"
  3833. have_power=yes
  3834. fi
  3835. # Set up files for the filesystem library
  3836. if test x$enable_filesystem = xyes; then
  3837. AC_DEFINE(SDL_FILESYSTEM_WINDOWS, 1, [ ])
  3838. SOURCES="$SOURCES $srcdir/src/filesystem/windows/SDL_sysfilesystem.c"
  3839. have_filesystem=yes
  3840. fi
  3841. # Set up files for the thread library
  3842. if test x$enable_threads = xyes; then
  3843. AC_DEFINE(SDL_THREAD_GENERIC_COND_SUFFIX, 1, [ ])
  3844. AC_DEFINE(SDL_THREAD_WINDOWS, 1, [ ])
  3845. SOURCES="$SOURCES $srcdir/src/thread/windows/*.c"
  3846. SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  3847. have_threads=yes
  3848. fi
  3849. # Set up files for the timer library
  3850. if test x$enable_timers = xyes; then
  3851. AC_DEFINE(SDL_TIMER_WINDOWS, 1, [ ])
  3852. SOURCES="$SOURCES $srcdir/src/timer/windows/*.c"
  3853. have_timers=yes
  3854. fi
  3855. # Set up files for the shared object loading library
  3856. if test x$enable_loadso = xyes; then
  3857. AC_DEFINE(SDL_LOADSO_WINDOWS, 1, [ ])
  3858. SOURCES="$SOURCES $srcdir/src/loadso/windows/*.c"
  3859. fi
  3860. # Set up the system libraries we need
  3861. if test -f /lib/w32api/libuuid.a; then
  3862. LIBUUID=/lib/w32api/libuuid.a
  3863. else
  3864. LIBUUID=-luuid
  3865. fi
  3866. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion $LIBUUID"
  3867. BUILD_LDFLAGS="$BUILD_LDFLAGS -Wc,-static-libgcc"
  3868. # The Windows platform requires special setup
  3869. VERSION_SOURCES="$srcdir/src/main/windows/*.rc"
  3870. SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c"
  3871. SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  3872. SDL_LIBS="-lSDL2main $SDL_LIBS -mwindows"
  3873. # Check to see if this is a mingw or cygwin build
  3874. have_mingw32=
  3875. AC_CHECK_LIB(mingw32, main, [have_mingw32=yes])
  3876. if test x$have_mingw32 = xyes; then
  3877. SDL_LIBS="-lmingw32 $SDL_LIBS"
  3878. else
  3879. SDL_LIBS="-lcygwin $SDL_LIBS"
  3880. fi
  3881. ;;
  3882. dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan.
  3883. *-*-beos*)
  3884. AC_MSG_ERROR([
  3885. *** BeOS support has been removed as of SDL 2.0.2.
  3886. ])
  3887. ;;
  3888. *-*-haiku*)
  3889. ARCH=haiku
  3890. ac_default_prefix=/boot/system
  3891. CheckDummyVideo
  3892. CheckOffscreenVideo
  3893. CheckDiskAudio
  3894. CheckDummyAudio
  3895. CheckDLOPEN
  3896. CheckO_CLOEXEC
  3897. CheckHaikuVideo
  3898. CheckHaikuGL
  3899. CheckPTHREAD
  3900. # Set up files for the audio library
  3901. if test x$enable_audio = xyes; then
  3902. AC_DEFINE(SDL_AUDIO_DRIVER_HAIKU, 1, [ ])
  3903. SOURCES="$SOURCES $srcdir/src/audio/haiku/*.cc"
  3904. SUMMARY_audio="${SUMMARY_audio} haiku"
  3905. have_audio=yes
  3906. fi
  3907. # Set up files for the joystick library
  3908. if test x$enable_joystick = xyes; then
  3909. AC_DEFINE(SDL_JOYSTICK_HAIKU, 1, [ ])
  3910. SOURCES="$SOURCES $srcdir/src/joystick/haiku/*.cc"
  3911. have_joystick=yes
  3912. fi
  3913. # Set up files for the timer library
  3914. if test x$enable_timers = xyes; then
  3915. AC_DEFINE(SDL_TIMER_HAIKU, 1, [ ])
  3916. SOURCES="$SOURCES $srcdir/src/timer/haiku/*.c"
  3917. have_timers=yes
  3918. fi
  3919. # Set up files for the system power library
  3920. if test x$enable_power = xyes; then
  3921. AC_DEFINE(SDL_POWER_HAIKU, 1, [ ])
  3922. SOURCES="$SOURCES $srcdir/src/power/haiku/*.c"
  3923. have_power=yes
  3924. fi
  3925. # Set up files for the system filesystem library
  3926. if test x$enable_filesystem = xyes; then
  3927. AC_DEFINE(SDL_FILESYSTEM_HAIKU, 1, [ ])
  3928. SOURCES="$SOURCES $srcdir/src/filesystem/haiku/*.cc"
  3929. have_filesystem=yes
  3930. fi
  3931. # Set up files for the misc library
  3932. if test x$enable_misc = xyes; then
  3933. SOURCES="$SOURCES $srcdir/src/misc/haiku/*.cc"
  3934. have_misc=yes
  3935. fi
  3936. # Set up files for the locale library
  3937. if test x$enable_locale = xyes; then
  3938. SOURCES="$SOURCES $srcdir/src/locale/haiku/*.cc"
  3939. have_locale=yes
  3940. fi
  3941. # The Haiku platform requires special setup.
  3942. SOURCES="$srcdir/src/main/haiku/*.cc $SOURCES"
  3943. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
  3944. ;;
  3945. *-ios-*)
  3946. ARCH=ios
  3947. CheckVisibilityHidden
  3948. CheckWerror
  3949. CheckNoErrorDeprecatedDeclarationsWerror
  3950. CheckDeclarationAfterStatement
  3951. CheckDummyVideo
  3952. CheckOffscreenVideo
  3953. CheckDiskAudio
  3954. CheckDummyAudio
  3955. CheckDLOPEN
  3956. CheckO_CLOEXEC
  3957. CheckMETAL
  3958. CheckVulkan
  3959. CheckPTHREAD
  3960. # Set up files for the misc library
  3961. if test x$enable_misc = xyes; then
  3962. SOURCES="$SOURCES $srcdir/src/misc/ios/*.m"
  3963. have_misc=yes
  3964. fi
  3965. # Set up files for the locale library
  3966. if test x$enable_locale = xyes; then
  3967. SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m"
  3968. have_locale=yes
  3969. fi
  3970. # Set up files for the audio library
  3971. if test x$enable_audio = xyes; then
  3972. AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ])
  3973. SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m"
  3974. SUMMARY_audio="${SUMMARY_audio} coreaudio"
  3975. have_audio=yes
  3976. fi
  3977. # Set up files for the joystick library
  3978. if test x$enable_joystick = xyes; then
  3979. AC_DEFINE(SDL_JOYSTICK_MFI, 1, [ ])
  3980. SOURCES="$SOURCES $srcdir/src/joystick/iphoneos/*.m"
  3981. SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c"
  3982. have_joystick=yes
  3983. else
  3984. # Need this code for accelerometer as joystick support
  3985. SOURCES="$SOURCES $srcdir/src/joystick/iphoneos/*.m"
  3986. fi
  3987. # Set up files for the haptic library
  3988. #if test x$enable_haptic = xyes; then
  3989. # SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
  3990. # have_haptic=yes
  3991. # EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
  3992. #fi
  3993. # Set up files for the sensor library
  3994. if test x$enable_sensor = xyes; then
  3995. AC_DEFINE(SDL_SENSOR_COREMOTION, 1, [ ])
  3996. SOURCES="$SOURCES $srcdir/src/sensor/coremotion/*.m"
  3997. have_sensor=yes
  3998. fi
  3999. # Set up files for the power library
  4000. if test x$enable_power = xyes; then
  4001. AC_DEFINE(SDL_POWER_UIKIT, 1, [ ])
  4002. SOURCES="$SOURCES $srcdir/src/power/uikit/*.m"
  4003. have_power=yes
  4004. fi
  4005. # Set up files for the filesystem library
  4006. if test x$enable_filesystem = xyes; then
  4007. SOURCES="$SOURCES $srcdir/src/filesystem/cocoa/*.m"
  4008. have_filesystem=yes
  4009. fi
  4010. # Set up additional files for the file library
  4011. if test x$enable_file = xyes; then
  4012. AC_DEFINE(SDL_FILESYSTEM_COCOA, 1, [ ])
  4013. SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m"
  4014. fi
  4015. # Set up files for the timer library
  4016. if test x$enable_timers = xyes; then
  4017. AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
  4018. SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  4019. have_timers=yes
  4020. fi
  4021. # Set up other core UNIX files
  4022. SOURCES="$SOURCES $srcdir/src/core/unix/*.c"
  4023. # The iOS platform requires special setup.
  4024. AC_DEFINE(SDL_VIDEO_DRIVER_UIKIT, 1, [ ])
  4025. AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
  4026. AC_DEFINE(SDL_VIDEO_OPENGL_ES, 1, [ ])
  4027. AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES, 1, [ ])
  4028. AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
  4029. SOURCES="$SOURCES $srcdir/src/video/uikit/*.m"
  4030. SUMMARY_video="${SUMMARY_video} uikit"
  4031. have_video=yes
  4032. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"
  4033. if test x$enable_system_iconv = xyes; then
  4034. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"
  4035. fi
  4036. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc"
  4037. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AVFoundation"
  4038. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox"
  4039. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio"
  4040. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreGraphics"
  4041. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreMotion"
  4042. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Foundation"
  4043. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,GameController"
  4044. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGLES"
  4045. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuartzCore"
  4046. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,UIKit"
  4047. if test x$enable_video_metal = xyes -o x$enable_video_vulkan = xyes; then
  4048. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Metal"
  4049. fi
  4050. ;;
  4051. *-*-darwin* )
  4052. # This could be either full "Mac OS X", or plain "Darwin" which is
  4053. # just the OS X kernel sans upper layers like Carbon and Cocoa.
  4054. # Next line is broken, and a few files below require Mac OS X (full)
  4055. ARCH=macosx
  4056. # Mac OS X builds with both the Carbon and OSX APIs at the moment
  4057. EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON"
  4058. EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
  4059. CheckObjectiveCARC
  4060. CheckVisibilityHidden
  4061. CheckWerror
  4062. CheckNoErrorDeprecatedDeclarationsWerror
  4063. CheckDeclarationAfterStatement
  4064. CheckDummyVideo
  4065. CheckOffscreenVideo
  4066. CheckDiskAudio
  4067. CheckDummyAudio
  4068. CheckDLOPEN
  4069. CheckO_CLOEXEC
  4070. CheckCOCOA
  4071. CheckMETAL
  4072. CheckX11
  4073. CheckMacGL
  4074. CheckMacGLES
  4075. CheckGLX
  4076. CheckOpenGL
  4077. CheckVulkan
  4078. CheckPTHREAD
  4079. CheckHIDAPI
  4080. # Set up files for the misc library
  4081. if test x$enable_misc = xyes; then
  4082. SOURCES="$SOURCES $srcdir/src/misc/macosx/*.m"
  4083. have_misc=yes
  4084. fi
  4085. # Set up files for the locale library
  4086. if test x$enable_locale = xyes; then
  4087. SOURCES="$SOURCES $srcdir/src/locale/macosx/*.m"
  4088. have_locale=yes
  4089. fi
  4090. # Set up files for the audio library
  4091. if test x$enable_audio = xyes; then
  4092. AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ])
  4093. SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m"
  4094. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox"
  4095. SUMMARY_audio="${SUMMARY_audio} coreaudio"
  4096. have_audio=yes
  4097. fi
  4098. # Set up files for the joystick library
  4099. if test x$enable_joystick = xyes; then
  4100. AC_DEFINE(SDL_JOYSTICK_IOKIT, 1, [ ])
  4101. SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
  4102. SOURCES="$SOURCES $srcdir/src/joystick/iphoneos/*.m"
  4103. CheckJoystickMFI
  4104. have_joystick=yes
  4105. fi
  4106. # Set up files for the haptic library
  4107. if test x$enable_haptic = xyes; then
  4108. AC_DEFINE(SDL_HAPTIC_IOKIT, 1, [ ])
  4109. SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
  4110. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
  4111. have_haptic=yes
  4112. fi
  4113. # Set up files for the power library
  4114. if test x$enable_power = xyes; then
  4115. AC_DEFINE(SDL_POWER_MACOSX, 1, [ ])
  4116. SOURCES="$SOURCES $srcdir/src/power/macosx/*.c"
  4117. have_power=yes
  4118. fi
  4119. # Set up files for the filesystem library
  4120. if test x$enable_filesystem = xyes; then
  4121. AC_DEFINE(SDL_FILESYSTEM_COCOA, 1, [ ])
  4122. SOURCES="$SOURCES $srcdir/src/filesystem/cocoa/*.m"
  4123. have_filesystem=yes
  4124. fi
  4125. # Set up files for the timer library
  4126. if test x$enable_timers = xyes; then
  4127. AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
  4128. SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  4129. have_timers=yes
  4130. fi
  4131. # Set up additional files for the file library
  4132. if test x$enable_file = xyes; then
  4133. SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m"
  4134. fi
  4135. # Set up other core UNIX files
  4136. SOURCES="$SOURCES $srcdir/src/core/unix/*.c"
  4137. # The Mac OS X platform requires special setup.
  4138. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc"
  4139. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreVideo"
  4140. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
  4141. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
  4142. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
  4143. if test x$enable_video_metal = xyes -o x$enable_video_vulkan = xyes; then
  4144. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-weak_framework,QuartzCore -Wl,-weak_framework,Metal"
  4145. fi
  4146. ;;
  4147. *-nacl|*-pnacl)
  4148. ARCH=nacl
  4149. CheckNativeClient
  4150. CheckDummyAudio
  4151. CheckDummyVideo
  4152. CheckOffscreenVideo
  4153. CheckInputEvents
  4154. CheckPTHREAD
  4155. CheckO_CLOEXEC
  4156. # Set up files for the timer library
  4157. if test x$enable_timers = xyes; then
  4158. AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
  4159. SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  4160. have_timers=yes
  4161. fi
  4162. if test x$enable_filesystem = xyes; then
  4163. AC_DEFINE(SDL_FILESYSTEM_NACL, 1, [ ])
  4164. SOURCES="$SOURCES $srcdir/src/filesystem/nacl/*.c"
  4165. have_filesystem=yes
  4166. fi
  4167. ;;
  4168. *-*-emscripten* )
  4169. if test x$enable_video = xyes; then
  4170. AC_DEFINE(SDL_VIDEO_DRIVER_EMSCRIPTEN, 1, [ ])
  4171. SOURCES="$SOURCES $srcdir/src/video/emscripten/*.c"
  4172. have_video=yes
  4173. SUMMARY_video="${SUMMARY_video} emscripten"
  4174. fi
  4175. if test x$enable_audio = xyes; then
  4176. AC_DEFINE(SDL_AUDIO_DRIVER_EMSCRIPTEN, 1, [ ])
  4177. SOURCES="$SOURCES $srcdir/src/audio/emscripten/*.c"
  4178. have_audio=yes
  4179. SUMMARY_audio="${SUMMARY_audio} emscripten"
  4180. fi
  4181. CheckVisibilityHidden
  4182. CheckWerror
  4183. CheckDeclarationAfterStatement
  4184. CheckDummyVideo
  4185. CheckOffscreenVideo
  4186. CheckDiskAudio
  4187. CheckDummyAudio
  4188. CheckPTHREAD
  4189. CheckDLOPEN
  4190. CheckClockGettime
  4191. CheckEmscriptenGLES
  4192. # Set up files for the misc library
  4193. if test x$enable_misc = xyes; then
  4194. SOURCES="$SOURCES $srcdir/src/misc/emscripten/*.c"
  4195. have_misc=yes
  4196. fi
  4197. # Set up files for the power library
  4198. if test x$enable_power = xyes; then
  4199. AC_DEFINE(SDL_POWER_EMSCRIPTEN, 1, [ ])
  4200. SOURCES="$SOURCES $srcdir/src/power/emscripten/*.c"
  4201. have_power=yes
  4202. fi
  4203. # Set up files for the joystick library
  4204. if test x$enable_joystick = xyes; then
  4205. AC_DEFINE(SDL_JOYSTICK_EMSCRIPTEN, 1, [ ])
  4206. SOURCES="$SOURCES $srcdir/src/joystick/emscripten/*.c"
  4207. have_joystick=yes
  4208. fi
  4209. # Set up files for the filesystem library
  4210. if test x$enable_filesystem = xyes; then
  4211. AC_DEFINE(SDL_FILESYSTEM_EMSCRIPTEN, 1, [ ])
  4212. SOURCES="$SOURCES $srcdir/src/filesystem/emscripten/*.c"
  4213. have_filesystem=yes
  4214. fi
  4215. # Set up files for the timer library
  4216. if test x$enable_timers = xyes; then
  4217. AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
  4218. SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  4219. have_timers=yes
  4220. fi
  4221. # Set up files for the locale library
  4222. if test x$enable_locale = xyes; then
  4223. SOURCES="$SOURCES $srcdir/src/locale/emscripten/*.c"
  4224. have_locale=yes
  4225. fi
  4226. ;;
  4227. *-*-riscos*)
  4228. ARCH=riscos
  4229. CheckVisibilityHidden
  4230. CheckWerror
  4231. CheckDeclarationAfterStatement
  4232. CheckDummyVideo
  4233. CheckOffscreenVideo
  4234. CheckDiskAudio
  4235. CheckDummyAudio
  4236. CheckDLOPEN
  4237. CheckO_CLOEXEC
  4238. CheckOSS
  4239. CheckPTHREAD
  4240. CheckClockGettime
  4241. # Set up files for the misc library
  4242. if test x$enable_misc = xyes; then
  4243. SOURCES="$SOURCES $srcdir/src/misc/riscos/*.c"
  4244. have_misc=yes
  4245. fi
  4246. # Set up files for the video library
  4247. if test x$enable_video = xyes; then
  4248. AC_DEFINE(SDL_VIDEO_DRIVER_RISCOS, 1, [ ])
  4249. SOURCES="$SOURCES $srcdir/src/video/riscos/*.c"
  4250. have_video=yes
  4251. SUMMARY_video="${SUMMARY_video} riscos"
  4252. fi
  4253. # Set up files for the filesystem library
  4254. if test x$enable_filesystem = xyes; then
  4255. AC_DEFINE(SDL_FILESYSTEM_RISCOS, 1, [ ])
  4256. SOURCES="$SOURCES $srcdir/src/filesystem/riscos/*.c"
  4257. have_filesystem=yes
  4258. fi
  4259. # Set up files for the timer library
  4260. if test x$enable_timers = xyes; then
  4261. AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
  4262. SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  4263. have_timers=yes
  4264. fi
  4265. ;;
  4266. *-*-os2*)
  4267. ARCH=os2
  4268. if test "$build" != "$host"; then # cross-compiling
  4269. # Default cross-compile location
  4270. ac_default_prefix=/@unixroot/usr/local/cross-tools/$host
  4271. else
  4272. # Look for the location of the tools and install there
  4273. if test "$BUILD_PREFIX" != ""; then
  4274. ac_default_prefix=$BUILD_PREFIX
  4275. fi
  4276. fi
  4277. enable_static=no # disable static builds
  4278. EXTRA_CFLAGS="$EXTRA_CFLAGS -DBUILD_SDL -DOS2EMX_PLAIN_CHAR"
  4279. CheckOS2
  4280. CheckWerror
  4281. CheckDeclarationAfterStatement
  4282. CheckDummyVideo
  4283. CheckDiskAudio
  4284. CheckDummyAudio
  4285. CheckHIDAPI
  4286. # Set up the core platform files
  4287. SOURCES="$SOURCES $srcdir/src/core/os2/*.c"
  4288. if test x$enable_system_iconv = xyes; then
  4289. if test x$ac_cv_func_iconv != xyes -o x$ac_cv_header_iconv_h != xyes; then
  4290. SOURCES="$SOURCES $srcdir/src/core/os2/geniconv/*.c"
  4291. fi
  4292. fi
  4293. # Use the Unix locale APIs.
  4294. if test x$enable_locale = xyes; then
  4295. SOURCES="$SOURCES $srcdir/src/locale/unix/*.c"
  4296. have_locale=yes
  4297. fi
  4298. # Set up files for the video library
  4299. if test x$enable_video = xyes; then
  4300. AC_DEFINE(SDL_VIDEO_DRIVER_OS2, 1, [ ])
  4301. SOURCES="$SOURCES $srcdir/src/video/os2/*.c"
  4302. have_video=yes
  4303. SUMMARY_video="${SUMMARY_video} OS/2"
  4304. fi
  4305. # Set up files for the audio library
  4306. if test x$enable_audio = xyes; then
  4307. AC_DEFINE(SDL_AUDIO_DRIVER_OS2, 1, [ ])
  4308. SOURCES="$SOURCES $srcdir/src/audio/os2/*.c"
  4309. have_audio=yes
  4310. SUMMARY_audio="${SUMMARY_audio} OS/2"
  4311. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lmmpm2"
  4312. fi
  4313. # Set up files for the thread library
  4314. if test x$enable_threads = xyes; then
  4315. AC_DEFINE(SDL_THREAD_OS2, 1, [ ])
  4316. SOURCES="$SOURCES $srcdir/src/thread/os2/*.c"
  4317. SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  4318. have_threads=yes
  4319. fi
  4320. # Set up files for the timer library
  4321. if test x$enable_timers = xyes; then
  4322. AC_DEFINE(SDL_TIMER_OS2, 1, [ ])
  4323. SOURCES="$SOURCES $srcdir/src/timer/os2/*.c"
  4324. have_timers=yes
  4325. fi
  4326. # Set up files for the shared object loading library
  4327. if test x$enable_loadso = xyes; then
  4328. AC_DEFINE(SDL_LOADSO_OS2, 1, [ ])
  4329. SOURCES="$SOURCES $srcdir/src/loadso/os2/*.c"
  4330. have_loadso=yes
  4331. fi
  4332. # Set up files for the filesystem library
  4333. if test x$enable_filesystem = xyes; then
  4334. AC_DEFINE(SDL_FILESYSTEM_OS2, 1, [ ])
  4335. SOURCES="$SOURCES $srcdir/src/filesystem/os2/*.c"
  4336. have_filesystem=yes
  4337. fi
  4338. # Set up files for the joystick library
  4339. if test x$enable_joystick = xyes; then
  4340. AC_DEFINE(SDL_JOYSTICK_OS2, 1, [ ])
  4341. SOURCES="$SOURCES $srcdir/src/joystick/os2/*.c"
  4342. have_joystick=yes
  4343. fi
  4344. ;;
  4345. *)
  4346. AC_MSG_ERROR([
  4347. *** Unsupported host: Please add to configure.ac
  4348. ])
  4349. ;;
  4350. esac
  4351. dnl Permit use of virtual joystick APIs on any platform (subject to configure options)
  4352. CheckVirtualJoystick
  4353. # Check whether to install sdl2-config
  4354. AC_MSG_CHECKING(whether to install sdl2-config)
  4355. AC_ARG_ENABLE([sdl2-config],
  4356. [AS_HELP_STRING([--enable-sdl2-config],[Install sdl2-config [default=yes]])],
  4357. [case "${enableval}" in
  4358. yes) enable_sdl2_config="TRUE" ;;
  4359. no) enable_sdl2_config="FALSE" ;;
  4360. *) AC_MSG_ERROR([bad value '${enableval}' for --enable-sdl2-config]) ;;
  4361. esac], [enable_sdl2_config="TRUE"])
  4362. if test "$enable_sdl2_config" = "TRUE"; then
  4363. AC_MSG_RESULT(yes)
  4364. else
  4365. AC_MSG_RESULT(no)
  4366. fi
  4367. AC_SUBST([INSTALL_SDL2_CONFIG], [$enable_sdl2_config])
  4368. AC_ARG_ENABLE([vendor-info],
  4369. [AS_HELP_STRING([--enable-vendor-info=STRING], [Add vendor info to SDL_REVISION])],
  4370. [enable_vendor_info="$enableval"], [enable_vendor_info=])
  4371. AS_IF([test "$enable_vendor_info" = no], [enable_vendor_info=])
  4372. AC_SUBST([SDL_VENDOR_INFO], [$enable_vendor_info])
  4373. # Verify that we have all the platform specific files we need
  4374. if test x$have_audio != xyes; then
  4375. if test x$enable_audio = xyes; then
  4376. AC_DEFINE(SDL_AUDIO_DRIVER_DUMMY, 1, [ ])
  4377. fi
  4378. SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c"
  4379. fi
  4380. if test x$have_video != xyes; then
  4381. if test x$enable_video = xyes; then
  4382. AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY, 1, [ ])
  4383. fi
  4384. SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
  4385. fi
  4386. if test x$have_misc != xyes; then
  4387. if test x$enable_misc = xyes; then
  4388. AC_DEFINE(SDL_MISC_DUMMY, 1, [ ])
  4389. fi
  4390. SOURCES="$SOURCES $srcdir/src/misc/dummy/*.c"
  4391. fi
  4392. if test x$have_locale != xyes; then
  4393. if test x$enable_locale = xyes; then
  4394. AC_DEFINE(SDL_LOCALE_DUMMY, 1, [ ])
  4395. fi
  4396. SOURCES="$SOURCES $srcdir/src/locale/dummy/*.c"
  4397. fi
  4398. if test x$have_joystick != xyes; then
  4399. if test x$enable_joystick = xyes; then
  4400. AC_DEFINE(SDL_JOYSTICK_DUMMY, 1, [ ])
  4401. fi
  4402. SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
  4403. fi
  4404. if test x$have_haptic != xyes; then
  4405. if test x$enable_haptic = xyes; then
  4406. AC_DEFINE(SDL_HAPTIC_DUMMY, 1, [ ])
  4407. fi
  4408. SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c"
  4409. fi
  4410. if test x$have_sensor != xyes; then
  4411. if test x$enable_sensor = xyes; then
  4412. AC_DEFINE(SDL_SENSOR_DUMMY, 1, [ ])
  4413. fi
  4414. SOURCES="$SOURCES $srcdir/src/sensor/dummy/*.c"
  4415. fi
  4416. if test x$have_threads != xyes; then
  4417. if test x$enable_threads = xyes; then
  4418. AC_DEFINE(SDL_THREADS_DISABLED, 1, [ ])
  4419. fi
  4420. SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
  4421. fi
  4422. if test x$have_timers != xyes; then
  4423. if test x$enable_timers = xyes; then
  4424. AC_DEFINE(SDL_TIMER_DUMMY, 1, [ ])
  4425. fi
  4426. SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
  4427. fi
  4428. if test x$have_filesystem != xyes; then
  4429. if test x$enable_filesystem = xyes; then
  4430. AC_DEFINE(SDL_FILESYSTEM_DUMMY, 1, [ ])
  4431. fi
  4432. SOURCES="$SOURCES $srcdir/src/filesystem/dummy/*.c"
  4433. fi
  4434. if test x$have_loadso != xyes; then
  4435. if test x$enable_loadso = xyes; then
  4436. AC_DEFINE(SDL_LOADSO_DUMMY, 1, [ ])
  4437. fi
  4438. SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
  4439. fi
  4440. if test x$SDLMAIN_SOURCES = x; then
  4441. SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c"
  4442. fi
  4443. SDLTEST_SOURCES="$srcdir/src/test/*.c"
  4444. if test x$video_wayland = xyes; then
  4445. WAYLAND_PROTOCOLS=`cd $srcdir/wayland-protocols ; for p in *.xml ; do printf '%s' "\$p" |sed 's,\\.xml\$, ,g' ; done`
  4446. WAYLAND_PROTOCOLS_SOURCES=`for p in $WAYLAND_PROTOCOLS ; do printf '%s' "\\$(gen)/\$p-protocol.c " ; done`
  4447. WAYLAND_PROTOCOLS_HEADERS=`for p in $WAYLAND_PROTOCOLS ; do printf '%s' "\\$(gen)/\$p-client-protocol.h " ; done`
  4448. GEN_SOURCES="$GEN_SOURCES $WAYLAND_PROTOCOLS_SOURCES"
  4449. GEN_HEADERS="$GEN_HEADERS $WAYLAND_PROTOCOLS_HEADERS"
  4450. WAYLAND_PROTOCOLS_DEPENDS=`for p in $WAYLAND_PROTOCOLS ; do\
  4451. echo ;\
  4452. printf '%s\n' "\\$(gen)/\$p-client-protocol.h: \\$(srcdir)/wayland-protocols/\$p.xml" ;\
  4453. printf '%s\n' " @\\$(SHELL) \\$(auxdir)/mkinstalldirs \\$(gen)" ;\
  4454. printf '%s\n' " \\$(RUN_CMD_GEN)\\$(WAYLAND_SCANNER) client-header \\$< \\$@" ;\
  4455. echo ;\
  4456. printf '%s\n' "\\$(gen)/\$p-protocol.c: \\$(srcdir)/wayland-protocols/\$p.xml" ;\
  4457. printf '%s\n' " @\\$(SHELL) \\$(auxdir)/mkinstalldirs \\$(gen)" ;\
  4458. printf '%s\n' " \\$(RUN_CMD_GEN)\\$(WAYLAND_SCANNER) \\$(WAYLAND_SCANNER_CODE_MODE) \\$< \\$@" ;\
  4459. echo ;\
  4460. printf '%s\n' "\\$(objects)/\$p-protocol.lo: \\$(gen)/\$p-protocol.c \\$(gen)/\$p-client-protocol.h" ;\
  4461. printf '%s\n' " @\\$(SHELL) \\$(auxdir)/mkinstalldirs \\$(objects)" ;\
  4462. printf '%s\n' " \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@" ;\
  4463. done ;\
  4464. echo ;\
  4465. for s in $WAYLAND_SOURCES ; do printf '%s' "\$s:" ; printf ' \$(gen)/%s-client-protocol.h' $WAYLAND_PROTOCOLS ; echo ; done ; echo`
  4466. fi
  4467. OBJECTS=`echo $SOURCES`
  4468. DEPENDS=`echo $SOURCES | tr ' ' '\n'`
  4469. for EXT in asm cc m c S; do
  4470. OBJECTS=`echo "$OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.'$EXT',$(objects)/\1.lo,g'`
  4471. DEPENDS=`echo "$DEPENDS" | sed "s,^\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.$EXT\\$,\\\\
  4472. \\$(objects)/\\2.lo: \\1/\\2.$EXT \\$(objects)/.created\\\\
  4473. \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
  4474. done
  4475. GEN_OBJECTS=`echo "$GEN_SOURCES" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
  4476. VERSION_OBJECTS=`echo $VERSION_SOURCES`
  4477. VERSION_DEPENDS=`echo $VERSION_SOURCES`
  4478. VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.lo,g'`
  4479. VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.rc,\\\\
  4480. \\$(objects)/\\2.lo: \\1/\\2.rc \\$(objects)/.created\\\\
  4481. \\$(RUN_CMD_RC)\\$(LIBTOOL) --mode=compile --tag=RC \\$(RC) -i \\$< -o \\$@,g"`
  4482. SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES`
  4483. SDLMAIN_DEPENDS=`echo $SDLMAIN_SOURCES`
  4484. SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
  4485. SDLMAIN_DEPENDS=`echo "$SDLMAIN_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\
  4486. \\$(objects)/\\2.lo: \\1/\\2.c \\$(objects)/.created\\\\
  4487. \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
  4488. SDLTEST_OBJECTS=`echo $SDLTEST_SOURCES`
  4489. SDLTEST_DEPENDS=`echo $SDLTEST_SOURCES`
  4490. SDLTEST_OBJECTS=`echo "$SDLTEST_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'`
  4491. SDLTEST_DEPENDS=`echo "$SDLTEST_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\
  4492. \\$(objects)/\\2.lo: \\1/\\2.c \\$(objects)/.created\\\\
  4493. \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
  4494. # Set runtime shared library paths as needed
  4495. if test "x$enable_rpath" = "xyes" -a "x$enable_shared" = "xyes"; then
  4496. if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = linux -o $ARCH = netbsd; then
  4497. SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}"
  4498. AC_MSG_CHECKING(for linker option --enable-new-dtags)
  4499. have_enable_new_dtags=no
  4500. save_LDFLAGS="$LDFLAGS"
  4501. LDFLAGS="$LDFLAGS -Wl,--enable-new-dtags"
  4502. AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [
  4503. have_enable_new_dtags=yes
  4504. SDL_RLD_FLAGS="$SDL_RLD_FLAGS -Wl,--enable-new-dtags"
  4505. ],[])
  4506. LDFLAGS="$save_LDFLAGS"
  4507. AC_MSG_RESULT($have_enable_new_dtags)
  4508. fi
  4509. if test $ARCH = solaris; then
  4510. SDL_RLD_FLAGS="-R\${libdir}"
  4511. fi
  4512. else
  4513. SDL_RLD_FLAGS=""
  4514. fi
  4515. SDL_STATIC_LIBS="$EXTRA_LDFLAGS"
  4516. dnl Calculate the location of the prefix, relative to the cmake folder
  4517. dnl Calculate the location of the prefix, relative to bindir
  4518. pkg_cmakedir='$libdir/cmake/SDL2'
  4519. AX_COMPUTE_RELATIVE_PATHS([pkg_cmakedir:prefix:cmake_prefix_relpath bindir:prefix:bin_prefix_relpath])
  4520. AC_SUBST([cmake_prefix_relpath])
  4521. AC_SUBST([bin_prefix_relpath])
  4522. dnl Expand the cflags and libraries needed by apps using SDL
  4523. AC_SUBST(SDL_CFLAGS)
  4524. AC_SUBST(SDL_LIBS)
  4525. AC_SUBST(SDL_STATIC_LIBS)
  4526. AC_SUBST(SDL_RLD_FLAGS)
  4527. PKGCONFIG_DEPENDS=""
  4528. AC_SUBST(PKGCONFIG_DEPENDS)
  4529. if test x$enable_shared = xyes; then
  4530. PKGCONFIG_LIBS_PRIV="
  4531. Libs.private:"
  4532. ENABLE_SHARED_TRUE=
  4533. ENABLE_SHARED_FALSE="#"
  4534. else
  4535. PKGCONFIG_LIBS_PRIV=
  4536. ENABLE_SHARED_TRUE="#"
  4537. ENABLE_SHARED_FALSE=
  4538. fi
  4539. if test x$enable_static = xyes; then
  4540. ENABLE_STATIC_TRUE=
  4541. ENABLE_STATIC_FALSE="#"
  4542. else
  4543. ENABLE_STATIC_TRUE="#"
  4544. ENABLE_STATIC_FALSE=
  4545. fi
  4546. AC_SUBST(PKGCONFIG_LIBS_PRIV)
  4547. AC_SUBST(ENABLE_SHARED_TRUE)
  4548. AC_SUBST(ENABLE_SHARED_FALSE)
  4549. AC_SUBST(ENABLE_STATIC_TRUE)
  4550. AC_SUBST(ENABLE_STATIC_FALSE)
  4551. dnl Expand the sources and objects needed to build the library
  4552. AC_SUBST(ac_aux_dir)
  4553. AC_SUBST(INCLUDE)
  4554. AC_SUBST(OBJECTS)
  4555. AC_SUBST(GEN_HEADERS)
  4556. AC_SUBST(GEN_OBJECTS)
  4557. AC_SUBST(VERSION_OBJECTS)
  4558. AC_SUBST(SDLMAIN_OBJECTS)
  4559. AC_SUBST(SDLTEST_OBJECTS)
  4560. AC_SUBST(BUILD_CFLAGS)
  4561. AC_SUBST(EXTRA_CFLAGS)
  4562. AC_SUBST(BUILD_LDFLAGS)
  4563. AC_SUBST(EXTRA_LDFLAGS)
  4564. AC_SUBST(WAYLAND_SCANNER)
  4565. AC_SUBST(WAYLAND_SCANNER_CODE_MODE)
  4566. cat >Makefile.rules <<__EOF__
  4567. # Build rules for objects
  4568. -include \$(OBJECTS:.lo=.d)
  4569. # Special dependency for SDL.c, since it depends on SDL_revision.h
  4570. $srcdir/src/SDL.c: update-revision
  4571. $DEPENDS
  4572. $VERSION_DEPENDS
  4573. $SDLMAIN_DEPENDS
  4574. $SDLTEST_DEPENDS
  4575. $WAYLAND_PROTOCOLS_DEPENDS
  4576. __EOF__
  4577. AC_CONFIG_FILES([
  4578. Makefile:Makefile.in:Makefile.rules sdl2-config sdl2-config.cmake sdl2-config-version.cmake SDL2.spec sdl2.pc
  4579. ])
  4580. AC_CONFIG_COMMANDS([sdl2_config],[chmod a+x sdl2-config])
  4581. SUMMARY="SDL2 Configure Summary:\n"
  4582. if test x$enable_shared = xyes; then
  4583. SUMMARY="${SUMMARY}Building Shared Libraries\n"
  4584. fi
  4585. if test x$enable_static = xyes; then
  4586. SUMMARY="${SUMMARY}Building Static Libraries\n"
  4587. fi
  4588. SUMMARY="${SUMMARY}Enabled modules :${SUMMARY_modules}\n"
  4589. SUMMARY="${SUMMARY}Assembly Math :${SUMMARY_math}\n"
  4590. SUMMARY="${SUMMARY}Audio drivers :${SUMMARY_audio}\n"
  4591. SUMMARY="${SUMMARY}Video drivers :${SUMMARY_video}\n"
  4592. if test x$have_x = xyes; then
  4593. SUMMARY="${SUMMARY}X11 libraries :${SUMMARY_video_x11}\n"
  4594. fi
  4595. SUMMARY="${SUMMARY}Input drivers :${SUMMARY_input}\n"
  4596. if test x$have_joystick_virtual = xyes; then
  4597. SUMMARY="${SUMMARY}Enable virtual joystick APIs : YES\n"
  4598. else
  4599. SUMMARY="${SUMMARY}Enable virtual joystick APIs : NO\n"
  4600. fi
  4601. if test x$have_samplerate_h_hdr = xyes; then
  4602. SUMMARY="${SUMMARY}Using libsamplerate : YES\n"
  4603. else
  4604. SUMMARY="${SUMMARY}Using libsamplerate : NO\n"
  4605. fi
  4606. if test x$have_libudev_h_hdr = xyes; then
  4607. SUMMARY="${SUMMARY}Using libudev : YES\n"
  4608. else
  4609. SUMMARY="${SUMMARY}Using libudev : NO\n"
  4610. fi
  4611. if test x$have_dbus_dbus_h_hdr = xyes; then
  4612. SUMMARY="${SUMMARY}Using dbus : YES\n"
  4613. else
  4614. SUMMARY="${SUMMARY}Using dbus : NO\n"
  4615. fi
  4616. if test x$enable_ime = xyes; then
  4617. SUMMARY="${SUMMARY}Using ime : YES\n"
  4618. else
  4619. SUMMARY="${SUMMARY}Using ime : NO\n"
  4620. fi
  4621. if test x$have_ibus_ibus_h_hdr = xyes; then
  4622. SUMMARY="${SUMMARY}Using ibus : YES\n"
  4623. else
  4624. SUMMARY="${SUMMARY}Using ibus : NO\n"
  4625. fi
  4626. if test x$have_fcitx = xyes; then
  4627. SUMMARY="${SUMMARY}Using fcitx : YES\n"
  4628. else
  4629. SUMMARY="${SUMMARY}Using fcitx : NO\n"
  4630. fi
  4631. if test x$WARN_ABOUT_ARM_SIMD_ASM_MIT = xyes; then
  4632. SUMMARY="${SUMMARY}\nSDL is being built with ARM SIMD optimizations, which\n"
  4633. SUMMARY="${SUMMARY}uses code licensed under the MIT license. If this is a\n"
  4634. SUMMARY="${SUMMARY}problem, please disable that code by rerunning the\n"
  4635. SUMMARY="${SUMMARY}configure script with:\n"
  4636. SUMMARY="${SUMMARY}\n --disable-arm-simd\n"
  4637. fi
  4638. if test x$WARN_ABOUT_ARM_NEON_ASM_MIT = xyes; then
  4639. SUMMARY="${SUMMARY}\nSDL is being built with ARM NEON optimizations, which\n"
  4640. SUMMARY="${SUMMARY}uses code licensed under the MIT license. If this is a\n"
  4641. SUMMARY="${SUMMARY}problem, please disable that code by rerunning the\n"
  4642. SUMMARY="${SUMMARY}configure script with:\n"
  4643. SUMMARY="${SUMMARY}\n --disable-arm-neon\n"
  4644. fi
  4645. AC_CONFIG_COMMANDS([summary], [printf "$SUMMARY"], [SUMMARY="$SUMMARY"])
  4646. AC_OUTPUT