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"
143 enable_cocoa_quickdraw
145 with_application_bundle
154 enable_builtin_depend
173 CC CXX CFLAGS CXXFLAGS LDFLAGS CFLAGS_BUILD CXXFLAGS_BUILD LDFLAGS_BUILD"
177 # Walk over all params from the user and override any default settings if
178 # needed. This also handles any invalid option.
180 if [ -n "$prev_p" ]; then
186 optarg=`expr "x$p" : 'x[^=]*=\(.*\)'`
189 --help | -h | -\?) showhelp; exit 0;;
191 --config-log) prev_p="config_log";;
192 --config-log=*) config_log="$optarg";;
194 --build) prev_p="build";;
195 --build=*) build="$optarg";;
197 --host) prev_p="host";;
198 --host=*) host="$optarg";;
201 --os=*) os="$optarg";;
203 --cpu-type) prev_p="cpu_type";;
204 --cpu-type=*) cpu_type="$optarg";;
206 --cc-build) prev_p="cc_build";;
207 --cc-build=*) cc_build="$optarg";;
208 --cc-host) prev_p="cc_host";;
209 --cc-host=*) cc_host="$optarg";;
210 --cxx-build) prev_p="cxx_build";;
211 --cxx-build=*) cxx_build="$optarg";;
212 --cxx-host) prev_p="cxx_host";;
213 --cxx-host=*) cxx_host="$optarg";;
214 --windres) prev_p="windres";;
215 --windres=*) windres="$optarg";;
216 --awk) prev_p="awk";;
217 --awk=*) awk="$optarg";;
218 --pkg-config) prev_p="pkg_config";;
219 --pkg-config=*) pkg_config="$optarg";;
220 --strip) prev_p="strip";;
221 --strip=*) strip="$optarg";;
222 --lipo) prev_p="lipo";;
223 --lipo=*) lipo="$optarg";;
225 --endian) prev_p="endian";;
226 --endian=*) endian="$optarg";;
230 # Alias --prefix with --prefix-dir, for compatibility with GNU autotools
231 --prefix-dir | --prefix) prev_p="prefix_dir";;
232 --prefix-dir=* | --prefix=*) prefix_dir="$optarg";;
234 --binary-dir) prev_p="binary_dir";;
235 --binary-dir=*) binary_dir="$optarg";;
237 --data-dir) prev_p="data_dir";;
238 --data-dir=*) data_dir="$optarg";;
240 --doc-dir) prev_p="doc_dir";;
241 --doc-dir=*) doc_dir="$optarg";;
243 --icon-dir) prev_p="icon_dir";;
244 --icon-dir=*) icon_dir="$optarg";;
246 --icon-theme-dir) prev_p="icon_theme_dir";;
247 --icon-theme-dir=*) icon_theme_dir="$optarg";;
248 --without-icon-theme) icon_theme_dir="";;
250 --menu-dir) prev_p="menu_dir";;
251 --menu-dir=*) menu_dir="$optarg";;
252 --without-menu-entry) menu_dir="";;
254 --menu-name) prev_p="menu_name";;
255 --menu-name=*) menu_name="$optarg";;
257 --binary-name) prev_p="binary_name";;
258 --binary-name=*) binary_name="$optarg";;
260 --man-dir) prev_p="man_dir";;
261 --man-dir=*) man_dir="$optarg";;
263 --personal-dir) prev_p="personal_dir";;
264 --personal-dir=*) personal_dir="$optarg";;
265 --without-personal-dir) personal_dir="";;
267 --shared-dir) prev_p="shared_dir";;
268 --shared-dir=*) shared_dir="$optarg";;
269 --without-shared-dir) shared_dir="";;
271 --install-dir) prev_p="install_dir";;
272 --install-dir=*) install_dir="$optarg";;
276 --menu-group) prev_p="menu_group";;
277 --menu-group=*) menu_group="$optarg";;
281 --enable-debug) enable_debug="1";;
282 --enable-debug=*) enable_debug="$optarg";;
283 --enable-desync-debug) enable_desync_debug="1";;
284 --enable-desync-debug=*) enable_desync_debug="$optarg";;
285 --enable-profiling) enable_profiling="1";;
286 --enable-profiling=*) enable_profiling="$optarg";;
287 --enable-lto) enable_lto="1";;
288 --enable-lto=*) enable_lto="$optarg";;
289 --enable-ipo) enable_lto="1";;
290 --enable-ipo=*) enable_lto="$optarg";;
291 --enable-dedicated) enable_dedicated="1";;
292 --enable-dedicated=*) enable_dedicated="$optarg";;
293 --enable-network) enable_network="2";;
294 --enable-network=*) enable_network="$optarg";;
295 --disable-network) enable_network="0";;
296 --disable-static) enable_static="0";;
297 --enable-static) enable_static="2";;
298 --enable-static=*) enable_static="$optarg";;
299 --disable-translator) enable_translator="0";;
300 --enable-translator) enable_translator="2";;
301 --enable-translator=*) enable_translator="$optarg";;
302 --disable-assert) enable_assert="0";;
303 --enable-assert) enable_assert="2";;
304 --enable-assert=*) enable_assert="$optarg";;
305 --disable-strip) enable_strip="0";;
306 --enable-strip) enable_strip="2";;
307 --enable-strip=*) enable_strip="$optarg";;
308 --disable-universal) enable_universal="0";;
309 --enable-universal) enable_universal="i386 ppc";;
310 --enable-universal=*) enable_universal="$optarg";;
311 --disable-osx-g5) enable_osx_g5="0";;
312 --enable-osx-g5) enable_osx_g5="2";;
313 --enable-osx-g5=*) enable_osx_g5="$optarg";;
314 --disable-unicode) enable_unicode="0";;
315 --enable-unicode) enable_unicode="2";;
316 --enable-unicode=*) enable_unicode="$optarg";;
317 --disable-console) enable_console="0";;
318 --enable-console) enable_console="2";;
319 --enable-console=*) enable_console="$optarg";;
321 --disable-cocoa-quartz) enable_cocoa_quartz="0";;
322 --enable-cocoa-quartz) enable_cocoa_quartz="2";;
323 --enable-cocoa-quartz=*) enable_cocoa_quartz="$optarg";;
324 --disable-cocoa-quickdraw) enable_cocoa_quickdraw="0";;
325 --enable-cocoa-quickdraw) enable_cocoa_quickdraw="2";;
326 --enable-cocoa-quickdraw=*) enable_cocoa_quickdraw="$optarg";;
328 --with-allegro) with_allegro="2";;
329 --without-allegro) with_allegro="0";;
330 --with-allegro=*) with_allegro="$optarg";;
332 --with-sdl) with_sdl="2";;
333 --without-sdl) with_sdl="0";;
334 --with-sdl=*) with_sdl="$optarg";;
336 --with-cocoa) with_cocoa="2";;
337 --without-cocoa) with_cocoa="0";;
338 --with-cocoa=*) with_cocoa="$optarg";;
340 --with-zlib) with_zlib="2";;
341 --without-zlib) with_zlib="0";;
342 --with-zlib=*) with_zlib="$optarg";;
344 --with-lzma) with_lzma="2";;
345 --without-lzma) with_lzma="0";;
346 --with-lzma=*) with_lzma="$optarg";;
347 --with-liblzma) with_lzma="2";;
348 --without-liblzma) with_lzma="0";;
349 --with-liblzma=*) with_lzma="$optarg";;
351 --with-lzo2) with_lzo2="2";;
352 --without-lzo2) with_lzo2="0";;
353 --with-lzo2=*) with_lzo2="$optarg";;
354 --with-liblzo2) with_lzo2="2";;
355 --without-liblzo2) with_lzo2="0";;
356 --with-liblzo2=*) with_lzo2="$optarg";;
358 --with-xdg-basedir) with_xdg_basedir="2";;
359 --without-xdg-basedir) with_xdg_basedir="0";;
360 --with-xdg-basedir=*) with_xdg_basedir="$optarg";;
361 --with-libxdg-basedir) with_xdg_basedir="2";;
362 --without-libxdg-basedir) with_xdg_basedir="0";;
363 --with-libxdg-basedir=*) with_xdg_basedir="$optarg";;
365 --with-png) with_png="2";;
366 --without-png) with_png="0";;
367 --with-png=*) with_png="$optarg";;
368 --with-libpng) with_png="2";;
369 --without-libpng) with_png="0";;
370 --with-libpng=*) with_png="$optarg";;
372 --with-libtimidity) with_libtimidity="2";;
373 --without-libtimidity) with_libtimidity="0";;
374 --with-libtimidity=*) with_libtimidity="$optarg";;
376 --with-freetype) with_freetype="2";;
377 --without-freetype) with_freetype="0";;
378 --with-freetype=*) with_freetype="$optarg";;
379 --with-libfreetype) with_freetype="2";;
380 --without-libfreetype) with_freetype="0";;
381 --with-libfreetype=*) with_freetype="$optarg";;
383 --with-fontconfig) with_fontconfig="2";;
384 --without-fontconfig) with_fontconfig="0";;
385 --with-fontconfig=*) with_fontconfig="$optarg";;
386 --with-libfontconfig) with_fontconfig="2";;
387 --without-libfontconfig) with_fontconfig="0";;
388 --with-libfontconfig=*) with_fontconfig="$optarg";;
390 --with-icu) with_icu="2";;
391 --without-icu) with_icu="0";;
392 --with-icu=*) with_icu="$optarg";;
393 --with-libicu) with_icu="2";;
394 --without-libicu) with_icu="0";;
395 --with-libicu=*) with_icu="$optarg";;
396 --static-icu) static_icu="1";;
397 --static-icu=*) static_icu="$optarg";;
398 --static-libicu) static_icu="1";;
399 --static-libicu=*) static_icu="$optarg";;
401 --with-psp-config) with_psp_config="2";;
402 --without-psp-config) with_psp_config="0";;
403 --with-psp-config=*) with_psp_config="$optarg";;
405 --disable-builtin-depend) enable_builtin_depend="0";;
406 --enable-builtin-depend) enable_builtin_depend="2";;
407 --enable-builtin-depend=*) enable_builtin_depend="$optarg";;
409 --with-makedepend) with_makedepend="2";;
410 --without-makedepend) with_makedepend="0";;
411 --with-makedepend=*) with_makedepend="$optarg";;
413 --with-direct-music) with_direct_music="2";;
414 --without-direct-music) with_direct_music="0";;
415 --with-direct-music=*) with_direct_music="$optarg";;
417 --with-sort) with_sort="2";;
418 --without-sort) with_sort="0";;
419 --with-sort=*) with_sort="$optarg";;
421 --with-iconv) with_iconv="2";;
422 --without-iconv) with_iconv="0";;
423 --with-iconv=*) with_iconv="$optarg";;
425 --with-midi=*) with_midi="$optarg";;
426 --with-midi-arg=*) with_midi_arg="$optarg";;
428 --without-distcc) with_distcc="0";;
429 --with-distcc) with_distcc="2";;
430 --with-distcc=*) with_distcc="$optarg";;
432 --without-ccache) with_ccache="0";;
433 --with-ccache) with_ccache="2";;
434 --with-ccache=*) with_ccache="$optarg";;
436 --without-nforenum) with_nforenum="0";;
437 --with-nforenum) with_nforenum="2";;
438 --with-nforenum=*) with_nforenum="$optarg";;
440 --without-grfcodec) with_grfcodec="0";;
441 --with-grfcodec) with_grfcodec="2";;
442 --with-grfcodec=*) with_grfcodec="$optarg";;
444 --without-osx-sysroot) with_osx_sysroot="0";;
445 --with-osx-sysroot) with_osx_sysroot="2";;
446 --with-osx-sysroot=*) with_osx_sysroot="$optarg";;
448 --without-application-bundle) with_application_bundle="0";;
449 --with-application-bundle) with_application_bundle="1";;
450 --with-application-bundle=*) with_application_bundle="$optarg";;
452 --without-threads) with_threads="0";;
453 --with-threads) with_threads="1";;
454 --with-threads=*) with_threads="$optarg";;
456 --without-sse) with_sse="0";;
457 --with-sse) with_sse="1";;
458 --with-sse=*) with_sse="$optarg";;
460 CC=* | --CC=*) CC="$optarg";;
461 CXX=* | --CXX=*) CXX="$optarg";;
462 CFLAGS=* | --CFLAGS=*) CFLAGS="$optarg";;
463 CXXFLAGS=* | --CXXFLAGS=*) CXXFLAGS="$optarg";;
464 LDFLAGS=* | --LDFLAGS=*) LDFLAGS="$optarg";;
465 CFLAGS_BUILD=* | --CFLAGS_BUILD=* | --CFLAGS-BUILD=*) CFLAGS_BUILD="$optarg";;
466 CXXFLAGS_BUILD=* | --CXXFLAGS_BUILD=* | --CXXFLAGS-BUILD=*) CXXFLAGS_BUILD="$optarg";;
467 LDFLAGS_BUILD=* | --LDFLAGS_BUILD=* | --LDFLAGS-BUILD=*) LDFLAGS_BUILD="$optarg";;
469 --ignore-extra-parameters) ignore_extra_parameters="1";;
472 if [ "$ignore_extra_parameters" = "0" ]; then
473 log 1 "Unknown option $p"
476 log 1 "Unknown option $p ignored"
482 if [ -n "$prev_p" ]; then
483 log 1 "configure: error: missing argument to --$prev_p"
488 echo "" > $config_log
489 log 2 "Invocation: $0 $*"
493 # Here we save all params, so we can later on do an exact redo of this
494 # configuration, without having the user to re-input stuff
496 echo "Running configure with following options:" >> $config_log
497 echo "" >> $config_log
499 configure="$CONFIGURE_EXECUTABLE --ignore-extra-parameters"
500 for p in $save_params_array; do
502 p=`echo "$p" | sed 's@_@-@g;s@\n@@g;s@ @\\ @g'`
503 # Only save those params that aren't empty
504 configure="$configure --$p=\"$v\""
507 echo "$configure" >> $config_log
508 echo "$configure" > config.cache
509 echo "" >> $config_log
513 # Some params want to be in full uppercase, else they might not work as
514 # expected.. fix that here
516 endian=`echo $endian | tr '[a-z]' '[A-Z]'`
517 os=`echo $os | tr '[a-z]' '[A-Z]'`
518 cpu_type=`echo $cpu_type | tr '[a-z]' '[A-Z]'`
520 # Check if all params have valid values
522 # Endian only allows AUTO, LE and, BE
523 if ! echo $endian | egrep -q '^(AUTO|LE|BE|PREPROCESSOR)$'; then
524 log 1 "configure: error: invalid option --endian=$endian"
525 log 1 " Available options are: --endian=[AUTO|LE|BE]"
528 if [ "$endian" = "PREPROCESSOR" ] && [ "$os" != "OSX" ]; then
529 log 1 "configure: error: invalid option --endian=$endian"
530 log 1 " PREPROCESSOR is only available for OSX"
533 # OS only allows DETECT, UNIX, OSX, FREEBSD, DRAGONFLY, OPENBSD, NETBSD, MORPHOS, BEOS, HAIKU, SUNOS, CYGWIN, MINGW, OS2, DOS, WINCE, and PSP
534 if ! echo $os | egrep -q '^(DETECT|UNIX|OSX|FREEBSD|DRAGONFLY|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|HAIKU|SUNOS|CYGWIN|MINGW|OS2|DOS|WINCE|PSP)$'; then
535 log 1 "configure: error: invalid option --os=$os"
536 log 1 " Available options are: --os=[DETECT|UNIX|OSX|FREEBSD|DRAGONFLY|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|HAIKU|SUNOS|CYGWIN|MINGW|OS2|DOS|WINCE|PSP]"
539 # cpu_type can be either 32 or 64
540 if ! echo $cpu_type | egrep -q '^(32|64|DETECT)$'; then
541 log 1 "configure: error: invalid option --cpu-type=$cpu_type"
542 log 1 " Available options are: --cpu-type[=DETECT|32|64]"
545 # enable_debug should be between 0 and 4
546 if ! echo $enable_debug | egrep -q '^[0123]$'; then
547 log 1 "configure: error: invalid option --enable-debug=$enable_debug"
548 log 1 " Available options are: --enable-debug[=0123]"
552 # enable_desync_debug should be between 0 and 3
553 if ! echo $enable_desync_debug | egrep -q '^[012]$'; then
554 log 1 "configure: error: invalid option --enable-desync-debug=$enable_desync_debug"
555 log 1 " Available options are: --enable-desync-debug[=012]"
566 # Check for universal builds; they only make sense for OSX, so fail if enabled for another OS
567 if [ "$enable_universal" = "0" ]; then
568 log 1 "checking universal build... no"
570 if [ "$os" != "OSX" ]; then
571 log 1 "configure: error: --enable-universal only works on OSX"
574 log 1 "checking universal build... yes, for: $enable_universal"
577 # Already detected by check_build
578 log 1 "checking build cc... $cc_build"
579 log 1 "checking host cc... $cc_host"
584 if [ "$enable_strip" != "0" ]; then
587 log 1 "checking strip... disabled"
591 if [ "$enable_builtin_depend" != "0" ]; then
592 log 1 "checking builtin depend... yes"
593 makedepend="\$(SRC_OBJS_DIR)/\$(DEPEND)"
595 log 1 "checking builtin depend... no"
600 detect_sse_capable_architecture
602 if [ "$enable_static" = "1" ]; then
603 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "MORPHOS" ] || [ "$os" = "DOS" ]; then
610 if [ "$enable_static" != "0" ]; then
611 log 1 "checking static... yes"
613 if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "OSX" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "DOS" ]; then
614 log 1 "WARNING: static is only known to work on Windows, DOS, MacOSX and MorphOS"
615 log 1 "WARNING: use static at your own risk on this platform"
620 log 1 "checking static... no"
623 if [ "$enable_unicode" = "1" ]; then
624 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "DOS" ]; then
631 if [ "$enable_unicode" != "0" ]; then
632 log 1 "checking unicode... yes"
634 log 1 "checking unicode... no"
637 # Show what we configured
638 if [ "$enable_debug" = "0" ]; then
639 log 1 "using debug level... no"
640 elif [ "$enable_profiling" != "0" ]; then
641 log 1 "using debug level... profiling (debug level $enable_debug)"
643 log 1 "using debug level... level $enable_debug"
646 if [ "$enable_desync_debug" = "0" ]; then
647 log 1 "using desync debug level... no"
649 log 1 "using desync debug level... level $enable_desync_debug"
650 log 1 "WARNING: desync debug functions slow down the game considerably."
651 log 1 "WARNING: use only when you are instructed to do so"
652 log 1 " or when you know what you are doing."
657 if [ "$enable_lto" != "0" ]; then
658 # GCC 4.5 outputs '%{flto}', GCC 4.6 outputs '%{flto*}'
659 if $cxx_build -dumpspecs 2>&1 | grep -q '\%{flto' || $cxx_build -help ipo 2>&1 | grep -q '\-ipo'; then
660 log 1 "using link time optimization... yes"
663 log 1 "using link time optimization... no"
664 log 1 "WARNING: you selected link time optimization but it is not found."
668 log 1 "using link time optimization... no"
672 if [ "$os" != "OSX" ] && [ "$with_osx_sysroot" != "0" ]; then
673 if [ "$with_osx_sysroot" = "1" ]; then
676 log 1 "checking OSX sysroot... not OSX, skipping"
678 log 1 "configure: error: --with-osx-sysroot only works if OSX is the target"
683 if [ "$with_osx_sysroot" != "0" ]; then
684 if [ "$enable_universal" = "0" ] && [ "$with_osx_sysroot" != "1" ] && [ "$with_osx_sysroot" != "2" ]; then
685 # Sysroot manually specified? Check for usability
686 log 1 "checking OSX sysroot... $with_osx_sysroot"
687 if ! check_osx_sdk "$with_osx_sysroot"; then
688 log 1 "Passed sysroot not found/not functional"
692 # If autodetect and no universal, use system default
693 if [ "$with_osx_sysroot" = "1" ] && [ "$enable_universal" = "0" ]; then
694 log 1 "checking OSX sysroot... no (use system default)"
696 log 1 "checking OSX sysroot... automatically"
701 if [ -n "$osx_sdk_path" ]; then
702 if [ "$enable_universal" != "0" ]; then
703 if [ -z "$osx_sdk_104_path" ]; then
704 log 1 "WARNING: Could not find a usable 10.4u SDK, the resulting"
705 log 1 "WARNING: binary will only run on OSX 10.5 or later"
706 osx_sdk_104_path="$osx_sdk_path"
708 OSX_SYSROOT="-isysroot $osx_sdk_104_path"
709 OSX_LD_SYSROOT="-Wl,-syslibroot,$osx_sdk_104_path"
711 OSX_SYSROOT="-isysroot $osx_sdk_path"
712 OSX_LD_SYSROOT="-Wl,-syslibroot,$osx_sdk_path"
716 if [ "$os" = "OSX" ]; then
717 log 1 "checking OSX sysroot... no (use system default)"
725 if [ "$enable_dedicated" != "0" ]; then
726 log 1 "checking GDI video driver... dedicated server, skipping"
727 log 1 "checking dedicated... found"
729 if [ "$enable_network" = "0" ]; then
730 log 1 "configure: error: building a dedicated server without network support is pointless"
734 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ]; then
735 log 1 "checking GDI video driver... found"
737 log 1 "checking GDI video driver... not Windows, skipping"
740 if [ -z "$allegro_config" ] && [ -z "$sdl_config" ] && [ "$with_cocoa" = 0 ] && [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "WINCE" ]; then
741 log 1 "configure: error: no video driver development files found"
742 log 1 " If you want a dedicated server use --enable-dedicated as parameter"
745 log 1 "checking dedicated... not selected"
749 if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then
750 log 1 "checking console application... not Windows, skipping"
751 elif [ "$enable_console" = "1" ] && [ "$enable_dedicated" != "0" ]; then
752 log 1 "checking console application... dedicated server, enabled"
754 elif [ "$enable_console" = "1" ]; then
755 log 1 "checking console application... disabled (only used when forced)"
757 elif [ "$enable_console" = "0" ]; then
758 log 1 "checking console application... disabled"
760 log 1 "checking console application... enabled"
763 if [ "$enable_network" = "1" ] && [ "$os" = "DOS" ]; then
764 log 1 "checking network... DOS, skipping"
766 elif [ "$enable_network" != "0" ]; then
767 log 1 "checking network... found"
769 log 1 "checking network... disabled"
772 log 1 "checking squirrel... found"
773 SCRIPT_SRC_DIR="$ROOT_DIR/src/3rdparty/squirrel/include"
775 if [ "$enable_translator" != "0" ]; then
776 log 1 "checking translator... debug"
777 # -t shows TODO items, normally they are muted
780 log 1 "checking translator... no"
784 if [ "$enable_assert" != "0" ]; then
785 log 1 "checking assert... enabled"
787 log 1 "checking assert... disabled"
790 pre_detect_with_zlib=$with_zlib
793 if [ "$with_zlib" = "0" ] || [ -z "$zlib-config" ]; then
794 log 1 "WARNING: zlib was not detected or disabled"
795 log 1 "WARNING: OpenTTD doesn't require zlib, but it does mean that many features"
796 log 1 "WARNING: (like loading most old savegames/scenarios, loading heightmaps,"
797 log 1 "WARNING: using PNG, or using fonts, ...) will be disabled."
798 if [ "$pre_detect_with_zlib" = "0" ]; then
799 log 1 "WARNING: We strongly suggest you to install zlib."
801 log 1 "configure: error: no zlib detected"
802 log 1 " If you want to compile without zlib use --without-zlib as parameter"
807 pre_detect_with_lzma=$with_lzma
810 if [ "$with_lzma" = "0" ] || [ -z "$lzma_config" ]; then
811 log 1 "WARNING: lzma was not detected or disabled"
812 log 1 "WARNING: OpenTTD doesn't require lzma, but it does mean that many features"
813 log 1 "WARNING: (like loading most savegames/scenarios and joining most servers)"
814 log 1 "WARNING: will be disabled."
815 if [ "$pre_detect_with_lzma" = "0" ]; then
816 log 1 "WARNING: We strongly suggest you to install liblzma."
817 log 1 "configure: error: no liblzma detected"
819 log 1 " If you want to compile without lzma use --without-lzma as parameter"
824 pre_detect_with_lzo2=$with_lzo2
827 if [ "$with_lzo2" = "0" ] || [ -z "$lzo2" ]; then
828 log 1 "WARNING: liblzo2 was not detected or disabled"
829 log 1 "WARNING: OpenTTD doesn't require liblzo2, but it does mean that"
830 log 1 "WARNING: loading old savegames/scenarios will be disabled."
831 if [ "$pre_detect_with_lzo2" = "0" ]; then
832 log 1 "WARNING: We strongly suggest you to install liblzo2."
834 log 1 "configure: error: no liblzo2 detected"
835 log 1 " If you want to compile without liblzo2 use --without-liblzo2 as parameter"
848 if [ "$with_direct_music" != "0" ]; then
849 if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then
850 if [ "$with_direct_music" != "1" ]; then
851 log 1 "configure: error: direct-music is only supported on Win32 targets"
854 with_direct_music="0"
856 log 1 "checking direct-music... not Windows, skipping"
864 if [ "$os" = "OSX" ] && [ "$endian" = "AUTO" ]; then
865 endian="PREPROCESSOR"
868 log 1 "checking endianness... $endian"
870 # Suppress language errors when there is a version defined, indicating a release
871 # It just isn't pretty if any release produces warnings in the languages.
872 if [ -f "$ROOT_DIR/version" ]; then
874 log 1 "suppress language errors... yes"
877 log 1 "suppress language errors... no"
880 if [ "$enable_debug" = "0" ] && [ "$enable_profiling" = "0" ] && [ "$enable_strip" != "0" ]; then
881 if [ "$os" = "MORPHOS" ]; then
882 strip_arg="--strip-all --strip-unneeded --remove-section .comment"
883 elif [ "$os" = "OSX" ]; then
885 elif [ "$os" = "OS2" ]; then
887 # OS2 uses strip via gcc, because it needs to be feed to emxbind
888 LDFLAGS="$LDFLAGS -s"
889 elif [ "$os" = "SUNOS" ]; then
890 # The GNU strip does know -s, the non-GNU doesn't
891 # So try to detect it (in a bit of an ugly way)
892 strip_arg="`$strip -s strip.test 2>/dev/null && echo \"-s\"`"
897 log 1 "checking stripping... $strip $strip_arg"
900 log 1 "checking stripping... skipped"
903 if [ "$with_distcc" = "0" ]; then
904 log 1 "checking distcc... no"
905 elif [ "$with_distcc" = "1" ]; then
908 log 1 "checking distcc... no (only used when forced)"
909 elif [ "$with_distcc" = "2" ]; then
912 distcc="$with_distcc"
914 if [ "$with_distcc" != "0" ]; then
915 res="`$distcc --version 2>/dev/null | head -n 1 | cut -b 1-6`"
916 if [ "$res" != "distcc" ]; then
918 log 1 "checking distcc... no"
919 if [ "$with_distcc" = "2" ]; then
920 log 1 "configure: error: no distcc detected, but was forced to be used"
923 if [ "$with_distcc" != "1" ]; then
924 log 1 "configure: error: '$with_distcc' doesn't seem a distcc to me"
929 log 1 "checking distcc... $distcc"
932 if [ "$with_ccache" = "0" ]; then
933 log 1 "checking ccache... no"
934 elif [ "$with_ccache" = "1" ]; then
937 log 1 "checking ccache... no (only used when forced)"
938 elif [ "$with_ccache" = "2" ]; then
941 ccache="$with_ccache"
943 if [ "$with_ccache" != "0" ]; then
944 res="`$ccache --version 2>/dev/null | head -n 1 | cut -b 1-6`"
945 if [ "$res" != "ccache" ]; then
947 log 1 "checking ccache... no"
948 if [ "$with_ccache" = "2" ]; then
949 log 1 "configure: error: no ccache detected, but was forced to be used"
952 if [ "$with_ccache" != "1" ]; then
953 log 1 "configure: error: '$with_ccache' doesn't seem a ccache to me"
958 log 1 "checking ccache... $ccache"
964 if [ -z "$grfcodec" ] && [ -n "$nforenum" ]; then
965 log 1 "checking nforenum/grfcodec... nforenum needs grfcodec enabled, disabling nforenum"
969 if [ -z "$nforenum" ] && [ -n "$grfcodec" ]; then
970 log 1 "checking nforenum/grfcodec... grfcodec needs nforenum enabled, disabling grfcodec"
974 if [ "$os" = "DOS" ]; then
978 if [ "$os" != "OSX" ] && [ "$with_application_bundle" != "0" ]; then
979 if [ "$with_application_bundle" = "1" ]; then
980 with_application_bundle="0"
982 log 1 "checking OSX application bundle... not OSX, skipping"
984 log 1 "configure: error: --with-application-bundle only works if OSX is the target"
989 if [ "$os" = "OSX" ] && [ "$with_application_bundle" = "1" ]; then
995 if [ "$os" = "OSX" ]; then
996 # Test on ppc970 (G5) - we can optimize there
998 if [ "$enable_osx_g5" != "0" ]; then
999 log 1 "detecting ppc970 (G5)... yes (forced)"
1001 # First, are we a real OSX system, else we can't detect it
1002 native=`LC_ALL=C uname | tr '[A-Z]' '[a-z]' | grep darwin`
1003 # If $host doesn't match $build , we are cross-compiling
1004 if [ -n "$native" ] && [ "$build" = "$host" ]; then
1005 $cxx_build $SRC_DIR/os/macosx/G5_detector.cpp -o G5_detector
1008 if [ -n "$res" ]; then
1009 # This is G5, add flags for it
1012 log 1 "detecting ppc970 (G5)... yes"
1016 log 1 "detecting ppc970 (G5)... no"
1021 log 1 "detecting ppc970 (G5)... no (cross-compiling)"
1025 if [ "$enable_osx_g5" != "0" ]; then
1026 log 1 "configure: error: ppc970 (OSX G5) selected, but not compiling for OSX"
1027 log 1 "configure: error: either select OSX as OS, or deselect ppc970"
1033 if [ -d "$ROOT_DIR/.svn" ] && [ -n "`svn help 2>/dev/null`" ]; then
1034 log 1 "checking revision... svn detection"
1035 elif [ -d "$ROOT_DIR/../.svn" ] && [ -n "`svn help 2>/dev/null`" ] && LC_ALL=C svn info $ROOT_DIR/.. | grep -q '^URL:.*tags$'; then
1036 # subversion changed its behaviour; now not all folders have a .svn folder,
1037 # but only the root folder. Since making tags requires a (sparse) checkout
1038 # of the tags folder, the folder of the tag does not have a .svn folder
1039 # anymore and this fails to detect the subversion repository checkout.
1040 log 1 "checking revision... svn detection (tag)"
1041 elif [ -e "$ROOT_DIR/.git" ] && [ -n "`git help 2>/dev/null`" ]; then
1042 log 1 "checking revision... git detection"
1043 elif [ -d "$ROOT_DIR/.hg" ] && [ -n "`HGPLAIN= hg help 2>/dev/null`" ]; then
1044 log 1 "checking revision... hg detection"
1045 elif [ -f "$ROOT_DIR/.ottdrev" ]; then
1046 log 1 "checking revision... source tarball"
1048 log 1 "checking revision... no detection"
1049 log 1 "WARNING: there is no means to determine the version."
1050 log 1 "WARNING: please use a subversion, mercurial, or git checkout of OpenTTD."
1051 log 1 "WARNING: you can only join game servers that have been compiled without"
1052 log 1 "WARNING: version detection."
1053 log 1 "WARNING: there is a great chance you desync."
1054 log 1 "WARNING: USE WITH CAUTION!"
1059 if [ "$doc_dir" = "1" ]; then
1060 if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "DRAGONFLY" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ]; then
1061 doc_dir="share/doc/openttd"
1063 doc_dir="$data_dir/docs"
1066 doc_dir="`echo $doc_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1069 if [ "$icon_theme_dir" = "1" ]; then
1070 if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "DRAGONFLY" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ]; then
1071 icon_theme_dir="share/icons/hicolor"
1076 icon_theme_dir="`echo $icon_theme_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1079 if [ "$personal_dir" = "1" ]; then
1080 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ] || [ "$os" = "DOS" ] || [ "$os" = "HAIKU" ]; then
1081 personal_dir="OpenTTD"
1082 elif [ "$os" = "OSX" ]; then
1083 personal_dir="Documents/OpenTTD"
1085 personal_dir=".openttd"
1088 personal_dir="`echo $personal_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1091 if [ "$shared_dir" = "1" ]; then
1092 # we are using default values
1093 if [ "$os" = "OSX" ]; then
1094 shared_dir="/Library/Application\\\\ Support/OpenTTD"
1099 shared_dir="`echo $shared_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1102 if [ "$man_dir" = "1" ]; then
1103 # add manpage on UNIX systems
1104 if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "DRAGONFLY" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ] || [ "$os" = "OSX" ]; then
1105 man_dir="share/man/man6"
1110 man_dir="`echo $man_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1113 if [ "$menu_dir" = "1" ]; then
1114 # add a freedesktop menu item only for some UNIX systems
1115 if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "DRAGONFLY" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ]; then
1116 menu_dir="share/applications"
1121 menu_dir="`echo $menu_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1126 if [ -n "$personal_dir" ]
1128 log 1 "personal home directory... $personal_dir"
1130 log 1 "personal home directory... none"
1133 if [ -n "$shared_dir" ]
1135 log 1 "shared data directory... $shared_dir"
1137 log 1 "shared data directory... none"
1140 if [ -n "$install_dir" ]
1142 log 1 "installation directory... $install_dir"
1144 log 1 "installation directory... none"
1147 if [ -n "$icon_theme_dir" ]
1149 log 1 "icon theme directory... $icon_theme_dir"
1151 log 1 "icon theme directory... none"
1154 if [ -n "$man_dir" ]
1156 log 1 "manual page directory... $man_dir"
1158 log 1 "manual page directory... none"
1161 if [ -n "$menu_dir" ]
1163 log 1 "menu item directory... $menu_dir"
1165 log 1 "menu item directory... none"
1169 make_compiler_cflags() {
1172 # $2 - name of the cflags variable
1173 # $3 - name of the cxxflags variable
1174 # $4 - name of the ldflags variable
1175 # $5 - name of the features variable
1177 eval eval "flags=\\\$$2"
1178 eval eval "cxxflags=\\\$$3"
1179 eval eval "ldflags=\\\$$4"
1180 eval eval "features=\\\$$5"
1182 if [ `basename $1 | cut -c 1-3` = "icc" ]; then
1183 # Enable some things only for certain ICC versions
1184 cc_version=`$1 -dumpversion | cut -c 1-4 | sed s@\\\.@@g`
1186 flags="$flags -rdynamic"
1187 ldflags="$ldflags -rdynamic"
1189 if [ -z "$first_time_icc_check" ]; then
1190 first_time_icc_check=no
1191 if [ $cc_version -lt 90 ]; then
1192 log 1 "WARNING: you seem to be using a very old version of ICC"
1193 log 1 "WARNING: OpenTTD hasn't been tested with this version"
1195 elif [ $cc_version -lt 120 ]; then
1196 log 1 "WARNING: you seem to be using an unsupported ICC version"
1197 log 1 "WARNING: ICC older than 12.0 is known to fail to compile OpenTTD"
1202 flags="$flags -Wall"
1203 # remark #111: statement is unreachable
1204 flags="$flags -wd111"
1205 # remark #181: argument is incompatible with corresponding format string conversion
1206 # ICC is very picky about signedness of operands, warnings provided by GCC are enough
1207 flags="$flags -wd181"
1208 # remark #271: trailing comma is nonstandard
1209 flags="$flags -wd271"
1210 # remark #280: selector expression is constant
1211 flags="$flags -wd280"
1212 # remark #304: access control not specified ("public" by default)
1213 flags="$flags -wd304"
1214 # remark #383: value copied to temporary, reference to temporary used
1215 flags="$flags -wd383"
1216 # remark #444: destructor for base class ... is not virtual
1217 flags="$flags -wd444"
1218 # remark #593: variable ... was set but never used
1219 flags="$flags -wd593"
1220 # warning #654: overloaded virtual function ... is only partially overridden in class ...
1221 flags="$flags -wd654"
1222 # remark #810: conversion from ... to ... may lose significant bits
1223 flags="$flags -wd810"
1224 # remark #869: parameter ... was never referenced
1225 flags="$flags -wd869"
1226 # warning #873: function ... ::operator new ... has no corresponding operator delete ...
1227 flags="$flags -wd873"
1228 # remark #981: operands are evaluated in unspecified order
1229 flags="$flags -wd981"
1230 # remark #1418: external function definition with no prior declaration
1231 flags="$flags -wd1418"
1232 # remark #1419: external declaration in primary source file
1233 flags="$flags -wd1419"
1234 # remark #1572: floating-point equality and inequality
1235 flags="$flags -wd1572"
1236 # remark #1599: declaration hides variable/parameter ...
1237 flags="$flags -wd1599"
1238 # remark #1720: function ... ::operator new ... has no corresponding member operator delete ...
1239 flags="$flags -wd1720"
1241 if [ $cc_version -lt 110 ]; then
1242 # warns about system headers with recent glibc:
1243 # warning #1292: attribute "__nonnull__" ignored
1244 flags="$flags -wd1292"
1247 if [ $cc_version -ge 100 ]; then
1248 # warning #1899: multicharacter character literal (potential portability problem)
1249 flags="$flags -wd1899"
1250 # vec report defaults to telling where it did loop vectorisation, which is not very important
1251 flags="$flags -vec-report=0 "
1254 if [ $cc_version -ge 110 ]; then
1255 # remark #2259: non-pointer conversion from ... to ... may lose significant bits
1256 flags="$flags -wd2259"
1257 # Use c++0x mode so static_assert() is available
1258 cxxflags="$cxxflags -std=c++0x"
1261 if [ "$enable_lto" != "0" ] && $1 -help ipo | grep -q '\-ipo'; then
1262 # Use IPO (only if we see IPO exists and is requested)
1264 features="$features lto"
1266 elif basename $1 | grep -q 'clang'; then
1267 # Enable some things only for certain clang versions
1268 cc_version="`$1 -v 2>&1 | head -n 1 | sed s@[^0-9]@@g | cut -c 1-2`"
1270 # aliasing rules are not held in openttd code
1271 flags="$flags -fno-strict-aliasing"
1273 # -W alone doesn't enable all warnings enabled by -Wall; on the other hand,
1274 # -Weverything enables too many useless warnings that can't be disabled (as of 3.0)
1275 flags="$flags -Wall -W"
1277 # warning: unused parameter '...'
1278 flags="$flags -Wno-unused-parameter"
1280 # warning: expression result unused
1281 flags="$flags -Wno-unused-value"
1283 # warning: multi-character character constant
1284 flags="$flags -Wno-multichar"
1286 # warning: explicitly assigning a variable of type '...' to itself
1287 # it happens when using the FOR_ALL_WINDOWS_FROM_BACK_FROM macro
1288 flags="$flags -Wno-self-assign"
1290 if [ "$cc_version" -lt "30" ]; then
1291 # warning: equality comparison with extraneous parentheses
1292 flags="$flags -Wno-parentheses"
1293 # warning: operands of ? are integers of different signs: 'unsigned int' and 'int'
1294 flags="$flags -Wno-sign-compare"
1297 if [ "$cc_version" -ge "30" ]; then
1298 # warning: equality comparison with extraneous parentheses
1299 # this warning could be useful, but it warns about code in squirrel
1300 flags="$flags -Wno-parentheses-equality"
1303 if [ "$with_ccache" != "0" -o "$with_distcc" != "0" ]; then
1304 # ccache and distcc run separate preprocess and compile passes,
1305 # both are fed with the same CFLAGS. Unfortunately, clang
1306 # complains about -I when compiling preprocessed files:
1307 # "clang: warning: argument unused during compilation: '-I /usr/include'"
1308 flags="$flags -Qunused-arguments"
1311 if [ "$enable_assert" -eq "0" ]; then
1312 # do not warn about unused variables when building without asserts
1313 flags="$flags -Wno-unused-variable"
1316 # rdynamic is used to get useful stack traces from crash reports.
1317 ldflags="$ldflags -rdynamic"
1319 # Enable some things only for certain GCC versions
1320 cc_version=`$1 -dumpversion | cut -c 1,3`
1322 if [ $cc_version -lt 33 ]; then
1323 log 1 "configure: error: gcc older than 3.3 can't compile OpenTTD because of its poor template support"
1327 flags="$flags -Wall -Wno-multichar -Wsign-compare -Wundef"
1328 flags="$flags -Wwrite-strings -Wpointer-arith"
1329 flags="$flags -W -Wno-unused-parameter -Wredundant-decls"
1330 flags="$flags -Wformat=2 -Wformat-security"
1332 if [ $enable_assert -eq 0 ]; then
1333 # Do not warn about unused variables when building without asserts
1334 flags="$flags -Wno-unused-variable"
1335 if [ $cc_version -ge 46 ]; then
1336 # GCC 4.6 gives more warnings, disable them too
1337 flags="$flags -Wno-unused-but-set-variable"
1338 flags="$flags -Wno-unused-but-set-parameter"
1342 if [ $cc_version -ge 34 ]; then
1343 # Warn when a variable is used to initialise itself:
1345 flags="$flags -Winit-self"
1348 if [ $cc_version -ge 40 ]; then
1349 # GCC 4.0+ complains about that we break strict-aliasing.
1350 # On most places we don't see how to fix it, and it doesn't
1351 # break anything. So disable strict-aliasing to make the
1352 # compiler all happy.
1353 flags="$flags -fno-strict-aliasing"
1354 # Warn about casting-out 'const' with regular C-style cast.
1355 # The preferred way is const_cast<>() which doesn't warn.
1356 flags="$flags -Wcast-qual"
1359 if [ $cc_version -ge 42 ]; then
1360 # GCC 4.2+ automatically assumes that signed overflows do
1361 # not occur in signed arithmetics, whereas we are not
1362 # sure that they will not happen. It furthermore complains
1363 # about its own optimized code in some places.
1364 flags="$flags -fno-strict-overflow"
1365 # GCC 4.2 no longer includes -Wnon-virtual-dtor in -Wall.
1366 # Enable it in order to be consistent with older GCC versions.
1367 flags="$flags -Wnon-virtual-dtor"
1370 if [ $cc_version -ge 43 ]; then
1371 # Use gnu++0x mode so static_assert() is available.
1372 # Don't use c++0x, it breaks mingw (with gcc 4.4.0).
1373 cxxflags="$cxxflags -std=gnu++0x"
1376 if [ $cc_version -eq 45 ]; then
1377 # Prevent optimisation supposing enums are in a range specified by the standard
1378 # For details, see http://gcc.gnu.org/PR43680
1379 flags="$flags -fno-tree-vrp"
1382 if [ $cc_version -ge 47 ]; then
1383 # Disable -Wnarrowing which gives many warnings, such as:
1384 # warning: narrowing conversion of '...' from 'unsigned int' to 'int' inside { } [-Wnarrowing]
1385 # They are valid according to the C++ standard, but useless.
1386 cxxflags="$cxxflags -Wno-narrowing"
1387 # Disable bogus 'attempt to free a non-heap object' warning
1388 flags="$flags -Wno-free-nonheap-object"
1391 # GCC 4.5 outputs '%{flto}', GCC 4.6 outputs '%{flto*}'
1392 if [ "$enable_lto" != "0" ] && $1 -dumpspecs | grep -q '\%{flto'; then
1393 # Use LTO only if we see LTO exists and is requested
1394 if [ $cc_version -lt 46 ]; then
1395 flags="$flags -flto"
1397 flags="$flags -flto=jobserver"
1399 ldflags="$ldflags -fwhole-program"
1400 features="$features lto"
1403 if $1 -dumpspecs | grep -q rdynamic; then
1404 # rdynamic is used to get useful stack traces from crash reports.
1405 flags="$flags -rdynamic"
1406 ldflags="$ldflags -rdynamic"
1410 eval "$2=\"$flags\""
1411 eval "$3=\"$cxxflags\""
1412 eval "$4=\"$ldflags\""
1413 eval "$5=\"$features\""
1416 make_cflags_and_ldflags() {
1417 # General CFlags for BUILD
1418 CFLAGS_BUILD="$CFLAGS_BUILD"
1419 # Special CXXFlags for BUILD
1420 CXXFLAGS_BUILD="$CXXFLAGS_BUILD"
1422 LDFLAGS_BUILD="$LDFLAGS_BUILD"
1423 # FEATURES for BUILD (lto)
1425 # General CFlags for HOST
1427 # Special CXXFlags for HOST
1428 CXXFLAGS="$CXXFLAGS"
1429 # Libs to compile. In fact this is just LDFLAGS
1431 # LDFLAGS used for HOST
1433 # FEATURES for HOST (lto)
1436 make_compiler_cflags "$cc_build" "CFLAGS_BUILD" "CXXFLAGS_BUILD" "LDFLAGS_BUILD" "FEATURES_BUILD"
1437 make_compiler_cflags "$cc_host" "CFLAGS" "CXXFLAGS" "LDFLAGS" "FEATURES"
1439 CFLAGS="$CFLAGS -D$os"
1440 CFLAGS_BUILD="$CFLAGS_BUILD -D$os"
1442 if [ "$enable_debug" = "0" ]; then
1443 # No debug, add default stuff
1444 OBJS_SUBDIR="release"
1445 if [ "$os" = "MORPHOS" ]; then
1446 CFLAGS="-I/gg/os-include -noixemul -fstrict-aliasing -fexpensive-optimizations -mcpu=604 -fno-inline -mstring -mmultiple $CFLAGS"
1447 LDFLAGS="$LDFLAGS -noixemul"
1450 if [ "$enable_profiling" = "0" ]; then
1451 # -fomit-frame-pointer and -pg do not go well together (gcc errors they are incompatible)
1452 CFLAGS="-fomit-frame-pointer $CFLAGS"
1454 CFLAGS="-O2 $CFLAGS"
1458 # Each debug level reduces the optimization by a bit
1459 if [ $enable_debug -ge 1 ]; then
1460 CFLAGS="$CFLAGS -g -D_DEBUG"
1461 if [ "$os" = "PSP" ]; then
1462 CFLAGS="$CFLAGS -G0"
1465 if [ $enable_debug -ge 2 ]; then
1466 CFLAGS="$CFLAGS -fno-inline"
1468 if [ $enable_debug -ge 3 ]; then
1469 CFLAGS="$CFLAGS -O0"
1471 CFLAGS="$CFLAGS -O2"
1475 if [ $enable_debug -le 2 ]; then
1476 if basename "$cc_host" | grep -q "gcc"; then
1477 # Define only when compiling with GCC. Some GLIBC versions use GNU
1478 # extensions in a way that breaks build with at least ICC.
1479 # This requires -O1 or more, so debug level 3 (-O0) is excluded.
1480 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
1483 if basename "$cc_build" | grep -q "gcc"; then
1484 # Just add -O1 to the tools needed for building.
1485 CFLAGS_BUILD="$CFLAGS_BUILD -D_FORTIFY_SOURCE=2 -O1"
1489 if [ "$os" = "OSX" ] && [ $cc_version -eq 40 ]; then
1490 # Apple's GCC 4.0 has a compiler bug for x86_64 with (higher) optimization,
1491 # wrongly optimizing ^= in loops. This disables the failing optimisation.
1492 CFLAGS="$CFLAGS -fno-expensive-optimizations"
1495 if [ "$enable_profiling" != "0" ]; then
1496 CFLAGS="$CFLAGS -pg"
1497 LDFLAGS="$LDFLAGS -pg"
1500 if [ "$with_threads" = "0" ]; then
1501 CFLAGS="$CFLAGS -DNO_THREADS"
1503 if [ "$with_sse" = "1" ]; then
1504 CFLAGS="$CFLAGS -DWITH_SSE"
1507 if [ "`echo $1 | cut -c 1-3`" != "icc" ]; then
1508 if [ "$os" = "CYGWIN" ]; then
1509 flags="$flags -mwin32"
1510 LDFLAGS="$LDFLAGS -mwin32"
1512 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
1513 if [ $cc_version -lt 46 ]; then
1514 flags="$flags -mno-cygwin"
1515 LDFLAGS="$LDFLAGS -mno-cygwin"
1518 if [ "$enable_console" != "0" ]; then
1519 LDFLAGS="$LDFLAGS -Wl,--subsystem,console"
1521 LDFLAGS="$LDFLAGS -Wl,--subsystem,windows"
1524 LIBS="$LIBS -lws2_32 -lwinmm -lgdi32 -ldxguid -lole32 -limm32"
1526 if [ $cc_version -ge 44 ]; then
1527 LDFLAGS_BUILD="$LDFLAGS_BUILD -static-libgcc -static-libstdc++"
1529 if [ $cc_version -ge 47 ]; then
1530 CFLAGS="$CFLAGS -mno-ms-bitfields"
1535 if [ "$os" != "CYGWIN" ] && [ "$os" != "HAIKU" ] && [ "$os" != "OPENBSD" ] && [ "$os" != "MINGW" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "OSX" ] && [ "$os" != "DOS" ] && [ "$os" != "WINCE" ] && [ "$os" != "PSP" ] && [ "$os" != "OS2" ]; then
1536 LIBS="$LIBS -lpthread"
1539 if [ "$os" != "CYGWIN" ] && [ "$os" != "HAIKU" ] && [ "$os" != "MINGW" ] && [ "$os" != "DOS" ] && [ "$os" != "WINCE" ]; then
1542 if [ "$os" = "WINCE" ]; then
1543 LIBS="$LIBS -lcoredll -lcorelibc -laygshell -lws2 -e WinMainCRTStartup"
1545 if [ "$os" = "PSP" ]; then
1546 CFLAGS="$CFLAGS -I`$psp_config -p`/include"
1547 LDFLAGS="$LDFLAGS -L`$psp_config -p`/lib"
1549 CFLAGS="$CFLAGS -fno-exceptions -fno-rtti -D_PSP_FW_VERSION=150"
1550 LIBS="$LIBS -D_PSP_FW_VERSION=150 -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -lm"
1553 if [ "$os" = "MORPHOS" ]; then
1554 # -Wstrict-prototypes generates much noise because of system headers
1555 CFLAGS="$CFLAGS -Wno-strict-prototypes"
1558 if [ "$os" = "OPENBSD" ]; then
1559 LIBS="$LIBS -pthread"
1562 if [ "$os" = "OSX" ]; then
1563 LDFLAGS="$LDFLAGS -framework Cocoa"
1565 # Add macports include dir which is not always set a default system dir. This avoids zillions of bogus warnings.
1566 CFLAGS="$CFLAGS -isystem/opt/local/include"
1568 if [ "$enable_dedicated" = "0" ] && ([ "$cpu_type" = "32" ] || [ "$enable_universal" != "0" ]); then
1569 LIBS="$LIBS -framework QuickTime"
1571 CFLAGS="$CFLAGS -DNO_QUICKTIME"
1574 if [ "$enable_universal" = "0" ]; then
1575 # Universal builds set this elsewhere
1576 CFLAGS="$OSX_SYSROOT $CFLAGS"
1577 LDFLAGS="$OSX_LD_SYSROOT $LDFLAGS"
1580 if [ "$enable_universal" = "0" ] && [ $cc_version -gt 40 ]; then
1581 # Only set the min version when not doing an universal build.
1582 # Universal builds set the version elsewhere.
1583 if [ "$cpu_type" = "64" ]; then
1584 CFLAGS="$CFLAGS -mmacosx-version-min=10.5"
1586 gcc_cpu=`$cc_host -dumpmachine`
1587 if [ "`echo $gcc_cpu | cut -c 1-3`" = "ppc" -o "`echo $gcc_cpu | cut -c 1-7`" = "powerpc" ]; then
1588 # PowerPC build can run on 10.3
1589 CFLAGS="$CFLAGS -mmacosx-version-min=10.3"
1591 # Intel is only available starting from 10.4
1592 CFLAGS="$CFLAGS -mmacosx-version-min=10.4"
1598 if [ "$os" = "BEOS" ] || [ "$os" = "HAIKU" ]; then
1599 LIBS="$LIBS -lmidi -lbe"
1602 # Most targets act like UNIX, just with some additions
1603 if [ "$os" = "BEOS" ] || [ "$os" = "HAIKU" ] || [ "$os" = "OSX" ] || [ "$os" = "MORPHOS" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "DRAGONFLY" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ] || [ "$os" = "OS2" ]; then
1604 CFLAGS="$CFLAGS -DUNIX"
1606 # And others like Windows
1607 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ]; then
1608 CFLAGS="$CFLAGS -DWIN"
1611 if [ -n "$allegro_config" ]; then
1612 CFLAGS="$CFLAGS -DWITH_ALLEGRO"
1613 CFLAGS="$CFLAGS `$allegro_config --cflags`"
1614 if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "WINCE" ]; then
1615 if [ "$enable_static" != "0" ]; then
1616 LIBS="$LIBS `$allegro_config --static --libs`"
1618 LIBS="$LIBS `$allegro_config --libs`"
1623 if [ -n "$sdl_config" ]; then
1624 CFLAGS="$CFLAGS -DWITH_SDL"
1625 # SDL must not add _GNU_SOURCE as it breaks many platforms
1626 CFLAGS="$CFLAGS `$sdl_config --cflags | sed 's@-D_GNU_SOURCE[^ ]*@@'`"
1627 if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "WINCE" ]; then
1628 if [ "$enable_static" != "0" ]; then
1629 LIBS="$LIBS `$sdl_config --static-libs`"
1631 LIBS="$LIBS `$sdl_config --libs`"
1636 if [ "$with_cocoa" != "0" ]; then
1637 CFLAGS="$CFLAGS -DWITH_COCOA"
1638 LIBS="$LIBS -F/System/Library/Frameworks -framework Cocoa -framework Carbon -framework AudioUnit -framework AudioToolbox"
1640 if [ "$enable_cocoa_quartz" != "0" ]; then
1641 CFLAGS="$CFLAGS -DENABLE_COCOA_QUARTZ"
1644 if [ "$enable_cocoa_quickdraw" != "0" ]; then
1645 CFLAGS="$CFLAGS -DENABLE_COCOA_QUICKDRAW"
1649 if [ "$with_zlib" != "0" ]; then
1650 CFLAGS="$CFLAGS -DWITH_ZLIB"
1651 CFLAGS="$CFLAGS `$zlib_config --cflags | tr '\n\r' ' '`"
1652 if [ "$enable_static" != "0" ]; then
1653 LIBS="$LIBS `$zlib_config --libs --static | tr '\n\r' ' '`"
1655 LIBS="$LIBS `$zlib_config --libs | tr '\n\r' ' '`"
1659 if [ -n "$lzma_config" ]; then
1660 CFLAGS="$CFLAGS -DWITH_LZMA"
1661 CFLAGS="$CFLAGS `$lzma_config --cflags | tr '\n\r' ' '`"
1663 if [ "$enable_static" != "0" ]; then
1664 CFLAGS="$CFLAGS -DLZMA_API_STATIC"
1665 LIBS="$LIBS `$lzma_config --libs --static | tr '\n\r' ' '`"
1667 LIBS="$LIBS `$lzma_config --libs | tr '\n\r' ' '`"
1671 if [ "$with_lzo2" != "0" ]; then
1672 if [ "$enable_static" != "0" ] && [ "$os" != "OSX" ]; then
1677 CFLAGS="$CFLAGS -DWITH_LZO"
1680 if [ -n "$xdg_basedir_config" ]; then
1681 CFLAGS="$CFLAGS -DWITH_XDG_BASEDIR"
1682 CFLAGS="$CFLAGS `$xdg_basedir_config --cflags | tr '\n\r' ' '`"
1684 if [ "$enable_static" != "0" ]; then
1685 LIBS="$LIBS `$xdg_basedir_config --libs --static | tr '\n\r' ' '`"
1687 LIBS="$LIBS `$xdg_basedir_config --libs | tr '\n\r' ' '`"
1691 # 64bit machines need -D_SQ64
1692 if [ "$cpu_type" = "64" ] && [ "$enable_universal" = "0" ]; then
1693 CFLAGS="$CFLAGS -D_SQ64"
1695 CFLAGS="$CFLAGS -I$SCRIPT_SRC_DIR"
1697 if [ -n "$png_config" ]; then
1698 CFLAGS="$CFLAGS -DWITH_PNG"
1699 CFLAGS="$CFLAGS `$png_config --cflags | tr '\n\r' ' '`"
1701 if [ "$enable_static" != "0" ]; then
1702 LIBS="$LIBS `$png_config --libs --static | tr '\n\r' ' '`"
1704 LIBS="$LIBS `$png_config --libs | tr '\n\r' ' '`"
1708 if [ -n "$fontconfig_config" ]; then
1709 CFLAGS="$CFLAGS -DWITH_FONTCONFIG"
1710 CFLAGS="$CFLAGS `$fontconfig_config --cflags | tr '\n\r' ' '`"
1712 if [ "$enable_static" != "0" ]; then
1713 LIBS="$LIBS `$fontconfig_config --libs --static | tr '\n\r' ' '`"
1715 LIBS="$LIBS `$fontconfig_config --libs | tr '\n\r' ' '`"
1719 if [ -n "$freetype_config" ]; then
1720 CFLAGS="$CFLAGS -DWITH_FREETYPE"
1721 CFLAGS="$CFLAGS `$freetype_config --cflags | tr '\n\r' ' '`"
1723 if [ "$enable_static" != "0" ]; then
1724 LIBS="$LIBS `$freetype_config --libs --static | tr '\n\r' ' '`"
1726 LIBS="$LIBS `$freetype_config --libs | tr '\n\r' ' '`"
1730 if [ -n "$icu_config" ]; then
1731 CFLAGS="$CFLAGS -DWITH_ICU"
1732 CFLAGS="$CFLAGS `$icu_config --cppflags | tr '\n\r' ' '`"
1734 # Some icu-configs have the 'feature' of not adding a space where others do add the space
1735 if [ "$static_icu" != "0" ]; then
1736 LIBS="$LIBS `$icu_config --ldflags-searchpath` `($icu_config --ldflags-libsonly; $icu_config --ldflags-layout) | tr '\n\r' ' ' | sed s/licu/lsicu/g`"
1738 LIBS="$LIBS `$icu_config --ldflags-searchpath` `($icu_config --ldflags-libsonly; $icu_config --ldflags-layout) | tr '\n\r' ' '`"
1743 if [ "$with_direct_music" != "0" ]; then
1744 CFLAGS="$CFLAGS -DWIN32_ENABLE_DIRECTMUSIC_SUPPORT"
1745 # GCC 4.0+ doesn't like the DirectX includes (gives tons of
1746 # warnings on it we won't be able to fix). For now just
1747 # suppress those warnings.
1748 if [ $cc_version -ge 40 ]; then
1749 CFLAGS="$CFLAGS -Wno-non-virtual-dtor"
1753 if [ -n "$libtimidity_config" ]; then
1754 CFLAGS="$CFLAGS -DLIBTIMIDITY"
1755 CFLAGS="$CFLAGS `$libtimidity_config --cflags | tr '\n\r' ' '`"
1757 if [ "$enable_static" != "0" ]; then
1758 LIBS="$LIBS `$libtimidity_config --libs --static | tr '\n\r' ' '`"
1760 LIBS="$LIBS `$libtimidity_config --libs | tr '\n\r' ' '`"
1764 if [ "$with_iconv" != "0" ]; then
1765 CFLAGS="$CFLAGS -DWITH_ICONV"
1766 if [ "$link_to_iconv" = "yes" ]; then
1767 LIBS="$LIBS -liconv"
1768 if [ "$with_iconv" != "2" ]; then
1769 CFLAGS="$CFLAGS -I$with_iconv/include"
1770 LIBS="$LIBS -L$with_iconv/lib"
1774 if [ "$os" != "OSX" ] && [ "$have_non_const_iconv" != "no" ]; then
1775 CFLAGS="$CFLAGS -DHAVE_NON_CONST_ICONV"
1779 if [ -n "$with_midi" ]; then
1780 CFLAGS="$CFLAGS -DEXTERNAL_PLAYER=\\\\\"$with_midi\\\\\""
1782 if [ -n "$with_midi_arg" ]; then
1783 CFLAGS="$CFLAGS -DMIDI_ARG=\\\\\"$with_midi_arg\\\\\""
1786 if [ "$enable_dedicated" != "0" ]; then
1787 CFLAGS="$CFLAGS -DDEDICATED"
1790 if [ "$enable_unicode" != "0" ]; then
1791 CFLAGS="$CFLAGS -DUNICODE -D_UNICODE"
1794 if [ "$enable_network" != "0" ]; then
1795 CFLAGS="$CFLAGS -DENABLE_NETWORK"
1797 if [ "$os" = "BEOS" ]; then
1798 LDFLAGS="$LDFLAGS -lbind -lsocket"
1801 if [ "$os" = "HAIKU" ]; then
1802 LDFLAGS="$LDFLAGS -lnetwork"
1805 if [ "$os" = "SUNOS" ]; then
1806 LDFLAGS="$LDFLAGS -lnsl -lsocket"
1810 if [ "$enable_static" != "0" ]; then
1811 # OSX can't handle -static in LDFLAGS
1812 if [ "$os" != "OSX" ]; then
1813 LDFLAGS="$LDFLAGS -static"
1817 if [ "$enable_assert" = "0" ]; then
1818 CFLAGS="$CFLAGS -DNDEBUG"
1819 CFLAGS_BUILD="$CFLAGS_BUILD -DNDEBUG"
1822 if [ "$enable_desync_debug" != "0" ]; then
1823 CFLAGS="$CFLAGS -DRANDOM_DEBUG"
1826 if [ "$enable_osx_g5" != "0" ]; then
1827 CFLAGS="$CFLAGS -mcpu=G5 -mpowerpc64 -mtune=970 -mcpu=970 -mpowerpc-gpopt"
1830 if [ -n "$personal_dir" ]; then
1831 CFLAGS="$CFLAGS -DWITH_PERSONAL_DIR -DPERSONAL_DIR=\\\\\"$personal_dir\\\\\""
1834 if [ -n "$shared_dir" ]; then
1835 CFLAGS="$CFLAGS -DWITH_SHARED_DIR -DSHARED_DIR=\\\\\"$shared_dir\\\\\""
1838 CFLAGS="$CFLAGS -DGLOBAL_DATA_DIR=\\\\\"$prefix_dir/$data_dir\\\\\""
1840 if [ "$enable_lto" != "0" ]; then
1842 if echo "$FEATURES_BUILD" | grep -q "lto"; then
1843 LDFLAGS_BUILD="$LDFLAGS_BUILD $CFLAGS_BUILD $CXXFLAGS_BUILD"
1846 if echo "$FEATURES" | grep -q "lto"; then
1847 LDFLAGS="$LDFLAGS $CFLAGS $CXXFLAGS"
1850 if [ "$lto_warn" != "0" ]; then
1851 log 1 "WARNING: you enabled LTO/IPO, but neither build nor host compiler supports it"
1852 log 1 "WARNING: LTO/IPO has been disabled"
1856 log 1 "using CFLAGS_BUILD... $CFLAGS_BUILD"
1857 log 1 "using CXXFLAGS_BUILD... $CXXFLAGS_BUILD"
1858 log 1 "using LDFLAGS_BUILD... $LDFLAGS_BUILD"
1859 log 1 "using CFLAGS... $CFLAGS"
1860 log 1 "using CXXFLAGS... $CXXFLAGS"
1861 log 1 "using LDFLAGS... $LIBS $LDFLAGS"
1863 # Makedepend doesn't like something like: -isysroot /OSX/blabla
1864 # so convert it to: -isysroot -OSX/blabla. makedepend just ignores
1865 # any - command it doesn't know, so we are pretty save.
1866 # Lovely hackish, not?
1867 # Btw, this almost always comes from outside the configure, so it is
1868 # not something we can control.
1869 # Also make makedepend aware of compiler's built-in defines.
1870 if [ "$with_makedepend" != "0" ] || [ "$enable_builtin_depend" != "0" ]; then
1871 # Append CXXFLAGS possibly containing -std=c++0x
1872 cflags_makedep="`echo | $cxx_host $CXXFLAGS -E -x c++ -dM - | sed 's@.define @-D@g;s@ .*@ @g;s@(.*)@@g' | tr -d '\r\n'`"
1874 # Please escape ALL " within ` because e.g. "" terminates the string in some sh implementations
1875 cflags_makedep="$cflags_makedep `echo \"$CFLAGS\" \"$CXXFLAGS\" | sed 's@ /@ -@g;s@-I[ ]*[^ ]*@@g'`"
1880 if [ "$with_distcc" != "0" ]; then
1881 cc_host="$distcc $cc_host"
1882 cxx_host="$distcc $cxx_host"
1884 log 1 " NOTICE: remind yourself to use 'make -jN' to make use of distcc"
1888 if [ "$with_ccache" != "0" ]; then
1889 cc_host="$ccache $cc_host"
1890 cxx_host="$ccache $cxx_host"
1896 # $1 - Type for message (build / host)
1897 # $2 - What to fill with the found compiler
1898 # $3 - System to try
1899 # $4 - Compiler to try
1900 # $5 - Env-setting to try
1901 # $6 - GCC alike to try
1902 # $7 - CC alike to try
1903 # $8 - "0" gcc, "1" g++, "2" windres, "3" strip, "4" lipo
1904 # $9 - What the command is to check for
1906 if [ -n "$3" ]; then
1908 if [ -z "$6" ]; then
1913 machine=`eval $compiler $9 2>/dev/null`
1915 eval "$2=\"$compiler\""
1917 log 2 "executing $compiler $9"
1918 log 2 " returned $machine"
1919 log 2 " exit code $ret"
1921 if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ]; then
1922 if [ -z "$5" ]; then
1923 log 1 "checking $1... $compiler not found"
1924 log 1 "I couldn't detect any $6 binary for $3"
1929 machine=`eval $compiler $9 2>/dev/null`
1931 eval "$2=\"$compiler\""
1933 log 2 "executing $compiler $9"
1934 log 2 " returned $machine"
1935 log 2 " exit code $ret"
1937 if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ]; then
1938 log 1 "checking $1... $compiler not found"
1939 log 1 "I couldn't detect any $5 binary for $3"
1944 if [ "$machine" != "$3" ] && ( [ "$8" = "0" ] || [ "$8" = "1" ] ); then
1945 log 1 "checking $1... expected $3, found $machine"
1946 log 1 "the compiler suggests it doesn't build code for the machine you specified"
1949 elif [ -n "$4" ]; then
1950 # Check for manual compiler
1951 machine=`$4 $9 2>/dev/null`
1955 log 2 "executing $4 $9"
1956 log 2 " returned $machine"
1957 log 2 " exit code $ret"
1959 if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ]; then
1960 log 1 "checking $1... $4 not found"
1961 log 1 "the selected binary doesn't seem to be a $6 binary"
1965 # Nothing given, autodetect
1967 if [ -n "$5" ]; then
1968 machine=`$5 $9 2>/dev/null`
1972 log 2 "executing $5 $9"
1973 log 2 " returned $machine"
1974 log 2 " exit code $ret"
1976 # The user defined a GCC that doesn't reply to $9.. abort
1977 if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ]; then
1978 log 1 "checking $1... $5 unusable"
1979 log 1 "the CC environment variable is set, but it doesn't seem to be a $6 binary"
1980 log 1 "please redefine the CC/CXX environment to a $6 binary"
1984 log 2 "checking $1... CC/CXX not set (skipping)"
1986 # No $5, so try '$6'
1987 machine=`$6 $9 2>/dev/null`
1991 log 2 "executing $6 $9"
1992 log 2 " returned $machine"
1993 log 2 " exit code $ret"
1995 if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ]; then
1997 machine=`$7 $9 2>/dev/null`
2001 log 2 "executing $7 $9"
2002 log 2 " returned $machine"
2003 log 2 " exit code $ret"
2006 if [ -z "$machine" ]; then
2007 log 1 "checking $1... $6 not found"
2008 log 1 "I couldn't detect any $6 binary on your system"
2009 log 1 "please define the CC/CXX environment to where it is located"
2017 if [ "$8" != "0" ]; then
2019 log 1 "checking $1... $res"
2021 log 1 "checking $1... $machine"
2026 if [ "$os" = "FREEBSD" ]; then
2027 # FreeBSD's C compiler does not support dump machine.
2028 # However, removing C support is not possible because PSP must be linked with the C compiler.
2029 check_compiler "build system type" "cc_build" "$build" "$cc_build" "$CXX" "g++" "c++" "0" "-dumpmachine"
2031 check_compiler "build system type" "cc_build" "$build" "$cc_build" "$CC" "gcc" "cc" "0" "-dumpmachine"
2036 # By default the host is the build
2037 if [ -z "$host" ]; then host="$build"; fi
2039 if [ "$os" = "FREEBSD" ]; then
2040 # FreeBSD's C compiler does not support dump machine.
2041 # However, removing C support is not possible because PSP must be linked with the C compiler.
2042 check_compiler "host system type" "cc_host" "$host" "$cc_host" "$CXX" "g++" "c++" "0" "-dumpmachine"
2044 check_compiler "host system type" "cc_host" "$host" "$cc_host" "$CC" "gcc" "cc" "0" "-dumpmachine"
2049 check_compiler "build c++" "cxx_build" "$build" "$cxx_build" "$CXX" "g++" "c++" 1 "-dumpmachine"
2053 # By default the host is the build
2054 if [ -z "$host" ]; then host="$build"; fi
2055 check_compiler "host c++" "cxx_host" "$host" "$cxx_host" "$CXX" "g++" "c++" 1 "-dumpmachine"
2059 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ]; then
2060 check_compiler "host windres" "windres" "$host" "$windres" "$WINDRES" "windres" "windres" "2" "-V"
2065 if [ "$os" = "OS2" ]; then
2066 # OS2 via gcc is a bit weird.. stripping HAS to be done via emxbind, which is via gcc directly
2067 log 1 "checking host strip... using gcc -s option"
2068 elif [ "$os" = "OSX" ]; then
2069 # Most targets have -V in strip, to see if they exists... OSX doesn't.. so execute something
2070 echo "int main(int argc, char *argv[]) { }" > strip.test.c
2071 $cxx_host strip.test.c -o strip.test
2072 check_compiler "host strip" "strip" "$host" "$strip" "$STRIP" "strip" "strip" "3" "strip.test"
2073 rm -f strip.test.c strip.test
2075 check_compiler "host strip" "strip" "$host" "$strip" "$STRIP" "strip" "strip" "3" "-V"
2080 if [ "$os" = "OSX" ] && [ "$enable_universal" != "0" ]; then
2081 echo "int main(int argc, char *argv[]) { }" > lipo.test.c
2082 $cxx_host lipo.test.c -o lipo.test
2083 check_compiler "host lipo" "lipo" "$host" "$lipo" "$LIPO" "lipo" "lipo" "4" "-info lipo.test"
2084 rm -f lipo.test.c lipo.test
2090 if [ -n "$1" ]; then
2091 if echo "$1" | grep -q / ; then
2092 # Seems to be a file system path
2095 osx_sdk_path="/Developer/SDKs/MacOSX$1.sdk"
2097 if [ ! -d "$osx_sdk_path" ]; then
2098 # No directory, not present or garbage
2102 # Set minimum version to 10.4 as that's when kCGBitmapByteOrder32Host was introduced
2103 sysroot="-isysroot $osx_sdk_path -Wl,-syslibroot,$osx_sdk_path -mmacosx-version-min=10.4"
2106 cat > tmp.osx.mm << EOF
2107 #include <Cocoa/Cocoa.h>
2109 kCGBitmapByteOrder32Host;
2113 execute="$cxx_host $sysroot $CFLAGS tmp.osx.mm -framework Cocoa -o tmp.osx 2>&1"
2114 eval $execute > /dev/null
2116 log 2 "executing $execute"
2117 log 2 " exit code $ret"
2118 rm -f tmp.osx.mm tmp.osx
2122 check_direct_music() {
2124 #include <windows.h>
2125 #include <dmksctrl.h>
2126 #include <dmusici.h>
2127 #include <dmusicc.h>
2128 #include <dmusicf.h>
2129 int main(int argc, char *argv[]) { }" > direct_music.test.c
2130 $cxx_host $CFLAGS direct_music.test.c -o direct_music.test 2> /dev/null
2132 rm -f direct_music.test.c direct_music.test
2134 if [ "$res" != "0" ]; then
2135 if [ "$with_direct_music" != "1" ]; then
2136 log 1 "configure: error: direct-music is not available on this system"
2139 with_direct_music="0"
2141 log 1 "checking direct-music... not found"
2143 log 1 "checking direct-music... found"
2147 check_makedepend() {
2148 if [ "$enable_builtin_depend" != "0" ]; then
2152 if [ "$with_makedepend" = "0" ]; then
2153 log 1 "checking makedepend... disabled"
2157 if [ "$with_makedepend" = "1" ] || [ "$with_makedepend" = "2" ]; then
2158 makedepend="makedepend"
2160 makedepend="$with_makedepend"
2163 rm -f makedepend.tmp
2164 touch makedepend.tmp
2165 res=`$makedepend -fmakedepend.tmp 2>/dev/null`
2167 log 2 "executing $makedepend -f makedepend.tmp"
2168 log 2 " returned `cat makedepend.tmp`"
2169 log 2 " exit code $ret"
2171 if [ ! -s makedepend.tmp ]; then
2172 rm -f makedepend.tmp makedepend.tmp.bak
2174 if [ "$with_makedepend" = "2" ]; then
2175 log 1 "checking makedepend... not found"
2177 log 1 "I couldn't detect any makedepend on your system"
2178 log 1 "please locate it via --makedepend=[binary]"
2181 elif [ "$with_makedepend" != "1" ]; then
2182 log 1 "checking makedepend... $makedepend not found"
2184 log 1 "the selected file doesn't seem to be a valid makedepend binary"
2188 log 1 "checking makedepend... not found"
2195 rm -f makedepend.tmp makedepend.tmp.bak
2197 log 1 "checking makedepend... $makedepend"
2201 # $1 - requested version (major.minor)
2202 # $2 - version we got (major.minor)
2204 if [ -z "$2" ]; then
2208 req_major=`echo $1 | cut -d. -f1`
2209 got_major=`echo $2 | cut -d. -f1`
2210 if [ $got_major -lt $req_major ]; then
2212 elif [ $got_major -gt $req_major ]; then
2216 req_minor=`echo $1 | cut -d. -f2`
2217 got_minor=`echo $2 | cut -d. -f2`
2218 if [ $got_minor -lt $req_minor ]; then
2225 # Not all awks allow gsub(), so we test for that here! It is in fact all we need...
2227 # These awks are known to work. Test for them explicit
2228 awks="gawk mawk nawk"
2230 awk_prefix="echo \"a.c b.c c.c\" | tr ' ' \\\\n | "
2231 awk_param="' { ORS = \" \" } /\.c$/ { gsub(\".c$\", \".o\", \$0); print \$0; }' 2>/dev/null"
2232 awk_result="a.o b.o c.o "
2233 log 2 "Detecing awk..."
2235 log 2 "Trying: $awk_prefix $awk $awk_param"
2236 res=`eval $awk_prefix $awk $awk_param`
2237 log 2 "Result: '$res'"
2238 if [ "$res" != "$awk_result" ] && [ "$awk" = "awk" ]; then
2239 # User didn't supply his own awk, so try to detect some other known working names for an awk
2240 for awk in $awks; do
2241 log 2 "Trying: $awk_prefix $awk $awk_param"
2242 res=`eval $awk_prefix $awk $awk_param`
2243 log 2 "Result: '$res'"
2244 if [ "$res" = "$awk_result" ]; then break; fi
2247 if [ "$res" != "$awk_result" ]; then
2248 log 1 "checking awk... not found"
2249 log 1 "configure: error: no awk found"
2250 log 1 "configure: error: please install one of the following: $awks"
2254 if [ "$res" != "$awk_result" ]; then
2255 log 1 "checking awk... not found"
2256 log 1 "configure: error: you supplied '$awk' but it doesn't seem a valid gawk or mawk"
2260 log 1 "checking awk... $awk"
2264 if [ "$os" = "DETECT" ]; then
2265 # Detect UNIX, OSX, FREEBSD, DRAGONFLY, OPENBSD, NETBSD, HPUX, MORPHOS, BEOS, SUNOS, CYGWIN, MINGW, OS2, DOS, WINCE, and PSP
2267 # Try first via dumpmachine, then via uname
2268 case `echo "$host" | tr '[A-Z]' '[a-z]'` in
2271 *freebsd*) os=FREEBSD;;
2272 *dragonfly*) os=DRAGONFLY;;
2273 *openbsd*) os=OPENBSD;;
2274 *netbsd*) os=NETBSD;;
2276 *morphos*) os=MORPHOS;;
2280 *solaris*) os=SUNOS;;
2281 *cygwin*) os=CYGWIN;;
2289 if [ "$os" = "DETECT" ]; then
2290 case `LC_ALL=C uname | tr '[A-Z]' '[a-z]'` in
2293 *freebsd*) os=FREEBSD;;
2294 *dragonfly*) os=DRAGONFLY;;
2295 *openbsd*) os=OPENBSD;;
2296 *netbsd*) os=NETBSD;;
2298 *morphos*) os=MORPHOS;;
2302 *cygwin*) os=CYGWIN;;
2309 if [ "$os" = "DETECT" ]; then
2310 log 1 "detecting OS... none detected"
2311 log 1 "I couldn't detect your OS. Please use --os=OS to force one"
2312 log 1 "Allowed values are: UNIX, OSX, FREEBSD, DRAGONFLY, OPENBSD, NETBSD, MORPHOS, HPUX, BEOS, HAIKU, SUNOS, CYGWIN, MINGW, OS2, DOS, WINCE, and PSP"
2316 log 1 "detecting OS... $os"
2318 log 1 "forcing OS... $os"
2323 # 0 means no, 1 is auto-detect, 2 is force
2324 if [ "$with_allegro" = "0" ]; then
2325 log 1 "checking Allegro... disabled"
2331 if [ "$with_allegro" = "2" ] && [ "$with_cocoa" = "2" ]; then
2332 log 1 "configure: error: it is impossible to compile both Allegro and COCOA"
2333 log 1 "configure: error: please deselect one of them and try again"
2337 if [ "$with_allegro" = "2" ] && [ "$enable_dedicated" != "0" ]; then
2338 log 1 "configure: error: it is impossible to compile a dedicated with Allegro"
2339 log 1 "configure: error: please deselect one of them and try again"
2343 if [ "$enable_dedicated" != "0" ]; then
2344 log 1 "checking Allegro... dedicated server, skipping"
2350 # By default on OSX we don't use Allegro. The rest is auto-detect
2351 if [ "$with_allegro" = "1" ] && [ "$os" = "OSX" ] && [ "$with_cocoa" != "0" ]; then
2352 log 1 "checking Allegro... OSX, skipping"
2358 detect_pkg_config "$with_allegro" "allegro" "allegro_config" "4.4"
2363 # 0 means no, 1 is auto-detect, 2 is force
2364 if [ "$with_sdl" = "0" ]; then
2365 log 1 "checking SDL... disabled"
2371 if [ "$with_sdl" = "2" ] && [ "$with_cocoa" = "2" ]; then
2372 log 1 "configure: error: it is impossible to compile both SDL and COCOA"
2373 log 1 "configure: error: please deselect one of them and try again"
2377 if [ "$with_sdl" = "2" ] && [ "$enable_dedicated" != "0" ]; then
2378 log 1 "configure: error: it is impossible to compile a dedicated with SDL"
2379 log 1 "configure: error: please deselect one of them and try again"
2383 if [ "$enable_dedicated" != "0" ]; then
2384 log 1 "checking SDL... dedicated server, skipping"
2390 # By default on OSX we don't use SDL. The rest is auto-detect
2391 if [ "$with_sdl" = "1" ] && [ "$os" = "OSX" ] && [ "$with_cocoa" != "0" ]; then
2392 log 1 "checking SDL... OSX, skipping"
2398 if [ "$os" = "OSX" ]; then
2399 log 1 "WARNING: sdl is known to fail on some versions of Mac OS X"
2400 log 1 "WARNING: with some hardware configurations. Use at own risk!"
2404 detect_pkg_config "$with_sdl" "sdl" "sdl_config" "1.2"
2408 # Try to find the best SDK available. For a normal build this
2409 # is currently the 10.5 SDK as this is needed to compile all
2410 # optional code. Because such an executable won't run on 10.4
2411 # or lower, also check for the 10.4u SDK when doing an universal
2414 # Check for the 10.5 SDK, but try 10.6 if that fails
2415 check_osx_sdk "10.5" || check_osx_sdk "10.6" || osx_sdk_path=""
2417 if [ -z "$osx_sdk_path" ] || [ "$enable_universal" != "0" ]; then
2418 # No better SDK or universal build enabled? Check 10.4u SDK as well
2419 local old_sdk="$osx_sdk_path"
2420 if check_osx_sdk "10.4u"; then
2421 osx_sdk_104_path="$osx_sdk_path"
2425 if [ -z "$old_sdk" ]; then
2426 osx_sdk_path="$osx_sdk_104_path"
2428 osx_sdk_path="$old_sdk"
2432 if [ -z "$osx_sdk_path" ]; then
2433 log 1 "Your system SDK is probably too old"
2434 log 1 "Please install/upgrade your Xcode to >= 2.5"
2441 # 0 means no, 1 is auto-detect, 2 is force
2442 if [ "$with_cocoa" = "0" ]; then
2443 log 1 "checking COCOA... disabled"
2448 if [ "$with_cocoa" = "2" ] && [ "$enable_dedicated" != "0" ]; then
2449 log 1 "configure: error: it is impossible to compile a dedicated with COCOA"
2450 log 1 "configure: error: please deselect one of them and try again"
2454 if [ "$enable_dedicated" != "0" ]; then
2455 log 1 "checking COCOA... dedicated server, skipping"
2461 # By default on OSX we use COCOA. The rest doesn't support it
2462 if [ "$with_cocoa" = "1" ] && [ "$os" != "OSX" ]; then
2463 log 1 "checking COCOA... not OSX, skipping"
2469 if [ "$os" != "OSX" ]; then
2470 log 1 "checking COCOA... not OSX"
2472 log 1 "configure: error: COCOA video driver is only supported for OSX"
2476 log 1 "checking COCOA... found"
2479 if [ "$enable_cocoa_quartz" != "0" ]; then
2480 log 1 "checking whether to enable the Quartz window subdriver... yes"
2482 log 1 "checking whether to enable the Quartz window subdriver... no"
2488 detect_quickdraw() {
2489 # 0 means no, 1 is auto-detect, 2 is force
2490 if [ "$enable_cocoa_quickdraw" = "0" ]; then
2491 log 1 "checking Quickdraw window subdriver... disabled"
2495 # Assume QuickDraw is available when doing an universal build
2496 if [ "$enable_universal" != "0" ]; then
2497 log 1 "checking Quickdraw window subdriver... found"
2501 # 64 bits doesn't have quickdraw
2502 if [ "$cpu_type" = "64" ]; then
2503 enable_cocoa_quickdraw="0"
2504 log 1 "checking Quickdraw window subdriver... disabled (64 bits)"
2508 cat > tmp.osx.mm << EOF
2509 #include <AvailabilityMacros.h>
2510 #import <Cocoa/Cocoa.h>
2511 int main(int argc, char *argv[]) { SetEmptyRgn(NULL); return 0; }
2513 execute="$cxx_host $OSX_SYSROOT $OSX_LD_SYSROOT $CFLAGS -mmacosx-version-min=10.3 tmp.osx.mm -framework Cocoa -o tmp.osx 2>&1"
2514 eval $execute > /dev/null
2516 log 2 "executing $execute"
2517 log 2 " exit code $ret"
2518 rm -f tmp.osx.mm tmp.osx
2519 if [ "$ret" != "0" ]; then
2520 log 1 "checking Quickdraw window subdriver... not found"
2522 # It was forced, so it should be found.
2523 if [ "$enable_cocoa_quickdraw" != "1" ]; then
2524 log 1 "configure: error: Quickdraw window driver could not be found"
2528 enable_cocoa_quickdraw=0
2532 enable_cocoa_quickdraw=1
2533 log 1 "checking Quickdraw window subdriver... found"
2537 # $1 - config-param ($with_zlib value)
2538 # $2 - library name ('zlib', sets $zlib)
2539 # $3 - static library name (libz.a)
2540 # $4 - header directory ()
2541 # $5 - header name (zlib.h)
2542 # $6 - force static (if non-empty)
2544 if [ -n "$6" ]; then force_static="1"; fi
2546 # 0 means no, 1 is auto-detect, 2 is force
2547 if [ "$1" = "0" ]; then
2548 log 1 "checking $2... disabled"
2554 log 2 "detecting $2"
2556 if [ "$1" = "1" ] || [ "$1" = "" ] || [ "$1" = "2" ]; then
2557 eval "$2=`ls -1 /usr/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2559 if [ -z "$res" ]; then
2560 log 2 " trying /usr/include/$4$5... no"
2561 eval "$2=`ls -1 /usr/local/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2564 if [ -z "$res" ]; then
2565 log 2 " trying /usr/local/include/$4$5... no"
2566 eval "$2=`ls -1 /mingw/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2569 if [ -z "$res" ]; then
2570 log 2 " trying /mingw/include/$4$5... no"
2571 eval "$2=`ls -1 /opt/local/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2574 if [ -z "$res" ]; then
2575 log 2 " trying /opt/local/include/$4$5... no"
2577 if [ -z "$res" ] && [ "$os" = "NETBSD" ]; then
2578 eval "$2=`ls -1 /usr/pkg/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2580 if [ -z "$res" ]; then
2581 log 2 " trying /usr/pkg/include/$4$5... no"
2584 if [ -z "$res" ] && [ "$os" = "HAIKU" ]; then
2585 if [ -z "$includeDir" ]; then
2586 includeDir=`finddir B_SYSTEM_HEADERS_DIRECTORY`
2588 eval "$2=`ls -1 $includeDir/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2590 if [ -z "$res" ]; then
2591 log 2 " trying $includeDir/$4$5... no"
2596 if [ -n "$res" ] && ( [ -n "$force_static" ] || ( [ "$enable_static" != "0" ] && [ "$os" != "OSX" ] ) ); then
2598 log 2 " trying $res... found"
2599 # Now find the static lib, if needed
2600 eval "$2=`ls /lib/*.a 2>/dev/null | egrep \"\/$3\$\"`"
2602 if [ -z "$res" ]; then
2603 log 2 " trying /lib/$3... no"
2604 eval "$2=`ls /usr/lib/*.a 2>/dev/null | egrep \"\/$3\$\"`"
2607 if [ -z "$res" ]; then
2608 log 2 " trying /usr/lib/$3... no"
2609 eval "$2=`ls /usr/local/lib/*.a 2>/dev/null | egrep \"\/$3\$\"`"
2612 if [ -z "$res" ]; then
2613 log 2 " trying /usr/local/lib/$3... no"
2614 eval "$2=`ls /mingw/lib/*.a 2>/dev/null | egrep \"\/$3\$\"`"
2617 if [ -z "$res" ]; then
2618 log 2 " trying /mingw/lib/$3... no"
2619 log 1 "configure: error: $2 couldn't be found"
2620 log 1 "configure: error: you requested a static link, but I can't find $3"
2626 # Make sure it exists
2627 if [ -f "$1" ]; then
2628 eval "$2=`ls $1 2>/dev/null`"
2630 eval "$2=`ls $1/$3 2>/dev/null`"
2635 if [ -z "$res" ]; then
2636 log 1 "checking $2... not found"
2637 if [ "$1" = "2" ]; then
2638 log 1 "configure: error: $2 couldn't be found"
2641 elif [ "$1" != "1" ]; then
2642 log 1 "configure: error: $2 couldn't be found"
2643 log 1 "configure: error: you supplied '$1', but it seems invalid"
2654 log 2 " trying $res... found"
2656 log 1 "checking $2... found"
2660 detect_pkg_config "$with_zlib" "zlib" "zlib_config" "1.2"
2664 detect_library "$with_lzo2" "lzo2" "liblzo2.a" "lzo/" "lzo1x.h"
2667 detect_libtimidity() {
2668 detect_pkg_config "$with_libtimidity" "libtimidity" "libtimidity_config" "0.1" "1"
2671 detect_pkg_config() {
2672 # $1 - config-param ($with_lzma value)
2673 # $2 - package name ('liblzma')
2674 # $3 - config name ('lzma_config', sets $lzma_config)
2675 # $4 - minimum module version ('2.3')
2676 # $5 - check for dedicated, 1 is "skif if dedicated"
2678 # 0 means no, 1 is auto-detect, 2 is force
2679 if [ "$1" = "0" ]; then
2680 log 1 "checking $2... disabled"
2686 if [ "$5" = "1" ] && [ "$1" = "1" ] && [ "$enable_dedicated" != "0" ]; then
2687 log 1 "checking $2... dedicated server, skipping"
2693 log 2 "detecting $2"
2695 if [ "$1" = "1" ] || [ "$1" = "" ] || [ "$1" = "2" ]; then
2696 pkg_config_call="$pkg_config $2"
2698 pkg_config_call="$1"
2701 version=`$pkg_config_call --modversion 2>/dev/null`
2703 check_version "$4" "$version"
2705 log 2 "executing $pkg_config_call --modversion"
2706 log 2 " returned $version"
2707 log 2 " exit code $ret"
2709 if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$version_ok" != "1" ]; then
2710 if [ -n "$version" ] && [ "$version_ok" != "1" ]; then
2711 log 1 "checking $2... needs at least version $4, $2 NOT enabled"
2713 log 1 "checking $2... not found"
2716 # It was forced, so it should be found.
2717 if [ "$1" != "1" ]; then
2718 log 1 "configure: error: $pkg_config $2 couldn't be found"
2719 log 1 "configure: error: you supplied '$1', but it seems invalid"
2727 eval "$3=\"$pkg_config_call\""
2728 log 1 "checking $2... found"
2732 detect_pkg_config "$with_lzma" "liblzma" "lzma_config" "5.0"
2735 detect_xdg_basedir() {
2736 detect_pkg_config "$with_xdg_basedir" "libxdg-basedir" "xdg_basedir_config" "1.2"
2740 detect_pkg_config "$with_png" "libpng" "png_config" "1.2"
2744 detect_pkg_config "$with_freetype" "freetype2" "freetype_config" "2.2" "1"
2747 detect_fontconfig() {
2748 # 0 means no, 1 is auto-detect, 2 is force
2749 if [ "$with_fontconfig" = "0" ]; then
2750 log 1 "checking libfontconfig... disabled"
2752 fontconfig_config=""
2755 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ]; then
2756 log 1 "checking libfontconfig... WIN32, skipping"
2757 fontconfig_config=""
2761 if [ "$os" = "OSX" ]; then
2762 log 1 "checking libfontconfig... OSX, skipping"
2763 fontconfig_config=""
2767 detect_pkg_config "$with_fontconfig" "fontconfig" "fontconfig_config" "2.3" "1"
2771 # 0 means no, 1 is auto-detect, 2 is force
2772 if [ "$with_icu" = "0" ]; then
2773 log 1 "checking libicu... disabled"
2778 if [ "$with_icu" = "1" ] && [ "$enable_dedicated" != "0" ]; then
2779 log 1 "checking libicu... dedicated server, skipping"
2785 if [ "$with_icu" = "1" ] || [ "$with_icu" = "" ] || [ "$with_icu" = "2" ]; then
2786 icu_config="icu-config"
2788 icu_config="$with_icu"
2791 version=`$icu_config --version 2>/dev/null`
2793 check_version '3.6' "$version"
2795 log 2 "executing $icu_config --version"
2796 log 2 " returned $version"
2797 log 2 " exit code $ret"
2799 if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$version_ok" != "1" ]; then
2800 if [ -n "$version" ] && [ "$version_ok" != "1" ]; then
2801 log 1 "checking libicu... needs at least version 3.6.0, icu NOT enabled"
2803 log 1 "checking libicu... not found"
2806 # It was forced, so it should be found.
2807 if [ "$with_icu" != "1" ]; then
2808 log 1 "configure: error: icu-config couldn't be found"
2809 log 1 "configure: error: you supplied '$with_icu', but it seems invalid"
2817 log 1 "checking libicu... found"
2820 detect_pspconfig() {
2821 # 0 means no, 1 is auto-detect, 2 is force
2822 if [ "$with_psp_config" = "0" ]; then
2823 log 1 "checking psp-config... disabled"
2829 if [ "$with_psp_config" = "1" ] && [ "$os" != "PSP" ]; then
2830 log 1 "checking psp-config... not PSP, skipping"
2836 if [ "$os" != "PSP" ]; then
2837 log 1 "checking psp-config... not PSP"
2839 log 1 "configure: error: psp-config is only supported for PSP"
2843 if [ "$with_psp_config" = "1" ] || [ "$with_psp_config" = "" ] || [ "$with_psp_config" = "2" ]; then
2844 psp_config="psp-config"
2846 psp_config="$with_psp_config"
2849 version=`$psp_config -p 2>/dev/null`
2851 log 2 "executing $psp_config -p"
2852 log 2 " returned $version"
2853 log 2 " exit code $ret"
2855 if [ -z "$version" ] || [ "$ret" != "0" ]; then
2856 log 1 "checking psp-config... not found"
2857 log 1 "configure: error: psp-config couldn't be found"
2859 # It was forced, so it should be found.
2860 if [ "$with_psp_config" != "1" ]; then
2861 log 1 "configure: error: you supplied '$with_psp_config', but it seems invalid"
2866 log 1 "checking psp-config... found"
2870 # 0 means no, 1 is auto-detect, 2 is force
2871 if [ "$with_iconv" = "0" ]; then
2872 log 1 "checking iconv... disabled"
2877 if [ "$with_iconv" = "1" ] && [ "$os" != "OSX" ]; then
2878 log 1 "checking iconv... not OSX, skipping"
2884 # Try to find iconv.h, seems to only thing to detect iconv with
2886 if [ "$with_iconv" = "1" ] || [ "$with_iconv" = "" ] || [ "$with_iconv" = "2" ]; then
2887 iconv=`ls -1 /usr/include 2>/dev/null | grep "iconv.h"`
2888 if [ -z "$iconv" ]; then
2889 iconv=`ls -1 /usr/local/include 2>/dev/null | grep "iconv.h"`
2892 # Make sure it exists
2893 iconv=`ls $with_iconv/include/iconv.h 2>/dev/null`
2896 if [ -z "$iconv" ]; then
2897 log 1 "checking iconv... not found"
2898 if [ "$with_iconv" = "2" ]; then
2899 log 1 "configure: error: iconv couldn't be found"
2902 elif [ "$with_iconv" != "1" ]; then
2903 log 1 "configure: error: iconv couldn't be found"
2904 log 1 "configure: error: you supplied '$with_iconv', but I couldn't detect iconv in it"
2912 if [ "$with_iconv" = "1" ]; then
2916 log 2 "found iconv in $iconv"
2918 log 1 "checking iconv... found"
2920 # There are different implementations of iconv. The older ones,
2921 # e.g. SUSv2, pass a const pointer, whereas the newer ones, e.g.
2922 # IEEE 1003.1 (2004), pass a non-const pointer.
2924 cat > tmp.iconv.cpp << EOF
2925 #include "src/stdafx.h"
2928 static char buf[1024];
2930 const char *inbuf = "";
2932 size_t outlen = 1023;
2934 return iconv(convd, &inbuf, &inlen, &outbuf, &outlen);
2937 execute="$cxx_host $OSX_SYSROOT $CFLAGS -c tmp.iconv.cpp -o tmp.iconv -DTESTING 2>&1"
2938 eval $execute > /dev/null
2940 log 2 "executing $execute"
2941 log 2 " exit code $ret"
2942 if [ "$ret" = "0" ]; then have_non_const_iconv="no"; else have_non_const_iconv="yes"; fi
2943 log 1 "checking if iconv has non-const inbuf... $have_non_const_iconv"
2945 cat > tmp.iconv.cpp << EOF
2946 #include "src/stdafx.h"
2949 static char buf[1024];
2953 size_t outlen = 1023;
2955 return iconv(convd, &inbuf, &inlen, &outbuf, &outlen);
2958 execute="$cxx_host $OSX_SYSROOT $OSX_LD_SYSROOT $CFLAGS tmp.iconv.cpp -o tmp.iconv -DTESTING 2>&1"
2959 eval $execute > /dev/null
2961 log 2 "executing $execute"
2962 log 2 " exit code $ret"
2963 if [ "$ret" = "0" ]; then link_to_iconv="no"; else link_to_iconv="yes"; fi
2964 log 1 "checking whether to link to iconv... $link_to_iconv"
2965 rm -f tmp.iconv tmp.iconv.cpp
2979 log 2 "running echo <array> | $1"
2981 if [ "`echo \"$sort_test_in\" | $1 2>/dev/null`" = "$sort_test_out" ]; then
2983 log 2 " result was valid"
2985 log 2 " result was invalid"
2990 if [ "$with_sort" = "0" ]; then
2991 log 1 "checking sort... disabled"
2996 if [ "$with_sort" = "1" ] || [ "$with_sort" = "2" ]; then
2998 if [ -z "$sort" ]; then _detect_sort "/sbin/sort"; fi
2999 if [ -z "$sort" ]; then _detect_sort "/usr/sbin/sort"; fi
3000 if [ -z "$sort" ]; then _detect_sort "/usr/local/sbin/sort"; fi
3001 if [ -z "$sort" ]; then _detect_sort "/bin/sort"; fi
3002 if [ -z "$sort" ]; then _detect_sort "/usr/bin/sort"; fi
3003 if [ -z "$sort" ]; then _detect_sort "/usr/local/bin/sort"; fi
3005 _detect_sort "$with_sort"
3008 if [ -z "$sort" ]; then
3009 if [ "$with_sort" = "2" ]; then
3010 log 1 "checking sort... not found"
3012 log 1 "configure: error: couldn't detect sort on your system"
3014 elif [ "$with_sort" != "1" ]; then
3015 log 1 "checking sort... $with_sort not found"
3017 log 1 "configure: error: '$with_sort' doesn't look like a sort to me"
3018 log 1 "configure: error: please verify its location and function and try again"
3022 log 1 "checking sort... not found"
3025 log 1 "checking sort... $sort"
3030 # 0 means no, 1 is auto-detect, 2 is force
3031 if [ "$with_grfcodec" = "0" ]; then
3032 log 1 "checking grfcodec... disabled"
3038 if [ "$with_grfcodec" = "1" ] || [ "$with_grfcodec" = "" ] || [ "$with_grfcodec" = "2" ]; then
3041 grfcodec="$with_grfcodec"
3044 version=`$grfcodec -v 2>/dev/null | $awk '{print $3}' | sed 's/[rM]//g;s/-/0/'`
3046 log 2 "executing grfcodec -v"
3047 log 2 " returned $version"
3048 log 2 " exit code $ret"
3050 if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$version" -lt "985" ]; then
3051 if [ -n "$version" ] && [ "$version" -lt "985" ]; then
3052 log 1 "checking grfcodec... needs at least version 6.0.5 (r985), disabled"
3054 log 1 "checking grfcodec... not found"
3057 # It was forced, so it should be found.
3058 if [ "$with_grfcodec" != "1" ]; then
3059 log 1 "configure: error: grfcodec couldn't be found"
3060 log 1 "configure: error: you supplied '$with_grfcodec', but it seems invalid"
3068 log 1 "checking grfcodec... found"
3072 # 0 means no, 1 is auto-detect, 2 is force
3073 if [ "$with_nforenum" = "0" ]; then
3074 log 1 "checking nforenum... disabled"
3080 if [ "$with_nforenum" = "1" ] || [ "$with_nforenum" = "" ] || [ "$with_nforenum" = "2" ]; then
3083 nforenum="$with_nforenum"
3086 version=`$nforenum -v 2>/dev/null | $awk '{print $3}' | sed 's/[rM]//g;s/-/0/'`
3088 log 2 "executing nforenum -v"
3089 log 2 " returned $version"
3090 log 2 " exit code $ret"
3092 if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$version" -lt "985" ]; then
3093 if [ -n "$version" ] && [ "$version" -lt "985" ]; then
3094 log 1 "checking nforenum... needs at least version 6.0.5 (r985), disabled"
3096 log 1 "checking nforenum... not found"
3099 # It was forced, so it should be found.
3100 if [ "$with_nforenum" != "1" ]; then
3101 log 1 "configure: error: nforenum couldn't be found"
3102 log 1 "configure: error: you supplied '$with_nforenum', but it seems invalid"
3110 log 1 "checking nforenum... found"
3114 if [ -n "$cpu_type" ] && [ "$cpu_type" != "DETECT" ]; then
3115 log 1 "forcing cpu-type... $cpu_type bits"
3118 echo "#define _SQ64 1" > tmp.64bit.cpp
3119 echo "#include \"src/stdafx.h\"" >> tmp.64bit.cpp
3120 echo "assert_compile(sizeof(size_t) == 8);" >> tmp.64bit.cpp
3121 echo "int main() { return 0; }" >> tmp.64bit.cpp
3122 execute="$cxx_host $CFLAGS tmp.64bit.cpp -o tmp.64bit -DTESTING 2>&1"
3123 cpu_type="`eval $execute 2>/dev/null`"
3125 log 2 "executing $execute"
3126 log 2 " returned $cpu_type"
3127 log 2 " exit code $ret"
3128 if [ "$ret" = "0" ]; then cpu_type="64"; else cpu_type="32"; fi
3129 log 1 "detecting cpu-type... $cpu_type bits"
3130 rm -f tmp.64bit tmp.64bit.cpp
3133 detect_sse_capable_architecture() {
3134 # 0 means no, 1 is auto-detect, 2 is force
3135 if [ "$with_sse" = "0" ]; then
3136 log 1 "checking SSE... disabled"
3140 echo "#define _SQ64 1" > tmp.sse.cpp
3141 echo "#include <xmmintrin.h>" >> tmp.sse.cpp
3142 echo "#include <smmintrin.h>" >> tmp.sse.cpp
3143 echo "#include <tmmintrin.h>" >> tmp.sse.cpp
3144 echo "int main() { return 0; }" >> tmp.sse.cpp
3145 execute="$cxx_host -msse4.1 $CFLAGS tmp.sse.cpp -o tmp.sse 2>&1"
3146 sse="`eval $execute 2>/dev/null`"
3148 log 2 "executing $execute"
3149 log 2 " returned $sse"
3150 log 2 " exit code $ret"
3151 if [ "$ret" = "0" ]; then
3152 log 1 "detecting SSE... found"
3154 # It was forced, so it should be found.
3155 if [ "$with_sse" != "1" ]; then
3156 log 1 "configure: error: SSE couln't be found"
3157 log 1 "configure: error: you force enabled SSE, but it seems unavailable"
3161 log 1 "detecting SSE... not found"
3164 rm -f tmp.sse tmp.exe tmp.sse.cpp
3169 T_CXXFLAGS="$CXXFLAGS"
3170 T_LDFLAGS="$LDFLAGS"
3172 SRC_OBJS_DIR="$BASE_SRC_OBJS_DIR/$OBJS_SUBDIR"
3174 # All the data needed to compile a single target
3175 # Make sure if you compile multiple targets to
3176 # use multiple OBJS_DIR, because all in-between
3177 # binaries are stored in there, and nowhere else.
3179 s@!!CC_HOST!!@$cc_host@g;
3180 s@!!CXX_HOST!!@$cxx_host@g;
3181 s@!!CC_BUILD!!@$cc_build@g;
3182 s@!!CXX_BUILD!!@$cxx_build@g;
3183 s@!!WINDRES!!@$windres@g;
3184 s@!!STRIP!!@$strip $strip_arg@g;
3186 s@!!CFLAGS!!@$T_CFLAGS@g;
3187 s@!!CFLAGS_BUILD!!@$CFLAGS_BUILD@g;
3188 s@!!CXXFLAGS!!@$T_CXXFLAGS@g;
3189 s@!!CXXFLAGS_BUILD!!@$CXXFLAGS_BUILD@g;
3190 s@!!STRGEN_FLAGS!!@$strgen_flags@g;
3192 s@!!LDFLAGS!!@$T_LDFLAGS@g;
3193 s@!!LDFLAGS_BUILD!!@$LDFLAGS_BUILD@g;
3194 s@!!BIN_DIR!!@$BIN_DIR@g;
3195 s@!!ROOT_DIR!!@$ROOT_DIR@g;
3196 s@!!MEDIA_DIR!!@$MEDIA_DIR@g;
3197 s@!!SOURCE_LIST!!@$SOURCE_LIST@g;
3198 s@!!SRC_OBJS_DIR!!@$SRC_OBJS_DIR@g;
3199 s@!!LANG_OBJS_DIR!!@$LANG_OBJS_DIR@g;
3200 s@!!GRF_OBJS_DIR!!@$GRF_OBJS_DIR@g;
3201 s@!!SETTING_OBJS_DIR!!@$SETTING_OBJS_DIR@g;
3202 s@!!SRC_DIR!!@$SRC_DIR@g;
3203 s@!!SCRIPT_SRC_DIR!!@$SCRIPT_SRC_DIR@g;
3204 s@!!OSXAPP!!@$OSXAPP@g;
3205 s@!!LANG_DIR!!@$LANG_DIR@g;
3207 s@!!BINARY_DIR!!@$prefix_dir/$binary_dir@g;
3208 s@!!DATA_DIR!!@$prefix_dir/$data_dir@g;
3209 s@!!DOC_DIR!!@$prefix_dir/$doc_dir@g;
3210 s@!!MAN_DIR!!@$prefix_dir/$man_dir@g;
3211 s@!!ICON_DIR!!@$prefix_dir/$icon_dir@g;
3212 s@!!ICON_THEME_DIR!!@$prefix_dir/$icon_theme_dir@g;
3213 s@!!PERSONAL_DIR!!@$personal_dir@g;
3214 s@!!SHARED_DIR!!@$shared_dir@g;
3215 s@!!INSTALL_DIR!!@$install_dir@g;
3216 s@!!BINARY_NAME!!@$binary_name@g;
3217 s@!!STRGEN!!@$STRGEN@g;
3218 s@!!ENDIAN_CHECK!!@$ENDIAN_CHECK@g;
3219 s@!!DEPEND!!@$DEPEND@g;
3220 s@!!SETTINGSGEN!!@$SETTINGSGEN@g;
3221 s@!!ENDIAN_FORCE!!@$endian@g;
3222 s@!!STAGE!!@$STAGE@g;
3223 s@!!MAKEDEPEND!!@$makedepend@g;
3224 s@!!CFLAGS_MAKEDEP!!@$cflags_makedep@g;
3226 s@!!CONFIG_CACHE_COMPILER!!@config.cache.compiler@g;
3227 s@!!CONFIG_CACHE_LINKER!!@config.cache.linker@g;
3228 s@!!CONFIG_CACHE_ENDIAN!!@config.cache.endian@g;
3229 s@!!CONFIG_CACHE_SOURCE!!@config.cache.source@g;
3230 s@!!CONFIG_CACHE_VERSION!!@config.cache.version@g;
3231 s@!!CONFIG_CACHE_SOURCE_LIST!!@config.cache.source.list@g;
3232 s@!!CONFIG_CACHE_PWD!!@config.cache.pwd@g;
3233 s@!!LANG_SUPPRESS!!@$lang_suppress@g;
3234 s@!!OBJS_C!!@$OBJS_C@g;
3235 s@!!OBJS_CPP!!@$OBJS_CPP@g;
3236 s@!!OBJS_MM!!@$OBJS_MM@g;
3237 s@!!OBJS_RC!!@$OBJS_RC@g;
3240 s@!!CONFIGURE_FILES!!@$CONFIGURE_FILES@g;
3242 s@!!DISTCC!!@$distcc@g;
3243 s@!!NFORENUM!!@$nforenum@g;
3244 s@!!GRFCODEC!!@$grfcodec@g;
3247 if [ "$icon_theme_dir" != "" ]; then
3248 SRC_REPLACE="$SRC_REPLACE
3249 s@!!ICON_THEME_DIR!!@$prefix_dir/$icon_theme_dir@g;
3252 SRC_REPLACE="$SRC_REPLACE
3253 s@!!ICON_THEME_DIR!!@@g;
3257 if [ "$man_dir" != "" ]; then
3258 SRC_REPLACE="$SRC_REPLACE
3259 s@!!MAN_DIR!!@$prefix_dir/$man_dir@g;
3262 SRC_REPLACE="$SRC_REPLACE
3267 if [ "$menu_dir" != "" ]; then
3268 SRC_REPLACE="$SRC_REPLACE
3269 s@!!MENU_DIR!!@$prefix_dir/$menu_dir@g;
3272 SRC_REPLACE="$SRC_REPLACE
3278 generate_menu_item() {
3281 s@!!MENU_GROUP!!@$menu_group@g;
3282 s@!!MENU_NAME!!@$menu_name@g
3284 log 1 "Generating menu item..."
3286 < $ROOT_DIR/media/openttd.desktop.in sed "$MENU_REPLACE" > media/openttd.desktop
3294 # Create the main Makefile
3295 log 1 "Generating Makefile..."
3296 echo "# Auto-generated file from 'Makefile.in' -- DO NOT EDIT" > Makefile
3297 < $ROOT_DIR/Makefile.in sed "$SRC_REPLACE" >> Makefile
3298 cp $ROOT_DIR/Makefile.bundle.in Makefile.bundle
3299 echo "# Auto-generated file -- DO NOT EDIT" > Makefile.am
3301 # Make the copy of the source-list, so we don't trigger an unwanted recompile
3302 cp $SOURCE_LIST config.cache.source.list
3303 # Add the current directory, so we don't trigger an unwanted recompile
3304 echo "`pwd`" > config.cache.pwd
3305 # Make sure config.cache is OLDER then config.cache.source.list
3309 if [ "$menu_dir" != "" ]; then
3319 # Create the language file
3320 mkdir -p $LANG_OBJS_DIR
3322 log 1 "Generating lang/Makefile..."
3323 echo "# Auto-generated file from 'Makefile.lang.in' -- DO NOT EDIT" > $LANG_OBJS_DIR/Makefile
3324 < $ROOT_DIR/Makefile.lang.in sed "$SRC_REPLACE" >> $LANG_OBJS_DIR/Makefile
3325 echo "DIRS += $LANG_OBJS_DIR" >> Makefile.am
3326 echo "LANG_DIRS += $LANG_OBJS_DIR" >> Makefile.am
3329 generate_settings() {
3334 # Create the language file
3335 mkdir -p $SETTING_OBJS_DIR
3337 log 1 "Generating setting/Makefile..."
3338 echo "# Auto-generated file from 'Makefile.settings.in' -- DO NOT EDIT" > $SETTING_OBJS_DIR/Makefile
3339 < $ROOT_DIR/Makefile.setting.in sed "$SRC_REPLACE" >> $SETTING_OBJS_DIR/Makefile
3340 echo "DIRS += $SETTING_OBJS_DIR" >> Makefile.am
3348 # Create the language file
3349 mkdir -p $GRF_OBJS_DIR
3351 log 1 "Generating grf/Makefile..."
3352 echo "# Auto-generated file from 'Makefile.grf.in' -- DO NOT EDIT" > $GRF_OBJS_DIR/Makefile
3353 < $ROOT_DIR/Makefile.grf.in sed "$SRC_REPLACE" >> $GRF_OBJS_DIR/Makefile
3354 echo "DIRS += $GRF_OBJS_DIR" >> Makefile.am
3357 generate_src_normal() {
3362 # Create the source file
3363 mkdir -p $SRC_OBJS_DIR
3365 log 1 "Generating $2/Makefile..."
3366 echo "# Auto-generated file from 'Makefile.src.in' -- DO NOT EDIT" > $SRC_OBJS_DIR/Makefile
3367 < $ROOT_DIR/Makefile.src.in sed "$SRC_REPLACE" >> $SRC_OBJS_DIR/Makefile
3368 echo "DIRS += $SRC_OBJS_DIR" >> Makefile.am
3369 echo "SRC_DIRS += $SRC_OBJS_DIR" >> Makefile.am
3372 generate_src_osx() {
3373 cc_host_orig="$cc_host"
3374 cxx_host_orig="$cxx_host"
3375 CFLAGS_orig="$CFLAGS"
3376 LDFLAGS_orig="$LDFLAGS"
3378 for type in $enable_universal; do
3380 if [ -n "$osx_sdk_104_path" ]; then
3381 # Use 10.4 SDK for 32-bit targets
3382 CFLAGS="-isysroot $osx_sdk_104_path $CFLAGS_orig"
3383 LDFLAGS="-Wl,-syslibroot,$osx_sdk_104_path $LDFLAGS_orig"
3386 # We don't want to duplicate the x86_64 stuff for each target, so do it once here
3387 if [ "$type" = "ppc64" ] || [ "$type" = "x86_64" ]; then
3388 # 64 bits is always 10.5 or higher. Furthermore it has a non const ICONV
3389 # and they also removed support for QuickTime/QuickDraw
3390 if [ -n "$osx_sdk_path" ]; then
3391 CFLAGS="-isysroot $osx_sdk_path $CFLAGS_orig"
3392 LDFLAGS="-Wl,-syslibroot,$osx_sdk_path $LDFLAGS_orig"
3394 CFLAGS="$CFLAGS -D_SQ64 -DNO_QUICKTIME -UENABLE_COCOA_QUICKDRAW"
3395 LIBS="`echo $LIBS | sed 's/-framework QuickTime//'`"
3400 BASE_SRC_OBJS_DIR="$OBJS_DIR/ppc"
3401 cc_host="$cc_host_orig -arch ppc -mmacosx-version-min=10.3"
3402 cxx_host="$cxx_host_orig -arch ppc -mmacosx-version-min=10.3"
3403 generate_src_normal "[ppc]" "objs/ppc";;
3405 BASE_SRC_OBJS_DIR="$OBJS_DIR/ppc970"
3406 cc_host="$cc_host_orig -arch ppc970 -mmacosx-version-min=10.3 -mcpu=G5 -mpowerpc64 -mtune=970 -mcpu=970 -mpowerpc-gpopt"
3407 cxx_host="$cxx_host_orig -arch ppc970 -mmacosx-version-min=10.3 -mcpu=G5 -mpowerpc64 -mtune=970 -mcpu=970 -mpowerpc-gpopt"
3408 generate_src_normal "[ppc970]" "objs/ppc970";;
3410 BASE_SRC_OBJS_DIR="$OBJS_DIR/i386"
3411 cc_host="$cc_host_orig -arch i386 -mmacosx-version-min=10.4"
3412 cxx_host="$cxx_host_orig -arch i386 -mmacosx-version-min=10.4"
3413 generate_src_normal "[i386]" "objs/i386";;
3415 BASE_SRC_OBJS_DIR="$OBJS_DIR/ppc64"
3416 cc_host="$cc_host_orig -arch ppc64 -mmacosx-version-min=10.5"
3417 cxx_host="$cxx_host_orig -arch ppc64 -mmacosx-version-min=10.5"
3418 generate_src_normal "[ppc64]" "objs/ppc64";;
3420 BASE_SRC_OBJS_DIR="$OBJS_DIR/x86_64"
3421 cc_host="$cc_host_orig -arch x86_64 -mmacosx-version-min=10.5"
3422 cxx_host="$cxx_host_orig -arch x86_64 -mmacosx-version-min=10.5"
3423 generate_src_normal "[x86_64]" "objs/x86_64";;
3424 *) log 1 "Unknown architecture requested for universal build: $type";;
3430 if [ "$os" = "OSX" ] && [ "$enable_universal" != "0" ]; then
3433 generate_src_normal "[SRC]" "objs"
3438 echo "'configure' configures OpenTTD."
3440 echo "Usage: $0 [OPTION]... [VAR=VALUE]..."
3442 echo "To assign environment variables (e.g., CC, CFLAGS...), specify them as"
3443 echo "VAR=VALUE. See below for descriptions of some of the useful variables."
3445 echo "Defaults for the options are specified in brackets."
3447 echo "Configuration:"
3448 echo " -h, --help display this help and exit"
3450 echo "System types:"
3451 echo " --build=BUILD configure for building on BUILD [guessed]"
3452 echo " --host=HOST cross-compile to build programs to run"
3453 echo " on HOST [BUILD]"
3454 echo " --windres=WINDRES the windres to use [HOST-windres]"
3455 echo " --strip=STRIP the strip to use [HOST-strip]"
3456 echo " --awk=AWK the awk to use in configure [awk]"
3457 echo " --pkg-config=PKG-CONFIG the pkg-config to use in configure [pkg-config]"
3458 echo " --lipo=LIPO the lipo to use (OSX ONLY) [HOST-lipo]"
3459 echo " --os=OS the OS we are compiling for [DETECT]"
3460 echo " DETECT/UNIX/OSX/FREEBSD/DRAGONFLY/OPENBSD/"
3461 echo " NETBSD/MORPHOS/HPUX/BEOS/SUNOS/CYGWIN/"
3462 echo " MINGW/OS2/DOS/WINCE/PSP/HAIKU"
3463 echo " --endian=ENDIAN set the endian of the HOST (AUTO/LE/BE)"
3466 echo " --prefix-dir=dir specifies the prefix for all installed"
3467 echo " files [/usr/local]"
3468 echo " --binary-dir=dir location of the binary. Will be prefixed"
3469 echo " with the prefix-dir [games]"
3470 echo " --data-dir=dir location of data files (lang, data, gm)."
3471 echo " Will be prefixed with the prefix-dir"
3472 echo " [share/games/openttd]"
3473 echo " --doc-dir=dir location of the doc files"
3474 echo " Will be prefixed with the prefix-dir"
3476 echo " --icon-dir=dir location of icons. Will be prefixed"
3477 echo " with the prefix-dir [share/pixmaps]"
3478 echo " --icon-theme-dir=dir location of icon theme."
3479 echo " Will be prefixed with the prefix-dir"
3480 echo " and postfixed with size-dirs [$icon_theme_dir]"
3481 echo " --man-dir=dir location of the manual page (UNIX only)"
3482 echo " Will be prefixed with the prefix-dir"
3484 echo " --menu-dir=dir location of the menu item. (UNIX only, except OSX)"
3485 echo " Will be prefixed with the prefix-dir"
3486 echo " [share/applications]"
3487 echo " --personal-dir=dir location of the personal directory"
3488 echo " [os-dependent default]"
3489 echo " --shared-dir=dir location of shared data files"
3490 echo " [os-dependent default]"
3491 echo " --install-dir=dir specifies the root to install to."
3492 echo " Useful to install into jails [/]"
3493 echo " --binary-name the name used for the binary, icons,"
3494 echo " desktop file, etc. when installing [openttd]"
3496 echo "Features and packages:"
3497 echo " --enable-debug[=LVL] enable debug-mode (LVL=[0123], 0 is release)"
3498 echo " --enable-desync-debug=[LVL] enable desync debug options (LVL=[012], 0 is none"
3499 echo " --enable-profiling enables profiling"
3500 echo " --enable-lto enables GCC's Link Time Optimization (LTO)/ICC's"
3501 echo " Interprocedural Optimization if available"
3502 echo " --enable-dedicated compile a dedicated server (without video)"
3503 echo " --enable-static enable static compile (doesn't work for"
3505 echo " --enable-translator enable extra output for translators"
3506 echo " --enable-universal[=ARCH] enable universal builds (OSX ONLY). Allowed is any combination"
3507 echo " of architectures: i386 ppc ppc970 ppc64 x86_64"
3508 echo " Default architectures are: i386 ppc"
3509 echo " --enable-osx-g5 enables optimizations for ppc970 (G5) (OSX ONLY)"
3510 echo " --disable-cocoa-quartz disable the quartz window mode driver for Cocoa (OSX ONLY)"
3511 echo " --disable-cocoa-quickdraw disable the quickdraw window mode driver for Cocoa (OSX ONLY)"
3512 echo " --disable-unicode disable unicode support to build win9x"
3513 echo " version (Win32 ONLY)"
3514 echo " --enable-console compile as a console application instead of as a GUI application."
3515 echo " If this setting is active, debug output will appear in the same"
3516 echo " console instead of opening a new window. (Win32 ONLY)"
3517 echo " --disable-network disable network support"
3518 echo " --disable-assert disable asserts (continue on errors)"
3519 echo " --enable-strip enable any possible stripping"
3520 echo " --without-osx-sysroot disable the automatic adding of sysroot "
3522 echo " --without-application-bundle disable generation of application bundle"
3524 echo " --without-menu-entry Don't generate a menu item (Freedesktop based only)"
3525 echo " --menu-group=group Category in which the menu item will be placed (Freedesktop based only)"
3526 echo " --menu-name=name Name of the menu item when placed [OpenTTD]"
3527 echo " --with-direct-music enable direct music support (Win32 ONLY)"
3528 echo " --with-sort=sort define a non-default location for sort"
3529 echo " --with-midi=midi define which midi-player to use"
3530 echo " --with-midi-arg=arg define which args to use for the"
3532 echo " --with-libtimidity[=\"pkg-config libtimidity\"]"
3533 echo " enables libtimidity support"
3534 echo " --with-allegro[=\"pkg-config allegro\"]"
3535 echo " enables Allegro video driver support"
3536 echo " --with-cocoa enables COCOA video driver (OSX ONLY)"
3537 echo " --with-sdl[=\"pkg-config sdl\"] enables SDL video driver support"
3538 echo " --with-zlib[=\"pkg-config zlib\"]"
3539 echo " enables zlib support"
3540 echo " --with-liblzma[=\"pkg-config liblzma\"]"
3541 echo " enables liblzma support"
3542 echo " --with-liblzo2[=liblzo2.a] enables liblzo2 support"
3543 echo " --with-png[=\"pkg-config libpng\"]"
3544 echo " enables libpng support"
3545 echo " --with-freetype[=\"pkg-config freetype2\"]"
3546 echo " enables libfreetype support"
3547 echo " --with-fontconfig[=\"pkg-config fontconfig\"]"
3548 echo " enables fontconfig support"
3549 echo " --with-xdg-basedir[=\"pkg-config libxdg-basedir\"]"
3550 echo " enables XDG base directory support"
3551 echo " --with-icu[=icu-config] enables icu (used for right-to-left support)"
3552 echo " --static-icu try to link statically (libsicu instead of"
3553 echo " libicu; can fail as the new name is guessed)"
3554 echo " --with-iconv[=iconv-path] enables iconv support"
3555 echo " --with-psp-config[=psp-config] enables psp-config support (PSP ONLY)"
3556 echo " --disable-builtin-depend disable use of builtin deps finder"
3557 echo " --with-makedepend[=makedepend] enables makedepend support"
3558 echo " --with-ccache enables ccache support"
3559 echo " --with-distcc enables distcc support"
3560 echo " --without-grfcodec disable usage of grfcodec and re-generation of base sets"
3561 echo " --without-threads disable threading support"
3562 echo " --without-sse disable SSE support (x86/x86_64 only)"
3564 echo "Some influential environment variables:"
3565 echo " CC C compiler command"
3566 echo " CXX C++ compiler command"
3567 echo " CFLAGS C compiler flags"
3568 echo " CXXFLAGS C++ compiler flags"
3569 echo " WINDRES windres command"
3570 echo " LDFLAGS linker flags, e.g. -L<lib dir> if you"
3571 echo " have libraries in a nonstandard"
3572 echo " directory <lib dir>"
3573 echo " CFLAGS_BUILD C compiler flags for build time tool generation"
3574 echo " CXXFLAGS_BUILD C++ compiler flags for build time tool generation"
3575 echo " LDFLAGS_BUILD linker flags for build time tool generation"
3577 echo "Use these variables to override the choices made by 'configure' or to help"
3578 echo "it to find libraries and programs with nonstandard names/locations."