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.
32 pkg_config="pkg-config"
36 config_log="config.log"
37 prefix_dir="/usr/local"
39 data_dir="share/games/openttd"
41 icon_dir="share/pixmaps"
52 enable_desync_debug="0"
65 enable_cocoa_quartz="1"
66 enable_cocoa_quickdraw="1"
68 with_application_bundle="1"
78 enable_builtin_depend="1"
144 enable_cocoa_quickdraw
146 with_application_bundle
155 enable_builtin_depend
175 CC CXX CFLAGS CXXFLAGS LDFLAGS CFLAGS_BUILD CXXFLAGS_BUILD LDFLAGS_BUILD"
179 # Walk over all params from the user and override any default settings if
180 # needed. This also handles any invalid option.
182 if [ -n "$prev_p" ]; then
188 optarg=`expr "x$p" : 'x[^=]*=\(.*\)'`
191 --help | -h | -\?) showhelp; exit 0;;
193 --config-log) prev_p="config_log";;
194 --config-log=*) config_log="$optarg";;
196 --build) prev_p="build";;
197 --build=*) build="$optarg";;
199 --host) prev_p="host";;
200 --host=*) host="$optarg";;
203 --os=*) os="$optarg";;
205 --cpu-type) prev_p="cpu_type";;
206 --cpu-type=*) cpu_type="$optarg";;
208 --cc-build) prev_p="cc_build";;
209 --cc-build=*) cc_build="$optarg";;
210 --cc-host) prev_p="cc_host";;
211 --cc-host=*) cc_host="$optarg";;
212 --cxx-build) prev_p="cxx_build";;
213 --cxx-build=*) cxx_build="$optarg";;
214 --cxx-host) prev_p="cxx_host";;
215 --cxx-host=*) cxx_host="$optarg";;
216 --windres) prev_p="windres";;
217 --windres=*) windres="$optarg";;
218 --awk) prev_p="awk";;
219 --awk=*) awk="$optarg";;
220 --pkg-config) prev_p="pkg_config";;
221 --pkg-config=*) pkg_config="$optarg";;
222 --strip) prev_p="strip";;
223 --strip=*) strip="$optarg";;
224 --lipo) prev_p="lipo";;
225 --lipo=*) lipo="$optarg";;
227 --endian) prev_p="endian";;
228 --endian=*) endian="$optarg";;
232 # Alias --prefix with --prefix-dir, for compatibility with GNU autotools
233 --prefix-dir | --prefix) prev_p="prefix_dir";;
234 --prefix-dir=* | --prefix=*) prefix_dir="$optarg";;
236 --binary-dir) prev_p="binary_dir";;
237 --binary-dir=*) binary_dir="$optarg";;
239 --data-dir) prev_p="data_dir";;
240 --data-dir=*) data_dir="$optarg";;
242 --doc-dir) prev_p="doc_dir";;
243 --doc-dir=*) doc_dir="$optarg";;
245 --icon-dir) prev_p="icon_dir";;
246 --icon-dir=*) icon_dir="$optarg";;
248 --icon-theme-dir) prev_p="icon_theme_dir";;
249 --icon-theme-dir=*) icon_theme_dir="$optarg";;
250 --without-icon-theme) icon_theme_dir="";;
252 --menu-dir) prev_p="menu_dir";;
253 --menu-dir=*) menu_dir="$optarg";;
254 --without-menu-entry) menu_dir="";;
256 --menu-name) prev_p="menu_name";;
257 --menu-name=*) menu_name="$optarg";;
259 --binary-name) prev_p="binary_name";;
260 --binary-name=*) binary_name="$optarg";;
262 --man-dir) prev_p="man_dir";;
263 --man-dir=*) man_dir="$optarg";;
265 --personal-dir) prev_p="personal_dir";;
266 --personal-dir=*) personal_dir="$optarg";;
267 --without-personal-dir) personal_dir="";;
269 --shared-dir) prev_p="shared_dir";;
270 --shared-dir=*) shared_dir="$optarg";;
271 --without-shared-dir) shared_dir="";;
273 --install-dir) prev_p="install_dir";;
274 --install-dir=*) install_dir="$optarg";;
278 --menu-group) prev_p="menu_group";;
279 --menu-group=*) menu_group="$optarg";;
283 --enable-debug) enable_debug="1";;
284 --enable-debug=*) enable_debug="$optarg";;
285 --enable-desync-debug) enable_desync_debug="1";;
286 --enable-desync-debug=*) enable_desync_debug="$optarg";;
287 --enable-profiling) enable_profiling="1";;
288 --enable-profiling=*) enable_profiling="$optarg";;
289 --enable-lto) enable_lto="1";;
290 --enable-lto=*) enable_lto="$optarg";;
291 --enable-ipo) enable_lto="1";;
292 --enable-ipo=*) enable_lto="$optarg";;
293 --enable-dedicated) enable_dedicated="1";;
294 --enable-dedicated=*) enable_dedicated="$optarg";;
295 --enable-network) enable_network="2";;
296 --enable-network=*) enable_network="$optarg";;
297 --disable-network) enable_network="0";;
298 --disable-static) enable_static="0";;
299 --enable-static) enable_static="2";;
300 --enable-static=*) enable_static="$optarg";;
301 --disable-translator) enable_translator="0";;
302 --enable-translator) enable_translator="2";;
303 --enable-translator=*) enable_translator="$optarg";;
304 --disable-assert) enable_assert="0";;
305 --enable-assert) enable_assert="2";;
306 --enable-assert=*) enable_assert="$optarg";;
307 --disable-strip) enable_strip="0";;
308 --enable-strip) enable_strip="2";;
309 --enable-strip=*) enable_strip="$optarg";;
310 --disable-universal) enable_universal="0";;
311 --enable-universal) enable_universal="i386 ppc";;
312 --enable-universal=*) enable_universal="$optarg";;
313 --disable-osx-g5) enable_osx_g5="0";;
314 --enable-osx-g5) enable_osx_g5="2";;
315 --enable-osx-g5=*) enable_osx_g5="$optarg";;
316 --disable-unicode) enable_unicode="0";;
317 --enable-unicode) enable_unicode="2";;
318 --enable-unicode=*) enable_unicode="$optarg";;
319 --disable-console) enable_console="0";;
320 --enable-console) enable_console="2";;
321 --enable-console=*) enable_console="$optarg";;
323 --disable-cocoa-quartz) enable_cocoa_quartz="0";;
324 --enable-cocoa-quartz) enable_cocoa_quartz="2";;
325 --enable-cocoa-quartz=*) enable_cocoa_quartz="$optarg";;
326 --disable-cocoa-quickdraw) enable_cocoa_quickdraw="0";;
327 --enable-cocoa-quickdraw) enable_cocoa_quickdraw="2";;
328 --enable-cocoa-quickdraw=*) enable_cocoa_quickdraw="$optarg";;
330 --with-allegro) with_allegro="2";;
331 --without-allegro) with_allegro="0";;
332 --with-allegro=*) with_allegro="$optarg";;
334 --with-sdl) with_sdl="2";;
335 --without-sdl) with_sdl="0";;
336 --with-sdl=*) with_sdl="$optarg";;
338 --with-cocoa) with_cocoa="2";;
339 --without-cocoa) with_cocoa="0";;
340 --with-cocoa=*) with_cocoa="$optarg";;
342 --with-zlib) with_zlib="2";;
343 --without-zlib) with_zlib="0";;
344 --with-zlib=*) with_zlib="$optarg";;
346 --with-lzma) with_lzma="2";;
347 --without-lzma) with_lzma="0";;
348 --with-lzma=*) with_lzma="$optarg";;
349 --with-liblzma) with_lzma="2";;
350 --without-liblzma) with_lzma="0";;
351 --with-liblzma=*) with_lzma="$optarg";;
353 --with-lzo2) with_lzo2="2";;
354 --without-lzo2) with_lzo2="0";;
355 --with-lzo2=*) with_lzo2="$optarg";;
356 --with-liblzo2) with_lzo2="2";;
357 --without-liblzo2) with_lzo2="0";;
358 --with-liblzo2=*) with_lzo2="$optarg";;
360 --with-xdg-basedir) with_xdg_basedir="2";;
361 --without-xdg-basedir) with_xdg_basedir="0";;
362 --with-xdg-basedir=*) with_xdg_basedir="$optarg";;
363 --with-libxdg-basedir) with_xdg_basedir="2";;
364 --without-libxdg-basedir) with_xdg_basedir="0";;
365 --with-libxdg-basedir=*) with_xdg_basedir="$optarg";;
367 --with-png) with_png="2";;
368 --without-png) with_png="0";;
369 --with-png=*) with_png="$optarg";;
370 --with-libpng) with_png="2";;
371 --without-libpng) with_png="0";;
372 --with-libpng=*) with_png="$optarg";;
374 --with-libtimidity) with_libtimidity="2";;
375 --without-libtimidity) with_libtimidity="0";;
376 --with-libtimidity=*) with_libtimidity="$optarg";;
378 --with-freetype) with_freetype="2";;
379 --without-freetype) with_freetype="0";;
380 --with-freetype=*) with_freetype="$optarg";;
381 --with-libfreetype) with_freetype="2";;
382 --without-libfreetype) with_freetype="0";;
383 --with-libfreetype=*) with_freetype="$optarg";;
385 --with-fontconfig) with_fontconfig="2";;
386 --without-fontconfig) with_fontconfig="0";;
387 --with-fontconfig=*) with_fontconfig="$optarg";;
388 --with-libfontconfig) with_fontconfig="2";;
389 --without-libfontconfig) with_fontconfig="0";;
390 --with-libfontconfig=*) with_fontconfig="$optarg";;
392 --with-icu) with_icu_layout="2";with_icu_sort="2";;
393 --without-icu) with_icu_layout="0";with_icu_sort="0";;
394 --with-icu=*) with_icu_layout="$optarg";with_icu_sort="$optarg";;
395 --with-libicu) with_icu_layout="2";with_icu_sort="2";;
396 --without-libicu) with_icu_layout="0";with_icu_sort="0";;
397 --with-libicu=*) with_icu_layout="$optarg";with_icu_sort="$optarg";;
398 --with-icu-layout) with_icu_layout="2";;
399 --without-icu-layout) with_icu_layout="0";;
400 --with-icu-layout=*) with_icu_layout="$optarg";;
401 --with-icu-sort) with_icu_sort="2";;
402 --without-icu-sort) with_icu_sort="0";;
403 --with-icu-sort=*) with_icu_sort="$optarg";;
404 --static-icu) static_icu="1";;
405 --static-icu=*) static_icu="$optarg";;
406 --static-libicu) static_icu="1";;
407 --static-libicu=*) static_icu="$optarg";;
409 --with-psp-config) with_psp_config="2";;
410 --without-psp-config) with_psp_config="0";;
411 --with-psp-config=*) with_psp_config="$optarg";;
413 --disable-builtin-depend) enable_builtin_depend="0";;
414 --enable-builtin-depend) enable_builtin_depend="2";;
415 --enable-builtin-depend=*) enable_builtin_depend="$optarg";;
417 --with-makedepend) with_makedepend="2";;
418 --without-makedepend) with_makedepend="0";;
419 --with-makedepend=*) with_makedepend="$optarg";;
421 --with-direct-music) with_direct_music="2";;
422 --without-direct-music) with_direct_music="0";;
423 --with-direct-music=*) with_direct_music="$optarg";;
425 --with-sort) with_sort="2";;
426 --without-sort) with_sort="0";;
427 --with-sort=*) with_sort="$optarg";;
429 --with-iconv) with_iconv="2";;
430 --without-iconv) with_iconv="0";;
431 --with-iconv=*) with_iconv="$optarg";;
433 --with-midi=*) with_midi="$optarg";;
434 --with-midi-arg=*) with_midi_arg="$optarg";;
436 --without-distcc) with_distcc="0";;
437 --with-distcc) with_distcc="2";;
438 --with-distcc=*) with_distcc="$optarg";;
440 --without-ccache) with_ccache="0";;
441 --with-ccache) with_ccache="2";;
442 --with-ccache=*) with_ccache="$optarg";;
444 --without-nforenum) with_nforenum="0";;
445 --with-nforenum) with_nforenum="2";;
446 --with-nforenum=*) with_nforenum="$optarg";;
448 --without-grfcodec) with_grfcodec="0";;
449 --with-grfcodec) with_grfcodec="2";;
450 --with-grfcodec=*) with_grfcodec="$optarg";;
452 --without-osx-sysroot) with_osx_sysroot="0";;
453 --with-osx-sysroot) with_osx_sysroot="2";;
454 --with-osx-sysroot=*) with_osx_sysroot="$optarg";;
456 --without-application-bundle) with_application_bundle="0";;
457 --with-application-bundle) with_application_bundle="1";;
458 --with-application-bundle=*) with_application_bundle="$optarg";;
460 --without-threads) with_threads="0";;
461 --with-threads) with_threads="1";;
462 --with-threads=*) with_threads="$optarg";;
464 --without-sse) with_sse="0";;
465 --with-sse) with_sse="1";;
466 --with-sse=*) with_sse="$optarg";;
468 CC=* | --CC=*) CC="$optarg";;
469 CXX=* | --CXX=*) CXX="$optarg";;
470 CFLAGS=* | --CFLAGS=*) CFLAGS="$optarg";;
471 CXXFLAGS=* | --CXXFLAGS=*) CXXFLAGS="$optarg";;
472 LDFLAGS=* | --LDFLAGS=*) LDFLAGS="$optarg";;
473 CFLAGS_BUILD=* | --CFLAGS_BUILD=* | --CFLAGS-BUILD=*) CFLAGS_BUILD="$optarg";;
474 CXXFLAGS_BUILD=* | --CXXFLAGS_BUILD=* | --CXXFLAGS-BUILD=*) CXXFLAGS_BUILD="$optarg";;
475 LDFLAGS_BUILD=* | --LDFLAGS_BUILD=* | --LDFLAGS-BUILD=*) LDFLAGS_BUILD="$optarg";;
477 --ignore-extra-parameters) ignore_extra_parameters="1";;
480 if [ "$ignore_extra_parameters" = "0" ]; then
481 log 1 "Unknown option $p"
484 log 1 "Unknown option $p ignored"
490 if [ -n "$prev_p" ]; then
491 log 1 "configure: error: missing argument to --$prev_p"
496 echo "" > $config_log
497 log 2 "Invocation: $0 $*"
501 # Here we save all params, so we can later on do an exact redo of this
502 # configuration, without having the user to re-input stuff
504 echo "Running configure with following options:" >> $config_log
505 echo "" >> $config_log
507 configure="$CONFIGURE_EXECUTABLE --ignore-extra-parameters"
508 for p in $save_params_array; do
510 p=`echo "$p" | sed 's@_@-@g;s@\n@@g;s@ @\\ @g'`
511 # Only save those params that aren't empty
512 configure="$configure --$p=\"$v\""
515 echo "$configure" >> $config_log
516 echo "$configure" > config.cache
517 echo "" >> $config_log
521 # Some params want to be in full uppercase, else they might not work as
522 # expected.. fix that here
524 endian=`echo $endian | tr '[a-z]' '[A-Z]'`
525 os=`echo $os | tr '[a-z]' '[A-Z]'`
526 cpu_type=`echo $cpu_type | tr '[a-z]' '[A-Z]'`
528 # Check if all params have valid values
530 # Endian only allows AUTO, LE and, BE
531 if ! echo $endian | egrep -q '^(AUTO|LE|BE|PREPROCESSOR)$'; then
532 log 1 "configure: error: invalid option --endian=$endian"
533 log 1 " Available options are: --endian=[AUTO|LE|BE]"
536 if [ "$endian" = "PREPROCESSOR" ] && [ "$os" != "OSX" ]; then
537 log 1 "configure: error: invalid option --endian=$endian"
538 log 1 " PREPROCESSOR is only available for OSX"
541 # OS only allows DETECT, UNIX, OSX, FREEBSD, DRAGONFLY, OPENBSD, NETBSD, MORPHOS, BEOS, HAIKU, SUNOS, CYGWIN, MINGW, OS2, DOS, WINCE, and PSP
542 if ! echo $os | egrep -q '^(DETECT|UNIX|OSX|FREEBSD|DRAGONFLY|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|HAIKU|SUNOS|CYGWIN|MINGW|OS2|DOS|WINCE|PSP)$'; then
543 log 1 "configure: error: invalid option --os=$os"
544 log 1 " Available options are: --os=[DETECT|UNIX|OSX|FREEBSD|DRAGONFLY|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|HAIKU|SUNOS|CYGWIN|MINGW|OS2|DOS|WINCE|PSP]"
547 # cpu_type can be either 32 or 64
548 if ! echo $cpu_type | egrep -q '^(32|64|DETECT)$'; then
549 log 1 "configure: error: invalid option --cpu-type=$cpu_type"
550 log 1 " Available options are: --cpu-type[=DETECT|32|64]"
553 # enable_debug should be between 0 and 4
554 if ! echo $enable_debug | egrep -q '^[0123]$'; then
555 log 1 "configure: error: invalid option --enable-debug=$enable_debug"
556 log 1 " Available options are: --enable-debug[=0123]"
560 # enable_desync_debug should be between 0 and 3
561 if ! echo $enable_desync_debug | egrep -q '^[012]$'; then
562 log 1 "configure: error: invalid option --enable-desync-debug=$enable_desync_debug"
563 log 1 " Available options are: --enable-desync-debug[=012]"
574 # Check for universal builds; they only make sense for OSX, so fail if enabled for another OS
575 if [ "$enable_universal" = "0" ]; then
576 log 1 "checking universal build... no"
578 if [ "$os" != "OSX" ]; then
579 log 1 "configure: error: --enable-universal only works on OSX"
582 log 1 "checking universal build... yes, for: $enable_universal"
585 # Already detected by check_build
586 log 1 "checking build cc... $cc_build"
587 log 1 "checking host cc... $cc_host"
592 if [ "$enable_strip" != "0" ]; then
595 log 1 "checking strip... disabled"
599 if [ "$enable_builtin_depend" != "0" ]; then
600 log 1 "checking builtin depend... yes"
601 makedepend="\$(SRC_OBJS_DIR)/\$(DEPEND)"
603 log 1 "checking builtin depend... no"
608 detect_sse_capable_architecture
610 if [ "$enable_static" = "1" ]; then
611 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "MORPHOS" ] || [ "$os" = "DOS" ]; then
618 if [ "$enable_static" != "0" ]; then
619 log 1 "checking static... yes"
621 if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "OSX" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "DOS" ]; then
622 log 1 "WARNING: static is only known to work on Windows, DOS, MacOSX and MorphOS"
623 log 1 "WARNING: use static at your own risk on this platform"
628 log 1 "checking static... no"
631 if [ "$enable_unicode" = "1" ]; then
632 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "DOS" ]; then
639 if [ "$enable_unicode" != "0" ]; then
640 log 1 "checking unicode... yes"
642 log 1 "checking unicode... no"
645 # Show what we configured
646 if [ "$enable_debug" = "0" ]; then
647 log 1 "using debug level... no"
648 elif [ "$enable_profiling" != "0" ]; then
649 log 1 "using debug level... profiling (debug level $enable_debug)"
651 log 1 "using debug level... level $enable_debug"
654 if [ "$enable_desync_debug" = "0" ]; then
655 log 1 "using desync debug level... no"
657 log 1 "using desync debug level... level $enable_desync_debug"
658 log 1 "WARNING: desync debug functions slow down the game considerably."
659 log 1 "WARNING: use only when you are instructed to do so"
660 log 1 " or when you know what you are doing."
665 if [ "$enable_lto" != "0" ]; then
666 # GCC 4.5 outputs '%{flto}', GCC 4.6 outputs '%{flto*}'
667 if $cxx_build -dumpspecs 2>&1 | grep -q '\%{flto' || $cxx_build -help ipo 2>&1 | grep -q '\-ipo'; then
668 log 1 "using link time optimization... yes"
671 log 1 "using link time optimization... no"
672 log 1 "WARNING: you selected link time optimization but it is not found."
676 log 1 "using link time optimization... no"
680 if [ "$os" != "OSX" ] && [ "$with_osx_sysroot" != "0" ]; then
681 if [ "$with_osx_sysroot" = "1" ]; then
684 log 1 "checking OSX sysroot... not OSX, skipping"
686 log 1 "configure: error: --with-osx-sysroot only works if OSX is the target"
691 if [ "$with_osx_sysroot" != "0" ]; then
692 if [ "$enable_universal" = "0" ] && [ "$with_osx_sysroot" != "1" ] && [ "$with_osx_sysroot" != "2" ]; then
693 # Sysroot manually specified? Check for usability
694 log 1 "checking OSX sysroot... $with_osx_sysroot"
695 if ! check_osx_sdk "$with_osx_sysroot"; then
696 log 1 "Passed sysroot not found/not functional"
700 # If autodetect and no universal, use system default
701 if [ "$with_osx_sysroot" = "1" ] && [ "$enable_universal" = "0" ]; then
702 log 1 "checking OSX sysroot... no (use system default)"
704 log 1 "checking OSX sysroot... automatically"
709 if [ -n "$osx_sdk_path" ]; then
710 if [ "$enable_universal" != "0" ]; then
711 if [ -z "$osx_sdk_104_path" ]; then
712 log 1 "WARNING: Could not find a usable 10.4u SDK, the resulting"
713 log 1 "WARNING: binary will only run on OSX 10.5 or later"
714 osx_sdk_104_path="$osx_sdk_path"
716 OSX_SYSROOT="-isysroot $osx_sdk_104_path"
717 OSX_LD_SYSROOT="-Wl,-syslibroot,$osx_sdk_104_path"
719 OSX_SYSROOT="-isysroot $osx_sdk_path"
720 OSX_LD_SYSROOT="-Wl,-syslibroot,$osx_sdk_path"
724 if [ "$os" = "OSX" ]; then
725 log 1 "checking OSX sysroot... no (use system default)"
733 if [ "$enable_dedicated" != "0" ]; then
734 log 1 "checking GDI video driver... dedicated server, skipping"
735 log 1 "checking dedicated... found"
737 if [ "$enable_network" = "0" ]; then
738 log 1 "configure: error: building a dedicated server without network support is pointless"
742 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ]; then
743 log 1 "checking GDI video driver... found"
745 log 1 "checking GDI video driver... not Windows, skipping"
748 if [ -z "$allegro_config" ] && [ -z "$sdl_config" ] && [ "$with_cocoa" = 0 ] && [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "WINCE" ]; then
749 log 1 "configure: error: no video driver development files found"
750 log 1 " If you want a dedicated server use --enable-dedicated as parameter"
753 log 1 "checking dedicated... not selected"
757 if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then
758 log 1 "checking console application... not Windows, skipping"
759 elif [ "$enable_console" = "1" ] && [ "$enable_dedicated" != "0" ]; then
760 log 1 "checking console application... dedicated server, enabled"
762 elif [ "$enable_console" = "1" ]; then
763 log 1 "checking console application... disabled (only used when forced)"
765 elif [ "$enable_console" = "0" ]; then
766 log 1 "checking console application... disabled"
768 log 1 "checking console application... enabled"
771 if [ "$enable_network" = "1" ] && [ "$os" = "DOS" ]; then
772 log 1 "checking network... DOS, skipping"
774 elif [ "$enable_network" != "0" ]; then
775 log 1 "checking network... found"
777 log 1 "checking network... disabled"
780 log 1 "checking squirrel... found"
781 SCRIPT_SRC_DIR="$ROOT_DIR/src/3rdparty/squirrel/include"
783 if [ "$enable_translator" != "0" ]; then
784 log 1 "checking translator... debug"
785 # -t shows TODO items, normally they are muted
788 log 1 "checking translator... no"
792 if [ "$enable_assert" != "0" ]; then
793 log 1 "checking assert... enabled"
795 log 1 "checking assert... disabled"
798 pre_detect_with_zlib=$with_zlib
801 if [ "$with_zlib" = "0" ] || [ -z "$zlib-config" ]; then
802 log 1 "WARNING: zlib was not detected or disabled"
803 log 1 "WARNING: OpenTTD doesn't require zlib, but it does mean that many features"
804 log 1 "WARNING: (like loading most old savegames/scenarios, loading heightmaps,"
805 log 1 "WARNING: using PNG, or using fonts, ...) will be disabled."
806 if [ "$pre_detect_with_zlib" = "0" ]; then
807 log 1 "WARNING: We strongly suggest you to install zlib."
809 log 1 "configure: error: no zlib detected"
810 log 1 " If you want to compile without zlib use --without-zlib as parameter"
815 pre_detect_with_lzma=$with_lzma
818 if [ "$with_lzma" = "0" ] || [ -z "$lzma_config" ]; then
819 log 1 "WARNING: lzma was not detected or disabled"
820 log 1 "WARNING: OpenTTD doesn't require lzma, but it does mean that many features"
821 log 1 "WARNING: (like loading most savegames/scenarios and joining most servers)"
822 log 1 "WARNING: will be disabled."
823 if [ "$pre_detect_with_lzma" = "0" ]; then
824 log 1 "WARNING: We strongly suggest you to install liblzma."
825 log 1 "configure: error: no liblzma detected"
827 log 1 " If you want to compile without lzma use --without-lzma as parameter"
832 pre_detect_with_lzo2=$with_lzo2
835 if [ "$with_lzo2" = "0" ] || [ -z "$lzo2" ]; then
836 log 1 "WARNING: liblzo2 was not detected or disabled"
837 log 1 "WARNING: OpenTTD doesn't require liblzo2, but it does mean that"
838 log 1 "WARNING: loading old savegames/scenarios will be disabled."
839 if [ "$pre_detect_with_lzo2" = "0" ]; then
840 log 1 "WARNING: We strongly suggest you to install liblzo2."
842 log 1 "configure: error: no liblzo2 detected"
843 log 1 " If you want to compile without liblzo2 use --without-liblzo2 as parameter"
857 if [ "$with_direct_music" != "0" ]; then
858 if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then
859 if [ "$with_direct_music" != "1" ]; then
860 log 1 "configure: error: direct-music is only supported on Win32 targets"
863 with_direct_music="0"
865 log 1 "checking direct-music... not Windows, skipping"
873 if [ "$os" = "OSX" ] && [ "$endian" = "AUTO" ]; then
874 endian="PREPROCESSOR"
877 log 1 "checking endianness... $endian"
879 # Suppress language errors when there is a version defined, indicating a release
880 # It just isn't pretty if any release produces warnings in the languages.
881 if [ -f "$ROOT_DIR/version" ]; then
883 log 1 "suppress language errors... yes"
886 log 1 "suppress language errors... no"
889 if [ "$enable_debug" = "0" ] && [ "$enable_profiling" = "0" ] && [ "$enable_strip" != "0" ]; then
890 if [ "$os" = "MORPHOS" ]; then
891 strip_arg="--strip-all --strip-unneeded --remove-section .comment"
892 elif [ "$os" = "OSX" ]; then
894 elif [ "$os" = "OS2" ]; then
896 # OS2 uses strip via gcc, because it needs to be feed to emxbind
897 LDFLAGS="$LDFLAGS -s"
898 elif [ "$os" = "SUNOS" ]; then
899 # The GNU strip does know -s, the non-GNU doesn't
900 # So try to detect it (in a bit of an ugly way)
901 strip_arg="`$strip -s strip.test 2>/dev/null && echo \"-s\"`"
906 log 1 "checking stripping... $strip $strip_arg"
909 log 1 "checking stripping... skipped"
912 if [ "$with_distcc" = "0" ]; then
913 log 1 "checking distcc... no"
914 elif [ "$with_distcc" = "1" ]; then
917 log 1 "checking distcc... no (only used when forced)"
918 elif [ "$with_distcc" = "2" ]; then
921 distcc="$with_distcc"
923 if [ "$with_distcc" != "0" ]; then
924 res="`$distcc --version 2>/dev/null | head -n 1 | cut -b 1-6`"
925 if [ "$res" != "distcc" ]; then
927 log 1 "checking distcc... no"
928 if [ "$with_distcc" = "2" ]; then
929 log 1 "configure: error: no distcc detected, but was forced to be used"
932 if [ "$with_distcc" != "1" ]; then
933 log 1 "configure: error: '$with_distcc' doesn't seem a distcc to me"
938 log 1 "checking distcc... $distcc"
941 if [ "$with_ccache" = "0" ]; then
942 log 1 "checking ccache... no"
943 elif [ "$with_ccache" = "1" ]; then
946 log 1 "checking ccache... no (only used when forced)"
947 elif [ "$with_ccache" = "2" ]; then
950 ccache="$with_ccache"
952 if [ "$with_ccache" != "0" ]; then
953 res="`$ccache --version 2>/dev/null | head -n 1 | cut -b 1-6`"
954 if [ "$res" != "ccache" ]; then
956 log 1 "checking ccache... no"
957 if [ "$with_ccache" = "2" ]; then
958 log 1 "configure: error: no ccache detected, but was forced to be used"
961 if [ "$with_ccache" != "1" ]; then
962 log 1 "configure: error: '$with_ccache' doesn't seem a ccache to me"
967 log 1 "checking ccache... $ccache"
973 if [ -z "$grfcodec" ] && [ -n "$nforenum" ]; then
974 log 1 "checking nforenum/grfcodec... nforenum needs grfcodec enabled, disabling nforenum"
978 if [ -z "$nforenum" ] && [ -n "$grfcodec" ]; then
979 log 1 "checking nforenum/grfcodec... grfcodec needs nforenum enabled, disabling grfcodec"
983 if [ "$os" = "DOS" ]; then
987 if [ "$os" != "OSX" ] && [ "$with_application_bundle" != "0" ]; then
988 if [ "$with_application_bundle" = "1" ]; then
989 with_application_bundle="0"
991 log 1 "checking OSX application bundle... not OSX, skipping"
993 log 1 "configure: error: --with-application-bundle only works if OSX is the target"
998 if [ "$os" = "OSX" ] && [ "$with_application_bundle" = "1" ]; then
1004 if [ "$os" = "OSX" ]; then
1005 # Test on ppc970 (G5) - we can optimize there
1007 if [ "$enable_osx_g5" != "0" ]; then
1008 log 1 "detecting ppc970 (G5)... yes (forced)"
1010 # First, are we a real OSX system, else we can't detect it
1011 native=`LC_ALL=C uname | tr '[A-Z]' '[a-z]' | grep darwin`
1012 # If $host doesn't match $build , we are cross-compiling
1013 if [ -n "$native" ] && [ "$build" = "$host" ]; then
1014 $cxx_build $SRC_DIR/os/macosx/G5_detector.cpp -o G5_detector
1017 if [ -n "$res" ]; then
1018 # This is G5, add flags for it
1021 log 1 "detecting ppc970 (G5)... yes"
1025 log 1 "detecting ppc970 (G5)... no"
1030 log 1 "detecting ppc970 (G5)... no (cross-compiling)"
1034 if [ "$enable_osx_g5" != "0" ]; then
1035 log 1 "configure: error: ppc970 (OSX G5) selected, but not compiling for OSX"
1036 log 1 "configure: error: either select OSX as OS, or deselect ppc970"
1042 if [ -d "$ROOT_DIR/.svn" ] && [ -n "`svn help 2>/dev/null`" ]; then
1043 log 1 "checking revision... svn detection"
1044 elif [ -d "$ROOT_DIR/../.svn" ] && [ -n "`svn help 2>/dev/null`" ] && LC_ALL=C svn info $ROOT_DIR/.. | grep -q '^URL:.*tags$'; then
1045 # subversion changed its behaviour; now not all folders have a .svn folder,
1046 # but only the root folder. Since making tags requires a (sparse) checkout
1047 # of the tags folder, the folder of the tag does not have a .svn folder
1048 # anymore and this fails to detect the subversion repository checkout.
1049 log 1 "checking revision... svn detection (tag)"
1050 elif [ -e "$ROOT_DIR/.git" ] && [ -n "`git help 2>/dev/null`" ]; then
1051 log 1 "checking revision... git detection"
1052 elif [ -d "$ROOT_DIR/.hg" ] && [ -n "`HGPLAIN= hg help 2>/dev/null`" ]; then
1053 log 1 "checking revision... hg detection"
1054 elif [ -f "$ROOT_DIR/.ottdrev" ]; then
1055 log 1 "checking revision... source tarball"
1057 log 1 "checking revision... no detection"
1058 log 1 "WARNING: there is no means to determine the version."
1059 log 1 "WARNING: please use a subversion, mercurial, or git checkout of OpenTTD."
1060 log 1 "WARNING: you can only join game servers that have been compiled without"
1061 log 1 "WARNING: version detection."
1062 log 1 "WARNING: there is a great chance you desync."
1063 log 1 "WARNING: USE WITH CAUTION!"
1068 if [ "$doc_dir" = "1" ]; then
1069 if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "DRAGONFLY" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ]; then
1070 doc_dir="share/doc/openttd"
1072 doc_dir="$data_dir/docs"
1075 doc_dir="`echo $doc_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1078 if [ "$icon_theme_dir" = "1" ]; then
1079 if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "DRAGONFLY" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ]; then
1080 icon_theme_dir="share/icons/hicolor"
1085 icon_theme_dir="`echo $icon_theme_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1088 if [ "$personal_dir" = "1" ]; then
1089 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ] || [ "$os" = "DOS" ] || [ "$os" = "HAIKU" ]; then
1090 personal_dir="OpenTTD"
1091 elif [ "$os" = "OSX" ]; then
1092 personal_dir="Documents/OpenTTD"
1094 personal_dir=".openttd"
1097 personal_dir="`echo $personal_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1100 if [ "$shared_dir" = "1" ]; then
1101 # we are using default values
1102 if [ "$os" = "OSX" ]; then
1103 shared_dir="/Library/Application\\\\ Support/OpenTTD"
1108 shared_dir="`echo $shared_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1111 if [ "$man_dir" = "1" ]; then
1112 # add manpage on UNIX systems
1113 if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "DRAGONFLY" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ] || [ "$os" = "OSX" ]; then
1114 man_dir="share/man/man6"
1119 man_dir="`echo $man_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1122 if [ "$menu_dir" = "1" ]; then
1123 # add a freedesktop menu item only for some UNIX systems
1124 if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "DRAGONFLY" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ]; then
1125 menu_dir="share/applications"
1130 menu_dir="`echo $menu_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1135 if [ -n "$personal_dir" ]
1137 log 1 "personal home directory... $personal_dir"
1139 log 1 "personal home directory... none"
1142 if [ -n "$shared_dir" ]
1144 log 1 "shared data directory... $shared_dir"
1146 log 1 "shared data directory... none"
1149 if [ -n "$install_dir" ]
1151 log 1 "installation directory... $install_dir"
1153 log 1 "installation directory... none"
1156 if [ -n "$icon_theme_dir" ]
1158 log 1 "icon theme directory... $icon_theme_dir"
1160 log 1 "icon theme directory... none"
1163 if [ -n "$man_dir" ]
1165 log 1 "manual page directory... $man_dir"
1167 log 1 "manual page directory... none"
1170 if [ -n "$menu_dir" ]
1172 log 1 "menu item directory... $menu_dir"
1174 log 1 "menu item directory... none"
1178 make_compiler_cflags() {
1181 # $2 - name of the cflags variable
1182 # $3 - name of the cxxflags variable
1183 # $4 - name of the ldflags variable
1184 # $5 - name of the features variable
1186 eval eval "flags=\\\$$2"
1187 eval eval "cxxflags=\\\$$3"
1188 eval eval "ldflags=\\\$$4"
1189 eval eval "features=\\\$$5"
1191 if [ `basename $1 | cut -c 1-3` = "icc" ]; then
1192 # Enable some things only for certain ICC versions
1193 cc_version=`$1 -dumpversion | cut -c 1-4 | sed s@\\\.@@g`
1195 flags="$flags -rdynamic"
1196 ldflags="$ldflags -rdynamic"
1198 if [ -z "$first_time_icc_check" ]; then
1199 first_time_icc_check=no
1200 if [ $cc_version -lt 90 ]; then
1201 log 1 "WARNING: you seem to be using a very old version of ICC"
1202 log 1 "WARNING: OpenTTD hasn't been tested with this version"
1204 elif [ $cc_version -lt 120 ]; then
1205 log 1 "WARNING: you seem to be using an unsupported ICC version"
1206 log 1 "WARNING: ICC older than 12.0 is known to fail to compile OpenTTD"
1211 flags="$flags -Wall"
1212 # remark #111: statement is unreachable
1213 flags="$flags -wd111"
1214 # remark #181: argument is incompatible with corresponding format string conversion
1215 # ICC is very picky about signedness of operands, warnings provided by GCC are enough
1216 flags="$flags -wd181"
1217 # remark #271: trailing comma is nonstandard
1218 flags="$flags -wd271"
1219 # remark #280: selector expression is constant
1220 flags="$flags -wd280"
1221 # remark #304: access control not specified ("public" by default)
1222 flags="$flags -wd304"
1223 # remark #383: value copied to temporary, reference to temporary used
1224 flags="$flags -wd383"
1225 # remark #444: destructor for base class ... is not virtual
1226 flags="$flags -wd444"
1227 # remark #593: variable ... was set but never used
1228 flags="$flags -wd593"
1229 # warning #654: overloaded virtual function ... is only partially overridden in class ...
1230 flags="$flags -wd654"
1231 # remark #810: conversion from ... to ... may lose significant bits
1232 flags="$flags -wd810"
1233 # remark #869: parameter ... was never referenced
1234 flags="$flags -wd869"
1235 # warning #873: function ... ::operator new ... has no corresponding operator delete ...
1236 flags="$flags -wd873"
1237 # remark #981: operands are evaluated in unspecified order
1238 flags="$flags -wd981"
1239 # remark #1418: external function definition with no prior declaration
1240 flags="$flags -wd1418"
1241 # remark #1419: external declaration in primary source file
1242 flags="$flags -wd1419"
1243 # remark #1572: floating-point equality and inequality
1244 flags="$flags -wd1572"
1245 # remark #1599: declaration hides variable/parameter ...
1246 flags="$flags -wd1599"
1247 # remark #1720: function ... ::operator new ... has no corresponding member operator delete ...
1248 flags="$flags -wd1720"
1250 if [ $cc_version -lt 110 ]; then
1251 # warns about system headers with recent glibc:
1252 # warning #1292: attribute "__nonnull__" ignored
1253 flags="$flags -wd1292"
1256 if [ $cc_version -ge 100 ]; then
1257 # warning #1899: multicharacter character literal (potential portability problem)
1258 flags="$flags -wd1899"
1259 # vec report defaults to telling where it did loop vectorisation, which is not very important
1260 flags="$flags -vec-report=0 "
1263 if [ $cc_version -ge 110 ]; then
1264 # remark #2259: non-pointer conversion from ... to ... may lose significant bits
1265 flags="$flags -wd2259"
1266 # Use c++0x mode so static_assert() is available
1267 cxxflags="$cxxflags -std=c++0x"
1270 if [ "$enable_lto" != "0" ] && $1 -help ipo | grep -q '\-ipo'; then
1271 # Use IPO (only if we see IPO exists and is requested)
1273 features="$features lto"
1275 elif basename $1 | grep -q 'clang'; then
1276 # Enable some things only for certain clang versions
1277 cc_version="`$1 -v 2>&1 | head -n 1 | sed s@[^0-9]@@g | cut -c 1-2`"
1279 # aliasing rules are not held in openttd code
1280 flags="$flags -fno-strict-aliasing"
1282 # -W alone doesn't enable all warnings enabled by -Wall; on the other hand,
1283 # -Weverything enables too many useless warnings that can't be disabled (as of 3.0)
1284 flags="$flags -Wall -W"
1286 # warning: unused parameter '...'
1287 flags="$flags -Wno-unused-parameter"
1289 # warning: expression result unused
1290 flags="$flags -Wno-unused-value"
1292 # warning: multi-character character constant
1293 flags="$flags -Wno-multichar"
1295 # warning: explicitly assigning a variable of type '...' to itself
1296 # it happens when using the FOR_ALL_WINDOWS_FROM_BACK_FROM macro
1297 flags="$flags -Wno-self-assign"
1299 if [ "$cc_version" -lt "30" ]; then
1300 # warning: equality comparison with extraneous parentheses
1301 flags="$flags -Wno-parentheses"
1302 # warning: operands of ? are integers of different signs: 'unsigned int' and 'int'
1303 flags="$flags -Wno-sign-compare"
1306 if [ "$cc_version" -ge "30" ]; then
1307 # warning: equality comparison with extraneous parentheses
1308 # this warning could be useful, but it warns about code in squirrel
1309 flags="$flags -Wno-parentheses-equality"
1312 if [ "$with_ccache" != "0" -o "$with_distcc" != "0" ]; then
1313 # ccache and distcc run separate preprocess and compile passes,
1314 # both are fed with the same CFLAGS. Unfortunately, clang
1315 # complains about -I when compiling preprocessed files:
1316 # "clang: warning: argument unused during compilation: '-I /usr/include'"
1317 flags="$flags -Qunused-arguments"
1320 if [ "$enable_assert" -eq "0" ]; then
1321 # do not warn about unused variables when building without asserts
1322 flags="$flags -Wno-unused-variable"
1325 # rdynamic is used to get useful stack traces from crash reports.
1326 ldflags="$ldflags -rdynamic"
1328 # Enable some things only for certain GCC versions
1329 cc_version=`$1 -dumpversion | cut -c 1,3`
1331 if [ $cc_version -lt 33 ]; then
1332 log 1 "configure: error: gcc older than 3.3 can't compile OpenTTD because of its poor template support"
1336 flags="$flags -Wall -Wno-multichar -Wsign-compare -Wundef"
1337 flags="$flags -Wwrite-strings -Wpointer-arith"
1338 flags="$flags -W -Wno-unused-parameter -Wredundant-decls"
1339 flags="$flags -Wformat=2 -Wformat-security"
1341 if [ $enable_assert -eq 0 ]; then
1342 # Do not warn about unused variables when building without asserts
1343 flags="$flags -Wno-unused-variable"
1344 if [ $cc_version -ge 46 ]; then
1345 # GCC 4.6 gives more warnings, disable them too
1346 flags="$flags -Wno-unused-but-set-variable"
1347 flags="$flags -Wno-unused-but-set-parameter"
1351 if [ $cc_version -ge 34 ]; then
1352 # Warn when a variable is used to initialise itself:
1354 flags="$flags -Winit-self"
1357 if [ $cc_version -ge 40 ]; then
1358 # GCC 4.0+ complains about that we break strict-aliasing.
1359 # On most places we don't see how to fix it, and it doesn't
1360 # break anything. So disable strict-aliasing to make the
1361 # compiler all happy.
1362 flags="$flags -fno-strict-aliasing"
1363 # Warn about casting-out 'const' with regular C-style cast.
1364 # The preferred way is const_cast<>() which doesn't warn.
1365 flags="$flags -Wcast-qual"
1368 if [ $cc_version -ge 42 ]; then
1369 # GCC 4.2+ automatically assumes that signed overflows do
1370 # not occur in signed arithmetics, whereas we are not
1371 # sure that they will not happen. It furthermore complains
1372 # about its own optimized code in some places.
1373 flags="$flags -fno-strict-overflow"
1374 # GCC 4.2 no longer includes -Wnon-virtual-dtor in -Wall.
1375 # Enable it in order to be consistent with older GCC versions.
1376 flags="$flags -Wnon-virtual-dtor"
1379 if [ $cc_version -ge 43 ] && [ $cc_version -lt 60 ]; then
1380 # Use gnu++0x mode so static_assert() is available.
1381 # Don't use c++0x, it breaks mingw (with gcc 4.4.0).
1382 cxxflags="$cxxflags -std=gnu++0x"
1385 if [ $cc_version -eq 45 ]; then
1386 # Prevent optimisation supposing enums are in a range specified by the standard
1387 # For details, see http://gcc.gnu.org/PR43680
1388 flags="$flags -fno-tree-vrp"
1391 if [ $cc_version -ge 47 ]; then
1392 # Disable -Wnarrowing which gives many warnings, such as:
1393 # warning: narrowing conversion of '...' from 'unsigned int' to 'int' inside { } [-Wnarrowing]
1394 # They are valid according to the C++ standard, but useless.
1395 cxxflags="$cxxflags -Wno-narrowing"
1396 # Disable bogus 'attempt to free a non-heap object' warning
1397 flags="$flags -Wno-free-nonheap-object"
1400 if [ $cc_version -ge 60 ]; then
1401 # -flifetime-dse=2 (default since GCC 6) doesn't play
1402 # well with our custom pool item allocator
1403 cxxflags="$cxxflags -flifetime-dse=1 -std=gnu++14"
1406 # GCC 4.5 outputs '%{flto}', GCC 4.6 outputs '%{flto*}'
1407 if [ "$enable_lto" != "0" ] && $1 -dumpspecs | grep -q '\%{flto'; then
1408 # Use LTO only if we see LTO exists and is requested
1409 if [ $cc_version -lt 46 ]; then
1410 flags="$flags -flto"
1412 flags="$flags -flto=jobserver"
1414 ldflags="$ldflags -fwhole-program"
1415 features="$features lto"
1418 if $1 -dumpspecs | grep -q rdynamic; then
1419 # rdynamic is used to get useful stack traces from crash reports.
1420 flags="$flags -rdynamic"
1421 ldflags="$ldflags -rdynamic"
1425 eval "$2=\"$flags\""
1426 eval "$3=\"$cxxflags\""
1427 eval "$4=\"$ldflags\""
1428 eval "$5=\"$features\""
1431 make_cflags_and_ldflags() {
1432 # General CFlags for BUILD
1433 CFLAGS_BUILD="$CFLAGS_BUILD"
1434 # Special CXXFlags for BUILD
1435 CXXFLAGS_BUILD="$CXXFLAGS_BUILD"
1437 LDFLAGS_BUILD="$LDFLAGS_BUILD"
1438 # FEATURES for BUILD (lto)
1440 # General CFlags for HOST
1442 # Special CXXFlags for HOST
1443 CXXFLAGS="$CXXFLAGS"
1444 # Libs to compile. In fact this is just LDFLAGS
1446 # LDFLAGS used for HOST
1448 # FEATURES for HOST (lto)
1451 make_compiler_cflags "$cc_build" "CFLAGS_BUILD" "CXXFLAGS_BUILD" "LDFLAGS_BUILD" "FEATURES_BUILD"
1452 make_compiler_cflags "$cc_host" "CFLAGS" "CXXFLAGS" "LDFLAGS" "FEATURES"
1454 CFLAGS="$CFLAGS -D$os"
1455 CFLAGS_BUILD="$CFLAGS_BUILD -D$os"
1457 if [ "$enable_debug" = "0" ]; then
1458 # No debug, add default stuff
1459 OBJS_SUBDIR="release"
1460 if [ "$os" = "MORPHOS" ]; then
1461 CFLAGS="-I/gg/os-include -noixemul -fstrict-aliasing -fexpensive-optimizations -mcpu=604 -fno-inline -mstring -mmultiple $CFLAGS"
1462 LDFLAGS="$LDFLAGS -noixemul"
1465 if [ "$enable_profiling" = "0" ]; then
1466 # -fomit-frame-pointer and -pg do not go well together (gcc errors they are incompatible)
1467 CFLAGS="-fomit-frame-pointer $CFLAGS"
1469 CFLAGS="-O2 $CFLAGS"
1473 # Each debug level reduces the optimization by a bit
1474 if [ $enable_debug -ge 1 ]; then
1475 CFLAGS="$CFLAGS -g -D_DEBUG"
1476 if [ "$os" = "PSP" ]; then
1477 CFLAGS="$CFLAGS -G0"
1480 if [ $enable_debug -ge 2 ]; then
1481 CFLAGS="$CFLAGS -fno-inline"
1483 if [ $enable_debug -ge 3 ]; then
1484 CFLAGS="$CFLAGS -O0"
1486 CFLAGS="$CFLAGS -O2"
1490 if [ $enable_debug -le 2 ]; then
1491 if basename "$cc_host" | grep -q "gcc"; then
1492 # Define only when compiling with GCC. Some GLIBC versions use GNU
1493 # extensions in a way that breaks build with at least ICC.
1494 # This requires -O1 or more, so debug level 3 (-O0) is excluded.
1495 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
1498 if basename "$cc_build" | grep -q "gcc"; then
1499 # Just add -O1 to the tools needed for building.
1500 CFLAGS_BUILD="$CFLAGS_BUILD -D_FORTIFY_SOURCE=2 -O1"
1504 if [ "$os" = "OSX" ] && [ $cc_version -eq 40 ]; then
1505 # Apple's GCC 4.0 has a compiler bug for x86_64 with (higher) optimization,
1506 # wrongly optimizing ^= in loops. This disables the failing optimisation.
1507 CFLAGS="$CFLAGS -fno-expensive-optimizations"
1510 if [ "$enable_profiling" != "0" ]; then
1511 CFLAGS="$CFLAGS -pg"
1512 LDFLAGS="$LDFLAGS -pg"
1515 if [ "$with_threads" = "0" ]; then
1516 CFLAGS="$CFLAGS -DNO_THREADS"
1518 if [ "$with_sse" = "1" ]; then
1519 CFLAGS="$CFLAGS -DWITH_SSE"
1522 if [ "`echo $1 | cut -c 1-3`" != "icc" ]; then
1523 if [ "$os" = "CYGWIN" ]; then
1524 flags="$flags -mwin32"
1525 LDFLAGS="$LDFLAGS -mwin32"
1527 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
1528 if [ $cc_version -lt 46 ]; then
1529 flags="$flags -mno-cygwin"
1530 LDFLAGS="$LDFLAGS -mno-cygwin"
1533 if [ "$enable_console" != "0" ]; then
1534 LDFLAGS="$LDFLAGS -Wl,--subsystem,console"
1536 LDFLAGS="$LDFLAGS -Wl,--subsystem,windows"
1539 LIBS="$LIBS -lws2_32 -lwinmm -lgdi32 -ldxguid -lole32 -limm32"
1541 if [ $cc_version -ge 44 ]; then
1542 LDFLAGS_BUILD="$LDFLAGS_BUILD -static-libgcc -static-libstdc++"
1544 if [ $cc_version -ge 47 ]; then
1545 CFLAGS="$CFLAGS -mno-ms-bitfields"
1550 if [ "$os" != "CYGWIN" ] && [ "$os" != "HAIKU" ] && [ "$os" != "OPENBSD" ] && [ "$os" != "MINGW" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "OSX" ] && [ "$os" != "DOS" ] && [ "$os" != "WINCE" ] && [ "$os" != "PSP" ] && [ "$os" != "OS2" ]; then
1551 LIBS="$LIBS -lpthread"
1554 if [ "$os" != "CYGWIN" ] && [ "$os" != "HAIKU" ] && [ "$os" != "MINGW" ] && [ "$os" != "DOS" ] && [ "$os" != "WINCE" ]; then
1557 if [ "$os" = "WINCE" ]; then
1558 LIBS="$LIBS -lcoredll -lcorelibc -laygshell -lws2 -e WinMainCRTStartup"
1560 if [ "$os" = "PSP" ]; then
1561 CFLAGS="$CFLAGS -I`$psp_config -p`/include"
1562 LDFLAGS="$LDFLAGS -L`$psp_config -p`/lib"
1564 CFLAGS="$CFLAGS -fno-exceptions -fno-rtti -D_PSP_FW_VERSION=150"
1565 LIBS="$LIBS -D_PSP_FW_VERSION=150 -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -lm"
1568 if [ "$os" = "MORPHOS" ]; then
1569 # -Wstrict-prototypes generates much noise because of system headers
1570 CFLAGS="$CFLAGS -Wno-strict-prototypes"
1573 if [ "$os" = "OPENBSD" ]; then
1574 LIBS="$LIBS -pthread"
1577 if [ "$os" = "OSX" ]; then
1578 LDFLAGS="$LDFLAGS -framework Cocoa"
1580 # Add macports include dir which is not always set a default system dir. This avoids zillions of bogus warnings.
1581 CFLAGS="$CFLAGS -isystem/opt/local/include"
1583 if [ "$enable_dedicated" = "0" ] && ([ "$cpu_type" = "32" ] || [ "$enable_universal" != "0" ]); then
1584 LIBS="$LIBS -framework QuickTime"
1586 CFLAGS="$CFLAGS -DNO_QUICKTIME"
1589 if [ "$enable_universal" = "0" ]; then
1590 # Universal builds set this elsewhere
1591 CFLAGS="$OSX_SYSROOT $CFLAGS"
1592 LDFLAGS="$OSX_LD_SYSROOT $LDFLAGS"
1595 if [ "$enable_universal" = "0" ] && [ $cc_version -gt 40 ]; then
1596 # Only set the min version when not doing an universal build.
1597 # Universal builds set the version elsewhere.
1598 if [ "$cpu_type" = "64" ]; then
1599 CFLAGS="$CFLAGS -mmacosx-version-min=10.5"
1601 gcc_cpu=`$cc_host -dumpmachine`
1602 if [ "`echo $gcc_cpu | cut -c 1-3`" = "ppc" -o "`echo $gcc_cpu | cut -c 1-7`" = "powerpc" ]; then
1603 # PowerPC build can run on 10.3
1604 CFLAGS="$CFLAGS -mmacosx-version-min=10.3"
1606 # Intel is only available starting from 10.4
1607 CFLAGS="$CFLAGS -mmacosx-version-min=10.4"
1613 if [ "$os" = "BEOS" ] || [ "$os" = "HAIKU" ]; then
1614 LIBS="$LIBS -lmidi -lbe"
1617 # Most targets act like UNIX, just with some additions
1618 if [ "$os" = "BEOS" ] || [ "$os" = "HAIKU" ] || [ "$os" = "OSX" ] || [ "$os" = "MORPHOS" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "DRAGONFLY" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ] || [ "$os" = "OS2" ]; then
1619 CFLAGS="$CFLAGS -DUNIX"
1621 # And others like Windows
1622 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ]; then
1623 CFLAGS="$CFLAGS -DWIN"
1626 if [ -n "$allegro_config" ]; then
1627 CFLAGS="$CFLAGS -DWITH_ALLEGRO"
1628 CFLAGS="$CFLAGS `$allegro_config --cflags`"
1629 if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "WINCE" ]; then
1630 if [ "$enable_static" != "0" ]; then
1631 LIBS="$LIBS `$allegro_config --static --libs`"
1633 LIBS="$LIBS `$allegro_config --libs`"
1638 if [ -n "$sdl_config" ]; then
1639 CFLAGS="$CFLAGS -DWITH_SDL"
1640 # SDL must not add _GNU_SOURCE as it breaks many platforms
1641 CFLAGS="$CFLAGS `$sdl_config --cflags | sed 's@-D_GNU_SOURCE[^ ]*@@'`"
1642 if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "WINCE" ]; then
1643 if [ "$enable_static" != "0" ]; then
1644 LIBS="$LIBS `$sdl_config --static-libs`"
1646 LIBS="$LIBS `$sdl_config --libs`"
1651 if [ "$with_cocoa" != "0" ]; then
1652 CFLAGS="$CFLAGS -DWITH_COCOA"
1653 LIBS="$LIBS -F/System/Library/Frameworks -framework Cocoa -framework Carbon -framework AudioUnit -framework AudioToolbox"
1655 if [ "$enable_cocoa_quartz" != "0" ]; then
1656 CFLAGS="$CFLAGS -DENABLE_COCOA_QUARTZ"
1659 if [ "$enable_cocoa_quickdraw" != "0" ]; then
1660 CFLAGS="$CFLAGS -DENABLE_COCOA_QUICKDRAW"
1664 if [ "$with_zlib" != "0" ]; then
1665 CFLAGS="$CFLAGS -DWITH_ZLIB"
1666 CFLAGS="$CFLAGS `$zlib_config --cflags | tr '\n\r' ' '`"
1667 if [ "$enable_static" != "0" ]; then
1668 LIBS="$LIBS `$zlib_config --libs --static | tr '\n\r' ' '`"
1670 LIBS="$LIBS `$zlib_config --libs | tr '\n\r' ' '`"
1674 if [ -n "$lzma_config" ]; then
1675 CFLAGS="$CFLAGS -DWITH_LZMA"
1676 CFLAGS="$CFLAGS `$lzma_config --cflags | tr '\n\r' ' '`"
1678 if [ "$enable_static" != "0" ]; then
1679 CFLAGS="$CFLAGS -DLZMA_API_STATIC"
1680 LIBS="$LIBS `$lzma_config --libs --static | tr '\n\r' ' '`"
1682 LIBS="$LIBS `$lzma_config --libs | tr '\n\r' ' '`"
1686 if [ "$with_lzo2" != "0" ]; then
1687 if [ "$enable_static" != "0" ] && [ "$os" != "OSX" ]; then
1692 CFLAGS="$CFLAGS -DWITH_LZO"
1695 if [ -n "$xdg_basedir_config" ]; then
1696 CFLAGS="$CFLAGS -DWITH_XDG_BASEDIR"
1697 CFLAGS="$CFLAGS `$xdg_basedir_config --cflags | tr '\n\r' ' '`"
1699 if [ "$enable_static" != "0" ]; then
1700 LIBS="$LIBS `$xdg_basedir_config --libs --static | tr '\n\r' ' '`"
1702 LIBS="$LIBS `$xdg_basedir_config --libs | tr '\n\r' ' '`"
1706 # 64bit machines need -D_SQ64
1707 if [ "$cpu_type" = "64" ] && [ "$enable_universal" = "0" ]; then
1708 CFLAGS="$CFLAGS -D_SQ64"
1710 CFLAGS="$CFLAGS -I$SCRIPT_SRC_DIR"
1712 if [ -n "$png_config" ]; then
1713 CFLAGS="$CFLAGS -DWITH_PNG"
1714 CFLAGS="$CFLAGS `$png_config --cflags | tr '\n\r' ' '`"
1716 if [ "$enable_static" != "0" ]; then
1717 LIBS="$LIBS `$png_config --libs --static | tr '\n\r' ' '`"
1719 LIBS="$LIBS `$png_config --libs | tr '\n\r' ' '`"
1723 if [ -n "$fontconfig_config" ]; then
1724 CFLAGS="$CFLAGS -DWITH_FONTCONFIG"
1725 CFLAGS="$CFLAGS `$fontconfig_config --cflags | tr '\n\r' ' '`"
1727 if [ "$enable_static" != "0" ]; then
1728 LIBS="$LIBS `$fontconfig_config --libs --static | tr '\n\r' ' '`"
1730 LIBS="$LIBS `$fontconfig_config --libs | tr '\n\r' ' '`"
1734 if [ -n "$freetype_config" ]; then
1735 CFLAGS="$CFLAGS -DWITH_FREETYPE"
1736 CFLAGS="$CFLAGS `$freetype_config --cflags | tr '\n\r' ' '`"
1738 if [ "$enable_static" != "0" ]; then
1739 LIBS="$LIBS `$freetype_config --libs --static | tr '\n\r' ' '`"
1741 LIBS="$LIBS `$freetype_config --libs | tr '\n\r' ' '`"
1745 if [ -n "$icu_layout_config" ]; then
1746 CFLAGS="$CFLAGS -DWITH_ICU_LAYOUT"
1747 CFLAGS="$CFLAGS `$icu_layout_config --cflags | tr '\n\r' ' '`"
1749 if [ "$static_icu" != "0" ]; then
1750 LIBS="$LIBS `$icu_layout_config --libs --static | tr '\n\r' ' ' | sed s/-licu/-lsicu/g`"
1752 LIBS="$LIBS `$icu_layout_config --libs | tr '\n\r' ' '`"
1756 if [ -n "$icu_sort_config" ]; then
1757 CFLAGS="$CFLAGS -DWITH_ICU_SORT"
1758 CFLAGS="$CFLAGS `$icu_sort_config --cflags | tr '\n\r' ' '`"
1760 if [ "$static_icu" != "0" ]; then
1761 LIBS="$LIBS `$icu_sort_config --libs --static | tr '\n\r' ' ' | sed s/-licu/-lsicu/g`"
1763 LIBS="$LIBS `$icu_sort_config --libs | tr '\n\r' ' '`"
1768 if [ "$with_direct_music" != "0" ]; then
1769 CFLAGS="$CFLAGS -DWIN32_ENABLE_DIRECTMUSIC_SUPPORT"
1770 # GCC 4.0+ doesn't like the DirectX includes (gives tons of
1771 # warnings on it we won't be able to fix). For now just
1772 # suppress those warnings.
1773 if [ $cc_version -ge 40 ]; then
1774 CFLAGS="$CFLAGS -Wno-non-virtual-dtor"
1778 if [ -n "$libtimidity_config" ]; then
1779 CFLAGS="$CFLAGS -DLIBTIMIDITY"
1780 CFLAGS="$CFLAGS `$libtimidity_config --cflags | tr '\n\r' ' '`"
1782 if [ "$enable_static" != "0" ]; then
1783 LIBS="$LIBS `$libtimidity_config --libs --static | tr '\n\r' ' '`"
1785 LIBS="$LIBS `$libtimidity_config --libs | tr '\n\r' ' '`"
1789 if [ "$with_iconv" != "0" ]; then
1790 CFLAGS="$CFLAGS -DWITH_ICONV"
1791 if [ "$link_to_iconv" = "yes" ]; then
1792 LIBS="$LIBS -liconv"
1793 if [ "$with_iconv" != "2" ]; then
1794 CFLAGS="$CFLAGS -I$with_iconv/include"
1795 LIBS="$LIBS -L$with_iconv/lib"
1799 if [ "$os" != "OSX" ] && [ "$have_non_const_iconv" != "no" ]; then
1800 CFLAGS="$CFLAGS -DHAVE_NON_CONST_ICONV"
1804 if [ -n "$with_midi" ]; then
1805 CFLAGS="$CFLAGS -DEXTERNAL_PLAYER=\\\\\"$with_midi\\\\\""
1807 if [ -n "$with_midi_arg" ]; then
1808 CFLAGS="$CFLAGS -DMIDI_ARG=\\\\\"$with_midi_arg\\\\\""
1811 if [ "$enable_dedicated" != "0" ]; then
1812 CFLAGS="$CFLAGS -DDEDICATED"
1815 if [ "$enable_unicode" != "0" ]; then
1816 CFLAGS="$CFLAGS -DUNICODE -D_UNICODE"
1819 if [ "$enable_network" != "0" ]; then
1820 CFLAGS="$CFLAGS -DENABLE_NETWORK"
1822 if [ "$os" = "BEOS" ]; then
1823 LDFLAGS="$LDFLAGS -lbind -lsocket"
1826 if [ "$os" = "HAIKU" ]; then
1827 LDFLAGS="$LDFLAGS -lnetwork"
1830 if [ "$os" = "SUNOS" ]; then
1831 LDFLAGS="$LDFLAGS -lnsl -lsocket"
1835 if [ "$enable_static" != "0" ]; then
1836 # OSX can't handle -static in LDFLAGS
1837 if [ "$os" != "OSX" ]; then
1838 LDFLAGS="$LDFLAGS -static"
1842 if [ "$enable_assert" = "0" ]; then
1843 CFLAGS="$CFLAGS -DNDEBUG"
1844 CFLAGS_BUILD="$CFLAGS_BUILD -DNDEBUG"
1847 if [ "$enable_desync_debug" != "0" ]; then
1848 CFLAGS="$CFLAGS -DRANDOM_DEBUG"
1851 if [ "$enable_osx_g5" != "0" ]; then
1852 CFLAGS="$CFLAGS -mcpu=G5 -mpowerpc64 -mtune=970 -mcpu=970 -mpowerpc-gpopt"
1855 if [ -n "$personal_dir" ]; then
1856 CFLAGS="$CFLAGS -DWITH_PERSONAL_DIR -DPERSONAL_DIR=\\\\\"$personal_dir\\\\\""
1859 if [ -n "$shared_dir" ]; then
1860 CFLAGS="$CFLAGS -DWITH_SHARED_DIR -DSHARED_DIR=\\\\\"$shared_dir\\\\\""
1863 CFLAGS="$CFLAGS -DGLOBAL_DATA_DIR=\\\\\"$prefix_dir/$data_dir\\\\\""
1865 if [ "$enable_lto" != "0" ]; then
1867 if echo "$FEATURES_BUILD" | grep -q "lto"; then
1868 LDFLAGS_BUILD="$LDFLAGS_BUILD $CFLAGS_BUILD $CXXFLAGS_BUILD"
1871 if echo "$FEATURES" | grep -q "lto"; then
1872 LDFLAGS="$LDFLAGS $CFLAGS $CXXFLAGS"
1875 if [ "$lto_warn" != "0" ]; then
1876 log 1 "WARNING: you enabled LTO/IPO, but neither build nor host compiler supports it"
1877 log 1 "WARNING: LTO/IPO has been disabled"
1881 log 1 "using CFLAGS_BUILD... $CFLAGS_BUILD"
1882 log 1 "using CXXFLAGS_BUILD... $CXXFLAGS_BUILD"
1883 log 1 "using LDFLAGS_BUILD... $LDFLAGS_BUILD"
1884 log 1 "using CFLAGS... $CFLAGS"
1885 log 1 "using CXXFLAGS... $CXXFLAGS"
1886 log 1 "using LDFLAGS... $LIBS $LDFLAGS"
1888 # Makedepend doesn't like something like: -isysroot /OSX/blabla
1889 # so convert it to: -isysroot -OSX/blabla. makedepend just ignores
1890 # any - command it doesn't know, so we are pretty save.
1891 # Lovely hackish, not?
1892 # Btw, this almost always comes from outside the configure, so it is
1893 # not something we can control.
1894 # Also make makedepend aware of compiler's built-in defines.
1895 if [ "$with_makedepend" != "0" ] || [ "$enable_builtin_depend" != "0" ]; then
1896 # Append CXXFLAGS possibly containing -std=c++0x
1897 cflags_makedep="`echo | $cxx_host $CXXFLAGS -E -x c++ -dM - | sed 's@.define @-D@g;s@ .*@ @g;s@(.*)@@g' | tr -d '\r\n'`"
1899 # Please escape ALL " within ` because e.g. "" terminates the string in some sh implementations
1900 cflags_makedep="$cflags_makedep `echo \"$CFLAGS\" \"$CXXFLAGS\" | sed 's@ /@ -@g;s@-I[ ]*[^ ]*@@g'`"
1905 if [ "$with_distcc" != "0" ]; then
1906 cc_host="$distcc $cc_host"
1907 cxx_host="$distcc $cxx_host"
1909 log 1 " NOTICE: remind yourself to use 'make -jN' to make use of distcc"
1913 if [ "$with_ccache" != "0" ]; then
1914 cc_host="$ccache $cc_host"
1915 cxx_host="$ccache $cxx_host"
1921 # $1 - Type for message (build / host)
1922 # $2 - What to fill with the found compiler
1923 # $3 - System to try
1924 # $4 - Compiler to try
1925 # $5 - Env-setting to try
1926 # $6 - GCC alike to try
1927 # $7 - CC alike to try
1928 # $8 - "0" gcc, "1" g++, "2" windres, "3" strip, "4" lipo
1929 # $9 - What the command is to check for
1931 if [ -n "$3" ]; then
1933 if [ -z "$6" ]; then
1938 machine=`eval $compiler $9 2>/dev/null`
1940 eval "$2=\"$compiler\""
1942 log 2 "executing $compiler $9"
1943 log 2 " returned $machine"
1944 log 2 " exit code $ret"
1946 if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ]; then
1947 if [ -z "$5" ]; then
1948 log 1 "checking $1... $compiler not found"
1949 log 1 "I couldn't detect any $6 binary for $3"
1954 machine=`eval $compiler $9 2>/dev/null`
1956 eval "$2=\"$compiler\""
1958 log 2 "executing $compiler $9"
1959 log 2 " returned $machine"
1960 log 2 " exit code $ret"
1962 if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ]; then
1963 log 1 "checking $1... $compiler not found"
1964 log 1 "I couldn't detect any $5 binary for $3"
1969 if [ "$machine" != "$3" ] && ( [ "$8" = "0" ] || [ "$8" = "1" ] ); then
1970 log 1 "checking $1... expected $3, found $machine"
1971 log 1 "the compiler suggests it doesn't build code for the machine you specified"
1974 elif [ -n "$4" ]; then
1975 # Check for manual compiler
1976 machine=`$4 $9 2>/dev/null`
1980 log 2 "executing $4 $9"
1981 log 2 " returned $machine"
1982 log 2 " exit code $ret"
1984 if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ]; then
1985 log 1 "checking $1... $4 not found"
1986 log 1 "the selected binary doesn't seem to be a $6 binary"
1990 # Nothing given, autodetect
1992 if [ -n "$5" ]; then
1993 machine=`$5 $9 2>/dev/null`
1997 log 2 "executing $5 $9"
1998 log 2 " returned $machine"
1999 log 2 " exit code $ret"
2001 # The user defined a GCC that doesn't reply to $9.. abort
2002 if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ]; then
2003 log 1 "checking $1... $5 unusable"
2004 log 1 "the CC environment variable is set, but it doesn't seem to be a $6 binary"
2005 log 1 "please redefine the CC/CXX environment to a $6 binary"
2009 log 2 "checking $1... CC/CXX not set (skipping)"
2011 # No $5, so try '$6'
2012 machine=`$6 $9 2>/dev/null`
2016 log 2 "executing $6 $9"
2017 log 2 " returned $machine"
2018 log 2 " exit code $ret"
2020 if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ]; then
2022 machine=`$7 $9 2>/dev/null`
2026 log 2 "executing $7 $9"
2027 log 2 " returned $machine"
2028 log 2 " exit code $ret"
2031 if [ -z "$machine" ]; then
2032 log 1 "checking $1... $6 not found"
2033 log 1 "I couldn't detect any $6 binary on your system"
2034 log 1 "please define the CC/CXX environment to where it is located"
2042 if [ "$8" != "0" ]; then
2044 log 1 "checking $1... $res"
2046 log 1 "checking $1... $machine"
2051 if [ "$os" = "FREEBSD" ]; then
2052 # FreeBSD's C compiler does not support dump machine.
2053 # However, removing C support is not possible because PSP must be linked with the C compiler.
2054 check_compiler "build system type" "cc_build" "$build" "$cc_build" "$CXX" "g++" "c++" "0" "-dumpmachine"
2056 check_compiler "build system type" "cc_build" "$build" "$cc_build" "$CC" "gcc" "cc" "0" "-dumpmachine"
2061 # By default the host is the build
2062 if [ -z "$host" ]; then host="$build"; fi
2064 if [ "$os" = "FREEBSD" ]; then
2065 # FreeBSD's C compiler does not support dump machine.
2066 # However, removing C support is not possible because PSP must be linked with the C compiler.
2067 check_compiler "host system type" "cc_host" "$host" "$cc_host" "$CXX" "g++" "c++" "0" "-dumpmachine"
2069 check_compiler "host system type" "cc_host" "$host" "$cc_host" "$CC" "gcc" "cc" "0" "-dumpmachine"
2074 check_compiler "build c++" "cxx_build" "$build" "$cxx_build" "$CXX" "g++" "c++" 1 "-dumpmachine"
2078 # By default the host is the build
2079 if [ -z "$host" ]; then host="$build"; fi
2080 check_compiler "host c++" "cxx_host" "$host" "$cxx_host" "$CXX" "g++" "c++" 1 "-dumpmachine"
2084 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ]; then
2085 check_compiler "host windres" "windres" "$host" "$windres" "$WINDRES" "windres" "windres" "2" "-V"
2090 if [ "$os" = "OS2" ]; then
2091 # OS2 via gcc is a bit weird.. stripping HAS to be done via emxbind, which is via gcc directly
2092 log 1 "checking host strip... using gcc -s option"
2093 elif [ "$os" = "OSX" ]; then
2094 # Most targets have -V in strip, to see if they exists... OSX doesn't.. so execute something
2095 echo "int main(int argc, char *argv[]) { }" > strip.test.c
2096 $cxx_host strip.test.c -o strip.test
2097 check_compiler "host strip" "strip" "$host" "$strip" "$STRIP" "strip" "strip" "3" "strip.test"
2098 rm -f strip.test.c strip.test
2100 check_compiler "host strip" "strip" "$host" "$strip" "$STRIP" "strip" "strip" "3" "-V"
2105 if [ "$os" = "OSX" ] && [ "$enable_universal" != "0" ]; then
2106 echo "int main(int argc, char *argv[]) { }" > lipo.test.c
2107 $cxx_host lipo.test.c -o lipo.test
2108 check_compiler "host lipo" "lipo" "$host" "$lipo" "$LIPO" "lipo" "lipo" "4" "-info lipo.test"
2109 rm -f lipo.test.c lipo.test
2115 if [ -n "$1" ]; then
2116 if echo "$1" | grep -q / ; then
2117 # Seems to be a file system path
2120 osx_sdk_path="/Developer/SDKs/MacOSX$1.sdk"
2122 if [ ! -d "$osx_sdk_path" ]; then
2123 # No directory, not present or garbage
2127 # Set minimum version to 10.4 as that's when kCGBitmapByteOrder32Host was introduced
2128 sysroot="-isysroot $osx_sdk_path -Wl,-syslibroot,$osx_sdk_path -mmacosx-version-min=10.4"
2131 cat > tmp.osx.mm << EOF
2132 #include <Cocoa/Cocoa.h>
2134 kCGBitmapByteOrder32Host;
2138 execute="$cxx_host $sysroot $CFLAGS tmp.osx.mm -framework Cocoa -o tmp.osx 2>&1"
2139 eval $execute > /dev/null
2141 log 2 "executing $execute"
2142 log 2 " exit code $ret"
2143 rm -f tmp.osx.mm tmp.osx
2147 check_direct_music() {
2149 #include <windows.h>
2150 #include <dmksctrl.h>
2151 #include <dmusici.h>
2152 #include <dmusicc.h>
2153 #include <dmusicf.h>
2154 int main(int argc, char *argv[]) { }" > direct_music.test.c
2155 $cxx_host $CFLAGS direct_music.test.c -o direct_music.test 2> /dev/null
2157 rm -f direct_music.test.c direct_music.test
2159 if [ "$res" != "0" ]; then
2160 if [ "$with_direct_music" != "1" ]; then
2161 log 1 "configure: error: direct-music is not available on this system"
2164 with_direct_music="0"
2166 log 1 "checking direct-music... not found"
2168 log 1 "checking direct-music... found"
2172 check_makedepend() {
2173 if [ "$enable_builtin_depend" != "0" ]; then
2177 if [ "$with_makedepend" = "0" ]; then
2178 log 1 "checking makedepend... disabled"
2182 if [ "$with_makedepend" = "1" ] || [ "$with_makedepend" = "2" ]; then
2183 makedepend="makedepend"
2185 makedepend="$with_makedepend"
2188 rm -f makedepend.tmp
2189 touch makedepend.tmp
2190 res=`$makedepend -fmakedepend.tmp 2>/dev/null`
2192 log 2 "executing $makedepend -f makedepend.tmp"
2193 log 2 " returned `cat makedepend.tmp`"
2194 log 2 " exit code $ret"
2196 if [ ! -s makedepend.tmp ]; then
2197 rm -f makedepend.tmp makedepend.tmp.bak
2199 if [ "$with_makedepend" = "2" ]; then
2200 log 1 "checking makedepend... not found"
2202 log 1 "I couldn't detect any makedepend on your system"
2203 log 1 "please locate it via --makedepend=[binary]"
2206 elif [ "$with_makedepend" != "1" ]; then
2207 log 1 "checking makedepend... $makedepend not found"
2209 log 1 "the selected file doesn't seem to be a valid makedepend binary"
2213 log 1 "checking makedepend... not found"
2220 rm -f makedepend.tmp makedepend.tmp.bak
2222 log 1 "checking makedepend... $makedepend"
2226 # $1 - requested version (major.minor)
2227 # $2 - version we got (major.minor)
2229 if [ -z "$2" ]; then
2233 req_major=`echo $1 | cut -d. -f1`
2234 got_major=`echo $2 | cut -d. -f1`
2235 if [ $got_major -lt $req_major ]; then
2237 elif [ $got_major -gt $req_major ]; then
2241 req_minor=`echo $1 | cut -d. -f2`
2242 got_minor=`echo $2 | cut -d. -f2`
2243 if [ $got_minor -lt $req_minor ]; then
2250 # Not all awks allow gsub(), so we test for that here! It is in fact all we need...
2252 # These awks are known to work. Test for them explicit
2253 awks="gawk mawk nawk"
2255 awk_prefix="echo \"a.c b.c c.c\" | tr ' ' \\\\n | "
2256 awk_param="' { ORS = \" \" } /\.c$/ { gsub(\".c$\", \".o\", \$0); print \$0; }' 2>/dev/null"
2257 awk_result="a.o b.o c.o "
2258 log 2 "Detecing awk..."
2260 log 2 "Trying: $awk_prefix $awk $awk_param"
2261 res=`eval $awk_prefix $awk $awk_param`
2262 log 2 "Result: '$res'"
2263 if [ "$res" != "$awk_result" ] && [ "$awk" = "awk" ]; then
2264 # User didn't supply his own awk, so try to detect some other known working names for an awk
2265 for awk in $awks; do
2266 log 2 "Trying: $awk_prefix $awk $awk_param"
2267 res=`eval $awk_prefix $awk $awk_param`
2268 log 2 "Result: '$res'"
2269 if [ "$res" = "$awk_result" ]; then break; fi
2272 if [ "$res" != "$awk_result" ]; then
2273 log 1 "checking awk... not found"
2274 log 1 "configure: error: no awk found"
2275 log 1 "configure: error: please install one of the following: $awks"
2279 if [ "$res" != "$awk_result" ]; then
2280 log 1 "checking awk... not found"
2281 log 1 "configure: error: you supplied '$awk' but it doesn't seem a valid gawk or mawk"
2285 log 1 "checking awk... $awk"
2289 if [ "$os" = "DETECT" ]; then
2290 # Detect UNIX, OSX, FREEBSD, DRAGONFLY, OPENBSD, NETBSD, HPUX, MORPHOS, BEOS, SUNOS, CYGWIN, MINGW, OS2, DOS, WINCE, and PSP
2292 # Try first via dumpmachine, then via uname
2293 case `echo "$host" | tr '[A-Z]' '[a-z]'` in
2296 *freebsd*) os=FREEBSD;;
2297 *dragonfly*) os=DRAGONFLY;;
2298 *openbsd*) os=OPENBSD;;
2299 *netbsd*) os=NETBSD;;
2301 *morphos*) os=MORPHOS;;
2305 *solaris*) os=SUNOS;;
2306 *cygwin*) os=CYGWIN;;
2314 if [ "$os" = "DETECT" ]; then
2315 case `LC_ALL=C uname | tr '[A-Z]' '[a-z]'` in
2318 *freebsd*) os=FREEBSD;;
2319 *dragonfly*) os=DRAGONFLY;;
2320 *openbsd*) os=OPENBSD;;
2321 *netbsd*) os=NETBSD;;
2323 *morphos*) os=MORPHOS;;
2327 *cygwin*) os=CYGWIN;;
2334 if [ "$os" = "DETECT" ]; then
2335 log 1 "detecting OS... none detected"
2336 log 1 "I couldn't detect your OS. Please use --os=OS to force one"
2337 log 1 "Allowed values are: UNIX, OSX, FREEBSD, DRAGONFLY, OPENBSD, NETBSD, MORPHOS, HPUX, BEOS, HAIKU, SUNOS, CYGWIN, MINGW, OS2, DOS, WINCE, and PSP"
2341 log 1 "detecting OS... $os"
2343 log 1 "forcing OS... $os"
2348 # 0 means no, 1 is auto-detect, 2 is force
2349 if [ "$with_allegro" = "0" ]; then
2350 log 1 "checking Allegro... disabled"
2356 if [ "$with_allegro" = "2" ] && [ "$with_cocoa" = "2" ]; then
2357 log 1 "configure: error: it is impossible to compile both Allegro and COCOA"
2358 log 1 "configure: error: please deselect one of them and try again"
2362 if [ "$with_allegro" = "2" ] && [ "$enable_dedicated" != "0" ]; then
2363 log 1 "configure: error: it is impossible to compile a dedicated with Allegro"
2364 log 1 "configure: error: please deselect one of them and try again"
2368 if [ "$enable_dedicated" != "0" ]; then
2369 log 1 "checking Allegro... dedicated server, skipping"
2375 # By default on OSX we don't use Allegro. The rest is auto-detect
2376 if [ "$with_allegro" = "1" ] && [ "$os" = "OSX" ] && [ "$with_cocoa" != "0" ]; then
2377 log 1 "checking Allegro... OSX, skipping"
2383 detect_pkg_config "$with_allegro" "allegro" "allegro_config" "4.4"
2388 # 0 means no, 1 is auto-detect, 2 is force
2389 if [ "$with_sdl" = "0" ]; then
2390 log 1 "checking SDL... disabled"
2396 if [ "$with_sdl" = "2" ] && [ "$with_cocoa" = "2" ]; then
2397 log 1 "configure: error: it is impossible to compile both SDL and COCOA"
2398 log 1 "configure: error: please deselect one of them and try again"
2402 if [ "$with_sdl" = "2" ] && [ "$enable_dedicated" != "0" ]; then
2403 log 1 "configure: error: it is impossible to compile a dedicated with SDL"
2404 log 1 "configure: error: please deselect one of them and try again"
2408 if [ "$enable_dedicated" != "0" ]; then
2409 log 1 "checking SDL... dedicated server, skipping"
2415 # By default on OSX we don't use SDL. The rest is auto-detect
2416 if [ "$with_sdl" = "1" ] && [ "$os" = "OSX" ] && [ "$with_cocoa" != "0" ]; then
2417 log 1 "checking SDL... OSX, skipping"
2423 if [ "$os" = "OSX" ]; then
2424 log 1 "WARNING: sdl is known to fail on some versions of Mac OS X"
2425 log 1 "WARNING: with some hardware configurations. Use at own risk!"
2429 detect_pkg_config "$with_sdl" "sdl" "sdl_config" "1.2"
2433 # Try to find the best SDK available. For a normal build this
2434 # is currently the 10.5 SDK as this is needed to compile all
2435 # optional code. Because such an executable won't run on 10.4
2436 # or lower, also check for the 10.4u SDK when doing an universal
2439 # Check for the 10.5 SDK, but try 10.6 if that fails
2440 check_osx_sdk "10.5" || check_osx_sdk "10.6" || osx_sdk_path=""
2442 if [ -z "$osx_sdk_path" ] || [ "$enable_universal" != "0" ]; then
2443 # No better SDK or universal build enabled? Check 10.4u SDK as well
2444 local old_sdk="$osx_sdk_path"
2445 if check_osx_sdk "10.4u"; then
2446 osx_sdk_104_path="$osx_sdk_path"
2450 if [ -z "$old_sdk" ]; then
2451 osx_sdk_path="$osx_sdk_104_path"
2453 osx_sdk_path="$old_sdk"
2457 if [ -z "$osx_sdk_path" ]; then
2458 log 1 "Your system SDK is probably too old"
2459 log 1 "Please install/upgrade your Xcode to >= 2.5"
2466 # 0 means no, 1 is auto-detect, 2 is force
2467 if [ "$with_cocoa" = "0" ]; then
2468 log 1 "checking COCOA... disabled"
2473 if [ "$with_cocoa" = "2" ] && [ "$enable_dedicated" != "0" ]; then
2474 log 1 "configure: error: it is impossible to compile a dedicated with COCOA"
2475 log 1 "configure: error: please deselect one of them and try again"
2479 if [ "$enable_dedicated" != "0" ]; then
2480 log 1 "checking COCOA... dedicated server, skipping"
2486 # By default on OSX we use COCOA. The rest doesn't support it
2487 if [ "$with_cocoa" = "1" ] && [ "$os" != "OSX" ]; then
2488 log 1 "checking COCOA... not OSX, skipping"
2494 if [ "$os" != "OSX" ]; then
2495 log 1 "checking COCOA... not OSX"
2497 log 1 "configure: error: COCOA video driver is only supported for OSX"
2501 log 1 "checking COCOA... found"
2504 if [ "$enable_cocoa_quartz" != "0" ]; then
2505 log 1 "checking whether to enable the Quartz window subdriver... yes"
2507 log 1 "checking whether to enable the Quartz window subdriver... no"
2513 detect_quickdraw() {
2514 # 0 means no, 1 is auto-detect, 2 is force
2515 if [ "$enable_cocoa_quickdraw" = "0" ]; then
2516 log 1 "checking Quickdraw window subdriver... disabled"
2520 # Assume QuickDraw is available when doing an universal build
2521 if [ "$enable_universal" != "0" ]; then
2522 log 1 "checking Quickdraw window subdriver... found"
2526 # 64 bits doesn't have quickdraw
2527 if [ "$cpu_type" = "64" ]; then
2528 enable_cocoa_quickdraw="0"
2529 log 1 "checking Quickdraw window subdriver... disabled (64 bits)"
2533 cat > tmp.osx.mm << EOF
2534 #include <AvailabilityMacros.h>
2535 #import <Cocoa/Cocoa.h>
2536 int main(int argc, char *argv[]) { SetEmptyRgn(NULL); return 0; }
2538 execute="$cxx_host $OSX_SYSROOT $OSX_LD_SYSROOT $CFLAGS -mmacosx-version-min=10.3 tmp.osx.mm -framework Cocoa -o tmp.osx 2>&1"
2539 eval $execute > /dev/null
2541 log 2 "executing $execute"
2542 log 2 " exit code $ret"
2543 rm -f tmp.osx.mm tmp.osx
2544 if [ "$ret" != "0" ]; then
2545 log 1 "checking Quickdraw window subdriver... not found"
2547 # It was forced, so it should be found.
2548 if [ "$enable_cocoa_quickdraw" != "1" ]; then
2549 log 1 "configure: error: Quickdraw window driver could not be found"
2553 enable_cocoa_quickdraw=0
2557 enable_cocoa_quickdraw=1
2558 log 1 "checking Quickdraw window subdriver... found"
2562 # $1 - config-param ($with_zlib value)
2563 # $2 - library name ('zlib', sets $zlib)
2564 # $3 - static library name (libz.a)
2565 # $4 - header directory ()
2566 # $5 - header name (zlib.h)
2567 # $6 - force static (if non-empty)
2569 if [ -n "$6" ]; then force_static="1"; fi
2571 # 0 means no, 1 is auto-detect, 2 is force
2572 if [ "$1" = "0" ]; then
2573 log 1 "checking $2... disabled"
2579 log 2 "detecting $2"
2581 if [ "$1" = "1" ] || [ "$1" = "" ] || [ "$1" = "2" ]; then
2582 eval "$2=`ls -1 /usr/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2584 if [ -z "$res" ]; then
2585 log 2 " trying /usr/include/$4$5... no"
2586 eval "$2=`ls -1 /usr/local/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2589 if [ -z "$res" ]; then
2590 log 2 " trying /usr/local/include/$4$5... no"
2591 eval "$2=`ls -1 /mingw/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2594 if [ -z "$res" ]; then
2595 log 2 " trying /mingw/include/$4$5... no"
2596 eval "$2=`ls -1 /opt/local/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2599 if [ -z "$res" ]; then
2600 log 2 " trying /opt/local/include/$4$5... no"
2602 if [ -z "$res" ] && [ "$os" = "NETBSD" ]; then
2603 eval "$2=`ls -1 /usr/pkg/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2605 if [ -z "$res" ]; then
2606 log 2 " trying /usr/pkg/include/$4$5... no"
2609 if [ -z "$res" ] && [ "$os" = "HAIKU" ]; then
2610 if [ -z "$includeDir" ]; then
2611 includeDir=`finddir B_SYSTEM_HEADERS_DIRECTORY`
2613 eval "$2=`ls -1 $includeDir/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2615 if [ -z "$res" ]; then
2616 log 2 " trying $includeDir/$4$5... no"
2621 if [ -n "$res" ] && ( [ -n "$force_static" ] || ( [ "$enable_static" != "0" ] && [ "$os" != "OSX" ] ) ); then
2623 log 2 " trying $res... found"
2624 # Now find the static lib, if needed
2625 eval "$2=`ls /lib/*.a 2>/dev/null | egrep \"\/$3\$\"`"
2627 if [ -z "$res" ]; then
2628 log 2 " trying /lib/$3... no"
2629 eval "$2=`ls /usr/lib/*.a 2>/dev/null | egrep \"\/$3\$\"`"
2632 if [ -z "$res" ]; then
2633 log 2 " trying /usr/lib/$3... no"
2634 eval "$2=`ls /usr/local/lib/*.a 2>/dev/null | egrep \"\/$3\$\"`"
2637 if [ -z "$res" ]; then
2638 log 2 " trying /usr/local/lib/$3... no"
2639 eval "$2=`ls /mingw/lib/*.a 2>/dev/null | egrep \"\/$3\$\"`"
2642 if [ -z "$res" ]; then
2643 log 2 " trying /mingw/lib/$3... no"
2644 log 1 "configure: error: $2 couldn't be found"
2645 log 1 "configure: error: you requested a static link, but I can't find $3"
2651 # Make sure it exists
2652 if [ -f "$1" ]; then
2653 eval "$2=`ls $1 2>/dev/null`"
2655 eval "$2=`ls $1/$3 2>/dev/null`"
2660 if [ -z "$res" ]; then
2661 log 1 "checking $2... not found"
2662 if [ "$1" = "2" ]; then
2663 log 1 "configure: error: $2 couldn't be found"
2666 elif [ "$1" != "1" ]; then
2667 log 1 "configure: error: $2 couldn't be found"
2668 log 1 "configure: error: you supplied '$1', but it seems invalid"
2679 log 2 " trying $res... found"
2681 log 1 "checking $2... found"
2685 detect_pkg_config "$with_zlib" "zlib" "zlib_config" "1.2"
2689 detect_library "$with_lzo2" "lzo2" "liblzo2.a" "lzo/" "lzo1x.h"
2692 detect_libtimidity() {
2693 detect_pkg_config "$with_libtimidity" "libtimidity" "libtimidity_config" "0.1" "1"
2696 detect_pkg_config() {
2697 # $1 - config-param ($with_lzma value)
2698 # $2 - package name ('liblzma')
2699 # $3 - config name ('lzma_config', sets $lzma_config)
2700 # $4 - minimum module version ('2.3')
2701 # $5 - check for dedicated, 1 is "skif if dedicated"
2703 # 0 means no, 1 is auto-detect, 2 is force
2704 if [ "$1" = "0" ]; then
2705 log 1 "checking $2... disabled"
2711 if [ "$5" = "1" ] && [ "$1" = "1" ] && [ "$enable_dedicated" != "0" ]; then
2712 log 1 "checking $2... dedicated server, skipping"
2718 log 2 "detecting $2"
2720 if [ "$1" = "1" ] || [ "$1" = "" ] || [ "$1" = "2" ]; then
2721 pkg_config_call="$pkg_config $2"
2723 pkg_config_call="$1"
2726 version=`$pkg_config_call --modversion 2>/dev/null`
2728 check_version "$4" "$version"
2730 log 2 "executing $pkg_config_call --modversion"
2731 log 2 " returned $version"
2732 log 2 " exit code $ret"
2734 if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$version_ok" != "1" ]; then
2735 if [ -n "$version" ] && [ "$version_ok" != "1" ]; then
2736 log 1 "checking $2... needs at least version $4, $2 NOT enabled"
2738 log 1 "checking $2... not found"
2741 # It was forced, so it should be found.
2742 if [ "$1" != "1" ]; then
2743 log 1 "configure: error: $pkg_config $2 couldn't be found"
2744 log 1 "configure: error: you supplied '$1', but it seems invalid"
2752 eval "$3=\"$pkg_config_call\""
2753 log 1 "checking $2... found"
2757 detect_pkg_config "$with_lzma" "liblzma" "lzma_config" "5.0"
2760 detect_xdg_basedir() {
2761 detect_pkg_config "$with_xdg_basedir" "libxdg-basedir" "xdg_basedir_config" "1.2"
2765 detect_pkg_config "$with_png" "libpng" "png_config" "1.2"
2769 detect_pkg_config "$with_freetype" "freetype2" "freetype_config" "2.2" "1"
2772 detect_fontconfig() {
2773 # 0 means no, 1 is auto-detect, 2 is force
2774 if [ "$with_fontconfig" = "0" ]; then
2775 log 1 "checking libfontconfig... disabled"
2777 fontconfig_config=""
2780 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ]; then
2781 log 1 "checking libfontconfig... WIN32, skipping"
2782 fontconfig_config=""
2786 if [ "$os" = "OSX" ]; then
2787 log 1 "checking libfontconfig... OSX, skipping"
2788 fontconfig_config=""
2792 detect_pkg_config "$with_fontconfig" "fontconfig" "fontconfig_config" "2.3" "1"
2795 detect_icu_layout() {
2796 detect_pkg_config "$with_icu_layout" "icu-lx" "icu_layout_config" "4.8" "1"
2800 detect_pkg_config "$with_icu_sort" "icu-i18n" "icu_sort_config" "4.8" "1"
2803 detect_pspconfig() {
2804 # 0 means no, 1 is auto-detect, 2 is force
2805 if [ "$with_psp_config" = "0" ]; then
2806 log 1 "checking psp-config... disabled"
2812 if [ "$with_psp_config" = "1" ] && [ "$os" != "PSP" ]; then
2813 log 1 "checking psp-config... not PSP, skipping"
2819 if [ "$os" != "PSP" ]; then
2820 log 1 "checking psp-config... not PSP"
2822 log 1 "configure: error: psp-config is only supported for PSP"
2826 if [ "$with_psp_config" = "1" ] || [ "$with_psp_config" = "" ] || [ "$with_psp_config" = "2" ]; then
2827 psp_config="psp-config"
2829 psp_config="$with_psp_config"
2832 version=`$psp_config -p 2>/dev/null`
2834 log 2 "executing $psp_config -p"
2835 log 2 " returned $version"
2836 log 2 " exit code $ret"
2838 if [ -z "$version" ] || [ "$ret" != "0" ]; then
2839 log 1 "checking psp-config... not found"
2840 log 1 "configure: error: psp-config couldn't be found"
2842 # It was forced, so it should be found.
2843 if [ "$with_psp_config" != "1" ]; then
2844 log 1 "configure: error: you supplied '$with_psp_config', but it seems invalid"
2849 log 1 "checking psp-config... found"
2853 # 0 means no, 1 is auto-detect, 2 is force
2854 if [ "$with_iconv" = "0" ]; then
2855 log 1 "checking iconv... disabled"
2860 if [ "$with_iconv" = "1" ] && [ "$os" != "OSX" ]; then
2861 log 1 "checking iconv... not OSX, skipping"
2867 # Try to find iconv.h, seems to only thing to detect iconv with
2869 if [ "$with_iconv" = "1" ] || [ "$with_iconv" = "" ] || [ "$with_iconv" = "2" ]; then
2870 iconv=`ls -1 /usr/include 2>/dev/null | grep "iconv.h"`
2871 if [ -z "$iconv" ]; then
2872 iconv=`ls -1 /usr/local/include 2>/dev/null | grep "iconv.h"`
2875 # Make sure it exists
2876 iconv=`ls $with_iconv/include/iconv.h 2>/dev/null`
2879 if [ -z "$iconv" ]; then
2880 log 1 "checking iconv... not found"
2881 if [ "$with_iconv" = "2" ]; then
2882 log 1 "configure: error: iconv couldn't be found"
2885 elif [ "$with_iconv" != "1" ]; then
2886 log 1 "configure: error: iconv couldn't be found"
2887 log 1 "configure: error: you supplied '$with_iconv', but I couldn't detect iconv in it"
2895 if [ "$with_iconv" = "1" ]; then
2899 log 2 "found iconv in $iconv"
2901 log 1 "checking iconv... found"
2903 # There are different implementations of iconv. The older ones,
2904 # e.g. SUSv2, pass a const pointer, whereas the newer ones, e.g.
2905 # IEEE 1003.1 (2004), pass a non-const pointer.
2907 cat > tmp.iconv.cpp << EOF
2908 #include "src/stdafx.h"
2911 static char buf[1024];
2913 const char *inbuf = "";
2915 size_t outlen = 1023;
2917 return iconv(convd, &inbuf, &inlen, &outbuf, &outlen);
2920 execute="$cxx_host $OSX_SYSROOT $CFLAGS -c tmp.iconv.cpp -o tmp.iconv -DTESTING 2>&1"
2921 eval $execute > /dev/null
2923 log 2 "executing $execute"
2924 log 2 " exit code $ret"
2925 if [ "$ret" = "0" ]; then have_non_const_iconv="no"; else have_non_const_iconv="yes"; fi
2926 log 1 "checking if iconv has non-const inbuf... $have_non_const_iconv"
2928 cat > tmp.iconv.cpp << EOF
2929 #include "src/stdafx.h"
2932 static char buf[1024];
2936 size_t outlen = 1023;
2938 return iconv(convd, &inbuf, &inlen, &outbuf, &outlen);
2941 execute="$cxx_host $OSX_SYSROOT $OSX_LD_SYSROOT $CFLAGS tmp.iconv.cpp -o tmp.iconv -DTESTING 2>&1"
2942 eval $execute > /dev/null
2944 log 2 "executing $execute"
2945 log 2 " exit code $ret"
2946 if [ "$ret" = "0" ]; then link_to_iconv="no"; else link_to_iconv="yes"; fi
2947 log 1 "checking whether to link to iconv... $link_to_iconv"
2948 rm -f tmp.iconv tmp.iconv.cpp
2962 log 2 "running echo <array> | $1"
2964 if [ "`echo \"$sort_test_in\" | $1 2>/dev/null`" = "$sort_test_out" ]; then
2966 log 2 " result was valid"
2968 log 2 " result was invalid"
2973 if [ "$with_sort" = "0" ]; then
2974 log 1 "checking sort... disabled"
2979 if [ "$with_sort" = "1" ] || [ "$with_sort" = "2" ]; then
2981 if [ -z "$sort" ]; then _detect_sort "/sbin/sort"; fi
2982 if [ -z "$sort" ]; then _detect_sort "/usr/sbin/sort"; fi
2983 if [ -z "$sort" ]; then _detect_sort "/usr/local/sbin/sort"; fi
2984 if [ -z "$sort" ]; then _detect_sort "/bin/sort"; fi
2985 if [ -z "$sort" ]; then _detect_sort "/usr/bin/sort"; fi
2986 if [ -z "$sort" ]; then _detect_sort "/usr/local/bin/sort"; fi
2988 _detect_sort "$with_sort"
2991 if [ -z "$sort" ]; then
2992 if [ "$with_sort" = "2" ]; then
2993 log 1 "checking sort... not found"
2995 log 1 "configure: error: couldn't detect sort on your system"
2997 elif [ "$with_sort" != "1" ]; then
2998 log 1 "checking sort... $with_sort not found"
3000 log 1 "configure: error: '$with_sort' doesn't look like a sort to me"
3001 log 1 "configure: error: please verify its location and function and try again"
3005 log 1 "checking sort... not found"
3008 log 1 "checking sort... $sort"
3013 # 0 means no, 1 is auto-detect, 2 is force
3014 if [ "$with_grfcodec" = "0" ]; then
3015 log 1 "checking grfcodec... disabled"
3021 if [ "$with_grfcodec" = "1" ] || [ "$with_grfcodec" = "" ] || [ "$with_grfcodec" = "2" ]; then
3024 grfcodec="$with_grfcodec"
3027 version=`$grfcodec -v 2>/dev/null | $awk '{print $3}' | sed 's/[rM]//g;s/-/0/'`
3029 log 2 "executing grfcodec -v"
3030 log 2 " returned $version"
3031 log 2 " exit code $ret"
3033 if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$version" -lt "985" ]; then
3034 if [ -n "$version" ] && [ "$version" -lt "985" ]; then
3035 log 1 "checking grfcodec... needs at least version 6.0.5 (r985), disabled"
3037 log 1 "checking grfcodec... not found"
3040 # It was forced, so it should be found.
3041 if [ "$with_grfcodec" != "1" ]; then
3042 log 1 "configure: error: grfcodec couldn't be found"
3043 log 1 "configure: error: you supplied '$with_grfcodec', but it seems invalid"
3051 log 1 "checking grfcodec... found"
3055 # 0 means no, 1 is auto-detect, 2 is force
3056 if [ "$with_nforenum" = "0" ]; then
3057 log 1 "checking nforenum... disabled"
3063 if [ "$with_nforenum" = "1" ] || [ "$with_nforenum" = "" ] || [ "$with_nforenum" = "2" ]; then
3066 nforenum="$with_nforenum"
3069 version=`$nforenum -v 2>/dev/null | $awk '{print $3}' | sed 's/[rM]//g;s/-/0/'`
3071 log 2 "executing nforenum -v"
3072 log 2 " returned $version"
3073 log 2 " exit code $ret"
3075 if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$version" -lt "985" ]; then
3076 if [ -n "$version" ] && [ "$version" -lt "985" ]; then
3077 log 1 "checking nforenum... needs at least version 6.0.5 (r985), disabled"
3079 log 1 "checking nforenum... not found"
3082 # It was forced, so it should be found.
3083 if [ "$with_nforenum" != "1" ]; then
3084 log 1 "configure: error: nforenum couldn't be found"
3085 log 1 "configure: error: you supplied '$with_nforenum', but it seems invalid"
3093 log 1 "checking nforenum... found"
3097 if [ -n "$cpu_type" ] && [ "$cpu_type" != "DETECT" ]; then
3098 log 1 "forcing cpu-type... $cpu_type bits"
3101 echo "#define _SQ64 1" > tmp.64bit.cpp
3102 echo "#include \"src/stdafx.h\"" >> tmp.64bit.cpp
3103 echo "assert_compile(sizeof(size_t) == 8);" >> tmp.64bit.cpp
3104 echo "int main() { return 0; }" >> tmp.64bit.cpp
3105 execute="$cxx_host $CFLAGS tmp.64bit.cpp -o tmp.64bit -DTESTING 2>&1"
3106 cpu_type="`eval $execute 2>/dev/null`"
3108 log 2 "executing $execute"
3109 log 2 " returned $cpu_type"
3110 log 2 " exit code $ret"
3111 if [ "$ret" = "0" ]; then cpu_type="64"; else cpu_type="32"; fi
3112 log 1 "detecting cpu-type... $cpu_type bits"
3113 rm -f tmp.64bit tmp.64bit.cpp
3116 detect_sse_capable_architecture() {
3117 # 0 means no, 1 is auto-detect, 2 is force
3118 if [ "$with_sse" = "0" ]; then
3119 log 1 "checking SSE... disabled"
3123 echo "#define _SQ64 1" > tmp.sse.cpp
3124 echo "#include <xmmintrin.h>" >> tmp.sse.cpp
3125 echo "#include <smmintrin.h>" >> tmp.sse.cpp
3126 echo "#include <tmmintrin.h>" >> tmp.sse.cpp
3127 echo "int main() { return 0; }" >> tmp.sse.cpp
3128 execute="$cxx_host -msse4.1 $CFLAGS tmp.sse.cpp -o tmp.sse 2>&1"
3129 sse="`eval $execute 2>/dev/null`"
3131 log 2 "executing $execute"
3132 log 2 " returned $sse"
3133 log 2 " exit code $ret"
3134 if [ "$ret" = "0" ]; then
3135 log 1 "detecting SSE... found"
3137 # It was forced, so it should be found.
3138 if [ "$with_sse" != "1" ]; then
3139 log 1 "configure: error: SSE couln't be found"
3140 log 1 "configure: error: you force enabled SSE, but it seems unavailable"
3144 log 1 "detecting SSE... not found"
3147 rm -f tmp.sse tmp.exe tmp.sse.cpp
3152 T_CXXFLAGS="$CXXFLAGS"
3153 T_LDFLAGS="$LDFLAGS"
3155 SRC_OBJS_DIR="$BASE_SRC_OBJS_DIR/$OBJS_SUBDIR"
3157 # All the data needed to compile a single target
3158 # Make sure if you compile multiple targets to
3159 # use multiple OBJS_DIR, because all in-between
3160 # binaries are stored in there, and nowhere else.
3162 s@!!CC_HOST!!@$cc_host@g;
3163 s@!!CXX_HOST!!@$cxx_host@g;
3164 s@!!CC_BUILD!!@$cc_build@g;
3165 s@!!CXX_BUILD!!@$cxx_build@g;
3166 s@!!WINDRES!!@$windres@g;
3167 s@!!STRIP!!@$strip $strip_arg@g;
3169 s@!!CFLAGS!!@$T_CFLAGS@g;
3170 s@!!CFLAGS_BUILD!!@$CFLAGS_BUILD@g;
3171 s@!!CXXFLAGS!!@$T_CXXFLAGS@g;
3172 s@!!CXXFLAGS_BUILD!!@$CXXFLAGS_BUILD@g;
3173 s@!!STRGEN_FLAGS!!@$strgen_flags@g;
3175 s@!!LDFLAGS!!@$T_LDFLAGS@g;
3176 s@!!LDFLAGS_BUILD!!@$LDFLAGS_BUILD@g;
3177 s@!!BIN_DIR!!@$BIN_DIR@g;
3178 s@!!ROOT_DIR!!@$ROOT_DIR@g;
3179 s@!!MEDIA_DIR!!@$MEDIA_DIR@g;
3180 s@!!SOURCE_LIST!!@$SOURCE_LIST@g;
3181 s@!!SRC_OBJS_DIR!!@$SRC_OBJS_DIR@g;
3182 s@!!LANG_OBJS_DIR!!@$LANG_OBJS_DIR@g;
3183 s@!!GRF_OBJS_DIR!!@$GRF_OBJS_DIR@g;
3184 s@!!SETTING_OBJS_DIR!!@$SETTING_OBJS_DIR@g;
3185 s@!!SRC_DIR!!@$SRC_DIR@g;
3186 s@!!SCRIPT_SRC_DIR!!@$SCRIPT_SRC_DIR@g;
3187 s@!!OSXAPP!!@$OSXAPP@g;
3188 s@!!LANG_DIR!!@$LANG_DIR@g;
3190 s@!!BINARY_DIR!!@$prefix_dir/$binary_dir@g;
3191 s@!!DATA_DIR!!@$prefix_dir/$data_dir@g;
3192 s@!!DOC_DIR!!@$prefix_dir/$doc_dir@g;
3193 s@!!MAN_DIR!!@$prefix_dir/$man_dir@g;
3194 s@!!ICON_DIR!!@$prefix_dir/$icon_dir@g;
3195 s@!!ICON_THEME_DIR!!@$prefix_dir/$icon_theme_dir@g;
3196 s@!!PERSONAL_DIR!!@$personal_dir@g;
3197 s@!!SHARED_DIR!!@$shared_dir@g;
3198 s@!!INSTALL_DIR!!@$install_dir@g;
3199 s@!!BINARY_NAME!!@$binary_name@g;
3200 s@!!STRGEN!!@$STRGEN@g;
3201 s@!!ENDIAN_CHECK!!@$ENDIAN_CHECK@g;
3202 s@!!DEPEND!!@$DEPEND@g;
3203 s@!!SETTINGSGEN!!@$SETTINGSGEN@g;
3204 s@!!ENDIAN_FORCE!!@$endian@g;
3205 s@!!STAGE!!@$STAGE@g;
3206 s@!!MAKEDEPEND!!@$makedepend@g;
3207 s@!!CFLAGS_MAKEDEP!!@$cflags_makedep@g;
3209 s@!!CONFIG_CACHE_COMPILER!!@config.cache.compiler@g;
3210 s@!!CONFIG_CACHE_LINKER!!@config.cache.linker@g;
3211 s@!!CONFIG_CACHE_ENDIAN!!@config.cache.endian@g;
3212 s@!!CONFIG_CACHE_SOURCE!!@config.cache.source@g;
3213 s@!!CONFIG_CACHE_VERSION!!@config.cache.version@g;
3214 s@!!CONFIG_CACHE_SOURCE_LIST!!@config.cache.source.list@g;
3215 s@!!CONFIG_CACHE_PWD!!@config.cache.pwd@g;
3216 s@!!LANG_SUPPRESS!!@$lang_suppress@g;
3217 s@!!OBJS_C!!@$OBJS_C@g;
3218 s@!!OBJS_CPP!!@$OBJS_CPP@g;
3219 s@!!OBJS_MM!!@$OBJS_MM@g;
3220 s@!!OBJS_RC!!@$OBJS_RC@g;
3223 s@!!CONFIGURE_FILES!!@$CONFIGURE_FILES@g;
3225 s@!!DISTCC!!@$distcc@g;
3226 s@!!NFORENUM!!@$nforenum@g;
3227 s@!!GRFCODEC!!@$grfcodec@g;
3230 if [ "$icon_theme_dir" != "" ]; then
3231 SRC_REPLACE="$SRC_REPLACE
3232 s@!!ICON_THEME_DIR!!@$prefix_dir/$icon_theme_dir@g;
3235 SRC_REPLACE="$SRC_REPLACE
3236 s@!!ICON_THEME_DIR!!@@g;
3240 if [ "$man_dir" != "" ]; then
3241 SRC_REPLACE="$SRC_REPLACE
3242 s@!!MAN_DIR!!@$prefix_dir/$man_dir@g;
3245 SRC_REPLACE="$SRC_REPLACE
3250 if [ "$menu_dir" != "" ]; then
3251 SRC_REPLACE="$SRC_REPLACE
3252 s@!!MENU_DIR!!@$prefix_dir/$menu_dir@g;
3255 SRC_REPLACE="$SRC_REPLACE
3261 generate_menu_item() {
3264 s@!!MENU_GROUP!!@$menu_group@g;
3265 s@!!MENU_NAME!!@$menu_name@g
3267 log 1 "Generating menu item..."
3269 < $ROOT_DIR/media/openttd.desktop.in sed "$MENU_REPLACE" > media/openttd.desktop
3277 # Create the main Makefile
3278 log 1 "Generating Makefile..."
3279 echo "# Auto-generated file from 'Makefile.in' -- DO NOT EDIT" > Makefile
3280 < $ROOT_DIR/Makefile.in sed "$SRC_REPLACE" >> Makefile
3281 cp $ROOT_DIR/Makefile.bundle.in Makefile.bundle
3282 echo "# Auto-generated file -- DO NOT EDIT" > Makefile.am
3284 # Make the copy of the source-list, so we don't trigger an unwanted recompile
3285 cp $SOURCE_LIST config.cache.source.list
3286 # Add the current directory, so we don't trigger an unwanted recompile
3287 echo "`pwd`" > config.cache.pwd
3288 # Make sure config.cache is OLDER then config.cache.source.list
3292 if [ "$menu_dir" != "" ]; then
3302 # Create the language file
3303 mkdir -p $LANG_OBJS_DIR
3305 log 1 "Generating lang/Makefile..."
3306 echo "# Auto-generated file from 'Makefile.lang.in' -- DO NOT EDIT" > $LANG_OBJS_DIR/Makefile
3307 < $ROOT_DIR/Makefile.lang.in sed "$SRC_REPLACE" >> $LANG_OBJS_DIR/Makefile
3308 echo "DIRS += $LANG_OBJS_DIR" >> Makefile.am
3309 echo "LANG_DIRS += $LANG_OBJS_DIR" >> Makefile.am
3312 generate_settings() {
3317 # Create the language file
3318 mkdir -p $SETTING_OBJS_DIR
3320 log 1 "Generating setting/Makefile..."
3321 echo "# Auto-generated file from 'Makefile.settings.in' -- DO NOT EDIT" > $SETTING_OBJS_DIR/Makefile
3322 < $ROOT_DIR/Makefile.setting.in sed "$SRC_REPLACE" >> $SETTING_OBJS_DIR/Makefile
3323 echo "DIRS += $SETTING_OBJS_DIR" >> Makefile.am
3331 # Create the language file
3332 mkdir -p $GRF_OBJS_DIR
3334 log 1 "Generating grf/Makefile..."
3335 echo "# Auto-generated file from 'Makefile.grf.in' -- DO NOT EDIT" > $GRF_OBJS_DIR/Makefile
3336 < $ROOT_DIR/Makefile.grf.in sed "$SRC_REPLACE" >> $GRF_OBJS_DIR/Makefile
3337 echo "DIRS += $GRF_OBJS_DIR" >> Makefile.am
3340 generate_src_normal() {
3345 # Create the source file
3346 mkdir -p $SRC_OBJS_DIR
3348 log 1 "Generating $2/Makefile..."
3349 echo "# Auto-generated file from 'Makefile.src.in' -- DO NOT EDIT" > $SRC_OBJS_DIR/Makefile
3350 < $ROOT_DIR/Makefile.src.in sed "$SRC_REPLACE" >> $SRC_OBJS_DIR/Makefile
3351 echo "DIRS += $SRC_OBJS_DIR" >> Makefile.am
3352 echo "SRC_DIRS += $SRC_OBJS_DIR" >> Makefile.am
3355 generate_src_osx() {
3356 cc_host_orig="$cc_host"
3357 cxx_host_orig="$cxx_host"
3358 CFLAGS_orig="$CFLAGS"
3359 LDFLAGS_orig="$LDFLAGS"
3361 for type in $enable_universal; do
3363 if [ -n "$osx_sdk_104_path" ]; then
3364 # Use 10.4 SDK for 32-bit targets
3365 CFLAGS="-isysroot $osx_sdk_104_path $CFLAGS_orig"
3366 LDFLAGS="-Wl,-syslibroot,$osx_sdk_104_path $LDFLAGS_orig"
3369 # We don't want to duplicate the x86_64 stuff for each target, so do it once here
3370 if [ "$type" = "ppc64" ] || [ "$type" = "x86_64" ]; then
3371 # 64 bits is always 10.5 or higher. Furthermore it has a non const ICONV
3372 # and they also removed support for QuickTime/QuickDraw
3373 if [ -n "$osx_sdk_path" ]; then
3374 CFLAGS="-isysroot $osx_sdk_path $CFLAGS_orig"
3375 LDFLAGS="-Wl,-syslibroot,$osx_sdk_path $LDFLAGS_orig"
3377 CFLAGS="$CFLAGS -D_SQ64 -DNO_QUICKTIME -UENABLE_COCOA_QUICKDRAW"
3378 LIBS="`echo $LIBS | sed 's/-framework QuickTime//'`"
3383 BASE_SRC_OBJS_DIR="$OBJS_DIR/ppc"
3384 cc_host="$cc_host_orig -arch ppc -mmacosx-version-min=10.3"
3385 cxx_host="$cxx_host_orig -arch ppc -mmacosx-version-min=10.3"
3386 generate_src_normal "[ppc]" "objs/ppc";;
3388 BASE_SRC_OBJS_DIR="$OBJS_DIR/ppc970"
3389 cc_host="$cc_host_orig -arch ppc970 -mmacosx-version-min=10.3 -mcpu=G5 -mpowerpc64 -mtune=970 -mcpu=970 -mpowerpc-gpopt"
3390 cxx_host="$cxx_host_orig -arch ppc970 -mmacosx-version-min=10.3 -mcpu=G5 -mpowerpc64 -mtune=970 -mcpu=970 -mpowerpc-gpopt"
3391 generate_src_normal "[ppc970]" "objs/ppc970";;
3393 BASE_SRC_OBJS_DIR="$OBJS_DIR/i386"
3394 cc_host="$cc_host_orig -arch i386 -mmacosx-version-min=10.4"
3395 cxx_host="$cxx_host_orig -arch i386 -mmacosx-version-min=10.4"
3396 generate_src_normal "[i386]" "objs/i386";;
3398 BASE_SRC_OBJS_DIR="$OBJS_DIR/ppc64"
3399 cc_host="$cc_host_orig -arch ppc64 -mmacosx-version-min=10.5"
3400 cxx_host="$cxx_host_orig -arch ppc64 -mmacosx-version-min=10.5"
3401 generate_src_normal "[ppc64]" "objs/ppc64";;
3403 BASE_SRC_OBJS_DIR="$OBJS_DIR/x86_64"
3404 cc_host="$cc_host_orig -arch x86_64 -mmacosx-version-min=10.5"
3405 cxx_host="$cxx_host_orig -arch x86_64 -mmacosx-version-min=10.5"
3406 generate_src_normal "[x86_64]" "objs/x86_64";;
3407 *) log 1 "Unknown architecture requested for universal build: $type";;
3413 if [ "$os" = "OSX" ] && [ "$enable_universal" != "0" ]; then
3416 generate_src_normal "[SRC]" "objs"
3421 echo "'configure' configures OpenTTD."
3423 echo "Usage: $0 [OPTION]... [VAR=VALUE]..."
3425 echo "To assign environment variables (e.g., CC, CFLAGS...), specify them as"
3426 echo "VAR=VALUE. See below for descriptions of some of the useful variables."
3428 echo "Defaults for the options are specified in brackets."
3430 echo "Configuration:"
3431 echo " -h, --help display this help and exit"
3433 echo "System types:"
3434 echo " --build=BUILD configure for building on BUILD [guessed]"
3435 echo " --host=HOST cross-compile to build programs to run"
3436 echo " on HOST [BUILD]"
3437 echo " --windres=WINDRES the windres to use [HOST-windres]"
3438 echo " --strip=STRIP the strip to use [HOST-strip]"
3439 echo " --awk=AWK the awk to use in configure [awk]"
3440 echo " --pkg-config=PKG-CONFIG the pkg-config to use in configure [pkg-config]"
3441 echo " --lipo=LIPO the lipo to use (OSX ONLY) [HOST-lipo]"
3442 echo " --os=OS the OS we are compiling for [DETECT]"
3443 echo " DETECT/UNIX/OSX/FREEBSD/DRAGONFLY/OPENBSD/"
3444 echo " NETBSD/MORPHOS/HPUX/BEOS/SUNOS/CYGWIN/"
3445 echo " MINGW/OS2/DOS/WINCE/PSP/HAIKU"
3446 echo " --endian=ENDIAN set the endian of the HOST (AUTO/LE/BE)"
3449 echo " --prefix-dir=dir specifies the prefix for all installed"
3450 echo " files [/usr/local]"
3451 echo " --binary-dir=dir location of the binary. Will be prefixed"
3452 echo " with the prefix-dir [games]"
3453 echo " --data-dir=dir location of data files (lang, data, gm)."
3454 echo " Will be prefixed with the prefix-dir"
3455 echo " [share/games/openttd]"
3456 echo " --doc-dir=dir location of the doc files"
3457 echo " Will be prefixed with the prefix-dir"
3459 echo " --icon-dir=dir location of icons. Will be prefixed"
3460 echo " with the prefix-dir [share/pixmaps]"
3461 echo " --icon-theme-dir=dir location of icon theme."
3462 echo " Will be prefixed with the prefix-dir"
3463 echo " and postfixed with size-dirs [$icon_theme_dir]"
3464 echo " --man-dir=dir location of the manual page (UNIX only)"
3465 echo " Will be prefixed with the prefix-dir"
3467 echo " --menu-dir=dir location of the menu item. (UNIX only, except OSX)"
3468 echo " Will be prefixed with the prefix-dir"
3469 echo " [share/applications]"
3470 echo " --personal-dir=dir location of the personal directory"
3471 echo " [os-dependent default]"
3472 echo " --shared-dir=dir location of shared data files"
3473 echo " [os-dependent default]"
3474 echo " --install-dir=dir specifies the root to install to."
3475 echo " Useful to install into jails [/]"
3476 echo " --binary-name the name used for the binary, icons,"
3477 echo " desktop file, etc. when installing [openttd]"
3479 echo "Features and packages:"
3480 echo " --enable-debug[=LVL] enable debug-mode (LVL=[0123], 0 is release)"
3481 echo " --enable-desync-debug=[LVL] enable desync debug options (LVL=[012], 0 is none"
3482 echo " --enable-profiling enables profiling"
3483 echo " --enable-lto enables GCC's Link Time Optimization (LTO)/ICC's"
3484 echo " Interprocedural Optimization if available"
3485 echo " --enable-dedicated compile a dedicated server (without video)"
3486 echo " --enable-static enable static compile (doesn't work for"
3488 echo " --enable-translator enable extra output for translators"
3489 echo " --enable-universal[=ARCH] enable universal builds (OSX ONLY). Allowed is any combination"
3490 echo " of architectures: i386 ppc ppc970 ppc64 x86_64"
3491 echo " Default architectures are: i386 ppc"
3492 echo " --enable-osx-g5 enables optimizations for ppc970 (G5) (OSX ONLY)"
3493 echo " --disable-cocoa-quartz disable the quartz window mode driver for Cocoa (OSX ONLY)"
3494 echo " --disable-cocoa-quickdraw disable the quickdraw window mode driver for Cocoa (OSX ONLY)"
3495 echo " --disable-unicode disable unicode support to build win9x"
3496 echo " version (Win32 ONLY)"
3497 echo " --enable-console compile as a console application instead of as a GUI application."
3498 echo " If this setting is active, debug output will appear in the same"
3499 echo " console instead of opening a new window. (Win32 ONLY)"
3500 echo " --disable-network disable network support"
3501 echo " --disable-assert disable asserts (continue on errors)"
3502 echo " --enable-strip enable any possible stripping"
3503 echo " --without-osx-sysroot disable the automatic adding of sysroot "
3505 echo " --without-application-bundle disable generation of application bundle"
3507 echo " --without-menu-entry Don't generate a menu item (Freedesktop based only)"
3508 echo " --menu-group=group Category in which the menu item will be placed (Freedesktop based only)"
3509 echo " --menu-name=name Name of the menu item when placed [OpenTTD]"
3510 echo " --with-direct-music enable direct music support (Win32 ONLY)"
3511 echo " --with-sort=sort define a non-default location for sort"
3512 echo " --with-midi=midi define which midi-player to use"
3513 echo " --with-midi-arg=arg define which args to use for the"
3515 echo " --with-libtimidity[=\"pkg-config libtimidity\"]"
3516 echo " enables libtimidity support"
3517 echo " --with-allegro[=\"pkg-config allegro\"]"
3518 echo " enables Allegro video driver support"
3519 echo " --with-cocoa enables COCOA video driver (OSX ONLY)"
3520 echo " --with-sdl[=\"pkg-config sdl\"] enables SDL video driver support"
3521 echo " --with-zlib[=\"pkg-config zlib\"]"
3522 echo " enables zlib support"
3523 echo " --with-liblzma[=\"pkg-config liblzma\"]"
3524 echo " enables liblzma support"
3525 echo " --with-liblzo2[=liblzo2.a] enables liblzo2 support"
3526 echo " --with-png[=\"pkg-config libpng\"]"
3527 echo " enables libpng support"
3528 echo " --with-freetype[=\"pkg-config freetype2\"]"
3529 echo " enables libfreetype support"
3530 echo " --with-fontconfig[=\"pkg-config fontconfig\"]"
3531 echo " enables fontconfig support"
3532 echo " --with-xdg-basedir[=\"pkg-config libxdg-basedir\"]"
3533 echo " enables XDG base directory support"
3534 echo " --with-icu enables icu components for layout and sorting"
3535 echo " --with-icu-layout[=\"pkg-config icu-lx\"]"
3536 echo " enables icu components for layouting (right-to-left support)"
3537 echo " --with-icu-sort[=\"pkg-config icu-i18n\"]"
3538 echo " enables icu components for locale specific string sorting"
3539 echo " --static-icu try to link statically (libsicu instead of"
3540 echo " libicu; can fail as the new name is guessed)"
3541 echo " --with-iconv[=iconv-path] enables iconv support"
3542 echo " --with-psp-config[=psp-config] enables psp-config support (PSP ONLY)"
3543 echo " --disable-builtin-depend disable use of builtin deps finder"
3544 echo " --with-makedepend[=makedepend] enables makedepend support"
3545 echo " --with-ccache enables ccache support"
3546 echo " --with-distcc enables distcc support"
3547 echo " --without-grfcodec disable usage of grfcodec and re-generation of base sets"
3548 echo " --without-threads disable threading support"
3549 echo " --without-sse disable SSE support (x86/x86_64 only)"
3551 echo "Some influential environment variables:"
3552 echo " CC C compiler command"
3553 echo " CXX C++ compiler command"
3554 echo " CFLAGS C compiler flags"
3555 echo " CXXFLAGS C++ compiler flags"
3556 echo " WINDRES windres command"
3557 echo " LDFLAGS linker flags, e.g. -L<lib dir> if you"
3558 echo " have libraries in a nonstandard"
3559 echo " directory <lib dir>"
3560 echo " CFLAGS_BUILD C compiler flags for build time tool generation"
3561 echo " CXXFLAGS_BUILD C++ compiler flags for build time tool generation"
3562 echo " LDFLAGS_BUILD linker flags for build time tool generation"
3564 echo "Use these variables to override the choices made by 'configure' or to help"
3565 echo "it to find libraries and programs with nonstandard names/locations."