1 # This file is part of OpenTTD.
2 # 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.
3 # 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.
4 # 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/>.
13 echo "$@" >> $config_log
17 ignore_extra_parameters="0"
18 # We set all kinds of defaults for params. Later on the user can override
19 # most of them; but if they don't, this default is used.
30 pkg_config="pkg-config"
33 config_log="config.log"
34 prefix_dir="/usr/local"
36 data_dir="share/games/openttd"
38 icon_dir="share/pixmaps"
49 enable_desync_debug="0"
61 enable_cocoa_quartz="1"
63 with_application_bundle="1"
73 enable_builtin_depend="1"
139 with_application_bundle
148 enable_builtin_depend
169 CC CXX CFLAGS CXXFLAGS LDFLAGS CFLAGS_BUILD CXXFLAGS_BUILD LDFLAGS_BUILD PKG_CONFIG_PATH PKG_CONFIG_LIBDIR"
173 # Walk over all params from the user and override any default settings if
174 # needed. This also handles any invalid option.
176 if [ -n "$prev_p" ]; then
182 optarg=`expr "x$p" : 'x[^=]*=\(.*\)'`
185 --help | -h | -\?) showhelp; exit 0;;
187 --config-log) prev_p="config_log";;
188 --config-log=*) config_log="$optarg";;
190 --build) prev_p="build";;
191 --build=*) build="$optarg";;
193 --host) prev_p="host";;
194 --host=*) host="$optarg";;
197 --os=*) os="$optarg";;
199 --cpu-type) prev_p="cpu_type";;
200 --cpu-type=*) cpu_type="$optarg";;
202 --cc-build) prev_p="cc_build";;
203 --cc-build=*) cc_build="$optarg";;
204 --cc-host) prev_p="cc_host";;
205 --cc-host=*) cc_host="$optarg";;
206 --cxx-build) prev_p="cxx_build";;
207 --cxx-build=*) cxx_build="$optarg";;
208 --cxx-host) prev_p="cxx_host";;
209 --cxx-host=*) cxx_host="$optarg";;
210 --windres) prev_p="windres";;
211 --windres=*) windres="$optarg";;
212 --awk) prev_p="awk";;
213 --awk=*) awk="$optarg";;
214 --pkg-config) prev_p="pkg_config";;
215 --pkg-config=*) pkg_config="$optarg";;
216 --strip) prev_p="strip";;
217 --strip=*) strip="$optarg";;
218 --lipo) prev_p="lipo";;
219 --lipo=*) lipo="$optarg";;
223 # Alias --prefix with --prefix-dir, for compatibility with GNU autotools
224 --prefix-dir | --prefix) prev_p="prefix_dir";;
225 --prefix-dir=* | --prefix=*) prefix_dir="$optarg";;
227 --binary-dir) prev_p="binary_dir";;
228 --binary-dir=*) binary_dir="$optarg";;
230 --data-dir) prev_p="data_dir";;
231 --data-dir=*) data_dir="$optarg";;
233 --doc-dir) prev_p="doc_dir";;
234 --doc-dir=*) doc_dir="$optarg";;
236 --icon-dir) prev_p="icon_dir";;
237 --icon-dir=*) icon_dir="$optarg";;
239 --icon-theme-dir) prev_p="icon_theme_dir";;
240 --icon-theme-dir=*) icon_theme_dir="$optarg";;
241 --without-icon-theme) icon_theme_dir="";;
243 --menu-dir) prev_p="menu_dir";;
244 --menu-dir=*) menu_dir="$optarg";;
245 --without-menu-entry) menu_dir="";;
247 --menu-name) prev_p="menu_name";;
248 --menu-name=*) menu_name="$optarg";;
250 --binary-name) prev_p="binary_name";;
251 --binary-name=*) binary_name="$optarg";;
253 --man-dir) prev_p="man_dir";;
254 --man-dir=*) man_dir="$optarg";;
256 --personal-dir) prev_p="personal_dir";;
257 --personal-dir=*) personal_dir="$optarg";;
258 --without-personal-dir) personal_dir="";;
260 --shared-dir) prev_p="shared_dir";;
261 --shared-dir=*) shared_dir="$optarg";;
262 --without-shared-dir) shared_dir="";;
264 --install-dir) prev_p="install_dir";;
265 --install-dir=*) install_dir="$optarg";;
269 --menu-group) prev_p="menu_group";;
270 --menu-group=*) menu_group="$optarg";;
274 --enable-debug) enable_debug="1";;
275 --enable-debug=*) enable_debug="$optarg";;
276 --enable-desync-debug) enable_desync_debug="1";;
277 --enable-desync-debug=*) enable_desync_debug="$optarg";;
278 --enable-profiling) enable_profiling="1";;
279 --enable-profiling=*) enable_profiling="$optarg";;
280 --enable-lto) enable_lto="1";;
281 --enable-lto=*) enable_lto="$optarg";;
282 --enable-ipo) enable_lto="1";;
283 --enable-ipo=*) enable_lto="$optarg";;
284 --enable-dedicated) enable_dedicated="1";;
285 --enable-dedicated=*) enable_dedicated="$optarg";;
286 --disable-static) enable_static="0";;
287 --enable-static) enable_static="2";;
288 --enable-static=*) enable_static="$optarg";;
289 --disable-translator) enable_translator="0";;
290 --enable-translator) enable_translator="2";;
291 --enable-translator=*) enable_translator="$optarg";;
292 --disable-assert) enable_assert="0";;
293 --enable-assert) enable_assert="2";;
294 --enable-assert=*) enable_assert="$optarg";;
295 --disable-strip) enable_strip="0";;
296 --enable-strip) enable_strip="2";;
297 --enable-strip=*) enable_strip="$optarg";;
298 --disable-universal) enable_universal="0";;
299 --enable-universal) enable_universal="i386 ppc";;
300 --enable-universal=*) enable_universal="$optarg";;
301 --disable-osx-g5) enable_osx_g5="0";;
302 --enable-osx-g5) enable_osx_g5="2";;
303 --enable-osx-g5=*) enable_osx_g5="$optarg";;
304 --disable-unicode) enable_unicode="0";;
305 --enable-unicode) enable_unicode="2";;
306 --enable-unicode=*) enable_unicode="$optarg";;
307 --disable-console) enable_console="0";;
308 --enable-console) enable_console="2";;
309 --enable-console=*) enable_console="$optarg";;
311 --disable-cocoa-quartz) enable_cocoa_quartz="0";;
312 --enable-cocoa-quartz) enable_cocoa_quartz="2";;
313 --enable-cocoa-quartz=*) enable_cocoa_quartz="$optarg";;
315 --with-allegro) with_allegro="2";;
316 --without-allegro) with_allegro="0";;
317 --with-allegro=*) with_allegro="$optarg";;
319 --with-sdl) with_sdl="2";;
320 --without-sdl) with_sdl="0";;
321 --with-sdl=*) with_sdl="$optarg";;
323 --with-cocoa) with_cocoa="2";;
324 --without-cocoa) with_cocoa="0";;
325 --with-cocoa=*) with_cocoa="$optarg";;
327 --with-zlib) with_zlib="2";;
328 --without-zlib) with_zlib="0";;
329 --with-zlib=*) with_zlib="$optarg";;
331 --with-lzma) with_lzma="2";;
332 --without-lzma) with_lzma="0";;
333 --with-lzma=*) with_lzma="$optarg";;
334 --with-liblzma) with_lzma="2";;
335 --without-liblzma) with_lzma="0";;
336 --with-liblzma=*) with_lzma="$optarg";;
338 --with-lzo2) with_lzo2="2";;
339 --without-lzo2) with_lzo2="0";;
340 --with-lzo2=*) with_lzo2="$optarg";;
341 --with-liblzo2) with_lzo2="2";;
342 --without-liblzo2) with_lzo2="0";;
343 --with-liblzo2=*) with_lzo2="$optarg";;
345 --with-xdg-basedir) with_xdg_basedir="2";;
346 --without-xdg-basedir) with_xdg_basedir="0";;
347 --with-xdg-basedir=*) with_xdg_basedir="$optarg";;
348 --with-libxdg-basedir) with_xdg_basedir="2";;
349 --without-libxdg-basedir) with_xdg_basedir="0";;
350 --with-libxdg-basedir=*) with_xdg_basedir="$optarg";;
352 --with-png) with_png="2";;
353 --without-png) with_png="0";;
354 --with-png=*) with_png="$optarg";;
355 --with-libpng) with_png="2";;
356 --without-libpng) with_png="0";;
357 --with-libpng=*) with_png="$optarg";;
359 --with-fluidsynth) with_fluidsynth="2";;
360 --without-fluidsynth) with_fluidsynth="0";;
361 --with-fluidsynth=*) with_fluidsynth="$optarg";;
363 --with-freetype) with_freetype="2";;
364 --without-freetype) with_freetype="0";;
365 --with-freetype=*) with_freetype="$optarg";;
366 --with-libfreetype) with_freetype="2";;
367 --without-libfreetype) with_freetype="0";;
368 --with-libfreetype=*) with_freetype="$optarg";;
370 --with-fontconfig) with_fontconfig="2";;
371 --without-fontconfig) with_fontconfig="0";;
372 --with-fontconfig=*) with_fontconfig="$optarg";;
373 --with-libfontconfig) with_fontconfig="2";;
374 --without-libfontconfig) with_fontconfig="0";;
375 --with-libfontconfig=*) with_fontconfig="$optarg";;
377 --with-icu) with_icu_layout="2";with_icu_sort="2";;
378 --without-icu) with_icu_layout="0";with_icu_sort="0";;
379 --with-icu=*) with_icu_layout="$optarg";with_icu_sort="$optarg";;
380 --with-libicu) with_icu_layout="2";with_icu_sort="2";;
381 --without-libicu) with_icu_layout="0";with_icu_sort="0";;
382 --with-libicu=*) with_icu_layout="$optarg";with_icu_sort="$optarg";;
383 --with-icu-layout) with_icu_layout="2";;
384 --without-icu-layout) with_icu_layout="0";;
385 --with-icu-layout=*) with_icu_layout="$optarg";;
386 --with-icu-sort) with_icu_sort="2";;
387 --without-icu-sort) with_icu_sort="0";;
388 --with-icu-sort=*) with_icu_sort="$optarg";;
389 --static-icu) static_icu="1";;
390 --static-icu=*) static_icu="$optarg";;
391 --static-libicu) static_icu="1";;
392 --static-libicu=*) static_icu="$optarg";;
394 --with-uniscribe) with_uniscribe="2";;
395 --without-uniscribe) with_uniscribe="0";;
396 --with-uniscribe=*) with_uniscribe="$optarg";;
398 --disable-builtin-depend) enable_builtin_depend="0";;
399 --enable-builtin-depend) enable_builtin_depend="2";;
400 --enable-builtin-depend=*) enable_builtin_depend="$optarg";;
402 --with-makedepend) with_makedepend="2";;
403 --without-makedepend) with_makedepend="0";;
404 --with-makedepend=*) with_makedepend="$optarg";;
406 --with-direct-music) with_direct_music="2";;
407 --without-direct-music) with_direct_music="0";;
408 --with-direct-music=*) with_direct_music="$optarg";;
410 --with-xaudio2) with_xaudio2="2";;
411 --without-xaudio2) with_xaudio2="0";;
412 --with-xaudio2=*) with_xaudio2="$optarg";;
414 --with-sort) with_sort="2";;
415 --without-sort) with_sort="0";;
416 --with-sort=*) with_sort="$optarg";;
418 --with-iconv) with_iconv="2";;
419 --without-iconv) with_iconv="0";;
420 --with-iconv=*) with_iconv="$optarg";;
422 --with-midi=*) with_midi="$optarg";;
423 --with-midi-arg=*) with_midi_arg="$optarg";;
425 --without-distcc) with_distcc="0";;
426 --with-distcc) with_distcc="2";;
427 --with-distcc=*) with_distcc="$optarg";;
429 --without-ccache) with_ccache="0";;
430 --with-ccache) with_ccache="2";;
431 --with-ccache=*) with_ccache="$optarg";;
433 --without-nforenum) with_nforenum="0";;
434 --with-nforenum) with_nforenum="2";;
435 --with-nforenum=*) with_nforenum="$optarg";;
437 --without-grfcodec) with_grfcodec="0";;
438 --with-grfcodec) with_grfcodec="2";;
439 --with-grfcodec=*) with_grfcodec="$optarg";;
441 --without-osx-sysroot) with_osx_sysroot="0";;
442 --with-osx-sysroot) with_osx_sysroot="2";;
443 --with-osx-sysroot=*) with_osx_sysroot="$optarg";;
445 --without-application-bundle) with_application_bundle="0";;
446 --with-application-bundle) with_application_bundle="1";;
447 --with-application-bundle=*) with_application_bundle="$optarg";;
449 --without-threads) with_threads="0";;
450 --with-threads) with_threads="1";;
451 --with-threads=*) with_threads="$optarg";;
453 --without-sse) with_sse="0";;
454 --with-sse) with_sse="1";;
455 --with-sse=*) with_sse="$optarg";;
457 CC=* | --CC=*) CC="$optarg";;
458 CXX=* | --CXX=*) CXX="$optarg";;
459 CFLAGS=* | --CFLAGS=*) CFLAGS="$optarg";;
460 CXXFLAGS=* | --CXXFLAGS=*) CXXFLAGS="$optarg";;
461 LDFLAGS=* | --LDFLAGS=*) LDFLAGS="$optarg";;
462 CFLAGS_BUILD=* | --CFLAGS_BUILD=* | --CFLAGS-BUILD=*) CFLAGS_BUILD="$optarg";;
463 CXXFLAGS_BUILD=* | --CXXFLAGS_BUILD=* | --CXXFLAGS-BUILD=*) CXXFLAGS_BUILD="$optarg";;
464 LDFLAGS_BUILD=* | --LDFLAGS_BUILD=* | --LDFLAGS-BUILD=*) LDFLAGS_BUILD="$optarg";;
465 PKG_CONFIG_PATH=* | --PKG_CONFIG_PATH=* | --PKG-CONFIG-PATH=*) PKG_CONFIG_PATH="$optarg";;
466 PKG_CONFIG_LIBDIR=* | --PKG_CONFIG_LIBDIR=* | --PKG-CONFIG-LIBDIR=*) PKG_CONFIG_LIBDIR="$optarg";;
468 --ignore-extra-parameters) ignore_extra_parameters="1";;
471 if [ "$ignore_extra_parameters" = "0" ]; then
472 log 1 "Unknown option $p"
475 log 1 "Unknown option $p ignored"
481 if [ -n "$prev_p" ]; then
482 log 1 "configure: error: missing argument to --$prev_p"
487 echo "" > $config_log
488 log 2 "Invocation: $0 $*"
492 # Here we save all params, so we can later on do an exact redo of this
493 # configuration, without having the user to re-input stuff
495 echo "Running configure with following options:" >> $config_log
496 echo "" >> $config_log
498 configure="$CONFIGURE_EXECUTABLE --ignore-extra-parameters"
499 for p in $save_params_array; do
501 p=`echo "$p" | sed 's@_@-@g;s@\n@@g;s@ @\\ @g'`
502 # Only save those params that aren't empty
503 configure="$configure --$p=\"$v\""
506 echo "$configure" >> $config_log
507 echo "$configure" > config.cache
508 echo "" >> $config_log
511 # Export a variable so tools like pkg-config can see it when invoked.
512 # If the variable contains an empty string then unset it.
513 # $1 - name of the variable to export or unset
515 eval local value=\$$1
516 if [ -n "$value" ]; then
518 log 2 "using $1=$value";
521 log 2 "not using $1";
526 # Some params want to be in full uppercase, else they might not work as
527 # expected.. fix that here
529 os=`echo $os | tr '[a-z]' '[A-Z]'`
530 cpu_type=`echo $cpu_type | tr '[a-z]' '[A-Z]'`
532 # Export some variables to be used by pkg-config
534 # PKG_CONFIG_LIBDIR variable mustn't be set if we are not willing to
535 # override the default pkg-config search path, it mustn't be an empty
536 # string. If the variable is empty (e.g. when an empty string comes
537 # from config.cache) then unset it. This way the "don't override" state
538 # will be properly preserved when (re)configuring.
539 export_or_unset PKG_CONFIG_PATH
540 export_or_unset PKG_CONFIG_LIBDIR
542 # Check if all params have valid values
544 # OS only allows DETECT, UNIX, OSX, FREEBSD, DRAGONFLY, OPENBSD, NETBSD, HAIKU, SUNOS, CYGWIN, MINGW, and OS2
545 if [ -z "`echo $os | egrep '^(DETECT|UNIX|OSX|FREEBSD|DRAGONFLY|OPENBSD|NETBSD|HPUX|HAIKU|SUNOS|CYGWIN|MINGW|OS2)$'`" ]; then
546 log 1 "configure: error: invalid option --os=$os"
547 log 1 " Available options are: --os=[DETECT|UNIX|OSX|FREEBSD|DRAGONFLY|OPENBSD|NETBSD|HPUX|HAIKU|SUNOS|CYGWIN|MINGW|OS2]"
550 # cpu_type can be either 32 or 64
551 if [ -z "`echo $cpu_type | egrep '^(32|64|DETECT)$'`" ]; then
552 log 1 "configure: error: invalid option --cpu-type=$cpu_type"
553 log 1 " Available options are: --cpu-type[=DETECT|32|64]"
556 # enable_debug should be between 0 and 4
557 if [ -z "`echo $enable_debug | egrep '^[0123]$'`" ]; then
558 log 1 "configure: error: invalid option --enable-debug=$enable_debug"
559 log 1 " Available options are: --enable-debug[=0123]"
563 # enable_desync_debug should be between 0 and 3
564 if [ -z "`echo $enable_desync_debug | egrep '^[012]$'`" ]; then
565 log 1 "configure: error: invalid option --enable-desync-debug=$enable_desync_debug"
566 log 1 " Available options are: --enable-desync-debug[=012]"
577 # Check for universal builds; they only make sense for OSX, so fail if enabled for another OS
578 if [ "$enable_universal" = "0" ]; then
579 log 1 "checking universal build... no"
581 if [ "$os" != "OSX" ]; then
582 log 1 "configure: error: --enable-universal only works on OSX"
585 log 1 "checking universal build... yes, for: $enable_universal"
588 # Already detected by check_build
589 log 1 "checking build cc... $cc_build"
590 log 1 "checking host cc... $cc_host"
595 if [ "$enable_strip" != "0" ]; then
598 log 1 "checking strip... disabled"
602 if [ "$enable_builtin_depend" != "0" ]; then
603 log 1 "checking builtin depend... yes"
604 makedepend="\$(SRC_OBJS_DIR)/\$(DEPEND)"
606 log 1 "checking builtin depend... no"
611 detect_sse_capable_architecture
613 if [ "$enable_static" = "1" ]; then
614 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
621 if [ "$enable_static" != "0" ]; then
622 log 1 "checking static... yes"
624 if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "OSX" ]; then
625 log 1 "WARNING: static is only known to work on Windows, and MacOSX"
626 log 1 "WARNING: use static at your own risk on this platform"
631 log 1 "checking static... no"
634 if [ "$enable_unicode" = "1" ]; then
635 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
642 if [ "$enable_unicode" != "0" ]; then
643 log 1 "checking unicode... yes"
645 log 1 "checking unicode... no"
648 # Show what we configured
649 if [ "$enable_debug" = "0" ]; then
650 log 1 "using debug level... no"
651 elif [ "$enable_profiling" != "0" ]; then
652 log 1 "using debug level... profiling (debug level $enable_debug)"
654 log 1 "using debug level... level $enable_debug"
657 if [ "$enable_desync_debug" = "0" ]; then
658 log 1 "using desync debug level... no"
660 log 1 "using desync debug level... level $enable_desync_debug"
661 log 1 "WARNING: desync debug functions slow down the game considerably."
662 log 1 "WARNING: use only when you are instructed to do so"
663 log 1 " or when you know what you are doing."
668 if [ "$enable_lto" != "0" ]; then
669 # GCC 4.5 outputs '%{flto}', GCC 4.6 outputs '%{flto*}'
670 has_lto=`($cxx_build -dumpspecs 2>&1 | grep '\%{flto') || ($cxx_build -help ipo 2>&1 | grep '\-ipo')`
671 if [ -n "$has_lto" ]; then
672 log 1 "using link time optimization... yes"
675 log 1 "using link time optimization... no"
676 log 1 "WARNING: you selected link time optimization but it is not found."
680 log 1 "using link time optimization... no"
684 if [ "$os" != "OSX" ] && [ "$with_osx_sysroot" != "0" ]; then
685 if [ "$with_osx_sysroot" = "1" ]; then
688 log 1 "checking OSX sysroot... not OSX, skipping"
690 log 1 "configure: error: --with-osx-sysroot only works if OSX is the target"
695 if [ "$with_osx_sysroot" != "0" ]; then
696 if [ "$enable_universal" = "0" ] && [ "$with_osx_sysroot" != "1" ] && [ "$with_osx_sysroot" != "2" ]; then
697 # Sysroot manually specified? Check for usability
698 log 1 "checking OSX sysroot... $with_osx_sysroot"
699 if ! check_osx_sdk "$with_osx_sysroot"; then
700 log 1 "Passed sysroot not found/not functional"
704 # If autodetect and no universal, use system default
705 if [ "$with_osx_sysroot" = "1" ] && [ "$enable_universal" = "0" ]; then
706 log 1 "checking OSX sysroot... no (use system default)"
708 log 1 "checking OSX sysroot... automatically"
713 if [ -n "$osx_sdk_path" ]; then
714 if [ "$enable_universal" != "0" ]; then
715 if [ -z "$osx_sdk_104_path" ]; then
716 log 1 "WARNING: Could not find a usable 10.4u SDK, the resulting"
717 log 1 "WARNING: binary will only run on OSX 10.5 or later"
718 osx_sdk_104_path="$osx_sdk_path"
720 OSX_SYSROOT="-isysroot $osx_sdk_104_path"
721 OSX_LD_SYSROOT="-Wl,-syslibroot,$osx_sdk_104_path"
723 OSX_SYSROOT="-isysroot $osx_sdk_path"
724 OSX_LD_SYSROOT="-Wl,-syslibroot,$osx_sdk_path"
728 if [ "$os" = "OSX" ]; then
729 log 1 "checking OSX sysroot... no (use system default)"
737 if [ "$enable_dedicated" != "0" ]; then
738 log 1 "checking GDI video driver... dedicated server, skipping"
739 log 1 "checking dedicated... found"
741 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
742 log 1 "checking GDI video driver... found"
744 log 1 "checking GDI video driver... not Windows, skipping"
747 if [ -z "$allegro_config" ] && [ -z "$sdl2_config" ] && [ -z "$sdl_config" ] && [ "$with_cocoa" = 0 ] && [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then
748 log 1 "configure: error: no video driver development files found"
749 log 1 " If you want a dedicated server use --enable-dedicated as parameter"
752 log 1 "checking dedicated... not selected"
756 if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then
757 log 1 "checking console application... not Windows, skipping"
758 elif [ "$enable_console" = "1" ] && [ "$enable_dedicated" != "0" ]; then
759 log 1 "checking console application... dedicated server, enabled"
761 elif [ "$enable_console" = "1" ]; then
762 log 1 "checking console application... disabled (only used when forced)"
764 elif [ "$enable_console" = "0" ]; then
765 log 1 "checking console application... disabled"
767 log 1 "checking console application... enabled"
770 log 1 "checking squirrel... found"
771 SCRIPT_SRC_DIR="$ROOT_DIR/src/3rdparty/squirrel/include"
773 if [ "$enable_translator" != "0" ]; then
774 log 1 "checking translator... debug"
775 # -t shows TODO items, normally they are muted
778 log 1 "checking translator... no"
782 if [ "$enable_assert" != "0" ]; then
783 log 1 "checking assert... enabled"
785 log 1 "checking assert... disabled"
788 pre_detect_with_zlib=$with_zlib
791 if [ "$with_zlib" = "0" ] || [ -z "$zlib_config" ]; then
792 log 1 "WARNING: zlib was not detected or disabled"
793 log 1 "WARNING: OpenTTD doesn't require zlib, but it does mean that many features"
794 log 1 "WARNING: (like loading most old savegames/scenarios, loading heightmaps,"
795 log 1 "WARNING: using PNG, or using fonts, ...) will be disabled."
796 if [ "$pre_detect_with_zlib" = "0" ]; then
797 log 1 "WARNING: We strongly suggest you to install zlib."
799 log 1 "configure: error: no zlib detected"
800 log 1 " If you want to compile without zlib use --without-zlib as parameter"
805 pre_detect_with_lzma=$with_lzma
808 if [ "$with_lzma" = "0" ] || [ -z "$lzma_config" ]; then
809 log 1 "WARNING: lzma was not detected or disabled"
810 log 1 "WARNING: OpenTTD doesn't require lzma, but it does mean that many features"
811 log 1 "WARNING: (like loading most savegames/scenarios and joining most servers)"
812 log 1 "WARNING: will be disabled."
813 if [ "$pre_detect_with_lzma" = "0" ]; then
814 log 1 "WARNING: We strongly suggest you to install liblzma."
815 log 1 "configure: error: no liblzma detected"
817 log 1 " If you want to compile without lzma use --without-lzma as parameter"
822 pre_detect_with_lzo2=$with_lzo2
825 if [ "$with_lzo2" = "0" ] || [ -z "$lzo2" ]; then
826 log 1 "WARNING: liblzo2 was not detected or disabled"
827 log 1 "WARNING: OpenTTD doesn't require liblzo2, but it does mean that"
828 log 1 "WARNING: loading old savegames/scenarios will be disabled."
829 if [ "$pre_detect_with_lzo2" = "0" ]; then
830 log 1 "WARNING: We strongly suggest you to install liblzo2."
832 log 1 "configure: error: no liblzo2 detected"
833 log 1 " If you want to compile without liblzo2 use --without-liblzo2 as parameter"
838 if [ "$with_uniscribe" != "0" ]; then
839 if [ "$os" != "MINGW" ]; then
840 if [ "$with_uniscribe" != "1" ]; then
841 log 1 "configure: error: Uniscribe is only supported on native Win32 targets"
846 log 1 "checking Uniscribe text layout... not Windows, skipping"
848 log 1 "checking Uniscribe text layout... found"
850 # Don't use ICU unless forced.
851 if [ "$with_icu_layout" = "1" ]; then
854 if [ "$with_icu_sort" = "1" ]; then
868 if [ "$with_direct_music" != "0" ]; then
869 if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then
870 if [ "$with_direct_music" != "1" ]; then
871 log 1 "configure: error: direct-music is only supported on Win32 targets"
874 with_direct_music="0"
876 log 1 "checking direct-music... not Windows, skipping"
882 if [ "$with_xaudio2" != "0" ]; then
883 if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then
884 if [ "$with_xaudio2" != "1" ]; then
885 log 1 "configure: error: xaudio2 is only supported on Win32 targets"
890 log 1 "checking xaudio2... not Windows, skipping"
898 # Suppress language errors when there is a version defined, indicating a release
899 # It just isn't pretty if any release produces warnings in the languages.
900 if [ -f "$ROOT_DIR/version" ]; then
902 log 1 "suppress language errors... yes"
905 log 1 "suppress language errors... no"
908 if [ "$enable_debug" = "0" ] && [ "$enable_profiling" = "0" ] && [ "$enable_strip" != "0" ]; then
909 if [ "$os" = "OSX" ]; then
911 elif [ "$os" = "OS2" ]; then
913 # OS2 uses strip via gcc, because it needs to be feed to emxbind
914 LDFLAGS="$LDFLAGS -s"
915 elif [ "$os" = "SUNOS" ]; then
916 # The GNU strip does know -s, the non-GNU doesn't
917 # So try to detect it (in a bit of an ugly way)
918 strip_arg="`$strip -s strip.test 2>/dev/null && echo \"-s\"`"
923 log 1 "checking stripping... $strip $strip_arg"
926 log 1 "checking stripping... skipped"
929 if [ "$with_distcc" = "0" ]; then
930 log 1 "checking distcc... no"
931 elif [ "$with_distcc" = "1" ]; then
934 log 1 "checking distcc... no (only used when forced)"
935 elif [ "$with_distcc" = "2" ]; then
938 distcc="$with_distcc"
940 if [ "$with_distcc" != "0" ]; then
941 res="`$distcc --version 2>/dev/null | head -n 1 | cut -b 1-6`"
942 if [ "$res" != "distcc" ]; then
944 log 1 "checking distcc... no"
945 if [ "$with_distcc" = "2" ]; then
946 log 1 "configure: error: no distcc detected, but was forced to be used"
949 if [ "$with_distcc" != "1" ]; then
950 log 1 "configure: error: '$with_distcc' doesn't seem a distcc to me"
955 log 1 "checking distcc... $distcc"
958 if [ "$with_ccache" = "0" ]; then
959 log 1 "checking ccache... no"
960 elif [ "$with_ccache" = "1" ]; then
963 log 1 "checking ccache... no (only used when forced)"
964 elif [ "$with_ccache" = "2" ]; then
967 ccache="$with_ccache"
969 if [ "$with_ccache" != "0" ]; then
970 res="`$ccache --version 2>/dev/null | head -n 1 | cut -b 1-6`"
971 if [ "$res" != "ccache" ]; then
973 log 1 "checking ccache... no"
974 if [ "$with_ccache" = "2" ]; then
975 log 1 "configure: error: no ccache detected, but was forced to be used"
978 if [ "$with_ccache" != "1" ]; then
979 log 1 "configure: error: '$with_ccache' doesn't seem a ccache to me"
984 log 1 "checking ccache... $ccache"
990 if [ -z "$grfcodec" ] && [ -n "$nforenum" ]; then
991 log 1 "checking nforenum/grfcodec... nforenum needs grfcodec enabled, disabling nforenum"
995 if [ -z "$nforenum" ] && [ -n "$grfcodec" ]; then
996 log 1 "checking nforenum/grfcodec... grfcodec needs nforenum enabled, disabling grfcodec"
1000 if [ "$os" != "OSX" ] && [ "$with_application_bundle" != "0" ]; then
1001 if [ "$with_application_bundle" = "1" ]; then
1002 with_application_bundle="0"
1004 log 1 "checking OSX application bundle... not OSX, skipping"
1006 log 1 "configure: error: --with-application-bundle only works if OSX is the target"
1011 if [ "$os" = "OSX" ] && [ "$with_application_bundle" = "1" ]; then
1012 OSXAPP="OpenTTD.app"
1017 if [ "$os" = "OSX" ]; then
1018 # Test on ppc970 (G5) - we can optimize there
1020 if [ "$enable_osx_g5" != "0" ]; then
1021 log 1 "detecting ppc970 (G5)... yes (forced)"
1023 # First, are we a real OSX system, else we can't detect it
1024 native=`LC_ALL=C uname | tr '[A-Z]' '[a-z]' | grep darwin`
1025 # If $host doesn't match $build , we are cross-compiling
1026 if [ -n "$native" ] && [ "$build" = "$host" ]; then
1027 $cxx_build $SRC_DIR/os/macosx/G5_detector.cpp -o G5_detector
1030 if [ -n "$res" ]; then
1031 # This is G5, add flags for it
1034 log 1 "detecting ppc970 (G5)... yes"
1038 log 1 "detecting ppc970 (G5)... no"
1043 log 1 "detecting ppc970 (G5)... no (cross-compiling)"
1047 if [ "$enable_osx_g5" != "0" ]; then
1048 log 1 "configure: error: ppc970 (OSX G5) selected, but not compiling for OSX"
1049 log 1 "configure: error: either select OSX as OS, or deselect ppc970"
1055 if { [ -d "$ROOT_DIR/.git" ] || [ -f "$ROOT_DIR/.git" ]; } && [ -n "`git help 2>/dev/null`" ]; then
1056 log 1 "checking revision... git detection"
1057 elif [ -f "$ROOT_DIR/.ottdrev" ]; then
1058 log 1 "checking revision... source tarball"
1060 log 1 "checking revision... no detection"
1061 log 1 "WARNING: there is no means to determine the version."
1062 log 1 "WARNING: please use a subversion, mercurial, or git checkout of OpenTTD."
1063 log 1 "WARNING: you can only join game servers that have been compiled without"
1064 log 1 "WARNING: version detection."
1065 log 1 "WARNING: there is a great chance you desync."
1066 log 1 "WARNING: USE WITH CAUTION!"
1071 if [ "$doc_dir" = "1" ]; then
1072 if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "DRAGONFLY" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ]; then
1073 doc_dir="share/doc/openttd"
1075 doc_dir="$data_dir/docs"
1078 doc_dir="`echo $doc_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1081 if [ "$icon_theme_dir" = "1" ]; then
1082 if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "DRAGONFLY" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ]; then
1083 icon_theme_dir="share/icons/hicolor"
1088 icon_theme_dir="`echo $icon_theme_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1091 if [ "$personal_dir" = "1" ]; then
1092 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "HAIKU" ]; then
1093 personal_dir="OpenTTD"
1094 elif [ "$os" = "OSX" ]; then
1095 personal_dir="Documents/OpenTTD"
1097 personal_dir=".openttd"
1100 personal_dir="`echo $personal_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1103 if [ "$shared_dir" = "1" ]; then
1104 # we are using default values
1105 if [ "$os" = "OSX" ]; then
1106 shared_dir="/Library/Application\\\\ Support/OpenTTD"
1111 shared_dir="`echo $shared_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1114 if [ "$man_dir" = "1" ]; then
1115 # add manpage on UNIX systems
1116 if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "DRAGONFLY" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ] || [ "$os" = "OSX" ]; then
1117 man_dir="share/man/man6"
1122 man_dir="`echo $man_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1125 if [ "$menu_dir" = "1" ]; then
1126 # add a freedesktop menu item only for some UNIX systems
1127 if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "DRAGONFLY" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ]; then
1128 menu_dir="share/applications"
1133 menu_dir="`echo $menu_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1138 if [ -n "$personal_dir" ]
1140 log 1 "personal home directory... $personal_dir"
1142 log 1 "personal home directory... none"
1145 if [ -n "$shared_dir" ]
1147 log 1 "shared data directory... $shared_dir"
1149 log 1 "shared data directory... none"
1152 if [ -n "$install_dir" ]
1154 log 1 "installation directory... $install_dir"
1156 log 1 "installation directory... none"
1159 if [ -n "$icon_theme_dir" ]
1161 log 1 "icon theme directory... $icon_theme_dir"
1163 log 1 "icon theme directory... none"
1166 if [ -n "$man_dir" ]
1168 log 1 "manual page directory... $man_dir"
1170 log 1 "manual page directory... none"
1173 if [ -n "$menu_dir" ]
1175 log 1 "menu item directory... $menu_dir"
1177 log 1 "menu item directory... none"
1181 make_compiler_cflags() {
1184 # $2 - name of the cflags variable
1185 # $3 - name of the cxxflags variable
1186 # $4 - name of the ldflags variable
1187 # $5 - name of the features variable
1189 # Get the compiler to tell us who it is
1190 version_line="`$1 --version | head -n1`"
1192 eval eval "flags=\\\$$2"
1193 eval eval "cxxflags=\\\$$3"
1194 eval eval "ldflags=\\\$$4"
1195 eval eval "features=\\\$$5"
1197 if [ `echo "$version_line" | cut -d' ' -f1` = "icc" ]; then
1198 # Enable some things only for certain ICC versions
1199 cc_version=`$1 -dumpversion | cut -c 1-4 | sed s@\\\.@@g`
1201 flags="$flags -rdynamic"
1202 ldflags="$ldflags -rdynamic"
1204 if [ -z "$first_time_icc_check" ]; then
1205 first_time_icc_check=no
1206 if [ $cc_version -lt 90 ]; then
1207 log 1 "WARNING: you seem to be using a very old version of ICC"
1208 log 1 "WARNING: OpenTTD hasn't been tested with this version"
1210 elif [ $cc_version -lt 120 ]; then
1211 log 1 "WARNING: you seem to be using an unsupported ICC version"
1212 log 1 "WARNING: ICC older than 12.0 is known to fail to compile OpenTTD"
1217 flags="$flags -Wall"
1218 # remark #111: statement is unreachable
1219 flags="$flags -wd111"
1220 # remark #181: argument is incompatible with corresponding format string conversion
1221 # ICC is very picky about signedness of operands, warnings provided by GCC are enough
1222 flags="$flags -wd181"
1223 # remark #271: trailing comma is nonstandard
1224 flags="$flags -wd271"
1225 # remark #280: selector expression is constant
1226 flags="$flags -wd280"
1227 # remark #304: access control not specified ("public" by default)
1228 flags="$flags -wd304"
1229 # remark #383: value copied to temporary, reference to temporary used
1230 flags="$flags -wd383"
1231 # remark #444: destructor for base class ... is not virtual
1232 flags="$flags -wd444"
1233 # remark #593: variable ... was set but never used
1234 flags="$flags -wd593"
1235 # warning #654: overloaded virtual function ... is only partially overridden in class ...
1236 flags="$flags -wd654"
1237 # remark #810: conversion from ... to ... may lose significant bits
1238 flags="$flags -wd810"
1239 # remark #869: parameter ... was never referenced
1240 flags="$flags -wd869"
1241 # warning #873: function ... ::operator new ... has no corresponding operator delete ...
1242 flags="$flags -wd873"
1243 # remark #981: operands are evaluated in unspecified order
1244 flags="$flags -wd981"
1245 # remark #1418: external function definition with no prior declaration
1246 flags="$flags -wd1418"
1247 # remark #1419: external declaration in primary source file
1248 flags="$flags -wd1419"
1249 # remark #1572: floating-point equality and inequality
1250 flags="$flags -wd1572"
1251 # remark #1599: declaration hides variable/parameter ...
1252 flags="$flags -wd1599"
1253 # remark #1720: function ... ::operator new ... has no corresponding member operator delete ...
1254 flags="$flags -wd1720"
1256 if [ $cc_version -lt 110 ]; then
1257 # warns about system headers with recent glibc:
1258 # warning #1292: attribute "__nonnull__" ignored
1259 flags="$flags -wd1292"
1262 if [ $cc_version -ge 100 ]; then
1263 # warning #1899: multicharacter character literal (potential portability problem)
1264 flags="$flags -wd1899"
1265 # vec report defaults to telling where it did loop vectorisation, which is not very important
1266 flags="$flags -vec-report=0 "
1269 if [ $cc_version -ge 110 ]; then
1270 # remark #2259: non-pointer conversion from ... to ... may lose significant bits
1271 flags="$flags -wd2259"
1274 if [ "$enable_lto" != "0" ]; then
1275 has_ipo=`$1 -help ipo | grep '\-ipo'`
1276 if [ -n "$has_ipo" ]; then
1277 # Use IPO (only if we see IPO exists and is requested)
1279 features="$features lto"
1282 elif echo "$version_line" | grep -q "clang"; then
1283 # Enable some things only for certain clang versions
1284 # Need to try really hard to get the version line, because OSX clang likes to hide its true version
1285 cc_version="`$1 -v 2>&1 | grep -i version | head -n 1 | sed s@[^0-9]@@g | cut -c 1-2`"
1287 # aliasing rules are not held in openttd code
1288 flags="$flags -fno-strict-aliasing"
1290 # -W alone doesn't enable all warnings enabled by -Wall; on the other hand,
1291 # -Weverything enables too many useless warnings that can't be disabled (as of 3.0)
1292 flags="$flags -Wall -W -Wextra"
1294 # warning: unused parameter '...'
1295 flags="$flags -Wno-unused-parameter"
1297 # warning: expression result unused
1298 flags="$flags -Wno-unused-value"
1300 # warning: multi-character character constant
1301 flags="$flags -Wno-multichar"
1303 # warning: explicitly assigning a variable of type '...' to itself
1304 # it happens when using the FOR_ALL_WINDOWS_FROM_BACK_FROM macro
1305 flags="$flags -Wno-self-assign"
1307 # warning: <something> is a C++11 extension
1308 flags="$flags -Wno-c++11-extensions"
1310 if [ "$cc_version" -lt "30" ]; then
1311 # warning: equality comparison with extraneous parentheses
1312 flags="$flags -Wno-parentheses"
1313 # warning: operands of ? are integers of different signs: 'unsigned int' and 'int'
1314 flags="$flags -Wno-sign-compare"
1317 if [ "$cc_version" -ge "30" ]; then
1318 # warning: equality comparison with extraneous parentheses
1319 # this warning could be useful, but it warns about code in squirrel
1320 flags="$flags -Wno-parentheses-equality"
1323 if [ "$with_ccache" != "0" -o "$with_distcc" != "0" ]; then
1324 # ccache and distcc run separate preprocess and compile passes,
1325 # both are fed with the same CFLAGS. Unfortunately, clang
1326 # complains about -I when compiling preprocessed files:
1327 # "clang: warning: argument unused during compilation: '-I /usr/include'"
1328 flags="$flags -Qunused-arguments"
1331 if [ "$enable_assert" -eq "0" ]; then
1332 # do not warn about unused variables when building without asserts
1333 flags="$flags -Wno-unused-variable"
1336 # rdynamic is used to get useful stack traces from crash reports.
1337 ldflags="$ldflags -rdynamic"
1339 # Assume gcc, since it just uses argv[0] in its --version output
1341 # Enable some things only for certain GCC versions
1342 # cc_version = major_version * 100 + minor_version
1343 # For example: "3.3" -> 303, "4.9.2" -> 409, "6" -> 600, "23.5" -> 2305
1344 cc_version=`$1 -dumpversion | $awk -F . '{printf "%d%02d", $1, $2}'`
1346 if [ $cc_version -lt 303 ]; then
1347 log 1 "configure: error: gcc older than 3.3 can't compile OpenTTD because of its poor template support"
1351 flags="$flags -Wall -Wno-multichar -Wsign-compare -Wundef"
1352 flags="$flags -Wwrite-strings -Wpointer-arith"
1353 flags="$flags -W -Wno-unused-parameter -Wredundant-decls"
1354 flags="$flags -Wformat=2 -Wformat-security"
1356 if [ $enable_assert -eq 0 ]; then
1357 # Do not warn about unused variables when building without asserts
1358 flags="$flags -Wno-unused-variable"
1359 if [ $cc_version -ge 406 ]; then
1360 # GCC 4.6 gives more warnings, disable them too
1361 flags="$flags -Wno-unused-but-set-variable"
1362 flags="$flags -Wno-unused-but-set-parameter"
1366 if [ $cc_version -ge 304 ]; then
1367 # Warn when a variable is used to initialise itself:
1369 flags="$flags -Winit-self"
1372 if [ $cc_version -ge 400 ]; then
1373 # GCC 4.0+ complains about that we break strict-aliasing.
1374 # On most places we don't see how to fix it, and it doesn't
1375 # break anything. So disable strict-aliasing to make the
1376 # compiler all happy.
1377 flags="$flags -fno-strict-aliasing"
1378 # Warn about casting-out 'const' with regular C-style cast.
1379 # The preferred way is const_cast<>() which doesn't warn.
1380 flags="$flags -Wcast-qual"
1383 if [ $cc_version -ge 402 ]; then
1384 # GCC 4.2+ automatically assumes that signed overflows do
1385 # not occur in signed arithmetic, whereas we are not
1386 # sure that they will not happen. It furthermore complains
1387 # about its own optimized code in some places.
1388 flags="$flags -fno-strict-overflow"
1389 # GCC 4.2 no longer includes -Wnon-virtual-dtor in -Wall.
1390 # Enable it in order to be consistent with older GCC versions.
1391 flags="$flags -Wnon-virtual-dtor"
1394 if [ $cc_version -eq 405 ]; then
1395 # Prevent optimisation supposing enums are in a range specified by the standard
1396 # For details, see http://gcc.gnu.org/PR43680
1397 flags="$flags -fno-tree-vrp"
1400 if [ $cc_version -eq 407 ]; then
1401 # Disable -Wnarrowing which gives many warnings, such as:
1402 # warning: narrowing conversion of '...' from 'unsigned int' to 'int' inside { } [-Wnarrowing]
1403 # They are valid according to the C++ standard, but useless.
1404 cxxflags="$cxxflags -Wno-narrowing"
1407 if [ $cc_version -ge 407 ]; then
1408 # Disable bogus 'attempt to free a non-heap object' warning
1409 flags="$flags -Wno-free-nonheap-object"
1412 if [ $cc_version -ge 600 ]; then
1413 # -flifetime-dse=2 (default since GCC 6) doesn't play
1414 # well with our custom pool item allocator
1415 cxxflags="$cxxflags -flifetime-dse=1"
1418 if [ "$enable_lto" != "0" ]; then
1419 # GCC 4.5 outputs '%{flto}', GCC 4.6 outputs '%{flto*}'
1420 has_lto=`$1 -dumpspecs | grep '\%{flto'`
1421 if [ -n "$has_lto" ]; then
1422 # Use LTO only if we see LTO exists and is requested
1423 if [ $cc_version -lt 406 ]; then
1424 flags="$flags -flto"
1426 flags="$flags -flto=jobserver"
1428 ldflags="$ldflags -fwhole-program"
1429 features="$features lto"
1433 has_rdynamic=`$1 -dumpspecs | grep rdynamic`
1434 if [ -n "$has_rdynamic" ]; then
1435 # rdynamic is used to get useful stack traces from crash reports.
1436 flags="$flags -rdynamic"
1437 ldflags="$ldflags -rdynamic"
1441 eval "$2=\"$flags\""
1442 eval "$3=\"$cxxflags\""
1443 eval "$4=\"$ldflags\""
1444 eval "$5=\"$features\""
1447 make_cflags_and_ldflags() {
1448 # General CFlags for BUILD
1449 CFLAGS_BUILD_ENV="$CFLAGS_BUILD"
1451 # Special CXXFlags for BUILD
1452 CXXFLAGS_BUILD_ENV="$CXXFLAGS_BUILD"
1455 LDFLAGS_BUILD_ENV="$LDFLAGS_BUILD"
1457 # FEATURES for BUILD (lto)
1459 # General CFlags for HOST
1460 CFLAGS_ENV="$CFLAGS"
1462 # Special CXXFlags for HOST
1463 CXXFLAGS_ENV="$CXXFLAGS"
1465 # Libs to compile. In fact this is just LDFLAGS
1467 # LDFLAGS used for HOST
1468 LDFLAGS_ENV="$LDFLAGS"
1470 # FEATURES for HOST (lto)
1473 make_compiler_cflags "$cc_build" "CFLAGS_BUILD" "CXXFLAGS_BUILD" "LDFLAGS_BUILD" "FEATURES_BUILD"
1474 make_compiler_cflags "$cc_host" "CFLAGS" "CXXFLAGS" "LDFLAGS" "FEATURES"
1476 CFLAGS="$CFLAGS -D$os"
1477 CFLAGS_BUILD="$CFLAGS_BUILD -D$os"
1478 CXXFLAGS="$CXXFLAGS -std=c++11"
1479 CXXFLAGS_BUILD="$CXXFLAGS_BUILD -std=c++11"
1481 if [ "$enable_debug" = "0" ]; then
1482 # No debug, add default stuff
1483 OBJS_SUBDIR="release"
1485 if [ "$enable_profiling" = "0" ]; then
1486 # -fomit-frame-pointer and -pg do not go well together (gcc errors they are incompatible)
1487 CFLAGS="-fomit-frame-pointer $CFLAGS"
1489 CFLAGS="-O2 $CFLAGS"
1493 # Each debug level reduces the optimization by a bit
1494 if [ $enable_debug -ge 1 ]; then
1495 CFLAGS="$CFLAGS -g -D_DEBUG"
1497 if [ $enable_debug -ge 2 ]; then
1498 CFLAGS="$CFLAGS -fno-inline"
1500 if [ $enable_debug -ge 3 ]; then
1501 CFLAGS="$CFLAGS -O0"
1503 CFLAGS="$CFLAGS -O2"
1507 if [ $enable_debug -le 2 ]; then
1508 cc_host_is_gcc=`basename "$cc_host" | grep "gcc" 2>/dev/null`
1509 if [ -n "$cc_host_is_gcc" ]; then
1510 # Define only when compiling with GCC. Some GLIBC versions use GNU
1511 # extensions in a way that breaks build with at least ICC.
1512 # This requires -O1 or more, so debug level 3 (-O0) is excluded.
1513 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
1514 if [ "$os" = "MINGW" ]; then
1515 # Prevent undefined references when _FORTIFY_SOURCE > 0
1516 LDFLAGS="$LDFLAGS -fstack-protector"
1520 cc_build_is_gcc=`basename "$cc_build" | grep "gcc" 2>/dev/null`
1521 if [ -n "$cc_build_is_gcc" ]; then
1522 # Just add -O1 to the tools needed for building.
1523 CFLAGS_BUILD="$CFLAGS_BUILD -D_FORTIFY_SOURCE=2 -O1"
1524 if [ "$os" = "MINGW" ]; then
1525 # Prevent undefined references when _FORTIFY_SOURCE > 0
1526 LDFLAGS_BUILD="$LDFLAGS_BUILD -fstack-protector"
1531 if [ "$os" = "OSX" ] && [ $cc_version -eq 400 ]; then
1532 # Apple's GCC 4.0 has a compiler bug for x86_64 with (higher) optimization,
1533 # wrongly optimizing ^= in loops. This disables the failing optimisation.
1534 CFLAGS="$CFLAGS -fno-expensive-optimizations"
1537 if [ "$enable_profiling" != "0" ]; then
1538 CFLAGS="$CFLAGS -pg"
1539 LDFLAGS="$LDFLAGS -pg"
1542 if [ "$with_threads" = "0" ]; then
1543 CFLAGS="$CFLAGS -DNO_THREADS"
1545 if [ "$with_sse" = "1" ]; then
1546 CFLAGS="$CFLAGS -DWITH_SSE"
1549 if [ "`echo $1 | cut -c 1-3`" != "icc" ]; then
1550 if [ "$os" = "CYGWIN" ]; then
1551 flags="$flags -mwin32"
1552 LDFLAGS="$LDFLAGS -mwin32"
1554 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
1555 if [ $cc_version -lt 406 ]; then
1556 flags="$flags -mno-cygwin"
1557 LDFLAGS="$LDFLAGS -mno-cygwin"
1560 if [ "$enable_console" != "0" ]; then
1561 LDFLAGS="$LDFLAGS -Wl,--subsystem,console"
1563 LDFLAGS="$LDFLAGS -Wl,--subsystem,windows"
1566 LIBS="$LIBS -lws2_32 -lwinmm -lusp10 -lgdi32 -ldxguid -lole32 -limm32"
1568 if [ $cc_version -ge 404 ]; then
1569 LDFLAGS_BUILD="$LDFLAGS_BUILD -static-libgcc -static-libstdc++"
1571 if [ $cc_version -ge 407 ]; then
1572 CFLAGS="$CFLAGS -mno-ms-bitfields"
1577 if [ "$os" != "CYGWIN" ] && [ "$os" != "HAIKU" ] && [ "$os" != "OPENBSD" ] && [ "$os" != "MINGW" ] && [ "$os" != "OSX" ] && [ "$os" != "OS2" ]; then
1578 LIBS="$LIBS -lpthread"
1581 if [ "$os" != "CYGWIN" ] && [ "$os" != "HAIKU" ] && [ "$os" != "MINGW" ]; then
1585 if [ "$os" = "OPENBSD" ]; then
1586 LIBS="$LIBS -pthread"
1589 if [ "$os" = "OSX" ]; then
1590 LDFLAGS="$LDFLAGS -framework Cocoa"
1592 # Add macports include dir which is not always set a default system dir. This avoids zillions of bogus warnings.
1593 CFLAGS="$CFLAGS -isystem/opt/local/include"
1595 if [ "$enable_universal" = "0" ]; then
1596 # Universal builds set this elsewhere
1597 CFLAGS="$OSX_SYSROOT $CFLAGS"
1598 LDFLAGS="$OSX_LD_SYSROOT $LDFLAGS"
1602 if [ "$os" = "HAIKU" ]; then
1603 LIBS="$LIBS -lmidi -lbe"
1606 # Most targets act like UNIX, just with some additions
1607 if [ "$os" = "HAIKU" ] || [ "$os" = "OSX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "DRAGONFLY" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ] || [ "$os" = "OS2" ]; then
1608 CFLAGS="$CFLAGS -DUNIX"
1610 # And others like Windows
1611 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
1612 CFLAGS="$CFLAGS -DWIN"
1615 if [ -n "$allegro_config" ]; then
1616 CFLAGS="$CFLAGS -DWITH_ALLEGRO"
1617 CFLAGS="$CFLAGS `$allegro_config --cflags`"
1618 if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then
1619 if [ "$enable_static" != "0" ]; then
1620 LIBS="$LIBS `$allegro_config --static --libs`"
1622 LIBS="$LIBS `$allegro_config --libs`"
1627 if [ -n "$sdl2_config" ]; then
1628 CFLAGS="$CFLAGS -DWITH_SDL2"
1629 # SDL must not add _GNU_SOURCE as it breaks many platforms
1630 CFLAGS="$CFLAGS `$sdl2_config --cflags | sed 's@-D_GNU_SOURCE[^ ]*@@'`"
1631 if [ "$enable_static" != "0" ]; then
1632 LIBS="$LIBS `$sdl2_config --static --libs`"
1634 LIBS="$LIBS `$sdl2_config --libs`"
1636 elif [ -n "$sdl_config" ]; then
1637 CFLAGS="$CFLAGS -DWITH_SDL"
1638 # SDL must not add _GNU_SOURCE as it breaks many platforms
1639 CFLAGS="$CFLAGS `$sdl_config --cflags | sed 's@-D_GNU_SOURCE[^ ]*@@'`"
1640 if [ "$enable_static" != "0" ]; then
1641 LIBS="$LIBS `$sdl_config --static --libs`"
1643 LIBS="$LIBS `$sdl_config --libs`"
1647 if [ "$with_cocoa" != "0" ]; then
1648 CFLAGS="$CFLAGS -DWITH_COCOA"
1649 LIBS="$LIBS -F$osx_sdk_path/System/Library/Frameworks -framework Cocoa -framework AudioUnit -framework AudioToolbox"
1651 if [ "$enable_cocoa_quartz" != "0" ]; then
1652 CFLAGS="$CFLAGS -DENABLE_COCOA_QUARTZ"
1656 if [ "$with_zlib" != "0" ]; then
1657 CFLAGS="$CFLAGS -DWITH_ZLIB"
1658 CFLAGS="$CFLAGS `$zlib_config --cflags | tr '\n\r' ' '`"
1659 if [ "$enable_static" != "0" ]; then
1660 LIBS="$LIBS `$zlib_config --libs --static | tr '\n\r' ' '`"
1662 LIBS="$LIBS `$zlib_config --libs | tr '\n\r' ' '`"
1666 if [ -n "$lzma_config" ]; then
1667 CFLAGS="$CFLAGS -DWITH_LIBLZMA"
1668 CFLAGS="$CFLAGS `$lzma_config --cflags | tr '\n\r' ' '`"
1670 if [ "$enable_static" != "0" ]; then
1671 CFLAGS="$CFLAGS -DLZMA_API_STATIC"
1672 LIBS="$LIBS `$lzma_config --libs --static | tr '\n\r' ' '`"
1674 LIBS="$LIBS `$lzma_config --libs | tr '\n\r' ' '`"
1678 if [ "$with_lzo2" != "0" ]; then
1679 if [ "$enable_static" != "0" ] && [ "$os" != "OSX" ]; then
1684 CFLAGS="$CFLAGS -DWITH_LZO"
1687 if [ -n "$xdg_basedir_config" ]; then
1688 CFLAGS="$CFLAGS -DWITH_XDG_BASEDIR"
1689 CFLAGS="$CFLAGS `$xdg_basedir_config --cflags | tr '\n\r' ' '`"
1691 if [ "$enable_static" != "0" ]; then
1692 LIBS="$LIBS `$xdg_basedir_config --libs --static | tr '\n\r' ' '`"
1694 LIBS="$LIBS `$xdg_basedir_config --libs | tr '\n\r' ' '`"
1698 # 64bit machines need -D_SQ64
1699 if [ "$cpu_type" = "64" ] && [ "$enable_universal" = "0" ]; then
1700 CFLAGS="$CFLAGS -D_SQ64"
1702 CFLAGS="$CFLAGS -I$SCRIPT_SRC_DIR"
1704 if [ -n "$png_config" ]; then
1705 CFLAGS="$CFLAGS -DWITH_PNG"
1706 CFLAGS="$CFLAGS `$png_config --cflags | tr '\n\r' ' '`"
1708 if [ "$enable_static" != "0" ]; then
1709 LIBS="$LIBS `$png_config --libs --static | tr '\n\r' ' '`"
1711 LIBS="$LIBS `$png_config --libs | tr '\n\r' ' '`"
1715 if [ -n "$fontconfig_config" ]; then
1716 CFLAGS="$CFLAGS -DWITH_FONTCONFIG"
1717 CFLAGS="$CFLAGS `$fontconfig_config --cflags | tr '\n\r' ' '`"
1719 if [ "$enable_static" != "0" ]; then
1720 LIBS="$LIBS `$fontconfig_config --libs --static | tr '\n\r' ' '`"
1722 LIBS="$LIBS `$fontconfig_config --libs | tr '\n\r' ' '`"
1726 if [ -n "$freetype_config" ]; then
1727 CFLAGS="$CFLAGS -DWITH_FREETYPE"
1728 CFLAGS="$CFLAGS `$freetype_config --cflags | tr '\n\r' ' '`"
1730 if [ "$enable_static" != "0" ]; then
1731 LIBS="$LIBS `$freetype_config --libs --static | tr '\n\r' ' '` -lfreetype"
1733 LIBS="$LIBS `$freetype_config --libs | tr '\n\r' ' '`"
1737 if [ -n "$icu_layout_config" ]; then
1738 CFLAGS="$CFLAGS -DWITH_ICU_LX"
1739 CFLAGS="$CFLAGS `$icu_layout_config --cflags | tr '\n\r' ' '`"
1741 if [ "$static_icu" != "0" ]; then
1742 LIBS="$LIBS `$icu_layout_config --libs --static | tr '\n\r' ' ' | sed s/-licu/-lsicu/g`"
1744 LIBS="$LIBS `$icu_layout_config --libs | tr '\n\r' ' '`"
1748 if [ -n "$icu_sort_config" ]; then
1749 CFLAGS="$CFLAGS -DWITH_ICU_I18N"
1750 CFLAGS="$CFLAGS `$icu_sort_config --cflags | tr '\n\r' ' '`"
1752 if [ "$static_icu" != "0" ]; then
1753 LIBS="$LIBS `$icu_sort_config --libs --static | tr '\n\r' ' ' | sed s/-licu/-lsicu/g`"
1755 LIBS="$LIBS `$icu_sort_config --libs | tr '\n\r' ' '`"
1759 if [ "$with_uniscribe" != "0" ]; then
1760 CFLAGS="$CFLAGS -DWITH_UNISCRIBE"
1761 LIBS="$LIBS -lusp10"
1764 if [ "$with_direct_music" != "0" ]; then
1765 CFLAGS="$CFLAGS -DWIN32_ENABLE_DIRECTMUSIC_SUPPORT"
1766 # GCC 4.0+ doesn't like the DirectX includes (gives tons of
1767 # warnings on it we won't be able to fix). For now just
1768 # suppress those warnings.
1769 if [ $cc_version -ge 400 ]; then
1770 CFLAGS="$CFLAGS -Wno-non-virtual-dtor"
1774 if [ "$with_xaudio2" != "0" ]; then
1775 CFLAGS="$CFLAGS -DWITH_XAUDIO2"
1778 if [ -n "$fluidsynth" ]; then
1779 LIBS="$LIBS -lfluidsynth"
1780 CFLAGS="$CFLAGS -DFLUIDSYNTH"
1783 if [ "$with_iconv" != "0" ]; then
1784 CFLAGS="$CFLAGS -DWITH_ICONV"
1785 if [ "$link_to_iconv" = "yes" ]; then
1786 LIBS="$LIBS -liconv"
1787 if [ "$with_iconv" != "2" ]; then
1788 CFLAGS="$CFLAGS -I$with_iconv/include"
1789 LIBS="$LIBS -L$with_iconv/lib"
1793 if [ "$os" != "OSX" ] && [ "$have_non_const_iconv" != "no" ]; then
1794 CFLAGS="$CFLAGS -DHAVE_NON_CONST_ICONV"
1798 if [ -n "$with_midi" ]; then
1799 CFLAGS="$CFLAGS -DEXTERNAL_PLAYER=\\\\\"$with_midi\\\\\""
1801 if [ -n "$with_midi_arg" ]; then
1802 CFLAGS="$CFLAGS -DMIDI_ARG=\\\\\"$with_midi_arg\\\\\""
1805 if [ "$enable_dedicated" != "0" ]; then
1806 CFLAGS="$CFLAGS -DDEDICATED"
1809 if [ "$enable_unicode" != "0" ]; then
1810 CFLAGS="$CFLAGS -DUNICODE -D_UNICODE"
1813 if [ "$os" = "HAIKU" ]; then
1814 LDFLAGS="$LDFLAGS -lnetwork"
1817 if [ "$os" = "SUNOS" ]; then
1818 LDFLAGS="$LDFLAGS -lnsl -lsocket"
1821 if [ "$enable_static" != "0" ]; then
1822 # OSX can't handle -static in LDFLAGS
1823 if [ "$os" != "OSX" ]; then
1824 LDFLAGS="$LDFLAGS -static"
1828 if [ "$enable_assert" = "0" ]; then
1829 CFLAGS="$CFLAGS -DNDEBUG"
1830 CFLAGS_BUILD="$CFLAGS_BUILD -DNDEBUG"
1833 if [ "$enable_desync_debug" != "0" ]; then
1834 CFLAGS="$CFLAGS -DRANDOM_DEBUG"
1837 if [ "$enable_osx_g5" != "0" ]; then
1838 CFLAGS="$CFLAGS -mcpu=G5 -mpowerpc64 -mtune=970 -mcpu=970 -mpowerpc-gpopt"
1841 if [ -n "$personal_dir" ]; then
1842 CFLAGS="$CFLAGS -DWITH_PERSONAL_DIR -DPERSONAL_DIR=\\\\\"$personal_dir\\\\\""
1845 if [ -n "$shared_dir" ]; then
1846 CFLAGS="$CFLAGS -DWITH_SHARED_DIR -DSHARED_DIR=\\\\\"$shared_dir\\\\\""
1849 CFLAGS="$CFLAGS -DGLOBAL_DATA_DIR=\\\\\"$prefix_dir/$data_dir\\\\\""
1851 if [ "$enable_lto" != "0" ]; then
1852 lto_build=`echo "$FEATURES_BUILD" | grep "lto"`
1853 lto_host=`echo "$FEATURES" | grep "lto"`
1854 if [ -z "$lto_build$lto_host" ]; then
1855 log 1 "WARNING: you enabled LTO/IPO, but neither build nor host compiler supports it"
1856 log 1 "WARNING: LTO/IPO has been disabled"
1858 if [ -n "$lto_build" ]; then
1859 LDFLAGS_BUILD="$LDFLAGS_BUILD $CFLAGS_BUILD $CXXFLAGS_BUILD"
1861 if [ -n "$lto_host" ]; then
1862 LDFLAGS="$LDFLAGS $CFLAGS $CXXFLAGS"
1866 # All flags to be extended via the env
1867 CFLAGS_BUILD="$CFLAGS_BUILD $CFLAGS_BUILD_ENV"
1868 CXXFLAGS_BUILD="$CXXFLAGS_BUILD $CXXFLAGS_BUILD_ENV"
1869 LDFLAGS_BUILD="$LDFLAGS_BUILD $LDFLAGS_BUILD_ENV"
1870 CFLAGS="$CFLAGS $CFLAGS_ENV"
1871 CXXFLAGS="$CXXFLAGS $CXXFLAGS_ENV"
1872 LDFLAGS="$LDFLAGS $LDFLAGS_ENV"
1874 log 1 "using CFLAGS_BUILD... $CFLAGS_BUILD"
1875 log 1 "using CXXFLAGS_BUILD... $CXXFLAGS_BUILD"
1876 log 1 "using LDFLAGS_BUILD... $LDFLAGS_BUILD"
1877 log 1 "using CFLAGS... $CFLAGS"
1878 log 1 "using CXXFLAGS... $CXXFLAGS"
1879 log 1 "using LDFLAGS... $LIBS $LDFLAGS"
1881 # Makedepend doesn't like something like: -isysroot /OSX/blabla
1882 # so convert it to: -isysroot -OSX/blabla. makedepend just ignores
1883 # any - command it doesn't know, so we are pretty save.
1884 # Lovely hackish, not?
1885 # Btw, this almost always comes from outside the configure, so it is
1886 # not something we can control.
1887 # Also make makedepend aware of compiler's built-in defines.
1888 if [ "$with_makedepend" != "0" ] || [ "$enable_builtin_depend" != "0" ]; then
1889 # Append CXXFLAGS possibly containing -std=c++0x
1890 cflags_makedep="`echo | $cxx_host $CXXFLAGS -E -x c++ -dM - | sed 's@.define @-D@g;s@ .*@ @g;s@(.*)@@g' | tr -d '\r\n'`"
1892 # Please escape ALL " within ` because e.g. "" terminates the string in some sh implementations
1893 cflags_makedep="$cflags_makedep `echo \"$CFLAGS\" \"$CXXFLAGS\" | sed 's@ /@ -@g;s@-I[ ]*[^ ]*@@g;s@[ ]*-[^D][^ ]*@@g'`"
1898 if [ "$with_distcc" != "0" ]; then
1899 cc_host="$distcc $cc_host"
1900 cxx_host="$distcc $cxx_host"
1902 log 1 " NOTICE: remind yourself to use 'make -jN' to make use of distcc"
1906 if [ "$with_ccache" != "0" ]; then
1907 cc_host="$ccache $cc_host"
1908 cxx_host="$ccache $cxx_host"
1914 # $1 - Type for message (build / host)
1915 # $2 - What to fill with the found compiler
1916 # $3 - System to try
1917 # $4 - Compiler to try
1918 # $5 - Env-setting to try
1919 # $6 - GCC alike to try
1920 # $7 - CC alike to try
1921 # $8 - "0" gcc, "1" g++, "2" windres, "3" strip, "4" lipo
1922 # $9 - What the command is to check for
1924 if [ -n "$4" ]; then
1925 # Check for manual compiler
1926 machine=`$4 $9 2>/dev/null`
1930 log 2 "executing $4 $9"
1931 log 2 " returned $machine"
1932 log 2 " exit code $ret"
1934 if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ]; then
1935 log 1 "checking $1... $4 not found"
1936 log 1 "the selected binary doesn't seem to be a $6 binary"
1939 elif [ -n "$3" ]; then
1941 if [ -z "$6" ]; then
1946 machine=`eval $compiler $9 2>/dev/null`
1948 eval "$2=\"$compiler\""
1950 log 2 "executing $compiler $9"
1951 log 2 " returned $machine"
1952 log 2 " exit code $ret"
1954 if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ]; then
1955 if [ -z "$5" ]; then
1956 log 1 "checking $1... $compiler not found"
1957 log 1 "I couldn't detect any $6 binary for $3"
1962 machine=`eval $compiler $9 2>/dev/null`
1964 eval "$2=\"$compiler\""
1966 log 2 "executing $compiler $9"
1967 log 2 " returned $machine"
1968 log 2 " exit code $ret"
1970 if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ]; then
1971 log 1 "checking $1... $compiler not found"
1972 log 1 "I couldn't detect any $5 binary for $3"
1977 if [ "$machine" != "$3" ] && ( [ "$8" = "0" ] || [ "$8" = "1" ] ); then
1978 log 1 "checking $1... expected $3, found $machine"
1979 log 1 "the compiler suggests it doesn't build code for the machine you specified"
1983 # Nothing given, autodetect
1985 if [ -n "$5" ]; then
1986 machine=`$5 $9 2>/dev/null`
1990 log 2 "executing $5 $9"
1991 log 2 " returned $machine"
1992 log 2 " exit code $ret"
1994 # The user defined a GCC that doesn't reply to $9.. abort
1995 if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ]; then
1996 log 1 "checking $1... $5 unusable"
1997 log 1 "the CC environment variable is set, but it doesn't seem to be a $6 binary"
1998 log 1 "please redefine the CC/CXX environment to a $6 binary"
2002 log 2 "checking $1... CC/CXX not set (skipping)"
2004 # No $5, so try '$6'
2005 machine=`$6 $9 2>/dev/null`
2009 log 2 "executing $6 $9"
2010 log 2 " returned $machine"
2011 log 2 " exit code $ret"
2013 if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ]; then
2015 machine=`$7 $9 2>/dev/null`
2019 log 2 "executing $7 $9"
2020 log 2 " returned $machine"
2021 log 2 " exit code $ret"
2024 if [ -z "$machine" ]; then
2025 log 1 "checking $1... $6 not found"
2026 log 1 "I couldn't detect any $6 binary on your system"
2027 log 1 "please define the CC/CXX environment to where it is located"
2035 if [ "$8" != "0" ]; then
2037 log 1 "checking $1... $res"
2039 log 1 "checking $1... $machine"
2044 check_compiler "build system type" "cc_build" "$build" "$cc_build" "$CC" "gcc" "cc" "0" "-dumpmachine"
2048 # By default the host is the build
2049 if [ -z "$host" ]; then host="$build"; fi
2050 check_compiler "host system type" "cc_host" "$host" "$cc_host" "$CC" "gcc" "cc" "0" "-dumpmachine"
2054 check_compiler "build c++" "cxx_build" "$build" "$cxx_build" "$CXX" "g++" "c++" 1 "-dumpmachine"
2058 # By default the host is the build
2059 if [ -z "$host" ]; then host="$build"; fi
2060 check_compiler "host c++" "cxx_host" "$host" "$cxx_host" "$CXX" "g++" "c++" 1 "-dumpmachine"
2064 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
2065 check_compiler "host windres" "windres" "$host" "$windres" "$WINDRES" "windres" "windres" "2" "-V"
2070 if [ "$os" = "OS2" ]; then
2071 # OS2 via gcc is a bit weird.. stripping HAS to be done via emxbind, which is via gcc directly
2072 log 1 "checking host strip... using gcc -s option"
2073 elif [ "$os" = "OSX" ]; then
2074 # Most targets have -V in strip, to see if they exists... OSX doesn't.. so execute something
2075 echo "int main(int argc, char *argv[]) { }" > strip.test.c
2076 $cxx_host strip.test.c -o strip.test
2077 check_compiler "host strip" "strip" "$host" "$strip" "$STRIP" "strip" "strip" "3" "strip.test"
2078 rm -f strip.test.c strip.test
2080 check_compiler "host strip" "strip" "$host" "$strip" "$STRIP" "strip" "strip" "3" "-V"
2085 if [ "$os" = "OSX" ] && [ "$enable_universal" != "0" ]; then
2086 echo "int main(int argc, char *argv[]) { }" > lipo.test.c
2087 $cxx_host lipo.test.c -o lipo.test
2088 check_compiler "host lipo" "lipo" "$host" "$lipo" "$LIPO" "lipo" "lipo" "4" "-info lipo.test"
2089 rm -f lipo.test.c lipo.test
2095 if [ -n "$1" ]; then
2096 if echo "$1" | grep -q / ; then
2097 # Seems to be a file system path
2100 osx_sdk_path="/Developer/SDKs/MacOSX$1.sdk"
2102 if [ ! -d "$osx_sdk_path" ]; then
2103 # No directory, not present or garbage
2107 # Set minimum version to 10.4 as that's when kCGBitmapByteOrder32Host was introduced
2108 sysroot="-isysroot $osx_sdk_path -Wl,-syslibroot,$osx_sdk_path -mmacosx-version-min=10.4"
2111 cat > tmp.osx.mm << EOF
2112 #include <Cocoa/Cocoa.h>
2114 kCGBitmapByteOrder32Host;
2118 execute="$cxx_host $sysroot $CFLAGS tmp.osx.mm -framework Cocoa -o tmp.osx 2>&1"
2119 eval $execute > /dev/null
2121 log 2 "executing $execute"
2122 log 2 " exit code $ret"
2123 rm -f tmp.osx.mm tmp.osx
2127 check_direct_music() {
2129 #include <windows.h>
2130 #include <dmksctrl.h>
2131 #include <dmusicc.h>
2132 int main(int argc, char *argv[]) { }" > direct_music.test.c
2133 $cxx_host $CFLAGS direct_music.test.c -o direct_music.test 2> /dev/null
2135 rm -f direct_music.test.c direct_music.test
2137 if [ "$res" != "0" ]; then
2138 if [ "$with_direct_music" != "1" ]; then
2139 log 1 "configure: error: direct-music is not available on this system"
2142 with_direct_music="0"
2144 log 1 "checking direct-music... not found"
2146 log 1 "checking direct-music... found"
2152 #include <windows.h>
2154 #undef NTDDI_VERSION
2157 #define NTDDI_VERSION NTDDI_WIN8
2158 #define _WIN32_WINNT _WIN32_WINNT_WIN8
2160 #include <xaudio2.h>
2161 int main(int argc, char *argv[]) { }" > xaudio2.test.c
2162 $cxx_host $CFLAGS xaudio2.test.c -o xaudio2.test 2> /dev/null
2164 rm -f xaudio2.test.c xaudio2.test
2166 if [ "$res" != "0" ]; then
2167 if [ "$with_xaudio2" != "1" ]; then
2168 log 1 "configure: error: xaudio2 is not available on this system"
2173 log 1 "checking xaudio2... not found"
2175 log 1 "checking xaudio2... found"
2179 check_makedepend() {
2180 if [ "$enable_builtin_depend" != "0" ]; then
2184 if [ "$with_makedepend" = "0" ]; then
2185 log 1 "checking makedepend... disabled"
2189 if [ "$with_makedepend" = "1" ] || [ "$with_makedepend" = "2" ]; then
2190 makedepend="makedepend"
2192 makedepend="$with_makedepend"
2195 rm -f makedepend.tmp
2196 touch makedepend.tmp
2197 res=`$makedepend -fmakedepend.tmp 2>/dev/null`
2199 log 2 "executing $makedepend -f makedepend.tmp"
2200 log 2 " returned `cat makedepend.tmp`"
2201 log 2 " exit code $ret"
2203 if [ ! -s makedepend.tmp ]; then
2204 rm -f makedepend.tmp makedepend.tmp.bak
2206 if [ "$with_makedepend" = "2" ]; then
2207 log 1 "checking makedepend... not found"
2209 log 1 "I couldn't detect any makedepend on your system"
2210 log 1 "please locate it via --makedepend=[binary]"
2213 elif [ "$with_makedepend" != "1" ]; then
2214 log 1 "checking makedepend... $makedepend not found"
2216 log 1 "the selected file doesn't seem to be a valid makedepend binary"
2220 log 1 "checking makedepend... not found"
2227 rm -f makedepend.tmp makedepend.tmp.bak
2229 log 1 "checking makedepend... $makedepend"
2233 # $1 - requested version (major.minor)
2234 # $2 - version we got (major.minor)
2236 if [ -z "$2" ]; then
2240 req_major=`echo $1 | cut -d. -f1`
2241 got_major=`echo $2 | cut -d. -f1`
2242 if [ $got_major -lt $req_major ]; then
2244 elif [ $got_major -gt $req_major ]; then
2248 req_minor=`echo $1 | cut -d. -f2`
2249 got_minor=`echo $2 | cut -d. -f2`
2250 if [ $got_minor -lt $req_minor ]; then
2257 # Not all awks allow gsub(), so we test for that here! It is in fact all we need...
2259 # These awks are known to work. Test for them explicit
2260 awks="gawk mawk nawk"
2262 awk_prefix="echo \"a.c b.c c.c\" | tr ' ' \\\\n | "
2263 awk_param="' { ORS = \" \" } /\.c$/ { gsub(\".c$\", \".o\", \$0); print \$0; }' 2>/dev/null"
2264 awk_result="a.o b.o c.o "
2265 log 2 "Detecing awk..."
2267 log 2 "Trying: $awk_prefix $awk $awk_param"
2268 res=`eval $awk_prefix $awk $awk_param`
2269 log 2 "Result: '$res'"
2270 if [ "$res" != "$awk_result" ] && [ "$awk" = "awk" ]; then
2271 # User didn't supply his own awk, so try to detect some other known working names for an awk
2272 for awk in $awks; do
2273 log 2 "Trying: $awk_prefix $awk $awk_param"
2274 res=`eval $awk_prefix $awk $awk_param`
2275 log 2 "Result: '$res'"
2276 if [ "$res" = "$awk_result" ]; then break; fi
2279 if [ "$res" != "$awk_result" ]; then
2280 log 1 "checking awk... not found"
2281 log 1 "configure: error: no awk found"
2282 log 1 "configure: error: please install one of the following: $awks"
2286 if [ "$res" != "$awk_result" ]; then
2287 log 1 "checking awk... not found"
2288 log 1 "configure: error: you supplied '$awk' but it doesn't seem a valid gawk or mawk"
2292 log 1 "checking awk... $awk"
2296 if [ "$os" = "DETECT" ]; then
2297 # Detect UNIX, OSX, FREEBSD, DRAGONFLY, OPENBSD, NETBSD, HPUX, SUNOS, CYGWIN, MINGW, and OS2
2299 # Try first via dumpmachine, then via uname
2300 os=`echo "$host" | tr '[A-Z]' '[a-z]' | $awk '
2301 /linux/ { print "UNIX"; exit}
2302 /darwin/ { print "OSX"; exit}
2303 /freebsd/ { print "FREEBSD"; exit}
2304 /dragonfly/ { print "DRAGONFLY"; exit}
2305 /openbsd/ { print "OPENBSD"; exit}
2306 /netbsd/ { print "NETBSD"; exit}
2307 /hp-ux/ { print "HPUX"; exit}
2308 /haiku/ { print "HAIKU"; exit}
2309 /sunos/ { print "SUNOS"; exit}
2310 /solaris/ { print "SUNOS"; exit}
2311 /cygwin/ { print "CYGWIN"; exit}
2312 /mingw/ { print "MINGW"; exit}
2313 /os2/ { print "OS2"; exit}
2316 if [ -z "$os" ]; then
2317 os=`LC_ALL=C uname | tr '[A-Z]' '[a-z]' | $awk '
2318 /linux/ { print "UNIX"; exit}
2319 /darwin/ { print "OSX"; exit}
2320 /freebsd/ { print "FREEBSD"; exit}
2321 /dragonfly/ { print "DRAGONFLY"; exit}
2322 /openbsd/ { print "OPENBSD"; exit}
2323 /netbsd/ { print "NETBSD"; exit}
2324 /hp-ux/ { print "HPUX"; exit}
2325 /haiku/ { print "HAIKU"; exit}
2326 /sunos/ { print "SUNOS"; exit}
2327 /cygwin/ { print "CYGWIN"; exit}
2328 /mingw/ { print "MINGW"; exit}
2329 /os\/2/ { print "OS2"; exit}
2330 /gnu/ { print "UNIX"; exit}
2334 if [ -z "$os" ]; then
2335 log 1 "detecting OS... none detected"
2336 log 1 "I couldn't detect your OS. Please use --os=OS to force one"
2337 log 1 "Allowed values are: UNIX, OSX, FREEBSD, DRAGONFLY, OPENBSD, NETBSD, HPUX, HAIKU, SUNOS, CYGWIN, MINGW, and OS2"
2341 log 1 "detecting OS... $os"
2343 log 1 "forcing OS... $os"
2348 # 0 means no, 1 is auto-detect, 2 is force
2349 if [ "$with_allegro" = "0" ]; then
2350 log 1 "checking Allegro... disabled"
2356 if [ "$with_allegro" = "2" ] && [ "$with_cocoa" = "2" ]; then
2357 log 1 "configure: error: it is impossible to compile both Allegro and COCOA"
2358 log 1 "configure: error: please deselect one of them and try again"
2362 if [ "$with_allegro" = "2" ] && [ "$enable_dedicated" != "0" ]; then
2363 log 1 "configure: error: it is impossible to compile a dedicated with Allegro"
2364 log 1 "configure: error: please deselect one of them and try again"
2368 if [ "$enable_dedicated" != "0" ]; then
2369 log 1 "checking Allegro... dedicated server, skipping"
2375 # By default on OSX we don't use Allegro. The rest is auto-detect
2376 if [ "$with_allegro" = "1" ] && [ "$os" = "OSX" ] && [ "$with_cocoa" != "0" ]; then
2377 log 1 "checking Allegro... OSX, skipping"
2383 detect_pkg_config "$with_allegro" "allegro" "allegro_config" "4.4"
2388 # 0 means no, 1 is auto-detect, 2 is force
2389 if [ "$with_sdl" = "0" ]; then
2390 log 1 "checking SDL... disabled"
2397 if [ "$with_sdl" != "1" ] && [ "$with_cocoa" = "2" ]; then
2398 log 1 "configure: error: it is impossible to compile both SDL and COCOA"
2399 log 1 "configure: error: please deselect one of them and try again"
2403 if [ "$with_sdl" != "1" ] && [ "$enable_dedicated" != "0" ]; then
2404 log 1 "configure: error: it is impossible to compile a dedicated with SDL"
2405 log 1 "configure: error: please deselect one of them and try again"
2409 if [ "$enable_dedicated" != "0" ]; then
2410 log 1 "checking SDL... dedicated server, skipping"
2417 # By default on OSX we don't use SDL. The rest is auto-detect
2418 if [ "$with_sdl" = "1" ] && [ "$os" = "OSX" ] && [ "$with_cocoa" != "0" ]; then
2419 log 1 "checking SDL... OSX, skipping"
2425 if [ "$os" = "OSX" ]; then
2426 log 1 "WARNING: sdl is known to fail on some versions of Mac OS X"
2427 log 1 "WARNING: with some hardware configurations. Use at own risk!"
2431 if [ $with_sdl = "sdl1" ]; then
2432 detect_pkg_config "2" "sdl" "sdl_config" "1.2"
2433 elif [ $with_sdl = "sdl2" ]; then
2434 detect_pkg_config "2" "sdl2" "sdl2_config" "2.0"
2437 if [ -x `which sdl2-config` ]; then
2438 detect_pkg_config "$with_sdl" "sdl2" "sdl2_config" "2.0"
2440 if [ -z "$sdl2_config" ]; then
2441 detect_pkg_config "$with_sdl" "sdl" "sdl_config" "1.2"
2447 # Try to find the best SDK available. For a normal build this
2448 # is currently the 10.5 SDK as this is needed to compile all
2449 # optional code. Because such an executable won't run on 10.4
2450 # or lower, also check for the 10.4u SDK when doing an universal
2453 # Check for the 10.5 SDK, but try 10.6 if that fails
2454 check_osx_sdk "10.5" || check_osx_sdk "10.6" || osx_sdk_path=""
2456 if [ -z "$osx_sdk_path" ] || [ "$enable_universal" != "0" ]; then
2457 # No better SDK or universal build enabled? Check 10.4u SDK as well
2458 local old_sdk="$osx_sdk_path"
2459 if check_osx_sdk "10.4u"; then
2460 osx_sdk_104_path="$osx_sdk_path"
2464 if [ -z "$old_sdk" ]; then
2465 osx_sdk_path="$osx_sdk_104_path"
2467 osx_sdk_path="$old_sdk"
2471 if [ -z "$osx_sdk_path" ]; then
2472 log 1 "Your system SDK is probably too old"
2473 log 1 "Please install/upgrade your Xcode to >= 2.5"
2480 # 0 means no, 1 is auto-detect, 2 is force
2481 if [ "$with_cocoa" = "0" ]; then
2482 log 1 "checking COCOA... disabled"
2487 if [ "$with_cocoa" = "2" ] && [ "$enable_dedicated" != "0" ]; then
2488 log 1 "configure: error: it is impossible to compile a dedicated with COCOA"
2489 log 1 "configure: error: please deselect one of them and try again"
2493 if [ "$enable_dedicated" != "0" ]; then
2494 log 1 "checking COCOA... dedicated server, skipping"
2500 # By default on OSX we use COCOA. The rest doesn't support it
2501 if [ "$with_cocoa" = "1" ] && [ "$os" != "OSX" ]; then
2502 log 1 "checking COCOA... not OSX, skipping"
2508 if [ "$os" != "OSX" ]; then
2509 log 1 "checking COCOA... not OSX"
2511 log 1 "configure: error: COCOA video driver is only supported for OSX"
2515 log 1 "checking COCOA... found"
2518 if [ "$enable_cocoa_quartz" != "0" ]; then
2519 log 1 "checking whether to enable the Quartz window subdriver... yes"
2521 log 1 "checking whether to enable the Quartz window subdriver... no"
2526 # $1 - config-param ($with_zlib value)
2527 # $2 - library name ('zlib', sets $zlib)
2528 # $3 - static library name (libz.a)
2529 # $4 - header directory ()
2530 # $5 - header name (zlib.h)
2531 # $6 - force static (if non-empty)
2533 if [ -n "$6" ]; then force_static="1"; fi
2535 # 0 means no, 1 is auto-detect, 2 is force
2536 if [ "$1" = "0" ]; then
2537 log 1 "checking $2... disabled"
2543 log 2 "detecting $2"
2545 if [ "$1" = "1" ] || [ "$1" = "" ] || [ "$1" = "2" ]; then
2546 eval "$2=`ls -1 /usr/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2548 if [ -z "$res" ]; then
2549 log 2 " trying /usr/include/$4$5... no"
2550 eval "$2=`ls -1 /usr/local/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2553 if [ -z "$res" ]; then
2554 log 2 " trying /usr/local/include/$4$5... no"
2555 eval "$2=`ls -1 /mingw/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2558 if [ -z "$res" ]; then
2559 log 2 " trying /mingw/include/$4$5... no"
2560 eval "$2=`ls -1 /mingw$cpu_type/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2563 if [ -z "$res" ]; then
2564 log 2 " trying /mingw$cpu_type/include/$4$5... no"
2565 eval "$2=`ls -1 /opt/local/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2568 if [ -z "$res" ]; then
2569 log 2 " trying /opt/local/include/$4$5... no"
2571 if [ -z "$res" ] && [ "$os" = "NETBSD" ]; then
2572 eval "$2=`ls -1 /usr/pkg/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2574 if [ -z "$res" ]; then
2575 log 2 " trying /usr/pkg/include/$4$5... no"
2578 if [ -z "$res" ] && [ "$os" = "HAIKU" ]; then
2579 if [ -z "$includeDir" ]; then
2580 includeDir=`finddir B_SYSTEM_HEADERS_DIRECTORY`
2582 eval "$2=`ls -1 $includeDir/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2584 if [ -z "$res" ]; then
2585 log 2 " trying $includeDir/$4$5... no"
2590 if [ -n "$res" ] && ( [ -n "$force_static" ] || ( [ "$enable_static" != "0" ] && [ "$os" != "OSX" ] ) ); then
2592 log 2 " trying $res... found"
2593 # Now find the static lib, if needed
2594 eval "$2=`ls /lib/*.a 2>/dev/null | egrep \"\/$3\$\"`"
2596 if [ -z "$res" ]; then
2597 log 2 " trying /lib/$3... no"
2598 eval "$2=`ls /usr/lib/*.a 2>/dev/null | egrep \"\/$3\$\"`"
2601 if [ -z "$res" ]; then
2602 log 2 " trying /usr/lib/$3... no"
2603 eval "$2=`ls /usr/local/lib/*.a 2>/dev/null | egrep \"\/$3\$\"`"
2606 if [ -z "$res" ]; then
2607 log 2 " trying /usr/local/lib/$3... no"
2608 eval "$2=`ls /mingw/lib/*.a 2>/dev/null | egrep \"\/$3\$\"`"
2611 if [ -z "$res" ]; then
2612 log 2 " trying /mingw/lib/$3... no"
2613 eval "$2=`ls /mingw$cpu_type/lib/*.a 2>/dev/null | egrep \"\/$3\$\"`"
2616 if [ -z "$res" ]; then
2617 log 2 " trying /mingw$cpu_type/lib/$3... no"
2618 log 1 "configure: error: $2 couldn't be found"
2619 log 1 "configure: error: you requested a static link, but I can't find $3"
2625 # Make sure it exists
2626 if [ -f "$1" ]; then
2627 eval "$2=`ls $1 2>/dev/null`"
2629 eval "$2=`ls $1/$3 2>/dev/null`"
2634 if [ -z "$res" ]; then
2635 log 1 "checking $2... not found"
2636 if [ "$1" = "2" ]; then
2637 log 1 "configure: error: $2 couldn't be found"
2640 elif [ "$1" != "1" ]; then
2641 log 1 "configure: error: $2 couldn't be found"
2642 log 1 "configure: error: you supplied '$1', but it seems invalid"
2653 log 2 " trying $res... found"
2655 log 1 "checking $2... found"
2659 detect_pkg_config "$with_zlib" "zlib" "zlib_config" "1.2"
2663 detect_library "$with_lzo2" "lzo2" "liblzo2.a" "lzo/" "lzo1x.h"
2666 detect_fluidsynth() {
2667 detect_library "$with_fluidsynth" "fluidsynth" "" "" "fluidsynth.h"
2670 detect_pkg_config() {
2671 # $1 - config-param ($with_lzma value)
2672 # $2 - package name ('liblzma')
2673 # $3 - config name ('lzma_config', sets $lzma_config)
2674 # $4 - minimum module version ('2.3')
2675 # $5 - check for dedicated, 1 is "skif if dedicated"
2677 # 0 means no, 1 is auto-detect, 2 is force
2678 if [ "$1" = "0" ]; then
2679 log 1 "checking $2... disabled"
2685 if [ "$5" = "1" ] && [ "$1" = "1" ] && [ "$enable_dedicated" != "0" ]; then
2686 log 1 "checking $2... dedicated server, skipping"
2692 log 2 "detecting $2"
2694 if [ "$1" = "1" ] || [ "$1" = "" ] || [ "$1" = "2" ]; then
2695 pkg_config_call="$pkg_config $2"
2697 pkg_config_call="$1"
2700 version=`$pkg_config_call --modversion 2>/dev/null`
2702 check_version "$4" "$version"
2704 log 2 "executing $pkg_config_call --modversion"
2705 log 2 " returned $version"
2706 log 2 " exit code $ret"
2708 if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$version_ok" != "1" ]; then
2709 if [ -n "$version" ] && [ "$version_ok" != "1" ]; then
2710 log 1 "checking $2... needs at least version $4, $2 NOT enabled"
2712 log 1 "checking $2... not found"
2715 # It was forced, so it should be found.
2716 if [ "$1" != "1" ]; then
2717 log 1 "configure: error: $pkg_config $2 couldn't be found"
2718 log 1 "configure: error: you supplied '$1', but it seems invalid"
2726 eval "$3=\"$pkg_config_call\""
2727 log 1 "checking $2... found"
2731 detect_pkg_config "$with_lzma" "liblzma" "lzma_config" "5.0"
2734 detect_xdg_basedir() {
2735 detect_pkg_config "$with_xdg_basedir" "libxdg-basedir" "xdg_basedir_config" "1.2"
2739 detect_pkg_config "$with_png" "libpng" "png_config" "1.2"
2743 if [ "$with_freetype" = "1" ] && ([ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]); then
2744 log 1 "checking freetype2... WIN32, skipping"
2749 detect_pkg_config "$with_freetype" "freetype2" "freetype_config" "2.2" "1"
2752 detect_fontconfig() {
2753 # 0 means no, 1 is auto-detect, 2 is force
2754 if [ "$with_fontconfig" = "0" ]; then
2755 log 1 "checking libfontconfig... disabled"
2757 fontconfig_config=""
2760 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
2761 log 1 "checking libfontconfig... WIN32, skipping"
2762 fontconfig_config=""
2766 if [ "$os" = "OSX" ]; then
2767 log 1 "checking libfontconfig... OSX, skipping"
2768 fontconfig_config=""
2772 detect_pkg_config "$with_fontconfig" "fontconfig" "fontconfig_config" "2.3" "1"
2775 detect_icu_layout() {
2776 if [ "$with_cocoa" != "0" ] && [ "$with_icu_layout" = "1" ]; then
2777 log 1 "checking icu-lx... OSX, skipping"
2778 icu_layout_config=""
2782 detect_pkg_config "$with_icu_layout" "icu-lx" "icu_layout_config" "4.8" "1"
2786 if [ "$with_cocoa" != "0" ] && [ "$with_icu_sort" = "1" ]; then
2787 log 1 "checking icu-i18n... OSX, skipping"
2792 detect_pkg_config "$with_icu_sort" "icu-i18n" "icu_sort_config" "4.8" "1"
2796 # 0 means no, 1 is auto-detect, 2 is force
2797 if [ "$with_iconv" = "0" ]; then
2798 log 1 "checking iconv... disabled"
2803 if [ "$with_iconv" = "1" ] && [ "$os" != "OSX" ]; then
2804 log 1 "checking iconv... not OSX, skipping"
2810 # Try to find iconv.h, seems to only thing to detect iconv with
2812 if [ "$with_iconv" = "1" ] || [ "$with_iconv" = "" ] || [ "$with_iconv" = "2" ]; then
2813 # Iterate over search paths
2815 search_paths=`LC_ALL=C $cxx_host $OSX_SYSROOT $CFLAGS -E - -v </dev/null 2>&1 | \
2816 $awk '/#include <...> search starts here:/{flag=1;next}/End of search list./{flag=0}flag'`
2817 for path in $search_paths; do
2818 iconv=`ls -1 $path 2>/dev/null | grep "iconv.h"`
2819 if [ -n "$iconv" ]; then
2824 # Make sure it exists
2825 iconv=`ls $with_iconv/include/iconv.h 2>/dev/null`
2828 if [ -z "$iconv" ]; then
2829 log 1 "checking iconv... not found"
2830 if [ "$with_iconv" = "2" ]; then
2831 log 1 "configure: error: iconv couldn't be found"
2834 elif [ "$with_iconv" != "1" ]; then
2835 log 1 "configure: error: iconv couldn't be found"
2836 log 1 "configure: error: you supplied '$with_iconv', but I couldn't detect iconv in it"
2844 if [ "$with_iconv" = "1" ]; then
2848 log 2 "found iconv in $iconv"
2850 log 1 "checking iconv... found"
2852 # There are different implementations of iconv. The older ones,
2853 # e.g. SUSv2, pass a const pointer, whereas the newer ones, e.g.
2854 # IEEE 1003.1 (2004), pass a non-const pointer.
2856 cat > tmp.iconv.cpp << EOF
2857 #include "src/stdafx.h"
2860 static char buf[1024];
2862 const char *inbuf = "";
2864 size_t outlen = 1023;
2866 return iconv(convd, &inbuf, &inlen, &outbuf, &outlen);
2869 execute="$cxx_host $OSX_SYSROOT $CFLAGS -c tmp.iconv.cpp -o tmp.iconv -DTESTING 2>&1"
2870 eval $execute > /dev/null
2872 log 2 "executing $execute"
2873 log 2 " exit code $ret"
2874 if [ "$ret" = "0" ]; then have_non_const_iconv="no"; else have_non_const_iconv="yes"; fi
2875 log 1 "checking if iconv has non-const inbuf... $have_non_const_iconv"
2877 cat > tmp.iconv.cpp << EOF
2878 #include "src/stdafx.h"
2881 static char buf[1024];
2885 size_t outlen = 1023;
2887 return iconv(convd, &inbuf, &inlen, &outbuf, &outlen);
2890 execute="$cxx_host $OSX_SYSROOT $OSX_LD_SYSROOT $CFLAGS tmp.iconv.cpp -o tmp.iconv -DTESTING 2>&1"
2891 eval $execute > /dev/null
2893 log 2 "executing $execute"
2894 log 2 " exit code $ret"
2895 if [ "$ret" = "0" ]; then link_to_iconv="no"; else link_to_iconv="yes"; fi
2896 log 1 "checking whether to link to iconv... $link_to_iconv"
2897 rm -f tmp.iconv tmp.iconv.cpp
2911 log 2 "running echo <array> | $1"
2913 if [ "`echo \"$sort_test_in\" | $1 2>/dev/null`" = "$sort_test_out" ]; then
2915 log 2 " result was valid"
2917 log 2 " result was invalid"
2922 if [ "$with_sort" = "0" ]; then
2923 log 1 "checking sort... disabled"
2928 if [ "$with_sort" = "1" ] || [ "$with_sort" = "2" ]; then
2930 if [ -z "$sort" ]; then _detect_sort "/sbin/sort"; fi
2931 if [ -z "$sort" ]; then _detect_sort "/usr/sbin/sort"; fi
2932 if [ -z "$sort" ]; then _detect_sort "/usr/local/sbin/sort"; fi
2933 if [ -z "$sort" ]; then _detect_sort "/bin/sort"; fi
2934 if [ -z "$sort" ]; then _detect_sort "/usr/bin/sort"; fi
2935 if [ -z "$sort" ]; then _detect_sort "/usr/local/bin/sort"; fi
2937 _detect_sort "$with_sort"
2940 if [ -z "$sort" ]; then
2941 if [ "$with_sort" = "2" ]; then
2942 log 1 "checking sort... not found"
2944 log 1 "configure: error: couldn't detect sort on your system"
2946 elif [ "$with_sort" != "1" ]; then
2947 log 1 "checking sort... $with_sort not found"
2949 log 1 "configure: error: '$with_sort' doesn't look like a sort to me"
2950 log 1 "configure: error: please verify its location and function and try again"
2954 log 1 "checking sort... not found"
2957 log 1 "checking sort... $sort"
2962 # 0 means no, 1 is auto-detect, 2 is force
2963 if [ "$with_grfcodec" = "0" ]; then
2964 log 1 "checking grfcodec... disabled"
2970 if [ "$with_grfcodec" = "1" ] || [ "$with_grfcodec" = "" ] || [ "$with_grfcodec" = "2" ]; then
2973 grfcodec="$with_grfcodec"
2976 version=`$grfcodec -v 2>/dev/null | $awk '{print $3}' | sed 's/[rM]//g;s/-/0/'`
2978 log 2 "executing grfcodec -v"
2979 log 2 " returned $version"
2980 log 2 " exit code $ret"
2982 if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$version" -lt "985" ]; then
2983 if [ -n "$version" ] && [ "$version" -lt "985" ]; then
2984 log 1 "checking grfcodec... needs at least version 6.0.5 (r985), disabled"
2986 log 1 "checking grfcodec... not found"
2989 # It was forced, so it should be found.
2990 if [ "$with_grfcodec" != "1" ]; then
2991 log 1 "configure: error: grfcodec couldn't be found"
2992 log 1 "configure: error: you supplied '$with_grfcodec', but it seems invalid"
3000 log 1 "checking grfcodec... found"
3004 # 0 means no, 1 is auto-detect, 2 is force
3005 if [ "$with_nforenum" = "0" ]; then
3006 log 1 "checking nforenum... disabled"
3012 if [ "$with_nforenum" = "1" ] || [ "$with_nforenum" = "" ] || [ "$with_nforenum" = "2" ]; then
3015 nforenum="$with_nforenum"
3018 version=`$nforenum -v 2>/dev/null | $awk '{print $3}' | sed 's/[rM]//g;s/-/0/'`
3020 log 2 "executing nforenum -v"
3021 log 2 " returned $version"
3022 log 2 " exit code $ret"
3024 if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$version" -lt "985" ]; then
3025 if [ -n "$version" ] && [ "$version" -lt "985" ]; then
3026 log 1 "checking nforenum... needs at least version 6.0.5 (r985), disabled"
3028 log 1 "checking nforenum... not found"
3031 # It was forced, so it should be found.
3032 if [ "$with_nforenum" != "1" ]; then
3033 log 1 "configure: error: nforenum couldn't be found"
3034 log 1 "configure: error: you supplied '$with_nforenum', but it seems invalid"
3042 log 1 "checking nforenum... found"
3046 if [ -n "$cpu_type" ] && [ "$cpu_type" != "DETECT" ]; then
3047 log 1 "forcing cpu-type... $cpu_type bits"
3050 echo "#define _SQ64 1" > tmp.64bit.cpp
3051 echo "#include \"src/stdafx.h\"" >> tmp.64bit.cpp
3052 echo "assert_compile(sizeof(size_t) == 8);" >> tmp.64bit.cpp
3053 echo "int main() { return 0; }" >> tmp.64bit.cpp
3054 execute="$cxx_host $CFLAGS tmp.64bit.cpp -o tmp.64bit -DTESTING 2>&1"
3055 cpu_type="`eval $execute 2>/dev/null`"
3057 log 2 "executing $execute"
3058 log 2 " returned $cpu_type"
3059 log 2 " exit code $ret"
3060 if [ "$ret" = "0" ]; then cpu_type="64"; else cpu_type="32"; fi
3061 log 1 "detecting cpu-type... $cpu_type bits"
3062 rm -f tmp.64bit tmp.64bit.cpp
3065 detect_sse_capable_architecture() {
3066 # 0 means no, 1 is auto-detect, 2 is force
3067 if [ "$with_sse" = "0" ]; then
3068 log 1 "checking SSE... disabled"
3072 echo "#define _SQ64 1" > tmp.sse.cpp
3073 echo "#include <xmmintrin.h>" >> tmp.sse.cpp
3074 echo "#include <smmintrin.h>" >> tmp.sse.cpp
3075 echo "#include <tmmintrin.h>" >> tmp.sse.cpp
3076 echo "int main() { return 0; }" >> tmp.sse.cpp
3077 execute="$cxx_host -msse4.1 $CFLAGS tmp.sse.cpp -o tmp.sse 2>&1"
3078 sse="`eval $execute 2>/dev/null`"
3080 log 2 "executing $execute"
3081 log 2 " returned $sse"
3082 log 2 " exit code $ret"
3083 if [ "$ret" = "0" ]; then
3084 log 1 "detecting SSE... found"
3086 # It was forced, so it should be found.
3087 if [ "$with_sse" != "1" ]; then
3088 log 1 "configure: error: SSE couldn't be found"
3089 log 1 "configure: error: you force enabled SSE, but it seems unavailable"
3093 log 1 "detecting SSE... not found"
3096 rm -f tmp.sse tmp.exe tmp.sse.cpp
3101 T_CXXFLAGS="$CXXFLAGS"
3102 T_LDFLAGS="$LDFLAGS"
3104 SRC_OBJS_DIR="$BASE_SRC_OBJS_DIR/$OBJS_SUBDIR"
3106 # All the data needed to compile a single target
3107 # Make sure if you compile multiple targets to
3108 # use multiple OBJS_DIR, because all in-between
3109 # binaries are stored in there, and nowhere else.
3111 s@!!CC_HOST!!@$cc_host@g;
3112 s@!!CXX_HOST!!@$cxx_host@g;
3113 s@!!CC_BUILD!!@$cc_build@g;
3114 s@!!CXX_BUILD!!@$cxx_build@g;
3115 s@!!WINDRES!!@$windres@g;
3116 s@!!STRIP!!@$strip $strip_arg@g;
3118 s@!!CFLAGS!!@$T_CFLAGS@g;
3119 s@!!CFLAGS_BUILD!!@$CFLAGS_BUILD@g;
3120 s@!!CXXFLAGS!!@$T_CXXFLAGS@g;
3121 s@!!CXXFLAGS_BUILD!!@$CXXFLAGS_BUILD@g;
3122 s@!!STRGEN_FLAGS!!@$strgen_flags@g;
3124 s@!!LDFLAGS!!@$T_LDFLAGS@g;
3125 s@!!LDFLAGS_BUILD!!@$LDFLAGS_BUILD@g;
3126 s@!!BIN_DIR!!@$BIN_DIR@g;
3127 s@!!ROOT_DIR!!@$ROOT_DIR@g;
3128 s@!!MEDIA_DIR!!@$MEDIA_DIR@g;
3129 s@!!SOURCE_LIST!!@$SOURCE_LIST@g;
3130 s@!!SRC_OBJS_DIR!!@$SRC_OBJS_DIR@g;
3131 s@!!LANG_OBJS_DIR!!@$LANG_OBJS_DIR@g;
3132 s@!!GRF_OBJS_DIR!!@$GRF_OBJS_DIR@g;
3133 s@!!SETTING_OBJS_DIR!!@$SETTING_OBJS_DIR@g;
3134 s@!!SRC_DIR!!@$SRC_DIR@g;
3135 s@!!SCRIPT_SRC_DIR!!@$SCRIPT_SRC_DIR@g;
3136 s@!!OSXAPP!!@$OSXAPP@g;
3137 s@!!LANG_DIR!!@$LANG_DIR@g;
3139 s@!!BINARY_DIR!!@$prefix_dir/$binary_dir@g;
3140 s@!!DATA_DIR!!@$prefix_dir/$data_dir@g;
3141 s@!!DOC_DIR!!@$prefix_dir/$doc_dir@g;
3142 s@!!MAN_DIR!!@$prefix_dir/$man_dir@g;
3143 s@!!ICON_DIR!!@$prefix_dir/$icon_dir@g;
3144 s@!!ICON_THEME_DIR!!@$prefix_dir/$icon_theme_dir@g;
3145 s@!!PERSONAL_DIR!!@$personal_dir@g;
3146 s@!!SHARED_DIR!!@$shared_dir@g;
3147 s@!!INSTALL_DIR!!@$install_dir@g;
3148 s@!!BINARY_NAME!!@$binary_name@g;
3149 s@!!STRGEN!!@$STRGEN@g;
3150 s@!!DEPEND!!@$DEPEND@g;
3151 s@!!SETTINGSGEN!!@$SETTINGSGEN@g;
3152 s@!!STAGE!!@$STAGE@g;
3153 s@!!MAKEDEPEND!!@$makedepend@g;
3154 s@!!CFLAGS_MAKEDEP!!@$cflags_makedep@g;
3156 s@!!CONFIG_CACHE_COMPILER!!@config.cache.compiler@g;
3157 s@!!CONFIG_CACHE_LINKER!!@config.cache.linker@g;
3158 s@!!CONFIG_CACHE_SOURCE!!@config.cache.source@g;
3159 s@!!CONFIG_CACHE_VERSION!!@config.cache.version@g;
3160 s@!!CONFIG_CACHE_SOURCE_LIST!!@config.cache.source.list@g;
3161 s@!!CONFIG_CACHE_PWD!!@config.cache.pwd@g;
3162 s@!!LANG_SUPPRESS!!@$lang_suppress@g;
3163 s@!!OBJS_C!!@$OBJS_C@g;
3164 s@!!OBJS_CPP!!@$OBJS_CPP@g;
3165 s@!!OBJS_MM!!@$OBJS_MM@g;
3166 s@!!OBJS_RC!!@$OBJS_RC@g;
3169 s@!!CONFIGURE_FILES!!@$CONFIGURE_FILES@g;
3171 s@!!DISTCC!!@$distcc@g;
3172 s@!!NFORENUM!!@$nforenum@g;
3173 s@!!GRFCODEC!!@$grfcodec@g;
3176 if [ "$icon_theme_dir" != "" ]; then
3177 SRC_REPLACE="$SRC_REPLACE
3178 s@!!ICON_THEME_DIR!!@$prefix_dir/$icon_theme_dir@g;
3181 SRC_REPLACE="$SRC_REPLACE
3182 s@!!ICON_THEME_DIR!!@@g;
3186 if [ "$man_dir" != "" ]; then
3187 SRC_REPLACE="$SRC_REPLACE
3188 s@!!MAN_DIR!!@$prefix_dir/$man_dir@g;
3191 SRC_REPLACE="$SRC_REPLACE
3196 if [ "$menu_dir" != "" ]; then
3197 SRC_REPLACE="$SRC_REPLACE
3198 s@!!MENU_DIR!!@$prefix_dir/$menu_dir@g;
3201 SRC_REPLACE="$SRC_REPLACE
3207 generate_menu_item() {
3210 s@!!MENU_GROUP!!@$menu_group@g;
3211 s@!!MENU_NAME!!@$menu_name@g
3213 log 1 "Generating menu item..."
3215 < $ROOT_DIR/media/openttd.desktop.in sed "$MENU_REPLACE" > media/openttd.desktop
3223 # Create the main Makefile
3224 log 1 "Generating Makefile..."
3225 echo "# Auto-generated file from 'Makefile.in' -- DO NOT EDIT" > Makefile
3226 < $ROOT_DIR/Makefile.in sed "$SRC_REPLACE" >> Makefile
3227 cp $ROOT_DIR/Makefile.bundle.in Makefile.bundle
3228 echo "# Auto-generated file -- DO NOT EDIT" > Makefile.am
3230 # Make the copy of the source-list, so we don't trigger an unwanted recompile
3231 cp $SOURCE_LIST config.cache.source.list
3232 # Add the current directory, so we don't trigger an unwanted recompile
3233 echo "`pwd`" > config.cache.pwd
3234 # Make sure config.cache is OLDER then config.cache.source.list
3238 if [ "$menu_dir" != "" ]; then
3248 # Create the language file
3249 mkdir -p $LANG_OBJS_DIR
3251 log 1 "Generating lang/Makefile..."
3252 echo "# Auto-generated file from 'Makefile.lang.in' -- DO NOT EDIT" > $LANG_OBJS_DIR/Makefile
3253 < $ROOT_DIR/Makefile.lang.in sed "$SRC_REPLACE" >> $LANG_OBJS_DIR/Makefile
3254 echo "DIRS += $LANG_OBJS_DIR" >> Makefile.am
3255 echo "LANG_DIRS += $LANG_OBJS_DIR" >> Makefile.am
3258 generate_settings() {
3263 # Create the language file
3264 mkdir -p $SETTING_OBJS_DIR
3266 log 1 "Generating setting/Makefile..."
3267 echo "# Auto-generated file from 'Makefile.settings.in' -- DO NOT EDIT" > $SETTING_OBJS_DIR/Makefile
3268 < $ROOT_DIR/Makefile.setting.in sed "$SRC_REPLACE" >> $SETTING_OBJS_DIR/Makefile
3269 echo "DIRS += $SETTING_OBJS_DIR" >> Makefile.am
3277 # Create the language file
3278 mkdir -p $GRF_OBJS_DIR
3280 log 1 "Generating grf/Makefile..."
3281 echo "# Auto-generated file from 'Makefile.grf.in' -- DO NOT EDIT" > $GRF_OBJS_DIR/Makefile
3282 < $ROOT_DIR/Makefile.grf.in sed "$SRC_REPLACE" >> $GRF_OBJS_DIR/Makefile
3283 echo "DIRS += $GRF_OBJS_DIR" >> Makefile.am
3286 generate_src_normal() {
3291 # Create the source file
3292 mkdir -p $SRC_OBJS_DIR
3294 log 1 "Generating $2/Makefile..."
3295 echo "# Auto-generated file from 'Makefile.src.in' -- DO NOT EDIT" > $SRC_OBJS_DIR/Makefile
3296 < $ROOT_DIR/Makefile.src.in sed "$SRC_REPLACE" >> $SRC_OBJS_DIR/Makefile
3297 echo "DIRS += $SRC_OBJS_DIR" >> Makefile.am
3298 echo "SRC_DIRS += $SRC_OBJS_DIR" >> Makefile.am
3301 generate_src_osx() {
3302 cc_host_orig="$cc_host"
3303 cxx_host_orig="$cxx_host"
3304 CFLAGS_orig="$CFLAGS"
3305 LDFLAGS_orig="$LDFLAGS"
3307 for type in $enable_universal; do
3309 if [ -n "$osx_sdk_104_path" ]; then
3310 # Use 10.4 SDK for 32-bit targets
3311 CFLAGS="-isysroot $osx_sdk_104_path $CFLAGS_orig"
3312 LDFLAGS="-Wl,-syslibroot,$osx_sdk_104_path $LDFLAGS_orig"
3315 # We don't want to duplicate the x86_64 stuff for each target, so do it once here
3316 if [ "$type" = "ppc64" ] || [ "$type" = "x86_64" ]; then
3317 # 64 bits is always 10.5 or higher. Furthermore it has a non const ICONV
3318 # and they also removed support for QuickTime/QuickDraw
3319 if [ -n "$osx_sdk_path" ]; then
3320 CFLAGS="-isysroot $osx_sdk_path $CFLAGS_orig"
3321 LDFLAGS="-Wl,-syslibroot,$osx_sdk_path $LDFLAGS_orig"
3323 CFLAGS="$CFLAGS -D_SQ64"
3328 BASE_SRC_OBJS_DIR="$OBJS_DIR/ppc"
3329 cc_host="$cc_host_orig -arch ppc -mmacosx-version-min=10.3"
3330 cxx_host="$cxx_host_orig -arch ppc -mmacosx-version-min=10.3"
3331 generate_src_normal "[ppc]" "objs/ppc";;
3333 BASE_SRC_OBJS_DIR="$OBJS_DIR/ppc970"
3334 cc_host="$cc_host_orig -arch ppc970 -mmacosx-version-min=10.3 -mcpu=G5 -mpowerpc64 -mtune=970 -mcpu=970 -mpowerpc-gpopt"
3335 cxx_host="$cxx_host_orig -arch ppc970 -mmacosx-version-min=10.3 -mcpu=G5 -mpowerpc64 -mtune=970 -mcpu=970 -mpowerpc-gpopt"
3336 generate_src_normal "[ppc970]" "objs/ppc970";;
3338 BASE_SRC_OBJS_DIR="$OBJS_DIR/i386"
3339 cc_host="$cc_host_orig -arch i386 -mmacosx-version-min=10.4"
3340 cxx_host="$cxx_host_orig -arch i386 -mmacosx-version-min=10.4"
3341 generate_src_normal "[i386]" "objs/i386";;
3343 BASE_SRC_OBJS_DIR="$OBJS_DIR/ppc64"
3344 cc_host="$cc_host_orig -arch ppc64 -mmacosx-version-min=10.5"
3345 cxx_host="$cxx_host_orig -arch ppc64 -mmacosx-version-min=10.5"
3346 generate_src_normal "[ppc64]" "objs/ppc64";;
3348 BASE_SRC_OBJS_DIR="$OBJS_DIR/x86_64"
3349 cc_host="$cc_host_orig -arch x86_64 -mmacosx-version-min=10.5"
3350 cxx_host="$cxx_host_orig -arch x86_64 -mmacosx-version-min=10.5"
3351 generate_src_normal "[x86_64]" "objs/x86_64";;
3352 *) log 1 "Unknown architecture requested for universal build: $type";;
3358 if [ "$os" = "OSX" ] && [ "$enable_universal" != "0" ]; then
3361 generate_src_normal "[SRC]" "objs"
3366 echo "'configure' configures OpenTTD."
3368 echo "Usage: $0 [OPTION]... [VAR=VALUE]..."
3370 echo "To assign environment variables (e.g., CC, CFLAGS...), specify them as"
3371 echo "VAR=VALUE. See below for descriptions of some of the useful variables."
3373 echo "Defaults for the options are specified in brackets."
3375 echo "Configuration:"
3376 echo " -h, --help display this help and exit"
3378 echo "System types:"
3379 echo " --build=BUILD configure for building on BUILD [guessed]"
3380 echo " --host=HOST cross-compile to build programs to run"
3381 echo " on HOST [BUILD]"
3382 echo " --windres=WINDRES the windres to use [HOST-windres]"
3383 echo " --strip=STRIP the strip to use [HOST-strip]"
3384 echo " --awk=AWK the awk to use in configure [awk]"
3385 echo " --pkg-config=PKG-CONFIG the pkg-config to use in configure [pkg-config]"
3386 echo " --lipo=LIPO the lipo to use (OSX ONLY) [HOST-lipo]"
3387 echo " --os=OS the OS we are compiling for [DETECT]"
3388 echo " DETECT/UNIX/OSX/FREEBSD/DRAGONFLY/OPENBSD/"
3389 echo " NETBSD/HPUX/SUNOS/CYGWIN/"
3390 echo " MINGW/OS2/HAIKU"
3393 echo " --prefix-dir=dir specifies the prefix for all installed"
3394 echo " files [/usr/local]"
3395 echo " --binary-dir=dir location of the binary. Will be prefixed"
3396 echo " with the prefix-dir [games]"
3397 echo " --data-dir=dir location of data files (lang, data, gm)."
3398 echo " Will be prefixed with the prefix-dir"
3399 echo " [share/games/openttd]"
3400 echo " --doc-dir=dir location of the doc files"
3401 echo " Will be prefixed with the prefix-dir"
3403 echo " --icon-dir=dir location of icons. Will be prefixed"
3404 echo " with the prefix-dir [share/pixmaps]"
3405 echo " --icon-theme-dir=dir location of icon theme."
3406 echo " Will be prefixed with the prefix-dir"
3407 echo " and postfixed with size-dirs [$icon_theme_dir]"
3408 echo " --man-dir=dir location of the manual page (UNIX only)"
3409 echo " Will be prefixed with the prefix-dir"
3411 echo " --menu-dir=dir location of the menu item. (UNIX only, except OSX)"
3412 echo " Will be prefixed with the prefix-dir"
3413 echo " [share/applications]"
3414 echo " --personal-dir=dir location of the personal directory"
3415 echo " [os-dependent default]"
3416 echo " --shared-dir=dir location of shared data files"
3417 echo " [os-dependent default]"
3418 echo " --install-dir=dir specifies the root to install to."
3419 echo " Useful to install into jails [/]"
3420 echo " --binary-name the name used for the binary, icons,"
3421 echo " desktop file, etc. when installing [openttd]"
3423 echo "Features and packages:"
3424 echo " --enable-debug[=LVL] enable debug-mode (LVL=[0123], 0 is release)"
3425 echo " --enable-desync-debug=[LVL] enable desync debug options (LVL=[012], 0 is none"
3426 echo " --enable-profiling enables profiling"
3427 echo " --enable-lto enables GCC's Link Time Optimization (LTO)/ICC's"
3428 echo " Interprocedural Optimization if available"
3429 echo " --enable-dedicated compile a dedicated server (without video)"
3430 echo " --enable-static enable static compile (doesn't work for"
3432 echo " --enable-translator enable extra output for translators"
3433 echo " --enable-universal[=ARCH] enable universal builds (OSX ONLY). Allowed is any combination"
3434 echo " of architectures: i386 ppc ppc970 ppc64 x86_64"
3435 echo " Default architectures are: i386 ppc"
3436 echo " --enable-osx-g5 enables optimizations for ppc970 (G5) (OSX ONLY)"
3437 echo " --disable-cocoa-quartz disable the quartz window mode driver for Cocoa (OSX ONLY)"
3438 echo " --disable-unicode disable unicode support to build win9x"
3439 echo " version (Win32 ONLY)"
3440 echo " --enable-console compile as a console application instead of as a GUI application."
3441 echo " If this setting is active, debug output will appear in the same"
3442 echo " console instead of opening a new window. (Win32 ONLY)"
3443 echo " --disable-assert disable asserts (continue on errors)"
3444 echo " --enable-strip enable any possible stripping"
3445 echo " --without-osx-sysroot disable the automatic adding of sysroot "
3447 echo " --without-application-bundle disable generation of application bundle"
3449 echo " --without-menu-entry Don't generate a menu item (Freedesktop based only)"
3450 echo " --menu-group=group Category in which the menu item will be placed (Freedesktop based only)"
3451 echo " --menu-name=name Name of the menu item when placed [OpenTTD]"
3452 echo " --with-direct-music enable direct music support (Win32 ONLY)"
3453 echo " --with-sort=sort define a non-default location for sort"
3454 echo " --with-midi=midi define which midi-player to use"
3455 echo " --with-midi-arg=arg define which args to use for the"
3457 echo " --with-fluidsynth enables fluidsynth support"
3458 echo " --with-allegro[=\"pkg-config allegro\"]"
3459 echo " enables Allegro video driver support"
3460 echo " --with-cocoa enables COCOA video driver (OSX ONLY)"
3461 echo " --with-sdl[=\"sdl1|sdl2\"] enables SDL video driver support"
3462 echo " --with-zlib[=\"pkg-config zlib\"]"
3463 echo " enables zlib support"
3464 echo " --with-liblzma[=\"pkg-config liblzma\"]"
3465 echo " enables liblzma support"
3466 echo " --with-liblzo2[=liblzo2.a] enables liblzo2 support"
3467 echo " --with-png[=\"pkg-config libpng\"]"
3468 echo " enables libpng support"
3469 echo " --with-freetype[=\"pkg-config freetype2\"]"
3470 echo " enables libfreetype support"
3471 echo " --with-fontconfig[=\"pkg-config fontconfig\"]"
3472 echo " enables fontconfig support"
3473 echo " --with-xdg-basedir[=\"pkg-config libxdg-basedir\"]"
3474 echo " enables XDG base directory support"
3475 echo " --with-icu enables icu components for layout and sorting"
3476 echo " --with-icu-layout[=\"pkg-config icu-lx\"]"
3477 echo " enables icu components for layouting (right-to-left support)"
3478 echo " --with-icu-sort[=\"pkg-config icu-i18n\"]"
3479 echo " enables icu components for locale specific string sorting"
3480 echo " --static-icu try to link statically (libsicu instead of"
3481 echo " libicu; can fail as the new name is guessed)"
3482 echo " --with-iconv[=iconv-path] enables iconv support"
3483 echo " --disable-builtin-depend disable use of builtin deps finder"
3484 echo " --with-makedepend[=makedepend] enables makedepend support"
3485 echo " --with-ccache enables ccache support"
3486 echo " --with-distcc enables distcc support"
3487 echo " --without-grfcodec disable usage of grfcodec and re-generation of base sets"
3488 echo " --without-threads disable threading support"
3489 echo " --without-sse disable SSE support (x86/x86_64 only)"
3491 echo "Some influential environment variables:"
3492 echo " CC C compiler command"
3493 echo " CXX C++ compiler command"
3494 echo " CFLAGS C compiler flags"
3495 echo " CXXFLAGS C++ compiler flags"
3496 echo " WINDRES windres command"
3497 echo " LDFLAGS linker flags, e.g. -L<lib dir> if you"
3498 echo " have libraries in a nonstandard"
3499 echo " directory <lib dir>"
3500 echo " CFLAGS_BUILD C compiler flags for build time tool generation"
3501 echo " CXXFLAGS_BUILD C++ compiler flags for build time tool generation"
3502 echo " LDFLAGS_BUILD linker flags for build time tool generation"
3503 echo " PKG_CONFIG_PATH additional library search paths (see \"man pkg-config\")"
3504 echo " PKG_CONFIG_LIBDIR replace the default library search path (see \"man pkg-config\")"
3506 echo "Use these variables to override the choices made by 'configure' or to help"
3507 echo "it to find libraries and programs with nonstandard names/locations."