3 # This file is part of OpenTTD.
4 # OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
5 # OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
6 # See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
15 echo "$@" >> $config_log
19 ignore_extra_parameters="0"
20 # We set all kinds of defaults for params. Later on the user can override
21 # most of them; but if they don't, this default is used.
35 config_log="config.log"
36 prefix_dir="/usr/local"
38 data_dir="share/games/openttd"
40 icon_dir="share/pixmaps"
51 enable_desync_debug="0"
64 enable_cocoa_quartz="1"
65 enable_cocoa_quickdraw="1"
67 with_application_bundle="1"
77 enable_builtin_depend="1"
141 enable_cocoa_quickdraw
143 with_application_bundle
152 enable_builtin_depend
171 CC CXX CFLAGS CXXFLAGS LDFLAGS CFLAGS_BUILD CXXFLAGS_BUILD LDFLAGS_BUILD"
175 # Walk over all params from the user and override any default settings if
176 # needed. This also handles any invalid option.
178 if [ -n "$prev_p" ]; then
184 optarg=`expr "x$p" : 'x[^=]*=\(.*\)'`
187 --help | -h | -\?) showhelp; exit 0;;
189 --config-log) prev_p="config_log";;
190 --config-log=*) config_log="$optarg";;
192 --build) prev_p="build";;
193 --build=*) build="$optarg";;
195 --host) prev_p="host";;
196 --host=*) host="$optarg";;
199 --os=*) os="$optarg";;
201 --cpu-type) prev_p="cpu_type";;
202 --cpu-type=*) cpu_type="$optarg";;
204 --cc-build) prev_p="cc_build";;
205 --cc-build=*) cc_build="$optarg";;
206 --cc-host) prev_p="cc_host";;
207 --cc-host=*) cc_host="$optarg";;
208 --cxx-build) prev_p="cxx_build";;
209 --cxx-build=*) cxx_build="$optarg";;
210 --cxx-host) prev_p="cxx_host";;
211 --cxx-host=*) cxx_host="$optarg";;
212 --windres) prev_p="windres";;
213 --windres=*) windres="$optarg";;
214 --awk) prev_p="awk";;
215 --awk=*) awk="$optarg";;
216 --strip) prev_p="strip";;
217 --strip=*) strip="$optarg";;
218 --lipo) prev_p="lipo";;
219 --lipo=*) lipo="$optarg";;
221 --endian) prev_p="endian";;
222 --endian=*) endian="$optarg";;
226 # Alias --prefix with --prefix-dir, for compatibility with GNU autotools
227 --prefix-dir | --prefix) prev_p="prefix_dir";;
228 --prefix-dir=* | --prefix=*) prefix_dir="$optarg";;
230 --binary-dir) prev_p="binary_dir";;
231 --binary-dir=*) binary_dir="$optarg";;
233 --data-dir) prev_p="data_dir";;
234 --data-dir=*) data_dir="$optarg";;
236 --doc-dir) prev_p="doc_dir";;
237 --doc-dir=*) doc_dir="$optarg";;
239 --icon-dir) prev_p="icon_dir";;
240 --icon-dir=*) icon_dir="$optarg";;
242 --icon-theme-dir) prev_p="icon_theme_dir";;
243 --icon-theme-dir=*) icon_theme_dir="$optarg";;
244 --without-icon-theme) icon_theme_dir="";;
246 --menu-dir) prev_p="menu_dir";;
247 --menu-dir=*) menu_dir="$optarg";;
248 --without-menu-entry) menu_dir="";;
250 --menu-name) prev_p="menu_name";;
251 --menu-name=*) menu_name="$optarg";;
253 --binary-name) prev_p="binary_name";;
254 --binary-name=*) binary_name="$optarg";;
256 --man-dir) prev_p="man_dir";;
257 --man-dir=*) man_dir="$optarg";;
259 --personal-dir) prev_p="personal_dir";;
260 --personal-dir=*) personal_dir="$optarg";;
261 --without-personal-dir) personal_dir="";;
263 --shared-dir) prev_p="shared_dir";;
264 --shared-dir=*) shared_dir="$optarg";;
265 --without-shared-dir) shared_dir="";;
267 --install-dir) prev_p="install_dir";;
268 --install-dir=*) install_dir="$optarg";;
272 --menu-group) prev_p="menu_group";;
273 --menu-group=*) menu_group="$optarg";;
277 --enable-debug) enable_debug="1";;
278 --enable-debug=*) enable_debug="$optarg";;
279 --enable-desync-debug) enable_desync_debug="1";;
280 --enable-desync-debug=*) enable_desync_debug="$optarg";;
281 --enable-profiling) enable_profiling="1";;
282 --enable-profiling=*) enable_profiling="$optarg";;
283 --enable-lto) enable_lto="1";;
284 --enable-lto=*) enable_lto="$optarg";;
285 --enable-ipo) enable_lto="1";;
286 --enable-ipo=*) enable_lto="$optarg";;
287 --enable-dedicated) enable_dedicated="1";;
288 --enable-dedicated=*) enable_dedicated="$optarg";;
289 --enable-network) enable_network="2";;
290 --enable-network=*) enable_network="$optarg";;
291 --disable-network) enable_network="0";;
292 --disable-static) enable_static="0";;
293 --enable-static) enable_static="2";;
294 --enable-static=*) enable_static="$optarg";;
295 --disable-translator) enable_translator="0";;
296 --enable-translator) enable_translator="2";;
297 --enable-translator=*) enable_translator="$optarg";;
298 --disable-assert) enable_assert="0";;
299 --enable-assert) enable_assert="2";;
300 --enable-assert=*) enable_assert="$optarg";;
301 --disable-strip) enable_strip="0";;
302 --enable-strip) enable_strip="2";;
303 --enable-strip=*) enable_strip="$optarg";;
304 --disable-universal) enable_universal="0";;
305 --enable-universal) enable_universal="i386 ppc";;
306 --enable-universal=*) enable_universal="$optarg";;
307 --disable-osx-g5) enable_osx_g5="0";;
308 --enable-osx-g5) enable_osx_g5="2";;
309 --enable-osx-g5=*) enable_osx_g5="$optarg";;
310 --disable-unicode) enable_unicode="0";;
311 --enable-unicode) enable_unicode="2";;
312 --enable-unicode=*) enable_unicode="$optarg";;
313 --disable-console) enable_console="0";;
314 --enable-console) enable_console="2";;
315 --enable-console=*) enable_console="$optarg";;
317 --disable-cocoa-quartz) enable_cocoa_quartz="0";;
318 --enable-cocoa-quartz) enable_cocoa_quartz="2";;
319 --enable-cocoa-quartz=*) enable_cocoa_quartz="$optarg";;
320 --disable-cocoa-quickdraw) enable_cocoa_quickdraw="0";;
321 --enable-cocoa-quickdraw) enable_cocoa_quickdraw="2";;
322 --enable-cocoa-quickdraw=*) enable_cocoa_quickdraw="$optarg";;
324 --with-allegro) with_allegro="2";;
325 --without-allegro) with_allegro="0";;
326 --with-allegro=*) with_allegro="$optarg";;
328 --with-sdl) with_sdl="2";;
329 --without-sdl) with_sdl="0";;
330 --with-sdl=*) with_sdl="$optarg";;
332 --with-cocoa) with_cocoa="2";;
333 --without-cocoa) with_cocoa="0";;
334 --with-cocoa=*) with_cocoa="$optarg";;
336 --with-zlib) with_zlib="2";;
337 --without-zlib) with_zlib="0";;
338 --with-zlib=*) with_zlib="$optarg";;
340 --with-lzma) with_lzma="2";;
341 --without-lzma) with_lzma="0";;
342 --with-lzma=*) with_lzma="$optarg";;
343 --with-liblzma) with_lzma="2";;
344 --without-liblzma) with_lzma="0";;
345 --with-liblzma=*) with_lzma="$optarg";;
347 --with-lzo2) with_lzo2="2";;
348 --without-lzo2) with_lzo2="0";;
349 --with-lzo2=*) with_lzo2="$optarg";;
350 --with-liblzo2) with_lzo2="2";;
351 --without-liblzo2) with_lzo2="0";;
352 --with-liblzo2=*) with_lzo2="$optarg";;
354 --with-xdg-basedir) with_xdg_basedir="2";;
355 --without-xdg-basedir) with_xdg_basedir="0";;
356 --with-xdg-basedir=*) with_xdg_basedir="$optarg";;
357 --with-libxdg-basedir) with_xdg_basedir="2";;
358 --without-libxdg-basedir) with_xdg_basedir="0";;
359 --with-libxdg-basedir=*) with_xdg_basedir="$optarg";;
361 --with-png) with_png="2";;
362 --without-png) with_png="0";;
363 --with-png=*) with_png="$optarg";;
364 --with-libpng) with_png="2";;
365 --without-libpng) with_png="0";;
366 --with-libpng=*) with_png="$optarg";;
368 --with-libtimidity) with_libtimidity="2";;
369 --without-libtimidity) with_libtimidity="0";;
370 --with-libtimidity=*) with_libtimidity="$optarg";;
372 --with-freetype) with_freetype="2";;
373 --without-freetype) with_freetype="0";;
374 --with-freetype=*) with_freetype="$optarg";;
375 --with-libfreetype) with_freetype="2";;
376 --without-libfreetype) with_freetype="0";;
377 --with-libfreetype=*) with_freetype="$optarg";;
379 --with-fontconfig) with_fontconfig="2";;
380 --without-fontconfig) with_fontconfig="0";;
381 --with-fontconfig=*) with_fontconfig="$optarg";;
382 --with-libfontconfig) with_fontconfig="2";;
383 --without-libfontconfig) with_fontconfig="0";;
384 --with-libfontconfig=*) with_fontconfig="$optarg";;
386 --with-icu) with_icu="2";;
387 --without-icu) with_icu="0";;
388 --with-icu=*) with_icu="$optarg";;
389 --with-libicu) with_icu="2";;
390 --without-libicu) with_icu="0";;
391 --with-libicu=*) with_icu="$optarg";;
392 --static-icu) static_icu="1";;
393 --static-icu=*) static_icu="$optarg";;
394 --static-libicu) static_icu="1";;
395 --static-libicu=*) static_icu="$optarg";;
397 --with-psp-config) with_psp_config="2";;
398 --without-psp-config) with_psp_config="0";;
399 --with-psp-config=*) with_psp_config="$optarg";;
401 --disable-builtin-depend) enable_builtin_depend="0";;
402 --enable-builtin-depend) enable_builtin_depend="2";;
403 --enable-builtin-depend=*) enable_builtin_depend="$optarg";;
405 --with-makedepend) with_makedepend="2";;
406 --without-makedepend) with_makedepend="0";;
407 --with-makedepend=*) with_makedepend="$optarg";;
409 --with-direct-music) with_direct_music="2";;
410 --without-direct-music) with_direct_music="0";;
411 --with-direct-music=*) with_direct_music="$optarg";;
413 --with-sort) with_sort="2";;
414 --without-sort) with_sort="0";;
415 --with-sort=*) with_sort="$optarg";;
417 --with-iconv) with_iconv="2";;
418 --without-iconv) with_iconv="0";;
419 --with-iconv=*) with_iconv="$optarg";;
421 --with-midi=*) with_midi="$optarg";;
422 --with-midi-arg=*) with_midi_arg="$optarg";;
424 --without-distcc) with_distcc="0";;
425 --with-distcc) with_distcc="2";;
426 --with-distcc=*) with_distcc="$optarg";;
428 --without-ccache) with_ccache="0";;
429 --with-ccache) with_ccache="2";;
430 --with-ccache=*) with_ccache="$optarg";;
432 --without-nforenum) with_nforenum="0";;
433 --with-nforenum) with_nforenum="2";;
434 --with-nforenum=*) with_nforenum="$optarg";;
436 --without-grfcodec) with_grfcodec="0";;
437 --with-grfcodec) with_grfcodec="2";;
438 --with-grfcodec=*) with_grfcodec="$optarg";;
440 --without-osx-sysroot) with_osx_sysroot="0";;
441 --with-osx-sysroot) with_osx_sysroot="2";;
442 --with-osx-sysroot=*) with_osx_sysroot="$optarg";;
444 --without-application-bundle) with_application_bundle="0";;
445 --with-application-bundle) with_application_bundle="1";;
446 --with-application-bundle=*) with_application_bundle="$optarg";;
448 --without-threads) with_threads="0";;
449 --with-threads) with_threads="1";;
450 --with-threads=*) with_threads="$optarg";;
452 --without-sse) with_sse="0";;
453 --with-sse) with_sse="1";;
454 --with-sse=*) with_sse="$optarg";;
456 CC=* | --CC=*) CC="$optarg";;
457 CXX=* | --CXX=*) CXX="$optarg";;
458 CFLAGS=* | --CFLAGS=*) CFLAGS="$optarg";;
459 CXXFLAGS=* | --CXXFLAGS=*) CXXFLAGS="$optarg";;
460 LDFLAGS=* | --LDFLAGS=*) LDFLAGS="$optarg";;
461 CFLAGS_BUILD=* | --CFLAGS_BUILD=* | --CFLAGS-BUILD=*) CFLAGS_BUILD="$optarg";;
462 CXXFLAGS_BUILD=* | --CXXFLAGS_BUILD=* | --CXXFLAGS-BUILD=*) CXXFLAGS_BUILD="$optarg";;
463 LDFLAGS_BUILD=* | --LDFLAGS_BUILD=* | --LDFLAGS-BUILD=*) LDFLAGS_BUILD="$optarg";;
465 --ignore-extra-parameters) ignore_extra_parameters="1";;
468 if [ "$ignore_extra_parameters" = "0" ]; then
469 log 1 "Unknown option $p"
472 log 1 "Unknown option $p ignored"
478 if [ -n "$prev_p" ]; then
479 log 1 "configure: error: missing argument to --$prev_p"
484 echo "" > $config_log
485 log 2 "Invocation: $0 $*"
489 # Here we save all params, so we can later on do an exact redo of this
490 # configuration, without having the user to re-input stuff
492 echo "Running configure with following options:" >> $config_log
493 echo "" >> $config_log
495 configure="$CONFIGURE_EXECUTABLE --ignore-extra-parameters"
496 for p in $save_params_array; do
498 p=`echo "$p" | sed 's@_@-@g;s@\n@@g;s@ @\\ @g'`
499 # Only save those params that aren't empty
500 configure="$configure --$p=\"$v\""
503 echo "$configure" >> $config_log
504 echo "$configure" > config.cache
505 echo "" >> $config_log
509 # Some params want to be in full uppercase, else they might not work as
510 # expected.. fix that here
512 endian=`echo $endian | tr '[a-z]' '[A-Z]'`
513 os=`echo $os | tr '[a-z]' '[A-Z]'`
514 cpu_type=`echo $cpu_type | tr '[a-z]' '[A-Z]'`
516 # Check if all params have valid values
518 # Endian only allows AUTO, LE and, BE
519 if ! echo $endian | egrep -q '^(AUTO|LE|BE|PREPROCESSOR)$'; then
520 log 1 "configure: error: invalid option --endian=$endian"
521 log 1 " Available options are: --endian=[AUTO|LE|BE]"
524 if [ "$endian" = "PREPROCESSOR" ] && [ "$os" != "OSX" ]; then
525 log 1 "configure: error: invalid option --endian=$endian"
526 log 1 " PREPROCESSOR is only available for OSX"
529 # OS only allows DETECT, UNIX, OSX, FREEBSD, OPENBSD, MORPHOS, BEOS, HAIKU, SUNOS, CYGWIN, MINGW, OS2, DOS, WINCE, and PSP
530 if ! echo $os | egrep -q '^(DETECT|UNIX|OSX|FREEBSD|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|HAIKU|SUNOS|CYGWIN|MINGW|OS2|DOS|WINCE|PSP)$'; then
531 log 1 "configure: error: invalid option --os=$os"
532 log 1 " Available options are: --os=[DETECT|UNIX|OSX|FREEBSD|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|HAIKU|SUNOS|CYGWIN|MINGW|OS2|DOS|WINCE|PSP]"
535 # cpu_type can be either 32 or 64
536 if ! echo $cpu_type | egrep -q '^(32|64|DETECT)$'; then
537 log 1 "configure: error: invalid option --cpu-type=$cpu_type"
538 log 1 " Available options are: --cpu-type[=DETECT|32|64]"
541 # enable_debug should be between 0 and 4
542 if ! echo $enable_debug | egrep -q '^[0123]$'; then
543 log 1 "configure: error: invalid option --enable-debug=$enable_debug"
544 log 1 " Available options are: --enable-debug[=0123]"
548 # enable_desync_debug should be between 0 and 3
549 if ! echo $enable_desync_debug | egrep -q '^[012]$'; then
550 log 1 "configure: error: invalid option --enable-desync-debug=$enable_desync_debug"
551 log 1 " Available options are: --enable-desync-debug[=012]"
562 # Check for universal builds; they only make sense for OSX, so fail if enabled for another OS
563 if [ "$enable_universal" = "0" ]; then
564 log 1 "checking universal build... no"
566 if [ "$os" != "OSX" ]; then
567 log 1 "configure: error: --enable-universal only works on OSX"
570 log 1 "checking universal build... yes, for: $enable_universal"
573 # Already detected by check_build
574 log 1 "checking build cc... $cc_build"
575 log 1 "checking host cc... $cc_host"
580 if [ "$enable_strip" != "0" ]; then
583 log 1 "checking strip... disabled"
587 if [ "$enable_builtin_depend" != "0" ]; then
588 log 1 "checking builtin depend... yes"
589 makedepend="\$(SRC_OBJS_DIR)/\$(DEPEND)"
591 log 1 "checking builtin depend... no"
596 detect_sse_capable_architecture
598 if [ "$enable_static" = "1" ]; then
599 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "MORPHOS" ] || [ "$os" = "DOS" ]; then
606 if [ "$enable_static" != "0" ]; then
607 log 1 "checking static... yes"
609 if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "OSX" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "DOS" ]; then
610 log 1 "WARNING: static is only known to work on Windows, DOS, MacOSX and MorphOS"
611 log 1 "WARNING: use static at your own risk on this platform"
616 log 1 "checking static... no"
619 if [ "$enable_unicode" = "1" ]; then
620 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "DOS" ]; then
627 if [ "$enable_unicode" != "0" ]; then
628 log 1 "checking unicode... yes"
630 log 1 "checking unicode... no"
633 # Show what we configured
634 if [ "$enable_debug" = "0" ]; then
635 log 1 "using debug level... no"
636 elif [ "$enable_profiling" != "0" ]; then
637 log 1 "using debug level... profiling (debug level $enable_debug)"
639 log 1 "using debug level... level $enable_debug"
642 if [ "$enable_desync_debug" = "0" ]; then
643 log 1 "using desync debug level... no"
645 log 1 "using desync debug level... level $enable_desync_debug"
646 log 1 "WARNING: desync debug functions slow down the game considerably."
647 log 1 "WARNING: use only when you are instructed to do so"
648 log 1 " or when you know what you are doing."
653 if [ "$enable_lto" != "0" ]; then
654 # GCC 4.5 outputs '%{flto}', GCC 4.6 outputs '%{flto*}'
655 if $cxx_build -dumpspecs 2>&1 | grep -q '\%{flto' || $cxx_build -help ipo 2>&1 | grep -q '\-ipo'; then
656 log 1 "using link time optimization... yes"
659 log 1 "using link time optimization... no"
660 log 1 "WARNING: you selected link time optimization but it is not found."
664 log 1 "using link time optimization... no"
668 if [ "$os" != "OSX" ] && [ "$with_osx_sysroot" != "0" ]; then
669 if [ "$with_osx_sysroot" = "1" ]; then
672 log 1 "checking OSX sysroot... not OSX, skipping"
674 log 1 "configure: error: --with-osx-sysroot only works if OSX is the target"
679 if [ "$with_osx_sysroot" != "0" ]; then
680 if [ "$enable_universal" = "0" ] && [ "$with_osx_sysroot" != "1" ] && [ "$with_osx_sysroot" != "2" ]; then
681 # Sysroot manually specified? Check for usability
682 log 1 "checking OSX sysroot... $with_osx_sysroot"
683 if ! check_osx_sdk "$with_osx_sysroot"; then
684 log 1 "Passed sysroot not found/not functional"
688 # If autodetect and no universal, use system default
689 if [ "$with_osx_sysroot" = "1" ] && [ "$enable_universal" = "0" ]; then
690 log 1 "checking OSX sysroot... no (use system default)"
692 log 1 "checking OSX sysroot... automatically"
697 if [ -n "$osx_sdk_path" ]; then
698 if [ "$enable_universal" != "0" ]; then
699 if [ -z "$osx_sdk_104_path" ]; then
700 log 1 "WARNING: Could not find a usable 10.4u SDK, the resulting"
701 log 1 "WARNING: binary will only run on OSX 10.5 or later"
702 osx_sdk_104_path="$osx_sdk_path"
704 OSX_SYSROOT="-isysroot $osx_sdk_104_path"
705 OSX_LD_SYSROOT="-Wl,-syslibroot,$osx_sdk_104_path"
707 OSX_SYSROOT="-isysroot $osx_sdk_path"
708 OSX_LD_SYSROOT="-Wl,-syslibroot,$osx_sdk_path"
712 if [ "$os" = "OSX" ]; then
713 log 1 "checking OSX sysroot... no (use system default)"
721 if [ "$enable_dedicated" != "0" ]; then
722 log 1 "checking GDI video driver... dedicated server, skipping"
723 log 1 "checking dedicated... found"
725 if [ "$enable_network" = "0" ]; then
726 log 1 "configure: error: building a dedicated server without network support is pointless"
730 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ]; then
731 log 1 "checking GDI video driver... found"
733 log 1 "checking GDI video driver... not Windows, skipping"
736 if [ -z "$allegro_config" ] && [ -z "$sdl_config" ] && [ "$with_cocoa" = 0 ] && [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "WINCE" ]; then
737 log 1 "configure: error: no video driver development files found"
738 log 1 " If you want a dedicated server use --enable-dedicated as parameter"
741 log 1 "checking dedicated... not selected"
745 if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then
746 log 1 "checking console application... not Windows, skipping"
747 elif [ "$enable_console" = "1" ] && [ "$enable_dedicated" != "0" ]; then
748 log 1 "checking console application... dedicated server, enabled"
750 elif [ "$enable_console" = "1" ]; then
751 log 1 "checking console application... disabled (only used when forced)"
753 elif [ "$enable_console" = "0" ]; then
754 log 1 "checking console application... disabled"
756 log 1 "checking console application... enabled"
759 if [ "$enable_network" = "1" ] && [ "$os" = "DOS" ]; then
760 log 1 "checking network... DOS, skipping"
762 elif [ "$enable_network" != "0" ]; then
763 log 1 "checking network... found"
765 log 1 "checking network... disabled"
768 log 1 "checking squirrel... found"
769 SCRIPT_SRC_DIR="$ROOT_DIR/src/3rdparty/squirrel/include"
771 if [ "$enable_translator" != "0" ]; then
772 log 1 "checking translator... debug"
773 # -t shows TODO items, normally they are muted
776 log 1 "checking translator... no"
780 if [ "$enable_assert" != "0" ]; then
781 log 1 "checking assert... enabled"
783 log 1 "checking assert... disabled"
786 pre_detect_with_zlib=$with_zlib
789 if [ "$with_zlib" = "0" ] || [ -z "$zlib" ]; then
790 log 1 "WARNING: zlib was not detected or disabled"
791 log 1 "WARNING: OpenTTD doesn't require zlib, but it does mean that many features"
792 log 1 "WARNING: (like loading most old savegames/scenarios, loading heightmaps,"
793 log 1 "WARNING: using PNG, or using fonts, ...) will be disabled."
794 if [ "$pre_detect_with_zlib" = "0" ]; then
795 log 1 "WARNING: We strongly suggest you to install zlib."
797 log 1 "configure: error: no zlib detected"
798 log 1 " If you want to compile without zlib use --without-zlib as parameter"
803 pre_detect_with_lzma=$with_lzma
806 if [ "$with_lzma" = "0" ] || [ -z "$lzma_config" ]; then
807 log 1 "WARNING: lzma was not detected or disabled"
808 log 1 "WARNING: OpenTTD doesn't require lzma, but it does mean that many features"
809 log 1 "WARNING: (like loading most savegames/scenarios and joining most servers)"
810 log 1 "WARNING: will be disabled."
811 if [ "$pre_detect_with_lzma" = "0" ]; then
812 log 1 "WARNING: We strongly suggest you to install liblzma."
813 log 1 "configure: error: no liblzma detected"
815 log 1 " If you want to compile without lzma use --without-lzma as parameter"
820 pre_detect_with_lzo2=$with_lzo2
823 if [ "$with_lzo2" = "0" ] || [ -z "$lzo2" ]; then
824 log 1 "WARNING: liblzo2 was not detected or disabled"
825 log 1 "WARNING: OpenTTD doesn't require liblzo2, but it does mean that"
826 log 1 "WARNING: loading old savegames/scenarios will be disabled."
827 if [ "$pre_detect_with_lzo2" = "0" ]; then
828 log 1 "WARNING: We strongly suggest you to install liblzo2."
830 log 1 "configure: error: no liblzo2 detected"
831 log 1 " If you want to compile without liblzo2 use --without-liblzo2 as parameter"
844 if [ "$with_direct_music" != "0" ]; then
845 if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then
846 if [ "$with_direct_music" != "1" ]; then
847 log 1 "configure: error: direct-music is only supported on Win32 targets"
850 with_direct_music="0"
852 log 1 "checking direct-music... not Windows, skipping"
860 if [ "$os" = "OSX" ] && [ "$endian" = "AUTO" ]; then
861 endian="PREPROCESSOR"
864 log 1 "checking endianness... $endian"
866 # Suppress language errors when there is a version defined, indicating a release
867 # It just isn't pretty if any release produces warnings in the languages.
868 if [ -f "$ROOT_DIR/version" ]; then
870 log 1 "suppress language errors... yes"
873 log 1 "suppress language errors... no"
876 if [ "$enable_debug" = "0" ] && [ "$enable_profiling" = "0" ] && [ "$enable_strip" != "0" ]; then
877 if [ "$os" = "MORPHOS" ]; then
878 strip_arg="--strip-all --strip-unneeded --remove-section .comment"
879 elif [ "$os" = "OSX" ]; then
881 elif [ "$os" = "OS2" ]; then
883 # OS2 uses strip via gcc, because it needs to be feed to emxbind
884 LDFLAGS="$LDFLAGS -s"
885 elif [ "$os" = "SUNOS" ]; then
886 # The GNU strip does know -s, the non-GNU doesn't
887 # So try to detect it (in a bit of an ugly way)
888 strip_arg="`$strip -s strip.test 2>/dev/null && echo \"-s\"`"
893 log 1 "checking stripping... $strip $strip_arg"
896 log 1 "checking stripping... skipped"
899 if [ "$with_distcc" = "0" ]; then
900 log 1 "checking distcc... no"
901 elif [ "$with_distcc" = "1" ]; then
904 log 1 "checking distcc... no (only used when forced)"
905 elif [ "$with_distcc" = "2" ]; then
908 distcc="$with_distcc"
910 if [ "$with_distcc" != "0" ]; then
911 res="`$distcc --version 2>/dev/null | head -n 1 | cut -b 1-6`"
912 if [ "$res" != "distcc" ]; then
914 log 1 "checking distcc... no"
915 if [ "$with_distcc" = "2" ]; then
916 log 1 "configure: error: no distcc detected, but was forced to be used"
919 if [ "$with_distcc" != "1" ]; then
920 log 1 "configure: error: '$with_distcc' doesn't seem a distcc to me"
925 log 1 "checking distcc... $distcc"
928 if [ "$with_ccache" = "0" ]; then
929 log 1 "checking ccache... no"
930 elif [ "$with_ccache" = "1" ]; then
933 log 1 "checking ccache... no (only used when forced)"
934 elif [ "$with_ccache" = "2" ]; then
937 ccache="$with_ccache"
939 if [ "$with_ccache" != "0" ]; then
940 res="`$ccache --version 2>/dev/null | head -n 1 | cut -b 1-6`"
941 if [ "$res" != "ccache" ]; then
943 log 1 "checking ccache... no"
944 if [ "$with_ccache" = "2" ]; then
945 log 1 "configure: error: no ccache detected, but was forced to be used"
948 if [ "$with_ccache" != "1" ]; then
949 log 1 "configure: error: '$with_ccache' doesn't seem a ccache to me"
954 log 1 "checking ccache... $ccache"
960 if [ -z "$grfcodec" ] && [ -n "$nforenum" ]; then
961 log 1 "checking nforenum/grfcodec... nforenum needs grfcodec enabled, disabling nforenum"
965 if [ -z "$nforenum" ] && [ -n "$grfcodec" ]; then
966 log 1 "checking nforenum/grfcodec... grfcodec needs nforenum enabled, disabling grfcodec"
970 if [ "$os" = "DOS" ]; then
974 if [ "$os" != "OSX" ] && [ "$with_application_bundle" != "0" ]; then
975 if [ "$with_application_bundle" = "1" ]; then
976 with_application_bundle="0"
978 log 1 "checking OSX application bundle... not OSX, skipping"
980 log 1 "configure: error: --with-application-bundle only works if OSX is the target"
985 if [ "$os" = "OSX" ] && [ "$with_application_bundle" = "1" ]; then
991 if [ "$os" = "OSX" ]; then
992 # Test on ppc970 (G5) - we can optimize there
994 if [ "$enable_osx_g5" != "0" ]; then
995 log 1 "detecting ppc970 (G5)... yes (forced)"
997 # First, are we a real OSX system, else we can't detect it
998 native=`LC_ALL=C uname | tr '[A-Z]' '[a-z]' | grep darwin`
999 # If $host doesn't match $build , we are cross-compiling
1000 if [ -n "$native" ] && [ "$build" = "$host" ]; then
1001 $cxx_build $SRC_DIR/os/macosx/G5_detector.cpp -o G5_detector
1004 if [ -n "$res" ]; then
1005 # This is G5, add flags for it
1008 log 1 "detecting ppc970 (G5)... yes"
1012 log 1 "detecting ppc970 (G5)... no"
1017 log 1 "detecting ppc970 (G5)... no (cross-compiling)"
1021 if [ "$enable_osx_g5" != "0" ]; then
1022 log 1 "configure: error: ppc970 (OSX G5) selected, but not compiling for OSX"
1023 log 1 "configure: error: either select OSX as OS, or deselect ppc970"
1029 if [ -d "$ROOT_DIR/.svn" ] && [ -n "`svn help 2>/dev/null`" ]; then
1030 log 1 "checking revision... svn detection"
1031 elif [ -d "$ROOT_DIR/../.svn" ] && [ -n "`svn help 2>/dev/null`" ] && LC_ALL=C svn info $ROOT_DIR/.. | grep -q '^URL:.*tags$'; then
1032 # subversion changed its behaviour; now not all folders have a .svn folder,
1033 # but only the root folder. Since making tags requires a (sparse) checkout
1034 # of the tags folder, the folder of the tag does not have a .svn folder
1035 # anymore and this fails to detect the subversion repository checkout.
1036 log 1 "checking revision... svn detection (tag)"
1037 elif [ -d "$ROOT_DIR/.git" ] && [ -n "`git help 2>/dev/null`" ]; then
1038 log 1 "checking revision... git detection"
1039 elif [ -d "$ROOT_DIR/.hg" ] && [ -n "`HGPLAIN= hg help 2>/dev/null`" ]; then
1040 log 1 "checking revision... hg detection"
1041 elif [ -f "$ROOT_DIR/.ottdrev" ]; then
1042 log 1 "checking revision... source tarball"
1044 log 1 "checking revision... no detection"
1045 log 1 "WARNING: there is no means to determine the version."
1046 log 1 "WARNING: please use a subversion, mercurial, or git checkout of OpenTTD."
1047 log 1 "WARNING: you can only join game servers that have been compiled without"
1048 log 1 "WARNING: version detection."
1049 log 1 "WARNING: there is a great chance you desync."
1050 log 1 "WARNING: USE WITH CAUTION!"
1055 if [ "$doc_dir" = "1" ]; then
1056 if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ]; then
1057 doc_dir="share/doc/openttd"
1059 doc_dir="$data_dir/docs"
1062 doc_dir="`echo $doc_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1065 if [ "$icon_theme_dir" = "1" ]; then
1066 if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ]; then
1067 icon_theme_dir="share/icons/hicolor"
1072 icon_theme_dir="`echo $icon_theme_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1075 if [ "$personal_dir" = "1" ]; then
1076 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ] || [ "$os" = "DOS" ] || [ "$os" = "HAIKU" ]; then
1077 personal_dir="OpenTTD"
1078 elif [ "$os" = "OSX" ]; then
1079 personal_dir="Documents/OpenTTD"
1081 personal_dir=".openttd"
1084 personal_dir="`echo $personal_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1087 if [ "$shared_dir" = "1" ]; then
1088 # we are using default values
1089 if [ "$os" = "OSX" ]; then
1090 shared_dir="/Library/Application\\\\ Support/OpenTTD"
1095 shared_dir="`echo $shared_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1098 if [ "$man_dir" = "1" ]; then
1099 # add manpage on UNIX systems
1100 if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ] || [ "$os" = "OSX" ]; then
1101 man_dir="share/man/man6"
1106 man_dir="`echo $man_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1109 if [ "$menu_dir" = "1" ]; then
1110 # add a freedesktop menu item only for some UNIX systems
1111 if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ]; then
1112 menu_dir="share/applications"
1117 menu_dir="`echo $menu_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1122 if [ -n "$personal_dir" ]
1124 log 1 "personal home directory... $personal_dir"
1126 log 1 "personal home directory... none"
1129 if [ -n "$shared_dir" ]
1131 log 1 "shared data directory... $shared_dir"
1133 log 1 "shared data directory... none"
1136 if [ -n "$install_dir" ]
1138 log 1 "installation directory... $install_dir"
1140 log 1 "installation directory... none"
1143 if [ -n "$icon_theme_dir" ]
1145 log 1 "icon theme directory... $icon_theme_dir"
1147 log 1 "icon theme directory... none"
1150 if [ -n "$man_dir" ]
1152 log 1 "manual page directory... $man_dir"
1154 log 1 "manual page directory... none"
1157 if [ -n "$menu_dir" ]
1159 log 1 "menu item directory... $menu_dir"
1161 log 1 "menu item directory... none"
1165 make_compiler_cflags() {
1168 # $2 - name of the cflags variable
1169 # $3 - name of the cxxflags variable
1170 # $4 - name of the ldflags variable
1171 # $5 - name of the features variable
1173 eval eval "flags=\\\$$2"
1174 eval eval "cxxflags=\\\$$3"
1175 eval eval "ldflags=\\\$$4"
1176 eval eval "features=\\\$$5"
1178 if [ `basename $1 | cut -c 1-3` = "icc" ]; then
1179 # Enable some things only for certain ICC versions
1180 cc_version=`$1 -dumpversion | cut -c 1-4 | sed s@\\\.@@g`
1182 flags="$flags -rdynamic"
1183 ldflags="$ldflags -rdynamic"
1185 if [ -z "$first_time_icc_check" ]; then
1186 first_time_icc_check=no
1187 if [ $cc_version -lt 90 ]; then
1188 log 1 "WARNING: you seem to be using a very old version of ICC"
1189 log 1 "WARNING: OpenTTD hasn't been tested with this version"
1191 elif [ $cc_version -lt 120 ]; then
1192 log 1 "WARNING: you seem to be using an unsupported ICC version"
1193 log 1 "WARNING: ICC older than 12.0 is known to fail to compile OpenTTD"
1198 flags="$flags -Wall"
1199 # remark #111: statement is unreachable
1200 flags="$flags -wd111"
1201 # remark #181: argument is incompatible with corresponding format string conversion
1202 # ICC is very picky about signedness of operands, warnings provided by GCC are enough
1203 flags="$flags -wd181"
1204 # remark #271: trailing comma is nonstandard
1205 flags="$flags -wd271"
1206 # remark #280: selector expression is constant
1207 flags="$flags -wd280"
1208 # remark #304: access control not specified ("public" by default)
1209 flags="$flags -wd304"
1210 # remark #383: value copied to temporary, reference to temporary used
1211 flags="$flags -wd383"
1212 # remark #444: destructor for base class ... is not virtual
1213 flags="$flags -wd444"
1214 # remark #593: variable ... was set but never used
1215 flags="$flags -wd593"
1216 # warning #654: overloaded virtual function ... is only partially overridden in class ...
1217 flags="$flags -wd654"
1218 # remark #810: conversion from ... to ... may lose significant bits
1219 flags="$flags -wd810"
1220 # remark #869: parameter ... was never referenced
1221 flags="$flags -wd869"
1222 # warning #873: function ... ::operator new ... has no corresponding operator delete ...
1223 flags="$flags -wd873"
1224 # remark #981: operands are evaluated in unspecified order
1225 flags="$flags -wd981"
1226 # remark #1418: external function definition with no prior declaration
1227 flags="$flags -wd1418"
1228 # remark #1419: external declaration in primary source file
1229 flags="$flags -wd1419"
1230 # remark #1572: floating-point equality and inequality
1231 flags="$flags -wd1572"
1232 # remark #1599: declaration hides variable/parameter ...
1233 flags="$flags -wd1599"
1234 # remark #1720: function ... ::operator new ... has no corresponding member operator delete ...
1235 flags="$flags -wd1720"
1237 if [ $cc_version -lt 110 ]; then
1238 # warns about system headers with recent glibc:
1239 # warning #1292: attribute "__nonnull__" ignored
1240 flags="$flags -wd1292"
1243 if [ $cc_version -ge 100 ]; then
1244 # warning #1899: multicharacter character literal (potential portability problem)
1245 flags="$flags -wd1899"
1246 # vec report defaults to telling where it did loop vectorisation, which is not very important
1247 flags="$flags -vec-report=0 "
1250 if [ $cc_version -ge 110 ]; then
1251 # remark #2259: non-pointer conversion from ... to ... may lose significant bits
1252 flags="$flags -wd2259"
1253 # Use c++0x mode so static_assert() is available
1254 cxxflags="$cxxflags -std=c++0x"
1257 if [ "$enable_lto" != "0" ] && $1 -help ipo | grep -q '\-ipo'; then
1258 # Use IPO (only if we see IPO exists and is requested)
1260 features="$features lto"
1262 elif basename $1 | grep -q 'clang'; then
1263 # Enable some things only for certain clang versions
1264 cc_version="`$1 -v 2>&1 | head -n 1 | sed s@[^0-9]@@g | cut -c 1-2`"
1266 # aliasing rules are not held in openttd code
1267 flags="$flags -fno-strict-aliasing"
1269 # -W alone doesn't enable all warnings enabled by -Wall; on the other hand,
1270 # -Weverything enables too many useless warnings that can't be disabled (as of 3.0)
1271 flags="$flags -Wall -W"
1273 # warning: unused parameter '...'
1274 flags="$flags -Wno-unused-parameter"
1276 # warning: expression result unused
1277 flags="$flags -Wno-unused-value"
1279 # warning: multi-character character constant
1280 flags="$flags -Wno-multichar"
1282 # warning: explicitly assigning a variable of type '...' to itself
1283 # it happens when using the FOR_ALL_WINDOWS_FROM_BACK_FROM macro
1284 flags="$flags -Wno-self-assign"
1286 if [ "$cc_version" -lt "30" ]; then
1287 # warning: equality comparison with extraneous parentheses
1288 flags="$flags -Wno-parentheses"
1289 # warning: operands of ? are integers of different signs: 'unsigned int' and 'int'
1290 flags="$flags -Wno-sign-compare"
1293 if [ "$cc_version" -ge "30" ]; then
1294 # warning: equality comparison with extraneous parentheses
1295 # this warning could be useful, but it warns about code in squirrel
1296 flags="$flags -Wno-parentheses-equality"
1299 if [ "$with_ccache" != "0" -o "$with_distcc" != "0" ]; then
1300 # ccache and distcc run separate preprocess and compile passes,
1301 # both are fed with the same CFLAGS. Unfortunately, clang
1302 # complains about -I when compiling preprocessed files:
1303 # "clang: warning: argument unused during compilation: '-I /usr/include'"
1304 flags="$flags -Qunused-arguments"
1307 if [ "$enable_assert" -eq "0" ]; then
1308 # do not warn about unused variables when building without asserts
1309 flags="$flags -Wno-unused-variable"
1312 # rdynamic is used to get useful stack traces from crash reports.
1313 ldflags="$ldflags -rdynamic"
1315 # Enable some things only for certain GCC versions
1316 cc_version=`$1 -dumpversion | cut -c 1,3`
1318 if [ $cc_version -lt 33 ]; then
1319 log 1 "configure: error: gcc older than 3.3 can't compile OpenTTD because of its poor template support"
1323 flags="$flags -Wall -Wno-multichar -Wsign-compare -Wundef"
1324 flags="$flags -Wwrite-strings -Wpointer-arith"
1325 flags="$flags -W -Wno-unused-parameter -Wredundant-decls"
1326 flags="$flags -Wformat=2 -Wformat-security"
1328 if [ $enable_assert -eq 0 ]; then
1329 # Do not warn about unused variables when building without asserts
1330 flags="$flags -Wno-unused-variable"
1331 if [ $cc_version -ge 46 ]; then
1332 # GCC 4.6 gives more warnings, disable them too
1333 flags="$flags -Wno-unused-but-set-variable"
1334 flags="$flags -Wno-unused-but-set-parameter"
1338 if [ $cc_version -ge 34 ]; then
1339 # Warn when a variable is used to initialise itself:
1341 flags="$flags -Winit-self"
1344 if [ $cc_version -ge 40 ]; then
1345 # GCC 4.0+ complains about that we break strict-aliasing.
1346 # On most places we don't see how to fix it, and it doesn't
1347 # break anything. So disable strict-aliasing to make the
1348 # compiler all happy.
1349 flags="$flags -fno-strict-aliasing"
1350 # Warn about casting-out 'const' with regular C-style cast.
1351 # The preferred way is const_cast<>() which doesn't warn.
1352 flags="$flags -Wcast-qual"
1355 if [ $cc_version -ge 42 ]; then
1356 # GCC 4.2+ automatically assumes that signed overflows do
1357 # not occur in signed arithmetics, whereas we are not
1358 # sure that they will not happen. It furthermore complains
1359 # about its own optimized code in some places.
1360 flags="$flags -fno-strict-overflow"
1361 # GCC 4.2 no longer includes -Wnon-virtual-dtor in -Wall.
1362 # Enable it in order to be consistent with older GCC versions.
1363 flags="$flags -Wnon-virtual-dtor"
1366 if [ $cc_version -ge 43 ]; then
1367 # Use gnu++0x mode so static_assert() is available.
1368 # Don't use c++0x, it breaks mingw (with gcc 4.4.0).
1369 cxxflags="$cxxflags -std=gnu++0x"
1372 if [ $cc_version -eq 45 ]; then
1373 # Prevent optimisation supposing enums are in a range specified by the standard
1374 # For details, see http://gcc.gnu.org/PR43680
1375 flags="$flags -fno-tree-vrp"
1378 if [ $cc_version -ge 47 ]; then
1379 # Disable -Wnarrowing which gives many warnings, such as:
1380 # warning: narrowing conversion of '...' from 'unsigned int' to 'int' inside { } [-Wnarrowing]
1381 # They are valid according to the C++ standard, but useless.
1382 cxxflags="$cxxflags -Wno-narrowing"
1383 # Disable bogus 'attempt to free a non-heap object' warning
1384 flags="$flags -Wno-free-nonheap-object"
1387 # GCC 4.5 outputs '%{flto}', GCC 4.6 outputs '%{flto*}'
1388 if [ "$enable_lto" != "0" ] && $1 -dumpspecs | grep -q '\%{flto'; then
1389 # Use LTO only if we see LTO exists and is requested
1390 if [ $cc_version -lt 46 ]; then
1391 flags="$flags -flto"
1393 flags="$flags -flto=jobserver"
1395 ldflags="$ldflags -fwhole-program"
1396 features="$features lto"
1399 if $1 -dumpspecs | grep -q rdynamic; then
1400 # rdynamic is used to get useful stack traces from crash reports.
1401 flags="$flags -rdynamic"
1402 ldflags="$ldflags -rdynamic"
1406 eval "$2=\"$flags\""
1407 eval "$3=\"$cxxflags\""
1408 eval "$4=\"$ldflags\""
1409 eval "$5=\"$features\""
1412 make_cflags_and_ldflags() {
1413 # General CFlags for BUILD
1414 CFLAGS_BUILD="$CFLAGS_BUILD"
1415 # Special CXXFlags for BUILD
1416 CXXFLAGS_BUILD="$CXXFLAGS_BUILD"
1418 LDFLAGS_BUILD="$LDFLAGS_BUILD"
1419 # FEATURES for BUILD (lto)
1421 # General CFlags for HOST
1423 # Special CXXFlags for HOST
1424 CXXFLAGS="$CXXFLAGS"
1425 # Libs to compile. In fact this is just LDFLAGS
1427 # LDFLAGS used for HOST
1429 # FEATURES for HOST (lto)
1432 make_compiler_cflags "$cc_build" "CFLAGS_BUILD" "CXXFLAGS_BUILD" "LDFLAGS_BUILD" "FEATURES_BUILD"
1433 make_compiler_cflags "$cc_host" "CFLAGS" "CXXFLAGS" "LDFLAGS" "FEATURES"
1435 CFLAGS="$CFLAGS -D$os"
1436 CFLAGS_BUILD="$CFLAGS_BUILD -D$os"
1438 if [ "$enable_debug" = "0" ]; then
1439 # No debug, add default stuff
1440 OBJS_SUBDIR="release"
1441 if [ "$os" = "MORPHOS" ]; then
1442 CFLAGS="-I/gg/os-include -noixemul -fstrict-aliasing -fexpensive-optimizations -mcpu=604 -fno-inline -mstring -mmultiple $CFLAGS"
1443 LDFLAGS="$LDFLAGS -noixemul"
1446 if [ "$enable_profiling" = "0" ]; then
1447 # -fomit-frame-pointer and -pg do not go well together (gcc errors they are incompatible)
1448 CFLAGS="-fomit-frame-pointer $CFLAGS"
1450 CFLAGS="-O2 $CFLAGS"
1454 # Each debug level reduces the optimization by a bit
1455 if [ $enable_debug -ge 1 ]; then
1456 CFLAGS="$CFLAGS -g -D_DEBUG"
1457 if [ "$os" = "PSP" ]; then
1458 CFLAGS="$CFLAGS -G0"
1461 if [ $enable_debug -ge 2 ]; then
1462 CFLAGS="$CFLAGS -fno-inline"
1464 if [ $enable_debug -ge 3 ]; then
1465 CFLAGS="$CFLAGS -O0"
1467 CFLAGS="$CFLAGS -O2"
1471 if [ $enable_debug -le 2 ]; then
1472 if basename "$cc_host" | grep -q "gcc"; then
1473 # Define only when compiling with GCC. Some GLIBC versions use GNU
1474 # extensions in a way that breaks build with at least ICC.
1475 # This requires -O1 or more, so debug level 3 (-O0) is excluded.
1476 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
1479 if basename "$cc_build" | grep -q "gcc"; then
1480 # Just add -O1 to the tools needed for building.
1481 CFLAGS_BUILD="$CFLAGS_BUILD -D_FORTIFY_SOURCE=2 -O1"
1485 if [ "$os" = "OSX" ] && [ $cc_version -eq 40 ]; then
1486 # Apple's GCC 4.0 has a compiler bug for x86_64 with (higher) optimization,
1487 # wrongly optimizing ^= in loops. This disables the failing optimisation.
1488 CFLAGS="$CFLAGS -fno-expensive-optimizations"
1491 if [ "$enable_profiling" != "0" ]; then
1492 CFLAGS="$CFLAGS -pg"
1493 LDFLAGS="$LDFLAGS -pg"
1496 if [ "$with_threads" = "0" ]; then
1497 CFLAGS="$CFLAGS -DNO_THREADS"
1499 if [ "$with_sse" = "1" ]; then
1500 CFLAGS="$CFLAGS -DWITH_SSE"
1503 if [ "`echo $1 | cut -c 1-3`" != "icc" ]; then
1504 if [ "$os" = "CYGWIN" ]; then
1505 flags="$flags -mwin32"
1506 LDFLAGS="$LDFLAGS -mwin32"
1508 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
1509 if [ $cc_version -lt 46 ]; then
1510 flags="$flags -mno-cygwin"
1511 LDFLAGS="$LDFLAGS -mno-cygwin"
1514 if [ "$enable_console" != "0" ]; then
1515 LDFLAGS="$LDFLAGS -Wl,--subsystem,console"
1517 LDFLAGS="$LDFLAGS -Wl,--subsystem,windows"
1520 LIBS="$LIBS -lws2_32 -lwinmm -lgdi32 -ldxguid -lole32 -limm32"
1522 if [ $cc_version -ge 44 ]; then
1523 LDFLAGS_BUILD="$LDFLAGS_BUILD -static-libgcc -static-libstdc++"
1525 if [ $cc_version -ge 47 ]; then
1526 CFLAGS="$CFLAGS -mno-ms-bitfields"
1531 if [ "$os" != "CYGWIN" ] && [ "$os" != "HAIKU" ] && [ "$os" != "FREEBSD" ] && [ "$os" != "OPENBSD" ] && [ "$os" != "MINGW" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "OSX" ] && [ "$os" != "DOS" ] && [ "$os" != "WINCE" ] && [ "$os" != "PSP" ] && [ "$os" != "OS2" ]; then
1532 LIBS="$LIBS -lpthread"
1535 if [ "$os" != "CYGWIN" ] && [ "$os" != "HAIKU" ] && [ "$os" != "MINGW" ] && [ "$os" != "DOS" ] && [ "$os" != "WINCE" ]; then
1538 if [ "$os" = "WINCE" ]; then
1539 LIBS="$LIBS -lcoredll -lcorelibc -laygshell -lws2 -e WinMainCRTStartup"
1541 if [ "$os" = "PSP" ]; then
1542 CFLAGS="$CFLAGS -I`$psp_config -p`/include"
1543 LDFLAGS="$LDFLAGS -L`$psp_config -p`/lib"
1545 CFLAGS="$CFLAGS -fno-exceptions -fno-rtti -D_PSP_FW_VERSION=150"
1546 LIBS="$LIBS -D_PSP_FW_VERSION=150 -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -lm"
1549 if [ "$os" = "MORPHOS" ]; then
1550 # -Wstrict-prototypes generates much noise because of system headers
1551 CFLAGS="$CFLAGS -Wno-strict-prototypes"
1554 if [ "$os" = "OPENBSD" ]; then
1555 LIBS="$LIBS -pthread"
1558 if [ "$os" = "FREEBSD" ]; then
1559 LIBS="$LIBS -lpthread"
1562 if [ "$os" = "OSX" ]; then
1563 LDFLAGS="$LDFLAGS -framework Cocoa"
1565 # Add macports include dir which is not always set a default system dir. This avoids zillions of bogus warnings.
1566 CFLAGS="$CFLAGS -isystem/opt/local/include"
1568 if [ "$enable_dedicated" = "0" ] && ([ "$cpu_type" = "32" ] || [ "$enable_universal" != "0" ]); then
1569 LIBS="$LIBS -framework QuickTime"
1571 CFLAGS="$CFLAGS -DNO_QUICKTIME"
1574 if [ "$enable_universal" = "0" ]; then
1575 # Universal builds set this elsewhere
1576 CFLAGS="$OSX_SYSROOT $CFLAGS"
1577 LDFLAGS="$OSX_LD_SYSROOT $LDFLAGS"
1580 if [ "$enable_universal" = "0" ] && [ $cc_version -gt 40 ]; then
1581 # Only set the min version when not doing an universal build.
1582 # Universal builds set the version elsewhere.
1583 if [ "$cpu_type" = "64" ]; then
1584 CFLAGS="$CFLAGS -mmacosx-version-min=10.5"
1586 gcc_cpu=`$cc_host -dumpmachine`
1587 if [ "`echo $gcc_cpu | cut -c 1-3`" = "ppc" -o "`echo $gcc_cpu | cut -c 1-7`" = "powerpc" ]; then
1588 # PowerPC build can run on 10.3
1589 CFLAGS="$CFLAGS -mmacosx-version-min=10.3"
1591 # Intel is only available starting from 10.4
1592 CFLAGS="$CFLAGS -mmacosx-version-min=10.4"
1598 if [ "$os" = "BEOS" ] || [ "$os" = "HAIKU" ]; then
1599 LIBS="$LIBS -lmidi -lbe"
1602 # Most targets act like UNIX, just with some additions
1603 if [ "$os" = "BEOS" ] || [ "$os" = "HAIKU" ] || [ "$os" = "OSX" ] || [ "$os" = "MORPHOS" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ] || [ "$os" = "OS2" ]; then
1604 CFLAGS="$CFLAGS -DUNIX"
1606 # And others like Windows
1607 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ]; then
1608 CFLAGS="$CFLAGS -DWIN"
1611 if [ -n "$allegro_config" ]; then
1612 CFLAGS="$CFLAGS -DWITH_ALLEGRO"
1613 CFLAGS="$CFLAGS `$allegro_config --cflags`"
1614 if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "WINCE" ]; then
1615 if [ "$enable_static" != "0" ]; then
1616 LIBS="$LIBS `$allegro_config --static --libs`"
1618 LIBS="$LIBS `$allegro_config --libs`"
1623 if [ -n "$sdl_config" ]; then
1624 CFLAGS="$CFLAGS -DWITH_SDL"
1625 # SDL must not add _GNU_SOURCE as it breaks many platforms
1626 CFLAGS="$CFLAGS `$sdl_config --cflags | sed 's@-D_GNU_SOURCE[^ ]*@@'`"
1627 if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "WINCE" ]; then
1628 if [ "$enable_static" != "0" ]; then
1629 LIBS="$LIBS `$sdl_config --static-libs`"
1631 LIBS="$LIBS `$sdl_config --libs`"
1636 if [ "$with_cocoa" != "0" ]; then
1637 CFLAGS="$CFLAGS -DWITH_COCOA"
1638 LIBS="$LIBS -F/System/Library/Frameworks -framework Cocoa -framework Carbon -framework AudioUnit -framework AudioToolbox"
1640 if [ "$enable_cocoa_quartz" != "0" ]; then
1641 CFLAGS="$CFLAGS -DENABLE_COCOA_QUARTZ"
1644 if [ "$enable_cocoa_quickdraw" != "0" ]; then
1645 CFLAGS="$CFLAGS -DENABLE_COCOA_QUICKDRAW"
1649 if [ "$with_zlib" != "0" ]; then
1650 if [ "$enable_static" != "0" ] && [ "$os" != "OSX" ]; then
1655 CFLAGS="$CFLAGS -DWITH_ZLIB"
1658 if [ -n "$lzma_config" ]; then
1659 CFLAGS="$CFLAGS -DWITH_LZMA"
1660 CFLAGS="$CFLAGS `$lzma_config --cflags | tr '\n\r' ' '`"
1662 if [ "$enable_static" != "0" ]; then
1663 CFLAGS="$CFLAGS -DLZMA_API_STATIC"
1664 LIBS="$LIBS `$lzma_config --libs --static | tr '\n\r' ' '`"
1666 LIBS="$LIBS `$lzma_config --libs | tr '\n\r' ' '`"
1670 if [ "$with_lzo2" != "0" ]; then
1671 if [ "$enable_static" != "0" ] && [ "$os" != "OSX" ]; then
1676 CFLAGS="$CFLAGS -DWITH_LZO"
1679 if [ -n "$xdg_basedir_config" ]; then
1680 CFLAGS="$CFLAGS -DWITH_XDG_BASEDIR"
1681 CFLAGS="$CFLAGS `$xdg_basedir_config --cflags | tr '\n\r' ' '`"
1683 if [ "$enable_static" != "0" ]; then
1684 LIBS="$LIBS `$xdg_basedir_config --libs --static | tr '\n\r' ' '`"
1686 LIBS="$LIBS `$xdg_basedir_config --libs | tr '\n\r' ' '`"
1690 # 64bit machines need -D_SQ64
1691 if [ "$cpu_type" = "64" ] && [ "$enable_universal" = "0" ]; then
1692 CFLAGS="$CFLAGS -D_SQ64"
1694 CFLAGS="$CFLAGS -I$SCRIPT_SRC_DIR"
1696 if [ -n "$png_config" ]; then
1697 CFLAGS="$CFLAGS -DWITH_PNG"
1698 CFLAGS="$CFLAGS `$png_config --cflags | tr '\n\r' ' '`"
1700 if [ "$enable_static" != "0" ]; then
1701 if [ "$os" = "OSX" ]; then
1702 # png_config goes via pkg-config on all systems, which doesn't know --prefix
1703 # Also, despite the reason we link to the .a file ourself (because we can't use -static), we do need to ask pkg-config about possible other deps
1704 LIBS="$LIBS `$png_config --variable=prefix`/lib/libpng.a `$png_config --libs --static | sed s@-lpng[0-9]*@@`"
1706 LIBS="$LIBS `$png_config --libs --static | tr '\n\r' ' '`"
1709 LIBS="$LIBS `$png_config --libs | tr '\n\r' ' '`"
1713 if [ -n "$fontconfig_config" ]; then
1714 CFLAGS="$CFLAGS -DWITH_FONTCONFIG"
1715 CFLAGS="$CFLAGS `$fontconfig_config --cflags | tr '\n\r' ' '`"
1717 if [ "$enable_static" != "0" ]; then
1718 if [ "$os" = "OSX" ]; then
1719 # fontconfig_config goes via pkg-config on all systems, which doesn't know --prefix
1720 # Also, despite the reason we link to the .a file ourself (because we can't use -static), we do need to ask pkg-config about possible other deps
1721 LIBS="$LIBS `$fontconfig_config --variable=prefix`/lib/libfontconfig.a `$fontconfig_config --libs --static | sed s@-lfontconfig@@`"
1723 LIBS="$LIBS `$fontconfig_config --libs --static | tr '\n\r' ' '`"
1726 LIBS="$LIBS `$fontconfig_config --libs | tr '\n\r' ' '`"
1730 if [ -n "$freetype_config" ]; then
1731 CFLAGS="$CFLAGS -DWITH_FREETYPE"
1732 CFLAGS="$CFLAGS `$freetype_config --cflags | tr '\n\r' ' '`"
1734 if [ "$enable_static" != "0" ]; then
1735 if [ "$os" = "OSX" ]; then
1736 LIBS="$LIBS `$freetype_config --prefix`/lib/libfreetype.a"
1738 # Is it possible to do static with freetype, if so: how?
1739 LIBS="$LIBS `$freetype_config --libs | tr '\n\r' ' '`"
1742 LIBS="$LIBS `$freetype_config --libs | tr '\n\r' ' '`"
1746 if [ -n "$icu_config" ]; then
1747 CFLAGS="$CFLAGS -DWITH_ICU"
1748 CFLAGS="$CFLAGS `$icu_config --cppflags | tr '\n\r' ' '`"
1750 # Some icu-configs have the 'feature' of not adding a space where others do add the space
1751 if [ "$static_icu" != "0" ]; then
1752 LIBS="$LIBS `$icu_config --ldflags-searchpath` `($icu_config --ldflags-libsonly; $icu_config --ldflags-layout) | tr '\n\r' ' ' | sed s/licu/lsicu/g`"
1754 LIBS="$LIBS `$icu_config --ldflags-searchpath` `($icu_config --ldflags-libsonly; $icu_config --ldflags-layout) | tr '\n\r' ' '`"
1759 if [ "$with_direct_music" != "0" ]; then
1760 CFLAGS="$CFLAGS -DWIN32_ENABLE_DIRECTMUSIC_SUPPORT"
1761 # GCC 4.0+ doesn't like the DirectX includes (gives tons of
1762 # warnings on it we won't be able to fix). For now just
1763 # suppress those warnings.
1764 if [ $cc_version -ge 40 ]; then
1765 CFLAGS="$CFLAGS -Wno-non-virtual-dtor"
1769 if [ -n "$libtimidity" ]; then
1770 if [ "$enable_static" != "0" ]; then
1771 LIBS="$LIBS $libtimidity"
1773 LIBS="$LIBS -ltimidity"
1775 CFLAGS="$CFLAGS -DLIBTIMIDITY"
1778 if [ "$with_iconv" != "0" ]; then
1779 CFLAGS="$CFLAGS -DWITH_ICONV"
1780 if [ "$link_to_iconv" = "yes" ]; then
1781 LIBS="$LIBS -liconv"
1782 if [ "$with_iconv" != "2" ]; then
1783 CFLAGS="$CFLAGS -I$with_iconv/include"
1784 LIBS="$LIBS -L$with_iconv/lib"
1788 if [ "$os" != "OSX" ] && [ "$have_non_const_iconv" != "no" ]; then
1789 CFLAGS="$CFLAGS -DHAVE_NON_CONST_ICONV"
1793 if [ -n "$with_midi" ]; then
1794 CFLAGS="$CFLAGS -DEXTERNAL_PLAYER=\\\\\"$with_midi\\\\\""
1796 if [ -n "$with_midi_arg" ]; then
1797 CFLAGS="$CFLAGS -DMIDI_ARG=\\\\\"$with_midi_arg\\\\\""
1800 if [ "$enable_dedicated" != "0" ]; then
1801 CFLAGS="$CFLAGS -DDEDICATED"
1804 if [ "$enable_unicode" != "0" ]; then
1805 CFLAGS="$CFLAGS -DUNICODE -D_UNICODE"
1808 if [ "$enable_network" != "0" ]; then
1809 CFLAGS="$CFLAGS -DENABLE_NETWORK"
1811 if [ "$os" = "BEOS" ]; then
1812 LDFLAGS="$LDFLAGS -lbind -lsocket"
1815 if [ "$os" = "HAIKU" ]; then
1816 LDFLAGS="$LDFLAGS -lnetwork"
1819 if [ "$os" = "SUNOS" ]; then
1820 LDFLAGS="$LDFLAGS -lnsl -lsocket"
1824 if [ "$enable_static" != "0" ]; then
1825 # OSX can't handle -static in LDFLAGS
1826 if [ "$os" != "OSX" ]; then
1827 LDFLAGS="$LDFLAGS -static"
1831 if [ "$enable_assert" = "0" ]; then
1832 CFLAGS="$CFLAGS -DNDEBUG"
1833 CFLAGS_BUILD="$CFLAGS_BUILD -DNDEBUG"
1836 if [ "$enable_desync_debug" != "0" ]; then
1837 CFLAGS="$CFLAGS -DRANDOM_DEBUG"
1840 if [ "$enable_osx_g5" != "0" ]; then
1841 CFLAGS="$CFLAGS -mcpu=G5 -mpowerpc64 -mtune=970 -mcpu=970 -mpowerpc-gpopt"
1844 if [ -n "$personal_dir" ]; then
1845 CFLAGS="$CFLAGS -DWITH_PERSONAL_DIR -DPERSONAL_DIR=\\\\\"$personal_dir\\\\\""
1848 if [ -n "$shared_dir" ]; then
1849 CFLAGS="$CFLAGS -DWITH_SHARED_DIR -DSHARED_DIR=\\\\\"$shared_dir\\\\\""
1852 CFLAGS="$CFLAGS -DGLOBAL_DATA_DIR=\\\\\"$prefix_dir/$data_dir\\\\\""
1854 if [ "$enable_lto" != "0" ]; then
1856 if echo "$FEATURES_BUILD" | grep -q "lto"; then
1857 LDFLAGS_BUILD="$LDFLAGS_BUILD $CFLAGS_BUILD $CXXFLAGS_BUILD"
1860 if echo "$FEATURES" | grep -q "lto"; then
1861 LDFLAGS="$LDFLAGS $CFLAGS $CXXFLAGS"
1864 if [ "$lto_warn" != "0" ]; then
1865 log 1 "WARNING: you enabled LTO/IPO, but neither build nor host compiler supports it"
1866 log 1 "WARNING: LTO/IPO has been disabled"
1870 log 1 "using CFLAGS_BUILD... $CFLAGS_BUILD"
1871 log 1 "using CXXFLAGS_BUILD... $CXXFLAGS_BUILD"
1872 log 1 "using LDFLAGS_BUILD... $LDFLAGS_BUILD"
1873 log 1 "using CFLAGS... $CFLAGS"
1874 log 1 "using CXXFLAGS... $CXXFLAGS"
1875 log 1 "using LDFLAGS... $LIBS $LDFLAGS"
1877 # Makedepend doesn't like something like: -isysroot /OSX/blabla
1878 # so convert it to: -isysroot -OSX/blabla. makedepend just ignores
1879 # any - command it doesn't know, so we are pretty save.
1880 # Lovely hackish, not?
1881 # Btw, this almost always comes from outside the configure, so it is
1882 # not something we can control.
1883 # Also make makedepend aware of compiler's built-in defines.
1884 if [ "$with_makedepend" != "0" ] || [ "$enable_builtin_depend" != "0" ]; then
1885 # Append CXXFLAGS possibly containing -std=c++0x
1886 cflags_makedep="`echo | $cxx_host $CXXFLAGS -E -x c++ -dM - | sed 's@.define @-D@g;s@ .*@ @g;s@(.*)@@g' | tr -d '\r\n'`"
1888 # Please escape ALL " within ` because e.g. "" terminates the string in some sh implementations
1889 cflags_makedep="$cflags_makedep `echo \"$CFLAGS\" \"$CXXFLAGS\" | sed 's@ /@ -@g;s@-I[ ]*[^ ]*@@g'`"
1894 if [ "$with_distcc" != "0" ]; then
1895 cc_host="$distcc $cc_host"
1896 cxx_host="$distcc $cxx_host"
1898 log 1 " NOTICE: remind yourself to use 'make -jN' to make use of distcc"
1902 if [ "$with_ccache" != "0" ]; then
1903 cc_host="$ccache $cc_host"
1904 cxx_host="$ccache $cxx_host"
1910 # $1 - Type for message (build / host)
1911 # $2 - What to fill with the found compiler
1912 # $3 - System to try
1913 # $4 - Compiler to try
1914 # $5 - Env-setting to try
1915 # $6 - GCC alike to try
1916 # $7 - CC alike to try
1917 # $8 - "0" gcc, "1" g++, "2" windres, "3" strip, "4" lipo
1918 # $9 - What the command is to check for
1920 if [ -n "$3" ]; then
1922 if [ -z "$6" ]; then
1927 machine=`eval $compiler $9 2>/dev/null`
1929 eval "$2=\"$compiler\""
1931 log 2 "executing $compiler $9"
1932 log 2 " returned $machine"
1933 log 2 " exit code $ret"
1935 if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ]; then
1936 log 1 "checking $1... $compiler not found"
1937 log 1 "I couldn't detect any $6 binary for $3"
1941 if [ "$machine" != "$3" ] && ( [ "$8" = "0" ] || [ "$8" = "1" ] ); then
1942 log 1 "checking $1... expected $3, found $machine"
1943 log 1 "the compiler suggests it doesn't build code for the machine you specified"
1946 elif [ -n "$4" ]; then
1947 # Check for manual compiler
1948 machine=`$4 $9 2>/dev/null`
1952 log 2 "executing $4 $9"
1953 log 2 " returned $machine"
1954 log 2 " exit code $ret"
1956 if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ]; then
1957 log 1 "checking $1... $4 not found"
1958 log 1 "the selected binary doesn't seem to be a $6 binary"
1962 # Nothing given, autodetect
1964 if [ -n "$5" ]; then
1965 machine=`$5 $9 2>/dev/null`
1969 log 2 "executing $5 $9"
1970 log 2 " returned $machine"
1971 log 2 " exit code $ret"
1973 # The user defined a GCC that doesn't reply to $9.. abort
1974 if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ]; then
1975 log 1 "checking $1... $5 unusable"
1976 log 1 "the CC environment variable is set, but it doesn't seem to be a $6 binary"
1977 log 1 "please redefine the CC/CXX environment to a $6 binary"
1981 log 2 "checking $1... CC/CXX not set (skipping)"
1983 # No $5, so try '$6'
1984 machine=`$6 $9 2>/dev/null`
1988 log 2 "executing $6 $9"
1989 log 2 " returned $machine"
1990 log 2 " exit code $ret"
1992 if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ]; then
1994 machine=`$7 $9 2>/dev/null`
1998 log 2 "executing $7 $9"
1999 log 2 " returned $machine"
2000 log 2 " exit code $ret"
2003 if [ -z "$machine" ]; then
2004 log 1 "checking $1... $6 not found"
2005 log 1 "I couldn't detect any $6 binary on your system"
2006 log 1 "please define the CC/CXX environment to where it is located"
2014 if [ "$8" != "0" ]; then
2016 log 1 "checking $1... $res"
2018 log 1 "checking $1... $machine"
2023 if [ "$os" = "FREEBSD" ]; then
2024 # FreeBSD's C compiler does not support dump machine.
2025 # However, removing C support is not possible because PSP must be linked with the C compiler.
2026 check_compiler "build system type" "cc_build" "$build" "$cc_build" "$CXX" "g++" "c++" "0" "-dumpmachine"
2028 check_compiler "build system type" "cc_build" "$build" "$cc_build" "$CC" "gcc" "cc" "0" "-dumpmachine"
2033 # By default the host is the build
2034 if [ -z "$host" ]; then host="$build"; fi
2036 if [ "$os" = "FREEBSD" ]; then
2037 # FreeBSD's C compiler does not support dump machine.
2038 # However, removing C support is not possible because PSP must be linked with the C compiler.
2039 check_compiler "host system type" "cc_host" "$host" "$cc_host" "$CXX" "g++" "c++" "0" "-dumpmachine"
2041 check_compiler "host system type" "cc_host" "$host" "$cc_host" "$CC" "gcc" "cc" "0" "-dumpmachine"
2046 check_compiler "build c++" "cxx_build" "$build" "$cxx_build" "$CXX" "g++" "c++" 1 "-dumpmachine"
2050 # By default the host is the build
2051 if [ -z "$host" ]; then host="$build"; fi
2052 check_compiler "host c++" "cxx_host" "$host" "$cxx_host" "$CXX" "g++" "c++" 1 "-dumpmachine"
2056 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ]; then
2057 check_compiler "host windres" "windres" "$host" "$windres" "$WINDRES" "windres" "windres" "2" "-V"
2062 if [ "$os" = "OS2" ]; then
2063 # OS2 via gcc is a bit weird.. stripping HAS to be done via emxbind, which is via gcc directly
2064 log 1 "checking host strip... using gcc -s option"
2065 elif [ "$os" = "OSX" ]; then
2066 # Most targets have -V in strip, to see if they exists... OSX doesn't.. so execute something
2067 echo "int main(int argc, char *argv[]) { }" > strip.test.c
2068 $cxx_host strip.test.c -o strip.test
2069 check_compiler "host strip" "strip" "$host" "$strip" "$STRIP" "strip" "strip" "3" "strip.test"
2070 rm -f strip.test.c strip.test
2072 check_compiler "host strip" "strip" "$host" "$strip" "$STRIP" "strip" "strip" "3" "-V"
2077 if [ "$os" = "OSX" ] && [ "$enable_universal" != "0" ]; then
2078 echo "int main(int argc, char *argv[]) { }" > lipo.test.c
2079 $cxx_host lipo.test.c -o lipo.test
2080 check_compiler "host lipo" "lipo" "$host" "$lipo" "$LIPO" "lipo" "lipo" "4" "-info lipo.test"
2081 rm -f lipo.test.c lipo.test
2087 if [ -n "$1" ]; then
2088 if echo "$1" | grep -q / ; then
2089 # Seems to be a file system path
2092 osx_sdk_path="/Developer/SDKs/MacOSX$1.sdk"
2094 if [ ! -d "$osx_sdk_path" ]; then
2095 # No directory, not present or garbage
2099 # Set minimum version to 10.4 as that's when kCGBitmapByteOrder32Host was introduced
2100 sysroot="-isysroot $osx_sdk_path -Wl,-syslibroot,$osx_sdk_path -mmacosx-version-min=10.4"
2103 cat > tmp.osx.mm << EOF
2104 #include <Cocoa/Cocoa.h>
2106 kCGBitmapByteOrder32Host;
2110 execute="$cxx_host $sysroot $CFLAGS tmp.osx.mm -framework Cocoa -o tmp.osx 2>&1"
2111 eval $execute > /dev/null
2113 log 2 "executing $execute"
2114 log 2 " exit code $ret"
2115 rm -f tmp.osx.mm tmp.osx
2119 check_direct_music() {
2121 #include <windows.h>
2122 #include <dmksctrl.h>
2123 #include <dmusici.h>
2124 #include <dmusicc.h>
2125 #include <dmusicf.h>
2126 int main(int argc, char *argv[]) { }" > direct_music.test.c
2127 $cxx_host $CFLAGS direct_music.test.c -o direct_music.test 2> /dev/null
2129 rm -f direct_music.test.c direct_music.test
2131 if [ "$res" != "0" ]; then
2132 if [ "$with_direct_music" != "1" ]; then
2133 log 1 "configure: error: direct-music is not available on this system"
2136 with_direct_music="0"
2138 log 1 "checking direct-music... not found"
2140 log 1 "checking direct-music... found"
2144 check_makedepend() {
2145 if [ "$enable_builtin_depend" != "0" ]; then
2149 if [ "$with_makedepend" = "0" ]; then
2150 log 1 "checking makedepend... disabled"
2154 if [ "$with_makedepend" = "1" ] || [ "$with_makedepend" = "2" ]; then
2155 makedepend="makedepend"
2157 makedepend="$with_makedepend"
2160 rm -f makedepend.tmp
2161 touch makedepend.tmp
2162 res=`$makedepend -fmakedepend.tmp 2>/dev/null`
2164 log 2 "executing $makedepend -f makedepend.tmp"
2165 log 2 " returned `cat makedepend.tmp`"
2166 log 2 " exit code $ret"
2168 if [ ! -s makedepend.tmp ]; then
2169 rm -f makedepend.tmp makedepend.tmp.bak
2171 if [ "$with_makedepend" = "2" ]; then
2172 log 1 "checking makedepend... not found"
2174 log 1 "I couldn't detect any makedepend on your system"
2175 log 1 "please locate it via --makedepend=[binary]"
2178 elif [ "$with_makedepend" != "1" ]; then
2179 log 1 "checking makedepend... $makedepend not found"
2181 log 1 "the selected file doesn't seem to be a valid makedepend binary"
2185 log 1 "checking makedepend... not found"
2192 rm -f makedepend.tmp makedepend.tmp.bak
2194 log 1 "checking makedepend... $makedepend"
2198 # $1 - requested version (major.minor)
2199 # $2 - version we got (major.minor)
2201 if [ -z "$2" ]; then
2205 req_major=`echo $1 | cut -d. -f1`
2206 got_major=`echo $2 | cut -d. -f1`
2207 if [ $got_major -lt $req_major ]; then
2209 elif [ $got_major -gt $req_major ]; then
2213 req_minor=`echo $1 | cut -d. -f2`
2214 got_minor=`echo $2 | cut -d. -f2`
2215 if [ $got_minor -lt $req_minor ]; then
2222 # Not all awks allow gsub(), so we test for that here! It is in fact all we need...
2224 # These awks are known to work. Test for them explicit
2225 awks="gawk mawk nawk"
2227 awk_prefix="echo \"a.c b.c c.c\" | tr ' ' \\\\n | "
2228 awk_param="' { ORS = \" \" } /\.c$/ { gsub(\".c$\", \".o\", \$0); print \$0; }' 2>/dev/null"
2229 awk_result="a.o b.o c.o "
2230 log 2 "Detecing awk..."
2232 log 2 "Trying: $awk_prefix $awk $awk_param"
2233 res=`eval $awk_prefix $awk $awk_param`
2234 log 2 "Result: '$res'"
2235 if [ "$res" != "$awk_result" ] && [ "$awk" = "awk" ]; then
2236 # User didn't supply his own awk, so try to detect some other known working names for an awk
2237 for awk in $awks; do
2238 log 2 "Trying: $awk_prefix $awk $awk_param"
2239 res=`eval $awk_prefix $awk $awk_param`
2240 log 2 "Result: '$res'"
2241 if [ "$res" = "$awk_result" ]; then break; fi
2244 if [ "$res" != "$awk_result" ]; then
2245 log 1 "checking awk... not found"
2246 log 1 "configure: error: no awk found"
2247 log 1 "configure: error: please install one of the following: $awks"
2251 if [ "$res" != "$awk_result" ]; then
2252 log 1 "checking awk... not found"
2253 log 1 "configure: error: you supplied '$awk' but it doesn't seem a valid gawk or mawk"
2257 log 1 "checking awk... $awk"
2261 if [ "$os" = "DETECT" ]; then
2262 # Detect UNIX, OSX, FREEBSD, OPENBSD, NETBSD, HPUX, MORPHOS, BEOS, SUNOS, CYGWIN, MINGW, OS2, DOS, WINCE, and PSP
2264 # Try first via dumpmachine, then via uname
2265 os=`echo "$host" | tr '[A-Z]' '[a-z]' | $awk '
2266 /linux/ { print "UNIX"; exit}
2267 /darwin/ { print "OSX"; exit}
2268 /freebsd/ { print "FREEBSD"; exit}
2269 /openbsd/ { print "OPENBSD"; exit}
2270 /netbsd/ { print "NETBSD"; exit}
2271 /hp-ux/ { print "HPUX"; exit}
2272 /morphos/ { print "MORPHOS"; exit}
2273 /beos/ { print "BEOS"; exit}
2274 /haiku/ { print "HAIKU"; exit}
2275 /sunos/ { print "SUNOS"; exit}
2276 /solaris/ { print "SUNOS"; exit}
2277 /cygwin/ { print "CYGWIN"; exit}
2278 /mingw/ { print "MINGW"; exit}
2279 /os2/ { print "OS2"; exit}
2280 /dos/ { print "DOS"; exit}
2281 /wince/ { print "WINCE"; exit}
2282 /psp/ { print "PSP"; exit}
2285 if [ -z "$os" ]; then
2286 os=`LC_ALL=C uname | tr '[A-Z]' '[a-z]' | $awk '
2287 /linux/ { print "UNIX"; exit}
2288 /darwin/ { print "OSX"; exit}
2289 /freebsd/ { print "FREEBSD"; exit}
2290 /openbsd/ { print "OPENBSD"; exit}
2291 /netbsd/ { print "NETBSD"; exit}
2292 /hp-ux/ { print "HPUX"; exit}
2293 /morphos/ { print "MORPHOS"; exit}
2294 /beos/ { print "BEOS"; exit}
2295 /haiku/ { print "HAIKU"; exit}
2296 /sunos/ { print "SUNOS"; exit}
2297 /cygwin/ { print "CYGWIN"; exit}
2298 /mingw/ { print "MINGW"; exit}
2299 /os\/2/ { print "OS2"; exit}
2300 /gnu/ { print "UNIX"; exit}
2304 if [ -z "$os" ]; then
2305 log 1 "detecting OS... none detected"
2306 log 1 "I couldn't detect your OS. Please use --os=OS to force one"
2307 log 1 "Allowed values are: UNIX, OSX, FREEBSD, OPENBSD, NETBSD, MORPHOS, HPUX, BEOS, HAIKU, SUNOS, CYGWIN, MINGW, OS2, DOS, WINCE, and PSP"
2311 log 1 "detecting OS... $os"
2313 log 1 "forcing OS... $os"
2318 # 0 means no, 1 is auto-detect, 2 is force
2319 if [ "$with_allegro" = "0" ]; then
2320 log 1 "checking Allegro... disabled"
2326 if [ "$with_allegro" = "2" ] && [ "$with_cocoa" = "2" ]; then
2327 log 1 "configure: error: it is impossible to compile both Allegro and COCOA"
2328 log 1 "configure: error: please deselect one of them and try again"
2332 if [ "$with_allegro" = "2" ] && [ "$enable_dedicated" != "0" ]; then
2333 log 1 "configure: error: it is impossible to compile a dedicated with Allegro"
2334 log 1 "configure: error: please deselect one of them and try again"
2338 if [ "$enable_dedicated" != "0" ]; then
2339 log 1 "checking Allegro... dedicated server, skipping"
2345 # By default on OSX we don't use SDL. The rest is auto-detect
2346 if [ "$with_allegro" = "1" ] && [ "$os" = "OSX" ] && [ "$with_cocoa" != "0" ]; then
2347 log 1 "checking Allegro... OSX, skipping"
2353 if [ "$with_allegro" = "1" ] || [ "$with_allegro" = "" ] || [ "$with_allegro" = "2" ]; then
2354 allegro_config="allegro-config"
2356 allegro_config="$with_allegro"
2359 version=`$allegro_config --version 2>/dev/null`
2361 log 2 "executing $allegro_config --version"
2362 log 2 " returned $version"
2363 log 2 " exit code $ret"
2365 if [ -z "$version" ] || [ "$ret" != "0" ]; then
2366 log 1 "checking Allegro... not found"
2368 # It was forced, so it should be found.
2369 if [ "$with_allegro" != "1" ]; then
2370 log 1 "configure: error: allegro-config couldn't be found"
2371 log 1 "configure: error: you supplied '$with_allegro', but it seems invalid"
2379 log 1 "checking Allegro... found"
2384 # 0 means no, 1 is auto-detect, 2 is force
2385 if [ "$with_sdl" = "0" ]; then
2386 log 1 "checking SDL... disabled"
2392 if [ "$with_sdl" = "2" ] && [ "$with_cocoa" = "2" ]; then
2393 log 1 "configure: error: it is impossible to compile both SDL and COCOA"
2394 log 1 "configure: error: please deselect one of them and try again"
2398 if [ "$with_sdl" = "2" ] && [ "$enable_dedicated" != "0" ]; then
2399 log 1 "configure: error: it is impossible to compile a dedicated with SDL"
2400 log 1 "configure: error: please deselect one of them and try again"
2404 if [ "$enable_dedicated" != "0" ]; then
2405 log 1 "checking SDL... dedicated server, skipping"
2411 # By default on OSX we don't use SDL. The rest is auto-detect
2412 if [ "$with_sdl" = "1" ] && [ "$os" = "OSX" ] && [ "$with_cocoa" != "0" ]; then
2413 log 1 "checking SDL... OSX, skipping"
2419 if [ "$os" = "OSX" ]; then
2420 log 1 "WARNING: sdl is known to fail on some versions of Mac OS X"
2421 log 1 "WARNING: with some hardware configurations. Use at own risk!"
2425 if [ "$with_sdl" = "1" ] || [ "$with_sdl" = "" ] || [ "$with_sdl" = "2" ]; then
2426 sdl_config="sdl-config"
2428 sdl_config="$with_sdl"
2431 version=`$sdl_config --version 2>/dev/null`
2433 log 2 "executing $sdl_config --version"
2434 log 2 " returned $version"
2435 log 2 " exit code $ret"
2437 if [ -z "$version" ] || [ "$ret" != "0" ]; then
2438 log 1 "checking SDL... not found"
2440 # It was forced, so it should be found.
2441 if [ "$with_sdl" != "1" ]; then
2442 log 1 "configure: error: sdl-config couldn't be found"
2443 log 1 "configure: error: you supplied '$with_sdl', but it seems invalid"
2451 log 1 "checking SDL... found"
2455 # Try to find the best SDK available. For a normal build this
2456 # is currently the 10.5 SDK as this is needed to compile all
2457 # optional code. Because such an executable won't run on 10.4
2458 # or lower, also check for the 10.4u SDK when doing an universal
2461 # Check for the 10.5 SDK, but try 10.6 if that fails
2462 check_osx_sdk "10.5" || check_osx_sdk "10.6" || osx_sdk_path=""
2464 if [ -z "$osx_sdk_path" ] || [ "$enable_universal" != "0" ]; then
2465 # No better SDK or universal build enabled? Check 10.4u SDK as well
2466 local old_sdk="$osx_sdk_path"
2467 if check_osx_sdk "10.4u"; then
2468 osx_sdk_104_path="$osx_sdk_path"
2472 if [ -z "$old_sdk" ]; then
2473 osx_sdk_path="$osx_sdk_104_path"
2475 osx_sdk_path="$old_sdk"
2479 if [ -z "$osx_sdk_path" ]; then
2480 log 1 "Your system SDK is probably too old"
2481 log 1 "Please install/upgrade your Xcode to >= 2.5"
2488 # 0 means no, 1 is auto-detect, 2 is force
2489 if [ "$with_cocoa" = "0" ]; then
2490 log 1 "checking COCOA... disabled"
2495 if [ "$with_cocoa" = "2" ] && [ "$enable_dedicated" != "0" ]; then
2496 log 1 "configure: error: it is impossible to compile a dedicated with COCOA"
2497 log 1 "configure: error: please deselect one of them and try again"
2501 if [ "$enable_dedicated" != "0" ]; then
2502 log 1 "checking COCOA... dedicated server, skipping"
2508 # By default on OSX we use COCOA. The rest doesn't support it
2509 if [ "$with_cocoa" = "1" ] && [ "$os" != "OSX" ]; then
2510 log 1 "checking COCOA... not OSX, skipping"
2516 if [ "$os" != "OSX" ]; then
2517 log 1 "checking COCOA... not OSX"
2519 log 1 "configure: error: COCOA video driver is only supported for OSX"
2523 log 1 "checking COCOA... found"
2526 if [ "$enable_cocoa_quartz" != "0" ]; then
2527 log 1 "checking whether to enable the Quartz window subdriver... yes"
2529 log 1 "checking whether to enable the Quartz window subdriver... no"
2535 detect_quickdraw() {
2536 # 0 means no, 1 is auto-detect, 2 is force
2537 if [ "$enable_cocoa_quickdraw" = "0" ]; then
2538 log 1 "checking Quickdraw window subdriver... disabled"
2542 # Assume QuickDraw is available when doing an universal build
2543 if [ "$enable_universal" != "0" ]; then
2544 log 1 "checking Quickdraw window subdriver... found"
2548 # 64 bits doesn't have quickdraw
2549 if [ "$cpu_type" = "64" ]; then
2550 enable_cocoa_quickdraw="0"
2551 log 1 "checking Quickdraw window subdriver... disabled (64 bits)"
2555 cat > tmp.osx.mm << EOF
2556 #include <AvailabilityMacros.h>
2557 #import <Cocoa/Cocoa.h>
2558 int main(int argc, char *argv[]) { SetEmptyRgn(NULL); return 0; }
2560 execute="$cxx_host $OSX_SYSROOT $OSX_LD_SYSROOT $CFLAGS -mmacosx-version-min=10.3 tmp.osx.mm -framework Cocoa -o tmp.osx 2>&1"
2561 eval $execute > /dev/null
2563 log 2 "executing $execute"
2564 log 2 " exit code $ret"
2565 rm -f tmp.osx.mm tmp.osx
2566 if [ "$ret" != "0" ]; then
2567 log 1 "checking Quickdraw window subdriver... not found"
2569 # It was forced, so it should be found.
2570 if [ "$enable_cocoa_quickdraw" != "1" ]; then
2571 log 1 "configure: error: Quickdraw window driver could not be found"
2575 enable_cocoa_quickdraw=0
2579 enable_cocoa_quickdraw=1
2580 log 1 "checking Quickdraw window subdriver... found"
2584 # $1 - config-param ($with_zlib value)
2585 # $2 - library name ('zlib', sets $zlib)
2586 # $3 - static library name (libz.a)
2587 # $4 - header directory ()
2588 # $5 - header name (zlib.h)
2589 # $6 - force static (if non-empty)
2591 if [ -n "$6" ]; then force_static="1"; fi
2593 # 0 means no, 1 is auto-detect, 2 is force
2594 if [ "$1" = "0" ]; then
2595 log 1 "checking $2... disabled"
2601 log 2 "detecting $2"
2603 if [ "$1" = "1" ] || [ "$1" = "" ] || [ "$1" = "2" ]; then
2604 eval "$2=`ls -1 /usr/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2606 if [ -z "$res" ]; then
2607 log 2 " trying /usr/include/$4$5... no"
2608 eval "$2=`ls -1 /usr/local/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2611 if [ -z "$res" ]; then
2612 log 2 " trying /usr/local/include/$4$5... no"
2613 eval "$2=`ls -1 /mingw/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2616 if [ -z "$res" ]; then
2617 log 2 " trying /mingw/include/$4$5... no"
2618 eval "$2=`ls -1 /opt/local/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2621 if [ -z "$res" ]; then
2622 log 2 " trying /opt/local/include/$4$5... no"
2624 if [ -z "$res" ] && [ "$os" = "NETBSD" ]; then
2625 eval "$2=`ls -1 /usr/pkg/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2627 if [ -z "$res" ]; then
2628 log 2 " trying /usr/pkg/include/$4$5... no"
2631 if [ -z "$res" ] && [ "$os" = "HAIKU" ]; then
2632 eval "$2=`ls -1 /boot/common/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2634 if [ -z "$res" ]; then
2635 log 2 " trying /boot/common/include/$4$5... no"
2640 if [ -n "$res" ] && ( [ -n "$force_static" ] || ( [ "$enable_static" != "0" ] && [ "$os" != "OSX" ] ) ); then
2642 log 2 " trying $res... found"
2643 # Now find the static lib, if needed
2644 eval "$2=`ls /lib/*.a 2>/dev/null | egrep \"\/$3\$\"`"
2646 if [ -z "$res" ]; then
2647 log 2 " trying /lib/$3... no"
2648 eval "$2=`ls /usr/lib/*.a 2>/dev/null | egrep \"\/$3\$\"`"
2651 if [ -z "$res" ]; then
2652 log 2 " trying /usr/lib/$3... no"
2653 eval "$2=`ls /usr/local/lib/*.a 2>/dev/null | egrep \"\/$3\$\"`"
2656 if [ -z "$res" ]; then
2657 log 2 " trying /usr/local/lib/$3... no"
2658 eval "$2=`ls /mingw/lib/*.a 2>/dev/null | egrep \"\/$3\$\"`"
2661 if [ -z "$res" ]; then
2662 log 2 " trying /mingw/lib/$3... no"
2663 log 1 "configure: error: $2 couldn't be found"
2664 log 1 "configure: error: you requested a static link, but I can't find $3"
2670 # Make sure it exists
2671 if [ -f "$1" ]; then
2672 eval "$2=`ls $1 2>/dev/null`"
2674 eval "$2=`ls $1/$3 2>/dev/null`"
2679 if [ -z "$res" ]; then
2680 log 1 "checking $2... not found"
2681 if [ "$1" = "2" ]; then
2682 log 1 "configure: error: $2 couldn't be found"
2685 elif [ "$1" != "1" ]; then
2686 log 1 "configure: error: $2 couldn't be found"
2687 log 1 "configure: error: you supplied '$1', but it seems invalid"
2698 log 2 " trying $res... found"
2700 log 1 "checking $2... found"
2704 detect_library "$with_zlib" "zlib" "libz.a" "" "zlib.h"
2708 detect_library "$with_lzo2" "lzo2" "liblzo2.a" "lzo/" "lzo1x.h"
2711 detect_libtimidity() {
2712 detect_library "$with_libtimidity" "libtimidity" "libtimidity.a" "" "timidity.h"
2715 detect_pkg_config() {
2716 # $1 - config-param ($with_lzma value)
2717 # $2 - package name ('liblzma')
2718 # $3 - config name ('lzma_config', sets $lzma_config)
2719 # $4 - minimum module version ('2.3')
2721 # 0 means no, 1 is auto-detect, 2 is force
2722 if [ "$1" = "0" ]; then
2723 log 1 "checking $2... disabled"
2729 log 2 "detecting $2"
2731 if [ "$1" = "1" ] || [ "$1" = "" ] || [ "$1" = "2" ]; then
2732 pkg_config_call="pkg-config $2"
2734 pkg_config_call="$1"
2737 version=`$pkg_config_call --modversion 2>/dev/null`
2739 check_version "$4" "$version"
2741 log 2 "executing $pkg_config_call --modversion"
2742 log 2 " returned $version"
2743 log 2 " exit code $ret"
2745 if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$version_ok" != "1" ]; then
2746 if [ -n "$version" ] && [ "$version_ok" != "1" ]; then
2747 log 1 "checking $2... needs at least version $4, $2 NOT enabled"
2749 log 1 "checking $2... not found"
2752 # It was forced, so it should be found.
2753 if [ "$1" != "1" ]; then
2754 log 1 "configure: error: pkg-config $2 couldn't be found"
2755 log 1 "configure: error: you supplied '$1', but it seems invalid"
2763 eval "$3=\"$pkg_config_call\""
2764 log 1 "checking $2... found"
2768 detect_pkg_config "$with_lzma" "liblzma" "lzma_config" "5.0"
2771 detect_xdg_basedir() {
2772 detect_pkg_config "$with_xdg_basedir" "libxdg-basedir" "xdg_basedir_config" "1.2"
2776 # 0 means no, 1 is auto-detect, 2 is force
2777 if [ "$with_png" = "0" ]; then
2778 log 1 "checking libpng... disabled"
2784 if [ "$with_zlib" = "0" ] || [ -z "$zlib" ]; then
2785 if [ "$with_png" != "1" ]; then
2786 log 1 "checking libpng... no zlib"
2787 log 1 "ERROR: libpng was forced, but zlib was not detected / disabled."
2788 log 1 "ERROR: libpng depends on zlib."
2793 log 1 "checking libpng... no zlib, skipping"
2799 detect_pkg_config "$with_png" "libpng" "png_config" "1.2"
2803 # 0 means no, 1 is auto-detect, 2 is force
2804 if [ "$with_freetype" = "0" ]; then
2805 log 1 "checking libfreetype... disabled"
2810 if [ "$with_freetype" = "1" ] && [ "$enable_dedicated" != "0" ]; then
2811 log 1 "checking libfreetype... dedicated server, skipping"
2817 if [ "$with_zlib" = "0" ] || [ -z "$zlib" ]; then
2818 if [ "$with_freetype" != "1" ]; then
2819 log 1 "checking libfreetype... no zlib"
2820 log 1 "ERROR: libfreetype was forced, but zlib was not detected / disabled."
2821 log 1 "ERROR: libfreetype depends on zlib."
2826 log 1 "checking libfreetype... no zlib, skipping"
2832 if [ "$with_freetype" = "1" ] || [ "$with_freetype" = "" ] || [ "$with_freetype" = "2" ]; then
2833 freetype_config="freetype-config"
2835 freetype_config="$with_freetype"
2838 version=`$freetype_config --version 2>/dev/null`
2840 log 2 "executing freetype_config --version"
2841 log 2 " returned $version"
2842 log 2 " exit code $ret"
2844 if [ -z "$version" ] || [ "$ret" != "0" ]; then
2845 log 1 "checking libfreetype... not found"
2847 # It was forced, so it should be found.
2848 if [ "$with_freetype" != "1" ]; then
2849 log 1 "configure: error: freetype-config couldn't be found"
2850 log 1 "configure: error: you supplied '$with_freetype', but it seems invalid"
2858 log 1 "checking libfreetype... found"
2861 detect_fontconfig() {
2862 # 0 means no, 1 is auto-detect, 2 is force
2863 if [ "$with_fontconfig" = "0" ]; then
2864 log 1 "checking libfontconfig... disabled"
2866 fontconfig_config=""
2869 if [ "$with_fontconfig" = "1" ] && [ "$enable_dedicated" != "0" ]; then
2870 log 1 "checking libfontconfig... dedicated server, skipping"
2872 fontconfig_config=""
2875 if [ "$with_fontconfig" != "2" ] && [ -z "$freetype_config" ]; then
2876 log 1 "checking libfontconfig... no freetype, skipping"
2878 fontconfig_config=""
2882 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ]; then
2883 log 1 "checking libfontconfig... WIN32, skipping"
2884 fontconfig_config=""
2888 if [ "$os" = "OSX" ]; then
2889 log 1 "checking libfontconfig... OSX, skipping"
2890 fontconfig_config=""
2894 detect_pkg_config "$with_fontconfig" "fontconfig" "fontconfig_config" "2.3"
2898 # 0 means no, 1 is auto-detect, 2 is force
2899 if [ "$with_icu" = "0" ]; then
2900 log 1 "checking libicu... disabled"
2905 if [ "$with_icu" = "1" ] && [ "$enable_dedicated" != "0" ]; then
2906 log 1 "checking libicu... dedicated server, skipping"
2912 if [ "$with_icu" = "1" ] || [ "$with_icu" = "" ] || [ "$with_icu" = "2" ]; then
2913 icu_config="icu-config"
2915 icu_config="$with_icu"
2918 version=`$icu_config --version 2>/dev/null`
2920 check_version '3.6' "$version"
2922 log 2 "executing $icu_config --version"
2923 log 2 " returned $version"
2924 log 2 " exit code $ret"
2926 if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$version_ok" != "1" ]; then
2927 if [ -n "$version" ] && [ "$version_ok" != "1" ]; then
2928 log 1 "checking libicu... needs at least version 3.6.0, icu NOT enabled"
2930 log 1 "checking libicu... not found"
2933 # It was forced, so it should be found.
2934 if [ "$with_icu" != "1" ]; then
2935 log 1 "configure: error: icu-config couldn't be found"
2936 log 1 "configure: error: you supplied '$with_icuconfig', but it seems invalid"
2944 log 1 "checking libicu... found"
2947 detect_pspconfig() {
2948 # 0 means no, 1 is auto-detect, 2 is force
2949 if [ "$with_psp_config" = "0" ]; then
2950 log 1 "checking psp-config... disabled"
2956 if [ "$with_psp_config" = "1" ] && [ "$os" != "PSP" ]; then
2957 log 1 "checking psp-config... not PSP, skipping"
2963 if [ "$os" != "PSP" ]; then
2964 log 1 "checking psp-config... not PSP"
2966 log 1 "configure: error: psp-config is only supported for PSP"
2970 if [ "$with_psp_config" = "1" ] || [ "$with_psp_config" = "" ] || [ "$with_psp_config" = "2" ]; then
2971 psp_config="psp-config"
2973 psp_config="$with_psp_config"
2976 version=`$psp_config -p 2>/dev/null`
2978 log 2 "executing $psp_config -p"
2979 log 2 " returned $version"
2980 log 2 " exit code $ret"
2982 if [ -z "$version" ] || [ "$ret" != "0" ]; then
2983 log 1 "checking psp-config... not found"
2984 log 1 "configure: error: psp-config couldn't be found"
2986 # It was forced, so it should be found.
2987 if [ "$with_psp_config" != "1" ]; then
2988 log 1 "configure: error: you supplied '$with_psp_config', but it seems invalid"
2993 log 1 "checking psp-config... found"
2997 # 0 means no, 1 is auto-detect, 2 is force
2998 if [ "$with_iconv" = "0" ]; then
2999 log 1 "checking iconv... disabled"
3004 if [ "$with_iconv" = "1" ] && [ "$os" != "OSX" ]; then
3005 log 1 "checking iconv... not OSX, skipping"
3011 # Try to find iconv.h, seems to only thing to detect iconv with
3013 if [ "$with_iconv" = "1" ] || [ "$with_iconv" = "" ] || [ "$with_iconv" = "2" ]; then
3014 iconv=`ls -1 /usr/include 2>/dev/null | grep "iconv.h"`
3015 if [ -z "$iconv" ]; then
3016 iconv=`ls -1 /usr/local/include 2>/dev/null | grep "iconv.h"`
3019 # Make sure it exists
3020 iconv=`ls $with_iconv/include/iconv.h 2>/dev/null`
3023 if [ -z "$iconv" ]; then
3024 log 1 "checking iconv... not found"
3025 if [ "$with_iconv" = "2" ]; then
3026 log 1 "configure: error: iconv couldn't be found"
3029 elif [ "$with_iconv" != "1" ]; then
3030 log 1 "configure: error: iconv couldn't be found"
3031 log 1 "configure: error: you supplied '$with_iconv', but I couldn't detect iconv in it"
3039 if [ "$with_iconv" = "1" ]; then
3043 log 2 "found iconv in $iconv"
3045 log 1 "checking iconv... found"
3047 # There are different implementations of iconv. The older ones,
3048 # e.g. SUSv2, pass a const pointer, whereas the newer ones, e.g.
3049 # IEEE 1003.1 (2004), pass a non-const pointer.
3051 cat > tmp.iconv.cpp << EOF
3052 #include "src/stdafx.h"
3055 static char buf[1024];
3057 const char *inbuf = "";
3059 size_t outlen = 1023;
3061 return iconv(convd, &inbuf, &inlen, &outbuf, &outlen);
3064 execute="$cxx_host $OSX_SYSROOT $CFLAGS -c tmp.iconv.cpp -o tmp.iconv -DTESTING 2>&1"
3065 eval $execute > /dev/null
3067 log 2 "executing $execute"
3068 log 2 " exit code $ret"
3069 if [ "$ret" = "0" ]; then have_non_const_iconv="no"; else have_non_const_iconv="yes"; fi
3070 log 1 "checking if iconv has non-const inbuf... $have_non_const_iconv"
3072 cat > tmp.iconv.cpp << EOF
3073 #include "src/stdafx.h"
3076 static char buf[1024];
3080 size_t outlen = 1023;
3082 return iconv(convd, &inbuf, &inlen, &outbuf, &outlen);
3085 execute="$cxx_host $OSX_SYSROOT $OSX_LD_SYSROOT $CFLAGS tmp.iconv.cpp -o tmp.iconv -DTESTING 2>&1"
3086 eval $execute > /dev/null
3088 log 2 "executing $execute"
3089 log 2 " exit code $ret"
3090 if [ "$ret" = "0" ]; then link_to_iconv="no"; else link_to_iconv="yes"; fi
3091 log 1 "checking whether to link to iconv... $link_to_iconv"
3092 rm -f tmp.iconv tmp.iconv.cpp
3106 log 2 "running echo <array> | $1"
3108 if [ "`echo \"$sort_test_in\" | $1 2>/dev/null`" = "$sort_test_out" ]; then
3110 log 2 " result was valid"
3112 log 2 " result was invalid"
3117 if [ "$with_sort" = "0" ]; then
3118 log 1 "checking sort... disabled"
3123 if [ "$with_sort" = "1" ] || [ "$with_sort" = "2" ]; then
3125 if [ -z "$sort" ]; then _detect_sort "/sbin/sort"; fi
3126 if [ -z "$sort" ]; then _detect_sort "/usr/sbin/sort"; fi
3127 if [ -z "$sort" ]; then _detect_sort "/usr/local/sbin/sort"; fi
3128 if [ -z "$sort" ]; then _detect_sort "/bin/sort"; fi
3129 if [ -z "$sort" ]; then _detect_sort "/usr/bin/sort"; fi
3130 if [ -z "$sort" ]; then _detect_sort "/usr/local/bin/sort"; fi
3132 _detect_sort "$with_sort"
3135 if [ -z "$sort" ]; then
3136 if [ "$with_sort" = "2" ]; then
3137 log 1 "checking sort... not found"
3139 log 1 "configure: error: couldn't detect sort on your system"
3141 elif [ "$with_sort" != "1" ]; then
3142 log 1 "checking sort... $with_sort not found"
3144 log 1 "configure: error: '$with_sort' doesn't look like a sort to me"
3145 log 1 "configure: error: please verify its location and function and try again"
3149 log 1 "checking sort... not found"
3152 log 1 "checking sort... $sort"
3157 # 0 means no, 1 is auto-detect, 2 is force
3158 if [ "$with_grfcodec" = "0" ]; then
3159 log 1 "checking grfcodec... disabled"
3165 if [ "$with_grfcodec" = "1" ] || [ "$with_grfcodec" = "" ] || [ "$with_grfcodec" = "2" ]; then
3168 grfcodec="$with_grfcodec"
3171 version=`$grfcodec -v 2>/dev/null | $awk '{print $3}' | sed 's/[rM]//g;s/-/0/'`
3173 log 2 "executing grfcodec -v"
3174 log 2 " returned $version"
3175 log 2 " exit code $ret"
3177 if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$version" -lt "985" ]; then
3178 if [ -n "$version" ] && [ "$version" -lt "985" ]; then
3179 log 1 "checking grfcodec... needs at least version 6.0.5 (r985), disabled"
3181 log 1 "checking grfcodec... not found"
3184 # It was forced, so it should be found.
3185 if [ "$with_grfcodec" != "1" ]; then
3186 log 1 "configure: error: grfcodec couldn't be found"
3187 log 1 "configure: error: you supplied '$with_grfcodec', but it seems invalid"
3195 log 1 "checking grfcodec... found"
3199 # 0 means no, 1 is auto-detect, 2 is force
3200 if [ "$with_nforenum" = "0" ]; then
3201 log 1 "checking nforenum... disabled"
3207 if [ "$with_nforenum" = "1" ] || [ "$with_nforenum" = "" ] || [ "$with_nforenum" = "2" ]; then
3210 nforenum="$with_nforenum"
3213 version=`$nforenum -v 2>/dev/null | $awk '{print $3}' | sed 's/[rM]//g;s/-/0/'`
3215 log 2 "executing nforenum -v"
3216 log 2 " returned $version"
3217 log 2 " exit code $ret"
3219 if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$version" -lt "985" ]; then
3220 if [ -n "$version" ] && [ "$version" -lt "985" ]; then
3221 log 1 "checking nforenum... needs at least version 6.0.5 (r985), disabled"
3223 log 1 "checking nforenum... not found"
3226 # It was forced, so it should be found.
3227 if [ "$with_nforenum" != "1" ]; then
3228 log 1 "configure: error: nforenum couldn't be found"
3229 log 1 "configure: error: you supplied '$with_nforenum', but it seems invalid"
3237 log 1 "checking nforenum... found"
3241 if [ -n "$cpu_type" ] && [ "$cpu_type" != "DETECT" ]; then
3242 log 1 "forcing cpu-type... $cpu_type bits"
3245 echo "#define _SQ64 1" > tmp.64bit.cpp
3246 echo "#include \"src/stdafx.h\"" >> tmp.64bit.cpp
3247 echo "assert_compile(sizeof(size_t) == 8);" >> tmp.64bit.cpp
3248 echo "int main() { return 0; }" >> tmp.64bit.cpp
3249 execute="$cxx_host $CFLAGS tmp.64bit.cpp -o tmp.64bit -DTESTING 2>&1"
3250 cpu_type="`eval $execute 2>/dev/null`"
3252 log 2 "executing $execute"
3253 log 2 " returned $cpu_type"
3254 log 2 " exit code $ret"
3255 if [ "$ret" = "0" ]; then cpu_type="64"; else cpu_type="32"; fi
3256 log 1 "detecting cpu-type... $cpu_type bits"
3257 rm -f tmp.64bit tmp.64bit.cpp
3260 detect_sse_capable_architecture() {
3261 # 0 means no, 1 is auto-detect, 2 is force
3262 if [ "$with_sse" = "0" ]; then
3263 log 1 "checking SSE... disabled"
3267 echo "#define _SQ64 1" > tmp.sse.cpp
3268 echo "#include <xmmintrin.h>" >> tmp.sse.cpp
3269 echo "#include <smmintrin.h>" >> tmp.sse.cpp
3270 echo "#include <tmmintrin.h>" >> tmp.sse.cpp
3271 echo "int main() { return 0; }" >> tmp.sse.cpp
3272 execute="$cxx_host -msse4.1 $CFLAGS tmp.sse.cpp -o tmp.sse 2>&1"
3273 sse="`eval $execute 2>/dev/null`"
3275 log 2 "executing $execute"
3276 log 2 " returned $sse"
3277 log 2 " exit code $ret"
3278 if [ "$ret" = "0" ]; then
3279 log 1 "detecting SSE... found"
3281 # It was forced, so it should be found.
3282 if [ "$with_sse" != "1" ]; then
3283 log 1 "configure: error: SSE couln't be found"
3284 log 1 "configure: error: you force enabled SSE, but it seems unavailable"
3288 log 1 "detecting SSE... not found"
3291 rm -f tmp.sse tmp.exe tmp.sse.cpp
3296 T_CXXFLAGS="$CXXFLAGS"
3297 T_LDFLAGS="$LDFLAGS"
3299 SRC_OBJS_DIR="$BASE_SRC_OBJS_DIR/$OBJS_SUBDIR"
3301 # All the data needed to compile a single target
3302 # Make sure if you compile multiple targets to
3303 # use multiple OBJS_DIR, because all in-between
3304 # binaries are stored in there, and nowhere else.
3306 s@!!CC_HOST!!@$cc_host@g;
3307 s@!!CXX_HOST!!@$cxx_host@g;
3308 s@!!CC_BUILD!!@$cc_build@g;
3309 s@!!CXX_BUILD!!@$cxx_build@g;
3310 s@!!WINDRES!!@$windres@g;
3311 s@!!STRIP!!@$strip $strip_arg@g;
3313 s@!!CFLAGS!!@$T_CFLAGS@g;
3314 s@!!CFLAGS_BUILD!!@$CFLAGS_BUILD@g;
3315 s@!!CXXFLAGS!!@$T_CXXFLAGS@g;
3316 s@!!CXXFLAGS_BUILD!!@$CXXFLAGS_BUILD@g;
3317 s@!!STRGEN_FLAGS!!@$strgen_flags@g;
3319 s@!!LDFLAGS!!@$T_LDFLAGS@g;
3320 s@!!LDFLAGS_BUILD!!@$LDFLAGS_BUILD@g;
3321 s@!!BIN_DIR!!@$BIN_DIR@g;
3322 s@!!ROOT_DIR!!@$ROOT_DIR@g;
3323 s@!!MEDIA_DIR!!@$MEDIA_DIR@g;
3324 s@!!SOURCE_LIST!!@$SOURCE_LIST@g;
3325 s@!!SRC_OBJS_DIR!!@$SRC_OBJS_DIR@g;
3326 s@!!LANG_OBJS_DIR!!@$LANG_OBJS_DIR@g;
3327 s@!!GRF_OBJS_DIR!!@$GRF_OBJS_DIR@g;
3328 s@!!SETTING_OBJS_DIR!!@$SETTING_OBJS_DIR@g;
3329 s@!!SRC_DIR!!@$SRC_DIR@g;
3330 s@!!SCRIPT_SRC_DIR!!@$SCRIPT_SRC_DIR@g;
3331 s@!!OSXAPP!!@$OSXAPP@g;
3332 s@!!LANG_DIR!!@$LANG_DIR@g;
3334 s@!!BINARY_DIR!!@$prefix_dir/$binary_dir@g;
3335 s@!!DATA_DIR!!@$prefix_dir/$data_dir@g;
3336 s@!!DOC_DIR!!@$prefix_dir/$doc_dir@g;
3337 s@!!MAN_DIR!!@$prefix_dir/$man_dir@g;
3338 s@!!ICON_DIR!!@$prefix_dir/$icon_dir@g;
3339 s@!!ICON_THEME_DIR!!@$prefix_dir/$icon_theme_dir@g;
3340 s@!!PERSONAL_DIR!!@$personal_dir@g;
3341 s@!!SHARED_DIR!!@$shared_dir@g;
3342 s@!!INSTALL_DIR!!@$install_dir@g;
3343 s@!!BINARY_NAME!!@$binary_name@g;
3344 s@!!STRGEN!!@$STRGEN@g;
3345 s@!!ENDIAN_CHECK!!@$ENDIAN_CHECK@g;
3346 s@!!DEPEND!!@$DEPEND@g;
3347 s@!!SETTINGSGEN!!@$SETTINGSGEN@g;
3348 s@!!ENDIAN_FORCE!!@$endian@g;
3349 s@!!STAGE!!@$STAGE@g;
3350 s@!!MAKEDEPEND!!@$makedepend@g;
3351 s@!!CFLAGS_MAKEDEP!!@$cflags_makedep@g;
3353 s@!!CONFIG_CACHE_COMPILER!!@config.cache.compiler@g;
3354 s@!!CONFIG_CACHE_LINKER!!@config.cache.linker@g;
3355 s@!!CONFIG_CACHE_ENDIAN!!@config.cache.endian@g;
3356 s@!!CONFIG_CACHE_SOURCE!!@config.cache.source@g;
3357 s@!!CONFIG_CACHE_VERSION!!@config.cache.version@g;
3358 s@!!CONFIG_CACHE_SOURCE_LIST!!@config.cache.source.list@g;
3359 s@!!CONFIG_CACHE_PWD!!@config.cache.pwd@g;
3360 s@!!LANG_SUPPRESS!!@$lang_suppress@g;
3361 s@!!OBJS_C!!@$OBJS_C@g;
3362 s@!!OBJS_CPP!!@$OBJS_CPP@g;
3363 s@!!OBJS_MM!!@$OBJS_MM@g;
3364 s@!!OBJS_RC!!@$OBJS_RC@g;
3367 s@!!CONFIGURE_FILES!!@$CONFIGURE_FILES@g;
3369 s@!!DISTCC!!@$distcc@g;
3370 s@!!NFORENUM!!@$nforenum@g;
3371 s@!!GRFCODEC!!@$grfcodec@g;
3374 if [ "$icon_theme_dir" != "" ]; then
3375 SRC_REPLACE="$SRC_REPLACE
3376 s@!!ICON_THEME_DIR!!@$prefix_dir/$icon_theme_dir@g;
3379 SRC_REPLACE="$SRC_REPLACE
3380 s@!!ICON_THEME_DIR!!@@g;
3384 if [ "$man_dir" != "" ]; then
3385 SRC_REPLACE="$SRC_REPLACE
3386 s@!!MAN_DIR!!@$prefix_dir/$man_dir@g;
3389 SRC_REPLACE="$SRC_REPLACE
3394 if [ "$menu_dir" != "" ]; then
3395 SRC_REPLACE="$SRC_REPLACE
3396 s@!!MENU_DIR!!@$prefix_dir/$menu_dir@g;
3399 SRC_REPLACE="$SRC_REPLACE
3405 generate_menu_item() {
3408 s@!!MENU_GROUP!!@$menu_group@g;
3409 s@!!MENU_NAME!!@$menu_name@g
3411 log 1 "Generating menu item..."
3413 < $ROOT_DIR/media/openttd.desktop.in sed "$MENU_REPLACE" > media/openttd.desktop
3421 # Create the main Makefile
3422 log 1 "Generating Makefile..."
3423 echo "# Auto-generated file from 'Makefile.in' -- DO NOT EDIT" > Makefile
3424 < $ROOT_DIR/Makefile.in sed "$SRC_REPLACE" >> Makefile
3425 cp $ROOT_DIR/Makefile.bundle.in Makefile.bundle
3426 echo "# Auto-generated file -- DO NOT EDIT" > Makefile.am
3428 # Make the copy of the source-list, so we don't trigger an unwanted recompile
3429 cp $SOURCE_LIST config.cache.source.list
3430 # Add the current directory, so we don't trigger an unwanted recompile
3431 echo "`pwd`" > config.cache.pwd
3432 # Make sure config.cache is OLDER then config.cache.source.list
3436 if [ "$menu_dir" != "" ]; then
3446 # Create the language file
3447 mkdir -p $LANG_OBJS_DIR
3449 log 1 "Generating lang/Makefile..."
3450 echo "# Auto-generated file from 'Makefile.lang.in' -- DO NOT EDIT" > $LANG_OBJS_DIR/Makefile
3451 < $ROOT_DIR/Makefile.lang.in sed "$SRC_REPLACE" >> $LANG_OBJS_DIR/Makefile
3452 echo "DIRS += $LANG_OBJS_DIR" >> Makefile.am
3453 echo "LANG_DIRS += $LANG_OBJS_DIR" >> Makefile.am
3456 generate_settings() {
3461 # Create the language file
3462 mkdir -p $SETTING_OBJS_DIR
3464 log 1 "Generating setting/Makefile..."
3465 echo "# Auto-generated file from 'Makefile.settings.in' -- DO NOT EDIT" > $SETTING_OBJS_DIR/Makefile
3466 < $ROOT_DIR/Makefile.setting.in sed "$SRC_REPLACE" >> $SETTING_OBJS_DIR/Makefile
3467 echo "DIRS += $SETTING_OBJS_DIR" >> Makefile.am
3475 # Create the language file
3476 mkdir -p $GRF_OBJS_DIR
3478 log 1 "Generating grf/Makefile..."
3479 echo "# Auto-generated file from 'Makefile.grf.in' -- DO NOT EDIT" > $GRF_OBJS_DIR/Makefile
3480 < $ROOT_DIR/Makefile.grf.in sed "$SRC_REPLACE" >> $GRF_OBJS_DIR/Makefile
3481 echo "DIRS += $GRF_OBJS_DIR" >> Makefile.am
3484 generate_src_normal() {
3489 # Create the source file
3490 mkdir -p $SRC_OBJS_DIR
3492 log 1 "Generating $2/Makefile..."
3493 echo "# Auto-generated file from 'Makefile.src.in' -- DO NOT EDIT" > $SRC_OBJS_DIR/Makefile
3494 < $ROOT_DIR/Makefile.src.in sed "$SRC_REPLACE" >> $SRC_OBJS_DIR/Makefile
3495 echo "DIRS += $SRC_OBJS_DIR" >> Makefile.am
3496 echo "SRC_DIRS += $SRC_OBJS_DIR" >> Makefile.am
3499 generate_src_osx() {
3500 cc_host_orig="$cc_host"
3501 cxx_host_orig="$cxx_host"
3502 CFLAGS_orig="$CFLAGS"
3503 LDFLAGS_orig="$LDFLAGS"
3505 for type in $enable_universal; do
3507 if [ -n "$osx_sdk_104_path" ]; then
3508 # Use 10.4 SDK for 32-bit targets
3509 CFLAGS="-isysroot $osx_sdk_104_path $CFLAGS_orig"
3510 LDFLAGS="-Wl,-syslibroot,$osx_sdk_104_path $LDFLAGS_orig"
3513 # We don't want to duplicate the x86_64 stuff for each target, so do it once here
3514 if [ "$type" = "ppc64" ] || [ "$type" = "x86_64" ]; then
3515 # 64 bits is always 10.5 or higher. Furthermore it has a non const ICONV
3516 # and they also removed support for QuickTime/QuickDraw
3517 if [ -n "$osx_sdk_path" ]; then
3518 CFLAGS="-isysroot $osx_sdk_path $CFLAGS_orig"
3519 LDFLAGS="-Wl,-syslibroot,$osx_sdk_path $LDFLAGS_orig"
3521 CFLAGS="$CFLAGS -D_SQ64 -DNO_QUICKTIME -UENABLE_COCOA_QUICKDRAW"
3522 LIBS="`echo $LIBS | sed 's/-framework QuickTime//'`"
3527 BASE_SRC_OBJS_DIR="$OBJS_DIR/ppc"
3528 cc_host="$cc_host_orig -arch ppc -mmacosx-version-min=10.3"
3529 cxx_host="$cxx_host_orig -arch ppc -mmacosx-version-min=10.3"
3530 generate_src_normal "[ppc]" "objs/ppc";;
3532 BASE_SRC_OBJS_DIR="$OBJS_DIR/ppc970"
3533 cc_host="$cc_host_orig -arch ppc970 -mmacosx-version-min=10.3 -mcpu=G5 -mpowerpc64 -mtune=970 -mcpu=970 -mpowerpc-gpopt"
3534 cxx_host="$cxx_host_orig -arch ppc970 -mmacosx-version-min=10.3 -mcpu=G5 -mpowerpc64 -mtune=970 -mcpu=970 -mpowerpc-gpopt"
3535 generate_src_normal "[ppc970]" "objs/ppc970";;
3537 BASE_SRC_OBJS_DIR="$OBJS_DIR/i386"
3538 cc_host="$cc_host_orig -arch i386 -mmacosx-version-min=10.4"
3539 cxx_host="$cxx_host_orig -arch i386 -mmacosx-version-min=10.4"
3540 generate_src_normal "[i386]" "objs/i386";;
3542 BASE_SRC_OBJS_DIR="$OBJS_DIR/ppc64"
3543 cc_host="$cc_host_orig -arch ppc64 -mmacosx-version-min=10.5"
3544 cxx_host="$cxx_host_orig -arch ppc64 -mmacosx-version-min=10.5"
3545 generate_src_normal "[ppc64]" "objs/ppc64";;
3547 BASE_SRC_OBJS_DIR="$OBJS_DIR/x86_64"
3548 cc_host="$cc_host_orig -arch x86_64 -mmacosx-version-min=10.5"
3549 cxx_host="$cxx_host_orig -arch x86_64 -mmacosx-version-min=10.5"
3550 generate_src_normal "[x86_64]" "objs/x86_64";;
3551 *) log 1 "Unknown architecture requested for universal build: $type";;
3557 if [ "$os" = "OSX" ] && [ "$enable_universal" != "0" ]; then
3560 generate_src_normal "[SRC]" "objs"
3565 echo "'configure' configures OpenTTD."
3567 echo "Usage: $0 [OPTION]... [VAR=VALUE]..."
3569 echo "To assign environment variables (e.g., CC, CFLAGS...), specify them as"
3570 echo "VAR=VALUE. See below for descriptions of some of the useful variables."
3572 echo "Defaults for the options are specified in brackets."
3574 echo "Configuration:"
3575 echo " -h, --help display this help and exit"
3577 echo "System types:"
3578 echo " --build=BUILD configure for building on BUILD [guessed]"
3579 echo " --host=HOST cross-compile to build programs to run"
3580 echo " on HOST [BUILD]"
3581 echo " --windres=WINDRES the windres to use [HOST-windres]"
3582 echo " --strip=STRIP the strip to use [HOST-strip]"
3583 echo " --awk=AWK the awk to use in configure [awk]"
3584 echo " --lipo=LIPO the lipo to use (OSX ONLY) [HOST-lipo]"
3585 echo " --os=OS the OS we are compiling for [DETECT]"
3586 echo " DETECT/UNIX/OSX/FREEBSD/OPENBSD/NETBSD/"
3587 echo " MORPHOS/HPUX/BEOS/SUNOS/CYGWIN/MINGW/OS2/"
3588 echo " DOS/WINCE/PSP/HAIKU"
3589 echo " --endian=ENDIAN set the endian of the HOST (AUTO/LE/BE)"
3592 echo " --prefix-dir=dir specifies the prefix for all installed"
3593 echo " files [/usr/local]"
3594 echo " --binary-dir=dir location of the binary. Will be prefixed"
3595 echo " with the prefix-dir [games]"
3596 echo " --data-dir=dir location of data files (lang, data, gm)."
3597 echo " Will be prefixed with the prefix-dir"
3598 echo " [share/games/openttd]"
3599 echo " --doc-dir=dir location of the doc files"
3600 echo " Will be prefixed with the prefix-dir"
3602 echo " --icon-dir=dir location of icons. Will be prefixed"
3603 echo " with the prefix-dir [share/pixmaps]"
3604 echo " --icon-theme-dir=dir location of icon theme."
3605 echo " Will be prefixed with the prefix-dir"
3606 echo " and postfixed with size-dirs [$icon_theme_dir]"
3607 echo " --man-dir=dir location of the manual page (UNIX only)"
3608 echo " Will be prefixed with the prefix-dir"
3610 echo " --menu-dir=dir location of the menu item. (UNIX only, except OSX)"
3611 echo " Will be prefixed with the prefix-dir"
3612 echo " [share/applications]"
3613 echo " --personal-dir=dir location of the personal directory"
3614 echo " [os-dependent default]"
3615 echo " --shared-dir=dir location of shared data files"
3616 echo " [os-dependent default]"
3617 echo " --install-dir=dir specifies the root to install to."
3618 echo " Useful to install into jails [/]"
3619 echo " --binary-name the name used for the binary, icons,"
3620 echo " desktop file, etc. when installing [openttd]"
3622 echo "Features and packages:"
3623 echo " --enable-debug[=LVL] enable debug-mode (LVL=[0123], 0 is release)"
3624 echo " --enable-desync-debug=[LVL] enable desync debug options (LVL=[012], 0 is none"
3625 echo " --enable-profiling enables profiling"
3626 echo " --enable-lto enables GCC's Link Time Optimization (LTO)/ICC's"
3627 echo " Interprocedural Optimization if available"
3628 echo " --enable-dedicated compile a dedicated server (without video)"
3629 echo " --enable-static enable static compile (doesn't work for"
3631 echo " --enable-translator enable extra output for translators"
3632 echo " --enable-universal[=ARCH] enable universal builds (OSX ONLY). Allowed is any combination"
3633 echo " of architectures: i386 ppc ppc970 ppc64 x86_64"
3634 echo " Default architectures are: i386 ppc"
3635 echo " --enable-osx-g5 enables optimizations for ppc970 (G5) (OSX ONLY)"
3636 echo " --disable-cocoa-quartz disable the quartz window mode driver for Cocoa (OSX ONLY)"
3637 echo " --disable-cocoa-quickdraw disable the quickdraw window mode driver for Cocoa (OSX ONLY)"
3638 echo " --disable-unicode disable unicode support to build win9x"
3639 echo " version (Win32 ONLY)"
3640 echo " --enable-console compile as a console application instead of as a GUI application."
3641 echo " If this setting is active, debug output will appear in the same"
3642 echo " console instead of opening a new window. (Win32 ONLY)"
3643 echo " --disable-network disable network support"
3644 echo " --disable-assert disable asserts (continue on errors)"
3645 echo " --enable-strip enable any possible stripping"
3646 echo " --without-osx-sysroot disable the automatic adding of sysroot "
3648 echo " --without-application-bundle disable generation of application bundle"
3650 echo " --without-menu-entry Don't generate a menu item (Freedesktop based only)"
3651 echo " --menu-group=group Category in which the menu item will be placed (Freedesktop based only)"
3652 echo " --menu-name=name Name of the menu item when placed [OpenTTD]"
3653 echo " --with-direct-music enable direct music support (Win32 ONLY)"
3654 echo " --with-sort=sort define a non-default location for sort"
3655 echo " --with-midi=midi define which midi-player to use"
3656 echo " --with-midi-arg=arg define which args to use for the"
3658 echo " --with-libtimidity enables libtimidity support"
3659 echo " --with-allegro[=allegro-config]"
3660 echo " enables Allegro video driver support"
3661 echo " --with-cocoa enables COCOA video driver (OSX ONLY)"
3662 echo " --with-sdl[=sdl-config] enables SDL video driver support"
3663 echo " --with-zlib[=zlib.a] enables zlib support"
3664 echo " --with-liblzma[=\"pkg-config liblzma\"]"
3665 echo " enables liblzma support"
3666 echo " --with-liblzo2[=liblzo2.a] enables liblzo2 support"
3667 echo " --with-png[=libpng-config] enables libpng support"
3668 echo " --with-freetype[=freetype-config]"
3669 echo " enables libfreetype support"
3670 echo " --with-fontconfig[=\"pkg-config fontconfig\"]"
3671 echo " enables fontconfig support"
3672 echo " --with-xdg-basedir[=\"pkg-config libxdg-basedir\"]"
3673 echo " enables XDG base directory support"
3674 echo " --with-icu[=icu-config] enables icu (used for right-to-left support)"
3675 echo " --static-icu try to link statically (libsicu instead of"
3676 echo " libicu; can fail as the new name is guessed)"
3677 echo " --with-iconv[=iconv-path] enables iconv support"
3678 echo " --with-psp-config[=psp-config] enables psp-config support (PSP ONLY)"
3679 echo " --disable-builtin-depend disable use of builtin deps finder"
3680 echo " --with-makedepend[=makedepend] enables makedepend support"
3681 echo " --with-ccache enables ccache support"
3682 echo " --with-distcc enables distcc support"
3683 echo " --without-grfcodec disable usage of grfcodec and re-generation of base sets"
3684 echo " --without-threads disable threading support"
3685 echo " --without-sse disable SSE support (x86/x86_64 only)"
3687 echo "Some influential environment variables:"
3688 echo " CC C compiler command"
3689 echo " CXX C++ compiler command"
3690 echo " CFLAGS C compiler flags"
3691 echo " CXXFLAGS C++ compiler flags"
3692 echo " WINDRES windres command"
3693 echo " LDFLAGS linker flags, e.g. -L<lib dir> if you"
3694 echo " have libraries in a nonstandard"
3695 echo " directory <lib dir>"
3696 echo " CFLAGS_BUILD C compiler flags for build time tool generation"
3697 echo " CXXFLAGS_BUILD C++ compiler flags for build time tool generation"
3698 echo " LDFLAGS_BUILD linker flags for build time tool generation"
3700 echo "Use these variables to override the choices made by 'configure' or to help"
3701 echo "it to find libraries and programs with nonstandard names/locations."