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"
76 enable_builtin_depend="1"
139 enable_cocoa_quickdraw
141 with_application_bundle
149 enable_builtin_depend
167 CC CXX CFLAGS CXXFLAGS LDFLAGS CFLAGS_BUILD CXXFLAGS_BUILD LDFLAGS_BUILD"
171 # Walk over all params from the user and override any default settings if
172 # needed. This also handles any invalid option.
174 if [ -n "$prev_p" ]; then
180 optarg=`expr "x$p" : 'x[^=]*=\(.*\)'`
183 --help | -h | -\?) showhelp; exit 0;;
185 --config-log) prev_p="config_log";;
186 --config-log=*) config_log="$optarg";;
188 --build) prev_p="build";;
189 --build=*) build="$optarg";;
191 --host) prev_p="host";;
192 --host=*) host="$optarg";;
195 --os=*) os="$optarg";;
197 --cpu-type) prev_p="cpu_type";;
198 --cpu-type=*) cpu_type="$optarg";;
200 --cc-build) prev_p="cc_build";;
201 --cc-build=*) cc_build="$optarg";;
202 --cc-host) prev_p="cc_host";;
203 --cc-host=*) cc_host="$optarg";;
204 --cxx-build) prev_p="cxx_build";;
205 --cxx-build=*) cxx_build="$optarg";;
206 --cxx-host) prev_p="cxx_host";;
207 --cxx-host=*) cxx_host="$optarg";;
208 --windres) prev_p="windres";;
209 --windres=*) windres="$optarg";;
210 --awk) prev_p="awk";;
211 --awk=*) awk="$optarg";;
212 --strip) prev_p="strip";;
213 --strip=*) strip="$optarg";;
214 --lipo) prev_p="lipo";;
215 --lipo=*) lipo="$optarg";;
217 --endian) prev_p="endian";;
218 --endian=*) endian="$optarg";;
222 # Alias --prefix with --prefix-dir, for compatibility with GNU autotools
223 --prefix-dir | --prefix) prev_p="prefix_dir";;
224 --prefix-dir=* | --prefix=*) prefix_dir="$optarg";;
226 --binary-dir) prev_p="binary_dir";;
227 --binary-dir=*) binary_dir="$optarg";;
229 --data-dir) prev_p="data_dir";;
230 --data-dir=*) data_dir="$optarg";;
232 --doc-dir) prev_p="doc_dir";;
233 --doc-dir=*) doc_dir="$optarg";;
235 --icon-dir) prev_p="icon_dir";;
236 --icon-dir=*) icon_dir="$optarg";;
238 --icon-theme-dir) prev_p="icon_theme_dir";;
239 --icon-theme-dir=*) icon_theme_dir="$optarg";;
240 --without-icon-theme) icon_theme_dir="";;
242 --menu-dir) prev_p="menu_dir";;
243 --menu-dir=*) menu_dir="$optarg";;
244 --without-menu-entry) menu_dir="";;
246 --menu-name) prev_p="menu_name";;
247 --menu-name=*) menu_name="$optarg";;
249 --binary-name) prev_p="binary_name";;
250 --binary-name=*) binary_name="$optarg";;
252 --man-dir) prev_p="man_dir";;
253 --man-dir=*) man_dir="$optarg";;
255 --personal-dir) prev_p="personal_dir";;
256 --personal-dir=*) personal_dir="$optarg";;
257 --without-personal-dir) personal_dir="";;
259 --shared-dir) prev_p="shared_dir";;
260 --shared-dir=*) shared_dir="$optarg";;
261 --without-shared-dir) shared_dir="";;
263 --install-dir) prev_p="install_dir";;
264 --install-dir=*) install_dir="$optarg";;
268 --menu-group) prev_p="menu_group";;
269 --menu-group=*) menu_group="$optarg";;
273 --enable-debug) enable_debug="1";;
274 --enable-debug=*) enable_debug="$optarg";;
275 --enable-desync-debug) enable_desync_debug="1";;
276 --enable-desync-debug=*) enable_desync_debug="$optarg";;
277 --enable-profiling) enable_profiling="1";;
278 --enable-profiling=*) enable_profiling="$optarg";;
279 --enable-lto) enable_lto="1";;
280 --enable-lto=*) enable_lto="$optarg";;
281 --enable-ipo) enable_lto="1";;
282 --enable-ipo=*) enable_lto="$optarg";;
283 --enable-dedicated) enable_dedicated="1";;
284 --enable-dedicated=*) enable_dedicated="$optarg";;
285 --enable-network) enable_network="2";;
286 --enable-network=*) enable_network="$optarg";;
287 --disable-network) enable_network="0";;
288 --disable-static) enable_static="0";;
289 --enable-static) enable_static="2";;
290 --enable-static=*) enable_static="$optarg";;
291 --disable-translator) enable_translator="0";;
292 --enable-translator) enable_translator="2";;
293 --enable-translator=*) enable_translator="$optarg";;
294 --disable-assert) enable_assert="0";;
295 --enable-assert) enable_assert="2";;
296 --enable-assert=*) enable_assert="$optarg";;
297 --disable-strip) enable_strip="0";;
298 --enable-strip) enable_strip="2";;
299 --enable-strip=*) enable_strip="$optarg";;
300 --disable-universal) enable_universal="0";;
301 --enable-universal) enable_universal="i386 ppc";;
302 --enable-universal=*) enable_universal="$optarg";;
303 --disable-osx-g5) enable_osx_g5="0";;
304 --enable-osx-g5) enable_osx_g5="2";;
305 --enable-osx-g5=*) enable_osx_g5="$optarg";;
306 --disable-unicode) enable_unicode="0";;
307 --enable-unicode) enable_unicode="2";;
308 --enable-unicode=*) enable_unicode="$optarg";;
309 --disable-console) enable_console="0";;
310 --enable-console) enable_console="2";;
311 --enable-console=*) enable_console="$optarg";;
313 --disable-cocoa-quartz) enable_cocoa_quartz="0";;
314 --enable-cocoa-quartz) enable_cocoa_quartz="2";;
315 --enable-cocoa-quartz=*) enable_cocoa_quartz="$optarg";;
316 --disable-cocoa-quickdraw) enable_cocoa_quickdraw="0";;
317 --enable-cocoa-quickdraw) enable_cocoa_quickdraw="2";;
318 --enable-cocoa-quickdraw=*) enable_cocoa_quickdraw="$optarg";;
320 --with-allegro) with_allegro="2";;
321 --without-allegro) with_allegro="0";;
322 --with-allegro=*) with_allegro="$optarg";;
324 --with-sdl) with_sdl="2";;
325 --without-sdl) with_sdl="0";;
326 --with-sdl=*) with_sdl="$optarg";;
328 --with-cocoa) with_cocoa="2";;
329 --without-cocoa) with_cocoa="0";;
330 --with-cocoa=*) with_cocoa="$optarg";;
332 --with-zlib) with_zlib="2";;
333 --without-zlib) with_zlib="0";;
334 --with-zlib=*) with_zlib="$optarg";;
336 --with-lzma) with_lzma="2";;
337 --without-lzma) with_lzma="0";;
338 --with-lzma=*) with_lzma="$optarg";;
339 --with-liblzma) with_lzma="2";;
340 --without-liblzma) with_lzma="0";;
341 --with-liblzma=*) with_lzma="$optarg";;
343 --with-lzo2) with_lzo2="2";;
344 --without-lzo2) with_lzo2="0";;
345 --with-lzo2=*) with_lzo2="$optarg";;
346 --with-liblzo2) with_lzo2="2";;
347 --without-liblzo2) with_lzo2="0";;
348 --with-liblzo2=*) with_lzo2="$optarg";;
350 --with-png) with_png="2";;
351 --without-png) with_png="0";;
352 --with-png=*) with_png="$optarg";;
353 --with-libpng) with_png="2";;
354 --without-libpng) with_png="0";;
355 --with-libpng=*) with_png="$optarg";;
357 --with-libtimidity) with_libtimidity="2";;
358 --without-libtimidity) with_libtimidity="0";;
359 --with-libtimidity=*) with_libtimidity="$optarg";;
361 --with-freetype) with_freetype="2";;
362 --without-freetype) with_freetype="0";;
363 --with-freetype=*) with_freetype="$optarg";;
364 --with-libfreetype) with_freetype="2";;
365 --without-libfreetype) with_freetype="0";;
366 --with-libfreetype=*) with_freetype="$optarg";;
368 --with-fontconfig) with_fontconfig="2";;
369 --without-fontconfig) with_fontconfig="0";;
370 --with-fontconfig=*) with_fontconfig="$optarg";;
371 --with-libfontconfig) with_fontconfig="2";;
372 --without-libfontconfig) with_fontconfig="0";;
373 --with-libfontconfig=*) with_fontconfig="$optarg";;
375 --with-icu) with_icu="2";;
376 --without-icu) with_icu="0";;
377 --with-icu=*) with_icu="$optarg";;
378 --with-libicu) with_icu="2";;
379 --without-libicu) with_icu="0";;
380 --with-libicu=*) with_icu="$optarg";;
381 --static-icu) static_icu="1";;
382 --static-icu=*) static_icu="$optarg";;
383 --static-libicu) static_icu="1";;
384 --static-libicu=*) static_icu="$optarg";;
386 --with-psp-config) with_psp_config="2";;
387 --without-psp-config) with_psp_config="0";;
388 --with-psp-config=*) with_psp_config="$optarg";;
390 --disable-builtin-depend) enable_builtin_depend="0";;
391 --enable-builtin-depend) enable_builtin_depend="2";;
392 --enable-builtin-depend=*) enable_builtin_depend="$optarg";;
394 --with-makedepend) with_makedepend="2";;
395 --without-makedepend) with_makedepend="0";;
396 --with-makedepend=*) with_makedepend="$optarg";;
398 --with-direct-music) with_direct_music="2";;
399 --without-direct-music) with_direct_music="0";;
400 --with-direct-music=*) with_direct_music="$optarg";;
402 --with-sort) with_sort="2";;
403 --without-sort) with_sort="0";;
404 --with-sort=*) with_sort="$optarg";;
406 --with-iconv) with_iconv="2";;
407 --without-iconv) with_iconv="0";;
408 --with-iconv=*) with_iconv="$optarg";;
410 --with-midi=*) with_midi="$optarg";;
411 --with-midi-arg=*) with_midi_arg="$optarg";;
413 --without-distcc) with_distcc="0";;
414 --with-distcc) with_distcc="2";;
415 --with-distcc=*) with_distcc="$optarg";;
417 --without-ccache) with_ccache="0";;
418 --with-ccache) with_ccache="2";;
419 --with-ccache=*) with_ccache="$optarg";;
421 --without-nforenum) with_nforenum="0";;
422 --with-nforenum) with_nforenum="2";;
423 --with-nforenum=*) with_nforenum="$optarg";;
425 --without-grfcodec) with_grfcodec="0";;
426 --with-grfcodec) with_grfcodec="2";;
427 --with-grfcodec=*) with_grfcodec="$optarg";;
429 --without-osx-sysroot) with_osx_sysroot="0";;
430 --with-osx-sysroot) with_osx_sysroot="2";;
431 --with-osx-sysroot=*) with_osx_sysroot="$optarg";;
433 --without-application-bundle) with_application_bundle="0";;
434 --with-application-bundle) with_application_bundle="1";;
435 --with-application-bundle=*) with_application_bundle="$optarg";;
437 --without-threads) with_threads="0";;
438 --with-threads) with_threads="1";;
439 --with-threads=*) with_threads="$optarg";;
441 CC=* | --CC=*) CC="$optarg";;
442 CXX=* | --CXX=*) CXX="$optarg";;
443 CFLAGS=* | --CFLAGS=*) CFLAGS="$optarg";;
444 CXXFLAGS=* | --CXXFLAGS=*) CXXFLAGS="$optarg";;
445 LDFLAGS=* | --LDFLAGS=*) LDFLAGS="$optarg";;
446 CFLAGS_BUILD=* | --CFLAGS_BUILD=* | --CFLAGS-BUILD=*) CFLAGS_BUILD="$optarg";;
447 CXXFLAGS_BUILD=* | --CXXFLAGS_BUILD=* | --CXXFLAGS-BUILD=*) CXXFLAGS_BUILD="$optarg";;
448 LDFLAGS_BUILD=* | --LDFLAGS_BUILD=* | --LDFLAGS-BUILD=*) LDFLAGS_BUILD="$optarg";;
450 --ignore-extra-parameters) ignore_extra_parameters="1";;
453 if [ "$ignore_extra_parameters" = "0" ]; then
454 log 1 "Unknown option $p"
457 log 1 "Unknown option $p ignored"
463 if [ -n "$prev_p" ]; then
464 log 1 "configure: error: missing argument to --$prev_p"
469 echo "" > $config_log
470 log 2 "Invocation: $0 $*"
474 # Here we save all params, so we can later on do an exact redo of this
475 # configuration, without having the user to re-input stuff
477 echo "Running configure with following options:" >> $config_log
478 echo "" >> $config_log
480 configure="$CONFIGURE_EXECUTABLE --ignore-extra-parameters"
481 for p in $save_params_array; do
483 p=`echo "$p" | sed 's@_@-@g;s@\n@@g;s@ @\\ @g'`
484 # Only save those params that aren't empty
485 configure="$configure --$p=\"$v\""
488 echo "$configure" >> $config_log
489 echo "$configure" > config.cache
490 echo "" >> $config_log
494 # Some params want to be in full uppercase, else they might not work as
495 # expected.. fix that here
497 endian=`echo $endian | tr '[a-z]' '[A-Z]'`
498 os=`echo $os | tr '[a-z]' '[A-Z]'`
499 cpu_type=`echo $cpu_type | tr '[a-z]' '[A-Z]'`
501 # Check if all params have valid values
503 # Endian only allows AUTO, LE and, BE
504 if [ -z "`echo $endian | egrep '^(AUTO|LE|BE|PREPROCESSOR)$'`" ]; then
505 log 1 "configure: error: invalid option --endian=$endian"
506 log 1 " Available options are: --endian=[AUTO|LE|BE]"
509 if [ "$endian" = "PREPROCESSOR" ] && [ "$os" != "OSX" ]; then
510 log 1 "configure: error: invalid option --endian=$endian"
511 log 1 " PREPROCESSOR is only available for OSX"
514 # OS only allows DETECT, UNIX, OSX, FREEBSD, OPENBSD, MORPHOS, BEOS, HAIKU, SUNOS, CYGWIN, MINGW, OS2, DOS, WINCE, and PSP
515 if [ -z "`echo $os | egrep '^(DETECT|UNIX|OSX|FREEBSD|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|HAIKU|SUNOS|CYGWIN|MINGW|OS2|DOS|WINCE|PSP)$'`" ]; then
516 log 1 "configure: error: invalid option --os=$os"
517 log 1 " Available options are: --os=[DETECT|UNIX|OSX|FREEBSD|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|HAIKU|SUNOS|CYGWIN|MINGW|OS2|DOS|WINCE|PSP]"
520 # cpu_type can be either 32 or 64
521 if [ -z "`echo $cpu_type | egrep '^(32|64|DETECT)$'`" ]; then
522 log 1 "configure: error: invalid option --cpu-type=$cpu_type"
523 log 1 " Available options are: --cpu-type[=DETECT|32|64]"
526 # enable_debug should be between 0 and 4
527 if [ -z "`echo $enable_debug | egrep '^[0123]$'`" ]; then
528 log 1 "configure: error: invalid option --enable-debug=$enable_debug"
529 log 1 " Available options are: --enable-debug[=0123]"
533 # enable_desync_debug should be between 0 and 3
534 if [ -z "`echo $enable_desync_debug | egrep '^[012]$'`" ]; then
535 log 1 "configure: error: invalid option --enable-desync-debug=$enable_desync_debug"
536 log 1 " Available options are: --enable-desync-debug[=012]"
547 # Check for universal builds; they only make sense for OSX, so fail if enabled for another OS
548 if [ "$enable_universal" = "0" ]; then
549 log 1 "checking universal build... no"
551 if [ "$os" != "OSX" ]; then
552 log 1 "configure: error: --enable-universal only works on OSX"
555 log 1 "checking universal build... yes, for: $enable_universal"
558 # Already detected by check_build
559 log 1 "checking build cc... $cc_build"
560 log 1 "checking host cc... $cc_host"
565 if [ "$enable_strip" != "0" ]; then
568 log 1 "checking strip... disabled"
572 if [ "$enable_builtin_depend" != "0" ]; then
573 log 1 "checking builtin depend... yes"
574 makedepend="\$(SRC_OBJS_DIR)/\$(DEPEND)"
576 log 1 "checking builtin depend... no"
582 if [ "$enable_static" = "1" ]; then
583 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "MORPHOS" ] || [ "$os" = "DOS" ]; then
590 if [ "$enable_static" != "0" ]; then
591 log 1 "checking static... yes"
593 if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "OSX" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "DOS" ]; then
594 log 1 "WARNING: static is only known to work on Windows, DOS, MacOSX and MorphOS"
595 log 1 "WARNING: use static at your own risk on this platform"
600 log 1 "checking static... no"
603 if [ "$enable_unicode" = "1" ]; then
604 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "DOS" ]; then
611 if [ "$enable_unicode" != "0" ]; then
612 log 1 "checking unicode... yes"
614 log 1 "checking unicode... no"
617 # Show what we configured
618 if [ "$enable_debug" = "0" ]; then
619 log 1 "using debug level... no"
620 elif [ "$enable_profiling" != "0" ]; then
621 log 1 "using debug level... profiling (debug level $enable_debug)"
623 log 1 "using debug level... level $enable_debug"
626 if [ "$enable_desync_debug" = "0" ]; then
627 log 1 "using desync debug level... no"
629 log 1 "using desync debug level... level $enable_desync_debug"
630 log 1 "WARNING: desync debug functions slow down the game considerably."
631 log 1 "WARNING: use only when you are instructed to do so"
632 log 1 " or when you know what you are doing."
637 if [ "$enable_lto" != "0" ]; then
638 # GCC 4.5 outputs '%{flto}', GCC 4.6 outputs '%{flto*}'
639 has_lto=`($cxx_build -dumpspecs 2>&1 | grep '\%{flto') || ($cxx_build -help ipo 2>&1 | grep '\-ipo')`
640 if [ -n "$has_lto" ]; then
641 log 1 "using link time optimization... yes"
644 log 1 "using link time optimization... no"
645 log 1 "WARNING: you selected link time optimization but it is not found."
649 log 1 "using link time optimization... no"
653 if [ "$os" != "OSX" ] && [ "$with_osx_sysroot" != "0" ]; then
654 if [ "$with_osx_sysroot" = "1" ]; then
657 log 1 "checking OSX sysroot... not OSX, skipping"
659 log 1 "configure: error: --with-osx-sysroot only works if OSX is the target"
664 if [ "$with_osx_sysroot" != "0" ]; then
665 if [ "$enable_universal" = "0" ] && [ "$with_osx_sysroot" != "1" ] && [ "$with_osx_sysroot" != "2" ]; then
666 # Sysroot manually specified? Check for usability
667 log 1 "checking OSX sysroot... $with_osx_sysroot"
668 if ! check_osx_sdk "$with_osx_sysroot"; then
669 log 1 "Passed sysroot not found/not functional"
673 # If autodetect and no universal, use system default
674 if [ "$with_osx_sysroot" = "1" ] && [ "$enable_universal" = "0" ]; then
675 log 1 "checking OSX sysroot... no (use system default)"
677 log 1 "checking OSX sysroot... automatically"
682 if [ -n "$osx_sdk_path" ]; then
683 if [ "$enable_universal" != "0" ]; then
684 if [ -z "$osx_sdk_104_path" ]; then
685 log 1 "WARNING: Could not find a usable 10.4u SDK, the resulting"
686 log 1 "WARNING: binary will only run on OSX 10.5 or later"
687 osx_sdk_104_path="$osx_sdk_path"
689 OSX_SYSROOT="-isysroot $osx_sdk_104_path"
690 OSX_LD_SYSROOT="-Wl,-syslibroot,$osx_sdk_104_path"
692 OSX_SYSROOT="-isysroot $osx_sdk_path"
693 OSX_LD_SYSROOT="-Wl,-syslibroot,$osx_sdk_path"
697 if [ "$os" = "OSX" ]; then
698 log 1 "checking OSX sysroot... no (use system default)"
706 if [ "$enable_dedicated" != "0" ]; then
707 log 1 "checking GDI video driver... dedicated server, skipping"
708 log 1 "checking dedicated... found"
710 if [ "$enable_network" = "0" ]; then
711 log 1 "configure: error: building a dedicated server without network support is pointless"
715 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ]; then
716 log 1 "checking GDI video driver... found"
718 log 1 "checking GDI video driver... not Windows, skipping"
721 if [ -z "$allegro_config" ] && [ -z "$sdl_config" ] && [ "$with_cocoa" = 0 ] && [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "WINCE" ]; then
722 log 1 "configure: error: no video driver development files found"
723 log 1 " If you want a dedicated server use --enable-dedicated as parameter"
726 log 1 "checking dedicated... not selected"
730 if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then
731 log 1 "checking console application... not Windows, skipping"
732 elif [ "$enable_console" = "1" ] && [ "$enable_dedicated" != "0" ]; then
733 log 1 "checking console application... dedicated server, enabled"
735 elif [ "$enable_console" = "1" ]; then
736 log 1 "checking console application... disabled (only used when forced)"
738 elif [ "$enable_console" = "0" ]; then
739 log 1 "checking console application... disabled"
741 log 1 "checking console application... enabled"
744 if [ "$enable_network" = "1" ] && [ "$os" = "DOS" ]; then
745 log 1 "checking network... DOS, skipping"
747 elif [ "$enable_network" != "0" ]; then
748 log 1 "checking network... found"
750 log 1 "checking network... disabled"
753 log 1 "checking squirrel... found"
754 SCRIPT_SRC_DIR="$ROOT_DIR/src/3rdparty/squirrel/include"
756 if [ "$enable_translator" != "0" ]; then
757 log 1 "checking translator... debug"
758 # -t shows TODO items, normally they are muted
761 log 1 "checking translator... no"
765 if [ "$enable_assert" != "0" ]; then
766 log 1 "checking assert... enabled"
768 log 1 "checking assert... disabled"
771 pre_detect_with_zlib=$with_zlib
774 if [ "$with_zlib" = "0" ] || [ -z "$zlib" ]; then
775 log 1 "WARNING: zlib was not detected or disabled"
776 log 1 "WARNING: OpenTTD doesn't require zlib, but it does mean that many features"
777 log 1 "WARNING: (like loading most old savegames/scenarios, loading heightmaps,"
778 log 1 "WARNING: using PNG, or using fonts, ...) will be disabled."
779 if [ "$pre_detect_with_zlib" = "0" ]; then
780 log 1 "WARNING: We strongly suggest you to install zlib."
782 log 1 "configure: error: no zlib detected"
783 log 1 " If you want to compile without zlib use --without-zlib as parameter"
788 pre_detect_with_lzma=$with_lzma
791 if [ "$with_lzma" = "0" ] || [ -z "$lzma_config" ]; then
792 log 1 "WARNING: lzma was not detected or disabled"
793 log 1 "WARNING: OpenTTD doesn't require lzma, but it does mean that many features"
794 log 1 "WARNING: (like loading most savegames/scenarios and joining most servers)"
795 log 1 "WARNING: will be disabled."
796 if [ "$pre_detect_with_lzma" = "0" ]; then
797 log 1 "WARNING: We strongly suggest you to install liblzma."
798 log 1 "configure: error: no liblzma detected"
800 log 1 " If you want to compile without lzma use --without-lzma as parameter"
805 pre_detect_with_lzo2=$with_lzo2
808 if [ "$with_lzo2" = "0" ] || [ -z "$lzo2" ]; then
809 log 1 "WARNING: liblzo2 was not detected or disabled"
810 log 1 "WARNING: OpenTTD doesn't require liblzo2, but it does mean that"
811 log 1 "WARNING: loading old savegames/scenarios will be disabled."
812 if [ "$pre_detect_with_lzo2" = "0" ]; then
813 log 1 "WARNING: We strongly suggest you to install liblzo2."
815 log 1 "configure: error: no liblzo2 detected"
816 log 1 " If you want to compile without liblzo2 use --without-liblzo2 as parameter"
828 if [ "$with_direct_music" != "0" ]; then
829 if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then
830 if [ "$with_direct_music" != "1" ]; then
831 log 1 "configure: error: direct-music is only supported on Win32 targets"
834 with_direct_music="0"
836 log 1 "checking direct-music... not Windows, skipping"
844 if [ "$os" = "OSX" ] && [ "$endian" = "AUTO" ]; then
845 endian="PREPROCESSOR"
848 log 1 "checking endianess... $endian"
850 # Suppress language errors when there is a version defined, indicating a release
851 # It just isn't pretty if any release produces warnings in the languages.
852 if [ -f "$ROOT_DIR/version" ]; then
854 log 1 "suppress language errors... yes"
857 log 1 "suppress language errors... no"
860 if [ "$enable_debug" = "0" ] && [ "$enable_profiling" = "0" ] && [ "$enable_strip" != "0" ]; then
861 if [ "$os" = "MORPHOS" ]; then
862 strip_arg="--strip-all --strip-unneeded --remove-section .comment"
863 elif [ "$os" = "OSX" ]; then
865 elif [ "$os" = "OS2" ]; then
867 # OS2 uses strip via gcc, because it needs to be feed to emxbind
868 LDFLAGS="$LDFLAGS -s"
869 elif [ "$os" = "SUNOS" ]; then
870 # The GNU strip does know -s, the non-GNU doesn't
871 # So try to detect it (in a bit of an ugly way)
872 strip_arg="`$strip -s strip.test 2>/dev/null && echo \"-s\"`"
877 log 1 "checking stripping... $strip $strip_arg"
880 log 1 "checking stripping... skipped"
883 if [ "$with_distcc" = "0" ]; then
884 log 1 "checking distcc... no"
885 elif [ "$with_distcc" = "1" ]; then
888 log 1 "checking distcc... no (only used when forced)"
889 elif [ "$with_distcc" = "2" ]; then
892 distcc="$with_distcc"
894 if [ "$with_distcc" != "0" ]; then
895 res="`$distcc --version 2>/dev/null | head -n 1 | cut -b 1-6`"
896 if [ "$res" != "distcc" ]; then
898 log 1 "checking distcc... no"
899 if [ "$with_distcc" = "2" ]; then
900 log 1 "configure: error: no distcc detected, but was forced to be used"
903 if [ "$with_distcc" != "1" ]; then
904 log 1 "configure: error: '$with_distcc' doesn't seem a distcc to me"
909 log 1 "checking distcc... $distcc"
912 if [ "$with_ccache" = "0" ]; then
913 log 1 "checking ccache... no"
914 elif [ "$with_ccache" = "1" ]; then
917 log 1 "checking ccache... no (only used when forced)"
918 elif [ "$with_ccache" = "2" ]; then
921 ccache="$with_ccache"
923 if [ "$with_ccache" != "0" ]; then
924 res="`$ccache --version 2>/dev/null | head -n 1 | cut -b 1-6`"
925 if [ "$res" != "ccache" ]; then
927 log 1 "checking ccache... no"
928 if [ "$with_ccache" = "2" ]; then
929 log 1 "configure: error: no ccache detected, but was forced to be used"
932 if [ "$with_ccache" != "1" ]; then
933 log 1 "configure: error: '$with_ccache' doesn't seem a ccache to me"
938 log 1 "checking ccache... $ccache"
944 if [ -z "$grfcodec" ] && [ -n "$nforenum" ]; then
945 log 1 "checking nforenum/grfcodec... nforenum needs grfcodec enabled, disabling nforenum"
949 if [ -z "$nforenum" ] && [ -n "$grfcodec" ]; then
950 log 1 "checking nforenum/grfcodec... grfcodec needs nforenum enabled, disabling grfcodec"
954 if [ "$os" = "DOS" ]; then
958 if [ "$os" != "OSX" ] && [ "$with_application_bundle" != "0" ]; then
959 if [ "$with_application_bundle" = "1" ]; then
960 with_application_bundle="0"
962 log 1 "checking OSX application bundle... not OSX, skipping"
964 log 1 "configure: error: --with-application-bundle only works if OSX is the target"
969 if [ "$os" = "OSX" ] && [ "$with_application_bundle" = "1" ]; then
975 if [ "$os" = "OSX" ]; then
976 # Test on ppc970 (G5) - we can optimize there
978 if [ "$enable_osx_g5" != "0" ]; then
979 log 1 "detecting ppc970 (G5)... yes (forced)"
981 # First, are we a real OSX system, else we can't detect it
982 native=`LC_ALL=C uname | tr '[A-Z]' '[a-z]' | grep darwin`
983 # If $host doesn't match $build , we are cross-compiling
984 if [ -n "$native" ] && [ "$build" = "$host" ]; then
985 $cxx_build $SRC_DIR/os/macosx/G5_detector.cpp -o G5_detector
988 if [ -n "$res" ]; then
989 # This is G5, add flags for it
992 log 1 "detecting ppc970 (G5)... yes"
996 log 1 "detecting ppc970 (G5)... no"
1001 log 1 "detecting ppc970 (G5)... no (cross-compiling)"
1005 if [ "$enable_osx_g5" != "0" ]; then
1006 log 1 "configure: error: ppc970 (OSX G5) selected, but not compiling for OSX"
1007 log 1 "configure: error: either select OSX as OS, or deselect ppc970"
1013 if [ -d "$ROOT_DIR/.svn" ] && [ -n "`svn help 2>/dev/null`" ]; then
1014 log 1 "checking revision... svn detection"
1015 elif [ -d "$ROOT_DIR/../.svn" ] && [ -n "`svn help 2>/dev/null`" ] && [ -n "`LC_ALL=C svn info $ROOT_DIR/.. | grep '^URL:.*tags$'`" ]; then
1016 # subversion changed its behaviour; now not all folders have a .svn folder,
1017 # but only the root folder. Since making tags requires a (sparse) checkout
1018 # of the tags folder, the folder of the tag does not have a .svn folder
1019 # anymore and this fails to detect the subversion repository checkout.
1020 log 1 "checking revision... svn detection (tag)"
1021 elif [ -d "$ROOT_DIR/.git" ] && [ -n "`git help 2>/dev/null`" ]; then
1022 log 1 "checking revision... git detection"
1023 elif [ -d "$ROOT_DIR/.hg" ] && [ -n "`hg help 2>/dev/null`" ]; then
1024 log 1 "checking revision... hg detection"
1025 elif [ -f "$ROOT_DIR/.ottdrev" ]; then
1026 log 1 "checking revision... source tarball"
1028 log 1 "checking revision... no detection"
1029 log 1 "WARNING: there is no means to determine the version."
1030 log 1 "WARNING: please use a subversion, mercurial, or git checkout of OpenTTD."
1031 log 1 "WARNING: you can only join game servers that have been compiled without"
1032 log 1 "WARNING: version detection."
1033 log 1 "WARNING: there is a great chance you desync."
1034 log 1 "WARNING: USE WITH CAUTION!"
1039 if [ "$doc_dir" = "1" ]; then
1040 if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ]; then
1041 doc_dir="share/doc/openttd"
1043 doc_dir="$data_dir/docs"
1046 doc_dir="`echo $doc_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1049 if [ "$icon_theme_dir" = "1" ]; then
1050 if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ]; then
1051 icon_theme_dir="share/icons/hicolor"
1056 icon_theme_dir="`echo $icon_theme_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1059 if [ "$personal_dir" = "1" ]; then
1060 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ] || [ "$os" = "DOS" ] || [ "$os" = "HAIKU" ]; then
1061 personal_dir="OpenTTD"
1062 elif [ "$os" = "OSX" ]; then
1063 personal_dir="Documents/OpenTTD"
1065 personal_dir=".openttd"
1068 personal_dir="`echo $personal_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1071 if [ "$shared_dir" = "1" ]; then
1072 # we are using default values
1073 if [ "$os" = "OSX" ]; then
1074 shared_dir="/Library/Application\\\\ Support/OpenTTD"
1079 shared_dir="`echo $shared_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1082 if [ "$man_dir" = "1" ]; then
1083 # add manpage on UNIX systems
1084 if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ] || [ "$os" = "OSX" ]; then
1085 man_dir="share/man/man6"
1090 man_dir="`echo $man_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1093 if [ "$menu_dir" = "1" ]; then
1094 # add a freedesktop menu item only for some UNIX systems
1095 if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ]; then
1096 menu_dir="share/applications"
1101 menu_dir="`echo $menu_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1106 if [ -n "$personal_dir" ]
1108 log 1 "personal home directory... $personal_dir"
1110 log 1 "personal home directory... none"
1113 if [ -n "$shared_dir" ]
1115 log 1 "shared data directory... $shared_dir"
1117 log 1 "shared data directory... none"
1120 if [ -n "$install_dir" ]
1122 log 1 "installation directory... $install_dir"
1124 log 1 "installation directory... none"
1127 if [ -n "$icon_theme_dir" ]
1129 log 1 "icon theme directory... $icon_theme_dir"
1131 log 1 "icon theme directory... none"
1134 if [ -n "$man_dir" ]
1136 log 1 "manual page directory... $man_dir"
1138 log 1 "manual page directory... none"
1141 if [ -n "$menu_dir" ]
1143 log 1 "menu item directory... $menu_dir"
1145 log 1 "menu item directory... none"
1149 make_compiler_cflags() {
1152 # $2 - name of the cflags variable
1153 # $3 - name of the cxxflags variable
1154 # $4 - name of the ldflags variable
1155 # $5 - name of the features variable
1157 eval eval "flags=\\\$$2"
1158 eval eval "cxxflags=\\\$$3"
1159 eval eval "ldflags=\\\$$4"
1160 eval eval "features=\\\$$5"
1162 if [ `basename $1 | cut -c 1-3` = "icc" ]; then
1163 # Enable some things only for certain ICC versions
1164 cc_version=`$1 -dumpversion | cut -c 1-4 | sed s@\\\.@@g`
1166 flags="$flags -rdynamic"
1167 ldflags="$ldflags -rdynamic"
1169 if [ -z "$first_time_icc_check" ]; then
1170 first_time_icc_check=no
1171 if [ $cc_version -lt 90 ]; then
1172 log 1 "WARNING: you seem to be using a very old version of ICC"
1173 log 1 "WARNING: OpenTTD hasn't been tested with this version"
1175 elif [ $cc_version -lt 120 ]; then
1176 log 1 "WARNING: you seem to be using an unsupported ICC version"
1177 log 1 "WARNING: ICC older than 12.0 is known to fail to compile OpenTTD"
1182 flags="$flags -Wall"
1183 # remark #111: statement is unreachable
1184 flags="$flags -wd111"
1185 # remark #181: argument is incompatible with corresponding format string conversion
1186 # ICC is very picky about signedness of operands, warnings provided by GCC are enough
1187 flags="$flags -wd181"
1188 # remark #271: trailing comma is nonstandard
1189 flags="$flags -wd271"
1190 # remark #280: selector expression is constant
1191 flags="$flags -wd280"
1192 # remark #304: access control not specified ("public" by default)
1193 flags="$flags -wd304"
1194 # remark #383: value copied to temporary, reference to temporary used
1195 flags="$flags -wd383"
1196 # remark #444: destructor for base class ... is not virtual
1197 flags="$flags -wd444"
1198 # remark #593: variable ... was set but never used
1199 flags="$flags -wd593"
1200 # warning #654: overloaded virtual function ... is only partially overridden in class ...
1201 flags="$flags -wd654"
1202 # remark #810: conversion from ... to ... may lose significant bits
1203 flags="$flags -wd810"
1204 # remark #869: parameter ... was never referenced
1205 flags="$flags -wd869"
1206 # warning #873: function ... ::operator new ... has no corresponding operator delete ...
1207 flags="$flags -wd873"
1208 # remark #981: operands are evaluated in unspecified order
1209 flags="$flags -wd981"
1210 # remark #1418: external function definition with no prior declaration
1211 flags="$flags -wd1418"
1212 # remark #1419: external declaration in primary source file
1213 flags="$flags -wd1419"
1214 # remark #1572: floating-point equality and inequality
1215 flags="$flags -wd1572"
1216 # remark #1599: declaration hides variable/parameter ...
1217 flags="$flags -wd1599"
1218 # remark #1720: function ... ::operator new ... has no corresponding member operator delete ...
1219 flags="$flags -wd1720"
1221 if [ $cc_version -lt 110 ]; then
1222 # warns about system headers with recent glibc:
1223 # warning #1292: attribute "__nonnull__" ignored
1224 flags="$flags -wd1292"
1227 if [ $cc_version -ge 100 ]; then
1228 # warning #1899: multicharacter character literal (potential portability problem)
1229 flags="$flags -wd1899"
1230 # vec report defaults to telling where it did loop vectorisation, which is not very important
1231 flags="$flags -vec-report=0 "
1234 if [ $cc_version -ge 110 ]; then
1235 # remark #2259: non-pointer conversion from ... to ... may lose significant bits
1236 flags="$flags -wd2259"
1237 # Use c++0x mode so static_assert() is available
1238 cxxflags="$cxxflags -std=c++0x"
1241 if [ "$enable_lto" != "0" ]; then
1242 has_ipo=`$1 -help ipo | grep '\-ipo'`
1243 if [ -n "$has_ipo" ]; then
1244 # Use IPO (only if we see IPO exists and is requested)
1246 features="$features lto"
1249 elif [ `basename $1 | grep 'clang'` ]; then
1250 # Enable some things only for certain clang versions
1251 cc_version="`$1 -v 2>&1 | head -n 1 | sed s@[^0-9]@@g | cut -c 1-2`"
1253 # aliasing rules are not held in openttd code
1254 flags="$flags -fno-strict-aliasing"
1256 # -W alone doesn't enable all warnings enabled by -Wall; on the other hand,
1257 # -Weverything enables too many useless warnings that can't be disabled (as of 3.0)
1258 flags="$flags -Wall -W"
1260 # warning: unused parameter '...'
1261 flags="$flags -Wno-unused-parameter"
1263 # warning: expression result unused
1264 flags="$flags -Wno-unused-value"
1266 # warning: multi-character character constant
1267 flags="$flags -Wno-multichar"
1269 # warning: explicitly assigning a variable of type '...' to itself
1270 # it happens when using the FOR_ALL_WINDOWS_FROM_BACK_FROM macro
1271 flags="$flags -Wno-self-assign"
1273 if [ "$cc_version" -lt "30" ]; then
1274 # warning: equality comparison with extraneous parentheses
1275 flags="$flags -Wno-parentheses"
1276 # warning: operands of ? are integers of different signs: 'unsigned int' and 'int'
1277 flags="$flags -Wno-sign-compare"
1280 if [ "$cc_version" -ge "30" ]; then
1281 # warning: equality comparison with extraneous parentheses
1282 # this warning could be useful, but it warns about code in squirrel
1283 flags="$flags -Wno-parentheses-equality"
1286 if [ "$with_ccache" != "0" -o "$with_distcc" != "0" ]; then
1287 # ccache and distcc run separate preprocess and compile passes,
1288 # both are fed with the same CFLAGS. Unfortunately, clang
1289 # complains about -I when compiling preprocessed files:
1290 # "clang: warning: argument unused during compilation: '-I /usr/include'"
1291 flags="$flags -Qunused-arguments"
1294 if [ "$enable_assert" -eq "0" ]; then
1295 # do not warn about unused variables when building without asserts
1296 flags="$flags -Wno-unused-variable"
1299 # rdynamic is used to get useful stack traces from crash reports.
1300 ldflags="$ldflags -rdynamic"
1302 # Enable some things only for certain GCC versions
1303 cc_version=`$1 -dumpversion | cut -c 1,3`
1305 if [ $cc_version -lt 33 ]; then
1306 log 1 "configure: error: gcc older than 3.3 can't compile OpenTTD because of its poor template support"
1310 flags="$flags -Wall -Wno-multichar -Wsign-compare -Wundef"
1311 flags="$flags -Wwrite-strings -Wpointer-arith"
1312 flags="$flags -W -Wno-unused-parameter -Wredundant-decls"
1313 flags="$flags -Wformat=2 -Wformat-security"
1315 if [ $enable_assert -eq 0 ]; then
1316 # Do not warn about unused variables when building without asserts
1317 flags="$flags -Wno-unused-variable"
1318 if [ $cc_version -ge 46 ]; then
1319 # GCC 4.6 gives more warnings, disable them too
1320 flags="$flags -Wno-unused-but-set-variable"
1321 flags="$flags -Wno-unused-but-set-parameter"
1325 if [ $cc_version -ge 34 ]; then
1326 # Warn when a variable is used to initialise itself:
1328 flags="$flags -Winit-self"
1331 if [ $cc_version -ge 40 ]; then
1332 # GCC 4.0+ complains about that we break strict-aliasing.
1333 # On most places we don't see how to fix it, and it doesn't
1334 # break anything. So disable strict-aliasing to make the
1335 # compiler all happy.
1336 flags="$flags -fno-strict-aliasing"
1337 # Warn about casting-out 'const' with regular C-style cast.
1338 # The preferred way is const_cast<>() which doesn't warn.
1339 flags="$flags -Wcast-qual"
1342 if [ $cc_version -ge 42 ]; then
1343 # GCC 4.2+ automatically assumes that signed overflows do
1344 # not occur in signed arithmetics, whereas we are not
1345 # sure that they will not happen. It furthermore complains
1346 # about its own optimized code in some places.
1347 flags="$flags -fno-strict-overflow"
1348 # GCC 4.2 no longer includes -Wnon-virtual-dtor in -Wall.
1349 # Enable it in order to be consistent with older GCC versions.
1350 flags="$flags -Wnon-virtual-dtor"
1353 if [ $cc_version -ge 43 ]; then
1354 # Use gnu++0x mode so static_assert() is available.
1355 # Don't use c++0x, it breaks mingw (with gcc 4.4.0).
1356 cxxflags="$cxxflags -std=gnu++0x"
1359 if [ $cc_version -eq 45 ]; then
1360 # Prevent optimisation supposing enums are in a range specified by the standard
1361 # For details, see http://gcc.gnu.org/PR43680
1362 flags="$flags -fno-tree-vrp"
1365 if [ $cc_version -ge 47 ]; then
1366 # Disable -Wnarrowing which gives many warnings, such as:
1367 # warning: narrowing conversion of '...' from 'unsigned int' to 'int' inside { } [-Wnarrowing]
1368 # They are valid according to the C++ standard, but useless.
1369 cxxflags="$cxxflags -Wno-narrowing"
1370 # Disable bogus 'attempt to free a non-heap object' warning
1371 flags="$flags -Wno-free-nonheap-object"
1374 if [ "$enable_lto" != "0" ]; then
1375 # GCC 4.5 outputs '%{flto}', GCC 4.6 outputs '%{flto*}'
1376 has_lto=`$1 -dumpspecs | grep '\%{flto'`
1377 if [ -n "$has_lto" ]; then
1378 # Use LTO only if we see LTO exists and is requested
1379 if [ $cc_version -lt 46 ]; then
1380 flags="$flags -flto"
1382 flags="$flags -flto=jobserver"
1384 ldflags="$ldflags -fwhole-program"
1385 features="$features lto"
1389 has_rdynamic=`$1 -dumpspecs | grep rdynamic`
1390 if [ -n "$has_rdynamic" ]; then
1391 # rdynamic is used to get useful stack traces from crash reports.
1392 flags="$flags -rdynamic"
1393 ldflags="$ldflags -rdynamic"
1397 eval "$2=\"$flags\""
1398 eval "$3=\"$cxxflags\""
1399 eval "$4=\"$ldflags\""
1400 eval "$5=\"$features\""
1403 make_cflags_and_ldflags() {
1404 # General CFlags for BUILD
1405 CFLAGS_BUILD="$CFLAGS_BUILD"
1406 # Special CXXFlags for BUILD
1407 CXXFLAGS_BUILD="$CXXFLAGS_BUILD"
1409 LDFLAGS_BUILD="$LDFLAGS_BUILD"
1410 # FEATURES for BUILD (lto)
1412 # General CFlags for HOST
1414 # Special CXXFlags for HOST
1415 CXXFLAGS="$CXXFLAGS"
1416 # Libs to compile. In fact this is just LDFLAGS
1418 # LDFLAGS used for HOST
1420 # FEATURES for HOST (lto)
1423 make_compiler_cflags "$cc_build" "CFLAGS_BUILD" "CXXFLAGS_BUILD" "LDFLAGS_BUILD" "FEATURES_BUILD"
1424 make_compiler_cflags "$cc_host" "CFLAGS" "CXXFLAGS" "LDFLAGS" "FEATURES"
1426 CFLAGS="$CFLAGS -D$os"
1428 if [ "$enable_debug" = "0" ]; then
1429 # No debug, add default stuff
1430 OBJS_SUBDIR="release"
1431 if [ "$os" = "MORPHOS" ]; then
1432 CFLAGS="-I/gg/os-include -noixemul -fstrict-aliasing -fexpensive-optimizations -mcpu=604 -fno-inline -mstring -mmultiple $CFLAGS"
1433 LDFLAGS="$LDFLAGS -noixemul"
1436 CFLAGS="-O2 -fomit-frame-pointer $CFLAGS"
1440 # Each debug level reduces the optimization by a bit
1441 if [ $enable_debug -ge 1 ]; then
1442 CFLAGS="$CFLAGS -g -D_DEBUG"
1443 if [ "$os" = "PSP" ]; then
1444 CFLAGS="$CFLAGS -G0"
1447 if [ $enable_debug -ge 2 ]; then
1448 CFLAGS="$CFLAGS -fno-inline"
1450 if [ $enable_debug -ge 3 ]; then
1451 CFLAGS="$CFLAGS -O0"
1453 CFLAGS="$CFLAGS -O2"
1457 if [ $enable_debug -le 2 ]; then
1458 if basename "$cc_host" | grep "gcc" &>/dev/null; then
1459 # Define only when compiling with GCC. Some GLIBC versions use GNU
1460 # extensions in a way that breaks build with at least ICC.
1461 # This requires -O1 or more, so debug level 3 (-O0) is excluded.
1462 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
1464 # Just add -O1 to the tools needed for building.
1465 CFLAGS_BUILD="$CFLAGS_BUILD -D_FORTIFY_SOURCE=2 -O1"
1469 if [ "$os" = "OSX" ] && [ $cc_version -eq 40 ]; then
1470 # Apple's GCC 4.0 has a compiler bug for x86_64 with (higher) optimization,
1471 # wrongly optimizing ^= in loops. This disables the failing optimisation.
1472 CFLAGS="$CFLAGS -fno-expensive-optimizations"
1475 if [ "$enable_profiling" != "0" ]; then
1477 LDFLAGS="$LDFLAGS -pg"
1480 if [ "$with_threads" = "0" ]; then
1481 CFLAGS="$CFLAGS -DNO_THREADS"
1484 if [ "`echo $1 | cut -c 1-3`" != "icc" ]; then
1485 if [ "$os" = "CYGWIN" ]; then
1486 flags="$flags -mwin32"
1487 LDFLAGS="$LDFLAGS -mwin32"
1489 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
1490 flags="$flags -mno-cygwin"
1492 if [ "$enable_console" != "0" ]; then
1493 LDFLAGS="$LDFLAGS -mno-cygwin -Wl,--subsystem,console"
1495 LDFLAGS="$LDFLAGS -mno-cygwin -Wl,--subsystem,windows"
1498 LIBS="$LIBS -lws2_32 -lwinmm -lgdi32 -ldxguid -lole32"
1500 if [ $cc_version -ge 44 ]; then
1501 LDFLAGS_BUILD="$LDFLAGS_BUILD -static-libgcc -static-libstdc++"
1503 if [ $cc_version -ge 47 ]; then
1504 CFLAGS="$CFLAGS -mno-ms-bitfields"
1509 if [ "$os" != "CYGWIN" ] && [ "$os" != "HAIKU" ] && [ "$os" != "FREEBSD" ] && [ "$os" != "OPENBSD" ] && [ "$os" != "MINGW" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "OSX" ] && [ "$os" != "DOS" ] && [ "$os" != "WINCE" ] && [ "$os" != "PSP" ] && [ "$os" != "OS2" ]; then
1510 LIBS="$LIBS -lpthread"
1513 if [ "$os" != "CYGWIN" ] && [ "$os" != "HAIKU" ] && [ "$os" != "MINGW" ] && [ "$os" != "DOS" ] && [ "$os" != "WINCE" ]; then
1516 if [ "$os" = "WINCE" ]; then
1517 LIBS="$LIBS -lcoredll -lcorelibc -laygshell -lws2 -e WinMainCRTStartup"
1519 if [ "$os" = "PSP" ]; then
1520 CFLAGS="$CFLAGS -I`$psp_config -p`/include"
1521 LDFLAGS="$LDFLAGS -L`$psp_config -p`/lib"
1523 CFLAGS="$CFLAGS -fno-exceptions -fno-rtti -D_PSP_FW_VERSION=150"
1524 LIBS="$LIBS -D_PSP_FW_VERSION=150 -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -lm"
1527 if [ "$os" = "MORPHOS" ]; then
1528 # -Wstrict-prototypes generates much noise because of system headers
1529 CFLAGS="$CFLAGS -Wno-strict-prototypes"
1532 if [ "$os" = "OPENBSD" ]; then
1533 LIBS="$LIBS -pthread"
1536 if [ "$os" = "FREEBSD" ]; then
1537 LIBS="$LIBS -lpthread"
1540 if [ "$os" = "OSX" ]; then
1541 LDFLAGS="$LDFLAGS -framework Cocoa"
1543 # Add macports include dir which is not always set a default system dir. This avoids zillions of bogus warnings.
1544 CFLAGS="$CFLAGS -isystem/opt/local/include"
1546 if [ "$enable_dedicated" = "0" ] && ([ "$cpu_type" = "32" ] || [ "$enable_universal" != "0" ]); then
1547 LIBS="$LIBS -framework QuickTime"
1549 CFLAGS="$CFLAGS -DNO_QUICKTIME"
1552 if [ "$enable_universal" = "0" ]; then
1553 # Universal builds set this elsewhere
1554 CFLAGS="$OSX_SYSROOT $CFLAGS"
1555 LDFLAGS="$OSX_LD_SYSROOT $LDFLAGS"
1558 if [ "$enable_universal" = "0" ] && [ $cc_version -ge 40 ]; then
1559 # Only set the min version when not doing an universal build.
1560 # Universal builds set the version elsewhere.
1561 if [ "$cpu_type" = "64" ]; then
1562 CFLAGS="$CFLAGS -mmacosx-version-min=10.5"
1564 gcc_cpu=`$cc_host -dumpmachine`
1565 if [ "`echo $gcc_cpu | cut -c 1-3`" = "ppc" -o "`echo $gcc_cpu | cut -c 1-7`" = "powerpc" ]; then
1566 # PowerPC build can run on 10.3
1567 CFLAGS="$CFLAGS -mmacosx-version-min=10.3"
1569 # Intel is only available starting from 10.4
1570 CFLAGS="$CFLAGS -mmacosx-version-min=10.4"
1576 if [ "$os" = "BEOS" ] || [ "$os" = "HAIKU" ]; then
1577 LIBS="$LIBS -lmidi -lbe"
1580 # Most targets act like UNIX, just with some additions
1581 if [ "$os" = "BEOS" ] || [ "$os" = "HAIKU" ] || [ "$os" = "OSX" ] || [ "$os" = "MORPHOS" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ] || [ "$os" = "OS2" ]; then
1582 CFLAGS="$CFLAGS -DUNIX"
1584 # And others like Windows
1585 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ]; then
1586 CFLAGS="$CFLAGS -DWIN"
1589 if [ -n "$allegro_config" ]; then
1590 CFLAGS="$CFLAGS -DWITH_ALLEGRO"
1591 CFLAGS="$CFLAGS `$allegro_config --cflags`"
1592 if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "WINCE" ]; then
1593 if [ "$enable_static" != "0" ]; then
1594 LIBS="$LIBS `$allegro_config --static --libs`"
1596 LIBS="$LIBS `$allegro_config --libs`"
1601 if [ -n "$sdl_config" ]; then
1602 CFLAGS="$CFLAGS -DWITH_SDL"
1603 # SDL must not add _GNU_SOURCE as it breaks many platforms
1604 CFLAGS="$CFLAGS `$sdl_config --cflags | sed 's@-D_GNU_SOURCE[^ ]*@@'`"
1605 if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "WINCE" ]; then
1606 if [ "$enable_static" != "0" ]; then
1607 LIBS="$LIBS `$sdl_config --static-libs`"
1609 LIBS="$LIBS `$sdl_config --libs`"
1614 if [ "$with_cocoa" != "0" ]; then
1615 CFLAGS="$CFLAGS -DWITH_COCOA"
1616 LIBS="$LIBS -F/System/Library/Frameworks -framework Cocoa -framework Carbon -framework AudioUnit -framework AudioToolbox"
1618 if [ "$enable_cocoa_quartz" != "0" ]; then
1619 CFLAGS="$CFLAGS -DENABLE_COCOA_QUARTZ"
1622 if [ "$enable_cocoa_quickdraw" != "0" ]; then
1623 CFLAGS="$CFLAGS -DENABLE_COCOA_QUICKDRAW"
1627 if [ "$with_zlib" != "0" ]; then
1628 if [ "$enable_static" != "0" ] && [ "$os" != "OSX" ]; then
1633 CFLAGS="$CFLAGS -DWITH_ZLIB"
1636 if [ -n "$lzma_config" ]; then
1637 CFLAGS="$CFLAGS -DWITH_LZMA"
1638 CFLAGS="$CFLAGS `$lzma_config --cflags | tr '\n\r' ' '`"
1640 if [ "$enable_static" != "0" ]; then
1641 CFLAGS="$CFLAGS -DLZMA_API_STATIC"
1642 LIBS="$LIBS `$lzma_config --libs --static | tr '\n\r' ' '`"
1644 LIBS="$LIBS `$lzma_config --libs | tr '\n\r' ' '`"
1648 if [ "$with_lzo2" != "0" ]; then
1649 if [ "$enable_static" != "0" ] && [ "$os" != "OSX" ]; then
1654 CFLAGS="$CFLAGS -DWITH_LZO"
1657 # 64bit machines need -D_SQ64
1658 if [ "$cpu_type" = "64" ] && [ "$enable_universal" = "0" ]; then
1659 CFLAGS="$CFLAGS -D_SQ64"
1661 CFLAGS="$CFLAGS -I$SCRIPT_SRC_DIR"
1663 if [ -n "$png_config" ]; then
1664 CFLAGS="$CFLAGS -DWITH_PNG"
1665 CFLAGS="$CFLAGS `$png_config --cppflags --I_opts | tr '\n\r' ' '`"
1667 # The extra flags are unneeded for latest libpng-config, but some versions are so broken...
1668 if [ "$enable_static" != "0" ]; then
1669 if [ "$os" = "OSX" ]; then
1670 LIBS="$LIBS `$png_config --prefix`/lib/libpng.a"
1672 LIBS="$LIBS `$png_config --static --ldflags | tr '\n\r' ' '`"
1675 LIBS="$LIBS `$png_config --ldflags | tr '\n\r' ' '`"
1679 if [ -n "$fontconfig_config" ]; then
1680 CFLAGS="$CFLAGS -DWITH_FONTCONFIG"
1681 CFLAGS="$CFLAGS `$fontconfig_config --cflags | tr '\n\r' ' '`"
1683 if [ "$enable_static" != "0" ]; then
1684 if [ "$os" = "OSX" ]; then
1685 # fontconfig_config goes via pkg-config on all systems, which doesn't know --prefix
1686 # 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
1687 LIBS="$LIBS `$fontconfig_config --variable=prefix`/lib/libfontconfig.a `$fontconfig_config --libs --static | sed s@-lfontconfig@@`"
1689 LIBS="$LIBS `$fontconfig_config --libs --static | tr '\n\r' ' '`"
1692 LIBS="$LIBS `$fontconfig_config --libs | tr '\n\r' ' '`"
1696 if [ -n "$freetype_config" ]; then
1697 CFLAGS="$CFLAGS -DWITH_FREETYPE"
1698 CFLAGS="$CFLAGS `$freetype_config --cflags | tr '\n\r' ' '`"
1700 if [ "$enable_static" != "0" ]; then
1701 if [ "$os" = "OSX" ]; then
1702 LIBS="$LIBS `$freetype_config --prefix`/lib/libfreetype.a"
1704 # Is it possible to do static with freetype, if so: how?
1705 LIBS="$LIBS `$freetype_config --libs | tr '\n\r' ' '`"
1708 LIBS="$LIBS `$freetype_config --libs | tr '\n\r' ' '`"
1712 if [ -n "$icu_config" ]; then
1713 CFLAGS="$CFLAGS -DWITH_ICU"
1714 CFLAGS="$CFLAGS `$icu_config --cppflags | tr '\n\r' ' '`"
1716 # Some icu-configs have the 'feature' of not adding a space where others do add the space
1717 if [ "$static_icu" != "0" ]; then
1718 LIBS="$LIBS `$icu_config --ldflags-searchpath` `$icu_config --ldflags-libsonly | tr '\n\r' ' ' | sed s/licu/lsicu/g`"
1720 LIBS="$LIBS `$icu_config --ldflags-searchpath` `$icu_config --ldflags-libsonly | tr '\n\r' ' '`"
1725 if [ "$with_direct_music" != "0" ]; then
1726 CFLAGS="$CFLAGS -DWIN32_ENABLE_DIRECTMUSIC_SUPPORT"
1727 # GCC 4.0+ doesn't like the DirectX includes (gives tons of
1728 # warnings on it we won't be able to fix). For now just
1729 # suppress those warnings.
1730 if [ $cc_version -ge 40 ]; then
1731 CFLAGS="$CFLAGS -Wno-non-virtual-dtor"
1735 if [ -n "$libtimidity" ]; then
1736 if [ "$enable_static" != "0" ]; then
1737 LIBS="$LIBS $libtimidity"
1739 LIBS="$LIBS -ltimidity"
1741 CFLAGS="$CFLAGS -DLIBTIMIDITY"
1744 if [ "$with_iconv" != "0" ]; then
1745 CFLAGS="$CFLAGS -DWITH_ICONV"
1746 if [ "$link_to_iconv" = "yes" ]; then
1747 LIBS="$LIBS -liconv"
1748 if [ "$with_iconv" != "2" ]; then
1749 CFLAGS="$CFLAGS -I$with_iconv/include"
1750 LIBS="$LIBS -L$with_iconv/lib"
1754 if [ "$have_non_const_iconv" != "no" ]; then
1755 CFLAGS="$CFLAGS -DHAVE_NON_CONST_ICONV"
1759 if [ -n "$with_midi" ]; then
1760 CFLAGS="$CFLAGS -DEXTERNAL_PLAYER=\\\\\"$with_midi\\\\\""
1762 if [ -n "$with_midi_arg" ]; then
1763 CFLAGS="$CFLAGS -DMIDI_ARG=\\\\\"$with_midi_arg\\\\\""
1766 if [ "$enable_dedicated" != "0" ]; then
1767 CFLAGS="$CFLAGS -DDEDICATED"
1770 if [ "$enable_unicode" != "0" ]; then
1771 CFLAGS="$CFLAGS -DUNICODE -D_UNICODE"
1774 if [ "$enable_network" != "0" ]; then
1775 CFLAGS="$CFLAGS -DENABLE_NETWORK"
1777 if [ "$os" = "BEOS" ]; then
1778 LDFLAGS="$LDFLAGS -lbind -lsocket"
1781 if [ "$os" = "HAIKU" ]; then
1782 LDFLAGS="$LDFLAGS -lnetwork"
1785 if [ "$os" = "SUNOS" ]; then
1786 LDFLAGS="$LDFLAGS -lnsl -lsocket"
1790 if [ "$enable_static" != "0" ]; then
1791 # OSX can't handle -static in LDFLAGS
1792 if [ "$os" != "OSX" ]; then
1793 LDFLAGS="$LDFLAGS -static"
1797 if [ "$enable_assert" = "0" ]; then
1798 CFLAGS="$CFLAGS -DNDEBUG"
1799 CFLAGS_BUILD="$CFLAGS_BUILD -DNDEBUG"
1802 if [ "$enable_desync_debug" != "0" ]; then
1803 CFLAGS="$CFLAGS -DRANDOM_DEBUG"
1806 if [ "$enable_osx_g5" != "0" ]; then
1807 CFLAGS="$CFLAGS -mcpu=G5 -mpowerpc64 -mtune=970 -mcpu=970 -mpowerpc-gpopt"
1810 if [ -n "$personal_dir" ]; then
1811 CFLAGS="$CFLAGS -DWITH_PERSONAL_DIR -DPERSONAL_DIR=\\\\\"$personal_dir\\\\\""
1814 if [ -n "$shared_dir" ]; then
1815 CFLAGS="$CFLAGS -DWITH_SHARED_DIR -DSHARED_DIR=\\\\\"$shared_dir\\\\\""
1818 CFLAGS="$CFLAGS -DGLOBAL_DATA_DIR=\\\\\"$prefix_dir/$data_dir\\\\\""
1820 if [ "$enable_lto" != "0" ]; then
1821 lto_build=`echo "$FEATURES_BUILD" | grep "lto"`
1822 lto_host=`echo "$FEATURES" | grep "lto"`
1823 if [ -z "$lto_build$lto_host" ]; then
1824 log 1 "WARNING: you enabled LTO/IPO, but neither build nor host compiler supports it"
1825 log 1 "WARNING: LTO/IPO has been disabled"
1827 if [ -n "$lto_build" ]; then
1828 LDFLAGS_BUILD="$LDFLAGS_BUILD $CFLAGS_BUILD $CXXFLAGS_BUILD"
1830 if [ -n "$lto_host" ]; then
1831 LDFLAGS="$LDFLAGS $CFLAGS $CXXFLAGS"
1835 log 1 "using CFLAGS_BUILD... $CFLAGS_BUILD"
1836 log 1 "using CXXFLAGS_BUILD... $CXXFLAGS_BUILD"
1837 log 1 "using LDFLAGS_BUILD... $LDFLAGS_BUILD"
1838 log 1 "using CFLAGS... $CFLAGS"
1839 log 1 "using CXXFLAGS... $CXXFLAGS"
1840 log 1 "using LDFLAGS... $LIBS $LDFLAGS"
1842 # Makedepend doesn't like something like: -isysroot /OSX/blabla
1843 # so convert it to: -isysroot -OSX/blabla. makedepend just ignores
1844 # any - command it doesn't know, so we are pretty save.
1845 # Lovely hackish, not?
1846 # Btw, this almost always comes from outside the configure, so it is
1847 # not something we can control.
1848 # Also make makedepend aware of compiler's built-in defines.
1849 if [ "$with_makedepend" != "0" ] || [ "$enable_builtin_depend" != "0" ]; then
1850 # Append CXXFLAGS possibly containing -std=c++0x
1851 cflags_makedep="`echo | $cxx_host $CXXFLAGS -E -x c++ -dM - | sed 's@.define @-D@g;s@ .*@ @g;s@(.*)@@g' | tr -d '\r\n'`"
1853 # Please escape ALL " within ` because e.g. "" terminates the string in some sh implementations
1854 cflags_makedep="$cflags_makedep `echo \"$CFLAGS\" \"$CXXFLAGS\" | sed 's@ /@ -@g;s@-I[ ]*[^ ]*@@g'`"
1859 if [ "$with_distcc" != "0" ]; then
1860 cc_host="$distcc $cc_host"
1861 cxx_host="$distcc $cxx_host"
1863 log 1 " NOTICE: remind yourself to use 'make -jN' to make use of distcc"
1867 if [ "$with_ccache" != "0" ]; then
1868 cc_host="$ccache $cc_host"
1869 cxx_host="$ccache $cxx_host"
1875 # $1 - Type for message (build / host)
1876 # $2 - What to fill with the found compiler
1877 # $3 - System to try
1878 # $4 - Compiler to try
1879 # $5 - Env-setting to try
1880 # $6 - GCC alike to try
1881 # $7 - CC alike to try
1882 # $8 - "0" gcc, "1" g++, "2" windres, "3" strip, "4" lipo
1883 # $9 - What the command is to check for
1885 if [ -n "$3" ]; then
1887 if [ -z "$6" ]; then
1892 machine=`eval $compiler $9 2>/dev/null`
1894 eval "$2=\"$compiler\""
1896 log 2 "executing $compiler $9"
1897 log 2 " returned $machine"
1898 log 2 " exit code $ret"
1900 if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ]; then
1901 log 1 "checking $1... $compiler not found"
1902 log 1 "I couldn't detect any $6 binary for $3"
1906 if [ "$machine" != "$3" ] && ( [ "$8" = "0" ] || [ "$8" = "1" ] ); then
1907 log 1 "checking $1... expected $3, found $machine"
1908 log 1 "the compiler suggests it doesn't build code for the machine you specified"
1911 elif [ -n "$4" ]; then
1912 # Check for manual compiler
1913 machine=`$4 $9 2>/dev/null`
1917 log 2 "executing $4 $9"
1918 log 2 " returned $machine"
1919 log 2 " exit code $ret"
1921 if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ]; then
1922 log 1 "checking $1... $4 not found"
1923 log 1 "the selected binary doesn't seem to be a $6 binary"
1927 # Nothing given, autodetect
1929 if [ -n "$5" ]; then
1930 machine=`$5 $9 2>/dev/null`
1934 log 2 "executing $5 $9"
1935 log 2 " returned $machine"
1936 log 2 " exit code $ret"
1938 # The user defined a GCC that doesn't reply to $9.. abort
1939 if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ]; then
1940 log 1 "checking $1... $5 unusable"
1941 log 1 "the CC environment variable is set, but it doesn't seem to be a $6 binary"
1942 log 1 "please redefine the CC/CXX environment to a $6 binary"
1946 log 2 "checking $1... CC/CXX not set (skipping)"
1948 # No $5, so try '$6'
1949 machine=`$6 $9 2>/dev/null`
1953 log 2 "executing $6 $9"
1954 log 2 " returned $machine"
1955 log 2 " exit code $ret"
1957 if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ]; then
1959 machine=`$7 $9 2>/dev/null`
1963 log 2 "executing $7 $9"
1964 log 2 " returned $machine"
1965 log 2 " exit code $ret"
1968 if [ -z "$machine" ]; then
1969 log 1 "checking $1... $6 not found"
1970 log 1 "I couldn't detect any $6 binary on your system"
1971 log 1 "please define the CC/CXX environment to where it is located"
1979 if [ "$8" != "0" ]; then
1981 log 1 "checking $1... $res"
1983 log 1 "checking $1... $machine"
1988 if [ "$os" = "FREEBSD" ]; then
1989 # FreeBSD's C compiler does not support dump machine.
1990 # However, removing C support is not possible because PSP must be linked with the C compiler.
1991 check_compiler "build system type" "cc_build" "$build" "$cc_build" "$CXX" "g++" "c++" "0" "-dumpmachine"
1993 check_compiler "build system type" "cc_build" "$build" "$cc_build" "$CC" "gcc" "cc" "0" "-dumpmachine"
1998 # By default the host is the build
1999 if [ -z "$host" ]; then host="$build"; fi
2001 if [ "$os" = "FREEBSD" ]; then
2002 # FreeBSD's C compiler does not support dump machine.
2003 # However, removing C support is not possible because PSP must be linked with the C compiler.
2004 check_compiler "host system type" "cc_host" "$host" "$cc_host" "$CXX" "g++" "c++" "0" "-dumpmachine"
2006 check_compiler "host system type" "cc_host" "$host" "$cc_host" "$CC" "gcc" "cc" "0" "-dumpmachine"
2011 check_compiler "build c++" "cxx_build" "$build" "$cxx_build" "$CXX" "g++" "c++" 1 "-dumpmachine"
2015 # By default the host is the build
2016 if [ -z "$host" ]; then host="$build"; fi
2017 check_compiler "host c++" "cxx_host" "$host" "$cxx_host" "$CXX" "g++" "c++" 1 "-dumpmachine"
2021 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ]; then
2022 check_compiler "host windres" "windres" "$host" "$windres" "$WINDRES" "windres" "windres" "2" "-V"
2027 if [ "$os" = "OS2" ]; then
2028 # OS2 via gcc is a bit weird.. stripping HAS to be done via emxbind, which is via gcc directly
2029 log 1 "checking host strip... using gcc -s option"
2030 elif [ "$os" = "OSX" ]; then
2031 # Most targets have -V in strip, to see if they exists... OSX doesn't.. so execute something
2032 echo "int main(int argc, char *argv[]) { }" > strip.test.c
2033 $cxx_host strip.test.c -o strip.test
2034 check_compiler "host strip" "strip" "$host" "$strip" "$STRIP" "strip" "strip" "3" "strip.test"
2035 rm -f strip.test.c strip.test
2037 check_compiler "host strip" "strip" "$host" "$strip" "$STRIP" "strip" "strip" "3" "-V"
2042 if [ "$os" = "OSX" ] && [ "$enable_universal" != "0" ]; then
2043 echo "int main(int argc, char *argv[]) { }" > lipo.test.c
2044 $cxx_host lipo.test.c -o lipo.test
2045 check_compiler "host lipo" "lipo" "$host" "$lipo" "$LIPO" "lipo" "lipo" "4" "-info lipo.test"
2046 rm -f lipo.test.c lipo.test
2052 if [ -n "$1" ]; then
2053 if echo "$1" | grep -q / ; then
2054 # Seems to be a file system path
2057 osx_sdk_path="/Developer/SDKs/MacOSX$1.sdk"
2059 if [ ! -d "$osx_sdk_path" ]; then
2060 # No directory, not present or garbage
2064 # Set minimum version to 10.4 as that's when kCGBitmapByteOrder32Host was introduced
2065 sysroot="-isysroot $osx_sdk_path -Wl,-syslibroot,$osx_sdk_path -mmacosx-version-min=10.4"
2068 cat > tmp.osx.mm << EOF
2069 #include <Cocoa/Cocoa.h>
2071 kCGBitmapByteOrder32Host;
2075 execute="$cxx_host $sysroot $CFLAGS tmp.osx.mm -framework Cocoa -o tmp.osx 2>&1"
2076 eval $execute > /dev/null
2078 log 2 "executing $execute"
2079 log 2 " exit code $ret"
2080 rm -f tmp.osx.mm tmp.osx
2084 check_direct_music() {
2086 #include <windows.h>
2087 #include <dmksctrl.h>
2088 #include <dmusici.h>
2089 #include <dmusicc.h>
2090 #include <dmusicf.h>
2091 int main(int argc, char *argv[]) { }" > direct_music.test.c
2092 $cxx_host $CFLAGS direct_music.test.c -o direct_music.test 2> /dev/null
2094 rm -f direct_music.test.c direct_music.test
2096 if [ "$res" != "0" ]; then
2097 if [ "$with_direct_music" != "1" ]; then
2098 log 1 "configure: error: direct-music is not available on this system"
2101 with_direct_music="0"
2103 log 1 "checking direct-music... not found"
2105 log 1 "checking direct-music... found"
2109 check_makedepend() {
2110 if [ "$enable_builtin_depend" != "0" ]; then
2114 if [ "$with_makedepend" = "0" ]; then
2115 log 1 "checking makedepend... disabled"
2119 if [ "$with_makedepend" = "1" ] || [ "$with_makedepend" = "2" ]; then
2120 makedepend="makedepend"
2122 makedepend="$with_makedepend"
2125 rm -f makedepend.tmp
2126 touch makedepend.tmp
2127 res=`$makedepend -fmakedepend.tmp 2>/dev/null`
2129 log 2 "executing $makedepend -f makedepend.tmp"
2130 log 2 " returned `cat makedepend.tmp`"
2131 log 2 " exit code $ret"
2133 if [ ! -s makedepend.tmp ]; then
2134 rm -f makedepend.tmp makedepend.tmp.bak
2136 if [ "$with_makedepend" = "2" ]; then
2137 log 1 "checking makedepend... not found"
2139 log 1 "I couldn't detect any makedepend on your system"
2140 log 1 "please locate it via --makedepend=[binary]"
2143 elif [ "$with_makedepend" != "1" ]; then
2144 log 1 "checking makedepend... $makedepend not found"
2146 log 1 "the selected file doesn't seem to be a valid makedepend binary"
2150 log 1 "checking makedepend... not found"
2157 rm -f makedepend.tmp makedepend.tmp.bak
2159 log 1 "checking makedepend... $makedepend"
2163 # $1 - requested version (major.minor)
2164 # $2 - version we got (major.minor)
2166 if [ -z "$2" ]; then
2170 req_major=`echo $1 | cut -d. -f1`
2171 got_major=`echo $2 | cut -d. -f1`
2172 if [ $got_major -lt $req_major ]; then
2174 elif [ $got_major -gt $req_major ]; then
2178 req_minor=`echo $1 | cut -d. -f2`
2179 got_minor=`echo $2 | cut -d. -f2`
2180 if [ $got_minor -lt $req_minor ]; then
2187 # Not all awks allow gsub(), so we test for that here! It is in fact all we need...
2189 # These awks are known to work. Test for them explicit
2190 awks="gawk mawk nawk"
2192 awk_prefix="echo \"a.c b.c c.c\" | tr ' ' \\\\n | "
2193 awk_param="' { ORS = \" \" } /\.c$/ { gsub(\".c$\", \".o\", \$0); print \$0; }' 2>/dev/null"
2194 awk_result="a.o b.o c.o "
2195 log 2 "Detecing awk..."
2197 log 2 "Trying: $awk_prefix $awk $awk_param"
2198 res=`eval $awk_prefix $awk $awk_param`
2199 log 2 "Result: '$res'"
2200 if [ "$res" != "$awk_result" ] && [ "$awk" = "awk" ]; then
2201 # User didn't supply his own awk, so try to detect some other known working names for an awk
2202 for awk in $awks; do
2203 log 2 "Trying: $awk_prefix $awk $awk_param"
2204 res=`eval $awk_prefix $awk $awk_param`
2205 log 2 "Result: '$res'"
2206 if [ "$res" = "$awk_result" ]; then break; fi
2209 if [ "$res" != "$awk_result" ]; then
2210 log 1 "checking awk... not found"
2211 log 1 "configure: error: no awk found"
2212 log 1 "configure: error: please install one of the following: $awks"
2216 if [ "$res" != "$awk_result" ]; then
2217 log 1 "checking awk... not found"
2218 log 1 "configure: error: you supplied '$awk' but it doesn't seem a valid gawk or mawk"
2222 log 1 "checking awk... $awk"
2226 if [ "$os" = "DETECT" ]; then
2227 # Detect UNIX, OSX, FREEBSD, OPENBSD, NETBSD, HPUX, MORPHOS, BEOS, SUNOS, CYGWIN, MINGW, OS2, DOS, WINCE, and PSP
2229 # Try first via dumpmachine, then via uname
2230 os=`echo "$host" | tr '[A-Z]' '[a-z]' | $awk '
2231 /linux/ { print "UNIX"; exit}
2232 /darwin/ { print "OSX"; exit}
2233 /freebsd/ { print "FREEBSD"; exit}
2234 /openbsd/ { print "OPENBSD"; exit}
2235 /netbsd/ { print "NETBSD"; exit}
2236 /hp-ux/ { print "HPUX"; exit}
2237 /morphos/ { print "MORPHOS"; exit}
2238 /beos/ { print "BEOS"; exit}
2239 /haiku/ { print "HAIKU"; exit}
2240 /sunos/ { print "SUNOS"; exit}
2241 /solaris/ { print "SUNOS"; exit}
2242 /cygwin/ { print "CYGWIN"; exit}
2243 /mingw/ { print "MINGW"; exit}
2244 /os2/ { print "OS2"; exit}
2245 /dos/ { print "DOS"; exit}
2246 /wince/ { print "WINCE"; exit}
2247 /psp/ { print "PSP"; exit}
2250 if [ -z "$os" ]; then
2251 os=`LC_ALL=C uname | tr '[A-Z]' '[a-z]' | $awk '
2252 /linux/ { print "UNIX"; exit}
2253 /darwin/ { print "OSX"; exit}
2254 /freebsd/ { print "FREEBSD"; exit}
2255 /openbsd/ { print "OPENBSD"; exit}
2256 /netbsd/ { print "NETBSD"; exit}
2257 /hp-ux/ { print "HPUX"; exit}
2258 /morphos/ { print "MORPHOS"; exit}
2259 /beos/ { print "BEOS"; exit}
2260 /haiku/ { print "HAIKU"; exit}
2261 /sunos/ { print "SUNOS"; exit}
2262 /cygwin/ { print "CYGWIN"; exit}
2263 /mingw/ { print "MINGW"; exit}
2264 /os\/2/ { print "OS2"; exit}
2265 /gnu/ { print "UNIX"; exit}
2269 if [ -z "$os" ]; then
2270 log 1 "detecting OS... none detected"
2271 log 1 "I couldn't detect your OS. Please use --os=OS to force one"
2272 log 1 "Allowed values are: UNIX, OSX, FREEBSD, OPENBSD, NETBSD, MORPHOS, HPUX, BEOS, HAIKU, SUNOS, CYGWIN, MINGW, OS2, DOS, WINCE, and PSP"
2276 log 1 "detecting OS... $os"
2278 log 1 "forcing OS... $os"
2283 # 0 means no, 1 is auto-detect, 2 is force
2284 if [ "$with_allegro" = "0" ]; then
2285 log 1 "checking Allegro... disabled"
2291 if [ "$with_allegro" = "2" ] && [ "$with_cocoa" = "2" ]; then
2292 log 1 "configure: error: it is impossible to compile both Allegro and COCOA"
2293 log 1 "configure: error: please deselect one of them and try again"
2297 if [ "$with_allegro" = "2" ] && [ "$enable_dedicated" != "0" ]; then
2298 log 1 "configure: error: it is impossible to compile a dedicated with Allegro"
2299 log 1 "configure: error: please deselect one of them and try again"
2303 if [ "$enable_dedicated" != "0" ]; then
2304 log 1 "checking Allegro... dedicated server, skipping"
2310 # By default on OSX we don't use SDL. The rest is auto-detect
2311 if [ "$with_allegro" = "1" ] && [ "$os" = "OSX" ] && [ "$with_cocoa" != "0" ]; then
2312 log 1 "checking Allegro... OSX, skipping"
2318 if [ "$with_allegro" = "1" ] || [ "$with_allegro" = "" ] || [ "$with_allegro" = "2" ]; then
2319 allegro_config="allegro-config"
2321 allegro_config="$with_allegro"
2324 version=`$allegro_config --version 2>/dev/null`
2326 log 2 "executing $allegro_config --version"
2327 log 2 " returned $version"
2328 log 2 " exit code $ret"
2330 if [ -z "$version" ] || [ "$ret" != "0" ]; then
2331 log 1 "checking Allegro... not found"
2333 # It was forced, so it should be found.
2334 if [ "$with_allegro" != "1" ]; then
2335 log 1 "configure: error: allegro-config couldn't be found"
2336 log 1 "configure: error: you supplied '$with_allegro', but it seems invalid"
2344 log 1 "checking Allegro... found"
2349 # 0 means no, 1 is auto-detect, 2 is force
2350 if [ "$with_sdl" = "0" ]; then
2351 log 1 "checking SDL... disabled"
2357 if [ "$with_sdl" = "2" ] && [ "$with_cocoa" = "2" ]; then
2358 log 1 "configure: error: it is impossible to compile both SDL and COCOA"
2359 log 1 "configure: error: please deselect one of them and try again"
2363 if [ "$with_sdl" = "2" ] && [ "$enable_dedicated" != "0" ]; then
2364 log 1 "configure: error: it is impossible to compile a dedicated with SDL"
2365 log 1 "configure: error: please deselect one of them and try again"
2369 if [ "$enable_dedicated" != "0" ]; then
2370 log 1 "checking SDL... dedicated server, skipping"
2376 # By default on OSX we don't use SDL. The rest is auto-detect
2377 if [ "$with_sdl" = "1" ] && [ "$os" = "OSX" ] && [ "$with_cocoa" != "0" ]; then
2378 log 1 "checking SDL... OSX, skipping"
2384 if [ "$os" = "OSX" ]; then
2385 log 1 "WARNING: sdl is known to fail on some versions of Mac OS X"
2386 log 1 "WARNING: with some hardware configurations. Use at own risk!"
2390 if [ "$with_sdl" = "1" ] || [ "$with_sdl" = "" ] || [ "$with_sdl" = "2" ]; then
2391 sdl_config="sdl-config"
2393 sdl_config="$with_sdl"
2396 version=`$sdl_config --version 2>/dev/null`
2398 log 2 "executing $sdl_config --version"
2399 log 2 " returned $version"
2400 log 2 " exit code $ret"
2402 if [ -z "$version" ] || [ "$ret" != "0" ]; then
2403 log 1 "checking SDL... not found"
2405 # It was forced, so it should be found.
2406 if [ "$with_sdl" != "1" ]; then
2407 log 1 "configure: error: sdl-config couldn't be found"
2408 log 1 "configure: error: you supplied '$with_sdl', but it seems invalid"
2416 log 1 "checking SDL... found"
2420 # Try to find the best SDK available. For a normal build this
2421 # is currently the 10.5 SDK as this is needed to compile all
2422 # optional code. Because such an executable won't run on 10.4
2423 # or lower, also check for the 10.4u SDK when doing an universal
2426 # Check for the 10.5 SDK, but try 10.6 if that fails
2427 check_osx_sdk "10.5" || check_osx_sdk "10.6" || osx_sdk_path=""
2429 if [ -z "$osx_sdk_path" ] || [ "$enable_universal" != "0" ]; then
2430 # No better SDK or universal build enabled? Check 10.4u SDK as well
2431 local old_sdk="$osx_sdk_path"
2432 if check_osx_sdk "10.4u"; then
2433 osx_sdk_104_path="$osx_sdk_path"
2437 if [ -z "$old_sdk" ]; then
2438 osx_sdk_path="$osx_sdk_104_path"
2440 osx_sdk_path="$old_sdk"
2444 if [ -z "$osx_sdk_path" ]; then
2445 log 1 "Your system SDK is probably too old"
2446 log 1 "Please install/upgrade your Xcode to >= 2.5"
2453 # 0 means no, 1 is auto-detect, 2 is force
2454 if [ "$with_cocoa" = "0" ]; then
2455 log 1 "checking COCOA... disabled"
2460 if [ "$with_cocoa" = "2" ] && [ "$enable_dedicated" != "0" ]; then
2461 log 1 "configure: error: it is impossible to compile a dedicated with COCOA"
2462 log 1 "configure: error: please deselect one of them and try again"
2466 if [ "$enable_dedicated" != "0" ]; then
2467 log 1 "checking COCOA... dedicated server, skipping"
2473 # By default on OSX we use COCOA. The rest doesn't support it
2474 if [ "$with_cocoa" = "1" ] && [ "$os" != "OSX" ]; then
2475 log 1 "checking COCOA... not OSX, skipping"
2481 if [ "$os" != "OSX" ]; then
2482 log 1 "checking COCOA... not OSX"
2484 log 1 "configure: error: COCOA video driver is only supported for OSX"
2488 log 1 "checking COCOA... found"
2491 if [ "$enable_cocoa_quartz" != "0" ]; then
2492 log 1 "checking whether to enable the Quartz window subdriver... yes"
2494 log 1 "checking whether to enable the Quartz window subdriver... no"
2500 detect_quickdraw() {
2501 # 0 means no, 1 is auto-detect, 2 is force
2502 if [ "$enable_cocoa_quickdraw" = "0" ]; then
2503 log 1 "checking Quickdraw window subdriver... disabled"
2507 # Assume QuickDraw is available when doing an universal build
2508 if [ "$enable_universal" != "0" ]; then
2509 log 1 "checking Quickdraw window subdriver... found"
2513 # 64 bits doesn't have quickdraw
2514 if [ "$cpu_type" = "64" ]; then
2515 enable_cocoa_quickdraw="0"
2516 log 1 "checking Quickdraw window subdriver... disabled (64 bits)"
2520 cat > tmp.osx.mm << EOF
2521 #include <AvailabilityMacros.h>
2522 #import <Cocoa/Cocoa.h>
2523 int main(int argc, char *argv[]) { SetEmptyRgn(NULL); return 0; }
2525 execute="$cxx_host $OSX_SYSROOT $OSX_LD_SYSROOT $CFLAGS -mmacosx-version-min=10.3 tmp.osx.mm -framework Cocoa -o tmp.osx 2>&1"
2526 eval $execute > /dev/null
2528 log 2 "executing $execute"
2529 log 2 " exit code $ret"
2530 rm -f tmp.osx.mm tmp.osx
2531 if [ "$ret" != "0" ]; then
2532 log 1 "checking Quickdraw window subdriver... not found"
2534 # It was forced, so it should be found.
2535 if [ "$enable_cocoa_quickdraw" != "1" ]; then
2536 log 1 "configure: error: Quickdraw window driver could not be found"
2540 enable_cocoa_quickdraw=0
2544 enable_cocoa_quickdraw=1
2545 log 1 "checking Quickdraw window subdriver... found"
2549 # $1 - config-param ($with_zlib value)
2550 # $2 - library name ('zlib', sets $zlib)
2551 # $3 - static library name (libz.a)
2552 # $4 - header directory ()
2553 # $5 - header name (zlib.h)
2554 # $6 - force static (if non-empty)
2556 if [ -n "$6" ]; then force_static="1"; fi
2558 # 0 means no, 1 is auto-detect, 2 is force
2559 if [ "$1" = "0" ]; then
2560 log 1 "checking $2... disabled"
2566 log 2 "detecting $2"
2568 if [ "$1" = "1" ] || [ "$1" = "" ] || [ "$1" = "2" ]; then
2569 eval "$2=`ls -1 /usr/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2571 if [ -z "$res" ]; then
2572 log 2 " trying /usr/include/$4$5... no"
2573 eval "$2=`ls -1 /usr/local/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2576 if [ -z "$res" ]; then
2577 log 2 " trying /usr/local/include/$4$5... no"
2578 eval "$2=`ls -1 /mingw/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2581 if [ -z "$res" ]; then
2582 log 2 " trying /mingw/include/$4$5... no"
2583 eval "$2=`ls -1 /opt/local/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2586 if [ -z "$res" ]; then
2587 log 2 " trying /opt/local/include/$4$5... no"
2589 if [ -z "$res" ] && [ "$os" = "NETBSD" ]; then
2590 eval "$2=`ls -1 /usr/pkg/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2592 if [ -z "$res" ]; then
2593 log 2 " trying /usr/pkg/include/$4$5... no"
2596 if [ -z "$res" ] && [ "$os" = "HAIKU" ]; then
2597 eval "$2=`ls -1 /boot/common/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2599 if [ -z "$res" ]; then
2600 log 2 " trying /boot/common/include/$4$5... no"
2605 if [ -n "$res" ] && ( [ -n "$force_static" ] || ( [ "$enable_static" != "0" ] && [ "$os" != "OSX" ] ) ); then
2607 log 2 " trying $res... found"
2608 # Now find the static lib, if needed
2609 eval "$2=`ls /lib/*.a 2>/dev/null | egrep \"\/$3\$\"`"
2611 if [ -z "$res" ]; then
2612 log 2 " trying /lib/$3... no"
2613 eval "$2=`ls /usr/lib/*.a 2>/dev/null | egrep \"\/$3\$\"`"
2616 if [ -z "$res" ]; then
2617 log 2 " trying /usr/lib/$3... no"
2618 eval "$2=`ls /usr/local/lib/*.a 2>/dev/null | egrep \"\/$3\$\"`"
2621 if [ -z "$res" ]; then
2622 log 2 " trying /usr/local/lib/$3... no"
2623 eval "$2=`ls /mingw/lib/*.a 2>/dev/null | egrep \"\/$3\$\"`"
2626 if [ -z "$res" ]; then
2627 log 2 " trying /mingw/lib/$3... no"
2628 log 1 "configure: error: $2 couldn't be found"
2629 log 1 "configure: error: you requested a static link, but I can't find $3"
2635 # Make sure it exists
2636 if [ -f "$1" ]; then
2637 eval "$2=`ls $1 2>/dev/null`"
2639 eval "$2=`ls $1/$3 2>/dev/null`"
2644 if [ -z "$res" ]; then
2645 log 1 "checking $2... not found"
2646 if [ "$1" = "2" ]; then
2647 log 1 "configure: error: $2 couldn't be found"
2650 elif [ "$1" != "1" ]; then
2651 log 1 "configure: error: $2 couldn't be found"
2652 log 1 "configure: error: you supplied '$1', but it seems invalid"
2663 log 2 " trying $res... found"
2665 log 1 "checking $2... found"
2669 detect_library "$with_zlib" "zlib" "libz.a" "" "zlib.h"
2673 detect_library "$with_lzo2" "lzo2" "liblzo2.a" "lzo/" "lzo1x.h"
2676 detect_libtimidity() {
2677 detect_library "$with_libtimidity" "libtimidity" "libtimidity.a" "" "timidity.h"
2681 # 0 means no, 1 is auto-detect, 2 is force
2682 if [ "$with_lzma" = "0" ]; then
2683 log 1 "checking liblzma... disabled"
2689 if [ "$with_lzma" = "1" ] || [ "$with_lzma" = "" ] || [ "$with_lzma" = "2" ]; then
2690 lzma_config="pkg-config liblzma"
2692 lzma_config="$with_lzma"
2695 version=`$lzma_config --modversion 2>/dev/null`
2697 log 2 "executing $lzma_config --modversion"
2698 log 2 " returned $version"
2699 log 2 " exit code $ret"
2701 if [ -z "$version" ] || [ "$ret" != "0" ]; then
2702 log 1 "checking liblzma... not found"
2704 # It was forced, so it should be found.
2705 if [ "$with_lzma" != "1" ]; then
2706 log 1 "configure: error: pkg-config liblzma couldn't be found"
2707 log 1 "configure: error: you supplied '$with_lzma', but it seems invalid"
2715 log 1 "checking liblzma... found"
2719 # 0 means no, 1 is auto-detect, 2 is force
2720 if [ "$with_png" = "0" ]; then
2721 log 1 "checking libpng... disabled"
2727 if [ "$with_zlib" = "0" ] || [ -z "$zlib" ]; then
2728 if [ "$with_png" != "1" ]; then
2729 log 1 "checking libpng... no zlib"
2730 log 1 "ERROR: libpng was forced, but zlib was not detected / disabled."
2731 log 1 "ERROR: libpng depends on zlib."
2736 log 1 "checking libpng... no zlib, skipping"
2742 if [ "$with_png" = "1" ] || [ "$with_png" = "" ] || [ "$with_png" = "2" ]; then
2743 png_config="libpng-config"
2745 png_config="$with_png"
2748 version=`$png_config --version 2>/dev/null`
2750 log 2 "executing $png_config --version"
2751 log 2 " returned $version"
2752 log 2 " exit code $ret"
2754 if [ -z "$version" ] || [ "$ret" != "0" ]; then
2755 log 1 "checking libpng... not found"
2757 # It was forced, so it should be found.
2758 if [ "$with_png" != "1" ]; then
2759 log 1 "configure: error: libpng-config couldn't be found"
2760 log 1 "configure: error: you supplied '$with_png', but it seems invalid"
2768 log 1 "checking libpng... found"
2772 # 0 means no, 1 is auto-detect, 2 is force
2773 if [ "$with_freetype" = "0" ]; then
2774 log 1 "checking libfreetype... disabled"
2779 if [ "$with_freetype" = "1" ] && [ "$enable_dedicated" != "0" ]; then
2780 log 1 "checking libfreetype... dedicated server, skipping"
2786 if [ "$with_zlib" = "0" ] || [ -z "$zlib" ]; then
2787 if [ "$with_freetype" != "1" ]; then
2788 log 1 "checking libfreetype... no zlib"
2789 log 1 "ERROR: libfreetype was forced, but zlib was not detected / disabled."
2790 log 1 "ERROR: libfreetype depends on zlib."
2795 log 1 "checking libfreetype... no zlib, skipping"
2801 if [ "$with_freetype" = "1" ] || [ "$with_freetype" = "" ] || [ "$with_freetype" = "2" ]; then
2802 freetype_config="freetype-config"
2804 freetype_config="$with_freetype"
2807 version=`$freetype_config --version 2>/dev/null`
2809 log 2 "executing freetype_config --version"
2810 log 2 " returned $version"
2811 log 2 " exit code $ret"
2813 if [ -z "$version" ] || [ "$ret" != "0" ]; then
2814 log 1 "checking libfreetype... not found"
2816 # It was forced, so it should be found.
2817 if [ "$with_freetype" != "1" ]; then
2818 log 1 "configure: error: freetype-config couldn't be found"
2819 log 1 "configure: error: you supplied '$with_freetype', but it seems invalid"
2827 log 1 "checking libfreetype... found"
2830 detect_fontconfig() {
2831 # 0 means no, 1 is auto-detect, 2 is force
2832 if [ "$with_fontconfig" = "0" ]; then
2833 log 1 "checking libfontconfig... disabled"
2835 fontconfig_config=""
2838 if [ "$with_fontconfig" = "1" ] && [ "$enable_dedicated" != "0" ]; then
2839 log 1 "checking libfontconfig... dedicated server, skipping"
2841 fontconfig_config=""
2844 if [ "$with_fontconfig" != "2" ] && [ -z "$freetype_config" ]; then
2845 log 1 "checking libfontconfig... no freetype, skipping"
2847 fontconfig_config=""
2851 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ]; then
2852 log 1 "checking libfontconfig... WIN32, skipping"
2853 fontconfig_config=""
2857 if [ "$os" = "OSX" ]; then
2858 log 1 "checking libfontconfig... OSX, skipping"
2859 fontconfig_config=""
2863 if [ "$with_fontconfig" = "1" ] || [ "$with_fontconfig" = "" ] || [ "$with_fontconfig" = "2" ]; then
2864 fontconfig_config="pkg-config fontconfig"
2866 fontconfig_config="$with_fontconfig"
2869 version=`$fontconfig_config --modversion 2>/dev/null`
2871 check_version '2.3' "$version"
2873 log 2 "executing $fontconfig_config --modversion"
2874 log 2 " returned $version"
2875 log 2 " exit code $ret"
2877 if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$version_ok" != "1" ]; then
2878 if [ -n "$version" ] && [ "$version_ok" != "1" ]; then
2879 log 1 "checking libfontconfig... needs at least version 2.3.0, fontconfig NOT enabled"
2881 log 1 "checking libfontconfig... not found"
2884 # It was forced, so it should be found.
2885 if [ "$with_fontconfig" != "1" ]; then
2886 log 1 "configure: error: fontconfig-config couldn't be found"
2887 log 1 "configure: error: you supplied '$with_fontconfig', but it seems invalid"
2891 fontconfig_config=""
2895 log 1 "checking libfontconfig... found"
2899 # 0 means no, 1 is auto-detect, 2 is force
2900 if [ "$with_icu" = "0" ]; then
2901 log 1 "checking libicu... disabled"
2906 if [ "$with_icu" = "1" ] && [ "$enable_dedicated" != "0" ]; then
2907 log 1 "checking libicu... dedicated server, skipping"
2913 if [ "$with_icu" = "1" ] || [ "$with_icu" = "" ] || [ "$with_icu" = "2" ]; then
2914 icu_config="icu-config"
2916 icu_config="$with_icu"
2919 version=`$icu_config --version 2>/dev/null`
2921 check_version '3.6' "$version"
2923 log 2 "executing $icu_config --version"
2924 log 2 " returned $version"
2925 log 2 " exit code $ret"
2927 if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$version_ok" != "1" ]; then
2928 if [ -n "$version" ] && [ "$version_ok" != "1" ]; then
2929 log 1 "checking libicu... needs at least version 3.6.0, icu NOT enabled"
2931 log 1 "checking libicu... not found"
2934 # It was forced, so it should be found.
2935 if [ "$with_icu" != "1" ]; then
2936 log 1 "configure: error: icu-config couldn't be found"
2937 log 1 "configure: error: you supplied '$with_icuconfig', but it seems invalid"
2945 log 1 "checking libicu... found"
2948 detect_pspconfig() {
2949 # 0 means no, 1 is auto-detect, 2 is force
2950 if [ "$with_psp_config" = "0" ]; then
2951 log 1 "checking psp-config... disabled"
2957 if [ "$with_psp_config" = "1" ] && [ "$os" != "PSP" ]; then
2958 log 1 "checking psp-config... not PSP, skipping"
2964 if [ "$os" != "PSP" ]; then
2965 log 1 "checking psp-config... not PSP"
2967 log 1 "configure: error: psp-config is only supported for PSP"
2971 if [ "$with_psp_config" = "1" ] || [ "$with_psp_config" = "" ] || [ "$with_psp_config" = "2" ]; then
2972 psp_config="psp-config"
2974 psp_config="$with_psp_config"
2977 version=`$psp_config -p 2>/dev/null`
2979 log 2 "executing $psp_config -p"
2980 log 2 " returned $version"
2981 log 2 " exit code $ret"
2983 if [ -z "$version" ] || [ "$ret" != "0" ]; then
2984 log 1 "checking psp-config... not found"
2985 log 1 "configure: error: psp-config couldn't be found"
2987 # It was forced, so it should be found.
2988 if [ "$with_psp_config" != "1" ]; then
2989 log 1 "configure: error: you supplied '$with_psp_config', but it seems invalid"
2994 log 1 "checking psp-config... found"
2998 # 0 means no, 1 is auto-detect, 2 is force
2999 if [ "$with_iconv" = "0" ]; then
3000 log 1 "checking iconv... disabled"
3005 if [ "$with_iconv" = "1" ] && [ "$os" != "OSX" ]; then
3006 log 1 "checking iconv... not OSX, skipping"
3012 # Try to find iconv.h, seems to only thing to detect iconv with
3014 if [ "$with_iconv" = "1" ] || [ "$with_iconv" = "" ] || [ "$with_iconv" = "2" ]; then
3015 iconv=`ls -1 /usr/include 2>/dev/null | grep "iconv.h"`
3016 if [ -z "$iconv" ]; then
3017 iconv=`ls -1 /usr/local/include 2>/dev/null | grep "iconv.h"`
3020 # Make sure it exists
3021 iconv=`ls $with_iconv/include/iconv.h 2>/dev/null`
3024 if [ -z "$iconv" ]; then
3025 log 1 "checking iconv... not found"
3026 if [ "$with_iconv" = "2" ]; then
3027 log 1 "configure: error: iconv couldn't be found"
3030 elif [ "$with_iconv" != "1" ]; then
3031 log 1 "configure: error: iconv couldn't be found"
3032 log 1 "configure: error: you supplied '$with_iconv', but I couldn't detect iconv in it"
3040 if [ "$with_iconv" = "1" ]; then
3044 log 2 "found iconv in $iconv"
3046 log 1 "checking iconv... found"
3048 # There are different implementations of iconv. The older ones,
3049 # e.g. SUSv2, pass a const pointer, whereas the newer ones, e.g.
3050 # IEEE 1003.1 (2004), pass a non-const pointer.
3052 cat > tmp.iconv.cpp << EOF
3053 #include "src/stdafx.h"
3056 static char buf[1024];
3058 const char *inbuf = "";
3060 size_t outlen = 1023;
3062 return iconv(convd, &inbuf, &inlen, &outbuf, &outlen);
3065 execute="$cxx_host $OSX_SYSROOT $CFLAGS -c tmp.iconv.cpp -o tmp.iconv -DTESTING 2>&1"
3066 eval $execute > /dev/null
3068 log 2 "executing $execute"
3069 log 2 " exit code $ret"
3070 if [ "$ret" = "0" ]; then have_non_const_iconv="no"; else have_non_const_iconv="yes"; fi
3071 log 1 "checking if iconv has non-const inbuf... $have_non_const_iconv"
3073 cat > tmp.iconv.cpp << EOF
3074 #include "src/stdafx.h"
3077 static char buf[1024];
3081 size_t outlen = 1023;
3083 return iconv(convd, &inbuf, &inlen, &outbuf, &outlen);
3086 execute="$cxx_host $OSX_SYSROOT $OSX_LD_SYSROOT $CFLAGS tmp.iconv.cpp -o tmp.iconv -DTESTING 2>&1"
3087 eval $execute > /dev/null
3089 log 2 "executing $execute"
3090 log 2 " exit code $ret"
3091 if [ "$ret" = "0" ]; then link_to_iconv="no"; else link_to_iconv="yes"; fi
3092 log 1 "checking whether to link to iconv... $link_to_iconv"
3093 rm -f tmp.iconv tmp.iconv.cpp
3107 log 2 "running echo <array> | $1"
3109 if [ "`echo \"$sort_test_in\" | $1 2>/dev/null`" = "$sort_test_out" ]; then
3111 log 2 " result was valid"
3113 log 2 " result was invalid"
3118 if [ "$with_sort" = "0" ]; then
3119 log 1 "checking sort... disabled"
3124 if [ "$with_sort" = "1" ] || [ "$with_sort" = "2" ]; then
3126 if [ -z "$sort" ]; then _detect_sort "/sbin/sort"; fi
3127 if [ -z "$sort" ]; then _detect_sort "/usr/sbin/sort"; fi
3128 if [ -z "$sort" ]; then _detect_sort "/usr/local/sbin/sort"; fi
3129 if [ -z "$sort" ]; then _detect_sort "/bin/sort"; fi
3130 if [ -z "$sort" ]; then _detect_sort "/usr/bin/sort"; fi
3131 if [ -z "$sort" ]; then _detect_sort "/usr/local/bin/sort"; fi
3133 _detect_sort "$with_sort"
3136 if [ -z "$sort" ]; then
3137 if [ "$with_sort" = "2" ]; then
3138 log 1 "checking sort... not found"
3140 log 1 "configure: error: couldn't detect sort on your system"
3142 elif [ "$with_sort" != "1" ]; then
3143 log 1 "checking sort... $with_sort not found"
3145 log 1 "configure: error: '$with_sort' doesn't look like a sort to me"
3146 log 1 "configure: error: please verify its location and function and try again"
3150 log 1 "checking sort... not found"
3153 log 1 "checking sort... $sort"
3158 # 0 means no, 1 is auto-detect, 2 is force
3159 if [ "$with_grfcodec" = "0" ]; then
3160 log 1 "checking grfcodec... disabled"
3166 if [ "$with_grfcodec" = "1" ] || [ "$with_grfcodec" = "" ] || [ "$with_grfcodec" = "2" ]; then
3169 grfcodec="$with_grfcodec"
3172 version=`$grfcodec -v 2>/dev/null | $awk '{print $3}' | sed 's/[rM]//g;s/-/0/'`
3174 log 2 "executing grfcodec -v"
3175 log 2 " returned $version"
3176 log 2 " exit code $ret"
3178 if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$version" -lt "949" ]; then
3179 if [ -n "$version" ] && [ "$version" -lt "949" ]; then
3180 log 1 "checking grfcodec... needs at least version 6.0.2 (r949), disabled"
3182 log 1 "checking grfcodec... not found"
3185 # It was forced, so it should be found.
3186 if [ "$with_grfcodec" != "1" ]; then
3187 log 1 "configure: error: grfcodec couldn't be found"
3188 log 1 "configure: error: you supplied '$with_grfcodec', but it seems invalid"
3196 log 1 "checking grfcodec... found"
3200 # 0 means no, 1 is auto-detect, 2 is force
3201 if [ "$with_nforenum" = "0" ]; then
3202 log 1 "checking nforenum... disabled"
3208 if [ "$with_nforenum" = "1" ] || [ "$with_nforenum" = "" ] || [ "$with_nforenum" = "2" ]; then
3211 nforenum="$with_nforenum"
3214 version=`$nforenum -v 2>/dev/null | $awk '{print $3}' | sed 's/[rM]//g;s/-/0/'`
3216 log 2 "executing nforenum -v"
3217 log 2 " returned $version"
3218 log 2 " exit code $ret"
3220 if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$version" -lt "949" ]; then
3221 if [ -n "$version" ] && [ "$version" -lt "949" ]; then
3222 log 1 "checking nforenum... needs at least version 6.0.2 (r949), disabled"
3224 log 1 "checking nforenum... not found"
3227 # It was forced, so it should be found.
3228 if [ "$with_nforenum" != "1" ]; then
3229 log 1 "configure: error: nforenum couldn't be found"
3230 log 1 "configure: error: you supplied '$with_nforenum', but it seems invalid"
3238 log 1 "checking nforenum... found"
3242 if [ -n "$cpu_type" ] && [ "$cpu_type" != "DETECT" ]; then
3243 log 1 "forcing cpu-type... $cpu_type bits"
3246 echo "#define _SQ64 1" > tmp.64bit.cpp
3247 echo "#include \"src/stdafx.h\"" >> tmp.64bit.cpp
3248 echo "assert_compile(sizeof(size_t) == 8);" >> tmp.64bit.cpp
3249 echo "int main() { return 0; }" >> tmp.64bit.cpp
3250 execute="$cxx_host $CFLAGS tmp.64bit.cpp -o tmp.64bit -DTESTING 2>&1"
3251 cpu_type="`eval $execute 2>/dev/null`"
3253 log 2 "executing $execute"
3254 log 2 " returned $cpu_type"
3255 log 2 " exit code $ret"
3256 if [ "$ret" = "0" ]; then cpu_type="64"; else cpu_type="32"; fi
3257 log 1 "detecting cpu-type... $cpu_type bits"
3258 rm -f tmp.64bit tmp.64bit.cpp
3263 T_CXXFLAGS="$CXXFLAGS"
3264 T_LDFLAGS="$LDFLAGS"
3266 SRC_OBJS_DIR="$BASE_SRC_OBJS_DIR/$OBJS_SUBDIR"
3268 # All the data needed to compile a single target
3269 # Make sure if you compile multiple targets to
3270 # use multiple OBJS_DIR, because all in-between
3271 # binaries are stored in there, and nowhere else.
3273 s@!!CC_HOST!!@$cc_host@g;
3274 s@!!CXX_HOST!!@$cxx_host@g;
3275 s@!!CC_BUILD!!@$cc_build@g;
3276 s@!!CXX_BUILD!!@$cxx_build@g;
3277 s@!!WINDRES!!@$windres@g;
3278 s@!!STRIP!!@$strip $strip_arg@g;
3280 s@!!CFLAGS!!@$T_CFLAGS@g;
3281 s@!!CFLAGS_BUILD!!@$CFLAGS_BUILD@g;
3282 s@!!CXXFLAGS!!@$T_CXXFLAGS@g;
3283 s@!!CXXFLAGS_BUILD!!@$CXXFLAGS_BUILD@g;
3284 s@!!STRGEN_FLAGS!!@$strgen_flags@g;
3286 s@!!LDFLAGS!!@$T_LDFLAGS@g;
3287 s@!!LDFLAGS_BUILD!!@$LDFLAGS_BUILD@g;
3288 s@!!BIN_DIR!!@$BIN_DIR@g;
3289 s@!!ROOT_DIR!!@$ROOT_DIR@g;
3290 s@!!MEDIA_DIR!!@$MEDIA_DIR@g;
3291 s@!!SOURCE_LIST!!@$SOURCE_LIST@g;
3292 s@!!SRC_OBJS_DIR!!@$SRC_OBJS_DIR@g;
3293 s@!!LANG_OBJS_DIR!!@$LANG_OBJS_DIR@g;
3294 s@!!GRF_OBJS_DIR!!@$GRF_OBJS_DIR@g;
3295 s@!!SETTING_OBJS_DIR!!@$SETTING_OBJS_DIR@g;
3296 s@!!SRC_DIR!!@$SRC_DIR@g;
3297 s@!!SCRIPT_SRC_DIR!!@$SCRIPT_SRC_DIR@g;
3298 s@!!OSXAPP!!@$OSXAPP@g;
3299 s@!!LANG_DIR!!@$LANG_DIR@g;
3301 s@!!BINARY_DIR!!@$prefix_dir/$binary_dir@g;
3302 s@!!DATA_DIR!!@$prefix_dir/$data_dir@g;
3303 s@!!DOC_DIR!!@$prefix_dir/$doc_dir@g;
3304 s@!!MAN_DIR!!@$prefix_dir/$man_dir@g;
3305 s@!!ICON_DIR!!@$prefix_dir/$icon_dir@g;
3306 s@!!ICON_THEME_DIR!!@$prefix_dir/$icon_theme_dir@g;
3307 s@!!PERSONAL_DIR!!@$personal_dir@g;
3308 s@!!SHARED_DIR!!@$shared_dir@g;
3309 s@!!INSTALL_DIR!!@$install_dir@g;
3310 s@!!BINARY_NAME!!@$binary_name@g;
3311 s@!!STRGEN!!@$STRGEN@g;
3312 s@!!ENDIAN_CHECK!!@$ENDIAN_CHECK@g;
3313 s@!!DEPEND!!@$DEPEND@g;
3314 s@!!SETTINGSGEN!!@$SETTINGSGEN@g;
3315 s@!!ENDIAN_FORCE!!@$endian@g;
3316 s@!!STAGE!!@$STAGE@g;
3317 s@!!MAKEDEPEND!!@$makedepend@g;
3318 s@!!CFLAGS_MAKEDEP!!@$cflags_makedep@g;
3320 s@!!CONFIG_CACHE_COMPILER!!@config.cache.compiler@g;
3321 s@!!CONFIG_CACHE_LINKER!!@config.cache.linker@g;
3322 s@!!CONFIG_CACHE_ENDIAN!!@config.cache.endian@g;
3323 s@!!CONFIG_CACHE_SOURCE!!@config.cache.source@g;
3324 s@!!CONFIG_CACHE_VERSION!!@config.cache.version@g;
3325 s@!!CONFIG_CACHE_SOURCE_LIST!!@config.cache.source.list@g;
3326 s@!!CONFIG_CACHE_PWD!!@config.cache.pwd@g;
3327 s@!!LANG_SUPPRESS!!@$lang_suppress@g;
3328 s@!!OBJS_C!!@$OBJS_C@g;
3329 s@!!OBJS_CPP!!@$OBJS_CPP@g;
3330 s@!!OBJS_MM!!@$OBJS_MM@g;
3331 s@!!OBJS_RC!!@$OBJS_RC@g;
3334 s@!!CONFIGURE_FILES!!@$CONFIGURE_FILES@g;
3336 s@!!DISTCC!!@$distcc@g;
3337 s@!!NFORENUM!!@$nforenum@g;
3338 s@!!GRFCODEC!!@$grfcodec@g;
3341 if [ "$icon_theme_dir" != "" ]; then
3342 SRC_REPLACE="$SRC_REPLACE
3343 s@!!ICON_THEME_DIR!!@$prefix_dir/$icon_theme_dir@g;
3346 SRC_REPLACE="$SRC_REPLACE
3347 s@!!ICON_THEME_DIR!!@@g;
3351 if [ "$man_dir" != "" ]; then
3352 SRC_REPLACE="$SRC_REPLACE
3353 s@!!MAN_DIR!!@$prefix_dir/$man_dir@g;
3356 SRC_REPLACE="$SRC_REPLACE
3361 if [ "$menu_dir" != "" ]; then
3362 SRC_REPLACE="$SRC_REPLACE
3363 s@!!MENU_DIR!!@$prefix_dir/$menu_dir@g;
3366 SRC_REPLACE="$SRC_REPLACE
3372 generate_menu_item() {
3375 s@!!MENU_GROUP!!@$menu_group@g;
3376 s@!!MENU_NAME!!@$menu_name@g
3378 log 1 "Generating menu item..."
3380 < $ROOT_DIR/media/openttd.desktop.in sed "$MENU_REPLACE" > media/openttd.desktop
3388 # Create the main Makefile
3389 log 1 "Generating Makefile..."
3390 echo "# Auto-generated file from 'Makefile.in' -- DO NOT EDIT" > Makefile
3391 < $ROOT_DIR/Makefile.in sed "$SRC_REPLACE" >> Makefile
3392 cp $ROOT_DIR/Makefile.bundle.in Makefile.bundle
3393 echo "# Auto-generated file -- DO NOT EDIT" > Makefile.am
3395 # Make the copy of the source-list, so we don't trigger an unwanted recompile
3396 cp $SOURCE_LIST config.cache.source.list
3397 # Add the current directory, so we don't trigger an unwanted recompile
3398 echo "`pwd`" > config.cache.pwd
3399 # Make sure config.cache is OLDER then config.cache.source.list
3403 if [ "$menu_dir" != "" ]; then
3413 # Create the language file
3414 mkdir -p $LANG_OBJS_DIR
3416 log 1 "Generating lang/Makefile..."
3417 echo "# Auto-generated file from 'Makefile.lang.in' -- DO NOT EDIT" > $LANG_OBJS_DIR/Makefile
3418 < $ROOT_DIR/Makefile.lang.in sed "$SRC_REPLACE" >> $LANG_OBJS_DIR/Makefile
3419 echo "DIRS += $LANG_OBJS_DIR" >> Makefile.am
3420 echo "LANG_DIRS += $LANG_OBJS_DIR" >> Makefile.am
3423 generate_settings() {
3428 # Create the language file
3429 mkdir -p $SETTING_OBJS_DIR
3431 log 1 "Generating setting/Makefile..."
3432 echo "# Auto-generated file from 'Makefile.settings.in' -- DO NOT EDIT" > $SETTING_OBJS_DIR/Makefile
3433 < $ROOT_DIR/Makefile.setting.in sed "$SRC_REPLACE" >> $SETTING_OBJS_DIR/Makefile
3434 echo "DIRS += $SETTING_OBJS_DIR" >> Makefile.am
3442 # Create the language file
3443 mkdir -p $GRF_OBJS_DIR
3445 log 1 "Generating grf/Makefile..."
3446 echo "# Auto-generated file from 'Makefile.grf.in' -- DO NOT EDIT" > $GRF_OBJS_DIR/Makefile
3447 < $ROOT_DIR/Makefile.grf.in sed "$SRC_REPLACE" >> $GRF_OBJS_DIR/Makefile
3448 echo "DIRS += $GRF_OBJS_DIR" >> Makefile.am
3451 generate_src_normal() {
3456 # Create the source file
3457 mkdir -p $SRC_OBJS_DIR
3459 log 1 "Generating $2/Makefile..."
3460 echo "# Auto-generated file from 'Makefile.src.in' -- DO NOT EDIT" > $SRC_OBJS_DIR/Makefile
3461 < $ROOT_DIR/Makefile.src.in sed "$SRC_REPLACE" >> $SRC_OBJS_DIR/Makefile
3462 echo "DIRS += $SRC_OBJS_DIR" >> Makefile.am
3463 echo "SRC_DIRS += $SRC_OBJS_DIR" >> Makefile.am
3466 generate_src_osx() {
3467 cc_host_orig="$cc_host"
3468 cxx_host_orig="$cxx_host"
3469 CFLAGS_orig="$CFLAGS"
3470 LDFLAGS_orig="$LDFLAGS"
3472 for type in $enable_universal; do
3474 if [ -n "$osx_sdk_104_path" ]; then
3475 # Use 10.4 SDK for 32-bit targets
3476 CFLAGS="-isysroot $osx_sdk_104_path $CFLAGS_orig"
3477 LDFLAGS="-Wl,-syslibroot,$osx_sdk_104_path $LDFLAGS_orig"
3480 # We don't want to duplicate the x86_64 stuff for each target, so do it once here
3481 if [ "$type" = "ppc64" ] || [ "$type" = "x86_64" ]; then
3482 # 64 bits is always 10.5 or higher. Furthermore it has a non const ICONV
3483 # and they also removed support for QuickTime/QuickDraw
3484 if [ -n "$osx_sdk_path" ]; then
3485 CFLAGS="-isysroot $osx_sdk_path $CFLAGS_orig"
3486 LDFLAGS="-Wl,-syslibroot,$osx_sdk_path $LDFLAGS_orig"
3488 CFLAGS="$CFLAGS -D_SQ64 -DHAVE_NON_CONST_ICONV -DNO_QUICKTIME -UENABLE_COCOA_QUICKDRAW"
3489 LIBS="`echo $LIBS | sed 's/-framework QuickTime//'`"
3494 BASE_SRC_OBJS_DIR="$OBJS_DIR/ppc"
3495 cc_host="$cc_host_orig -arch ppc -mmacosx-version-min=10.3"
3496 cxx_host="$cxx_host_orig -arch ppc -mmacosx-version-min=10.3"
3497 generate_src_normal "[ppc]" "objs/ppc";;
3499 BASE_SRC_OBJS_DIR="$OBJS_DIR/ppc970"
3500 cc_host="$cc_host_orig -arch ppc970 -mmacosx-version-min=10.3 -mcpu=G5 -mpowerpc64 -mtune=970 -mcpu=970 -mpowerpc-gpopt"
3501 cxx_host="$cxx_host_orig -arch ppc970 -mmacosx-version-min=10.3 -mcpu=G5 -mpowerpc64 -mtune=970 -mcpu=970 -mpowerpc-gpopt"
3502 generate_src_normal "[ppc970]" "objs/ppc970";;
3504 BASE_SRC_OBJS_DIR="$OBJS_DIR/i386"
3505 cc_host="$cc_host_orig -arch i386 -mmacosx-version-min=10.4"
3506 cxx_host="$cxx_host_orig -arch i386 -mmacosx-version-min=10.4"
3507 generate_src_normal "[i386]" "objs/i386";;
3509 BASE_SRC_OBJS_DIR="$OBJS_DIR/ppc64"
3510 cc_host="$cc_host_orig -arch ppc64 -mmacosx-version-min=10.5"
3511 cxx_host="$cxx_host_orig -arch ppc64 -mmacosx-version-min=10.5"
3512 generate_src_normal "[ppc64]" "objs/ppc64";;
3514 BASE_SRC_OBJS_DIR="$OBJS_DIR/x86_64"
3515 cc_host="$cc_host_orig -arch x86_64 -mmacosx-version-min=10.5"
3516 cxx_host="$cxx_host_orig -arch x86_64 -mmacosx-version-min=10.5"
3517 generate_src_normal "[x86_64]" "objs/x86_64";;
3518 *) log 1 "Unknown architecture requested for universal build: $type";;
3524 if [ "$os" = "OSX" ] && [ "$enable_universal" != "0" ]; then
3527 generate_src_normal "[SRC]" "objs"
3532 echo "'configure' configures OpenTTD."
3534 echo "Usage: $0 [OPTION]... [VAR=VALUE]..."
3536 echo "To assign environment variables (e.g., CC, CFLAGS...), specify them as"
3537 echo "VAR=VALUE. See below for descriptions of some of the useful variables."
3539 echo "Defaults for the options are specified in brackets."
3541 echo "Configuration:"
3542 echo " -h, --help display this help and exit"
3544 echo "System types:"
3545 echo " --build=BUILD configure for building on BUILD [guessed]"
3546 echo " --host=HOST cross-compile to build programs to run"
3547 echo " on HOST [BUILD]"
3548 echo " --windres=WINDRES the windres to use [HOST-windres]"
3549 echo " --strip=STRIP the strip to use [HOST-strip]"
3550 echo " --awk=AWK the awk to use in configure [awk]"
3551 echo " --lipo=LIPO the lipo to use (OSX ONLY) [HOST-lipo]"
3552 echo " --os=OS the OS we are compiling for [DETECT]"
3553 echo " DETECT/UNIX/OSX/FREEBSD/OPENBSD/NETBSD/"
3554 echo " MORPHOS/HPUX/BEOS/SUNOS/CYGWIN/MINGW/OS2/"
3555 echo " DOS/WINCE/PSP/HAIKU"
3556 echo " --endian=ENDIAN set the endian of the HOST (AUTO/LE/BE)"
3559 echo " --prefix-dir=dir specifies the prefix for all installed"
3560 echo " files [/usr/local]"
3561 echo " --binary-dir=dir location of the binary. Will be prefixed"
3562 echo " with the prefix-dir [games]"
3563 echo " --data-dir=dir location of data files (lang, data, gm)."
3564 echo " Will be prefixed with the prefix-dir"
3565 echo " [share/games/openttd]"
3566 echo " --doc-dir=dir location of the doc files"
3567 echo " Will be prefixed with the prefix-dir"
3569 echo " --icon-dir=dir location of icons. Will be prefixed"
3570 echo " with the prefix-dir [share/pixmaps]"
3571 echo " --icon-theme-dir=dir location of icon theme."
3572 echo " Will be prefixed with the prefix-dir"
3573 echo " and postfixed with size-dirs [$icon_theme_dir]"
3574 echo " --man-dir=dir location of the manual page (UNIX only)"
3575 echo " Will be prefixed with the prefix-dir"
3577 echo " --menu-dir=dir location of the menu item. (UNIX only, except OSX)"
3578 echo " Will be prefixed with the prefix-dir"
3579 echo " [share/applications]"
3580 echo " --personal-dir=dir location of the personal directory"
3581 echo " [os-dependent default]"
3582 echo " --shared-dir=dir location of shared data files"
3583 echo " [os-dependent default]"
3584 echo " --install-dir=dir specifies the root to install to."
3585 echo " Useful to install into jails [/]"
3586 echo " --binary-name the name used for the binary, icons,"
3587 echo " desktop file, etc. when installing [openttd]"
3589 echo "Features and packages:"
3590 echo " --enable-debug[=LVL] enable debug-mode (LVL=[0123], 0 is release)"
3591 echo " --enable-desync-debug=[LVL] enable desync debug options (LVL=[012], 0 is none"
3592 echo " --enable-profiling enables profiling"
3593 echo " --enable-lto enables GCC's Link Time Optimization (LTO)/ICC's"
3594 echo " Interprocedural Optimization if available"
3595 echo " --enable-dedicated compile a dedicated server (without video)"
3596 echo " --enable-static enable static compile (doesn't work for"
3598 echo " --enable-translator enable extra output for translators"
3599 echo " --enable-universal[=ARCH] enable universal builds (OSX ONLY). Allowed is any combination"
3600 echo " of architectures: i386 ppc ppc970 ppc64 x86_64"
3601 echo " Default architectures are: i386 ppc"
3602 echo " --enable-osx-g5 enables optimizations for ppc970 (G5) (OSX ONLY)"
3603 echo " --disable-cocoa-quartz disable the quartz window mode driver for Cocoa (OSX ONLY)"
3604 echo " --disable-cocoa-quickdraw disable the quickdraw window mode driver for Cocoa (OSX ONLY)"
3605 echo " --disable-unicode disable unicode support to build win9x"
3606 echo " version (Win32 ONLY)"
3607 echo " --enable-console compile as a console application instead of as a GUI application."
3608 echo " If this setting is active, debug output will appear in the same"
3609 echo " console instead of opening a new window. (Win32 ONLY)"
3610 echo " --disable-network disable network support"
3611 echo " --disable-assert disable asserts (continue on errors)"
3612 echo " --enable-strip enable any possible stripping"
3613 echo " --without-osx-sysroot disable the automatic adding of sysroot "
3615 echo " --without-application-bundle disable generation of application bundle"
3617 echo " --without-menu-entry Don't generate a menu item (Freedesktop based only)"
3618 echo " --menu-group=group Category in which the menu item will be placed (Freedesktop based only)"
3619 echo " --menu-name=name Name of the menu item when placed [OpenTTD]"
3620 echo " --with-direct-music enable direct music support (Win32 ONLY)"
3621 echo " --with-sort=sort define a non-default location for sort"
3622 echo " --with-midi=midi define which midi-player to use"
3623 echo " --with-midi-arg=arg define which args to use for the"
3625 echo " --with-libtimidity enables libtimidity support"
3626 echo " --with-allegro[=allegro-config]"
3627 echo " enables Allegro video driver support"
3628 echo " --with-cocoa enables COCOA video driver (OSX ONLY)"
3629 echo " --with-sdl[=sdl-config] enables SDL video driver support"
3630 echo " --with-zlib[=zlib.a] enables zlib support"
3631 echo " --with-liblzma[=liblzma.a] enables liblzma support"
3632 echo " --with-liblzo2[=liblzo2.a] enables liblzo2 support"
3633 echo " --with-png[=libpng-config] enables libpng support"
3634 echo " --with-freetype[=freetype-config]"
3635 echo " enables libfreetype support"
3636 echo " --with-fontconfig[=pkg-config fontconfig]"
3637 echo " enables fontconfig support"
3638 echo " --with-icu[=icu-config] enables icu (used for right-to-left support)"
3639 echo " --static-icu try to link statically (libsicu instead of"
3640 echo " libicu; can fail as the new name is guessed)"
3641 echo " --with-iconv[=iconv-path] enables iconv support"
3642 echo " --with-psp-config[=psp-config] enables psp-config support (PSP ONLY)"
3643 echo " --disable-builtin-depend disable use of builtin deps finder"
3644 echo " --with-makedepend[=makedepend] enables makedepend support"
3645 echo " --with-ccache enables ccache support"
3646 echo " --with-distcc enables distcc support"
3647 echo " --without-grfcodec disable usage of grfcodec and re-generation of base sets"
3649 echo "Some influential environment variables:"
3650 echo " CC C compiler command"
3651 echo " CXX C++ compiler command"
3652 echo " CFLAGS C compiler flags"
3653 echo " CXXFLAGS C++ compiler flags"
3654 echo " WINDRES windres command"
3655 echo " LDFLAGS linker flags, e.g. -L<lib dir> if you"
3656 echo " have libraries in a nonstandard"
3657 echo " directory <lib dir>"
3658 echo " CFLAGS_BUILD C compiler flags for build time tool generation"
3659 echo " CXXFLAGS_BUILD C++ compiler flags for build time tool generation"
3660 echo " LDFLAGS_BUILD linker flags for build time tool generation"
3662 echo "Use these variables to override the choices made by 'configure' or to help"
3663 echo "it to find libraries and programs with nonstandard names/locations."