configure.in 108 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037
  1. dnl Process this file with autoconf to produce a configure script.
  2. AC_INIT(README.txt)
  3. AC_CONFIG_HEADER(include/SDL_config.h)
  4. AC_CONFIG_AUX_DIR(build-scripts)
  5. AC_CONFIG_MACRO_DIR([acinclude])
  6. dnl Save the CFLAGS to see whether they were passed in or generated
  7. orig_CFLAGS="$CFLAGS"
  8. dnl Set various version strings - taken gratefully from the GTk sources
  9. #
  10. # Making releases:
  11. # Edit include/SDL_version.h and change the version, then:
  12. # SDL_MICRO_VERSION += 1;
  13. # SDL_INTERFACE_AGE += 1;
  14. # SDL_BINARY_AGE += 1;
  15. # if any functions have been added, set SDL_INTERFACE_AGE to 0.
  16. # if backwards compatibility has been broken,
  17. # set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0.
  18. #
  19. SDL_MAJOR_VERSION=2
  20. SDL_MINOR_VERSION=0
  21. SDL_MICRO_VERSION=1
  22. SDL_INTERFACE_AGE=0
  23. SDL_BINARY_AGE=1
  24. SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION
  25. AC_SUBST(SDL_MAJOR_VERSION)
  26. AC_SUBST(SDL_MINOR_VERSION)
  27. AC_SUBST(SDL_MICRO_VERSION)
  28. AC_SUBST(SDL_INTERFACE_AGE)
  29. AC_SUBST(SDL_BINARY_AGE)
  30. AC_SUBST(SDL_VERSION)
  31. # libtool versioning
  32. LT_INIT([win32-dll])
  33. LT_RELEASE=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION
  34. LT_CURRENT=`expr $SDL_MICRO_VERSION - $SDL_INTERFACE_AGE`
  35. LT_REVISION=$SDL_INTERFACE_AGE
  36. LT_AGE=`expr $SDL_BINARY_AGE - $SDL_INTERFACE_AGE`
  37. m4_pattern_allow([^LT_])
  38. AC_SUBST(LT_RELEASE)
  39. AC_SUBST(LT_CURRENT)
  40. AC_SUBST(LT_REVISION)
  41. AC_SUBST(LT_AGE)
  42. dnl Detect the canonical build and host environments
  43. dnl AC_CANONICAL_HOST
  44. dnl Check for tools
  45. AC_PROG_LIBTOOL
  46. AC_PROG_CC
  47. AC_PROG_CXX
  48. AC_PROG_INSTALL
  49. AC_PROG_MAKE_SET
  50. AC_CHECK_TOOL(WINDRES, [windres], [:])
  51. dnl Make sure that srcdir is a full pathname
  52. case "$host" in
  53. *-*-mingw32*)
  54. # Except on msys, where make can't handle full pathnames (bug 1972)
  55. ;;
  56. *)
  57. srcdir=`cd $srcdir && pwd`
  58. ;;
  59. esac
  60. dnl Set up the compiler and linker flags
  61. INCLUDE="-I$srcdir/include"
  62. if test x$srcdir != x.; then
  63. INCLUDE="-Iinclude $INCLUDE"
  64. elif test -d .hg; then
  65. AC_MSG_ERROR([
  66. *** When building from Mercurial you should configure and build in a
  67. separate directory so you don't clobber SDL_config.h, SDL_revision.h
  68. ])
  69. fi
  70. BASE_CFLAGS=""
  71. BASE_LDFLAGS=""
  72. case "$host" in
  73. *-*-cygwin*)
  74. # We build SDL on cygwin without the UNIX emulation layer
  75. save_CFLAGS="$CFLAGS"
  76. have_no_cygwin=no
  77. AC_MSG_CHECKING(for GCC -mno-cygwin option)
  78. CFLAGS="$save_CFLAGS -mno-cygwin"
  79. AC_TRY_COMPILE([
  80. ],[
  81. ],[
  82. have_no_cygwin=yes
  83. ])
  84. AC_MSG_RESULT($have_no_cygwin)
  85. CFLAGS="$save_CFLAGS"
  86. if test x$have_no_cygwin = xyes; then
  87. BASE_CFLAGS="-mno-cygwin"
  88. BASE_LDFLAGS="-mno-cygwin"
  89. fi
  90. BASE_CFLAGS="$BASE_CFLAGS -I/usr/include/mingw"
  91. ;;
  92. esac
  93. # Uncomment the following line if you want to force SDL and applications
  94. # built with it to be compiled for a particular architecture.
  95. #AX_GCC_ARCHFLAG([no], [BASE_CFLAGS="$BASE_CFLAGS $ax_cv_gcc_archflag]")
  96. BUILD_CFLAGS="$CFLAGS $CPPFLAGS -DUSING_GENERATED_CONFIG_H"
  97. # The default optimization for SDL is -O3 (Bug #31)
  98. if test "x$orig_CFLAGS" = x; then
  99. BUILD_CFLAGS=`echo $BUILD_CFLAGS | sed 's/-O2/-O3/'`
  100. fi
  101. EXTRA_CFLAGS="$INCLUDE $BASE_CFLAGS"
  102. BUILD_LDFLAGS="$LDFLAGS"
  103. EXTRA_LDFLAGS="$BASE_LDFLAGS"
  104. ## These are common directories to find software packages
  105. #for path in /usr/freeware /usr/pkg /usr/X11R6 /usr/local; do
  106. # if test -d $path/include; then
  107. # EXTRA_CFLAGS="$EXTRA_CFLAGS -I$path/include"
  108. # fi
  109. # if test -d $path/lib; then
  110. # EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L$path/lib"
  111. # fi
  112. #done
  113. SDL_CFLAGS="$BASE_CFLAGS"
  114. SDL_LIBS="-lSDL2 $BASE_LDFLAGS"
  115. CPPFLAGS="$CPPFLAGS $EXTRA_CFLAGS"
  116. CFLAGS="$CFLAGS $EXTRA_CFLAGS"
  117. LDFLAGS="$LDFLAGS $EXTRA_LDFLAGS"
  118. dnl set this to use on systems that use lib64 instead of lib
  119. base_libdir=`echo \${libdir} | sed 's/.*\/\(.*\)/\1/; q'`
  120. dnl Function to find a library in the compiler search path
  121. find_lib()
  122. {
  123. gcc_bin_path=[`$CC -print-search-dirs 2>/dev/null | fgrep programs: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
  124. gcc_lib_path=[`$CC -print-search-dirs 2>/dev/null | fgrep libraries: | sed 's/[^=]*=\(.*\)/\1/' | sed 's/:/ /g'`]
  125. env_lib_path=[`echo $LIBS $LDFLAGS $* | sed 's/-L[ ]*//g'`]
  126. if test "$cross_compiling" = yes; then
  127. host_lib_path=""
  128. else
  129. host_lib_path="/usr/$base_libdir /usr/local/$base_libdir"
  130. fi
  131. for path in $gcc_bin_path $gcc_lib_path $env_lib_path $host_lib_path; do
  132. lib=[`ls -- $path/$1 2>/dev/null | sed -e '/\.so\..*\./d' -e 's,.*/,,' | sort | tail -1`]
  133. if test x$lib != x; then
  134. echo $lib
  135. return
  136. fi
  137. done
  138. }
  139. dnl Check for compiler characteristics
  140. AC_C_CONST
  141. AC_C_INLINE
  142. AC_C_VOLATILE
  143. dnl See whether we want assertions for debugging/sanity checking SDL itself.
  144. AC_ARG_ENABLE(assertions,
  145. AC_HELP_STRING([--enable-assertions],
  146. [Enable internal sanity checks (auto/disabled/release/enabled/paranoid) [[default=auto]]]),
  147. , enable_assertions=auto)
  148. case "$enable_assertions" in
  149. auto) # Use optimization settings to determine assertion level
  150. ;;
  151. disabled)
  152. AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 0, [ ])
  153. ;;
  154. release)
  155. AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 1, [ ])
  156. ;;
  157. enabled)
  158. AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 2, [ ])
  159. ;;
  160. paranoid)
  161. AC_DEFINE(SDL_DEFAULT_ASSERT_LEVEL, 3, [ ])
  162. ;;
  163. *)
  164. AC_MSG_ERROR([*** unknown assertion level. stop.])
  165. ;;
  166. esac
  167. dnl See whether we can use gcc style dependency tracking
  168. AC_ARG_ENABLE(dependency-tracking,
  169. AC_HELP_STRING([--enable-dependency-tracking],
  170. [Use gcc -MMD -MT dependency tracking [[default=yes]]]),
  171. , enable_dependency_tracking=yes)
  172. if test x$enable_dependency_tracking = xyes; then
  173. have_gcc_mmd_mt=no
  174. AC_MSG_CHECKING(for GCC -MMD -MT option)
  175. AC_TRY_COMPILE([
  176. #if !defined(__GNUC__) || __GNUC__ < 3
  177. #error Dependency tracking requires GCC 3.0 or newer
  178. #endif
  179. ],[
  180. ],[
  181. have_gcc_mmd_mt=yes
  182. ])
  183. AC_MSG_RESULT($have_gcc_mmd_mt)
  184. if test x$have_gcc_mmd_mt = xyes; then
  185. DEPENDENCY_TRACKING_OPTIONS="-MMD -MT \$@"
  186. fi
  187. fi
  188. AC_MSG_CHECKING(for linker option --no-undefined)
  189. have_no_undefined=no
  190. case "$host" in
  191. dnl Skip this on platforms where it is just simply busted.
  192. *-*-openbsd*)
  193. ;;
  194. *)
  195. save_LDFLAGS="$LDFLAGS"
  196. LDFLAGS="$LDFLAGS -Wl,--no-undefined"
  197. AC_TRY_LINK([
  198. ],[
  199. ],[
  200. have_no_undefined=yes
  201. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,--no-undefined"
  202. ])
  203. LDFLAGS="$save_LDFLAGS"
  204. ;;
  205. esac
  206. AC_MSG_RESULT($have_no_undefined)
  207. dnl See whether we are allowed to use the system C library
  208. AC_ARG_ENABLE(libc,
  209. AC_HELP_STRING([--enable-libc], [Use the system C library [[default=yes]]]),
  210. , enable_libc=yes)
  211. if test x$enable_libc = xyes; then
  212. AC_DEFINE(HAVE_LIBC, 1, [ ])
  213. dnl Check for C library headers
  214. AC_HEADER_STDC
  215. AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h)
  216. dnl Check for typedefs, structures, etc.
  217. AC_TYPE_SIZE_T
  218. dnl Check for defines
  219. AC_CHECK_DEFINE(M_PI, math.h)
  220. dnl Checks for library functions.
  221. case "$host" in
  222. *-*-cygwin* | *-*-mingw32*)
  223. ;;
  224. *)
  225. AC_FUNC_ALLOCA
  226. ;;
  227. esac
  228. AC_FUNC_MEMCMP
  229. if test x$ac_cv_func_memcmp_working = xyes; then
  230. AC_DEFINE(HAVE_MEMCMP, 1, [ ])
  231. fi
  232. AC_FUNC_STRTOD
  233. if test x$ac_cv_func_strtod = xyes; then
  234. AC_DEFINE(HAVE_STRTOD, 1, [ ])
  235. fi
  236. AC_CHECK_FUNC(mprotect,
  237. AC_TRY_COMPILE([
  238. #include <sys/types.h>
  239. #include <sys/mman.h>
  240. ],[
  241. ],[
  242. AC_DEFINE(HAVE_MPROTECT, 1, [ ])
  243. ]),
  244. )
  245. AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname)
  246. AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"])
  247. AC_CHECK_FUNCS(atan atan2 acos asin ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt)
  248. AC_CHECK_LIB(iconv, iconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"])
  249. AC_CHECK_FUNCS(iconv)
  250. AC_CHECK_MEMBER(struct sigaction.sa_sigaction,[AC_DEFINE(HAVE_SA_SIGACTION)], ,[#include <signal.h>])
  251. fi
  252. dnl AC_CHECK_SIZEOF(void*)
  253. dnl See whether we can use gcc atomic operations on this architecture
  254. AC_ARG_ENABLE(gcc-atomics,
  255. AC_HELP_STRING([--enable-gcc-atomics],
  256. [Use gcc builtin atomics [[default=yes]]]),
  257. , enable_gcc_atomics=yes)
  258. if test x$enable_gcc_atomics = xyes; then
  259. have_gcc_atomics=no
  260. AC_MSG_CHECKING(for GCC builtin atomic operations)
  261. AC_TRY_LINK([
  262. ],[
  263. int a;
  264. void *x, *y, *z;
  265. __sync_lock_test_and_set(&a, 4);
  266. __sync_lock_test_and_set(&x, y);
  267. __sync_fetch_and_add(&a, 1);
  268. __sync_bool_compare_and_swap(&a, 5, 10);
  269. __sync_bool_compare_and_swap(&x, y, z);
  270. ],[
  271. have_gcc_atomics=yes
  272. ])
  273. AC_MSG_RESULT($have_gcc_atomics)
  274. if test x$have_gcc_atomics = xyes; then
  275. AC_DEFINE(HAVE_GCC_ATOMICS, 1, [ ])
  276. else
  277. # See if we have the minimum operation needed for GCC atomics
  278. AC_TRY_LINK([
  279. ],[
  280. int a;
  281. __sync_lock_test_and_set(&a, 1);
  282. __sync_lock_release(&a);
  283. ],[
  284. have_gcc_sync_lock_test_and_set=yes
  285. ])
  286. if test x$have_gcc_sync_lock_test_and_set = xyes; then
  287. AC_DEFINE(HAVE_GCC_SYNC_LOCK_TEST_AND_SET, 1, [ ])
  288. fi
  289. fi
  290. fi
  291. # Standard C sources
  292. SOURCES="$SOURCES $srcdir/src/*.c"
  293. SOURCES="$SOURCES $srcdir/src/atomic/*.c"
  294. SOURCES="$SOURCES $srcdir/src/audio/*.c"
  295. SOURCES="$SOURCES $srcdir/src/cpuinfo/*.c"
  296. SOURCES="$SOURCES $srcdir/src/events/*.c"
  297. SOURCES="$SOURCES $srcdir/src/file/*.c"
  298. SOURCES="$SOURCES $srcdir/src/haptic/*.c"
  299. SOURCES="$SOURCES $srcdir/src/joystick/*.c"
  300. SOURCES="$SOURCES $srcdir/src/libm/*.c"
  301. SOURCES="$SOURCES $srcdir/src/power/*.c"
  302. #SOURCES="$SOURCES $srcdir/src/filesystem/*.c"
  303. SOURCES="$SOURCES $srcdir/src/render/*.c"
  304. SOURCES="$SOURCES $srcdir/src/render/*/*.c"
  305. SOURCES="$SOURCES $srcdir/src/stdlib/*.c"
  306. SOURCES="$SOURCES $srcdir/src/thread/*.c"
  307. SOURCES="$SOURCES $srcdir/src/timer/*.c"
  308. SOURCES="$SOURCES $srcdir/src/video/*.c"
  309. dnl Enable/disable various subsystems of the SDL library
  310. AC_ARG_ENABLE(atomic,
  311. AC_HELP_STRING([--enable-atomic], [Enable the atomic operations subsystem [[default=yes]]]),
  312. , enable_atomic=yes)
  313. if test x$enable_atomic != xyes; then
  314. AC_DEFINE(SDL_ATOMIC_DISABLED, 1, [ ])
  315. fi
  316. AC_ARG_ENABLE(audio,
  317. AC_HELP_STRING([--enable-audio], [Enable the audio subsystem [[default=yes]]]),
  318. , enable_audio=yes)
  319. if test x$enable_audio != xyes; then
  320. AC_DEFINE(SDL_AUDIO_DISABLED, 1, [ ])
  321. fi
  322. AC_ARG_ENABLE(video,
  323. AC_HELP_STRING([--enable-video], [Enable the video subsystem [[default=yes]]]),
  324. , enable_video=yes)
  325. if test x$enable_video != xyes; then
  326. AC_DEFINE(SDL_VIDEO_DISABLED, 1, [ ])
  327. fi
  328. AC_ARG_ENABLE(render,
  329. AC_HELP_STRING([--enable-render], [Enable the render subsystem [[default=yes]]]),
  330. , enable_render=yes)
  331. if test x$enable_render != xyes; then
  332. AC_DEFINE(SDL_RENDER_DISABLED, 1, [ ])
  333. fi
  334. AC_ARG_ENABLE(events,
  335. AC_HELP_STRING([--enable-events], [Enable the events subsystem [[default=yes]]]),
  336. , enable_events=yes)
  337. if test x$enable_events != xyes; then
  338. AC_DEFINE(SDL_EVENTS_DISABLED, 1, [ ])
  339. fi
  340. AC_ARG_ENABLE(joystick,
  341. AC_HELP_STRING([--enable-joystick], [Enable the joystick subsystem [[default=yes]]]),
  342. , enable_joystick=yes)
  343. if test x$enable_joystick != xyes; then
  344. AC_DEFINE(SDL_JOYSTICK_DISABLED, 1, [ ])
  345. fi
  346. AC_ARG_ENABLE(haptic,
  347. AC_HELP_STRING([--enable-haptic], [Enable the haptic (force feedback) subsystem [[default=yes]]]),
  348. , enable_haptic=yes)
  349. if test x$enable_haptic != xyes; then
  350. AC_DEFINE(SDL_HAPTIC_DISABLED, 1, [ ])
  351. fi
  352. AC_ARG_ENABLE(power,
  353. AC_HELP_STRING([--enable-power], [Enable the power subsystem [[default=yes]]]),
  354. , enable_power=yes)
  355. if test x$enable_power != xyes; then
  356. AC_DEFINE(SDL_POWER_DISABLED, 1, [ ])
  357. fi
  358. AC_ARG_ENABLE(filesystem,
  359. AC_HELP_STRING([--enable-filesystem], [Enable the filesystem subsystem [[default=yes]]]),
  360. , enable_filesystem=yes)
  361. if test x$enable_filesystem != xyes; then
  362. AC_DEFINE(SDL_FILESYSTEM_DISABLED, 1, [ ])
  363. fi
  364. AC_ARG_ENABLE(threads,
  365. AC_HELP_STRING([--enable-threads], [Enable the threading subsystem [[default=yes]]]),
  366. , enable_threads=yes)
  367. if test x$enable_threads != xyes; then
  368. AC_DEFINE(SDL_THREADS_DISABLED, 1, [ ])
  369. fi
  370. AC_ARG_ENABLE(timers,
  371. AC_HELP_STRING([--enable-timers], [Enable the timer subsystem [[default=yes]]]),
  372. , enable_timers=yes)
  373. if test x$enable_timers != xyes; then
  374. AC_DEFINE(SDL_TIMERS_DISABLED, 1, [ ])
  375. fi
  376. AC_ARG_ENABLE(file,
  377. AC_HELP_STRING([--enable-file], [Enable the file subsystem [[default=yes]]]),
  378. , enable_file=yes)
  379. if test x$enable_file != xyes; then
  380. AC_DEFINE(SDL_FILE_DISABLED, 1, [ ])
  381. fi
  382. AC_ARG_ENABLE(loadso,
  383. AC_HELP_STRING([--enable-loadso], [Enable the shared object loading subsystem [[default=yes]]]),
  384. , enable_loadso=yes)
  385. if test x$enable_loadso != xyes; then
  386. AC_DEFINE(SDL_LOADSO_DISABLED, 1, [ ])
  387. fi
  388. AC_ARG_ENABLE(cpuinfo,
  389. AC_HELP_STRING([--enable-cpuinfo], [Enable the cpuinfo subsystem [[default=yes]]]),
  390. , enable_cpuinfo=yes)
  391. if test x$enable_cpuinfo != xyes; then
  392. AC_DEFINE(SDL_CPUINFO_DISABLED, 1, [ ])
  393. fi
  394. AC_ARG_ENABLE(atomic,
  395. AC_HELP_STRING([--enable-atomic], [Enable the atomic operations [[default=yes]]]),
  396. , enable_atomic=yes)
  397. if test x$enable_atomic != xyes; then
  398. AC_DEFINE(SDL_ATOMIC_DISABLED, 1, [ ])
  399. fi
  400. AC_ARG_ENABLE(assembly,
  401. AC_HELP_STRING([--enable-assembly], [Enable assembly routines [[default=yes]]]),
  402. , enable_assembly=yes)
  403. if test x$enable_assembly = xyes; then
  404. AC_DEFINE(SDL_ASSEMBLY_ROUTINES, 1, [ ])
  405. # Make sure that we don't generate floating point code that would
  406. # cause illegal instruction exceptions on older processors
  407. case "$host" in
  408. *-*-darwin*)
  409. # Don't need to worry about Apple hardware, it's all SSE capable
  410. default_ssemath=yes
  411. ;;
  412. *64-*-*)
  413. # x86 64-bit architectures all have SSE instructions
  414. default_ssemath=yes
  415. ;;
  416. *)
  417. default_ssemath=no
  418. ;;
  419. esac
  420. AC_ARG_ENABLE(ssemath,
  421. AC_HELP_STRING([--enable-ssemath], [Allow GCC to use SSE floating point math [[default=no]]]),
  422. , enable_ssemath=$default_ssemath)
  423. if test x$enable_ssemath = xno; then
  424. if test x$have_gcc_sse = xyes -o x$have_gcc_sse2 = xyes; then
  425. EXTRA_CFLAGS="$EXTRA_CFLAGS -mfpmath=387"
  426. fi
  427. fi
  428. dnl Check for various instruction support
  429. AC_ARG_ENABLE(mmx,
  430. AC_HELP_STRING([--enable-mmx], [use MMX assembly routines [[default=yes]]]),
  431. , enable_mmx=yes)
  432. if test x$enable_mmx = xyes; then
  433. save_CFLAGS="$CFLAGS"
  434. have_gcc_mmx=no
  435. AC_MSG_CHECKING(for GCC -mmmx option)
  436. mmx_CFLAGS="-mmmx"
  437. CFLAGS="$save_CFLAGS $mmx_CFLAGS"
  438. AC_TRY_COMPILE([
  439. #ifdef __MINGW32__
  440. #include <_mingw.h>
  441. #ifdef __MINGW64_VERSION_MAJOR
  442. #include <intrin.h>
  443. #else
  444. #include <mmintrin.h>
  445. #endif
  446. #else
  447. #include <mmintrin.h>
  448. #endif
  449. #ifndef __MMX__
  450. #error Assembler CPP flag not enabled
  451. #endif
  452. ],[
  453. ],[
  454. have_gcc_mmx=yes
  455. ])
  456. AC_MSG_RESULT($have_gcc_mmx)
  457. CFLAGS="$save_CFLAGS"
  458. if test x$have_gcc_mmx = xyes; then
  459. EXTRA_CFLAGS="$EXTRA_CFLAGS $mmx_CFLAGS"
  460. fi
  461. fi
  462. AC_ARG_ENABLE(3dnow,
  463. AC_HELP_STRING([--enable-3dnow], [use 3DNow! assembly routines [[default=yes]]]),
  464. , enable_3dnow=yes)
  465. if test x$enable_3dnow = xyes; then
  466. save_CFLAGS="$CFLAGS"
  467. have_gcc_3dnow=no
  468. AC_MSG_CHECKING(for GCC -m3dnow option)
  469. amd3dnow_CFLAGS="-m3dnow"
  470. CFLAGS="$save_CFLAGS $amd3dnow_CFLAGS"
  471. AC_TRY_LINK([
  472. #include <mm3dnow.h>
  473. #ifndef __3dNOW__
  474. #error Assembler CPP flag not enabled
  475. #endif
  476. ],[
  477. void *p = 0;
  478. _m_prefetch(p);
  479. ],[
  480. have_gcc_3dnow=yes
  481. ])
  482. AC_MSG_RESULT($have_gcc_3dnow)
  483. CFLAGS="$save_CFLAGS"
  484. if test x$have_gcc_3dnow = xyes; then
  485. EXTRA_CFLAGS="$EXTRA_CFLAGS $amd3dnow_CFLAGS"
  486. fi
  487. fi
  488. AC_ARG_ENABLE(sse,
  489. AC_HELP_STRING([--enable-sse], [use SSE assembly routines [[default=yes]]]),
  490. , enable_sse=yes)
  491. if test x$enable_sse = xyes; then
  492. save_CFLAGS="$CFLAGS"
  493. have_gcc_sse=no
  494. AC_MSG_CHECKING(for GCC -msse option)
  495. sse_CFLAGS="-msse"
  496. CFLAGS="$save_CFLAGS $sse_CFLAGS"
  497. AC_TRY_COMPILE([
  498. #ifdef __MINGW32__
  499. #include <_mingw.h>
  500. #ifdef __MINGW64_VERSION_MAJOR
  501. #include <intrin.h>
  502. #else
  503. #include <xmmintrin.h>
  504. #endif
  505. #else
  506. #include <xmmintrin.h>
  507. #endif
  508. #ifndef __SSE__
  509. #error Assembler CPP flag not enabled
  510. #endif
  511. ],[
  512. ],[
  513. have_gcc_sse=yes
  514. ])
  515. AC_MSG_RESULT($have_gcc_sse)
  516. CFLAGS="$save_CFLAGS"
  517. if test x$have_gcc_sse = xyes; then
  518. EXTRA_CFLAGS="$EXTRA_CFLAGS $sse_CFLAGS"
  519. fi
  520. fi
  521. AC_ARG_ENABLE(sse2,
  522. AC_HELP_STRING([--enable-sse2], [use SSE2 assembly routines [[default=no]]]),
  523. , enable_sse2=$default_ssemath)
  524. if test x$enable_sse2 = xyes; then
  525. save_CFLAGS="$CFLAGS"
  526. have_gcc_sse2=no
  527. AC_MSG_CHECKING(for GCC -msse2 option)
  528. sse2_CFLAGS="-msse2"
  529. CFLAGS="$save_CFLAGS $sse2_CFLAGS"
  530. AC_TRY_COMPILE([
  531. #ifdef __MINGW32__
  532. #include <_mingw.h>
  533. #ifdef __MINGW64_VERSION_MAJOR
  534. #include <intrin.h>
  535. #else
  536. #include <emmintrin.h>
  537. #endif
  538. #else
  539. #include <emmintrin.h>
  540. #endif
  541. #ifndef __SSE2__
  542. #error Assembler CPP flag not enabled
  543. #endif
  544. ],[
  545. ],[
  546. have_gcc_sse2=yes
  547. ])
  548. AC_MSG_RESULT($have_gcc_sse2)
  549. CFLAGS="$save_CFLAGS"
  550. if test x$have_gcc_sse2 = xyes; then
  551. EXTRA_CFLAGS="$EXTRA_CFLAGS $sse2_CFLAGS"
  552. fi
  553. fi
  554. AC_ARG_ENABLE(altivec,
  555. AC_HELP_STRING([--enable-altivec], [use Altivec assembly routines [[default=yes]]]),
  556. , enable_altivec=yes)
  557. if test x$enable_altivec = xyes; then
  558. save_CFLAGS="$CFLAGS"
  559. have_gcc_altivec=no
  560. have_altivec_h_hdr=no
  561. altivec_CFLAGS="-maltivec"
  562. CFLAGS="$save_CFLAGS $altivec_CFLAGS"
  563. AC_MSG_CHECKING(for Altivec with GCC altivec.h and -maltivec option)
  564. AC_TRY_COMPILE([
  565. #include <altivec.h>
  566. vector unsigned int vzero() {
  567. return vec_splat_u32(0);
  568. }
  569. ],[
  570. ],[
  571. have_gcc_altivec=yes
  572. have_altivec_h_hdr=yes
  573. ])
  574. AC_MSG_RESULT($have_gcc_altivec)
  575. if test x$have_gcc_altivec = xno; then
  576. AC_MSG_CHECKING(for Altivec with GCC -maltivec option)
  577. AC_TRY_COMPILE([
  578. vector unsigned int vzero() {
  579. return vec_splat_u32(0);
  580. }
  581. ],[
  582. ],[
  583. have_gcc_altivec=yes
  584. ])
  585. AC_MSG_RESULT($have_gcc_altivec)
  586. fi
  587. if test x$have_gcc_altivec = xno; then
  588. AC_MSG_CHECKING(for Altivec with GCC altivec.h and -faltivec option)
  589. altivec_CFLAGS="-faltivec"
  590. CFLAGS="$save_CFLAGS $altivec_CFLAGS"
  591. AC_TRY_COMPILE([
  592. #include <altivec.h>
  593. vector unsigned int vzero() {
  594. return vec_splat_u32(0);
  595. }
  596. ],[
  597. ],[
  598. have_gcc_altivec=yes
  599. have_altivec_h_hdr=yes
  600. ])
  601. AC_MSG_RESULT($have_gcc_altivec)
  602. fi
  603. if test x$have_gcc_altivec = xno; then
  604. AC_MSG_CHECKING(for Altivec with GCC -faltivec option)
  605. AC_TRY_COMPILE([
  606. vector unsigned int vzero() {
  607. return vec_splat_u32(0);
  608. }
  609. ],[
  610. ],[
  611. have_gcc_altivec=yes
  612. ])
  613. AC_MSG_RESULT($have_gcc_altivec)
  614. fi
  615. CFLAGS="$save_CFLAGS"
  616. if test x$have_gcc_altivec = xyes; then
  617. AC_DEFINE(SDL_ALTIVEC_BLITTERS, 1, [ ])
  618. if test x$have_altivec_h_hdr = xyes; then
  619. AC_DEFINE(HAVE_ALTIVEC_H, 1, [ ])
  620. fi
  621. EXTRA_CFLAGS="$EXTRA_CFLAGS $altivec_CFLAGS"
  622. fi
  623. fi
  624. fi
  625. dnl See if the OSS audio interface is supported
  626. CheckOSS()
  627. {
  628. AC_ARG_ENABLE(oss,
  629. AC_HELP_STRING([--enable-oss], [support the OSS audio API [[default=maybe]]]),
  630. , enable_oss=maybe)
  631. # OpenBSD "has" OSS, but it's not really for app use. They want you to
  632. # use sndio instead. So on there, we default to disabled. You can force
  633. # it on if you really want, though.
  634. if test x$enable_oss = xmaybe; then
  635. enable_oss=yes
  636. case "$host" in
  637. *-*-openbsd*)
  638. enable_oss=no;;
  639. esac
  640. fi
  641. if test x$enable_audio = xyes -a x$enable_oss = xyes; then
  642. AC_MSG_CHECKING(for OSS audio support)
  643. have_oss=no
  644. if test x$have_oss != xyes; then
  645. AC_TRY_COMPILE([
  646. #include <sys/soundcard.h>
  647. ],[
  648. int arg = SNDCTL_DSP_SETFRAGMENT;
  649. ],[
  650. have_oss=yes
  651. ])
  652. fi
  653. if test x$have_oss != xyes; then
  654. AC_TRY_COMPILE([
  655. #include <soundcard.h>
  656. ],[
  657. int arg = SNDCTL_DSP_SETFRAGMENT;
  658. ],[
  659. have_oss=yes
  660. AC_DEFINE(SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H, 1, [ ])
  661. ])
  662. fi
  663. AC_MSG_RESULT($have_oss)
  664. if test x$have_oss = xyes; then
  665. AC_DEFINE(SDL_AUDIO_DRIVER_OSS, 1, [ ])
  666. SOURCES="$SOURCES $srcdir/src/audio/dsp/*.c"
  667. have_audio=yes
  668. # We may need to link with ossaudio emulation library
  669. case "$host" in
  670. *-*-openbsd*|*-*-netbsd*)
  671. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lossaudio";;
  672. esac
  673. fi
  674. fi
  675. }
  676. dnl See if the ALSA audio interface is supported
  677. CheckALSA()
  678. {
  679. AC_ARG_ENABLE(alsa,
  680. AC_HELP_STRING([--enable-alsa], [support the ALSA audio API [[default=yes]]]),
  681. , enable_alsa=yes)
  682. if test x$enable_audio = xyes -a x$enable_alsa = xyes; then
  683. AM_PATH_ALSA(0.9.0, have_alsa=yes, have_alsa=no)
  684. # Restore all flags from before the ALSA detection runs
  685. CFLAGS="$alsa_save_CFLAGS"
  686. LDFLAGS="$alsa_save_LDFLAGS"
  687. LIBS="$alsa_save_LIBS"
  688. if test x$have_alsa = xyes; then
  689. AC_ARG_ENABLE(alsa-shared,
  690. AC_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [[default=yes]]]),
  691. , enable_alsa_shared=yes)
  692. alsa_lib=[`find_lib "libasound.so.*" "$ALSA_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
  693. AC_DEFINE(SDL_AUDIO_DRIVER_ALSA, 1, [ ])
  694. SOURCES="$SOURCES $srcdir/src/audio/alsa/*.c"
  695. EXTRA_CFLAGS="$EXTRA_CFLAGS $ALSA_CFLAGS"
  696. if test x$have_loadso != xyes && \
  697. test x$enable_alsa_shared = xyes; then
  698. AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ALSA loading])
  699. fi
  700. if test x$have_loadso = xyes && \
  701. test x$enable_alsa_shared = xyes && test x$alsa_lib != x; then
  702. echo "-- dynamic libasound -> $alsa_lib"
  703. AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ALSA_DYNAMIC, "$alsa_lib", [ ])
  704. else
  705. EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ALSA_LIBS"
  706. fi
  707. have_audio=yes
  708. fi
  709. fi
  710. }
  711. dnl Find the ESD includes and libraries
  712. CheckESD()
  713. {
  714. AC_ARG_ENABLE(esd,
  715. AC_HELP_STRING([--enable-esd], [support the Enlightened Sound Daemon [[default=yes]]]),
  716. , enable_esd=yes)
  717. if test x$enable_audio = xyes -a x$enable_esd = xyes; then
  718. AM_PATH_ESD(0.2.8, have_esd=yes, have_esd=no)
  719. if test x$have_esd = xyes; then
  720. AC_ARG_ENABLE(esd-shared,
  721. AC_HELP_STRING([--enable-esd-shared], [dynamically load ESD audio support [[default=yes]]]),
  722. , enable_esd_shared=yes)
  723. esd_lib=[`find_lib "libesd.so.*" "$ESD_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
  724. AC_DEFINE(SDL_AUDIO_DRIVER_ESD, 1, [ ])
  725. SOURCES="$SOURCES $srcdir/src/audio/esd/*.c"
  726. EXTRA_CFLAGS="$EXTRA_CFLAGS $ESD_CFLAGS"
  727. if test x$have_loadso != xyes && \
  728. test x$enable_esd_shared = xyes; then
  729. AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ESD loading])
  730. fi
  731. if test x$have_loadso = xyes && \
  732. test x$enable_esd_shared = xyes && test x$esd_lib != x; then
  733. echo "-- dynamic libesd -> $esd_lib"
  734. AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ESD_DYNAMIC, "$esd_lib", [ ])
  735. else
  736. EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ESD_LIBS"
  737. fi
  738. have_audio=yes
  739. fi
  740. fi
  741. }
  742. dnl Find PulseAudio
  743. CheckPulseAudio()
  744. {
  745. AC_ARG_ENABLE(pulseaudio,
  746. AC_HELP_STRING([--enable-pulseaudio], [use PulseAudio [[default=yes]]]),
  747. , enable_pulseaudio=yes)
  748. if test x$enable_audio = xyes -a x$enable_pulseaudio = xyes; then
  749. audio_pulseaudio=no
  750. PULSEAUDIO_REQUIRED_VERSION=0.9
  751. AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  752. AC_MSG_CHECKING(for PulseAudio $PULSEAUDIO_REQUIRED_VERSION support)
  753. if test x$PKG_CONFIG != xno; then
  754. if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $PULSEAUDIO_REQUIRED_VERSION libpulse-simple; then
  755. PULSEAUDIO_CFLAGS=`$PKG_CONFIG --cflags libpulse-simple`
  756. PULSEAUDIO_LIBS=`$PKG_CONFIG --libs libpulse-simple`
  757. audio_pulseaudio=yes
  758. fi
  759. fi
  760. AC_MSG_RESULT($audio_pulseaudio)
  761. if test x$audio_pulseaudio = xyes; then
  762. AC_ARG_ENABLE(pulseaudio-shared,
  763. AC_HELP_STRING([--enable-pulseaudio-shared], [dynamically load PulseAudio support [[default=yes]]]),
  764. , enable_pulseaudio_shared=yes)
  765. pulseaudio_lib=[`find_lib "libpulse-simple.so.*" "$PULSEAUDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
  766. AC_DEFINE(SDL_AUDIO_DRIVER_PULSEAUDIO, 1, [ ])
  767. SOURCES="$SOURCES $srcdir/src/audio/pulseaudio/*.c"
  768. EXTRA_CFLAGS="$EXTRA_CFLAGS $PULSEAUDIO_CFLAGS"
  769. if test x$have_loadso != xyes && \
  770. test x$enable_pulseaudio_shared = xyes; then
  771. AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic PulseAudio loading])
  772. fi
  773. if test x$have_loadso = xyes && \
  774. test x$enable_pulseaudio_shared = xyes && test x$pulseaudio_lib != x; then
  775. echo "-- dynamic libpulse-simple -> $pulseaudio_lib"
  776. AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC, "$pulseaudio_lib", [ ])
  777. case "$host" in
  778. # On Solaris, pulseaudio must be linked deferred explicitly
  779. # to prevent undefined symbol failures.
  780. *-*-solaris*)
  781. PULSEAUDIO_LIBS=`echo $PULSEAUDIO_LIBS | sed 's/\-l/-Wl,-l/g'`
  782. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-zdeferred $PULSEAUDIO_LIBS -Wl,-znodeferred"
  783. esac
  784. else
  785. EXTRA_LDFLAGS="$EXTRA_LDFLAGS $PULSEAUDIO_LIBS"
  786. fi
  787. have_audio=yes
  788. fi
  789. fi
  790. }
  791. CheckARTSC()
  792. {
  793. AC_ARG_ENABLE(arts,
  794. AC_HELP_STRING([--enable-arts], [support the Analog Real Time Synthesizer [[default=yes]]]),
  795. , enable_arts=yes)
  796. if test x$enable_audio = xyes -a x$enable_arts = xyes; then
  797. AC_PATH_PROG(ARTSCONFIG, artsc-config)
  798. if test x$ARTSCONFIG = x -o x$ARTSCONFIG = x'"$ARTSCONFIG"'; then
  799. : # arts isn't installed
  800. else
  801. ARTS_CFLAGS=`$ARTSCONFIG --cflags`
  802. ARTS_LIBS=`$ARTSCONFIG --libs`
  803. AC_MSG_CHECKING(for aRts development environment)
  804. audio_arts=no
  805. save_CFLAGS="$CFLAGS"
  806. CFLAGS="$CFLAGS $ARTS_CFLAGS"
  807. AC_TRY_COMPILE([
  808. #include <artsc.h>
  809. ],[
  810. arts_stream_t stream;
  811. ],[
  812. audio_arts=yes
  813. ])
  814. CFLAGS="$save_CFLAGS"
  815. AC_MSG_RESULT($audio_arts)
  816. if test x$audio_arts = xyes; then
  817. AC_ARG_ENABLE(arts-shared,
  818. AC_HELP_STRING([--enable-arts-shared], [dynamically load aRts audio support [[default=yes]]]),
  819. , enable_arts_shared=yes)
  820. arts_lib=[`find_lib "libartsc.so.*" "$ARTS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
  821. AC_DEFINE(SDL_AUDIO_DRIVER_ARTS, 1, [ ])
  822. SOURCES="$SOURCES $srcdir/src/audio/arts/*.c"
  823. EXTRA_CFLAGS="$EXTRA_CFLAGS $ARTS_CFLAGS"
  824. if test x$have_loadso != xyes && \
  825. test x$enable_arts_shared = xyes; then
  826. AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic ARTS loading])
  827. fi
  828. if test x$have_loadso = xyes && \
  829. test x$enable_arts_shared = xyes && test x$arts_lib != x; then
  830. echo "-- dynamic libartsc -> $arts_lib"
  831. AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_ARTS_DYNAMIC, "$arts_lib", [ ])
  832. else
  833. EXTRA_LDFLAGS="$EXTRA_LDFLAGS $ARTS_LIBS"
  834. fi
  835. have_audio=yes
  836. fi
  837. fi
  838. fi
  839. }
  840. dnl See if the NAS audio interface is supported
  841. CheckNAS()
  842. {
  843. AC_ARG_ENABLE(nas,
  844. AC_HELP_STRING([--enable-nas], [support the NAS audio API [[default=yes]]]),
  845. , enable_nas=yes)
  846. if test x$enable_audio = xyes -a x$enable_nas = xyes; then
  847. AC_CHECK_HEADER(audio/audiolib.h, have_nas_hdr=yes)
  848. AC_CHECK_LIB(audio, AuOpenServer, have_nas_lib=yes)
  849. AC_MSG_CHECKING(for NAS audio support)
  850. have_nas=no
  851. if test x$have_nas_hdr = xyes -a x$have_nas_lib = xyes; then
  852. have_nas=yes
  853. NAS_LIBS="-laudio"
  854. elif test -r /usr/X11R6/include/audio/audiolib.h; then
  855. have_nas=yes
  856. NAS_CFLAGS="-I/usr/X11R6/include/"
  857. NAS_LIBS="-L/usr/X11R6/lib -laudio -lXt"
  858. fi
  859. AC_MSG_RESULT($have_nas)
  860. if test x$have_nas = xyes; then
  861. AC_ARG_ENABLE(nas-shared,
  862. AC_HELP_STRING([--enable-nas-shared], [dynamically load NAS audio support [[default=yes]]]),
  863. , enable_nas_shared=yes)
  864. nas_lib=[`find_lib "libaudio.so.*" "$NAS_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
  865. if test x$have_loadso != xyes && \
  866. test x$enable_nas_shared = xyes; then
  867. AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic NAS loading])
  868. fi
  869. if test x$have_loadso = xyes && \
  870. test x$enable_nas_shared = xyes && test x$nas_lib != x; then
  871. echo "-- dynamic libaudio -> $nas_lib"
  872. AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_NAS_DYNAMIC, "$nas_lib", [ ])
  873. else
  874. EXTRA_LDFLAGS="$EXTRA_LDFLAGS $NAS_LIBS"
  875. fi
  876. AC_DEFINE(SDL_AUDIO_DRIVER_NAS, 1, [ ])
  877. SOURCES="$SOURCES $srcdir/src/audio/nas/*.c"
  878. EXTRA_CFLAGS="$EXTRA_CFLAGS $NAS_CFLAGS"
  879. have_audio=yes
  880. fi
  881. fi
  882. }
  883. dnl See if the sndio audio interface is supported
  884. CheckSNDIO()
  885. {
  886. AC_ARG_ENABLE(sndio,
  887. AC_HELP_STRING([--enable-sndio], [support the sndio audio API [[default=yes]]]),
  888. , enable_sndio=yes)
  889. if test x$enable_audio = xyes -a x$enable_sndio = xyes; then
  890. AC_CHECK_HEADER(sndio.h, have_sndio_hdr=yes)
  891. AC_CHECK_LIB(sndio, sio_open, have_sndio_lib=yes)
  892. AC_MSG_CHECKING(for sndio audio support)
  893. have_sndio=no
  894. if test x$have_sndio_hdr = xyes -a x$have_sndio_lib = xyes; then
  895. have_sndio=yes
  896. SNDIO_LIBS="-lsndio"
  897. fi
  898. AC_MSG_RESULT($have_sndio)
  899. if test x$have_sndio = xyes; then
  900. AC_ARG_ENABLE(sndio-shared,
  901. AC_HELP_STRING([--enable-sndio-shared], [dynamically load sndio audio support [[default=yes]]]),
  902. , enable_sndio_shared=yes)
  903. sndio_lib=[`find_lib "libsndio.so.*" "$SNDIO_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`]
  904. if test x$have_loadso != xyes && \
  905. test x$enable_sndio_shared = xyes; then
  906. AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic sndio loading])
  907. fi
  908. if test x$have_loadso = xyes && \
  909. test x$enable_sndio_shared = xyes && test x$sndio_lib != x; then
  910. echo "-- dynamic libsndio -> $sndio_lib"
  911. AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_SNDIO_DYNAMIC, "$sndio_lib", [ ])
  912. else
  913. EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SNDIO_LIBS"
  914. fi
  915. AC_DEFINE(SDL_AUDIO_DRIVER_SNDIO, 1, [ ])
  916. SOURCES="$SOURCES $srcdir/src/audio/sndio/*.c"
  917. EXTRA_CFLAGS="$EXTRA_CFLAGS $SNDIO_CFLAGS"
  918. have_audio=yes
  919. fi
  920. fi
  921. }
  922. dnl rcg07142001 See if the user wants the disk writer audio driver...
  923. CheckDiskAudio()
  924. {
  925. AC_ARG_ENABLE(diskaudio,
  926. AC_HELP_STRING([--enable-diskaudio], [support the disk writer audio driver [[default=yes]]]),
  927. , enable_diskaudio=yes)
  928. if test x$enable_audio = xyes -a x$enable_diskaudio = xyes; then
  929. AC_DEFINE(SDL_AUDIO_DRIVER_DISK, 1, [ ])
  930. SOURCES="$SOURCES $srcdir/src/audio/disk/*.c"
  931. fi
  932. }
  933. dnl rcg03142006 See if the user wants the dummy audio driver...
  934. CheckDummyAudio()
  935. {
  936. AC_ARG_ENABLE(dummyaudio,
  937. AC_HELP_STRING([--enable-dummyaudio], [support the dummy audio driver [[default=yes]]]),
  938. , enable_dummyaudio=yes)
  939. if test x$enable_audio = xyes -a x$enable_dummyaudio = xyes; then
  940. AC_DEFINE(SDL_AUDIO_DRIVER_DUMMY, 1, [ ])
  941. SOURCES="$SOURCES $srcdir/src/audio/dummy/*.c"
  942. fi
  943. }
  944. dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually).
  945. dnl Details of this flag are here: http://gcc.gnu.org/wiki/Visibility
  946. CheckVisibilityHidden()
  947. {
  948. AC_MSG_CHECKING(for GCC -fvisibility=hidden option)
  949. have_gcc_fvisibility=no
  950. visibility_CFLAGS="-fvisibility=hidden"
  951. save_CFLAGS="$CFLAGS"
  952. CFLAGS="$save_CFLAGS $visibility_CFLAGS -Werror"
  953. AC_TRY_COMPILE([
  954. #if !defined(__GNUC__) || __GNUC__ < 4
  955. #error SDL only uses visibility attributes in GCC 4 or newer
  956. #endif
  957. ],[
  958. ],[
  959. have_gcc_fvisibility=yes
  960. ])
  961. AC_MSG_RESULT($have_gcc_fvisibility)
  962. CFLAGS="$save_CFLAGS"
  963. if test x$have_gcc_fvisibility = xyes; then
  964. EXTRA_CFLAGS="$EXTRA_CFLAGS $visibility_CFLAGS"
  965. fi
  966. }
  967. dnl See if GCC's -mpreferred-stack-boundary is supported.
  968. dnl Reference: http://bugzilla.libsdl.org/show_bug.cgi?id=1296
  969. CheckStackBoundary()
  970. {
  971. AC_MSG_CHECKING(for GCC -mpreferred-stack-boundary option)
  972. have_gcc_preferred_stack_boundary=no
  973. save_CFLAGS="$CFLAGS"
  974. CFLAGS="$save_CFLAGS -mpreferred-stack-boundary=2"
  975. AC_TRY_COMPILE([
  976. int x = 0;
  977. ],[
  978. ],[
  979. have_gcc_preferred_stack_boundary=yes
  980. ])
  981. AC_MSG_RESULT($have_gcc_preferred_stack_boundary)
  982. CFLAGS="$save_CFLAGS"
  983. if test x$have_gcc_preferred_stack_boundary = xyes; then
  984. EXTRA_CFLAGS="$EXTRA_CFLAGS -mpreferred-stack-boundary=2"
  985. fi
  986. }
  987. dnl See if GCC's -Wall is supported.
  988. CheckWarnAll()
  989. {
  990. AC_MSG_CHECKING(for GCC -Wall option)
  991. have_gcc_Wall=no
  992. save_CFLAGS="$CFLAGS"
  993. CFLAGS="$save_CFLAGS -Wall"
  994. AC_TRY_COMPILE([
  995. int x = 0;
  996. ],[
  997. ],[
  998. have_gcc_Wall=yes
  999. ])
  1000. AC_MSG_RESULT($have_gcc_Wall)
  1001. CFLAGS="$save_CFLAGS"
  1002. if test x$have_gcc_Wall = xyes; then
  1003. EXTRA_CFLAGS="$EXTRA_CFLAGS -Wall"
  1004. dnl Haiku headers use multicharacter constants all over the place. Ignore these warnings when using -Wall.
  1005. AC_MSG_CHECKING(for necessary GCC -Wno-multichar option)
  1006. need_gcc_Wno_multichar=no
  1007. case "$host" in
  1008. *-*-haiku*)
  1009. need_gcc_Wno_multichar=yes
  1010. ;;
  1011. esac
  1012. AC_MSG_RESULT($need_gcc_Wno_multichar)
  1013. if test x$need_gcc_Wno_multichar = xyes; then
  1014. EXTRA_CFLAGS="$EXTRA_CFLAGS -Wno-multichar"
  1015. fi
  1016. fi
  1017. }
  1018. dnl Check for Wayland
  1019. CheckWayland()
  1020. {
  1021. AC_ARG_ENABLE(video-wayland,
  1022. AC_HELP_STRING([--enable-video-wayland], [use Wayland video driver [[default=yes]]]),
  1023. ,enable_video_wayland=yes)
  1024. AC_ARG_ENABLE(video-wayland-qt-touch,
  1025. AC_HELP_STRING([--enable-video-wayland-qt-touch], [QtWayland server support for Wayland video driver [[default=yes]]]),
  1026. ,enable_video_wayland_qt_touch=yes)
  1027. if test x$enable_video = xyes -a x$enable_video_wayland = xyes; then
  1028. AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  1029. AC_MSG_CHECKING(for Wayland support)
  1030. video_wayland=no
  1031. if test x$PKG_CONFIG != xno; then
  1032. if $PKG_CONFIG --exists wayland-client wayland-egl wayland-cursor egl xkbcommon ; then
  1033. WAYLAND_CFLAGS=`$PKG_CONFIG --cflags wayland-client wayland-egl wayland-cursor egl xkbcommon`
  1034. WAYLAND_LIBS=`$PKG_CONFIG --libs wayland-client wayland-egl wayland-cursor egl xkbcommon`
  1035. video_wayland=yes
  1036. fi
  1037. fi
  1038. AC_MSG_RESULT($video_wayland)
  1039. if test x$video_wayland = xyes; then
  1040. AC_DEFINE(SDL_VIDEO_DRIVER_WAYLAND, 1, [ ])
  1041. if test x$enable_video_wayland_qt_touch = xyes; then
  1042. AC_DEFINE(SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH, 1, [ ])
  1043. fi
  1044. SOURCES="$SOURCES $srcdir/src/video/wayland/*.c"
  1045. EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS"
  1046. dnl FIXME do dynamic loading code here.
  1047. EXTRA_LDFLAGS="$EXTRA_LDFLAGS $WAYLAND_LIBS"
  1048. have_video=yes
  1049. fi
  1050. fi
  1051. }
  1052. dnl Find the X11 include and library directories
  1053. CheckX11()
  1054. {
  1055. AC_ARG_ENABLE(video-x11,
  1056. AC_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]),
  1057. , enable_video_x11=yes)
  1058. if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then
  1059. case "$host" in
  1060. *-*-darwin*)
  1061. # This isn't necessary for X11, but fixes GLX detection
  1062. if test "x$x_includes" = xNONE && \
  1063. test "x$x_libraries" = xNONE && \
  1064. test -d /usr/X11R6/include && \
  1065. test -d /usr/X11R6/lib; then
  1066. x_includes="/usr/X11R6/include"
  1067. x_libraries="/usr/X11R6/lib"
  1068. fi
  1069. ;;
  1070. esac
  1071. AC_PATH_X
  1072. AC_PATH_XTRA
  1073. if test x$have_x = xyes; then
  1074. AC_ARG_ENABLE(x11-shared,
  1075. AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=maybe]]]),
  1076. , enable_x11_shared=maybe)
  1077. case "$host" in
  1078. *-*-darwin*)
  1079. x11_lib='/usr/X11R6/lib/libX11.6.dylib'
  1080. x11ext_lib='/usr/X11R6/lib/libXext.6.dylib'
  1081. xcursor_lib='/usr/X11R6/lib/libXcursor.1.dylib'
  1082. xinerama_lib='/usr/X11R6/lib/libXinerama.1.dylib'
  1083. xinput_lib='/usr/X11R6/lib/libXi.6.dylib'
  1084. xrandr_lib='/usr/X11R6/lib/libXrandr.2.dylib'
  1085. xrender_lib='/usr/X11R6/lib/libXrender.1.dylib'
  1086. xss_lib='/usr/X11R6/lib/libXss.1.dylib'
  1087. xvidmode_lib='/usr/X11R6/lib/libXxf86vm.1.dylib'
  1088. ;;
  1089. *-*-openbsd*)
  1090. x11_lib='libX11.so'
  1091. x11ext_lib='libXext.so'
  1092. xcursor_lib='libXcursor.so'
  1093. xinerama_lib='libXinerama.so'
  1094. xinput_lib='libXi.so'
  1095. xrandr_lib='libXrandr.so'
  1096. xrender_lib='libXrender.so'
  1097. xss_lib='libXss.so'
  1098. xvidmode_lib='libXxf86vm.so'
  1099. ;;
  1100. *)
  1101. x11_lib=[`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1102. x11ext_lib=[`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1103. xcursor_lib=[`find_lib "libXcursor.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1104. xinerama_lib=[`find_lib "libXinerama.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1105. xinput_lib=[`find_lib "libXi.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1106. xrandr_lib=[`find_lib "libXrandr.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1107. xrender_lib=[`find_lib "libXrender.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1108. xss_lib=[`find_lib "libXss.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1109. xvidmode_lib=[`find_lib "libXxf86vm.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
  1110. ;;
  1111. esac
  1112. if test x$ac_cv_func_shmat != xyes; then
  1113. X_CFLAGS="$X_CFLAGS -DNO_SHARED_MEMORY"
  1114. fi
  1115. CFLAGS="$CFLAGS $X_CFLAGS"
  1116. LDFLAGS="$LDFLAGS $X_LIBS"
  1117. AC_CHECK_HEADER(X11/extensions/Xext.h,
  1118. have_xext_h_hdr=yes,
  1119. have_xext_h_hdr=no,
  1120. [#include <X11/Xlib.h>
  1121. #include <X11/Xproto.h>
  1122. ])
  1123. if test x$have_xext_h_hdr != xyes; then
  1124. AC_MSG_ERROR([
  1125. *** Missing Xext.h, maybe you need to install the libxext-dev package?
  1126. ])
  1127. fi
  1128. AC_DEFINE(SDL_VIDEO_DRIVER_X11, 1, [ ])
  1129. SOURCES="$SOURCES $srcdir/src/video/x11/*.c"
  1130. EXTRA_CFLAGS="$EXTRA_CFLAGS $X_CFLAGS"
  1131. # Needed so SDL applications can include SDL_syswm.h
  1132. SDL_CFLAGS="$SDL_CFLAGS $X_CFLAGS"
  1133. if test x$enable_x11_shared = xmaybe; then
  1134. enable_x11_shared=yes
  1135. fi
  1136. if test x$have_loadso != xyes && \
  1137. test x$enable_x11_shared = xyes; then
  1138. AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic X11 loading])
  1139. enable_x11_shared=no
  1140. fi
  1141. if test x$have_loadso = xyes && \
  1142. test x$enable_x11_shared = xyes && test x$x11_lib != x && test x$x11ext_lib != x; then
  1143. echo "-- dynamic libX11 -> $x11_lib"
  1144. echo "-- dynamic libX11ext -> $x11ext_lib"
  1145. AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC, "$x11_lib", [ ])
  1146. AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT, "$x11ext_lib", [ ])
  1147. else
  1148. enable_x11_shared=no
  1149. EXTRA_LDFLAGS="$EXTRA_LDFLAGS $X_LIBS -lX11 -lXext"
  1150. fi
  1151. have_video=yes
  1152. AC_MSG_CHECKING(for const parameter to XextAddDisplay)
  1153. have_const_param_XextAddDisplay=no
  1154. AC_TRY_COMPILE([
  1155. #include <X11/Xlib.h>
  1156. #include <X11/Xproto.h>
  1157. #include <X11/extensions/Xext.h>
  1158. #include <X11/extensions/extutil.h>
  1159. extern XExtDisplayInfo* XextAddDisplay(XExtensionInfo* a,Display* b,_Xconst char* c,XExtensionHooks* d,int e,XPointer f);
  1160. ],[
  1161. ],[
  1162. have_const_param_XextAddDisplay=yes
  1163. AC_DEFINE(SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY)
  1164. ])
  1165. AC_MSG_RESULT($have_const_param_XextAddDisplay)
  1166. AC_MSG_CHECKING(for const parameter to _XData32)
  1167. have_const_param_xdata32=no
  1168. AC_TRY_COMPILE([
  1169. #include <X11/Xlibint.h>
  1170. extern int _XData32(Display *dpy,register _Xconst long *data,unsigned len);
  1171. ],[
  1172. ],[
  1173. have_const_param_xdata32=yes
  1174. AC_DEFINE(SDL_VIDEO_DRIVER_X11_CONST_PARAM_XDATA32)
  1175. ])
  1176. AC_MSG_RESULT($have_const_param_xdata32)
  1177. dnl AC_CHECK_LIB(X11, XGetEventData, AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS, 1, [Have XGenericEvent]))
  1178. AC_MSG_CHECKING([for XGenericEvent])
  1179. have_XGenericEvent=no
  1180. AC_TRY_COMPILE([
  1181. #include <X11/Xlib.h>
  1182. ],[
  1183. Display *display;
  1184. XEvent event;
  1185. XGenericEventCookie *cookie = &event.xcookie;
  1186. XNextEvent(display, &event);
  1187. XGetEventData(display, cookie);
  1188. XFreeEventData(display, cookie);
  1189. ],[
  1190. have_XGenericEvent=yes
  1191. AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS)
  1192. ])
  1193. AC_MSG_RESULT($have_XGenericEvent)
  1194. AC_CHECK_LIB(X11, XkbKeycodeToKeysym, AC_DEFINE(SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM, 1, [Have XkbKeycodeToKeysym]))
  1195. AC_ARG_ENABLE(video-x11-xcursor,
  1196. AC_HELP_STRING([--enable-video-x11-xcursor], [enable X11 Xcursor support [[default=yes]]]),
  1197. , enable_video_x11_xcursor=yes)
  1198. if test x$enable_video_x11_xcursor = xyes; then
  1199. definitely_enable_video_x11_xcursor=no
  1200. AC_CHECK_HEADER(X11/Xcursor/Xcursor.h,
  1201. have_xcursor_h_hdr=yes,
  1202. have_xcursor_h_hdr=no,
  1203. [#include <X11/Xlib.h>
  1204. ])
  1205. if test x$have_xcursor_h_hdr = xyes; then
  1206. if test x$enable_x11_shared = xyes && test x$xcursor_lib != x ; then
  1207. echo "-- dynamic libXcursor -> $xcursor_lib"
  1208. AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR, "$xcursor_lib", [ ])
  1209. definitely_enable_video_x11_xcursor=yes
  1210. else
  1211. AC_CHECK_LIB(Xcursor, XcursorImageCreate, have_xcursor_lib=yes)
  1212. if test x$have_xcursor_lib = xyes ; then
  1213. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXcursor"
  1214. definitely_enable_video_x11_xcursor=yes
  1215. fi
  1216. fi
  1217. fi
  1218. fi
  1219. if test x$definitely_enable_video_x11_xcursor = xyes; then
  1220. AC_DEFINE(SDL_VIDEO_DRIVER_X11_XCURSOR, 1, [ ])
  1221. fi
  1222. AC_ARG_ENABLE(video-x11-xinerama,
  1223. AC_HELP_STRING([--enable-video-x11-xinerama], [enable X11 Xinerama support [[default=yes]]]),
  1224. , enable_video_x11_xinerama=yes)
  1225. if test x$enable_video_x11_xinerama = xyes; then
  1226. definitely_enable_video_x11_xinerama=no
  1227. AC_CHECK_HEADER(X11/extensions/Xinerama.h,
  1228. have_xinerama_h_hdr=yes,
  1229. have_xinerama_h_hdr=no,
  1230. [#include <X11/Xlib.h>
  1231. ])
  1232. if test x$have_xinerama_h_hdr = xyes; then
  1233. if test x$enable_x11_shared = xyes && test x$xinerama_lib != x ; then
  1234. echo "-- dynamic libXinerama -> $xinerama_lib"
  1235. AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA, "$xinerama_lib", [ ])
  1236. definitely_enable_video_x11_xinerama=yes
  1237. else
  1238. AC_CHECK_LIB(Xinerama, XineramaQueryExtension, have_xinerama_lib=yes)
  1239. if test x$have_xinerama_lib = xyes ; then
  1240. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXinerama"
  1241. definitely_enable_video_x11_xinerama=yes
  1242. fi
  1243. fi
  1244. fi
  1245. fi
  1246. if test x$definitely_enable_video_x11_xinerama = xyes; then
  1247. AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINERAMA, 1, [ ])
  1248. fi
  1249. AC_ARG_ENABLE(video-x11-xinput,
  1250. AC_HELP_STRING([--enable-video-x11-xinput], [enable X11 XInput extension for manymouse, tablets, etc [[default=yes]]]),
  1251. , enable_video_x11_xinput=yes)
  1252. if test x$enable_video_x11_xinput = xyes; then
  1253. definitely_enable_video_x11_xinput=no
  1254. AC_CHECK_HEADER(X11/extensions/XInput2.h,
  1255. have_xinput_h_hdr=yes,
  1256. have_xinput_h_hdr=no,
  1257. [#include <X11/Xlib.h>
  1258. ])
  1259. if test x$have_xinput_h_hdr = xyes; then
  1260. if test x$enable_x11_shared = xyes && test x$xinput_lib != x ; then
  1261. echo "-- dynamic libXi -> $xinput_lib"
  1262. AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT2, "$xinput_lib", [ ])
  1263. definitely_enable_video_x11_xinput=yes
  1264. else
  1265. AC_CHECK_LIB(Xi, XOpenDevice, have_xinput_lib=yes)
  1266. if test x$have_xinput_lib = xyes ; then
  1267. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXi"
  1268. definitely_enable_video_x11_xinput=yes
  1269. fi
  1270. fi
  1271. fi
  1272. fi
  1273. if test x$definitely_enable_video_x11_xinput = xyes; then
  1274. AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT2, 1, [ ])
  1275. AC_MSG_CHECKING(for xinput2 multitouch)
  1276. have_xinput2_multitouch=no
  1277. AC_TRY_COMPILE([
  1278. #include <X11/Xlib.h>
  1279. #include <X11/Xproto.h>
  1280. #include <X11/extensions/XInput2.h>
  1281. ],[
  1282. int event_type = XI_TouchBegin;
  1283. XITouchClassInfo *t;
  1284. Status
  1285. XIAllowTouchEvents(Display *a,int b,unsigned int c,Window d,int f)
  1286. {
  1287. return (Status)0;
  1288. }
  1289. ],[
  1290. have_xinput2_multitouch=yes
  1291. AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH)
  1292. ])
  1293. AC_MSG_RESULT($have_xinput2_multitouch)
  1294. fi
  1295. AC_ARG_ENABLE(video-x11-xrandr,
  1296. AC_HELP_STRING([--enable-video-x11-xrandr], [enable X11 Xrandr extension for fullscreen [[default=yes]]]),
  1297. , enable_video_x11_xrandr=yes)
  1298. if test x$enable_video_x11_xrandr = xyes; then
  1299. definitely_enable_video_x11_xrandr=no
  1300. AC_CHECK_HEADER(X11/extensions/Xrandr.h,
  1301. have_xrandr_h_hdr=yes,
  1302. have_xrandr_h_hdr=no,
  1303. [#include <X11/Xlib.h>
  1304. ])
  1305. if test x$have_xrandr_h_hdr = xyes; then
  1306. if test x$enable_x11_shared = xyes && test x$xrandr_lib != x ; then
  1307. echo "-- dynamic libXrandr -> $xrandr_lib"
  1308. AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR, "$xrandr_lib", [ ])
  1309. definitely_enable_video_x11_xrandr=yes
  1310. else
  1311. AC_CHECK_LIB(Xrandr, XRRQueryExtension, have_xrandr_lib=yes)
  1312. if test x$have_xrandr_lib = xyes ; then
  1313. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXrandr"
  1314. definitely_enable_video_x11_xrandr=yes
  1315. fi
  1316. fi
  1317. fi
  1318. fi
  1319. if test x$definitely_enable_video_x11_xrandr = xyes; then
  1320. AC_DEFINE(SDL_VIDEO_DRIVER_X11_XRANDR, 1, [ ])
  1321. fi
  1322. AC_ARG_ENABLE(video-x11-scrnsaver,
  1323. AC_HELP_STRING([--enable-video-x11-scrnsaver], [enable X11 screensaver extension [[default=yes]]]),
  1324. , enable_video_x11_scrnsaver=yes)
  1325. if test x$enable_video_x11_scrnsaver = xyes; then
  1326. AC_CHECK_HEADER(X11/extensions/scrnsaver.h,
  1327. have_scrnsaver_h_hdr=yes,
  1328. have_scrnsaver_h_hdr=no,
  1329. [#include <X11/Xlib.h>
  1330. ])
  1331. if test x$have_scrnsaver_h_hdr = xyes; then
  1332. if test x$enable_x11_shared = xyes && test x$xss_lib != x ; then
  1333. echo "-- dynamic libXss -> $xss_lib"
  1334. AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS, "$xss_lib", [ ])
  1335. definitely_enable_video_x11_scrnsaver=yes
  1336. else
  1337. AC_CHECK_LIB(Xss, XScreenSaverSuspend, have_xss_lib=yes)
  1338. if test x$have_xss_lib = xyes ; then
  1339. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXss"
  1340. definitely_enable_video_x11_scrnsaver=yes
  1341. fi
  1342. fi
  1343. fi
  1344. fi
  1345. if test x$definitely_enable_video_x11_scrnsaver = xyes; then
  1346. AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSCRNSAVER, 1, [ ])
  1347. fi
  1348. AC_ARG_ENABLE(video-x11-xshape,
  1349. AC_HELP_STRING([--enable-video-x11-xshape], [enable X11 XShape support [[default=yes]]]),
  1350. , enable_video_x11_xshape=yes)
  1351. if test x$enable_video_x11_xshape = xyes; then
  1352. AC_CHECK_HEADER(X11/extensions/shape.h,
  1353. have_shape_h_hdr=yes,
  1354. have_shape_h_hdr=no,
  1355. [#include <X11/Xlib.h>
  1356. ])
  1357. if test x$have_shape_h_hdr = xyes; then
  1358. AC_DEFINE(SDL_VIDEO_DRIVER_X11_XSHAPE, 1, [ ])
  1359. fi
  1360. fi
  1361. AC_ARG_ENABLE(video-x11-vm,
  1362. AC_HELP_STRING([--enable-video-x11-vm], [use X11 VM extension for fullscreen [[default=yes]]]),
  1363. , enable_video_x11_vm=yes)
  1364. if test x$enable_video_x11_vm = xyes; then
  1365. definitely_enable_video_x11_vm=no
  1366. AC_CHECK_HEADER(X11/extensions/xf86vmode.h,
  1367. have_vm_h_hdr=yes,
  1368. have_vm_h_hdr=no,
  1369. [#include <X11/Xlib.h>
  1370. ])
  1371. if test x$have_vm_h_hdr = xyes; then
  1372. if test x$enable_x11_shared = xyes && test x$xvidmode_lib != x ; then
  1373. echo "-- dynamic libXxf86vm -> $xvidmode_lib"
  1374. AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE, "$xvidmode_lib", [ ])
  1375. definitely_enable_video_x11_vm=yes
  1376. else
  1377. AC_CHECK_LIB(Xxf86vm, XF86VidModeQueryVersion, have_vm_lib=yes)
  1378. if test x$have_vm_lib = xyes ; then
  1379. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lXxf86vm"
  1380. definitely_enable_video_x11_vm=yes
  1381. fi
  1382. fi
  1383. fi
  1384. fi
  1385. if test x$definitely_enable_video_x11_vm = xyes; then
  1386. AC_DEFINE(SDL_VIDEO_DRIVER_X11_XVIDMODE, 1, [ ])
  1387. fi
  1388. fi
  1389. fi
  1390. }
  1391. dnl Set up the Haiku video driver if enabled
  1392. CheckHaikuVideo()
  1393. {
  1394. if test x$enable_video = xyes; then
  1395. AC_DEFINE(SDL_VIDEO_DRIVER_HAIKU, 1, [ ])
  1396. SOURCES="$SOURCES $srcdir/src/video/haiku/*.cc"
  1397. have_video=yes
  1398. fi
  1399. }
  1400. dnl Set up the Cocoa video driver for Mac OS X (but not Darwin)
  1401. CheckCOCOA()
  1402. {
  1403. AC_ARG_ENABLE(video-cocoa,
  1404. AC_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]]),
  1405. , enable_video_cocoa=yes)
  1406. if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then
  1407. save_CFLAGS="$CFLAGS"
  1408. dnl work around that we don't have Objective-C support in autoconf
  1409. CFLAGS="$CFLAGS -x objective-c"
  1410. AC_MSG_CHECKING(for Cocoa framework)
  1411. have_cocoa=no
  1412. AC_TRY_COMPILE([
  1413. #import <Cocoa/Cocoa.h>
  1414. ],[
  1415. ],[
  1416. have_cocoa=yes
  1417. ])
  1418. AC_MSG_RESULT($have_cocoa)
  1419. CFLAGS="$save_CFLAGS"
  1420. if test x$have_cocoa = xyes; then
  1421. AC_DEFINE(SDL_VIDEO_DRIVER_COCOA, 1, [ ])
  1422. SOURCES="$SOURCES $srcdir/src/video/cocoa/*.m"
  1423. have_video=yes
  1424. fi
  1425. fi
  1426. }
  1427. dnl Find DirectFB
  1428. CheckDirectFB()
  1429. {
  1430. AC_ARG_ENABLE(video-directfb,
  1431. AC_HELP_STRING([--enable-video-directfb], [use DirectFB video driver [[default=no]]]),
  1432. , enable_video_directfb=no)
  1433. if test x$enable_video = xyes -a x$enable_video_directfb = xyes; then
  1434. video_directfb=no
  1435. DIRECTFB_REQUIRED_VERSION=1.0.0
  1436. AC_PATH_PROGS(DIRECTFBCONFIG, directfb-config, no, [$prefix/bin:$PATH])
  1437. if test x$DIRECTFBCONFIG = xno; then
  1438. AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  1439. if test x$PKG_CONFIG != xno; then
  1440. if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $DIRECTFB_REQUIRED_VERSION directfb; then
  1441. DIRECTFB_CFLAGS=`$PKG_CONFIG --cflags directfb`
  1442. DIRECTFB_LIBS=`$PKG_CONFIG --libs directfb`
  1443. DIRECTFB_PREFIX=`$PKG_CONFIG --variable=prefix directfb`
  1444. video_directfb=yes
  1445. fi
  1446. fi
  1447. else
  1448. set -- `echo $DIRECTFB_REQUIRED_VERSION | sed 's/\./ /g'`
  1449. NEED_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
  1450. set -- `$DIRECTFBCONFIG --version | sed 's/\./ /g'`
  1451. HAVE_VERSION=`expr $1 \* 10000 + $2 \* 100 + $3`
  1452. if test $HAVE_VERSION -ge $NEED_VERSION; then
  1453. DIRECTFB_CFLAGS=`$DIRECTFBCONFIG --cflags`
  1454. DIRECTFB_LIBS=`$DIRECTFBCONFIG --libs`
  1455. DIRECTFB_PREFIX=`$DIRECTFBCONFIG --prefix`
  1456. video_directfb=yes
  1457. fi
  1458. fi
  1459. if test x$video_directfb = xyes; then
  1460. # SuSE 11.1 installs directfb-config without directfb-devel
  1461. save_CPPFLAGS="$CPPFLAGS"
  1462. CPPFLAGS="$CPPFLAGS $DIRECTFB_CFLAGS"
  1463. AC_CHECK_HEADER(directfb.h, have_directfb_hdr=yes, have_directfb_hdr=no)
  1464. CPPFLAGS="$save_CPPFLAGS"
  1465. video_directfb=$have_directfb_hdr
  1466. fi
  1467. AC_MSG_CHECKING(for DirectFB $DIRECTFB_REQUIRED_VERSION support)
  1468. AC_MSG_RESULT($video_directfb)
  1469. if test x$video_directfb = xyes; then
  1470. AC_ARG_ENABLE(directfb-shared,
  1471. AC_HELP_STRING([--enable-directfb-shared], [dynamically load directfb support [[default=yes]]]),
  1472. , enable_directfb_shared=yes)
  1473. AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB, 1, [ ])
  1474. AC_DEFINE(SDL_VIDEO_RENDER_DIRECTFB, 1, [ ])
  1475. SOURCES="$SOURCES $srcdir/src/video/directfb/*.c"
  1476. EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS"
  1477. AC_MSG_CHECKING(for directfb dynamic loading support)
  1478. directfb_shared=no
  1479. directfb_lib=[`find_lib "libdirectfb.so.*" "$DIRECTFB_LIBS"`]
  1480. # | sed 's/.*\/\(.*\)/\1/; q'`]
  1481. AC_MSG_WARN("directfb $directfb_lib")
  1482. if test x$have_loadso != xyes && \
  1483. test x$enable_directfb_shared = xyes; then
  1484. AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic directfb loading])
  1485. fi
  1486. if test x$have_loadso = xyes && \
  1487. test x$enable_directfb_shared = xyes && test x$directfb_lib != x; then
  1488. directfb_shared=yes
  1489. echo "-- $directfb_lib_spec -> $directfb_lib"
  1490. AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC, "$directfb_lib", [ ])
  1491. else
  1492. EXTRA_LDFLAGS="$EXTRA_LDFLAGS $DIRECTFB_LIBS"
  1493. fi
  1494. AC_MSG_RESULT($directfb_shared)
  1495. have_video=yes
  1496. fi
  1497. fi
  1498. }
  1499. dnl Find FusionSound
  1500. CheckFusionSound()
  1501. {
  1502. AC_ARG_ENABLE(fusionsound,
  1503. AC_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [[default=no]]]),
  1504. , enable_fusionsound=no)
  1505. if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then
  1506. fusionsound=no
  1507. FUSIONSOUND_REQUIRED_VERSION=1.1.1
  1508. AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  1509. AC_MSG_CHECKING(for FusionSound $FUSIONSOUND_REQUIRED_VERSION support)
  1510. if test x$PKG_CONFIG != xno; then
  1511. if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then
  1512. FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound`
  1513. FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound`
  1514. fusionsound=yes
  1515. fi
  1516. fi
  1517. AC_MSG_RESULT($fusionsound)
  1518. if test x$fusionsound = xyes; then
  1519. AC_DEFINE(SDL_AUDIO_DRIVER_FUSIONSOUND, 1, [ ])
  1520. SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c"
  1521. EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS"
  1522. AC_ARG_ENABLE(fusionsound-shared,
  1523. AC_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audio support [[default=yes]]]),
  1524. , enable_fusionsound_shared=yes)
  1525. fusionsound_shared=no
  1526. AC_MSG_CHECKING(for FusionSound dynamic loading support)
  1527. if test x$have_loadso != xyes && \
  1528. test x$enable_fusionsound_shared = xyes; then
  1529. AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic fusionsound loading])
  1530. fi
  1531. if test x$have_loadso = xyes && \
  1532. test x$enable_fusionsound_shared = xyes; then
  1533. AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC, "libfusionsound.so", [ ])
  1534. fusionsound_shared=yes
  1535. else
  1536. EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS"
  1537. fi
  1538. AC_MSG_RESULT($fusionsound_shared)
  1539. have_audio=yes
  1540. fi
  1541. fi
  1542. }
  1543. dnl rcg04172001 Set up the Null video driver.
  1544. CheckDummyVideo()
  1545. {
  1546. AC_ARG_ENABLE(video-dummy,
  1547. AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]),
  1548. , enable_video_dummy=yes)
  1549. if test x$enable_video_dummy = xyes; then
  1550. AC_DEFINE(SDL_VIDEO_DRIVER_DUMMY, 1, [ ])
  1551. SOURCES="$SOURCES $srcdir/src/video/dummy/*.c"
  1552. have_video=yes
  1553. fi
  1554. }
  1555. dnl Check to see if OpenGL support is desired
  1556. AC_ARG_ENABLE(video-opengl,
  1557. AC_HELP_STRING([--enable-video-opengl], [include OpenGL support [[default=yes]]]),
  1558. , enable_video_opengl=yes)
  1559. dnl Find OpenGL
  1560. CheckOpenGLX11()
  1561. {
  1562. if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1563. AC_MSG_CHECKING(for OpenGL (GLX) support)
  1564. video_opengl=no
  1565. AC_TRY_COMPILE([
  1566. #include <GL/gl.h>
  1567. #include <GL/glx.h>
  1568. ],[
  1569. ],[
  1570. video_opengl=yes
  1571. ])
  1572. AC_MSG_RESULT($video_opengl)
  1573. if test x$video_opengl = xyes; then
  1574. AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  1575. AC_DEFINE(SDL_VIDEO_OPENGL_GLX, 1, [ ])
  1576. AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
  1577. fi
  1578. fi
  1579. }
  1580. dnl Check to see if OpenGL ES support is desired
  1581. AC_ARG_ENABLE(video-opengles,
  1582. AC_HELP_STRING([--enable-video-opengles], [include OpenGL ES support [[default=yes]]]),
  1583. , enable_video_opengles=yes)
  1584. dnl Find OpenGL ES
  1585. CheckOpenGLESX11()
  1586. {
  1587. if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
  1588. AC_MSG_CHECKING(for EGL support)
  1589. video_opengl_egl=no
  1590. AC_TRY_COMPILE([
  1591. #include <EGL/egl.h>
  1592. ],[
  1593. ],[
  1594. video_opengl_egl=yes
  1595. ])
  1596. AC_MSG_RESULT($video_opengl_egl)
  1597. if test x$video_opengl_egl = xyes; then
  1598. AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
  1599. fi
  1600. AC_MSG_CHECKING(for OpenGL ES v1 headers)
  1601. video_opengles_v1=no
  1602. AC_TRY_COMPILE([
  1603. #include <GLES/gl.h>
  1604. #include <GLES/glext.h>
  1605. ],[
  1606. ],[
  1607. video_opengles_v1=yes
  1608. ])
  1609. AC_MSG_RESULT($video_opengles_v1)
  1610. if test x$video_opengles_v1 = xyes; then
  1611. AC_DEFINE(SDL_VIDEO_OPENGL_ES, 1, [ ])
  1612. AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES, 1, [ ])
  1613. fi
  1614. AC_MSG_CHECKING(for OpenGL ES v2 headers)
  1615. video_opengles_v2=no
  1616. AC_TRY_COMPILE([
  1617. #include <GLES2/gl2.h>
  1618. #include <GLES2/gl2ext.h>
  1619. ],[
  1620. ],[
  1621. video_opengles_v2=yes
  1622. ])
  1623. AC_MSG_RESULT($video_opengles_v2)
  1624. if test x$video_opengles_v2 = xyes; then
  1625. AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
  1626. AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
  1627. fi
  1628. fi
  1629. }
  1630. dnl Check for Windows OpenGL
  1631. CheckWINDOWSGL()
  1632. {
  1633. if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1634. AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  1635. AC_DEFINE(SDL_VIDEO_OPENGL_WGL, 1, [ ])
  1636. AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
  1637. fi
  1638. }
  1639. dnl Check for Windows OpenGL
  1640. CheckWINDOWSGLES()
  1641. {
  1642. if test x$enable_video = xyes -a x$enable_video_opengles = xyes; then
  1643. AC_MSG_CHECKING(for EGL support)
  1644. video_opengl_egl=no
  1645. AC_TRY_COMPILE([
  1646. #include <EGL/egl.h>
  1647. ],[
  1648. ],[
  1649. video_opengl_egl=yes
  1650. ])
  1651. AC_MSG_RESULT($video_opengl_egl)
  1652. if test x$video_opengl_egl = xyes; then
  1653. AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  1654. AC_DEFINE(SDL_VIDEO_OPENGL_EGL, 1, [ ])
  1655. fi
  1656. AC_MSG_CHECKING(for OpenGL ES v2 headers)
  1657. video_opengles_v2=no
  1658. AC_TRY_COMPILE([
  1659. #include <GLES2/gl2.h>
  1660. #include <GLES2/gl2ext.h>
  1661. ],[
  1662. ],[
  1663. video_opengles_v2=yes
  1664. ])
  1665. AC_MSG_RESULT($video_opengles_v2)
  1666. if test x$video_opengles_v2 = xyes; then
  1667. AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  1668. AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ])
  1669. AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ])
  1670. fi
  1671. fi
  1672. }
  1673. dnl Check for Haiku OpenGL
  1674. CheckHaikuGL()
  1675. {
  1676. if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1677. AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  1678. AC_DEFINE(SDL_VIDEO_OPENGL_HAIKU, 1, [ ])
  1679. AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
  1680. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lGL"
  1681. fi
  1682. }
  1683. dnl Check for MacOS OpenGL
  1684. CheckMacGL()
  1685. {
  1686. if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then
  1687. AC_DEFINE(SDL_VIDEO_OPENGL, 1, [ ])
  1688. AC_DEFINE(SDL_VIDEO_OPENGL_CGL, 1, [ ])
  1689. AC_DEFINE(SDL_VIDEO_RENDER_OGL, 1, [ ])
  1690. case "$host" in
  1691. *-*-darwin*)
  1692. if test x$enable_video_cocoa = xyes; then
  1693. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGL"
  1694. fi
  1695. esac
  1696. fi
  1697. }
  1698. dnl See if we can use the new unified event interface in Linux 2.4
  1699. CheckInputEvents()
  1700. {
  1701. dnl Check for Linux 2.4 unified input event interface support
  1702. AC_MSG_CHECKING(for Linux 2.4 unified input interface)
  1703. use_input_events=no
  1704. AC_TRY_COMPILE([
  1705. #include <linux/input.h>
  1706. ],[
  1707. #ifndef EVIOCGNAME
  1708. #error EVIOCGNAME() ioctl not available
  1709. #endif
  1710. ],[
  1711. use_input_events=yes
  1712. ])
  1713. AC_MSG_RESULT($use_input_events)
  1714. if test x$use_input_events = xyes; then
  1715. AC_DEFINE(SDL_INPUT_LINUXEV, 1, [ ])
  1716. fi
  1717. }
  1718. dnl See if we can use the kernel kd.h header
  1719. CheckInputKD()
  1720. {
  1721. AC_MSG_CHECKING(for Linux kd.h)
  1722. use_input_kd=no
  1723. AC_TRY_COMPILE([
  1724. #include <linux/kd.h>
  1725. #include <linux/keyboard.h>
  1726. ],[
  1727. struct kbentry kbe;
  1728. kbe.kb_table = KG_CTRL;
  1729. ioctl(0, KDGKBENT, &kbe);
  1730. ],[
  1731. use_input_kd=yes
  1732. ])
  1733. AC_MSG_RESULT($use_input_kd)
  1734. if test x$use_input_kd = xyes; then
  1735. AC_DEFINE(SDL_INPUT_LINUXKD, 1, [ ])
  1736. fi
  1737. }
  1738. dnl See if the platform offers libudev for device enumeration and hotplugging.
  1739. CheckLibUDev()
  1740. {
  1741. AC_ARG_ENABLE(libudev,
  1742. AC_HELP_STRING([--enable-libudev], [enable libudev support [[default=yes]]]),
  1743. , enable_libudev=yes)
  1744. if test x$enable_libudev = xyes; then
  1745. AC_CHECK_HEADER(libudev.h,
  1746. have_libudev_h_hdr=yes,
  1747. have_libudev_h_hdr=no)
  1748. if test x$have_libudev_h_hdr = xyes; then
  1749. AC_DEFINE(HAVE_LIBUDEV_H, 1, [ ])
  1750. fi
  1751. fi
  1752. }
  1753. dnl See if the platform offers libdbus for various IPC techniques.
  1754. CheckDBus()
  1755. {
  1756. AC_ARG_ENABLE(dbus,
  1757. AC_HELP_STRING([--enable-dbus], [enable D-Bus support [[default=yes]]]),
  1758. , enable_dbus=yes)
  1759. if test x$enable_dbus = xyes; then
  1760. AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
  1761. if test x$PKG_CONFIG != xno; then
  1762. DBUS_CFLAGS=`$PKG_CONFIG --cflags dbus-1`
  1763. save_CFLAGS="$CFLAGS"
  1764. CFLAGS="$save_CFLAGS $DBUS_CFLAGS"
  1765. AC_CHECK_HEADER(dbus/dbus.h,
  1766. have_dbus_dbus_h_hdr=yes,
  1767. have_dbus_dbus_h_hdr=no)
  1768. CFLAGS="$save_CFLAGS"
  1769. if test x$have_dbus_dbus_h_hdr = xyes; then
  1770. AC_DEFINE(HAVE_DBUS_DBUS_H, 1, [ ])
  1771. EXTRA_CFLAGS="$EXTRA_CFLAGS $DBUS_CFLAGS"
  1772. fi
  1773. fi
  1774. fi
  1775. }
  1776. dnl See if we can use the Touchscreen input library
  1777. CheckTslib()
  1778. {
  1779. AC_ARG_ENABLE(input-tslib,
  1780. AC_HELP_STRING([--enable-input-tslib], [use the Touchscreen library for input [[default=yes]]]),
  1781. , enable_input_tslib=yes)
  1782. if test x$enable_input_tslib = xyes; then
  1783. AC_MSG_CHECKING(for Touchscreen library support)
  1784. enable_input_tslib=no
  1785. AC_TRY_COMPILE([
  1786. #include "tslib.h"
  1787. ],[
  1788. ],[
  1789. enable_input_tslib=yes
  1790. ])
  1791. AC_MSG_RESULT($enable_input_tslib)
  1792. if test x$enable_input_tslib = xyes; then
  1793. AC_DEFINE(SDL_INPUT_TSLIB, 1, [ ])
  1794. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lts"
  1795. fi
  1796. fi
  1797. }
  1798. dnl See what type of thread model to use on Linux and Solaris
  1799. CheckPTHREAD()
  1800. {
  1801. dnl Check for pthread support
  1802. AC_ARG_ENABLE(pthreads,
  1803. AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[default=yes]]]),
  1804. , enable_pthreads=yes)
  1805. dnl This is used on Linux for glibc binary compatibility (Doh!)
  1806. AC_ARG_ENABLE(pthread-sem,
  1807. AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]),
  1808. , enable_pthread_sem=yes)
  1809. case "$host" in
  1810. *-*-linux*|*-*-uclinux*)
  1811. pthread_cflags="-D_REENTRANT"
  1812. pthread_lib="-lpthread"
  1813. ;;
  1814. *-*-bsdi*)
  1815. pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1816. pthread_lib=""
  1817. ;;
  1818. *-*-darwin*)
  1819. pthread_cflags="-D_THREAD_SAFE"
  1820. # causes Carbon.p complaints?
  1821. # pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1822. ;;
  1823. *-*-freebsd*|*-*-dragonfly*)
  1824. pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1825. pthread_lib="-pthread"
  1826. ;;
  1827. *-*-netbsd*)
  1828. pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
  1829. pthread_lib="-lpthread"
  1830. ;;
  1831. *-*-openbsd*)
  1832. pthread_cflags="-D_REENTRANT"
  1833. pthread_lib="-pthread"
  1834. ;;
  1835. *-*-solaris2.9)
  1836. # From Solaris 9+, posix4's preferred name is rt.
  1837. pthread_cflags="-D_REENTRANT"
  1838. pthread_lib="-lpthread -lrt"
  1839. ;;
  1840. *-*-solaris2.10)
  1841. # Solaris 10+ merged pthread into libc.
  1842. pthread_cflags="-D_REENTRANT"
  1843. pthread_lib="-lrt"
  1844. ;;
  1845. *-*-solaris*)
  1846. # Solaris 11+ merged rt into libc.
  1847. pthread_cflags="-D_REENTRANT"
  1848. pthread_lib=""
  1849. ;;
  1850. *-*-sysv5*)
  1851. pthread_cflags="-D_REENTRANT -Kthread"
  1852. pthread_lib=""
  1853. ;;
  1854. *-*-aix*)
  1855. pthread_cflags="-D_REENTRANT -mthreads"
  1856. pthread_lib="-lpthread"
  1857. ;;
  1858. *-*-hpux11*)
  1859. pthread_cflags="-D_REENTRANT"
  1860. pthread_lib="-L/usr/lib -lpthread"
  1861. ;;
  1862. *-*-haiku*)
  1863. pthread_cflags="-D_REENTRANT"
  1864. pthread_lib=""
  1865. ;;
  1866. *)
  1867. pthread_cflags="-D_REENTRANT"
  1868. pthread_lib="-lpthread"
  1869. ;;
  1870. esac
  1871. if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then
  1872. # Save the original compiler flags and libraries
  1873. ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1874. # Add the pthread compiler flags and libraries
  1875. CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1876. # Check to see if we have pthread support on this system
  1877. AC_MSG_CHECKING(for pthreads)
  1878. use_pthreads=no
  1879. AC_TRY_LINK([
  1880. #include <pthread.h>
  1881. ],[
  1882. pthread_attr_t type;
  1883. pthread_attr_init(&type);
  1884. ],[
  1885. use_pthreads=yes
  1886. ])
  1887. AC_MSG_RESULT($use_pthreads)
  1888. # Restore the compiler flags and libraries
  1889. CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1890. # Do futher testing if we have pthread support...
  1891. if test x$use_pthreads = xyes; then
  1892. AC_DEFINE(SDL_THREAD_PTHREAD, 1, [ ])
  1893. EXTRA_CFLAGS="$EXTRA_CFLAGS $pthread_cflags"
  1894. EXTRA_LDFLAGS="$EXTRA_LDFLAGS $pthread_lib"
  1895. SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags"
  1896. SDL_LIBS="$SDL_LIBS $pthread_lib"
  1897. # Save the original compiler flags and libraries
  1898. ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS"
  1899. # Add the pthread compiler flags and libraries
  1900. CFLAGS="$CFLAGS $pthread_cflags"; LIBS="$LIBS $pthread_lib"
  1901. # Check to see if recursive mutexes are available
  1902. AC_MSG_CHECKING(for recursive mutexes)
  1903. has_recursive_mutexes=no
  1904. if test x$has_recursive_mutexes = xno; then
  1905. AC_TRY_COMPILE([
  1906. #include <pthread.h>
  1907. ],[
  1908. pthread_mutexattr_t attr;
  1909. pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
  1910. ],[
  1911. has_recursive_mutexes=yes
  1912. AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX, 1, [ ])
  1913. ])
  1914. fi
  1915. if test x$has_recursive_mutexes = xno; then
  1916. AC_TRY_COMPILE([
  1917. #include <pthread.h>
  1918. ],[
  1919. pthread_mutexattr_t attr;
  1920. pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
  1921. ],[
  1922. has_recursive_mutexes=yes
  1923. AC_DEFINE(SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP, 1, [ ])
  1924. ])
  1925. fi
  1926. AC_MSG_RESULT($has_recursive_mutexes)
  1927. # Check to see if pthread semaphore support is missing
  1928. if test x$enable_pthread_sem = xyes; then
  1929. AC_MSG_CHECKING(for pthread semaphores)
  1930. have_pthread_sem=no
  1931. AC_TRY_COMPILE([
  1932. #include <pthread.h>
  1933. #include <semaphore.h>
  1934. ],[
  1935. ],[
  1936. have_pthread_sem=yes
  1937. ])
  1938. AC_MSG_RESULT($have_pthread_sem)
  1939. fi
  1940. if test x$have_pthread_sem = xyes; then
  1941. AC_MSG_CHECKING(for sem_timedwait)
  1942. have_sem_timedwait=no
  1943. AC_TRY_LINK([
  1944. #include <pthread.h>
  1945. #include <semaphore.h>
  1946. ],[
  1947. sem_timedwait(NULL, NULL);
  1948. ],[
  1949. have_sem_timedwait=yes
  1950. AC_DEFINE(HAVE_SEM_TIMEDWAIT)
  1951. ])
  1952. AC_MSG_RESULT($have_sem_timedwait)
  1953. fi
  1954. AC_MSG_CHECKING(for pthread_spin_trylock)
  1955. AC_TRY_LINK_FUNC(pthread_spin_trylock, [
  1956. has_pthread_spin_trylock=yes
  1957. AC_DEFINE(HAVE_PTHREAD_SPINLOCK, 1, [ ])
  1958. ],[
  1959. has_pthread_spin_trylock=no
  1960. ])
  1961. AC_MSG_RESULT($has_pthread_spin_trylock)
  1962. AC_CHECK_HEADER(pthread_np.h, have_pthread_np_h=yes, have_pthread_np_h=no, [ #include <pthread.h> ])
  1963. if test x$have_pthread_np_h = xyes; then
  1964. AC_DEFINE(HAVE_PTHREAD_NP_H, 1, [ ])
  1965. fi
  1966. # Check to see if pthread naming is available
  1967. AC_MSG_CHECKING(for pthread_setname_np)
  1968. AC_TRY_LINK_FUNC(pthread_setname_np, [
  1969. has_pthread_setname_np=yes
  1970. AC_DEFINE(HAVE_PTHREAD_SETNAME_NP, 1, [ ])
  1971. ],[
  1972. has_pthread_setname_np=no
  1973. ])
  1974. AC_MSG_RESULT($has_pthread_setname_np)
  1975. AC_MSG_CHECKING(for pthread_set_name_np)
  1976. AC_TRY_LINK_FUNC(pthread_set_name_np, [
  1977. has_pthread_set_name_np=yes
  1978. AC_DEFINE(HAVE_PTHREAD_SET_NAME_NP, 1, [ ])
  1979. ],[
  1980. has_pthread_set_name_np=no
  1981. ])
  1982. AC_MSG_RESULT($has_pthread_set_name_np)
  1983. # Restore the compiler flags and libraries
  1984. CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs"
  1985. # Basic thread creation functions
  1986. SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systhread.c"
  1987. # Semaphores
  1988. # We can fake these with mutexes and condition variables if necessary
  1989. if test x$have_pthread_sem = xyes; then
  1990. SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syssem.c"
  1991. else
  1992. SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syssem.c"
  1993. fi
  1994. # Mutexes
  1995. # We can fake these with semaphores if necessary
  1996. SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_sysmutex.c"
  1997. # Condition variables
  1998. # We can fake these with semaphores and mutexes if necessary
  1999. SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_syscond.c"
  2000. # Thread local storage
  2001. SOURCES="$SOURCES $srcdir/src/thread/pthread/SDL_systls.c"
  2002. have_threads=yes
  2003. fi
  2004. fi
  2005. }
  2006. dnl Determine whether the compiler can produce Windows executables
  2007. CheckWINDOWS()
  2008. {
  2009. AC_MSG_CHECKING(Windows compiler)
  2010. have_win32_gcc=no
  2011. AC_TRY_COMPILE([
  2012. #include <windows.h>
  2013. ],[
  2014. ],[
  2015. have_win32_gcc=yes
  2016. ])
  2017. AC_MSG_RESULT($have_win32_gcc)
  2018. if test x$have_win32_gcc != xyes; then
  2019. AC_MSG_ERROR([
  2020. *** Your compiler ($CC) does not produce Windows executables!
  2021. ])
  2022. fi
  2023. AC_MSG_CHECKING(Windows CE)
  2024. have_wince=no
  2025. AC_TRY_COMPILE([
  2026. #if !defined(_WIN32_WCE) && !defined(__MINGW32CE__)
  2027. #error This is not Windows CE
  2028. #endif
  2029. ],[
  2030. ],[
  2031. have_wince=yes
  2032. AC_MSG_ERROR([
  2033. *** Sorry, Windows CE is no longer supported.
  2034. ])
  2035. ])
  2036. AC_MSG_RESULT($have_wince)
  2037. # This fixes Windows stack alignment with newer GCC
  2038. CheckStackBoundary
  2039. }
  2040. dnl Find the DirectX includes and libraries
  2041. CheckDIRECTX()
  2042. {
  2043. AC_ARG_ENABLE(directx,
  2044. AC_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [[default=yes]]]),
  2045. , enable_directx=yes)
  2046. if test x$enable_directx = xyes; then
  2047. AC_CHECK_HEADER(d3d9.h, have_d3d=yes)
  2048. AC_CHECK_HEADER(ddraw.h, have_ddraw=yes)
  2049. AC_CHECK_HEADER(dsound.h, have_dsound=yes)
  2050. AC_CHECK_HEADER(dinput.h, have_dinput=yes)
  2051. AC_CHECK_HEADER(xaudio2.h, have_xaudio2=yes)
  2052. # FIXME: latest Cygwin finds dinput headers, but we die on other win32 headers.
  2053. # FIXME: ...so force it off for now.
  2054. case "$host" in
  2055. *-*-cygwin*)
  2056. have_dinput=false
  2057. ;;
  2058. esac
  2059. fi
  2060. }
  2061. dnl Check for the dlfcn.h interface for dynamically loading objects
  2062. CheckDLOPEN()
  2063. {
  2064. AC_ARG_ENABLE(sdl-dlopen,
  2065. AC_HELP_STRING([--enable-sdl-dlopen], [use dlopen for shared object loading [[default=yes]]]),
  2066. , enable_sdl_dlopen=yes)
  2067. if test x$enable_sdl_dlopen = xyes; then
  2068. AC_MSG_CHECKING(for dlopen)
  2069. have_dlopen=no
  2070. AC_TRY_COMPILE([
  2071. #include <dlfcn.h>
  2072. ],[
  2073. void *handle = dlopen("", RTLD_NOW);
  2074. const char *loaderror = (char *) dlerror();
  2075. ],[
  2076. have_dlopen=yes
  2077. ])
  2078. AC_MSG_RESULT($have_dlopen)
  2079. if test x$have_dlopen = xyes; then
  2080. AC_CHECK_LIB(c, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS",
  2081. AC_CHECK_LIB(dl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl",
  2082. AC_CHECK_LIB(ltdl, dlopen, EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lltdl")))
  2083. AC_DEFINE(SDL_LOADSO_DLOPEN, 1, [ ])
  2084. SOURCES="$SOURCES $srcdir/src/loadso/dlopen/*.c"
  2085. have_loadso=yes
  2086. fi
  2087. fi
  2088. }
  2089. dnl Check for the usbhid(3) library on *BSD
  2090. CheckUSBHID()
  2091. {
  2092. case "$host" in
  2093. *-*-*bsd*)
  2094. if test x$enable_joystick = xyes; then
  2095. AC_CHECK_LIB(usbhid, hid_init, have_libusbhid=yes)
  2096. if test x$have_libusbhid = xyes; then
  2097. AC_CHECK_HEADER(usbhid.h, [USB_CFLAGS="-DHAVE_USBHID_H"])
  2098. AC_CHECK_HEADER(libusbhid.h, [USB_CFLAGS="-DHAVE_LIBUSBHID_H"])
  2099. USB_LIBS="$USB_LIBS -lusbhid"
  2100. else
  2101. AC_CHECK_HEADER(usb.h, [USB_CFLAGS="-DHAVE_USB_H"])
  2102. AC_CHECK_HEADER(libusb.h, [USB_CFLAGS="-DHAVE_LIBUSB_H"])
  2103. AC_CHECK_LIB(usb, hid_init, [USB_LIBS="$USB_LIBS -lusb"])
  2104. fi
  2105. save_CFLAGS="$CFLAGS"
  2106. CFLAGS="$CFLAGS $USB_CFLAGS"
  2107. AC_MSG_CHECKING(for usbhid)
  2108. have_usbhid=no
  2109. AC_TRY_COMPILE([
  2110. #include <sys/types.h>
  2111. #if defined(HAVE_USB_H)
  2112. #include <usb.h>
  2113. #endif
  2114. #ifdef __DragonFly__
  2115. # include <bus/usb/usb.h>
  2116. # include <bus/usb/usbhid.h>
  2117. #else
  2118. # include <dev/usb/usb.h>
  2119. # include <dev/usb/usbhid.h>
  2120. #endif
  2121. #if defined(HAVE_USBHID_H)
  2122. #include <usbhid.h>
  2123. #elif defined(HAVE_LIBUSB_H)
  2124. #include <libusb.h>
  2125. #elif defined(HAVE_LIBUSBHID_H)
  2126. #include <libusbhid.h>
  2127. #endif
  2128. ],[
  2129. struct report_desc *repdesc;
  2130. struct usb_ctl_report *repbuf;
  2131. hid_kind_t hidkind;
  2132. ],[
  2133. have_usbhid=yes
  2134. ])
  2135. AC_MSG_RESULT($have_usbhid)
  2136. if test x$have_usbhid = xyes; then
  2137. AC_MSG_CHECKING(for ucr_data member of usb_ctl_report)
  2138. have_usbhid_ucr_data=no
  2139. AC_TRY_COMPILE([
  2140. #include <sys/types.h>
  2141. #if defined(HAVE_USB_H)
  2142. #include <usb.h>
  2143. #endif
  2144. #ifdef __DragonFly__
  2145. # include <bus/usb/usb.h>
  2146. # include <bus/usb/usbhid.h>
  2147. #else
  2148. # include <dev/usb/usb.h>
  2149. # include <dev/usb/usbhid.h>
  2150. #endif
  2151. #if defined(HAVE_USBHID_H)
  2152. #include <usbhid.h>
  2153. #elif defined(HAVE_LIBUSB_H)
  2154. #include <libusb.h>
  2155. #elif defined(HAVE_LIBUSBHID_H)
  2156. #include <libusbhid.h>
  2157. #endif
  2158. ],[
  2159. struct usb_ctl_report buf;
  2160. if (buf.ucr_data) { }
  2161. ],[
  2162. have_usbhid_ucr_data=yes
  2163. ])
  2164. if test x$have_usbhid_ucr_data = xyes; then
  2165. USB_CFLAGS="$USB_CFLAGS -DUSBHID_UCR_DATA"
  2166. fi
  2167. AC_MSG_RESULT($have_usbhid_ucr_data)
  2168. AC_MSG_CHECKING(for new usbhid API)
  2169. have_usbhid_new=no
  2170. AC_TRY_COMPILE([
  2171. #include <sys/types.h>
  2172. #if defined(HAVE_USB_H)
  2173. #include <usb.h>
  2174. #endif
  2175. #ifdef __DragonFly__
  2176. #include <bus/usb/usb.h>
  2177. #include <bus/usb/usbhid.h>
  2178. #else
  2179. #include <dev/usb/usb.h>
  2180. #include <dev/usb/usbhid.h>
  2181. #endif
  2182. #if defined(HAVE_USBHID_H)
  2183. #include <usbhid.h>
  2184. #elif defined(HAVE_LIBUSB_H)
  2185. #include <libusb.h>
  2186. #elif defined(HAVE_LIBUSBHID_H)
  2187. #include <libusbhid.h>
  2188. #endif
  2189. ],[
  2190. report_desc_t d;
  2191. hid_start_parse(d, 1, 1);
  2192. ],[
  2193. have_usbhid_new=yes
  2194. ])
  2195. if test x$have_usbhid_new = xyes; then
  2196. USB_CFLAGS="$USB_CFLAGS -DUSBHID_NEW"
  2197. fi
  2198. AC_MSG_RESULT($have_usbhid_new)
  2199. AC_MSG_CHECKING(for struct joystick in machine/joystick.h)
  2200. have_machine_joystick=no
  2201. AC_TRY_COMPILE([
  2202. #include <machine/joystick.h>
  2203. ],[
  2204. struct joystick t;
  2205. ],[
  2206. have_machine_joystick=yes
  2207. ])
  2208. if test x$have_machine_joystick = xyes; then
  2209. AC_DEFINE(SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H, 1, [ ])
  2210. fi
  2211. AC_MSG_RESULT($have_machine_joystick)
  2212. AC_DEFINE(SDL_JOYSTICK_USBHID, 1, [ ])
  2213. SOURCES="$SOURCES $srcdir/src/joystick/bsd/*.c"
  2214. EXTRA_CFLAGS="$EXTRA_CFLAGS $USB_CFLAGS"
  2215. EXTRA_LDFLAGS="$EXTRA_LDFLAGS $USB_LIBS"
  2216. have_joystick=yes
  2217. fi
  2218. CFLAGS="$save_CFLAGS"
  2219. fi
  2220. ;;
  2221. esac
  2222. }
  2223. dnl Check for clock_gettime()
  2224. CheckClockGettime()
  2225. {
  2226. AC_ARG_ENABLE(clock_gettime,
  2227. AC_HELP_STRING([--enable-clock_gettime], [use clock_gettime() instead of gettimeofday() on UNIX [[default=yes]]]),
  2228. , enable_clock_gettime=yes)
  2229. if test x$enable_clock_gettime = xyes; then
  2230. AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=yes)
  2231. if test x$have_clock_gettime = xyes; then
  2232. AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ ])
  2233. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lrt"
  2234. else
  2235. AC_CHECK_LIB(c, clock_gettime, have_clock_gettime=yes)
  2236. if test x$have_clock_gettime = xyes; then
  2237. AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [ ])
  2238. EXTRA_LDFLAGS="$EXTRA_LDFLAGS"
  2239. fi
  2240. fi
  2241. fi
  2242. }
  2243. dnl Check for a valid linux/version.h
  2244. CheckLinuxVersion()
  2245. {
  2246. AC_CHECK_HEADER(linux/version.h, have_linux_version_h=yes)
  2247. if test x$have_linux_version_h = xyes; then
  2248. EXTRA_CFLAGS="$EXTRA_CFLAGS -DHAVE_LINUX_VERSION_H"
  2249. fi
  2250. }
  2251. dnl Check if we want to use RPATH
  2252. CheckRPATH()
  2253. {
  2254. AC_ARG_ENABLE(rpath,
  2255. AC_HELP_STRING([--enable-rpath], [use an rpath when linking SDL [[default=yes]]]),
  2256. , enable_rpath=yes)
  2257. }
  2258. dnl Set up the configuration based on the host platform!
  2259. case "$host" in
  2260. *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*)
  2261. case "$host" in
  2262. *-raspberry-linux*)
  2263. # Raspberry Pi
  2264. ARCH=linux
  2265. RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
  2266. CFLAGS="$CFLAGS $RPI_CFLAGS"
  2267. SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS"
  2268. EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS"
  2269. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L/opt/vc/lib -lbcm_host -ldl"
  2270. if test x$enable_video = xyes; then
  2271. SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c"
  2272. $as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h
  2273. fi
  2274. ;;
  2275. *-*-linux*) ARCH=linux ;;
  2276. *-*-uclinux*) ARCH=linux ;;
  2277. *-*-kfreebsd*-gnu) ARCH=kfreebsd-gnu ;;
  2278. *-*-knetbsd*-gnu) ARCH=knetbsd-gnu ;;
  2279. *-*-kopenbsd*-gnu) ARCH=kopenbsd-gnu ;;
  2280. *-*-gnu*) ARCH=gnu ;; # must be last of the gnu variants
  2281. *-*-bsdi*) ARCH=bsdi ;;
  2282. *-*-freebsd*) ARCH=freebsd ;;
  2283. *-*-dragonfly*) ARCH=freebsd ;;
  2284. *-*-netbsd*) ARCH=netbsd ;;
  2285. *-*-openbsd*) ARCH=openbsd ;;
  2286. *-*-sysv5*) ARCH=sysv5 ;;
  2287. *-*-solaris*) ARCH=solaris ;;
  2288. *-*-hpux*) ARCH=hpux ;;
  2289. *-*-aix*) ARCH=aix ;;
  2290. *-*-minix*) ARCH=minix ;;
  2291. esac
  2292. CheckVisibilityHidden
  2293. CheckDummyVideo
  2294. CheckDiskAudio
  2295. CheckDummyAudio
  2296. CheckDLOPEN
  2297. CheckOSS
  2298. CheckALSA
  2299. CheckPulseAudio
  2300. CheckARTSC
  2301. CheckESD
  2302. CheckNAS
  2303. CheckSNDIO
  2304. CheckX11
  2305. CheckWayland
  2306. CheckDirectFB
  2307. CheckFusionSound
  2308. CheckOpenGLX11
  2309. CheckOpenGLESX11
  2310. CheckLibUDev
  2311. CheckDBus
  2312. CheckInputEvents
  2313. CheckInputKD
  2314. CheckTslib
  2315. CheckUSBHID
  2316. CheckPTHREAD
  2317. CheckClockGettime
  2318. CheckLinuxVersion
  2319. CheckRPATH
  2320. # Set up files for the audio library
  2321. if test x$enable_audio = xyes; then
  2322. case $ARCH in
  2323. sysv5|solaris|hpux)
  2324. AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO, 1, [ ])
  2325. SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
  2326. have_audio=yes
  2327. ;;
  2328. netbsd) # Don't use this on OpenBSD, it's busted.
  2329. AC_DEFINE(SDL_AUDIO_DRIVER_BSD, 1, [ ])
  2330. SOURCES="$SOURCES $srcdir/src/audio/bsd/*.c"
  2331. have_audio=yes
  2332. ;;
  2333. aix)
  2334. AC_DEFINE(SDL_AUDIO_DRIVER_PAUDIO, 1, [ ])
  2335. SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
  2336. have_audio=yes
  2337. ;;
  2338. esac
  2339. fi
  2340. # Set up files for the joystick library
  2341. if test x$enable_joystick = xyes; then
  2342. case $ARCH in
  2343. linux)
  2344. AC_DEFINE(SDL_JOYSTICK_LINUX, 1, [ ])
  2345. SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
  2346. have_joystick=yes
  2347. ;;
  2348. esac
  2349. fi
  2350. # Set up files for the haptic library
  2351. if test x$enable_haptic = xyes; then
  2352. if test x$use_input_events = xyes; then
  2353. case $ARCH in
  2354. linux)
  2355. AC_DEFINE(SDL_HAPTIC_LINUX, 1, [ ])
  2356. SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c"
  2357. have_haptic=yes
  2358. ;;
  2359. esac
  2360. fi
  2361. fi
  2362. # Set up files for the power library
  2363. if test x$enable_power = xyes; then
  2364. case $ARCH in
  2365. linux)
  2366. AC_DEFINE(SDL_POWER_LINUX, 1, [ ])
  2367. SOURCES="$SOURCES $srcdir/src/power/linux/*.c"
  2368. have_power=yes
  2369. ;;
  2370. esac
  2371. fi
  2372. # Set up files for the filesystem library
  2373. if test x$enable_filesystem = xyes; then
  2374. AC_DEFINE(SDL_FILESYSTEM_UNIX, 1, [ ])
  2375. SOURCES="$SOURCES $srcdir/src/filesystem/unix/*.c"
  2376. have_filesystem=yes
  2377. fi
  2378. # Set up files for the timer library
  2379. if test x$enable_timers = xyes; then
  2380. AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
  2381. SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2382. have_timers=yes
  2383. fi
  2384. # Set up files for udev hotplugging support
  2385. if test x$enable_libudev = xyes && test x$have_libudev_h_hdr = xyes; then
  2386. SOURCES="$SOURCES $srcdir/src/core/linux/SDL_udev.c"
  2387. fi
  2388. # Set up files for evdev input
  2389. if test x$use_input_events = xyes; then
  2390. SOURCES="$SOURCES $srcdir/src/core/linux/SDL_evdev.c"
  2391. fi
  2392. ;;
  2393. *-*-cygwin* | *-*-mingw32*)
  2394. ARCH=win32
  2395. if test "$build" != "$host"; then # cross-compiling
  2396. # Default cross-compile location
  2397. ac_default_prefix=/usr/local/cross-tools/$host
  2398. else
  2399. # Look for the location of the tools and install there
  2400. if test "$BUILD_PREFIX" != ""; then
  2401. ac_default_prefix=$BUILD_PREFIX
  2402. fi
  2403. fi
  2404. CheckDummyVideo
  2405. CheckDiskAudio
  2406. CheckDummyAudio
  2407. CheckWINDOWS
  2408. CheckWINDOWSGL
  2409. CheckWINDOWSGLES
  2410. CheckDIRECTX
  2411. # Set up the core platform files
  2412. SOURCES="$SOURCES $srcdir/src/core/windows/*.c"
  2413. # Set up files for the video library
  2414. if test x$enable_video = xyes; then
  2415. AC_DEFINE(SDL_VIDEO_DRIVER_WINDOWS, 1, [ ])
  2416. SOURCES="$SOURCES $srcdir/src/video/windows/*.c"
  2417. have_video=yes
  2418. AC_ARG_ENABLE(render-d3d,
  2419. AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[default=yes]]]),
  2420. , enable_render_d3d=yes)
  2421. if test x$enable_render_d3d = xyes -a x$have_d3d = xyes; then
  2422. AC_DEFINE(SDL_VIDEO_RENDER_D3D, 1, [ ])
  2423. fi
  2424. fi
  2425. # Set up files for the audio library
  2426. if test x$enable_audio = xyes; then
  2427. AC_DEFINE(SDL_AUDIO_DRIVER_WINMM, 1, [ ])
  2428. SOURCES="$SOURCES $srcdir/src/audio/winmm/*.c"
  2429. if test x$have_dsound = xyes; then
  2430. AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND, 1, [ ])
  2431. SOURCES="$SOURCES $srcdir/src/audio/directsound/*.c"
  2432. fi
  2433. if test x$have_xaudio2 = xyes; then
  2434. AC_DEFINE(SDL_AUDIO_DRIVER_XAUDIO2, 1, [ ])
  2435. SOURCES="$SOURCES $srcdir/src/audio/xaudio2/*.c"
  2436. fi
  2437. have_audio=yes
  2438. fi
  2439. # Set up files for the joystick library
  2440. if test x$enable_joystick = xyes; then
  2441. if test x$have_dinput = xyes; then
  2442. AC_DEFINE(SDL_JOYSTICK_DINPUT, 1, [ ])
  2443. SOURCES="$SOURCES $srcdir/src/joystick/windows/SDL_dxjoystick.c"
  2444. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid -ldxerr8"
  2445. else
  2446. AC_DEFINE(SDL_JOYSTICK_WINMM, 1, [ ])
  2447. SOURCES="$SOURCES $srcdir/src/joystick/windows/SDL_mmjoystick.c"
  2448. fi
  2449. have_joystick=yes
  2450. fi
  2451. if test x$enable_haptic = xyes; then
  2452. if test x$have_dinput = xyes; then
  2453. AC_DEFINE(SDL_HAPTIC_DINPUT, 1, [ ])
  2454. SOURCES="$SOURCES $srcdir/src/haptic/windows/SDL_syshaptic.c"
  2455. have_haptic=yes
  2456. fi
  2457. fi
  2458. if test x$enable_power = xyes; then
  2459. AC_DEFINE(SDL_POWER_WINDOWS, 1, [ ])
  2460. SOURCES="$SOURCES $srcdir/src/power/windows/SDL_syspower.c"
  2461. have_power=yes
  2462. fi
  2463. if test x$enable_filesystem = xyes; then
  2464. AC_DEFINE(SDL_FILESYSTEM_WINDOWS, 1, [ ])
  2465. SOURCES="$SOURCES $srcdir/src/filesystem/windows/SDL_sysfilesystem.c"
  2466. have_filesystem=yes
  2467. fi
  2468. # Set up files for the thread library
  2469. if test x$enable_threads = xyes; then
  2470. AC_DEFINE(SDL_THREAD_WINDOWS, 1, [ ])
  2471. SOURCES="$SOURCES $srcdir/src/thread/windows/*.c"
  2472. SOURCES="$SOURCES $srcdir/src/thread/generic/SDL_syscond.c"
  2473. have_threads=yes
  2474. fi
  2475. # Set up files for the timer library
  2476. if test x$enable_timers = xyes; then
  2477. AC_DEFINE(SDL_TIMER_WINDOWS, 1, [ ])
  2478. SOURCES="$SOURCES $srcdir/src/timer/windows/*.c"
  2479. have_timers=yes
  2480. fi
  2481. # Set up files for the shared object loading library
  2482. if test x$enable_loadso = xyes; then
  2483. AC_DEFINE(SDL_LOADSO_WINDOWS, 1, [ ])
  2484. SOURCES="$SOURCES $srcdir/src/loadso/windows/*.c"
  2485. have_loadso=yes
  2486. fi
  2487. # Set up the system libraries we need
  2488. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lversion -luuid -XCClinker -static-libgcc"
  2489. # The Windows platform requires special setup
  2490. VERSION_SOURCES="$srcdir/src/main/windows/*.rc"
  2491. SDLMAIN_SOURCES="$srcdir/src/main/windows/*.c"
  2492. SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main"
  2493. SDL_LIBS="-lSDL2main $SDL_LIBS -mwindows"
  2494. # Check to see if this is a mingw or cygwin build
  2495. have_mingw32=
  2496. AC_CHECK_LIB(mingw32, main, [have_mingw32=yes])
  2497. if test x$have_mingw32 = xyes; then
  2498. SDL_LIBS="-lmingw32 $SDL_LIBS"
  2499. else
  2500. SDL_LIBS="-lcygwin $SDL_LIBS"
  2501. fi
  2502. ;;
  2503. dnl BeOS support removed after SDL 2.0.1. Haiku still works. --ryan.
  2504. *-*-beos*)
  2505. AC_MSG_ERROR([
  2506. *** BeOS support has been removed as of SDL 2.0.2.
  2507. ])
  2508. ;;
  2509. *-*-haiku*)
  2510. ARCH=haiku
  2511. ac_default_prefix=/boot/system
  2512. CheckDummyVideo
  2513. CheckDiskAudio
  2514. CheckDummyAudio
  2515. CheckHaikuVideo
  2516. CheckHaikuGL
  2517. CheckPTHREAD
  2518. # Set up files for the audio library
  2519. if test x$enable_audio = xyes; then
  2520. AC_DEFINE(SDL_AUDIO_DRIVER_HAIKU, 1, [ ])
  2521. SOURCES="$SOURCES $srcdir/src/audio/haiku/*.cc"
  2522. have_audio=yes
  2523. fi
  2524. # Set up files for the joystick library
  2525. if test x$enable_joystick = xyes; then
  2526. AC_DEFINE(SDL_JOYSTICK_HAIKU, 1, [ ])
  2527. SOURCES="$SOURCES $srcdir/src/joystick/haiku/*.cc"
  2528. have_joystick=yes
  2529. fi
  2530. # Set up files for the timer library
  2531. if test x$enable_timers = xyes; then
  2532. AC_DEFINE(SDL_TIMER_HAIKU, 1, [ ])
  2533. SOURCES="$SOURCES $srcdir/src/timer/haiku/*.c"
  2534. have_timers=yes
  2535. fi
  2536. # Set up files for the shared object loading library
  2537. if test x$enable_loadso = xyes; then
  2538. AC_DEFINE(SDL_LOADSO_HAIKU, 1, [ ])
  2539. SOURCES="$SOURCES $srcdir/src/loadso/haiku/*.c"
  2540. have_loadso=yes
  2541. fi
  2542. # Set up files for the system power library
  2543. if test x$enable_power = xyes; then
  2544. AC_DEFINE(SDL_POWER_HAIKU, 1, [ ])
  2545. SOURCES="$SOURCES $srcdir/src/power/haiku/*.c"
  2546. have_power=yes
  2547. fi
  2548. # Set up files for the system filesystem library
  2549. if test x$enable_filesystem = xyes; then
  2550. AC_DEFINE(SDL_FILESYSTEM_HAIKU, 1, [ ])
  2551. SOURCES="$SOURCES $srcdir/src/filesystem/haiku/*.cc"
  2552. have_filesystem=yes
  2553. fi
  2554. # The Haiku platform requires special setup.
  2555. SOURCES="$srcdir/src/main/haiku/*.cc $SOURCES"
  2556. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding"
  2557. ;;
  2558. arm*-apple-darwin*)
  2559. # iOS - We are not writing anything to confdefs.h because you have to replace
  2560. # SDL_config.h for SDL_config_iphoneos.h anyway
  2561. ARCH=ios
  2562. CheckVisibilityHidden
  2563. CheckDummyVideo
  2564. CheckDiskAudio
  2565. CheckDummyAudio
  2566. CheckDLOPEN
  2567. CheckCOCOA
  2568. CheckPTHREAD
  2569. # Set up files for the audio library
  2570. if test x$enable_audio = xyes; then
  2571. SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.c"
  2572. have_audio=yes
  2573. fi
  2574. # Set up files for the joystick library
  2575. if test x$enable_joystick = xyes; then
  2576. SOURCES="$SOURCES $srcdir/src/joystick/iphoneos/*.m"
  2577. have_joystick=yes
  2578. fi
  2579. # Set up files for the haptic library
  2580. #if test x$enable_haptic = xyes; then
  2581. # SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
  2582. # have_haptic=yes
  2583. # EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
  2584. #fi
  2585. # Set up files for the power library
  2586. if test x$enable_power = xyes; then
  2587. SOURCES="$SOURCES $srcdir/src/power/uikit/*.m"
  2588. have_power=yes
  2589. fi
  2590. # Set up files for the filesystem library
  2591. if test x$enable_filesystem = xyes; then
  2592. SOURCES="$SOURCES $srcdir/src/filesystem/cocoa/*.m"
  2593. have_filesystem=yes
  2594. fi
  2595. # Set up files for the timer library
  2596. if test x$enable_timers = xyes; then
  2597. SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2598. have_timers=yes
  2599. fi
  2600. # Set up additional files for the file library
  2601. if test x$enable_file = xyes; then
  2602. SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m"
  2603. fi
  2604. # The iOS platform requires special setup.
  2605. SOURCES="$SOURCES $srcdir/src/video/uikit/*.m"
  2606. EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
  2607. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -liconv -lobjc"
  2608. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Foundation"
  2609. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,UIKit"
  2610. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGLES"
  2611. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuartzCore"
  2612. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio"
  2613. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox"
  2614. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreGraphics"
  2615. ;;
  2616. *-*-darwin* )
  2617. # This could be either full "Mac OS X", or plain "Darwin" which is
  2618. # just the OS X kernel sans upper layers like Carbon and Cocoa.
  2619. # Next line is broken, and a few files below require Mac OS X (full)
  2620. ARCH=macosx
  2621. # Mac OS X builds with both the Carbon and OSX APIs at the moment
  2622. EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_CARBON"
  2623. EXTRA_CFLAGS="$EXTRA_CFLAGS -DTARGET_API_MAC_OSX"
  2624. CheckVisibilityHidden
  2625. CheckDummyVideo
  2626. CheckDiskAudio
  2627. CheckDummyAudio
  2628. CheckDLOPEN
  2629. CheckCOCOA
  2630. CheckX11
  2631. CheckMacGL
  2632. CheckOpenGLX11
  2633. CheckPTHREAD
  2634. # Need this or things might misbuild on a G3.
  2635. EXTRA_CFLAGS="$EXTRA_CFLAGS -force_cpusubtype_ALL"
  2636. # Set up files for the audio library
  2637. if test x$enable_audio = xyes; then
  2638. AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ])
  2639. SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.c"
  2640. have_audio=yes
  2641. fi
  2642. # Set up files for the joystick library
  2643. if test x$enable_joystick = xyes; then
  2644. AC_DEFINE(SDL_JOYSTICK_IOKIT, 1, [ ])
  2645. SOURCES="$SOURCES $srcdir/src/joystick/darwin/*.c"
  2646. have_joystick=yes
  2647. fi
  2648. # Set up files for the haptic library
  2649. if test x$enable_haptic = xyes; then
  2650. AC_DEFINE(SDL_HAPTIC_IOKIT, 1, [ ])
  2651. SOURCES="$SOURCES $srcdir/src/haptic/darwin/*.c"
  2652. have_haptic=yes
  2653. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,ForceFeedback"
  2654. fi
  2655. # Set up files for the power library
  2656. if test x$enable_power = xyes; then
  2657. AC_DEFINE(SDL_POWER_MACOSX, 1, [ ])
  2658. SOURCES="$SOURCES $srcdir/src/power/macosx/*.c"
  2659. have_power=yes
  2660. fi
  2661. # Set up files for the filesystem library
  2662. if test x$enable_filesystem = xyes; then
  2663. AC_DEFINE(SDL_FILESYSTEM_COCOA, 1, [ ])
  2664. SOURCES="$SOURCES $srcdir/src/filesystem/cocoa/*.m"
  2665. have_filesystem=yes
  2666. fi
  2667. # Set up files for the timer library
  2668. if test x$enable_timers = xyes; then
  2669. AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
  2670. SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
  2671. have_timers=yes
  2672. fi
  2673. # Set up additional files for the file library
  2674. if test x$enable_file = xyes; then
  2675. SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m"
  2676. fi
  2677. # The Mac OS X platform requires special setup.
  2678. EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings"
  2679. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc"
  2680. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa"
  2681. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon"
  2682. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit"
  2683. # If audio is used, add the AudioUnit framework
  2684. if test x$enable_audio = xyes; then
  2685. EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio -Wl,-framework,AudioToolbox -Wl,-framework,AudioUnit"
  2686. fi
  2687. ;;
  2688. *)
  2689. AC_MSG_ERROR([
  2690. *** Unsupported host: Please add to configure.in
  2691. ])
  2692. ;;
  2693. esac
  2694. dnl Do this on all platforms, after everything else.
  2695. CheckWarnAll
  2696. # Verify that we have all the platform specific files we need
  2697. if test x$have_joystick != xyes; then
  2698. if test x$enable_joystick = xyes; then
  2699. AC_DEFINE(SDL_JOYSTICK_DISABLED, 1, [ ])
  2700. fi
  2701. SOURCES="$SOURCES $srcdir/src/joystick/dummy/*.c"
  2702. fi
  2703. if test x$have_haptic != xyes; then
  2704. if test x$enable_haptic = xyes; then
  2705. AC_DEFINE(SDL_HAPTIC_DISABLED, 1, [ ])
  2706. fi
  2707. SOURCES="$SOURCES $srcdir/src/haptic/dummy/*.c"
  2708. fi
  2709. if test x$have_threads != xyes; then
  2710. if test x$enable_threads = xyes; then
  2711. AC_DEFINE(SDL_THREADS_DISABLED, 1, [ ])
  2712. fi
  2713. SOURCES="$SOURCES $srcdir/src/thread/generic/*.c"
  2714. fi
  2715. if test x$have_timers != xyes; then
  2716. if test x$enable_timers = xyes; then
  2717. AC_DEFINE(SDL_TIMERS_DISABLED, 1, [ ])
  2718. fi
  2719. SOURCES="$SOURCES $srcdir/src/timer/dummy/*.c"
  2720. fi
  2721. if test x$have_filesystem != xyes; then
  2722. if test x$enable_filesystem = xyes; then
  2723. AC_DEFINE(SDL_FILESYSTEM_DISABLED, 1, [ ])
  2724. fi
  2725. SOURCES="$SOURCES $srcdir/src/filesystem/dummy/*.c"
  2726. fi
  2727. if test x$have_loadso != xyes; then
  2728. if test x$enable_loadso = xyes; then
  2729. AC_DEFINE(SDL_LOADSO_DISABLED, 1, [ ])
  2730. fi
  2731. SOURCES="$SOURCES $srcdir/src/loadso/dummy/*.c"
  2732. fi
  2733. if test x$SDLMAIN_SOURCES = x; then
  2734. SDLMAIN_SOURCES="$srcdir/src/main/dummy/*.c"
  2735. fi
  2736. SDLTEST_SOURCES="$srcdir/src/test/*.c"
  2737. OBJECTS=`echo $SOURCES`
  2738. DEPENDS=`echo $SOURCES | tr ' ' '\n'`
  2739. for EXT in asm cc m c S; do
  2740. OBJECTS=`echo "$OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.'$EXT',$(objects)/\1.lo,g'`
  2741. DEPENDS=`echo "$DEPENDS" | sed "s,^\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.$EXT\\$,\\\\
  2742. \\$(objects)/\\2.lo: \\1/\\2.$EXT\\\\
  2743. \\$(LIBTOOL) --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
  2744. done
  2745. VERSION_OBJECTS=`echo $VERSION_SOURCES`
  2746. VERSION_DEPENDS=`echo $VERSION_SOURCES`
  2747. VERSION_OBJECTS=`echo "$VERSION_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.rc,$(objects)/\1.o,g'`
  2748. VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.rc,\\\\
  2749. \\$(objects)/\\2.o: \\1/\\2.rc\\\\
  2750. \\$(WINDRES) \\$< \\$@,g"`
  2751. SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES`
  2752. SDLMAIN_DEPENDS=`echo $SDLMAIN_SOURCES`
  2753. SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
  2754. SDLMAIN_DEPENDS=`echo "$SDLMAIN_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\
  2755. \\$(objects)/\\2.o: \\1/\\2.c\\\\
  2756. \\$(LIBTOOL) --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
  2757. SDLTEST_OBJECTS=`echo $SDLTEST_SOURCES`
  2758. SDLTEST_DEPENDS=`echo $SDLTEST_SOURCES`
  2759. SDLTEST_OBJECTS=`echo "$SDLTEST_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'`
  2760. SDLTEST_DEPENDS=`echo "$SDLTEST_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\
  2761. \\$(objects)/\\2.o: \\1/\\2.c\\\\
  2762. \\$(LIBTOOL) --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"`
  2763. # Set runtime shared library paths as needed
  2764. if test "x$enable_rpath" = "xyes"; then
  2765. if test $ARCH = bsdi -o $ARCH = freebsd -o $ARCH = linux -o $ARCH = netbsd; then
  2766. SDL_RLD_FLAGS="-Wl,-rpath,\${libdir}"
  2767. fi
  2768. if test $ARCH = solaris; then
  2769. SDL_RLD_FLAGS="-R\${libdir}"
  2770. fi
  2771. else
  2772. SDL_RLD_FLAGS=""
  2773. fi
  2774. SDL_STATIC_LIBS="$SDL_LIBS $EXTRA_LDFLAGS"
  2775. dnl Expand the cflags and libraries needed by apps using SDL
  2776. AC_SUBST(SDL_CFLAGS)
  2777. AC_SUBST(SDL_LIBS)
  2778. AC_SUBST(SDL_STATIC_LIBS)
  2779. AC_SUBST(SDL_RLD_FLAGS)
  2780. if test x$enable_shared = xyes; then
  2781. ENABLE_SHARED_TRUE=
  2782. ENABLE_SHARED_FALSE="#"
  2783. else
  2784. ENABLE_SHARED_TRUE="#"
  2785. ENABLE_SHARED_FALSE=
  2786. fi
  2787. if test x$enable_static = xyes; then
  2788. ENABLE_STATIC_TRUE=
  2789. ENABLE_STATIC_FALSE="#"
  2790. else
  2791. ENABLE_STATIC_TRUE="#"
  2792. ENABLE_STATIC_FALSE=
  2793. fi
  2794. AC_SUBST(ENABLE_SHARED_TRUE)
  2795. AC_SUBST(ENABLE_SHARED_FALSE)
  2796. AC_SUBST(ENABLE_STATIC_TRUE)
  2797. AC_SUBST(ENABLE_STATIC_FALSE)
  2798. dnl Expand the sources and objects needed to build the library
  2799. AC_SUBST(ac_aux_dir)
  2800. AC_SUBST(INCLUDE)
  2801. AC_SUBST(OBJECTS)
  2802. AC_SUBST(VERSION_OBJECTS)
  2803. AC_SUBST(SDLMAIN_OBJECTS)
  2804. AC_SUBST(SDLTEST_OBJECTS)
  2805. AC_SUBST(BUILD_CFLAGS)
  2806. AC_SUBST(EXTRA_CFLAGS)
  2807. AC_SUBST(BUILD_LDFLAGS)
  2808. AC_SUBST(EXTRA_LDFLAGS)
  2809. AC_SUBST(WINDRES)
  2810. cat >Makefile.rules <<__EOF__
  2811. # Build rules for objects
  2812. -include \$(OBJECTS:.lo=.d)
  2813. # Special dependency for SDL.c, since it depends on SDL_revision.h
  2814. $srcdir/src/SDL.c: update-revision
  2815. $DEPENDS
  2816. $VERSION_DEPENDS
  2817. $SDLMAIN_DEPENDS
  2818. $SDLTEST_DEPENDS
  2819. __EOF__
  2820. AC_CONFIG_FILES([
  2821. Makefile:Makefile.in:Makefile.rules sdl2-config SDL2.spec sdl2.pc
  2822. ])
  2823. AC_OUTPUT
  2824. chmod a+x sdl2-config