configure.ac 162 KB

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