config.sh 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299
  1. #!/bin/sh
  2. ### CONFIG.SH HELP TEXT #######################################################
  3. usage() {
  4. echo "usage: ./config.sh --platform [platform] <--prefix [dir]> <--sysconfdir [dir]>"
  5. echo " <--gamesdir [dir]> <--bindir [dir]>"
  6. echo " <--sharedir [dir]> <options..>"
  7. echo
  8. echo " --prefix Where dependencies should be found."
  9. echo " --sysconfdir Where the config should be read from."
  10. echo " --gamesdir Where binaries should be installed."
  11. echo " --libdir Where libraries should be installed."
  12. echo " --bindir Where utilities should be installed."
  13. echo " --sharedir Where resources should be installed."
  14. echo
  15. echo "Supported [platform] values:"
  16. echo
  17. echo " win32 Microsoft Windows (x86)"
  18. echo " win64 Microsoft Windows (x64)"
  19. echo " mingw32 Use MinGW32 on Linux, to build for win32"
  20. echo " mingw64 Use MinGW64 on Linux, to build for win64"
  21. echo " unix Unix-like / Linux / Solaris / BSD / Embedded"
  22. echo " unix-devel As above, but for running from current dir"
  23. echo " darwin Mac OS X Unix-like install"
  24. echo " darwin-devel Mac OS X running from current dir"
  25. echo " darwin-dist Mac OS X (PPC .app builds -- use Xcode for Intel)"
  26. echo " psp Experimental PSP port"
  27. echo " gp2x Experimental GP2X port"
  28. echo " nds Experimental NDS port"
  29. echo " 3ds Experimental 3DS port"
  30. echo " switch Experimental Switch port"
  31. echo " wii Experimental Wii port"
  32. echo " amiga Experimental AmigaOS 4 port"
  33. echo " android Experimental Android port"
  34. echo " pandora Experimental Pandora port"
  35. echo
  36. echo "Supported <option> values (negatives can be used):"
  37. echo
  38. echo " --as-needed-hack Pass --as-needed through to GNU ld."
  39. echo " --enable-release Optimize and remove debugging code."
  40. echo " --enable-verbose Build system is always verbose (V=1)."
  41. echo " --optimize-size Perform size optimizations (-Os)."
  42. echo " --disable-datestamp Disable adding date to version."
  43. echo " --disable-editor Disable the built-in editor."
  44. echo " --disable-mzxrun Disable generation of separate MZXRun."
  45. echo " --disable-helpsys Disable the built-in help system."
  46. echo " --disable-utils Disable compilation of utils."
  47. echo " --disable-x11 Disable X11, removing binary dependency."
  48. echo " --disable-software Disable software renderer."
  49. echo " --disable-softscale Disable SDL 2 accelerated software renderer."
  50. echo " --disable-gl Disable all GL renderers."
  51. echo " --disable-gl-fixed Disable GL renderers for fixed-function h/w."
  52. echo " --disable-gl-prog Disable GL renderers for programmable h/w."
  53. echo " --disable-overlay Disable SDL 1.2 overlay renderers."
  54. echo " --enable-gp2x Enables half-res software renderer."
  55. echo " --disable-screenshots Disable the screenshot hotkey."
  56. echo " --disable-xmp Disable XMP music engine."
  57. echo " --enable-modplug Enables ModPlug music engine."
  58. echo " --enable-mikmod Enables MikMod music engine."
  59. echo " --enable-openmpt Enables OpenMPT music engine."
  60. echo " --disable-libpng Disable PNG screendump support."
  61. echo " --disable-audio Disable all audio (sound + music)."
  62. echo " --disable-vorbis Disable ogg/vorbis support."
  63. echo " --enable-tremor Switches out libvorbis for libvorbisidec."
  64. echo " --enable-tremor-lowmem Switches out libvorbis for libvorbisidec (lowmem branch)."
  65. echo " --disable-pthread Use SDL's threads/locking instead of pthread."
  66. echo " --disable-icon Do not try to brand executable."
  67. echo " --disable-modular Disable dynamically shared objects."
  68. echo " --disable-updater Disable built-in updater."
  69. echo " --disable-network Disable networking abilities."
  70. echo " --enable-meter Enable load/save meter display."
  71. echo " --disable-sdl Disables SDL dependencies and features."
  72. echo " --enable-egl Enables EGL backend (if SDL disabled)."
  73. echo " --enable-gles Enable hacks for OpenGL ES platforms."
  74. echo " --disable-check-alloc Disables memory allocator error handling."
  75. echo " --disable-khash Disables using khash for counter/string lookups."
  76. echo " --enable-debytecode Enable experimental 'debytecode' transform."
  77. echo " --disable-libsdl2 Disable SDL 2.0 support (falls back on 1.2)."
  78. echo " --enable-stdio-redirect Redirect console output to stdout.txt/stderr.txt."
  79. echo " --enable-fps Enable frames-per-second counter."
  80. echo
  81. echo "e.g.: ./config.sh --platform unix --prefix /usr"
  82. echo " --sysconfdir /etc --disable-x11"
  83. echo "e.g.: ./config.sh --platform win32"
  84. echo
  85. }
  86. ### CHOMP CONFIG.SH FLAGS #####################################################
  87. #
  88. # Default settings for flags (used if unspecified)
  89. #
  90. PLATFORM=""
  91. PREFIX="/usr"
  92. PREFIX_IS_SET="false"
  93. SYSCONFDIR="/etc"
  94. SYSCONFDIR_IS_SET="false"
  95. GAMESDIR_IS_SET="false"
  96. GAMESDIR_IN_PREFIX="/games"
  97. GAMESDIR="${PREFIX}${GAMESDIR_IN_PREFIX}"
  98. LIBDIR_IS_SET="false"
  99. LIBDIR_IN_PREFIX="/lib"
  100. LIBDIR="${PREFIX}${LIBDIR_IN_PREFIX}"
  101. BINDIR_IS_SET="false"
  102. BINDIR_IN_PREFIX="/bin"
  103. BINDIR="${PREFIX}${BINDIR_IN_PREFIX}"
  104. SHAREDIR_IS_SET="false"
  105. SHAREDIR_IN_PREFIX="/share"
  106. SHAREDIR="${PREFIX}${SHAREDIR_IN_PREFIX}"
  107. DATE_STAMP="true"
  108. AS_NEEDED="false"
  109. RELEASE="false"
  110. OPT_SIZE="false"
  111. EDITOR="true"
  112. MZXRUN="true"
  113. HELPSYS="true"
  114. UTILS="true"
  115. X11="true"
  116. SOFTWARE="true"
  117. SOFTSCALE="true"
  118. GL_FIXED="true"
  119. GL_PROGRAM="true"
  120. OVERLAY="true"
  121. GP2X="false"
  122. SCREENSHOTS="true"
  123. XMP="true"
  124. MODPLUG="false"
  125. MIKMOD="false"
  126. OPENMPT="false"
  127. LIBPNG="true"
  128. AUDIO="true"
  129. VORBIS="true"
  130. PTHREAD="true"
  131. ICON="true"
  132. MODULAR="true"
  133. UPDATER="true"
  134. NETWORK="true"
  135. VERBOSE="false"
  136. METER="false"
  137. SDL="true"
  138. EGL="false"
  139. GLES="false"
  140. CHECK_ALLOC="true"
  141. KHASH="true"
  142. DEBYTECODE="false"
  143. LIBSDL2="true"
  144. STDIO_REDIRECT="false"
  145. GAMECONTROLLERDB="true"
  146. FPSCOUNTER="false"
  147. #
  148. # User may override above settings
  149. #
  150. while [ "$1" != "" ]; do
  151. # e.g. --platform unix-devel
  152. if [ "$1" = "--platform" ]; then
  153. shift
  154. PLATFORM="$1"
  155. fi
  156. # e.g. --prefix /usr
  157. if [ "$1" = "--prefix" ]; then
  158. shift
  159. PREFIX="$1"
  160. PREFIX_IS_SET="true"
  161. # Update other install folders to match
  162. if [ "$GAMESDIR_IS_SET" = "false" ]; then
  163. GAMESDIR="${PREFIX}${GAMESDIR_IN_PREFIX}"
  164. fi
  165. if [ "$LIBDIR_IS_SET" = "false" ]; then
  166. LIBDIR="${PREFIX}${LIBDIR_IN_PREFIX}"
  167. fi
  168. if [ "$BINDIR_IS_SET" = "false" ]; then
  169. BINDIR="${PREFIX}${BINDIR_IN_PREFIX}"
  170. fi
  171. if [ "$SHAREDIR_IS_SET" = "false" ]; then
  172. SHAREDIR="${PREFIX}${SHAREDIR_IN_PREFIX}"
  173. fi
  174. fi
  175. # e.g. --sysconfdir /etc
  176. if [ "$1" = "--sysconfdir" ]; then
  177. shift
  178. SYSCONFDIR="$1"
  179. SYSCONFDIR_IS_SET="true"
  180. fi
  181. # e.g. --gamesdir /usr/games
  182. if [ "$1" = "--gamesdir" ]; then
  183. shift
  184. GAMESDIR="$1"
  185. GAMESDIR_IS_SET="true"
  186. fi
  187. # e.g. --libdir /usr/lib
  188. if [ "$1" = "--libdir" ]; then
  189. shift
  190. LIBDIR="$1"
  191. LIBDIR_IS_SET="true"
  192. fi
  193. # e.g. --bindir /usr/bin
  194. if [ "$1" = "--bindir" ]; then
  195. shift
  196. BINDIR="$1"
  197. BINDIR_IS_SET="true"
  198. fi
  199. # e.g. --sharedir /usr/share
  200. if [ "$1" = "--sharedir" ]; then
  201. shift
  202. SHAREDIR="$1"
  203. SHAREDIR_IS_SET="true"
  204. fi
  205. [ "$1" = "--as-needed-hack" ] && AS_NEEDED="true"
  206. [ "$1" = "--enable-release" ] && RELEASE="true"
  207. [ "$1" = "--disable-release" ] && RELEASE="false"
  208. [ "$1" = "--optimize-size" ] && OPT_SIZE="true"
  209. [ "$1" = "--optimize-speed" ] && OPT_SIZE="false"
  210. [ "$1" = "--disable-datestamp" ] && DATE_STAMP="false"
  211. [ "$1" = "--enable-datestamp" ] && DATE_STAMP="true"
  212. [ "$1" = "--disable-editor" ] && EDITOR="false"
  213. [ "$1" = "--enable-editor" ] && EDITOR="true"
  214. [ "$1" = "--disable-mzxrun" ] && MZXRUN="false"
  215. [ "$1" = "--enable-mzxrun" ] && MZXRUN="true"
  216. [ "$1" = "--disable-helpsys" ] && HELPSYS="false"
  217. [ "$1" = "--enable-helpsys" ] && HELPSYS="true"
  218. [ "$1" = "--disable-utils" ] && UTILS="false"
  219. [ "$1" = "--enable-utils" ] && UTILS="true"
  220. [ "$1" = "--disable-x11" ] && X11="false"
  221. [ "$1" = "--enable-x11" ] && X11="true"
  222. [ "$1" = "--disable-software" ] && SOFTWARE="false"
  223. [ "$1" = "--enable-software" ] && SOFTWARE="true"
  224. [ "$1" = "--disable-softscale" ] && SOFTSCALE="false"
  225. [ "$1" = "--enable-softscale" ] && SOFTSCALE="true"
  226. [ "$1" = "--disable-gl" ] && GL="false"
  227. [ "$1" = "--enable-gl" ] && GL="true"
  228. [ "$1" = "--disable-gl-fixed" ] && GL_FIXED="false"
  229. [ "$1" = "--enable-gl-fixed" ] && GL_FIXED="true"
  230. [ "$1" = "--disable-gl-prog" ] && GL_PROGRAM="false"
  231. [ "$1" = "--enable-gl-prog" ] && GL_PROGRAM="true"
  232. [ "$1" = "--disable-overlay" ] && OVERLAY="false"
  233. [ "$1" = "--enable-overlay" ] && OVERLAY="true"
  234. [ "$1" = "--disable-gp2x" ] && GP2X="false"
  235. [ "$1" = "--enable-gp2x" ] && GP2X="true"
  236. [ "$1" = "--disable-screenshots" ] && SCREENSHOTS="false"
  237. [ "$1" = "--enable-screenshots" ] && SCREENSHOTS="true"
  238. [ "$1" = "--disable-modplug" ] && MODPLUG="false"
  239. [ "$1" = "--enable-modplug" ] && MODPLUG="true"
  240. [ "$1" = "--disable-mikmod" ] && MIKMOD="false"
  241. [ "$1" = "--enable-mikmod" ] && MIKMOD="true"
  242. [ "$1" = "--disable-xmp" ] && XMP="false"
  243. [ "$1" = "--enable-xmp" ] && XMP="true"
  244. [ "$1" = "--disable-openmpt" ] && OPENMPT="false"
  245. [ "$1" = "--enable-openmpt" ] && OPENMPT="true"
  246. [ "$1" = "--disable-libpng" ] && LIBPNG="false"
  247. [ "$1" = "--enable-libpng" ] && LIBPNG="true"
  248. [ "$1" = "--disable-audio" ] && AUDIO="false"
  249. [ "$1" = "--enable-audio" ] && AUDIO="true"
  250. [ "$1" = "--disable-vorbis" ] && VORBIS="false"
  251. [ "$1" = "--enable-vorbis" ] && VORBIS="true"
  252. [ "$1" = "--disable-tremor" ] && VORBIS="true"
  253. [ "$1" = "--enable-tremor" ] && VORBIS="tremor"
  254. [ "$1" = "--disable-tremor-lowmem" ] && VORBIS="true"
  255. [ "$1" = "--enable-tremor-lowmem" ] && VORBIS="tremor-lowmem"
  256. [ "$1" = "--disable-pthread" ] && PTHREAD="false"
  257. [ "$1" = "--enable-pthread" ] && PTHREAD="true"
  258. [ "$1" = "--disable-icon" ] && ICON="false"
  259. [ "$1" = "--enable-icon" ] && ICON="true"
  260. [ "$1" = "--disable-modular" ] && MODULAR="false"
  261. [ "$1" = "--enable-modular" ] && MODULAR="true"
  262. [ "$1" = "--disable-updater" ] && UPDATER="false"
  263. [ "$1" = "--enable-updater" ] && UPDATER="true"
  264. [ "$1" = "--disable-network" ] && NETWORK="false"
  265. [ "$1" = "--enable-network" ] && NETWORK="true"
  266. [ "$1" = "--disable-verbose" ] && VERBOSE="false"
  267. [ "$1" = "--enable-verbose" ] && VERBOSE="true"
  268. [ "$1" = "--enable-meter" ] && METER="true"
  269. [ "$1" = "--disable-meter" ] && METER="false"
  270. [ "$1" = "--disable-sdl" ] && SDL="false"
  271. [ "$1" = "--enable-sdl" ] && SDL="true"
  272. [ "$1" = "--enable-egl" ] && EGL="true"
  273. [ "$1" = "--disable-egl" ] && EGL="false"
  274. [ "$1" = "--enable-gles" ] && GLES="true"
  275. [ "$1" = "--disable-gles" ] && GLES="false"
  276. [ "$1" = "--disable-check-alloc" ] && CHECK_ALLOC="false"
  277. [ "$1" = "--enable-check-alloc" ] && CHECK_ALLOC="true"
  278. [ "$1" = "--enable-khash" ] && KHASH="true"
  279. [ "$1" = "--disable-khash" ] && KHASH="false"
  280. [ "$1" = "--enable-debytecode" ] && DEBYTECODE="true"
  281. [ "$1" = "--disable-debytecode" ] && DEBYTECODE="false"
  282. [ "$1" = "--enable-libsdl2" ] && LIBSDL2="true"
  283. [ "$1" = "--disable-libsdl2" ] && LIBSDL2="false"
  284. [ "$1" = "--enable-stdio-redirect" ] && STDIO_REDIRECT="true"
  285. [ "$1" = "--disable-stdio-redirect" ] && STDIO_REDIRECT="false"
  286. [ "$1" = "--enable-fps" ] && FPSCOUNTER="true"
  287. [ "$1" = "--disable-fps" ] && FPSCOUNTER="false"
  288. if [ "$1" = "--help" ]; then
  289. usage
  290. exit 0
  291. fi
  292. shift
  293. done
  294. #
  295. # Platform cannot be sanely omitted
  296. #
  297. if [ "$PLATFORM" = "" ]; then
  298. usage
  299. exit 0
  300. fi
  301. ### PLATFORM DEFINITION #######################################################
  302. rm -f platform.inc
  303. if [ "$PLATFORM" = "win32" -o "$PLATFORM" = "win64" \
  304. -o "$PLATFORM" = "mingw32" -o "$PLATFORM" = "mingw64" ]; then
  305. # Auto-prefix for the MSYS2 MINGW32/MINGW64 environments if a prefix wasn't
  306. # provided. This helps avoid errors that occur when gcc or libs exist in
  307. # /usr, which is used by MSYS2 for the MSYS environment.
  308. if [ "$PREFIX_IS_SET" = "false" -a -n "$MSYSTEM" \
  309. -a "$(uname -o)" == "Msys" ]; then
  310. if [ "$MSYSTEM" = "MINGW32" -o "$MSYSTEM" = "MINGW64" ]; then
  311. [ "$PLATFORM" = "win32" ] && PREFIX="/mingw32"
  312. [ "$PLATFORM" = "win64" ] && PREFIX="/mingw64"
  313. fi
  314. fi
  315. [ "$PLATFORM" = "win32" -o "$PLATFORM" = "mingw32" ] && ARCHNAME=x86
  316. [ "$PLATFORM" = "win64" -o "$PLATFORM" = "mingw64" ] && ARCHNAME=x64
  317. [ "$PLATFORM" = "mingw32" ] && MINGWBASE=i686-w64-mingw32-
  318. [ "$PLATFORM" = "mingw64" ] && MINGWBASE=x86_64-w64-mingw32-
  319. PLATFORM="mingw"
  320. echo "#define PLATFORM \"windows-$ARCHNAME\"" > src/config.h
  321. echo "SUBPLATFORM=windows-$ARCHNAME" >> platform.inc
  322. echo "PLATFORM=$PLATFORM" >> platform.inc
  323. echo "MINGWBASE=$MINGWBASE" >> platform.inc
  324. elif [ "$PLATFORM" = "unix" -o "$PLATFORM" = "unix-devel" ]; then
  325. OS="`uname -s`"
  326. MACH="`uname -m`"
  327. case "$OS" in
  328. "Linux")
  329. UNIX="linux"
  330. ;;
  331. "FreeBSD")
  332. UNIX="freebsd"
  333. ;;
  334. *)
  335. echo "WARNING: Should define proper UNIX name here!"
  336. UNIX="unix"
  337. ;;
  338. esac
  339. if [ "$MACH" = "x86_64" -o "$MACH" = "amd64" ]; then
  340. ARCHNAME=amd64
  341. #RAWLIBDIR=lib64
  342. # FreeBSD amd64 hack
  343. #[ "$UNIX" = "freebsd" ] && RAWLIBDIR=lib
  344. elif [ "`echo $MACH | sed 's,i.86,x86,'`" = "x86" ]; then
  345. ARCHNAME=x86
  346. #RAWLIBDIR=lib
  347. elif [ "`echo $MACH | sed 's,^arm.*,arm,'`" = "arm" ]; then
  348. ARCHNAME=arm
  349. #RAWLIBDIR=lib
  350. elif [ "$MACH" == "ppc" ]; then
  351. ARCHNAME=ppc
  352. #RAWLIBDIR=lib
  353. else
  354. ARCHNAME=$MACH
  355. #RAWLIBDIR=lib
  356. echo "WARNING: Compiling on an unsupported architecture. Add a friendly MACH to config.sh."
  357. fi
  358. echo "#define PLATFORM \"$UNIX-$ARCHNAME\"" > src/config.h
  359. echo "SUBPLATFORM=$UNIX-$ARCHNAME" >> platform.inc
  360. echo "PLATFORM=unix" >> platform.inc
  361. elif [ "$PLATFORM" = "darwin" -o "$PLATFORM" = "darwin-devel" \
  362. -o "$PLATFORM" = "darwin-dist" ]; then
  363. echo "#define PLATFORM \"darwin\"" > src/config.h
  364. echo "SUBPLATFORM=$PLATFORM" >> platform.inc
  365. echo "PLATFORM=darwin" >> platform.inc
  366. else
  367. if [ ! -d arch/$PLATFORM ]; then
  368. echo "Invalid platform selection (see arch/)."
  369. exit 1
  370. fi
  371. echo "#define PLATFORM \"$PLATFORM\"" > src/config.h
  372. echo "SUBPLATFORM=$PLATFORM" >> platform.inc
  373. echo "PLATFORM=$PLATFORM" >> platform.inc
  374. fi
  375. echo "PREFIX:=$PREFIX" >> platform.inc
  376. if [ "$PLATFORM" = "unix" -o "$PLATFORM" = "darwin" ]; then
  377. LIBDIR="${LIBDIR}/megazeux"
  378. elif [ "$PLATFORM" = "android" ]; then
  379. LIBDIR="/data/megazeux"
  380. else
  381. LIBDIR="."
  382. fi
  383. ### SYSTEM CONFIG DIRECTORY ###################################################
  384. if [ "$PLATFORM" = "unix" -o "$PLATFORM" = "darwin" ]; then
  385. : # Use default or user-defined SYSCONFDIR
  386. elif [ "$PLATFORM" = "darwin-dist" ]; then
  387. SYSCONFDIR="../Resources"
  388. elif [ "$PLATFORM" = "android" ]; then
  389. SYSCONFDIR="/data/megazeux"
  390. elif [ "$SYSCONFDIR_IS_SET" != "true" ]; then
  391. SYSCONFDIR="."
  392. fi
  393. ### SUMMARY OF OPTIONS ########################################################
  394. echo "Building for platform: $PLATFORM"
  395. echo "Using prefix: $PREFIX"
  396. echo "Using sysconfdir: $SYSCONFDIR"
  397. echo
  398. ### GENERATE CONFIG.H HEADER ##################################################
  399. . ./version.inc
  400. #
  401. # Set the version to build with
  402. #
  403. echo "#define VERSION \"$VERSION\"" >> src/config.h
  404. if [ "$DATE_STAMP" = "true" ]; then
  405. echo "Stamping version with today's date."
  406. echo "#define VERSION_DATE \" (`date -u +%Y%m%d`)\"" >> src/config.h
  407. else
  408. echo "Not stamping version with today's date."
  409. fi
  410. echo "#define CONFDIR \"$SYSCONFDIR/\"" >> src/config.h
  411. #
  412. # Some platforms may have filesystem hierarchies they need to fit into
  413. # FIXME: SHAREDIR should be hardcoded in fewer cases
  414. #
  415. if [ "$PLATFORM" = "unix" -o "$PLATFORM" = "darwin" ]; then
  416. echo "#define CONFFILE \"megazeux-config\"" >> src/config.h
  417. echo "#define SHAREDIR \"$SHAREDIR/megazeux/\"" >> src/config.h
  418. echo "#define USERCONFFILE \".megazeux-config\"" >> src/config.h
  419. elif [ "$PLATFORM" = "nds" ]; then
  420. SHAREDIR=/games/megazeux
  421. GAMESDIR=$SHAREDIR
  422. BINDIR=$SHAREDIR
  423. echo "#define CONFFILE \"config.txt\"" >> src/config.h
  424. echo "#define SHAREDIR \"$SHAREDIR\"" >> src/config.h
  425. elif [ "$PLATFORM" = "3ds" ]; then
  426. SHAREDIR=/3ds/megazeux
  427. GAMESDIR=$SHAREDIR
  428. BINDIR=$SHAREDIR
  429. echo "#define CONFFILE \"config.txt\"" >> src/config.h
  430. echo "#define SHAREDIR \"$SHAREDIR\"" >> src/config.h
  431. elif [ "$PLATFORM" = "wii" ]; then
  432. SHAREDIR=/apps/megazeux
  433. GAMESDIR=$SHAREDIR
  434. BINDIR=$SHAREDIR
  435. echo "#define CONFFILE \"config.txt\"" >> src/config.h
  436. echo "#define SHAREDIR \"$SHAREDIR\"" >> src/config.h
  437. elif [ "$PLATFORM" = "switch" ]; then
  438. SHAREDIR=/switch/megazeux
  439. GAMESDIR=$SHAREDIR
  440. BINDIR=$SHAREDIR
  441. echo "#define CONFFILE \"config.txt\"" >> src/config.h
  442. echo "#define SHAREDIR \"$SHAREDIR\"" >> src/config.h
  443. elif [ "$PLATFORM" = "darwin-dist" ]; then
  444. SHAREDIR=../Resources
  445. GAMESDIR=$SHAREDIR
  446. BINDIR=$SHAREDIR
  447. echo "#define CONFFILE \"config.txt\"" >> src/config.h
  448. echo "#define SHAREDIR \"$SHAREDIR\"" >> src/config.h
  449. echo "#define USERCONFFILE \".megazeux-config\"" >> src/config.h
  450. elif [ "$PLATFORM" = "android" ]; then
  451. SHAREDIR=/data/megazeux
  452. GAMESDIR=/data/megazeux
  453. BINDIR=/data/megazeux
  454. echo "#define CONFFILE \"config.txt\"" >> src/config.h
  455. echo "#define SHAREDIR \"$SHAREDIR\"" >> src/config.h
  456. else
  457. SHAREDIR=.
  458. GAMESDIR=.
  459. BINDIR=.
  460. echo "#define CONFFILE \"config.txt\"" >> src/config.h
  461. echo "#define SHAREDIR \"$SHAREDIR\"" >> src/config.h
  462. fi
  463. #
  464. # LIBDIR is required by several platforms that support modular builds.
  465. # Some architectures define an "install" target, and need the rest.
  466. #
  467. echo "SYSCONFDIR=$SYSCONFDIR" >> platform.inc
  468. echo "GAMESDIR=$GAMESDIR" >> platform.inc
  469. echo "LIBDIR=$LIBDIR" >> platform.inc
  470. echo "BINDIR=$BINDIR" >> platform.inc
  471. echo "SHAREDIR=$SHAREDIR" >> platform.inc
  472. #
  473. # Platform-specific libraries, or SDL?
  474. #
  475. if [ "$PLATFORM" = "wii" ]; then
  476. echo "#define CONFIG_WII" >> src/config.h
  477. echo "BUILD_WII=1" >> platform.inc
  478. LIBSDL2="false"
  479. fi
  480. if [ "$PLATFORM" = "3ds" -o "$PLATFORM" = "nds" ]; then
  481. echo "Disabling SDL ($PLATFORM)."
  482. SDL="false"
  483. fi
  484. if [ "$PLATFORM" = "android" ]; then
  485. echo "Disabling SDL (Android), force-enabling EGL."
  486. SDL="false"
  487. EGL="true"
  488. fi
  489. if [ "$PLATFORM" = "pandora" ]; then
  490. echo "#define CONFIG_PANDORA" >> src/config.h
  491. echo "BUILD_PANDORA=1" >> platform.inc
  492. fi
  493. #
  494. # SDL was disabled above; must also disable SDL-dependent modules
  495. #
  496. if [ "$SDL" = "false" ]; then
  497. echo "Force-disabling SDL dependent components:"
  498. echo " -> SOFTWARE, SOFTSCALE, OVERLAY, MIKMOD"
  499. SOFTWARE="false"
  500. SOFTSCALE="false"
  501. OVERLAY="false"
  502. MIKMOD="false"
  503. LIBSDL2="false"
  504. else
  505. echo "#define CONFIG_SDL" >> src/config.h
  506. echo "BUILD_SDL=1" >> platform.inc
  507. EGL="false"
  508. fi
  509. #
  510. # Use an EGL backend in place of SDL.
  511. # For now, also force-enable OpenGL ES hacks, since that's most
  512. # likely what is being used with EGL.
  513. #
  514. if [ "$EGL" = "true" ]; then
  515. echo "#define CONFIG_EGL" >> src/config.h
  516. echo "BUILD_EGL=1" >> platform.inc
  517. echo "Force-enabling OpenGL ES support (EGL)."
  518. GLES="true"
  519. fi
  520. #
  521. # We need either SDL or EGL for OpenGL
  522. #
  523. if [ "$SDL" = "false" -a "$EGL" = "false" ]; then
  524. echo "Force-disabling OpenGL (no SDL or EGL backend)."
  525. GL="false"
  526. fi
  527. #
  528. # If the NDS arch is enabled, some code has to be compile time
  529. # enabled too.
  530. #
  531. # Additionally, AUDIO must be disabled on NDS as it is currently
  532. # broken (please fix this!).
  533. #
  534. if [ "$PLATFORM" = "nds" ]; then
  535. echo "Enabling NDS-specific hacks."
  536. echo "#define CONFIG_NDS" >> src/config.h
  537. echo "BUILD_NDS=1" >> platform.inc
  538. echo "Force-disabling audio on NDS (fixme)."
  539. AUDIO="false"
  540. echo "Force-disabling software renderer on NDS."
  541. echo "Building custom NDS renderer."
  542. SOFTWARE="false"
  543. echo "Force-disabling hash tables on NDS."
  544. KHASH="false"
  545. fi
  546. #
  547. # If the 3DS arch is enabled, some code has to be compile time
  548. # enabled too.
  549. #
  550. if [ "$PLATFORM" = "3ds" ]; then
  551. echo "Enabling 3DS-specific hacks."
  552. echo "#define CONFIG_3DS" >> src/config.h
  553. echo "BUILD_3DS=1" >> platform.inc
  554. echo "Force-disabling software renderer on 3DS."
  555. echo "Building custom 3DS renderer."
  556. SOFTWARE="false"
  557. echo "Disabling utils on 3DS (silly)."
  558. UTILS="false"
  559. fi
  560. #
  561. # If the Switch arch is enabled, some code has to be compile time
  562. # enabled too.
  563. #
  564. if [ "$PLATFORM" = "switch" ]; then
  565. echo "Enabling Switch-specific hacks."
  566. echo "#define CONFIG_SWITCH" >> src/config.h
  567. echo "BUILD_SWITCH=1" >> platform.inc
  568. echo "Disabling utils on Switch (silly)."
  569. UTILS="false"
  570. echo "Force-enabling OpenGL ES support (Switch)."
  571. GLES="true"
  572. # This may or may not be totally useless for the Switch, disable it for now.
  573. GAMECONTROLLERDB="false"
  574. fi
  575. #
  576. # If the PSP arch is enabled, some code has to be compile time
  577. # enabled too.
  578. #
  579. if [ "$PLATFORM" = "psp" ]; then
  580. echo "Enabling PSP-specific hacks."
  581. echo "#define CONFIG_PSP" >> src/config.h
  582. echo "BUILD_PSP=1" >> platform.inc
  583. fi
  584. #
  585. # If the GP2X arch is enabled, some code has to be compile time
  586. # enabled too.
  587. #
  588. # Additionally, the software renderer is replaced with the gp2x
  589. # renderer on this platform.
  590. #
  591. if [ "$PLATFORM" = "gp2x" ]; then
  592. echo "Enabling GP2X-specific hacks."
  593. echo "#define CONFIG_GP2X" >> src/config.h
  594. echo "BUILD_GP2X=1" >> platform.inc
  595. echo "Force disabling software renderer on GP2X."
  596. SOFTWARE="false"
  597. echo "Force-enabling GP2X 320x240 renderer."
  598. GP2X="true"
  599. echo "Force-disabling Modplug audio."
  600. MODPLUG="false"
  601. fi
  602. #
  603. # Force-disable OpenGL and overlay renderers on PSP, GP2X, 3DS, NDS and Wii
  604. #
  605. if [ "$PLATFORM" = "psp" -o "$PLATFORM" = "gp2x" \
  606. -o "$PLATFORM" = "3ds" \
  607. -o "$PLATFORM" = "nds" -o "$PLATFORM" = "wii" ]; then
  608. echo "Force-disabling OpenGL and overlay renderers."
  609. GL="false"
  610. OVERLAY="false"
  611. fi
  612. #
  613. # Force-disable the softscale renderer for SDL 1.2 (requires SDL_Renderer).
  614. #
  615. if [ "$SDL" = "true" -a "$LIBSDL2" = "false" -a "$SOFTSCALE" = "true" ]; then
  616. echo "Force-disabling softscale renderer (requires SDL 2)."
  617. SOFTSCALE="false"
  618. fi
  619. #
  620. # Force-disable overlay renderers for SDL 2. The SDL 2 answer to SDL_Overlay
  621. # involves planar YUV modes which don't mesh well with MZX's internal rendering.
  622. #
  623. if [ "$SDL" = "true" -a "$LIBSDL2" = "true" -a "$OVERLAY" = "true" ]; then
  624. echo "Force-disabling overlay renderers (requires SDL 1.2)."
  625. OVERLAY="false"
  626. fi
  627. #
  628. # Must have at least one OpenGL renderer enabled
  629. #
  630. [ "$GL_FIXED" = "false" -a "$GL_PROGRAM" = "false" ] && GL="false"
  631. #
  632. # If OpenGL is globally disabled, disable all renderers
  633. #
  634. if [ "$GL" = "false" ]; then
  635. echo "Force-disabling OpenGL."
  636. GL_FIXED="false"
  637. GL_PROGRAM="false"
  638. GLES="false"
  639. fi
  640. #
  641. # Force-disable PNG support on platforms without screenshots or utils enabled.
  642. # The 3DS port requires PNG for other purposes.
  643. #
  644. if [ "$SCREENSHOTS" = "false" -a "$UTILS" = "false" \
  645. -a "$LIBPNG" = "true" -a "$PLATFORM" != "3ds" ]; then
  646. echo "Force-disabling PNG support (screenshots and utils disabled)"
  647. LIBPNG="false"
  648. fi
  649. #
  650. # Force-enable tremor-lowmem on GP2X
  651. #
  652. if [ "$PLATFORM" = "gp2x" -o "$PLATFORM" = "android" ]; then
  653. echo "Force-switching ogg/vorbis to tremor-lowmem."
  654. VORBIS="tremor-lowmem"
  655. fi
  656. #
  657. # Force-disable modplug/mikmod/openmpt if audio is disabled
  658. #
  659. if [ "$AUDIO" = "false" ]; then
  660. MODPLUG="false"
  661. MIKMOD="false"
  662. XMP="false"
  663. OPENMPT="false"
  664. fi
  665. #
  666. # Force-disable pthread on non-POSIX platforms
  667. #
  668. if [ "$PLATFORM" != "unix" -a "$PLATFORM" != "unix-devel" \
  669. -a "$PLATFORM" != "gp2x" -a "$PLATFORM" != "android" ]; then
  670. echo "Force-disabling pthread on non-POSIX platforms."
  671. PTHREAD="false"
  672. fi
  673. #
  674. # Force disable modular DSOs.
  675. #
  676. if [ "$PLATFORM" = "gp2x" -o "$PLATFORM" = "nds" \
  677. -o "$PLATFORM" = "3ds" -o "$PLATFORM" = "switch" \
  678. -o "$PLATFORM" = "psp" -o "$PLATFORM" = "wii" ]; then
  679. echo "Force-disabling modular build (nonsensical or unsupported)."
  680. MODULAR="false"
  681. fi
  682. #
  683. # Force disable networking (unsupported platform or no editor build)
  684. #
  685. if [ "$EDITOR" = "false" -o "$PLATFORM" = "nds" ]; then
  686. echo "Force-disabling networking (unsupported platform or editor disabled)."
  687. NETWORK="false"
  688. fi
  689. #
  690. # Force disable updater (unsupported platform)
  691. #
  692. if [ "$PLATFORM" != "mingw" ]; then
  693. echo "Force-disabling updater (unsupported platform)."
  694. UPDATER="false"
  695. fi
  696. #
  697. # Force disable network applications (network disabled)
  698. #
  699. if [ "$NETWORK" = "false" ]; then
  700. echo "Force-disabling network-dependent features (networking disabled)"
  701. UPDATER="false"
  702. fi
  703. #
  704. # Force disable networking (no applications enabled)
  705. #
  706. if [ "$NETWORK" = "true" -a "$UPDATER" = "false" ]; then
  707. echo "Force-disabling networking (no network-dependent features enabled)."
  708. NETWORK="false"
  709. fi
  710. #
  711. # Force disable utils.
  712. #
  713. if [ "$DEBYTECODE" = "true" ]; then
  714. echo "Force-disabling utils (debytecode)."
  715. UTILS="false"
  716. fi
  717. #
  718. # As GNU ld supports recursive dylib dependency tracking, we don't need to
  719. # explicitly link to as many libraries as the authors would have us provide.
  720. #
  721. # Instead, pass the linker --as-needed to discard libraries explicitly
  722. # passed through but not directly used. Fixes warnings with the Debian
  723. # packaging infrastructure.
  724. #
  725. if [ "$AS_NEEDED" = "true" ]; then
  726. echo "Assuming GNU ld and passing --as-needed through."
  727. echo "LDFLAGS+=-Wl,--as-needed" >> platform.inc
  728. fi
  729. #
  730. # Users may enable release mode
  731. #
  732. if [ "$RELEASE" = "true" ]; then
  733. #
  734. # Users may want size optimizations
  735. #
  736. if [ "$OPT_SIZE" = "true" ]; then
  737. echo "Optimizing for size."
  738. echo "OPTIMIZE_CFLAGS=-Os" >> platform.inc
  739. else
  740. echo "Optimizing for speed."
  741. fi
  742. else
  743. echo "Disabling optimization, debug enabled."
  744. echo "DEBUG=1" >> platform.inc
  745. fi
  746. #
  747. # User may disable the built-in editor
  748. #
  749. if [ "$EDITOR" = "true" ]; then
  750. echo "Built-in editor enabled."
  751. echo "BUILD_EDITOR=1" >> platform.inc
  752. echo "#define CONFIG_EDITOR" >> src/config.h
  753. else
  754. echo "Built-in editor disabled."
  755. fi
  756. #
  757. # User may disable `MZXRun' component
  758. #
  759. if [ "$MZXRUN" = "true" ]; then
  760. echo "Building MZXRun executable."
  761. echo "BUILD_MZXRUN=1" >> platform.inc
  762. else
  763. echo "Not building MZXRun executable."
  764. fi
  765. #
  766. # User may disable the built-in help system.
  767. #
  768. if [ "$HELPSYS" = "true" ]; then
  769. echo "Built-in help system enabled."
  770. echo "BUILD_HELPSYS=1" >> platform.inc
  771. echo "#define CONFIG_HELPSYS" >> src/config.h
  772. else
  773. echo "Built-in help system disabled."
  774. fi
  775. #
  776. # User may want to compile utils (checkres, downver, txt2hlp)
  777. #
  778. if [ "$UTILS" = "true" ]; then
  779. echo "Building utils (checkres, downver, png2smzx, hlp2txt, txt2hlp)."
  780. echo "BUILD_UTILS=1" >> platform.inc
  781. echo "#define CONFIG_UTILS" >> src/config.h
  782. else
  783. echo "Disabled utils (checkres, downver, png2smzx, hlp2txt, txt2hlp)."
  784. fi
  785. #
  786. # X11 support (linked against and needs headers installed)
  787. #
  788. if [ "$PLATFORM" = "unix" -o "$PLATFORM" = "unix-devel" \
  789. -o "$PLATFORM" = "pandora" ]; then
  790. #
  791. # Confirm the user's selection of X11, if they enabled it
  792. #
  793. if [ "$X11" = "true" ]; then
  794. for XBIN in X Xorg; do
  795. # try to run X
  796. $XBIN -version >/dev/null 2>&1
  797. # X/Xorg queried successfully
  798. [ "$?" = "0" ] && break
  799. done
  800. if [ "$?" != "0" ]; then
  801. echo "Force-disabling X11 (could not be queried)."
  802. X11="false"
  803. fi
  804. fi
  805. if [ "$ICON" = "true" -a "$X11" = "false" ]; then
  806. echo "Force-disabling icon branding (X11 disabled)."
  807. ICON="false"
  808. fi
  809. else
  810. echo "Force-disabling X11 (unsupported platform)."
  811. X11="false"
  812. fi
  813. if [ "$X11" = "true" ]; then
  814. echo "X11 support enabled."
  815. # enable the C++ bits
  816. echo "#define CONFIG_X11" >> src/config.h
  817. # figure out where X11 is prefixed
  818. X11PATH=`which $XBIN`
  819. X11DIR=`dirname $X11PATH`
  820. # pass this along to the build system
  821. echo "X11DIR=${X11DIR}" >> platform.inc
  822. fi
  823. #
  824. # Force disable icon branding.
  825. #
  826. if [ "$ICON" = "true" ]; then
  827. if [ "$PLATFORM" = "darwin" -o "$PLATFORM" = "darwin-devel" \
  828. -o "$PLATFORM" = "darwin-dist" -o "$PLATFORM" = "gp2x" \
  829. -o "$PLATFORM" = "psp" -o "$PLATFORM" = "nds" \
  830. -o "$PLATFORM" = "wii" ]; then
  831. echo "Force-disabling icon branding (redundant)."
  832. ICON="false"
  833. fi
  834. fi
  835. #
  836. # Enable OpenGL ES hacks if required.
  837. #
  838. if [ "$GLES" = "true" ]; then
  839. echo "OpenGL ES support enabled."
  840. echo "#define CONFIG_GLES" >> src/config.h
  841. else
  842. echo "OpenGL ES support disabled."
  843. fi
  844. #
  845. # Software renderer
  846. #
  847. if [ "$SOFTWARE" = "true" ]; then
  848. echo "Software renderer enabled."
  849. echo "#define CONFIG_RENDER_SOFT" >> src/config.h
  850. echo "BUILD_RENDER_SOFT=1" >> platform.inc
  851. else
  852. echo "Software renderer disabled."
  853. fi
  854. #
  855. # Softscale renderer (SDL 2)
  856. #
  857. if [ "$SOFTSCALE" = "true" ]; then
  858. echo "Softscale renderer enabled."
  859. echo "#define CONFIG_RENDER_SOFTSCALE" >> src/config.h
  860. echo "BUILD_RENDER_SOFTSCALE=1" >> platform.inc
  861. else
  862. echo "Softscale renderer disabled."
  863. fi
  864. #
  865. # Fixed-function H/W OpenGL renderers
  866. #
  867. if [ "$GL_FIXED" = "true" ]; then
  868. echo "Fixed-function H/W OpenGL renderers enabled."
  869. echo "#define CONFIG_RENDER_GL_FIXED" >> src/config.h
  870. echo "BUILD_RENDER_GL_FIXED=1" >> platform.inc
  871. else
  872. echo "Fixed-function OpenGL renderers disabled."
  873. fi
  874. #
  875. # Programmable H/W OpenGL renderers
  876. #
  877. if [ "$GL_PROGRAM" = "true" ]; then
  878. echo "Programmable H/W OpenGL renderer enabled."
  879. echo "#define CONFIG_RENDER_GL_PROGRAM" >> src/config.h
  880. echo "BUILD_RENDER_GL_PROGRAM=1" >> platform.inc
  881. else
  882. echo "Programmable H/W OpenGL renderer disabled."
  883. fi
  884. #
  885. # Overlay renderers
  886. #
  887. if [ "$OVERLAY" = "true" ]; then
  888. echo "Overlay renderers enabled."
  889. echo "#define CONFIG_RENDER_YUV" >> src/config.h
  890. echo "BUILD_RENDER_YUV=1" >> platform.inc
  891. else
  892. echo "Overlay renderers disabled."
  893. fi
  894. #
  895. # GX renderer (Wii and GameCube)
  896. #
  897. if [ "$PLATFORM" = "wii" -a "$SDL" = "false" ]; then
  898. echo "Building custom GX renderer."
  899. echo "#define CONFIG_RENDER_GX" >> src/config.h
  900. echo "BUILD_RENDER_GX=1" >> platform.inc
  901. fi
  902. #
  903. # GP2X renderer
  904. #
  905. if [ "$GP2X" = "true" ]; then
  906. echo "GP2X half-res renderer enabled."
  907. echo "#define CONFIG_RENDER_GP2X" >> src/config.h
  908. echo "BUILD_RENDER_GP2X=1" >> platform.inc
  909. else
  910. echo "GP2X half-res renderer disabled."
  911. fi
  912. #
  913. # Screenshot hotkey
  914. #
  915. if [ "$SCREENSHOTS" = "true" ]; then
  916. echo "Screenshot hotkey enabled."
  917. echo "#define CONFIG_ENABLE_SCREENSHOTS" >> src/config.h
  918. echo "BUILD_ENABLE_SCREENSHOTS=1" >> platform.inc
  919. else
  920. echo "Screenshot hotkey disabled."
  921. fi
  922. #
  923. # GP2X needs Mikmod, other platforms can pick
  924. # Keep the default at the bottom so it doesn't override others.
  925. #
  926. if [ "$MODPLUG" = "true" ]; then
  927. echo "Selected Modplug music engine."
  928. echo "#define CONFIG_AUDIO_MOD_SYSTEM" >> src/config.h
  929. echo "#define CONFIG_MODPLUG" >> src/config.h
  930. echo "BUILD_MODPLUG=1" >> platform.inc
  931. elif [ "$MIKMOD" = "true" ]; then
  932. echo "Selected Mikmod music engine."
  933. echo "#define CONFIG_AUDIO_MOD_SYSTEM" >> src/config.h
  934. echo "#define CONFIG_MIKMOD" >> src/config.h
  935. echo "BUILD_MIKMOD=1" >> platform.inc
  936. elif [ "$OPENMPT" = "true" ]; then
  937. echo "Selected OpenMPT music engine."
  938. echo "#define CONFIG_AUDIO_MOD_SYSTEM" >> src/config.h
  939. echo "#define CONFIG_OPENMPT" >> src/config.h
  940. echo "BUILD_OPENMPT=1" >> platform.inc
  941. elif [ "$XMP" = "true" ]; then
  942. echo "Selected XMP music engine."
  943. echo "#define CONFIG_AUDIO_MOD_SYSTEM" >> src/config.h
  944. echo "#define CONFIG_XMP" >> src/config.h
  945. echo "BUILD_XMP=1" >> platform.inc
  946. else
  947. echo "Music engine disabled."
  948. fi
  949. #
  950. # Handle audio subsystem, if enabled
  951. #
  952. if [ "$AUDIO" = "true" ]; then
  953. echo "Audio subsystem enabled."
  954. echo "#define CONFIG_AUDIO" >> src/config.h
  955. echo "BUILD_AUDIO=1" >> platform.inc
  956. else
  957. echo "Audio subsystem disabled."
  958. fi
  959. #
  960. # Handle PNG support, if enabled
  961. #
  962. if [ "$LIBPNG" = "true" ]; then
  963. echo "PNG support enabled."
  964. echo "#define CONFIG_PNG" >> src/config.h
  965. echo "LIBPNG=1" >> platform.inc
  966. else
  967. echo "PNG support disabled."
  968. fi
  969. #
  970. # Handle vorbis support, if enabled
  971. #
  972. if [ "$VORBIS" = "true" ]; then
  973. echo "Using ogg/vorbis."
  974. echo "#define CONFIG_VORBIS" >> src/config.h
  975. echo "VORBIS=vorbis" >> platform.inc
  976. elif [ "$VORBIS" = "tremor" ]; then
  977. echo "Using tremor in place of ogg/vorbis."
  978. echo "#define CONFIG_VORBIS" >> src/config.h
  979. echo "#define CONFIG_TREMOR" >> src/config.h
  980. echo "VORBIS=tremor" >> platform.inc
  981. elif [ "$VORBIS" = "tremor-lowmem" ]; then
  982. echo "Using tremor (lowmem) in place of ogg/vorbis."
  983. echo "#define CONFIG_VORBIS" >> src/config.h
  984. echo "#define CONFIG_TREMOR" >> src/config.h
  985. echo "VORBIS=tremor-lowmem" >> platform.inc
  986. else
  987. echo "Ogg/vorbis disabled."
  988. fi
  989. #
  990. # Handle pthread mutexes, if enabled
  991. #
  992. if [ "$PTHREAD" = "true" ]; then
  993. echo "Using pthread for threads/locking primitives."
  994. echo "#define CONFIG_PTHREAD" >> src/config.h
  995. echo "PTHREAD=1" >> platform.inc
  996. else
  997. echo "Not using pthread for threads/locking primitives."
  998. fi
  999. #
  1000. # Handle icon branding, if enabled
  1001. #
  1002. if [ "$ICON" = "true" ]; then
  1003. echo "Icon branding enabled."
  1004. echo "#define CONFIG_ICON" >> src/config.h
  1005. #
  1006. # On Windows we want the icons to be compiled in
  1007. #
  1008. if [ "$PLATFORM" = "mingw" ]; then
  1009. echo "EMBED_ICONS=1" >> platform.inc
  1010. fi
  1011. else
  1012. echo "Icon branding disabled."
  1013. fi
  1014. #
  1015. # Inform build system of modular build, if appropriate
  1016. #
  1017. if [ "$MODULAR" = "true" ]; then
  1018. echo "Modular build enabled."
  1019. echo "BUILD_MODULAR=1" >> platform.inc
  1020. echo "#define CONFIG_MODULAR" >> src/config.h
  1021. else
  1022. echo "Modular build disabled."
  1023. fi
  1024. #
  1025. # Handle networking, if enabled
  1026. #
  1027. if [ "$NETWORK" = "true" ]; then
  1028. echo "Networking enabled."
  1029. echo "#define CONFIG_NETWORK" >> src/config.h
  1030. echo "BUILD_NETWORK=1" >> platform.inc
  1031. else
  1032. echo "Networking disabled."
  1033. fi
  1034. #
  1035. # Handle built-in updater, if enabled
  1036. #
  1037. if [ "$UPDATER" = "true" ]; then
  1038. echo "Built-in updater enabled."
  1039. echo "#define CONFIG_UPDATER" >> src/config.h
  1040. echo "BUILD_UPDATER=1" >> platform.inc
  1041. else
  1042. echo "Built-in updater disabled."
  1043. fi
  1044. #
  1045. # Some users may prefer the build system to ALWAYS be verbose
  1046. #
  1047. if [ "$VERBOSE" = "true" ]; then
  1048. echo "Verbose build system (always)."
  1049. echo "export V=1" >> platform.inc
  1050. fi
  1051. #
  1052. # Users may enable the load/save meter display.
  1053. #
  1054. if [ "$METER" = "true" ]; then
  1055. echo "Load/save meter display enabled."
  1056. echo "#define CONFIG_LOADSAVE_METER" >> src/config.h
  1057. else
  1058. echo "Load/save meter display disabled."
  1059. fi
  1060. #
  1061. # Memory allocation error handling, if enabled
  1062. #
  1063. if [ "$CHECK_ALLOC" = "true" ]; then
  1064. echo "Memory allocation error checking enabled."
  1065. echo "#define CONFIG_CHECK_ALLOC" >> src/config.h
  1066. else
  1067. echo "Memory allocation error checking disabled."
  1068. fi
  1069. #
  1070. # Allow use of hash table counter/string lookups, if enabled
  1071. #
  1072. if [ "$KHASH" = "true" ]; then
  1073. echo "khash counter/string lookup enabled."
  1074. echo "#define CONFIG_KHASH" >> src/config.h
  1075. echo "BUILD_KHASH=1" >> platform.inc
  1076. else
  1077. echo "khash counter/string lookup disabled (using binary search)."
  1078. fi
  1079. #
  1080. # Experimental 'debytecode' transformation, if enabled
  1081. #
  1082. if [ "$DEBYTECODE" = "true" ]; then
  1083. echo "Experimental 'debytecode' transform enabled."
  1084. echo "#define CONFIG_DEBYTECODE" >> src/config.h
  1085. echo "BUILD_DEBYTECODE=1" >> platform.inc
  1086. else
  1087. echo "Experimental 'debytecode' transform disabled."
  1088. fi
  1089. #
  1090. # SDL 2.0 support, if enabled
  1091. #
  1092. if [ "$LIBSDL2" = "true" ]; then
  1093. echo "SDL 2.0 support enabled."
  1094. echo "BUILD_LIBSDL2=1" >> platform.inc
  1095. else
  1096. echo "SDL 2.0 support disabled."
  1097. fi
  1098. #
  1099. # stdio redirect, if enabled
  1100. #
  1101. if [ "$SDL" = "true" -a "$LIBSDL2" = "false" ]; then
  1102. echo "Using SDL 1.x default stdio redirect behavior."
  1103. elif [ "$STDIO_REDIRECT" = "true" ]; then
  1104. echo "Redirecting stdio to stdout.txt and stderr.txt."
  1105. echo "#define CONFIG_STDIO_REDIRECT" >> src/config.h
  1106. else
  1107. echo "stdio redirect disabled."
  1108. fi
  1109. #
  1110. # SDL_GameControllerDB, if enabled. This depends on SDL 2.
  1111. #
  1112. if [ "$LIBSDL2" = "true" -a "$GAMECONTROLLERDB" = "true" ]; then
  1113. echo "SDL_GameControllerDB enabled."
  1114. echo "#define CONFIG_GAMECONTROLLERDB" >> src/config.h
  1115. echo "BUILD_GAMECONTROLLERDB=1" >> platform.inc
  1116. else
  1117. echo "SDL_GameControllerDB disabled."
  1118. fi
  1119. #
  1120. # Frames-per-second counter
  1121. #
  1122. if [ "$FPSCOUNTER" = "true" ]; then
  1123. echo "fps counter enabled."
  1124. echo "#define CONFIG_FPS" >> src/config.h
  1125. else
  1126. echo "fps counter disabled."
  1127. fi
  1128. echo
  1129. echo "Now type \"make\" (or \"gmake\" on BSD)."