configure.in 108 KB

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