3 # This file is part of OpenTTD.
4 # OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
5 # OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
6 # See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
15 echo "$@" >> $config_log
19 ignore_extra_parameters="0"
20 # We set all kinds of defaults for params. Later on the user can override
21 # most of them; but if they don't, this default is used.
32 pkg_config="pkg-config"
35 config_log="config.log"
36 prefix_dir="/usr/local"
38 data_dir="share/games/openttd"
40 icon_dir="share/pixmaps"
51 enable_desync_debug="0"
64 enable_cocoa_quartz="1"
65 enable_cocoa_quickdraw="1"
67 with_application_bundle="1"
77 enable_builtin_depend="1"
142 enable_cocoa_quickdraw
144 with_application_bundle
153 enable_builtin_depend
173 CC CXX CFLAGS CXXFLAGS LDFLAGS CFLAGS_BUILD CXXFLAGS_BUILD LDFLAGS_BUILD PKG_CONFIG_PATH PKG_CONFIG_LIBDIR"
177 # Walk over all params from the user and override any default settings if
178 # needed. This also handles any invalid option.
180 if [ -n "$prev_p" ]; then
186 optarg=`expr "x$p" : 'x[^=]*=\(.*\)'`
189 --help | -h | -\?) showhelp; exit 0;;
191 --config-log) prev_p="config_log";;
192 --config-log=*) config_log="$optarg";;
194 --build) prev_p="build";;
195 --build=*) build="$optarg";;
197 --host) prev_p="host";;
198 --host=*) host="$optarg";;
201 --os=*) os="$optarg";;
203 --cpu-type) prev_p="cpu_type";;
204 --cpu-type=*) cpu_type="$optarg";;
206 --cc-build) prev_p="cc_build";;
207 --cc-build=*) cc_build="$optarg";;
208 --cc-host) prev_p="cc_host";;
209 --cc-host=*) cc_host="$optarg";;
210 --cxx-build) prev_p="cxx_build";;
211 --cxx-build=*) cxx_build="$optarg";;
212 --cxx-host) prev_p="cxx_host";;
213 --cxx-host=*) cxx_host="$optarg";;
214 --windres) prev_p="windres";;
215 --windres=*) windres="$optarg";;
216 --awk) prev_p="awk";;
217 --awk=*) awk="$optarg";;
218 --pkg-config) prev_p="pkg_config";;
219 --pkg-config=*) pkg_config="$optarg";;
220 --strip) prev_p="strip";;
221 --strip=*) strip="$optarg";;
222 --lipo) prev_p="lipo";;
223 --lipo=*) lipo="$optarg";;
227 # Alias --prefix with --prefix-dir, for compatibility with GNU autotools
228 --prefix-dir | --prefix) prev_p="prefix_dir";;
229 --prefix-dir=* | --prefix=*) prefix_dir="$optarg";;
231 --binary-dir) prev_p="binary_dir";;
232 --binary-dir=*) binary_dir="$optarg";;
234 --data-dir) prev_p="data_dir";;
235 --data-dir=*) data_dir="$optarg";;
237 --doc-dir) prev_p="doc_dir";;
238 --doc-dir=*) doc_dir="$optarg";;
240 --icon-dir) prev_p="icon_dir";;
241 --icon-dir=*) icon_dir="$optarg";;
243 --icon-theme-dir) prev_p="icon_theme_dir";;
244 --icon-theme-dir=*) icon_theme_dir="$optarg";;
245 --without-icon-theme) icon_theme_dir="";;
247 --menu-dir) prev_p="menu_dir";;
248 --menu-dir=*) menu_dir="$optarg";;
249 --without-menu-entry) menu_dir="";;
251 --menu-name) prev_p="menu_name";;
252 --menu-name=*) menu_name="$optarg";;
254 --binary-name) prev_p="binary_name";;
255 --binary-name=*) binary_name="$optarg";;
257 --man-dir) prev_p="man_dir";;
258 --man-dir=*) man_dir="$optarg";;
260 --personal-dir) prev_p="personal_dir";;
261 --personal-dir=*) personal_dir="$optarg";;
262 --without-personal-dir) personal_dir="";;
264 --shared-dir) prev_p="shared_dir";;
265 --shared-dir=*) shared_dir="$optarg";;
266 --without-shared-dir) shared_dir="";;
268 --install-dir) prev_p="install_dir";;
269 --install-dir=*) install_dir="$optarg";;
273 --menu-group) prev_p="menu_group";;
274 --menu-group=*) menu_group="$optarg";;
278 --enable-debug) enable_debug="1";;
279 --enable-debug=*) enable_debug="$optarg";;
280 --enable-desync-debug) enable_desync_debug="1";;
281 --enable-desync-debug=*) enable_desync_debug="$optarg";;
282 --enable-profiling) enable_profiling="1";;
283 --enable-profiling=*) enable_profiling="$optarg";;
284 --enable-lto) enable_lto="1";;
285 --enable-lto=*) enable_lto="$optarg";;
286 --enable-ipo) enable_lto="1";;
287 --enable-ipo=*) enable_lto="$optarg";;
288 --enable-dedicated) enable_dedicated="1";;
289 --enable-dedicated=*) enable_dedicated="$optarg";;
290 --enable-network) enable_network="2";;
291 --enable-network=*) enable_network="$optarg";;
292 --disable-network) enable_network="0";;
293 --disable-static) enable_static="0";;
294 --enable-static) enable_static="2";;
295 --enable-static=*) enable_static="$optarg";;
296 --disable-translator) enable_translator="0";;
297 --enable-translator) enable_translator="2";;
298 --enable-translator=*) enable_translator="$optarg";;
299 --disable-assert) enable_assert="0";;
300 --enable-assert) enable_assert="2";;
301 --enable-assert=*) enable_assert="$optarg";;
302 --disable-strip) enable_strip="0";;
303 --enable-strip) enable_strip="2";;
304 --enable-strip=*) enable_strip="$optarg";;
305 --disable-universal) enable_universal="0";;
306 --enable-universal) enable_universal="i386 ppc";;
307 --enable-universal=*) enable_universal="$optarg";;
308 --disable-osx-g5) enable_osx_g5="0";;
309 --enable-osx-g5) enable_osx_g5="2";;
310 --enable-osx-g5=*) enable_osx_g5="$optarg";;
311 --disable-unicode) enable_unicode="0";;
312 --enable-unicode) enable_unicode="2";;
313 --enable-unicode=*) enable_unicode="$optarg";;
314 --disable-console) enable_console="0";;
315 --enable-console) enable_console="2";;
316 --enable-console=*) enable_console="$optarg";;
318 --disable-cocoa-quartz) enable_cocoa_quartz="0";;
319 --enable-cocoa-quartz) enable_cocoa_quartz="2";;
320 --enable-cocoa-quartz=*) enable_cocoa_quartz="$optarg";;
321 --disable-cocoa-quickdraw) enable_cocoa_quickdraw="0";;
322 --enable-cocoa-quickdraw) enable_cocoa_quickdraw="2";;
323 --enable-cocoa-quickdraw=*) enable_cocoa_quickdraw="$optarg";;
325 --with-allegro) with_allegro="2";;
326 --without-allegro) with_allegro="0";;
327 --with-allegro=*) with_allegro="$optarg";;
329 --with-sdl) with_sdl="2";;
330 --without-sdl) with_sdl="0";;
331 --with-sdl=*) with_sdl="$optarg";;
333 --with-cocoa) with_cocoa="2";;
334 --without-cocoa) with_cocoa="0";;
335 --with-cocoa=*) with_cocoa="$optarg";;
337 --with-zlib) with_zlib="2";;
338 --without-zlib) with_zlib="0";;
339 --with-zlib=*) with_zlib="$optarg";;
341 --with-lzma) with_lzma="2";;
342 --without-lzma) with_lzma="0";;
343 --with-lzma=*) with_lzma="$optarg";;
344 --with-liblzma) with_lzma="2";;
345 --without-liblzma) with_lzma="0";;
346 --with-liblzma=*) with_lzma="$optarg";;
348 --with-lzo2) with_lzo2="2";;
349 --without-lzo2) with_lzo2="0";;
350 --with-lzo2=*) with_lzo2="$optarg";;
351 --with-liblzo2) with_lzo2="2";;
352 --without-liblzo2) with_lzo2="0";;
353 --with-liblzo2=*) with_lzo2="$optarg";;
355 --with-xdg-basedir) with_xdg_basedir="2";;
356 --without-xdg-basedir) with_xdg_basedir="0";;
357 --with-xdg-basedir=*) with_xdg_basedir="$optarg";;
358 --with-libxdg-basedir) with_xdg_basedir="2";;
359 --without-libxdg-basedir) with_xdg_basedir="0";;
360 --with-libxdg-basedir=*) with_xdg_basedir="$optarg";;
362 --with-png) with_png="2";;
363 --without-png) with_png="0";;
364 --with-png=*) with_png="$optarg";;
365 --with-libpng) with_png="2";;
366 --without-libpng) with_png="0";;
367 --with-libpng=*) with_png="$optarg";;
369 --with-libtimidity) with_libtimidity="2";;
370 --without-libtimidity) with_libtimidity="0";;
371 --with-libtimidity=*) with_libtimidity="$optarg";;
373 --with-freetype) with_freetype="2";;
374 --without-freetype) with_freetype="0";;
375 --with-freetype=*) with_freetype="$optarg";;
376 --with-libfreetype) with_freetype="2";;
377 --without-libfreetype) with_freetype="0";;
378 --with-libfreetype=*) with_freetype="$optarg";;
380 --with-fontconfig) with_fontconfig="2";;
381 --without-fontconfig) with_fontconfig="0";;
382 --with-fontconfig=*) with_fontconfig="$optarg";;
383 --with-libfontconfig) with_fontconfig="2";;
384 --without-libfontconfig) with_fontconfig="0";;
385 --with-libfontconfig=*) with_fontconfig="$optarg";;
387 --with-icu) with_icu_layout="2";with_icu_sort="2";;
388 --without-icu) with_icu_layout="0";with_icu_sort="0";;
389 --with-icu=*) with_icu_layout="$optarg";with_icu_sort="$optarg";;
390 --with-libicu) with_icu_layout="2";with_icu_sort="2";;
391 --without-libicu) with_icu_layout="0";with_icu_sort="0";;
392 --with-libicu=*) with_icu_layout="$optarg";with_icu_sort="$optarg";;
393 --with-icu-layout) with_icu_layout="2";;
394 --without-icu-layout) with_icu_layout="0";;
395 --with-icu-layout=*) with_icu_layout="$optarg";;
396 --with-icu-sort) with_icu_sort="2";;
397 --without-icu-sort) with_icu_sort="0";;
398 --with-icu-sort=*) with_icu_sort="$optarg";;
399 --static-icu) static_icu="1";;
400 --static-icu=*) static_icu="$optarg";;
401 --static-libicu) static_icu="1";;
402 --static-libicu=*) static_icu="$optarg";;
404 --disable-builtin-depend) enable_builtin_depend="0";;
405 --enable-builtin-depend) enable_builtin_depend="2";;
406 --enable-builtin-depend=*) enable_builtin_depend="$optarg";;
408 --with-makedepend) with_makedepend="2";;
409 --without-makedepend) with_makedepend="0";;
410 --with-makedepend=*) with_makedepend="$optarg";;
412 --with-direct-music) with_direct_music="2";;
413 --without-direct-music) with_direct_music="0";;
414 --with-direct-music=*) with_direct_music="$optarg";;
416 --with-xaudio2) with_xaudio2="2";;
417 --without-xaudio2) with_xaudio2="0";;
418 --with-xaudio2=*) with_xaudio2="$optarg";;
420 --with-sort) with_sort="2";;
421 --without-sort) with_sort="0";;
422 --with-sort=*) with_sort="$optarg";;
424 --with-iconv) with_iconv="2";;
425 --without-iconv) with_iconv="0";;
426 --with-iconv=*) with_iconv="$optarg";;
428 --with-midi=*) with_midi="$optarg";;
429 --with-midi-arg=*) with_midi_arg="$optarg";;
431 --without-distcc) with_distcc="0";;
432 --with-distcc) with_distcc="2";;
433 --with-distcc=*) with_distcc="$optarg";;
435 --without-ccache) with_ccache="0";;
436 --with-ccache) with_ccache="2";;
437 --with-ccache=*) with_ccache="$optarg";;
439 --without-nforenum) with_nforenum="0";;
440 --with-nforenum) with_nforenum="2";;
441 --with-nforenum=*) with_nforenum="$optarg";;
443 --without-grfcodec) with_grfcodec="0";;
444 --with-grfcodec) with_grfcodec="2";;
445 --with-grfcodec=*) with_grfcodec="$optarg";;
447 --without-osx-sysroot) with_osx_sysroot="0";;
448 --with-osx-sysroot) with_osx_sysroot="2";;
449 --with-osx-sysroot=*) with_osx_sysroot="$optarg";;
451 --without-application-bundle) with_application_bundle="0";;
452 --with-application-bundle) with_application_bundle="1";;
453 --with-application-bundle=*) with_application_bundle="$optarg";;
455 --without-threads) with_threads="0";;
456 --with-threads) with_threads="1";;
457 --with-threads=*) with_threads="$optarg";;
459 --without-sse) with_sse="0";;
460 --with-sse) with_sse="1";;
461 --with-sse=*) with_sse="$optarg";;
463 CC=* | --CC=*) CC="$optarg";;
464 CXX=* | --CXX=*) CXX="$optarg";;
465 CFLAGS=* | --CFLAGS=*) CFLAGS="$optarg";;
466 CXXFLAGS=* | --CXXFLAGS=*) CXXFLAGS="$optarg";;
467 LDFLAGS=* | --LDFLAGS=*) LDFLAGS="$optarg";;
468 CFLAGS_BUILD=* | --CFLAGS_BUILD=* | --CFLAGS-BUILD=*) CFLAGS_BUILD="$optarg";;
469 CXXFLAGS_BUILD=* | --CXXFLAGS_BUILD=* | --CXXFLAGS-BUILD=*) CXXFLAGS_BUILD="$optarg";;
470 LDFLAGS_BUILD=* | --LDFLAGS_BUILD=* | --LDFLAGS-BUILD=*) LDFLAGS_BUILD="$optarg";;
471 PKG_CONFIG_PATH=* | --PKG_CONFIG_PATH=* | --PKG-CONFIG-PATH=*) PKG_CONFIG_PATH="$optarg";;
472 PKG_CONFIG_LIBDIR=* | --PKG_CONFIG_LIBDIR=* | --PKG-CONFIG-LIBDIR=*) PKG_CONFIG_LIBDIR="$optarg";;
474 --ignore-extra-parameters) ignore_extra_parameters="1";;
477 if [ "$ignore_extra_parameters" = "0" ]; then
478 log 1 "Unknown option $p"
481 log 1 "Unknown option $p ignored"
487 if [ -n "$prev_p" ]; then
488 log 1 "configure: error: missing argument to --$prev_p"
493 echo "" > $config_log
494 log 2 "Invocation: $0 $*"
498 # Here we save all params, so we can later on do an exact redo of this
499 # configuration, without having the user to re-input stuff
501 echo "Running configure with following options:" >> $config_log
502 echo "" >> $config_log
504 configure="$CONFIGURE_EXECUTABLE --ignore-extra-parameters"
505 for p in $save_params_array; do
507 p=`echo "$p" | sed 's@_@-@g;s@\n@@g;s@ @\\ @g'`
508 # Only save those params that aren't empty
509 configure="$configure --$p=\"$v\""
512 echo "$configure" >> $config_log
513 echo "$configure" > config.cache
514 echo "" >> $config_log
517 # Export a variable so tools like pkg-config can see it when invoked.
518 # If the variable contains an empty string then unset it.
519 # $1 - name of the variable to export or unset
521 eval local value=\$$1
522 if [ -n "$value" ]; then
524 log 2 "using $1=$value";
527 log 2 "not using $1";
532 # Some params want to be in full uppercase, else they might not work as
533 # expected.. fix that here
535 os=`echo $os | tr '[a-z]' '[A-Z]'`
536 cpu_type=`echo $cpu_type | tr '[a-z]' '[A-Z]'`
538 # Export some variables to be used by pkg-config
540 # PKG_CONFIG_LIBDIR variable musn't be set if we are not willing to
541 # override the default pkg-config search path, it musn't be an empty
542 # string. If the variable is empty (e.g. when an empty string comes
543 # from config.cache) then unset it. This way the "don't override" state
544 # will be properly preserved when (re)configuring.
545 export_or_unset PKG_CONFIG_PATH
546 export_or_unset PKG_CONFIG_LIBDIR
548 # Check if all params have valid values
550 # OS only allows DETECT, UNIX, OSX, FREEBSD, DRAGONFLY, OPENBSD, NETBSD, MORPHOS, BEOS, HAIKU, SUNOS, CYGWIN, MINGW, OS2, and DOS
551 if [ -z "`echo $os | egrep '^(DETECT|UNIX|OSX|FREEBSD|DRAGONFLY|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|HAIKU|SUNOS|CYGWIN|MINGW|OS2|DOS)$'`" ]; then
552 log 1 "configure: error: invalid option --os=$os"
553 log 1 " Available options are: --os=[DETECT|UNIX|OSX|FREEBSD|DRAGONFLY|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|HAIKU|SUNOS|CYGWIN|MINGW|OS2|DOS]"
556 # cpu_type can be either 32 or 64
557 if [ -z "`echo $cpu_type | egrep '^(32|64|DETECT)$'`" ]; then
558 log 1 "configure: error: invalid option --cpu-type=$cpu_type"
559 log 1 " Available options are: --cpu-type[=DETECT|32|64]"
562 # enable_debug should be between 0 and 4
563 if [ -z "`echo $enable_debug | egrep '^[0123]$'`" ]; then
564 log 1 "configure: error: invalid option --enable-debug=$enable_debug"
565 log 1 " Available options are: --enable-debug[=0123]"
569 # enable_desync_debug should be between 0 and 3
570 if [ -z "`echo $enable_desync_debug | egrep '^[012]$'`" ]; then
571 log 1 "configure: error: invalid option --enable-desync-debug=$enable_desync_debug"
572 log 1 " Available options are: --enable-desync-debug[=012]"
583 # Check for universal builds; they only make sense for OSX, so fail if enabled for another OS
584 if [ "$enable_universal" = "0" ]; then
585 log 1 "checking universal build... no"
587 if [ "$os" != "OSX" ]; then
588 log 1 "configure: error: --enable-universal only works on OSX"
591 log 1 "checking universal build... yes, for: $enable_universal"
594 # Already detected by check_build
595 log 1 "checking build cc... $cc_build"
596 log 1 "checking host cc... $cc_host"
601 if [ "$enable_strip" != "0" ]; then
604 log 1 "checking strip... disabled"
608 if [ "$enable_builtin_depend" != "0" ]; then
609 log 1 "checking builtin depend... yes"
610 makedepend="\$(SRC_OBJS_DIR)/\$(DEPEND)"
612 log 1 "checking builtin depend... no"
617 detect_sse_capable_architecture
619 if [ "$enable_static" = "1" ]; then
620 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "MORPHOS" ] || [ "$os" = "DOS" ]; then
627 if [ "$enable_static" != "0" ]; then
628 log 1 "checking static... yes"
630 if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "OSX" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "DOS" ]; then
631 log 1 "WARNING: static is only known to work on Windows, DOS, MacOSX and MorphOS"
632 log 1 "WARNING: use static at your own risk on this platform"
637 log 1 "checking static... no"
640 if [ "$enable_unicode" = "1" ]; then
641 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "DOS" ]; then
648 if [ "$enable_unicode" != "0" ]; then
649 log 1 "checking unicode... yes"
651 log 1 "checking unicode... no"
654 # Show what we configured
655 if [ "$enable_debug" = "0" ]; then
656 log 1 "using debug level... no"
657 elif [ "$enable_profiling" != "0" ]; then
658 log 1 "using debug level... profiling (debug level $enable_debug)"
660 log 1 "using debug level... level $enable_debug"
663 if [ "$enable_desync_debug" = "0" ]; then
664 log 1 "using desync debug level... no"
666 log 1 "using desync debug level... level $enable_desync_debug"
667 log 1 "WARNING: desync debug functions slow down the game considerably."
668 log 1 "WARNING: use only when you are instructed to do so"
669 log 1 " or when you know what you are doing."
674 if [ "$enable_lto" != "0" ]; then
675 # GCC 4.5 outputs '%{flto}', GCC 4.6 outputs '%{flto*}'
676 has_lto=`($cxx_build -dumpspecs 2>&1 | grep '\%{flto') || ($cxx_build -help ipo 2>&1 | grep '\-ipo')`
677 if [ -n "$has_lto" ]; then
678 log 1 "using link time optimization... yes"
681 log 1 "using link time optimization... no"
682 log 1 "WARNING: you selected link time optimization but it is not found."
686 log 1 "using link time optimization... no"
690 if [ "$os" != "OSX" ] && [ "$with_osx_sysroot" != "0" ]; then
691 if [ "$with_osx_sysroot" = "1" ]; then
694 log 1 "checking OSX sysroot... not OSX, skipping"
696 log 1 "configure: error: --with-osx-sysroot only works if OSX is the target"
701 if [ "$with_osx_sysroot" != "0" ]; then
702 if [ "$enable_universal" = "0" ] && [ "$with_osx_sysroot" != "1" ] && [ "$with_osx_sysroot" != "2" ]; then
703 # Sysroot manually specified? Check for usability
704 log 1 "checking OSX sysroot... $with_osx_sysroot"
705 if ! check_osx_sdk "$with_osx_sysroot"; then
706 log 1 "Passed sysroot not found/not functional"
710 # If autodetect and no universal, use system default
711 if [ "$with_osx_sysroot" = "1" ] && [ "$enable_universal" = "0" ]; then
712 log 1 "checking OSX sysroot... no (use system default)"
714 log 1 "checking OSX sysroot... automatically"
719 if [ -n "$osx_sdk_path" ]; then
720 if [ "$enable_universal" != "0" ]; then
721 if [ -z "$osx_sdk_104_path" ]; then
722 log 1 "WARNING: Could not find a usable 10.4u SDK, the resulting"
723 log 1 "WARNING: binary will only run on OSX 10.5 or later"
724 osx_sdk_104_path="$osx_sdk_path"
726 OSX_SYSROOT="-isysroot $osx_sdk_104_path"
727 OSX_LD_SYSROOT="-Wl,-syslibroot,$osx_sdk_104_path"
729 OSX_SYSROOT="-isysroot $osx_sdk_path"
730 OSX_LD_SYSROOT="-Wl,-syslibroot,$osx_sdk_path"
734 if [ "$os" = "OSX" ]; then
735 log 1 "checking OSX sysroot... no (use system default)"
743 if [ "$enable_dedicated" != "0" ]; then
744 log 1 "checking GDI video driver... dedicated server, skipping"
745 log 1 "checking dedicated... found"
747 if [ "$enable_network" = "0" ]; then
748 log 1 "configure: error: building a dedicated server without network support is pointless"
752 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
753 log 1 "checking GDI video driver... found"
755 log 1 "checking GDI video driver... not Windows, skipping"
758 if [ -z "$allegro_config" ] && [ -z "$sdl_config" ] && [ "$with_cocoa" = 0 ] && [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then
759 log 1 "configure: error: no video driver development files found"
760 log 1 " If you want a dedicated server use --enable-dedicated as parameter"
763 log 1 "checking dedicated... not selected"
767 if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then
768 log 1 "checking console application... not Windows, skipping"
769 elif [ "$enable_console" = "1" ] && [ "$enable_dedicated" != "0" ]; then
770 log 1 "checking console application... dedicated server, enabled"
772 elif [ "$enable_console" = "1" ]; then
773 log 1 "checking console application... disabled (only used when forced)"
775 elif [ "$enable_console" = "0" ]; then
776 log 1 "checking console application... disabled"
778 log 1 "checking console application... enabled"
781 if [ "$enable_network" = "1" ] && [ "$os" = "DOS" ]; then
782 log 1 "checking network... DOS, skipping"
784 elif [ "$enable_network" != "0" ]; then
785 log 1 "checking network... found"
787 log 1 "checking network... disabled"
790 log 1 "checking squirrel... found"
791 SCRIPT_SRC_DIR="$ROOT_DIR/src/3rdparty/squirrel/include"
793 if [ "$enable_translator" != "0" ]; then
794 log 1 "checking translator... debug"
795 # -t shows TODO items, normally they are muted
798 log 1 "checking translator... no"
802 if [ "$enable_assert" != "0" ]; then
803 log 1 "checking assert... enabled"
805 log 1 "checking assert... disabled"
808 pre_detect_with_zlib=$with_zlib
811 if [ "$with_zlib" = "0" ] || [ -z "$zlib-config" ]; then
812 log 1 "WARNING: zlib was not detected or disabled"
813 log 1 "WARNING: OpenTTD doesn't require zlib, but it does mean that many features"
814 log 1 "WARNING: (like loading most old savegames/scenarios, loading heightmaps,"
815 log 1 "WARNING: using PNG, or using fonts, ...) will be disabled."
816 if [ "$pre_detect_with_zlib" = "0" ]; then
817 log 1 "WARNING: We strongly suggest you to install zlib."
819 log 1 "configure: error: no zlib detected"
820 log 1 " If you want to compile without zlib use --without-zlib as parameter"
825 pre_detect_with_lzma=$with_lzma
828 if [ "$with_lzma" = "0" ] || [ -z "$lzma_config" ]; then
829 log 1 "WARNING: lzma was not detected or disabled"
830 log 1 "WARNING: OpenTTD doesn't require lzma, but it does mean that many features"
831 log 1 "WARNING: (like loading most savegames/scenarios and joining most servers)"
832 log 1 "WARNING: will be disabled."
833 if [ "$pre_detect_with_lzma" = "0" ]; then
834 log 1 "WARNING: We strongly suggest you to install liblzma."
835 log 1 "configure: error: no liblzma detected"
837 log 1 " If you want to compile without lzma use --without-lzma as parameter"
842 pre_detect_with_lzo2=$with_lzo2
845 if [ "$with_lzo2" = "0" ] || [ -z "$lzo2" ]; then
846 log 1 "WARNING: liblzo2 was not detected or disabled"
847 log 1 "WARNING: OpenTTD doesn't require liblzo2, but it does mean that"
848 log 1 "WARNING: loading old savegames/scenarios will be disabled."
849 if [ "$pre_detect_with_lzo2" = "0" ]; then
850 log 1 "WARNING: We strongly suggest you to install liblzo2."
852 log 1 "configure: error: no liblzo2 detected"
853 log 1 " If you want to compile without liblzo2 use --without-liblzo2 as parameter"
866 if [ "$with_direct_music" != "0" ]; then
867 if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then
868 if [ "$with_direct_music" != "1" ]; then
869 log 1 "configure: error: direct-music is only supported on Win32 targets"
872 with_direct_music="0"
874 log 1 "checking direct-music... not Windows, skipping"
880 if [ "$with_xaudio2" != "0" ]; then
881 if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then
882 if [ "$with_xaudio2" != "1" ]; then
883 log 1 "configure: error: xaudio2 is only supported on Win32 targets"
888 log 1 "checking xaudio2... not Windows, skipping"
896 # Suppress language errors when there is a version defined, indicating a release
897 # It just isn't pretty if any release produces warnings in the languages.
898 if [ -f "$ROOT_DIR/version" ]; then
900 log 1 "suppress language errors... yes"
903 log 1 "suppress language errors... no"
906 if [ "$enable_debug" = "0" ] && [ "$enable_profiling" = "0" ] && [ "$enable_strip" != "0" ]; then
907 if [ "$os" = "MORPHOS" ]; then
908 strip_arg="--strip-all --strip-unneeded --remove-section .comment"
909 elif [ "$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" = "DOS" ]; then
1004 if [ "$os" != "OSX" ] && [ "$with_application_bundle" != "0" ]; then
1005 if [ "$with_application_bundle" = "1" ]; then
1006 with_application_bundle="0"
1008 log 1 "checking OSX application bundle... not OSX, skipping"
1010 log 1 "configure: error: --with-application-bundle only works if OSX is the target"
1015 if [ "$os" = "OSX" ] && [ "$with_application_bundle" = "1" ]; then
1016 OSXAPP="OpenTTD.app"
1021 if [ "$os" = "OSX" ]; then
1022 # Test on ppc970 (G5) - we can optimize there
1024 if [ "$enable_osx_g5" != "0" ]; then
1025 log 1 "detecting ppc970 (G5)... yes (forced)"
1027 # First, are we a real OSX system, else we can't detect it
1028 native=`LC_ALL=C uname | tr '[A-Z]' '[a-z]' | grep darwin`
1029 # If $host doesn't match $build , we are cross-compiling
1030 if [ -n "$native" ] && [ "$build" = "$host" ]; then
1031 $cxx_build $SRC_DIR/os/macosx/G5_detector.cpp -o G5_detector
1034 if [ -n "$res" ]; then
1035 # This is G5, add flags for it
1038 log 1 "detecting ppc970 (G5)... yes"
1042 log 1 "detecting ppc970 (G5)... no"
1047 log 1 "detecting ppc970 (G5)... no (cross-compiling)"
1051 if [ "$enable_osx_g5" != "0" ]; then
1052 log 1 "configure: error: ppc970 (OSX G5) selected, but not compiling for OSX"
1053 log 1 "configure: error: either select OSX as OS, or deselect ppc970"
1059 if [ -d "$ROOT_DIR/.svn" ] && [ -n "`svn help 2>/dev/null`" ]; then
1060 log 1 "checking revision... svn detection"
1061 elif [ -d "$ROOT_DIR/../.svn" ] && [ -n "`svn help 2>/dev/null`" ] && [ -n "`LC_ALL=C svn info $ROOT_DIR/.. | grep '^URL:.*tags$'`" ]; then
1062 # subversion changed its behaviour; now not all folders have a .svn folder,
1063 # but only the root folder. Since making tags requires a (sparse) checkout
1064 # of the tags folder, the folder of the tag does not have a .svn folder
1065 # anymore and this fails to detect the subversion repository checkout.
1066 log 1 "checking revision... svn detection (tag)"
1067 elif [ -d "$ROOT_DIR/.git" ] && [ -n "`git help 2>/dev/null`" ]; then
1068 log 1 "checking revision... git detection"
1069 elif [ -d "$ROOT_DIR/.hg" ] && [ -n "`HGPLAIN= hg help 2>/dev/null`" ]; then
1070 log 1 "checking revision... hg detection"
1071 elif [ -f "$ROOT_DIR/.ottdrev" ]; then
1072 log 1 "checking revision... source tarball"
1074 log 1 "checking revision... no detection"
1075 log 1 "WARNING: there is no means to determine the version."
1076 log 1 "WARNING: please use a subversion, mercurial, or git checkout of OpenTTD."
1077 log 1 "WARNING: you can only join game servers that have been compiled without"
1078 log 1 "WARNING: version detection."
1079 log 1 "WARNING: there is a great chance you desync."
1080 log 1 "WARNING: USE WITH CAUTION!"
1085 if [ "$doc_dir" = "1" ]; then
1086 if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "DRAGONFLY" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ]; then
1087 doc_dir="share/doc/openttd"
1089 doc_dir="$data_dir/docs"
1092 doc_dir="`echo $doc_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1095 if [ "$icon_theme_dir" = "1" ]; then
1096 if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "DRAGONFLY" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ]; then
1097 icon_theme_dir="share/icons/hicolor"
1102 icon_theme_dir="`echo $icon_theme_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1105 if [ "$personal_dir" = "1" ]; then
1106 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "DOS" ] || [ "$os" = "HAIKU" ]; then
1107 personal_dir="OpenTTD"
1108 elif [ "$os" = "OSX" ]; then
1109 personal_dir="Documents/OpenTTD"
1111 personal_dir=".openttd"
1114 personal_dir="`echo $personal_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1117 if [ "$shared_dir" = "1" ]; then
1118 # we are using default values
1119 if [ "$os" = "OSX" ]; then
1120 shared_dir="/Library/Application\\\\ Support/OpenTTD"
1125 shared_dir="`echo $shared_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1128 if [ "$man_dir" = "1" ]; then
1129 # add manpage on UNIX systems
1130 if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "DRAGONFLY" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ] || [ "$os" = "OSX" ]; then
1131 man_dir="share/man/man6"
1136 man_dir="`echo $man_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1139 if [ "$menu_dir" = "1" ]; then
1140 # add a freedesktop menu item only for some UNIX systems
1141 if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "DRAGONFLY" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ]; then
1142 menu_dir="share/applications"
1147 menu_dir="`echo $menu_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
1152 if [ -n "$personal_dir" ]
1154 log 1 "personal home directory... $personal_dir"
1156 log 1 "personal home directory... none"
1159 if [ -n "$shared_dir" ]
1161 log 1 "shared data directory... $shared_dir"
1163 log 1 "shared data directory... none"
1166 if [ -n "$install_dir" ]
1168 log 1 "installation directory... $install_dir"
1170 log 1 "installation directory... none"
1173 if [ -n "$icon_theme_dir" ]
1175 log 1 "icon theme directory... $icon_theme_dir"
1177 log 1 "icon theme directory... none"
1180 if [ -n "$man_dir" ]
1182 log 1 "manual page directory... $man_dir"
1184 log 1 "manual page directory... none"
1187 if [ -n "$menu_dir" ]
1189 log 1 "menu item directory... $menu_dir"
1191 log 1 "menu item directory... none"
1195 make_compiler_cflags() {
1198 # $2 - name of the cflags variable
1199 # $3 - name of the cxxflags variable
1200 # $4 - name of the ldflags variable
1201 # $5 - name of the features variable
1203 # Get the compiler to tell us who it is
1204 compiler="`$1 --version | head -n1 | cut -d' ' -f1`"
1206 eval eval "flags=\\\$$2"
1207 eval eval "cxxflags=\\\$$3"
1208 eval eval "ldflags=\\\$$4"
1209 eval eval "features=\\\$$5"
1211 if [ "$compiler" = "icc" ]; then
1212 # Enable some things only for certain ICC versions
1213 cc_version=`$1 -dumpversion | cut -c 1-4 | sed s@\\\.@@g`
1215 flags="$flags -rdynamic"
1216 ldflags="$ldflags -rdynamic"
1218 if [ -z "$first_time_icc_check" ]; then
1219 first_time_icc_check=no
1220 if [ $cc_version -lt 90 ]; then
1221 log 1 "WARNING: you seem to be using a very old version of ICC"
1222 log 1 "WARNING: OpenTTD hasn't been tested with this version"
1224 elif [ $cc_version -lt 120 ]; then
1225 log 1 "WARNING: you seem to be using an unsupported ICC version"
1226 log 1 "WARNING: ICC older than 12.0 is known to fail to compile OpenTTD"
1231 flags="$flags -Wall"
1232 # remark #111: statement is unreachable
1233 flags="$flags -wd111"
1234 # remark #181: argument is incompatible with corresponding format string conversion
1235 # ICC is very picky about signedness of operands, warnings provided by GCC are enough
1236 flags="$flags -wd181"
1237 # remark #271: trailing comma is nonstandard
1238 flags="$flags -wd271"
1239 # remark #280: selector expression is constant
1240 flags="$flags -wd280"
1241 # remark #304: access control not specified ("public" by default)
1242 flags="$flags -wd304"
1243 # remark #383: value copied to temporary, reference to temporary used
1244 flags="$flags -wd383"
1245 # remark #444: destructor for base class ... is not virtual
1246 flags="$flags -wd444"
1247 # remark #593: variable ... was set but never used
1248 flags="$flags -wd593"
1249 # warning #654: overloaded virtual function ... is only partially overridden in class ...
1250 flags="$flags -wd654"
1251 # remark #810: conversion from ... to ... may lose significant bits
1252 flags="$flags -wd810"
1253 # remark #869: parameter ... was never referenced
1254 flags="$flags -wd869"
1255 # warning #873: function ... ::operator new ... has no corresponding operator delete ...
1256 flags="$flags -wd873"
1257 # remark #981: operands are evaluated in unspecified order
1258 flags="$flags -wd981"
1259 # remark #1418: external function definition with no prior declaration
1260 flags="$flags -wd1418"
1261 # remark #1419: external declaration in primary source file
1262 flags="$flags -wd1419"
1263 # remark #1572: floating-point equality and inequality
1264 flags="$flags -wd1572"
1265 # remark #1599: declaration hides variable/parameter ...
1266 flags="$flags -wd1599"
1267 # remark #1720: function ... ::operator new ... has no corresponding member operator delete ...
1268 flags="$flags -wd1720"
1270 if [ $cc_version -lt 110 ]; then
1271 # warns about system headers with recent glibc:
1272 # warning #1292: attribute "__nonnull__" ignored
1273 flags="$flags -wd1292"
1276 if [ $cc_version -ge 100 ]; then
1277 # warning #1899: multicharacter character literal (potential portability problem)
1278 flags="$flags -wd1899"
1279 # vec report defaults to telling where it did loop vectorisation, which is not very important
1280 flags="$flags -vec-report=0 "
1283 if [ $cc_version -ge 110 ]; then
1284 # remark #2259: non-pointer conversion from ... to ... may lose significant bits
1285 flags="$flags -wd2259"
1286 # Use c++0x mode so static_assert() is available
1287 cxxflags="$cxxflags -std=c++0x"
1290 if [ "$enable_lto" != "0" ]; then
1291 has_ipo=`$1 -help ipo | grep '\-ipo'`
1292 if [ -n "$has_ipo" ]; then
1293 # Use IPO (only if we see IPO exists and is requested)
1295 features="$features lto"
1298 elif [ "$compiler" = "clang" ]; then
1299 # Enable some things only for certain clang versions
1300 cc_version="`$1 -v 2>&1 | head -n 1 | sed s@[^0-9]@@g | cut -c 1-2`"
1302 # aliasing rules are not held in openttd code
1303 flags="$flags -fno-strict-aliasing"
1305 # -W alone doesn't enable all warnings enabled by -Wall; on the other hand,
1306 # -Weverything enables too many useless warnings that can't be disabled (as of 3.0)
1307 flags="$flags -Wall -W -Wextra"
1309 # warning: unused parameter '...'
1310 flags="$flags -Wno-unused-parameter"
1312 # warning: expression result unused
1313 flags="$flags -Wno-unused-value"
1315 # warning: multi-character character constant
1316 flags="$flags -Wno-multichar"
1318 # warning: explicitly assigning a variable of type '...' to itself
1319 # it happens when using the FOR_ALL_WINDOWS_FROM_BACK_FROM macro
1320 flags="$flags -Wno-self-assign"
1322 if [ "$cc_version" -lt "30" ]; then
1323 # warning: equality comparison with extraneous parentheses
1324 flags="$flags -Wno-parentheses"
1325 # warning: operands of ? are integers of different signs: 'unsigned int' and 'int'
1326 flags="$flags -Wno-sign-compare"
1329 if [ "$cc_version" -ge "30" ]; then
1330 # warning: equality comparison with extraneous parentheses
1331 # this warning could be useful, but it warns about code in squirrel
1332 flags="$flags -Wno-parentheses-equality"
1335 if [ "$with_ccache" != "0" -o "$with_distcc" != "0" ]; then
1336 # ccache and distcc run separate preprocess and compile passes,
1337 # both are fed with the same CFLAGS. Unfortunately, clang
1338 # complains about -I when compiling preprocessed files:
1339 # "clang: warning: argument unused during compilation: '-I /usr/include'"
1340 flags="$flags -Qunused-arguments"
1343 if [ "$enable_assert" -eq "0" ]; then
1344 # do not warn about unused variables when building without asserts
1345 flags="$flags -Wno-unused-variable"
1348 if [ "$cc_version" -ge "33" ]; then
1349 # clang completed C++11 support in version 3.3
1350 flags="$flags -std=c++11"
1353 # rdynamic is used to get useful stack traces from crash reports.
1354 ldflags="$ldflags -rdynamic"
1356 # Assume gcc, since it just uses argv[0] in its --version output
1358 # Enable some things only for certain GCC versions
1359 # cc_version = major_version * 100 + minor_version
1360 # For example: "3.3" -> 303, "4.9.2" -> 409, "6" -> 600, "23.5" -> 2305
1361 cc_version=`$1 -dumpversion | $awk -F . '{printf "%d%02d", $1, $2}'`
1363 if [ $cc_version -lt 303 ]; then
1364 log 1 "configure: error: gcc older than 3.3 can't compile OpenTTD because of its poor template support"
1368 flags="$flags -Wall -Wno-multichar -Wsign-compare -Wundef"
1369 flags="$flags -Wwrite-strings -Wpointer-arith"
1370 flags="$flags -W -Wno-unused-parameter -Wredundant-decls"
1371 flags="$flags -Wformat=2 -Wformat-security"
1373 if [ $enable_assert -eq 0 ]; then
1374 # Do not warn about unused variables when building without asserts
1375 flags="$flags -Wno-unused-variable"
1376 if [ $cc_version -ge 406 ]; then
1377 # GCC 4.6 gives more warnings, disable them too
1378 flags="$flags -Wno-unused-but-set-variable"
1379 flags="$flags -Wno-unused-but-set-parameter"
1383 if [ $cc_version -ge 304 ]; then
1384 # Warn when a variable is used to initialise itself:
1386 flags="$flags -Winit-self"
1389 if [ $cc_version -ge 400 ]; then
1390 # GCC 4.0+ complains about that we break strict-aliasing.
1391 # On most places we don't see how to fix it, and it doesn't
1392 # break anything. So disable strict-aliasing to make the
1393 # compiler all happy.
1394 flags="$flags -fno-strict-aliasing"
1395 # Warn about casting-out 'const' with regular C-style cast.
1396 # The preferred way is const_cast<>() which doesn't warn.
1397 flags="$flags -Wcast-qual"
1400 if [ $cc_version -ge 402 ]; then
1401 # GCC 4.2+ automatically assumes that signed overflows do
1402 # not occur in signed arithmetics, whereas we are not
1403 # sure that they will not happen. It furthermore complains
1404 # about its own optimized code in some places.
1405 flags="$flags -fno-strict-overflow"
1406 # GCC 4.2 no longer includes -Wnon-virtual-dtor in -Wall.
1407 # Enable it in order to be consistent with older GCC versions.
1408 flags="$flags -Wnon-virtual-dtor"
1411 if [ $cc_version -ge 403 ] && [ $cc_version -lt 600 ]; then
1412 # Use gnu++0x mode so static_assert() is available.
1413 # Don't use c++0x, it breaks mingw (with gcc 4.4.0).
1414 cxxflags="$cxxflags -std=gnu++0x"
1417 if [ $cc_version -eq 405 ]; then
1418 # Prevent optimisation supposing enums are in a range specified by the standard
1419 # For details, see http://gcc.gnu.org/PR43680
1420 flags="$flags -fno-tree-vrp"
1423 if [ $cc_version -eq 407 ]; then
1424 # Disable -Wnarrowing which gives many warnings, such as:
1425 # warning: narrowing conversion of '...' from 'unsigned int' to 'int' inside { } [-Wnarrowing]
1426 # They are valid according to the C++ standard, but useless.
1427 cxxflags="$cxxflags -Wno-narrowing"
1430 if [ $cc_version -ge 407 ]; then
1431 # Disable bogus 'attempt to free a non-heap object' warning
1432 flags="$flags -Wno-free-nonheap-object"
1435 if [ $cc_version -ge 600 ]; then
1436 # -flifetime-dse=2 (default since GCC 6) doesn't play
1437 # well with our custom pool item allocator
1438 cxxflags="$cxxflags -flifetime-dse=1 -std=gnu++14"
1441 if [ "$enable_lto" != "0" ]; then
1442 # GCC 4.5 outputs '%{flto}', GCC 4.6 outputs '%{flto*}'
1443 has_lto=`$1 -dumpspecs | grep '\%{flto'`
1444 if [ -n "$has_lto" ]; then
1445 # Use LTO only if we see LTO exists and is requested
1446 if [ $cc_version -lt 406 ]; then
1447 flags="$flags -flto"
1449 flags="$flags -flto=jobserver"
1451 ldflags="$ldflags -fwhole-program"
1452 features="$features lto"
1456 has_rdynamic=`$1 -dumpspecs | grep rdynamic`
1457 if [ -n "$has_rdynamic" ]; then
1458 # rdynamic is used to get useful stack traces from crash reports.
1459 flags="$flags -rdynamic"
1460 ldflags="$ldflags -rdynamic"
1464 eval "$2=\"$flags\""
1465 eval "$3=\"$cxxflags\""
1466 eval "$4=\"$ldflags\""
1467 eval "$5=\"$features\""
1470 make_cflags_and_ldflags() {
1471 # General CFlags for BUILD
1472 CFLAGS_BUILD_ENV="$CFLAGS_BUILD"
1474 # Special CXXFlags for BUILD
1475 CXXFLAGS_BUILD_ENV="$CXXFLAGS_BUILD"
1478 LDFLAGS_BUILD_ENV="$LDFLAGS_BUILD"
1480 # FEATURES for BUILD (lto)
1482 # General CFlags for HOST
1483 CFLAGS_ENV="$CFLAGS"
1485 # Special CXXFlags for HOST
1486 CXXFLAGS_ENV="$CXXFLAGS"
1488 # Libs to compile. In fact this is just LDFLAGS
1490 # LDFLAGS used for HOST
1491 LDFLAGS_ENV="$LDFLAGS"
1493 # FEATURES for HOST (lto)
1496 make_compiler_cflags "$cc_build" "CFLAGS_BUILD" "CXXFLAGS_BUILD" "LDFLAGS_BUILD" "FEATURES_BUILD"
1497 make_compiler_cflags "$cc_host" "CFLAGS" "CXXFLAGS" "LDFLAGS" "FEATURES"
1499 CFLAGS="$CFLAGS -D$os"
1500 CFLAGS_BUILD="$CFLAGS_BUILD -D$os"
1502 if [ "$enable_debug" = "0" ]; then
1503 # No debug, add default stuff
1504 OBJS_SUBDIR="release"
1505 if [ "$os" = "MORPHOS" ]; then
1506 CFLAGS="-I/gg/os-include -noixemul -fstrict-aliasing -fexpensive-optimizations -mcpu=604 -fno-inline -mstring -mmultiple $CFLAGS"
1507 LDFLAGS="$LDFLAGS -noixemul"
1510 if [ "$enable_profiling" = "0" ]; then
1511 # -fomit-frame-pointer and -pg do not go well together (gcc errors they are incompatible)
1512 CFLAGS="-fomit-frame-pointer $CFLAGS"
1514 CFLAGS="-O2 $CFLAGS"
1518 # Each debug level reduces the optimization by a bit
1519 if [ $enable_debug -ge 1 ]; then
1520 CFLAGS="$CFLAGS -g -D_DEBUG"
1522 if [ $enable_debug -ge 2 ]; then
1523 CFLAGS="$CFLAGS -fno-inline"
1525 if [ $enable_debug -ge 3 ]; then
1526 CFLAGS="$CFLAGS -O0"
1528 CFLAGS="$CFLAGS -O2"
1532 if [ $enable_debug -le 2 ]; then
1533 cc_host_is_gcc=`basename "$cc_host" | grep "gcc" 2>/dev/null`
1534 if [ -n "$cc_host_is_gcc" ]; then
1535 # Define only when compiling with GCC. Some GLIBC versions use GNU
1536 # extensions in a way that breaks build with at least ICC.
1537 # This requires -O1 or more, so debug level 3 (-O0) is excluded.
1538 CFLAGS="$CFLAGS -D_FORTIFY_SOURCE=2"
1541 cc_build_is_gcc=`basename "$cc_build" | grep "gcc" 2>/dev/null`
1542 if [ -n "$cc_build_is_gcc" ]; then
1543 # Just add -O1 to the tools needed for building.
1544 CFLAGS_BUILD="$CFLAGS_BUILD -D_FORTIFY_SOURCE=2 -O1"
1548 if [ "$os" = "OSX" ] && [ $cc_version -eq 400 ]; then
1549 # Apple's GCC 4.0 has a compiler bug for x86_64 with (higher) optimization,
1550 # wrongly optimizing ^= in loops. This disables the failing optimisation.
1551 CFLAGS="$CFLAGS -fno-expensive-optimizations"
1554 if [ "$enable_profiling" != "0" ]; then
1555 CFLAGS="$CFLAGS -pg"
1556 LDFLAGS="$LDFLAGS -pg"
1559 if [ "$with_threads" = "0" ]; then
1560 CFLAGS="$CFLAGS -DNO_THREADS"
1562 if [ "$with_sse" = "1" ]; then
1563 CFLAGS="$CFLAGS -DWITH_SSE"
1566 if [ "`echo $1 | cut -c 1-3`" != "icc" ]; then
1567 if [ "$os" = "CYGWIN" ]; then
1568 flags="$flags -mwin32"
1569 LDFLAGS="$LDFLAGS -mwin32"
1571 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
1572 if [ $cc_version -lt 406 ]; then
1573 flags="$flags -mno-cygwin"
1574 LDFLAGS="$LDFLAGS -mno-cygwin"
1577 if [ "$enable_console" != "0" ]; then
1578 LDFLAGS="$LDFLAGS -Wl,--subsystem,console"
1580 LDFLAGS="$LDFLAGS -Wl,--subsystem,windows"
1583 LIBS="$LIBS -lws2_32 -lwinmm -lgdi32 -ldxguid -lole32 -limm32"
1585 if [ $cc_version -ge 404 ]; then
1586 LDFLAGS_BUILD="$LDFLAGS_BUILD -static-libgcc -static-libstdc++"
1588 if [ $cc_version -ge 407 ]; then
1589 CFLAGS="$CFLAGS -mno-ms-bitfields"
1594 if [ "$os" != "CYGWIN" ] && [ "$os" != "HAIKU" ] && [ "$os" != "OPENBSD" ] && [ "$os" != "MINGW" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "OSX" ] && [ "$os" != "DOS" ] && [ "$os" != "OS2" ]; then
1595 LIBS="$LIBS -lpthread"
1598 if [ "$os" != "CYGWIN" ] && [ "$os" != "HAIKU" ] && [ "$os" != "MINGW" ] && [ "$os" != "DOS" ]; then
1602 if [ "$os" = "MORPHOS" ]; then
1603 # -Wstrict-prototypes generates much noise because of system headers
1604 CFLAGS="$CFLAGS -Wno-strict-prototypes"
1607 if [ "$os" = "OPENBSD" ]; then
1608 LIBS="$LIBS -pthread"
1611 if [ "$os" = "OSX" ]; then
1612 LDFLAGS="$LDFLAGS -framework Cocoa"
1614 # Add macports include dir which is not always set a default system dir. This avoids zillions of bogus warnings.
1615 CFLAGS="$CFLAGS -isystem/opt/local/include"
1617 if [ "$enable_dedicated" = "0" ] && ([ "$cpu_type" = "32" ] || [ "$enable_universal" != "0" ]); then
1618 LIBS="$LIBS -framework QuickTime"
1620 CFLAGS="$CFLAGS -DNO_QUICKTIME"
1623 if [ "$enable_universal" = "0" ]; then
1624 # Universal builds set this elsewhere
1625 CFLAGS="$OSX_SYSROOT $CFLAGS"
1626 LDFLAGS="$OSX_LD_SYSROOT $LDFLAGS"
1630 if [ "$os" = "BEOS" ] || [ "$os" = "HAIKU" ]; then
1631 LIBS="$LIBS -lmidi -lbe"
1634 # Most targets act like UNIX, just with some additions
1635 if [ "$os" = "BEOS" ] || [ "$os" = "HAIKU" ] || [ "$os" = "OSX" ] || [ "$os" = "MORPHOS" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "DRAGONFLY" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ] || [ "$os" = "OS2" ]; then
1636 CFLAGS="$CFLAGS -DUNIX"
1638 # And others like Windows
1639 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
1640 CFLAGS="$CFLAGS -DWIN"
1643 if [ -n "$allegro_config" ]; then
1644 CFLAGS="$CFLAGS -DWITH_ALLEGRO"
1645 CFLAGS="$CFLAGS `$allegro_config --cflags`"
1646 if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then
1647 if [ "$enable_static" != "0" ]; then
1648 LIBS="$LIBS `$allegro_config --static --libs`"
1650 LIBS="$LIBS `$allegro_config --libs`"
1655 if [ -n "$sdl_config" ]; then
1656 CFLAGS="$CFLAGS -DWITH_SDL"
1657 # SDL must not add _GNU_SOURCE as it breaks many platforms
1658 CFLAGS="$CFLAGS `$sdl_config --cflags | sed 's@-D_GNU_SOURCE[^ ]*@@'`"
1659 if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then
1660 if [ "$enable_static" != "0" ]; then
1661 LIBS="$LIBS `$sdl_config --static-libs`"
1663 LIBS="$LIBS `$sdl_config --libs`"
1668 if [ "$with_cocoa" != "0" ]; then
1669 CFLAGS="$CFLAGS -DWITH_COCOA"
1670 LIBS="$LIBS -F/System/Library/Frameworks -framework Cocoa -framework Carbon -framework AudioUnit -framework AudioToolbox"
1672 if [ "$enable_cocoa_quartz" != "0" ]; then
1673 CFLAGS="$CFLAGS -DENABLE_COCOA_QUARTZ"
1676 if [ "$enable_cocoa_quickdraw" != "0" ]; then
1677 CFLAGS="$CFLAGS -DENABLE_COCOA_QUICKDRAW"
1681 if [ "$with_zlib" != "0" ]; then
1682 CFLAGS="$CFLAGS -DWITH_ZLIB"
1683 CFLAGS="$CFLAGS `$zlib_config --cflags | tr '\n\r' ' '`"
1684 if [ "$enable_static" != "0" ]; then
1685 LIBS="$LIBS `$zlib_config --libs --static | tr '\n\r' ' '`"
1687 LIBS="$LIBS `$zlib_config --libs | tr '\n\r' ' '`"
1691 if [ -n "$lzma_config" ]; then
1692 CFLAGS="$CFLAGS -DWITH_LZMA"
1693 CFLAGS="$CFLAGS `$lzma_config --cflags | tr '\n\r' ' '`"
1695 if [ "$enable_static" != "0" ]; then
1696 CFLAGS="$CFLAGS -DLZMA_API_STATIC"
1697 LIBS="$LIBS `$lzma_config --libs --static | tr '\n\r' ' '`"
1699 LIBS="$LIBS `$lzma_config --libs | tr '\n\r' ' '`"
1703 if [ "$with_lzo2" != "0" ]; then
1704 if [ "$enable_static" != "0" ] && [ "$os" != "OSX" ]; then
1709 CFLAGS="$CFLAGS -DWITH_LZO"
1712 if [ -n "$xdg_basedir_config" ]; then
1713 CFLAGS="$CFLAGS -DWITH_XDG_BASEDIR"
1714 CFLAGS="$CFLAGS `$xdg_basedir_config --cflags | tr '\n\r' ' '`"
1716 if [ "$enable_static" != "0" ]; then
1717 LIBS="$LIBS `$xdg_basedir_config --libs --static | tr '\n\r' ' '`"
1719 LIBS="$LIBS `$xdg_basedir_config --libs | tr '\n\r' ' '`"
1723 # 64bit machines need -D_SQ64
1724 if [ "$cpu_type" = "64" ] && [ "$enable_universal" = "0" ]; then
1725 CFLAGS="$CFLAGS -D_SQ64"
1727 CFLAGS="$CFLAGS -I$SCRIPT_SRC_DIR"
1729 if [ -n "$png_config" ]; then
1730 CFLAGS="$CFLAGS -DWITH_PNG"
1731 CFLAGS="$CFLAGS `$png_config --cflags | tr '\n\r' ' '`"
1733 if [ "$enable_static" != "0" ]; then
1734 LIBS="$LIBS `$png_config --libs --static | tr '\n\r' ' '`"
1736 LIBS="$LIBS `$png_config --libs | tr '\n\r' ' '`"
1740 if [ -n "$fontconfig_config" ]; then
1741 CFLAGS="$CFLAGS -DWITH_FONTCONFIG"
1742 CFLAGS="$CFLAGS `$fontconfig_config --cflags | tr '\n\r' ' '`"
1744 if [ "$enable_static" != "0" ]; then
1745 LIBS="$LIBS `$fontconfig_config --libs --static | tr '\n\r' ' '`"
1747 LIBS="$LIBS `$fontconfig_config --libs | tr '\n\r' ' '`"
1751 if [ -n "$freetype_config" ]; then
1752 CFLAGS="$CFLAGS -DWITH_FREETYPE"
1753 CFLAGS="$CFLAGS `$freetype_config --cflags | tr '\n\r' ' '`"
1755 if [ "$enable_static" != "0" ]; then
1756 LIBS="$LIBS `$freetype_config --libs --static | tr '\n\r' ' '`"
1758 LIBS="$LIBS `$freetype_config --libs | tr '\n\r' ' '`"
1762 if [ -n "$icu_layout_config" ]; then
1763 CFLAGS="$CFLAGS -DWITH_ICU_LAYOUT"
1764 CFLAGS="$CFLAGS `$icu_layout_config --cflags | tr '\n\r' ' '`"
1766 if [ "$static_icu" != "0" ]; then
1767 LIBS="$LIBS `$icu_layout_config --libs --static | tr '\n\r' ' ' | sed s/-licu/-lsicu/g`"
1769 LIBS="$LIBS `$icu_layout_config --libs | tr '\n\r' ' '`"
1773 if [ -n "$icu_sort_config" ]; then
1774 CFLAGS="$CFLAGS -DWITH_ICU_SORT"
1775 CFLAGS="$CFLAGS `$icu_sort_config --cflags | tr '\n\r' ' '`"
1777 if [ "$static_icu" != "0" ]; then
1778 LIBS="$LIBS `$icu_sort_config --libs --static | tr '\n\r' ' ' | sed s/-licu/-lsicu/g`"
1780 LIBS="$LIBS `$icu_sort_config --libs | tr '\n\r' ' '`"
1785 if [ "$with_direct_music" != "0" ]; then
1786 CFLAGS="$CFLAGS -DWIN32_ENABLE_DIRECTMUSIC_SUPPORT"
1787 # GCC 4.0+ doesn't like the DirectX includes (gives tons of
1788 # warnings on it we won't be able to fix). For now just
1789 # suppress those warnings.
1790 if [ $cc_version -ge 400 ]; then
1791 CFLAGS="$CFLAGS -Wno-non-virtual-dtor"
1795 if [ "$with_xaudio2" != "0" ]; then
1796 CFLAGS="$CFLAGS -DWITH_XAUDIO2"
1799 if [ -n "$libtimidity_config" ]; then
1800 CFLAGS="$CFLAGS -DLIBTIMIDITY"
1801 CFLAGS="$CFLAGS `$libtimidity_config --cflags | tr '\n\r' ' '`"
1803 if [ "$enable_static" != "0" ]; then
1804 LIBS="$LIBS `$libtimidity_config --libs --static | tr '\n\r' ' '`"
1806 LIBS="$LIBS `$libtimidity_config --libs | tr '\n\r' ' '`"
1810 if [ "$with_iconv" != "0" ]; then
1811 CFLAGS="$CFLAGS -DWITH_ICONV"
1812 if [ "$link_to_iconv" = "yes" ]; then
1813 LIBS="$LIBS -liconv"
1814 if [ "$with_iconv" != "2" ]; then
1815 CFLAGS="$CFLAGS -I$with_iconv/include"
1816 LIBS="$LIBS -L$with_iconv/lib"
1820 if [ "$os" != "OSX" ] && [ "$have_non_const_iconv" != "no" ]; then
1821 CFLAGS="$CFLAGS -DHAVE_NON_CONST_ICONV"
1825 if [ -n "$with_midi" ]; then
1826 CFLAGS="$CFLAGS -DEXTERNAL_PLAYER=\\\\\"$with_midi\\\\\""
1828 if [ -n "$with_midi_arg" ]; then
1829 CFLAGS="$CFLAGS -DMIDI_ARG=\\\\\"$with_midi_arg\\\\\""
1832 if [ "$enable_dedicated" != "0" ]; then
1833 CFLAGS="$CFLAGS -DDEDICATED"
1836 if [ "$enable_unicode" != "0" ]; then
1837 CFLAGS="$CFLAGS -DUNICODE -D_UNICODE"
1840 if [ "$enable_network" != "0" ]; then
1841 CFLAGS="$CFLAGS -DENABLE_NETWORK"
1843 if [ "$os" = "BEOS" ]; then
1844 LDFLAGS="$LDFLAGS -lbind -lsocket"
1847 if [ "$os" = "HAIKU" ]; then
1848 LDFLAGS="$LDFLAGS -lnetwork"
1851 if [ "$os" = "SUNOS" ]; then
1852 LDFLAGS="$LDFLAGS -lnsl -lsocket"
1856 if [ "$enable_static" != "0" ]; then
1857 # OSX can't handle -static in LDFLAGS
1858 if [ "$os" != "OSX" ]; then
1859 LDFLAGS="$LDFLAGS -static"
1863 if [ "$enable_assert" = "0" ]; then
1864 CFLAGS="$CFLAGS -DNDEBUG"
1865 CFLAGS_BUILD="$CFLAGS_BUILD -DNDEBUG"
1868 if [ "$enable_desync_debug" != "0" ]; then
1869 CFLAGS="$CFLAGS -DRANDOM_DEBUG"
1872 if [ "$enable_osx_g5" != "0" ]; then
1873 CFLAGS="$CFLAGS -mcpu=G5 -mpowerpc64 -mtune=970 -mcpu=970 -mpowerpc-gpopt"
1876 if [ -n "$personal_dir" ]; then
1877 CFLAGS="$CFLAGS -DWITH_PERSONAL_DIR -DPERSONAL_DIR=\\\\\"$personal_dir\\\\\""
1880 if [ -n "$shared_dir" ]; then
1881 CFLAGS="$CFLAGS -DWITH_SHARED_DIR -DSHARED_DIR=\\\\\"$shared_dir\\\\\""
1884 CFLAGS="$CFLAGS -DGLOBAL_DATA_DIR=\\\\\"$prefix_dir/$data_dir\\\\\""
1886 if [ "$enable_lto" != "0" ]; then
1887 lto_build=`echo "$FEATURES_BUILD" | grep "lto"`
1888 lto_host=`echo "$FEATURES" | grep "lto"`
1889 if [ -z "$lto_build$lto_host" ]; then
1890 log 1 "WARNING: you enabled LTO/IPO, but neither build nor host compiler supports it"
1891 log 1 "WARNING: LTO/IPO has been disabled"
1893 if [ -n "$lto_build" ]; then
1894 LDFLAGS_BUILD="$LDFLAGS_BUILD $CFLAGS_BUILD $CXXFLAGS_BUILD"
1896 if [ -n "$lto_host" ]; then
1897 LDFLAGS="$LDFLAGS $CFLAGS $CXXFLAGS"
1901 # All flags to be extended via the env
1902 CFLAGS_BUILD="$CFLAGS_BUILD $CFLAGS_BUILD_ENV"
1903 CXXFLAGS_BUILD="$CXXFLAGS_BUILD $CXXFLAGS_BUILD_ENV"
1904 LDFLAGS_BUILD="$LDFLAGS_BUILD $LDFLAGS_BUILD_ENV"
1905 CFLAGS="$CFLAGS $CFLAGS_ENV"
1906 CXXFLAGS="$CXXFLAGS $CXXFLAGS_ENV"
1907 LDFLAGS="$LDFLAGS $LDFLAGS_ENV"
1909 log 1 "using CFLAGS_BUILD... $CFLAGS_BUILD"
1910 log 1 "using CXXFLAGS_BUILD... $CXXFLAGS_BUILD"
1911 log 1 "using LDFLAGS_BUILD... $LDFLAGS_BUILD"
1912 log 1 "using CFLAGS... $CFLAGS"
1913 log 1 "using CXXFLAGS... $CXXFLAGS"
1914 log 1 "using LDFLAGS... $LIBS $LDFLAGS"
1916 # Makedepend doesn't like something like: -isysroot /OSX/blabla
1917 # so convert it to: -isysroot -OSX/blabla. makedepend just ignores
1918 # any - command it doesn't know, so we are pretty save.
1919 # Lovely hackish, not?
1920 # Btw, this almost always comes from outside the configure, so it is
1921 # not something we can control.
1922 # Also make makedepend aware of compiler's built-in defines.
1923 if [ "$with_makedepend" != "0" ] || [ "$enable_builtin_depend" != "0" ]; then
1924 # Append CXXFLAGS possibly containing -std=c++0x
1925 cflags_makedep="`echo | $cxx_host $CXXFLAGS -E -x c++ -dM - | sed 's@.define @-D@g;s@ .*@ @g;s@(.*)@@g' | tr -d '\r\n'`"
1927 # Please escape ALL " within ` because e.g. "" terminates the string in some sh implementations
1928 cflags_makedep="$cflags_makedep `echo \"$CFLAGS\" \"$CXXFLAGS\" | sed 's@ /@ -@g;s@-I[ ]*[^ ]*@@g'`"
1933 if [ "$with_distcc" != "0" ]; then
1934 cc_host="$distcc $cc_host"
1935 cxx_host="$distcc $cxx_host"
1937 log 1 " NOTICE: remind yourself to use 'make -jN' to make use of distcc"
1941 if [ "$with_ccache" != "0" ]; then
1942 cc_host="$ccache $cc_host"
1943 cxx_host="$ccache $cxx_host"
1949 # $1 - Type for message (build / host)
1950 # $2 - What to fill with the found compiler
1951 # $3 - System to try
1952 # $4 - Compiler to try
1953 # $5 - Env-setting to try
1954 # $6 - GCC alike to try
1955 # $7 - CC alike to try
1956 # $8 - "0" gcc, "1" g++, "2" windres, "3" strip, "4" lipo
1957 # $9 - What the command is to check for
1959 if [ -n "$4" ]; then
1960 # Check for manual compiler
1961 machine=`$4 $9 2>/dev/null`
1965 log 2 "executing $4 $9"
1966 log 2 " returned $machine"
1967 log 2 " exit code $ret"
1969 if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ]; then
1970 log 1 "checking $1... $4 not found"
1971 log 1 "the selected binary doesn't seem to be a $6 binary"
1974 elif [ -n "$3" ]; then
1976 if [ -z "$6" ]; then
1981 machine=`eval $compiler $9 2>/dev/null`
1983 eval "$2=\"$compiler\""
1985 log 2 "executing $compiler $9"
1986 log 2 " returned $machine"
1987 log 2 " exit code $ret"
1989 if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ]; then
1990 if [ -z "$5" ]; then
1991 log 1 "checking $1... $compiler not found"
1992 log 1 "I couldn't detect any $6 binary for $3"
1997 machine=`eval $compiler $9 2>/dev/null`
1999 eval "$2=\"$compiler\""
2001 log 2 "executing $compiler $9"
2002 log 2 " returned $machine"
2003 log 2 " exit code $ret"
2005 if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ]; then
2006 log 1 "checking $1... $compiler not found"
2007 log 1 "I couldn't detect any $5 binary for $3"
2012 if [ "$machine" != "$3" ] && ( [ "$8" = "0" ] || [ "$8" = "1" ] ); then
2013 log 1 "checking $1... expected $3, found $machine"
2014 log 1 "the compiler suggests it doesn't build code for the machine you specified"
2018 # Nothing given, autodetect
2020 if [ -n "$5" ]; then
2021 machine=`$5 $9 2>/dev/null`
2025 log 2 "executing $5 $9"
2026 log 2 " returned $machine"
2027 log 2 " exit code $ret"
2029 # The user defined a GCC that doesn't reply to $9.. abort
2030 if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ]; then
2031 log 1 "checking $1... $5 unusable"
2032 log 1 "the CC environment variable is set, but it doesn't seem to be a $6 binary"
2033 log 1 "please redefine the CC/CXX environment to a $6 binary"
2037 log 2 "checking $1... CC/CXX not set (skipping)"
2039 # No $5, so try '$6'
2040 machine=`$6 $9 2>/dev/null`
2044 log 2 "executing $6 $9"
2045 log 2 " returned $machine"
2046 log 2 " exit code $ret"
2048 if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ]; then
2050 machine=`$7 $9 2>/dev/null`
2054 log 2 "executing $7 $9"
2055 log 2 " returned $machine"
2056 log 2 " exit code $ret"
2059 if [ -z "$machine" ]; then
2060 log 1 "checking $1... $6 not found"
2061 log 1 "I couldn't detect any $6 binary on your system"
2062 log 1 "please define the CC/CXX environment to where it is located"
2070 if [ "$8" != "0" ]; then
2072 log 1 "checking $1... $res"
2074 log 1 "checking $1... $machine"
2079 check_compiler "build system type" "cc_build" "$build" "$cc_build" "$CC" "gcc" "cc" "0" "-dumpmachine"
2083 # By default the host is the build
2084 if [ -z "$host" ]; then host="$build"; fi
2085 check_compiler "host system type" "cc_host" "$host" "$cc_host" "$CC" "gcc" "cc" "0" "-dumpmachine"
2089 check_compiler "build c++" "cxx_build" "$build" "$cxx_build" "$CXX" "g++" "c++" 1 "-dumpmachine"
2093 # By default the host is the build
2094 if [ -z "$host" ]; then host="$build"; fi
2095 check_compiler "host c++" "cxx_host" "$host" "$cxx_host" "$CXX" "g++" "c++" 1 "-dumpmachine"
2099 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
2100 check_compiler "host windres" "windres" "$host" "$windres" "$WINDRES" "windres" "windres" "2" "-V"
2105 if [ "$os" = "OS2" ]; then
2106 # OS2 via gcc is a bit weird.. stripping HAS to be done via emxbind, which is via gcc directly
2107 log 1 "checking host strip... using gcc -s option"
2108 elif [ "$os" = "OSX" ]; then
2109 # Most targets have -V in strip, to see if they exists... OSX doesn't.. so execute something
2110 echo "int main(int argc, char *argv[]) { }" > strip.test.c
2111 $cxx_host strip.test.c -o strip.test
2112 check_compiler "host strip" "strip" "$host" "$strip" "$STRIP" "strip" "strip" "3" "strip.test"
2113 rm -f strip.test.c strip.test
2115 check_compiler "host strip" "strip" "$host" "$strip" "$STRIP" "strip" "strip" "3" "-V"
2120 if [ "$os" = "OSX" ] && [ "$enable_universal" != "0" ]; then
2121 echo "int main(int argc, char *argv[]) { }" > lipo.test.c
2122 $cxx_host lipo.test.c -o lipo.test
2123 check_compiler "host lipo" "lipo" "$host" "$lipo" "$LIPO" "lipo" "lipo" "4" "-info lipo.test"
2124 rm -f lipo.test.c lipo.test
2130 if [ -n "$1" ]; then
2131 if echo "$1" | grep -q / ; then
2132 # Seems to be a file system path
2135 osx_sdk_path="/Developer/SDKs/MacOSX$1.sdk"
2137 if [ ! -d "$osx_sdk_path" ]; then
2138 # No directory, not present or garbage
2142 # Set minimum version to 10.4 as that's when kCGBitmapByteOrder32Host was introduced
2143 sysroot="-isysroot $osx_sdk_path -Wl,-syslibroot,$osx_sdk_path -mmacosx-version-min=10.4"
2146 cat > tmp.osx.mm << EOF
2147 #include <Cocoa/Cocoa.h>
2149 kCGBitmapByteOrder32Host;
2153 execute="$cxx_host $sysroot $CFLAGS tmp.osx.mm -framework Cocoa -o tmp.osx 2>&1"
2154 eval $execute > /dev/null
2156 log 2 "executing $execute"
2157 log 2 " exit code $ret"
2158 rm -f tmp.osx.mm tmp.osx
2162 check_direct_music() {
2164 #include <windows.h>
2165 #include <dmksctrl.h>
2166 #include <dmusici.h>
2167 #include <dmusicc.h>
2168 #include <dmusicf.h>
2169 int main(int argc, char *argv[]) { }" > direct_music.test.c
2170 $cxx_host $CFLAGS direct_music.test.c -o direct_music.test 2> /dev/null
2172 rm -f direct_music.test.c direct_music.test
2174 if [ "$res" != "0" ]; then
2175 if [ "$with_direct_music" != "1" ]; then
2176 log 1 "configure: error: direct-music is not available on this system"
2179 with_direct_music="0"
2181 log 1 "checking direct-music... not found"
2183 log 1 "checking direct-music... found"
2189 #include <windows.h>
2191 #undef NTDDI_VERSION
2194 #define NTDDI_VERSION NTDDI_WIN8
2195 #define _WIN32_WINNT _WIN32_WINNT_WIN8
2197 #include <xaudio2.h>
2198 int main(int argc, char *argv[]) { }" > xaudio2.test.c
2199 $cxx_host $CFLAGS xaudio2.test.c -o xaudio2.test 2> /dev/null
2201 rm -f xaudio2.test.c xaudio2.test
2203 if [ "$res" != "0" ]; then
2204 if [ "$with_xaudio2" != "1" ]; then
2205 log 1 "configure: error: xaudio2 is not available on this system"
2210 log 1 "checking xaudio2... not found"
2212 log 1 "checking xaudio2... found"
2216 check_makedepend() {
2217 if [ "$enable_builtin_depend" != "0" ]; then
2221 if [ "$with_makedepend" = "0" ]; then
2222 log 1 "checking makedepend... disabled"
2226 if [ "$with_makedepend" = "1" ] || [ "$with_makedepend" = "2" ]; then
2227 makedepend="makedepend"
2229 makedepend="$with_makedepend"
2232 rm -f makedepend.tmp
2233 touch makedepend.tmp
2234 res=`$makedepend -fmakedepend.tmp 2>/dev/null`
2236 log 2 "executing $makedepend -f makedepend.tmp"
2237 log 2 " returned `cat makedepend.tmp`"
2238 log 2 " exit code $ret"
2240 if [ ! -s makedepend.tmp ]; then
2241 rm -f makedepend.tmp makedepend.tmp.bak
2243 if [ "$with_makedepend" = "2" ]; then
2244 log 1 "checking makedepend... not found"
2246 log 1 "I couldn't detect any makedepend on your system"
2247 log 1 "please locate it via --makedepend=[binary]"
2250 elif [ "$with_makedepend" != "1" ]; then
2251 log 1 "checking makedepend... $makedepend not found"
2253 log 1 "the selected file doesn't seem to be a valid makedepend binary"
2257 log 1 "checking makedepend... not found"
2264 rm -f makedepend.tmp makedepend.tmp.bak
2266 log 1 "checking makedepend... $makedepend"
2270 # $1 - requested version (major.minor)
2271 # $2 - version we got (major.minor)
2273 if [ -z "$2" ]; then
2277 req_major=`echo $1 | cut -d. -f1`
2278 got_major=`echo $2 | cut -d. -f1`
2279 if [ $got_major -lt $req_major ]; then
2281 elif [ $got_major -gt $req_major ]; then
2285 req_minor=`echo $1 | cut -d. -f2`
2286 got_minor=`echo $2 | cut -d. -f2`
2287 if [ $got_minor -lt $req_minor ]; then
2294 # Not all awks allow gsub(), so we test for that here! It is in fact all we need...
2296 # These awks are known to work. Test for them explicit
2297 awks="gawk mawk nawk"
2299 awk_prefix="echo \"a.c b.c c.c\" | tr ' ' \\\\n | "
2300 awk_param="' { ORS = \" \" } /\.c$/ { gsub(\".c$\", \".o\", \$0); print \$0; }' 2>/dev/null"
2301 awk_result="a.o b.o c.o "
2302 log 2 "Detecing awk..."
2304 log 2 "Trying: $awk_prefix $awk $awk_param"
2305 res=`eval $awk_prefix $awk $awk_param`
2306 log 2 "Result: '$res'"
2307 if [ "$res" != "$awk_result" ] && [ "$awk" = "awk" ]; then
2308 # User didn't supply his own awk, so try to detect some other known working names for an awk
2309 for awk in $awks; do
2310 log 2 "Trying: $awk_prefix $awk $awk_param"
2311 res=`eval $awk_prefix $awk $awk_param`
2312 log 2 "Result: '$res'"
2313 if [ "$res" = "$awk_result" ]; then break; fi
2316 if [ "$res" != "$awk_result" ]; then
2317 log 1 "checking awk... not found"
2318 log 1 "configure: error: no awk found"
2319 log 1 "configure: error: please install one of the following: $awks"
2323 if [ "$res" != "$awk_result" ]; then
2324 log 1 "checking awk... not found"
2325 log 1 "configure: error: you supplied '$awk' but it doesn't seem a valid gawk or mawk"
2329 log 1 "checking awk... $awk"
2333 if [ "$os" = "DETECT" ]; then
2334 # Detect UNIX, OSX, FREEBSD, DRAGONFLY, OPENBSD, NETBSD, HPUX, MORPHOS, BEOS, SUNOS, CYGWIN, MINGW, OS2, and DOS
2336 # Try first via dumpmachine, then via uname
2337 os=`echo "$host" | tr '[A-Z]' '[a-z]' | $awk '
2338 /linux/ { print "UNIX"; exit}
2339 /darwin/ { print "OSX"; exit}
2340 /freebsd/ { print "FREEBSD"; exit}
2341 /dragonfly/ { print "DRAGONFLY"; exit}
2342 /openbsd/ { print "OPENBSD"; exit}
2343 /netbsd/ { print "NETBSD"; exit}
2344 /hp-ux/ { print "HPUX"; exit}
2345 /morphos/ { print "MORPHOS"; exit}
2346 /beos/ { print "BEOS"; exit}
2347 /haiku/ { print "HAIKU"; exit}
2348 /sunos/ { print "SUNOS"; exit}
2349 /solaris/ { print "SUNOS"; exit}
2350 /cygwin/ { print "CYGWIN"; exit}
2351 /mingw/ { print "MINGW"; exit}
2352 /os2/ { print "OS2"; exit}
2353 /dos/ { print "DOS"; exit}
2356 if [ -z "$os" ]; then
2357 os=`LC_ALL=C uname | tr '[A-Z]' '[a-z]' | $awk '
2358 /linux/ { print "UNIX"; exit}
2359 /darwin/ { print "OSX"; exit}
2360 /freebsd/ { print "FREEBSD"; exit}
2361 /dragonfly/ { print "DRAGONFLY"; exit}
2362 /openbsd/ { print "OPENBSD"; exit}
2363 /netbsd/ { print "NETBSD"; exit}
2364 /hp-ux/ { print "HPUX"; exit}
2365 /morphos/ { print "MORPHOS"; exit}
2366 /beos/ { print "BEOS"; exit}
2367 /haiku/ { print "HAIKU"; exit}
2368 /sunos/ { print "SUNOS"; exit}
2369 /cygwin/ { print "CYGWIN"; exit}
2370 /mingw/ { print "MINGW"; exit}
2371 /os\/2/ { print "OS2"; exit}
2372 /gnu/ { print "UNIX"; exit}
2376 if [ -z "$os" ]; then
2377 log 1 "detecting OS... none detected"
2378 log 1 "I couldn't detect your OS. Please use --os=OS to force one"
2379 log 1 "Allowed values are: UNIX, OSX, FREEBSD, DRAGONFLY, OPENBSD, NETBSD, MORPHOS, HPUX, BEOS, HAIKU, SUNOS, CYGWIN, MINGW, OS2, and DOS"
2383 log 1 "detecting OS... $os"
2385 log 1 "forcing OS... $os"
2390 # 0 means no, 1 is auto-detect, 2 is force
2391 if [ "$with_allegro" = "0" ]; then
2392 log 1 "checking Allegro... disabled"
2398 if [ "$with_allegro" = "2" ] && [ "$with_cocoa" = "2" ]; then
2399 log 1 "configure: error: it is impossible to compile both Allegro and COCOA"
2400 log 1 "configure: error: please deselect one of them and try again"
2404 if [ "$with_allegro" = "2" ] && [ "$enable_dedicated" != "0" ]; then
2405 log 1 "configure: error: it is impossible to compile a dedicated with Allegro"
2406 log 1 "configure: error: please deselect one of them and try again"
2410 if [ "$enable_dedicated" != "0" ]; then
2411 log 1 "checking Allegro... dedicated server, skipping"
2417 # By default on OSX we don't use Allegro. The rest is auto-detect
2418 if [ "$with_allegro" = "1" ] && [ "$os" = "OSX" ] && [ "$with_cocoa" != "0" ]; then
2419 log 1 "checking Allegro... OSX, skipping"
2425 detect_pkg_config "$with_allegro" "allegro" "allegro_config" "4.4"
2430 # 0 means no, 1 is auto-detect, 2 is force
2431 if [ "$with_sdl" = "0" ]; then
2432 log 1 "checking SDL... disabled"
2438 if [ "$with_sdl" = "2" ] && [ "$with_cocoa" = "2" ]; then
2439 log 1 "configure: error: it is impossible to compile both SDL and COCOA"
2440 log 1 "configure: error: please deselect one of them and try again"
2444 if [ "$with_sdl" = "2" ] && [ "$enable_dedicated" != "0" ]; then
2445 log 1 "configure: error: it is impossible to compile a dedicated with SDL"
2446 log 1 "configure: error: please deselect one of them and try again"
2450 if [ "$enable_dedicated" != "0" ]; then
2451 log 1 "checking SDL... dedicated server, skipping"
2457 # By default on OSX we don't use SDL. The rest is auto-detect
2458 if [ "$with_sdl" = "1" ] && [ "$os" = "OSX" ] && [ "$with_cocoa" != "0" ]; then
2459 log 1 "checking SDL... OSX, skipping"
2465 if [ "$os" = "OSX" ]; then
2466 log 1 "WARNING: sdl is known to fail on some versions of Mac OS X"
2467 log 1 "WARNING: with some hardware configurations. Use at own risk!"
2471 detect_pkg_config "$with_sdl" "sdl" "sdl_config" "1.2"
2475 # Try to find the best SDK available. For a normal build this
2476 # is currently the 10.5 SDK as this is needed to compile all
2477 # optional code. Because such an executable won't run on 10.4
2478 # or lower, also check for the 10.4u SDK when doing an universal
2481 # Check for the 10.5 SDK, but try 10.6 if that fails
2482 check_osx_sdk "10.5" || check_osx_sdk "10.6" || osx_sdk_path=""
2484 if [ -z "$osx_sdk_path" ] || [ "$enable_universal" != "0" ]; then
2485 # No better SDK or universal build enabled? Check 10.4u SDK as well
2486 local old_sdk="$osx_sdk_path"
2487 if check_osx_sdk "10.4u"; then
2488 osx_sdk_104_path="$osx_sdk_path"
2492 if [ -z "$old_sdk" ]; then
2493 osx_sdk_path="$osx_sdk_104_path"
2495 osx_sdk_path="$old_sdk"
2499 if [ -z "$osx_sdk_path" ]; then
2500 log 1 "Your system SDK is probably too old"
2501 log 1 "Please install/upgrade your Xcode to >= 2.5"
2508 # 0 means no, 1 is auto-detect, 2 is force
2509 if [ "$with_cocoa" = "0" ]; then
2510 log 1 "checking COCOA... disabled"
2515 if [ "$with_cocoa" = "2" ] && [ "$enable_dedicated" != "0" ]; then
2516 log 1 "configure: error: it is impossible to compile a dedicated with COCOA"
2517 log 1 "configure: error: please deselect one of them and try again"
2521 if [ "$enable_dedicated" != "0" ]; then
2522 log 1 "checking COCOA... dedicated server, skipping"
2528 # By default on OSX we use COCOA. The rest doesn't support it
2529 if [ "$with_cocoa" = "1" ] && [ "$os" != "OSX" ]; then
2530 log 1 "checking COCOA... not OSX, skipping"
2536 if [ "$os" != "OSX" ]; then
2537 log 1 "checking COCOA... not OSX"
2539 log 1 "configure: error: COCOA video driver is only supported for OSX"
2543 log 1 "checking COCOA... found"
2546 if [ "$enable_cocoa_quartz" != "0" ]; then
2547 log 1 "checking whether to enable the Quartz window subdriver... yes"
2549 log 1 "checking whether to enable the Quartz window subdriver... no"
2555 detect_quickdraw() {
2556 # 0 means no, 1 is auto-detect, 2 is force
2557 if [ "$enable_cocoa_quickdraw" = "0" ]; then
2558 log 1 "checking Quickdraw window subdriver... disabled"
2562 # Assume QuickDraw is available when doing an universal build
2563 if [ "$enable_universal" != "0" ]; then
2564 log 1 "checking Quickdraw window subdriver... found"
2568 # 64 bits doesn't have quickdraw
2569 if [ "$cpu_type" = "64" ]; then
2570 enable_cocoa_quickdraw="0"
2571 log 1 "checking Quickdraw window subdriver... disabled (64 bits)"
2575 cat > tmp.osx.mm << EOF
2576 #include <AvailabilityMacros.h>
2577 #import <Cocoa/Cocoa.h>
2578 int main(int argc, char *argv[]) { SetEmptyRgn(NULL); return 0; }
2580 execute="$cxx_host $OSX_SYSROOT $OSX_LD_SYSROOT $CFLAGS -mmacosx-version-min=10.3 tmp.osx.mm -framework Cocoa -o tmp.osx 2>&1"
2581 eval $execute > /dev/null
2583 log 2 "executing $execute"
2584 log 2 " exit code $ret"
2585 rm -f tmp.osx.mm tmp.osx
2586 if [ "$ret" != "0" ]; then
2587 log 1 "checking Quickdraw window subdriver... not found"
2589 # It was forced, so it should be found.
2590 if [ "$enable_cocoa_quickdraw" != "1" ]; then
2591 log 1 "configure: error: Quickdraw window driver could not be found"
2595 enable_cocoa_quickdraw=0
2599 enable_cocoa_quickdraw=1
2600 log 1 "checking Quickdraw window subdriver... found"
2604 # $1 - config-param ($with_zlib value)
2605 # $2 - library name ('zlib', sets $zlib)
2606 # $3 - static library name (libz.a)
2607 # $4 - header directory ()
2608 # $5 - header name (zlib.h)
2609 # $6 - force static (if non-empty)
2611 if [ -n "$6" ]; then force_static="1"; fi
2613 # 0 means no, 1 is auto-detect, 2 is force
2614 if [ "$1" = "0" ]; then
2615 log 1 "checking $2... disabled"
2621 log 2 "detecting $2"
2623 if [ "$1" = "1" ] || [ "$1" = "" ] || [ "$1" = "2" ]; then
2624 eval "$2=`ls -1 /usr/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2626 if [ -z "$res" ]; then
2627 log 2 " trying /usr/include/$4$5... no"
2628 eval "$2=`ls -1 /usr/local/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2631 if [ -z "$res" ]; then
2632 log 2 " trying /usr/local/include/$4$5... no"
2633 eval "$2=`ls -1 /mingw/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2636 if [ -z "$res" ]; then
2637 log 2 " trying /mingw/include/$4$5... no"
2638 eval "$2=`ls -1 /opt/local/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2641 if [ -z "$res" ]; then
2642 log 2 " trying /opt/local/include/$4$5... no"
2644 if [ -z "$res" ] && [ "$os" = "NETBSD" ]; then
2645 eval "$2=`ls -1 /usr/pkg/include/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2647 if [ -z "$res" ]; then
2648 log 2 " trying /usr/pkg/include/$4$5... no"
2651 if [ -z "$res" ] && [ "$os" = "HAIKU" ]; then
2652 if [ -z "$includeDir" ]; then
2653 includeDir=`finddir B_SYSTEM_HEADERS_DIRECTORY`
2655 eval "$2=`ls -1 $includeDir/$4*.h 2>/dev/null | egrep \"\/$5\$\"`"
2657 if [ -z "$res" ]; then
2658 log 2 " trying $includeDir/$4$5... no"
2663 if [ -n "$res" ] && ( [ -n "$force_static" ] || ( [ "$enable_static" != "0" ] && [ "$os" != "OSX" ] ) ); then
2665 log 2 " trying $res... found"
2666 # Now find the static lib, if needed
2667 eval "$2=`ls /lib/*.a 2>/dev/null | egrep \"\/$3\$\"`"
2669 if [ -z "$res" ]; then
2670 log 2 " trying /lib/$3... no"
2671 eval "$2=`ls /usr/lib/*.a 2>/dev/null | egrep \"\/$3\$\"`"
2674 if [ -z "$res" ]; then
2675 log 2 " trying /usr/lib/$3... no"
2676 eval "$2=`ls /usr/local/lib/*.a 2>/dev/null | egrep \"\/$3\$\"`"
2679 if [ -z "$res" ]; then
2680 log 2 " trying /usr/local/lib/$3... no"
2681 eval "$2=`ls /mingw/lib/*.a 2>/dev/null | egrep \"\/$3\$\"`"
2684 if [ -z "$res" ]; then
2685 log 2 " trying /mingw/lib/$3... no"
2686 log 1 "configure: error: $2 couldn't be found"
2687 log 1 "configure: error: you requested a static link, but I can't find $3"
2693 # Make sure it exists
2694 if [ -f "$1" ]; then
2695 eval "$2=`ls $1 2>/dev/null`"
2697 eval "$2=`ls $1/$3 2>/dev/null`"
2702 if [ -z "$res" ]; then
2703 log 1 "checking $2... not found"
2704 if [ "$1" = "2" ]; then
2705 log 1 "configure: error: $2 couldn't be found"
2708 elif [ "$1" != "1" ]; then
2709 log 1 "configure: error: $2 couldn't be found"
2710 log 1 "configure: error: you supplied '$1', but it seems invalid"
2721 log 2 " trying $res... found"
2723 log 1 "checking $2... found"
2727 detect_pkg_config "$with_zlib" "zlib" "zlib_config" "1.2"
2731 detect_library "$with_lzo2" "lzo2" "liblzo2.a" "lzo/" "lzo1x.h"
2734 detect_libtimidity() {
2735 detect_pkg_config "$with_libtimidity" "libtimidity" "libtimidity_config" "0.1" "1"
2738 detect_pkg_config() {
2739 # $1 - config-param ($with_lzma value)
2740 # $2 - package name ('liblzma')
2741 # $3 - config name ('lzma_config', sets $lzma_config)
2742 # $4 - minimum module version ('2.3')
2743 # $5 - check for dedicated, 1 is "skif if dedicated"
2745 # 0 means no, 1 is auto-detect, 2 is force
2746 if [ "$1" = "0" ]; then
2747 log 1 "checking $2... disabled"
2753 if [ "$5" = "1" ] && [ "$1" = "1" ] && [ "$enable_dedicated" != "0" ]; then
2754 log 1 "checking $2... dedicated server, skipping"
2760 log 2 "detecting $2"
2762 if [ "$1" = "1" ] || [ "$1" = "" ] || [ "$1" = "2" ]; then
2763 pkg_config_call="$pkg_config $2"
2765 pkg_config_call="$1"
2768 version=`$pkg_config_call --modversion 2>/dev/null`
2770 check_version "$4" "$version"
2772 log 2 "executing $pkg_config_call --modversion"
2773 log 2 " returned $version"
2774 log 2 " exit code $ret"
2776 if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$version_ok" != "1" ]; then
2777 if [ -n "$version" ] && [ "$version_ok" != "1" ]; then
2778 log 1 "checking $2... needs at least version $4, $2 NOT enabled"
2780 log 1 "checking $2... not found"
2783 # It was forced, so it should be found.
2784 if [ "$1" != "1" ]; then
2785 log 1 "configure: error: $pkg_config $2 couldn't be found"
2786 log 1 "configure: error: you supplied '$1', but it seems invalid"
2794 eval "$3=\"$pkg_config_call\""
2795 log 1 "checking $2... found"
2799 detect_pkg_config "$with_lzma" "liblzma" "lzma_config" "5.0"
2802 detect_xdg_basedir() {
2803 detect_pkg_config "$with_xdg_basedir" "libxdg-basedir" "xdg_basedir_config" "1.2"
2807 detect_pkg_config "$with_png" "libpng" "png_config" "1.2"
2811 detect_pkg_config "$with_freetype" "freetype2" "freetype_config" "2.2" "1"
2814 detect_fontconfig() {
2815 # 0 means no, 1 is auto-detect, 2 is force
2816 if [ "$with_fontconfig" = "0" ]; then
2817 log 1 "checking libfontconfig... disabled"
2819 fontconfig_config=""
2822 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
2823 log 1 "checking libfontconfig... WIN32, skipping"
2824 fontconfig_config=""
2828 if [ "$os" = "OSX" ]; then
2829 log 1 "checking libfontconfig... OSX, skipping"
2830 fontconfig_config=""
2834 detect_pkg_config "$with_fontconfig" "fontconfig" "fontconfig_config" "2.3" "1"
2837 detect_icu_layout() {
2838 detect_pkg_config "$with_icu_layout" "icu-lx" "icu_layout_config" "4.8" "1"
2842 detect_pkg_config "$with_icu_sort" "icu-i18n" "icu_sort_config" "4.8" "1"
2846 # 0 means no, 1 is auto-detect, 2 is force
2847 if [ "$with_iconv" = "0" ]; then
2848 log 1 "checking iconv... disabled"
2853 if [ "$with_iconv" = "1" ] && [ "$os" != "OSX" ]; then
2854 log 1 "checking iconv... not OSX, skipping"
2860 # Try to find iconv.h, seems to only thing to detect iconv with
2862 if [ "$with_iconv" = "1" ] || [ "$with_iconv" = "" ] || [ "$with_iconv" = "2" ]; then
2863 iconv=`ls -1 /usr/include 2>/dev/null | grep "iconv.h"`
2864 if [ -z "$iconv" ]; then
2865 iconv=`ls -1 /usr/local/include 2>/dev/null | grep "iconv.h"`
2868 # Make sure it exists
2869 iconv=`ls $with_iconv/include/iconv.h 2>/dev/null`
2872 if [ -z "$iconv" ]; then
2873 log 1 "checking iconv... not found"
2874 if [ "$with_iconv" = "2" ]; then
2875 log 1 "configure: error: iconv couldn't be found"
2878 elif [ "$with_iconv" != "1" ]; then
2879 log 1 "configure: error: iconv couldn't be found"
2880 log 1 "configure: error: you supplied '$with_iconv', but I couldn't detect iconv in it"
2888 if [ "$with_iconv" = "1" ]; then
2892 log 2 "found iconv in $iconv"
2894 log 1 "checking iconv... found"
2896 # There are different implementations of iconv. The older ones,
2897 # e.g. SUSv2, pass a const pointer, whereas the newer ones, e.g.
2898 # IEEE 1003.1 (2004), pass a non-const pointer.
2900 cat > tmp.iconv.cpp << EOF
2901 #include "src/stdafx.h"
2904 static char buf[1024];
2906 const char *inbuf = "";
2908 size_t outlen = 1023;
2910 return iconv(convd, &inbuf, &inlen, &outbuf, &outlen);
2913 execute="$cxx_host $OSX_SYSROOT $CFLAGS -c tmp.iconv.cpp -o tmp.iconv -DTESTING 2>&1"
2914 eval $execute > /dev/null
2916 log 2 "executing $execute"
2917 log 2 " exit code $ret"
2918 if [ "$ret" = "0" ]; then have_non_const_iconv="no"; else have_non_const_iconv="yes"; fi
2919 log 1 "checking if iconv has non-const inbuf... $have_non_const_iconv"
2921 cat > tmp.iconv.cpp << EOF
2922 #include "src/stdafx.h"
2925 static char buf[1024];
2929 size_t outlen = 1023;
2931 return iconv(convd, &inbuf, &inlen, &outbuf, &outlen);
2934 execute="$cxx_host $OSX_SYSROOT $OSX_LD_SYSROOT $CFLAGS tmp.iconv.cpp -o tmp.iconv -DTESTING 2>&1"
2935 eval $execute > /dev/null
2937 log 2 "executing $execute"
2938 log 2 " exit code $ret"
2939 if [ "$ret" = "0" ]; then link_to_iconv="no"; else link_to_iconv="yes"; fi
2940 log 1 "checking whether to link to iconv... $link_to_iconv"
2941 rm -f tmp.iconv tmp.iconv.cpp
2955 log 2 "running echo <array> | $1"
2957 if [ "`echo \"$sort_test_in\" | $1 2>/dev/null`" = "$sort_test_out" ]; then
2959 log 2 " result was valid"
2961 log 2 " result was invalid"
2966 if [ "$with_sort" = "0" ]; then
2967 log 1 "checking sort... disabled"
2972 if [ "$with_sort" = "1" ] || [ "$with_sort" = "2" ]; then
2974 if [ -z "$sort" ]; then _detect_sort "/sbin/sort"; fi
2975 if [ -z "$sort" ]; then _detect_sort "/usr/sbin/sort"; fi
2976 if [ -z "$sort" ]; then _detect_sort "/usr/local/sbin/sort"; fi
2977 if [ -z "$sort" ]; then _detect_sort "/bin/sort"; fi
2978 if [ -z "$sort" ]; then _detect_sort "/usr/bin/sort"; fi
2979 if [ -z "$sort" ]; then _detect_sort "/usr/local/bin/sort"; fi
2981 _detect_sort "$with_sort"
2984 if [ -z "$sort" ]; then
2985 if [ "$with_sort" = "2" ]; then
2986 log 1 "checking sort... not found"
2988 log 1 "configure: error: couldn't detect sort on your system"
2990 elif [ "$with_sort" != "1" ]; then
2991 log 1 "checking sort... $with_sort not found"
2993 log 1 "configure: error: '$with_sort' doesn't look like a sort to me"
2994 log 1 "configure: error: please verify its location and function and try again"
2998 log 1 "checking sort... not found"
3001 log 1 "checking sort... $sort"
3006 # 0 means no, 1 is auto-detect, 2 is force
3007 if [ "$with_grfcodec" = "0" ]; then
3008 log 1 "checking grfcodec... disabled"
3014 if [ "$with_grfcodec" = "1" ] || [ "$with_grfcodec" = "" ] || [ "$with_grfcodec" = "2" ]; then
3017 grfcodec="$with_grfcodec"
3020 version=`$grfcodec -v 2>/dev/null | $awk '{print $3}' | sed 's/[rM]//g;s/-/0/'`
3022 log 2 "executing grfcodec -v"
3023 log 2 " returned $version"
3024 log 2 " exit code $ret"
3026 if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$version" -lt "985" ]; then
3027 if [ -n "$version" ] && [ "$version" -lt "985" ]; then
3028 log 1 "checking grfcodec... needs at least version 6.0.5 (r985), disabled"
3030 log 1 "checking grfcodec... not found"
3033 # It was forced, so it should be found.
3034 if [ "$with_grfcodec" != "1" ]; then
3035 log 1 "configure: error: grfcodec couldn't be found"
3036 log 1 "configure: error: you supplied '$with_grfcodec', but it seems invalid"
3044 log 1 "checking grfcodec... found"
3048 # 0 means no, 1 is auto-detect, 2 is force
3049 if [ "$with_nforenum" = "0" ]; then
3050 log 1 "checking nforenum... disabled"
3056 if [ "$with_nforenum" = "1" ] || [ "$with_nforenum" = "" ] || [ "$with_nforenum" = "2" ]; then
3059 nforenum="$with_nforenum"
3062 version=`$nforenum -v 2>/dev/null | $awk '{print $3}' | sed 's/[rM]//g;s/-/0/'`
3064 log 2 "executing nforenum -v"
3065 log 2 " returned $version"
3066 log 2 " exit code $ret"
3068 if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$version" -lt "985" ]; then
3069 if [ -n "$version" ] && [ "$version" -lt "985" ]; then
3070 log 1 "checking nforenum... needs at least version 6.0.5 (r985), disabled"
3072 log 1 "checking nforenum... not found"
3075 # It was forced, so it should be found.
3076 if [ "$with_nforenum" != "1" ]; then
3077 log 1 "configure: error: nforenum couldn't be found"
3078 log 1 "configure: error: you supplied '$with_nforenum', but it seems invalid"
3086 log 1 "checking nforenum... found"
3090 if [ -n "$cpu_type" ] && [ "$cpu_type" != "DETECT" ]; then
3091 log 1 "forcing cpu-type... $cpu_type bits"
3094 echo "#define _SQ64 1" > tmp.64bit.cpp
3095 echo "#include \"src/stdafx.h\"" >> tmp.64bit.cpp
3096 echo "assert_compile(sizeof(size_t) == 8);" >> tmp.64bit.cpp
3097 echo "int main() { return 0; }" >> tmp.64bit.cpp
3098 execute="$cxx_host $CFLAGS tmp.64bit.cpp -o tmp.64bit -DTESTING 2>&1"
3099 cpu_type="`eval $execute 2>/dev/null`"
3101 log 2 "executing $execute"
3102 log 2 " returned $cpu_type"
3103 log 2 " exit code $ret"
3104 if [ "$ret" = "0" ]; then cpu_type="64"; else cpu_type="32"; fi
3105 log 1 "detecting cpu-type... $cpu_type bits"
3106 rm -f tmp.64bit tmp.64bit.cpp
3109 detect_sse_capable_architecture() {
3110 # 0 means no, 1 is auto-detect, 2 is force
3111 if [ "$with_sse" = "0" ]; then
3112 log 1 "checking SSE... disabled"
3116 echo "#define _SQ64 1" > tmp.sse.cpp
3117 echo "#include <xmmintrin.h>" >> tmp.sse.cpp
3118 echo "#include <smmintrin.h>" >> tmp.sse.cpp
3119 echo "#include <tmmintrin.h>" >> tmp.sse.cpp
3120 echo "int main() { return 0; }" >> tmp.sse.cpp
3121 execute="$cxx_host -msse4.1 $CFLAGS tmp.sse.cpp -o tmp.sse 2>&1"
3122 sse="`eval $execute 2>/dev/null`"
3124 log 2 "executing $execute"
3125 log 2 " returned $sse"
3126 log 2 " exit code $ret"
3127 if [ "$ret" = "0" ]; then
3128 log 1 "detecting SSE... found"
3130 # It was forced, so it should be found.
3131 if [ "$with_sse" != "1" ]; then
3132 log 1 "configure: error: SSE couln't be found"
3133 log 1 "configure: error: you force enabled SSE, but it seems unavailable"
3137 log 1 "detecting SSE... not found"
3140 rm -f tmp.sse tmp.exe tmp.sse.cpp
3145 T_CXXFLAGS="$CXXFLAGS"
3146 T_LDFLAGS="$LDFLAGS"
3148 SRC_OBJS_DIR="$BASE_SRC_OBJS_DIR/$OBJS_SUBDIR"
3150 # All the data needed to compile a single target
3151 # Make sure if you compile multiple targets to
3152 # use multiple OBJS_DIR, because all in-between
3153 # binaries are stored in there, and nowhere else.
3155 s@!!CC_HOST!!@$cc_host@g;
3156 s@!!CXX_HOST!!@$cxx_host@g;
3157 s@!!CC_BUILD!!@$cc_build@g;
3158 s@!!CXX_BUILD!!@$cxx_build@g;
3159 s@!!WINDRES!!@$windres@g;
3160 s@!!STRIP!!@$strip $strip_arg@g;
3162 s@!!CFLAGS!!@$T_CFLAGS@g;
3163 s@!!CFLAGS_BUILD!!@$CFLAGS_BUILD@g;
3164 s@!!CXXFLAGS!!@$T_CXXFLAGS@g;
3165 s@!!CXXFLAGS_BUILD!!@$CXXFLAGS_BUILD@g;
3166 s@!!STRGEN_FLAGS!!@$strgen_flags@g;
3168 s@!!LDFLAGS!!@$T_LDFLAGS@g;
3169 s@!!LDFLAGS_BUILD!!@$LDFLAGS_BUILD@g;
3170 s@!!BIN_DIR!!@$BIN_DIR@g;
3171 s@!!ROOT_DIR!!@$ROOT_DIR@g;
3172 s@!!MEDIA_DIR!!@$MEDIA_DIR@g;
3173 s@!!SOURCE_LIST!!@$SOURCE_LIST@g;
3174 s@!!SRC_OBJS_DIR!!@$SRC_OBJS_DIR@g;
3175 s@!!LANG_OBJS_DIR!!@$LANG_OBJS_DIR@g;
3176 s@!!GRF_OBJS_DIR!!@$GRF_OBJS_DIR@g;
3177 s@!!SETTING_OBJS_DIR!!@$SETTING_OBJS_DIR@g;
3178 s@!!SRC_DIR!!@$SRC_DIR@g;
3179 s@!!SCRIPT_SRC_DIR!!@$SCRIPT_SRC_DIR@g;
3180 s@!!OSXAPP!!@$OSXAPP@g;
3181 s@!!LANG_DIR!!@$LANG_DIR@g;
3183 s@!!BINARY_DIR!!@$prefix_dir/$binary_dir@g;
3184 s@!!DATA_DIR!!@$prefix_dir/$data_dir@g;
3185 s@!!DOC_DIR!!@$prefix_dir/$doc_dir@g;
3186 s@!!MAN_DIR!!@$prefix_dir/$man_dir@g;
3187 s@!!ICON_DIR!!@$prefix_dir/$icon_dir@g;
3188 s@!!ICON_THEME_DIR!!@$prefix_dir/$icon_theme_dir@g;
3189 s@!!PERSONAL_DIR!!@$personal_dir@g;
3190 s@!!SHARED_DIR!!@$shared_dir@g;
3191 s@!!INSTALL_DIR!!@$install_dir@g;
3192 s@!!BINARY_NAME!!@$binary_name@g;
3193 s@!!STRGEN!!@$STRGEN@g;
3194 s@!!DEPEND!!@$DEPEND@g;
3195 s@!!SETTINGSGEN!!@$SETTINGSGEN@g;
3196 s@!!STAGE!!@$STAGE@g;
3197 s@!!MAKEDEPEND!!@$makedepend@g;
3198 s@!!CFLAGS_MAKEDEP!!@$cflags_makedep@g;
3200 s@!!CONFIG_CACHE_COMPILER!!@config.cache.compiler@g;
3201 s@!!CONFIG_CACHE_LINKER!!@config.cache.linker@g;
3202 s@!!CONFIG_CACHE_SOURCE!!@config.cache.source@g;
3203 s@!!CONFIG_CACHE_VERSION!!@config.cache.version@g;
3204 s@!!CONFIG_CACHE_SOURCE_LIST!!@config.cache.source.list@g;
3205 s@!!CONFIG_CACHE_PWD!!@config.cache.pwd@g;
3206 s@!!LANG_SUPPRESS!!@$lang_suppress@g;
3207 s@!!OBJS_C!!@$OBJS_C@g;
3208 s@!!OBJS_CPP!!@$OBJS_CPP@g;
3209 s@!!OBJS_MM!!@$OBJS_MM@g;
3210 s@!!OBJS_RC!!@$OBJS_RC@g;
3213 s@!!CONFIGURE_FILES!!@$CONFIGURE_FILES@g;
3215 s@!!DISTCC!!@$distcc@g;
3216 s@!!NFORENUM!!@$nforenum@g;
3217 s@!!GRFCODEC!!@$grfcodec@g;
3220 if [ "$icon_theme_dir" != "" ]; then
3221 SRC_REPLACE="$SRC_REPLACE
3222 s@!!ICON_THEME_DIR!!@$prefix_dir/$icon_theme_dir@g;
3225 SRC_REPLACE="$SRC_REPLACE
3226 s@!!ICON_THEME_DIR!!@@g;
3230 if [ "$man_dir" != "" ]; then
3231 SRC_REPLACE="$SRC_REPLACE
3232 s@!!MAN_DIR!!@$prefix_dir/$man_dir@g;
3235 SRC_REPLACE="$SRC_REPLACE
3240 if [ "$menu_dir" != "" ]; then
3241 SRC_REPLACE="$SRC_REPLACE
3242 s@!!MENU_DIR!!@$prefix_dir/$menu_dir@g;
3245 SRC_REPLACE="$SRC_REPLACE
3251 generate_menu_item() {
3254 s@!!MENU_GROUP!!@$menu_group@g;
3255 s@!!MENU_NAME!!@$menu_name@g
3257 log 1 "Generating menu item..."
3259 < $ROOT_DIR/media/openttd.desktop.in sed "$MENU_REPLACE" > media/openttd.desktop
3267 # Create the main Makefile
3268 log 1 "Generating Makefile..."
3269 echo "# Auto-generated file from 'Makefile.in' -- DO NOT EDIT" > Makefile
3270 < $ROOT_DIR/Makefile.in sed "$SRC_REPLACE" >> Makefile
3271 cp $ROOT_DIR/Makefile.bundle.in Makefile.bundle
3272 echo "# Auto-generated file -- DO NOT EDIT" > Makefile.am
3274 # Make the copy of the source-list, so we don't trigger an unwanted recompile
3275 cp $SOURCE_LIST config.cache.source.list
3276 # Add the current directory, so we don't trigger an unwanted recompile
3277 echo "`pwd`" > config.cache.pwd
3278 # Make sure config.cache is OLDER then config.cache.source.list
3282 if [ "$menu_dir" != "" ]; then
3292 # Create the language file
3293 mkdir -p $LANG_OBJS_DIR
3295 log 1 "Generating lang/Makefile..."
3296 echo "# Auto-generated file from 'Makefile.lang.in' -- DO NOT EDIT" > $LANG_OBJS_DIR/Makefile
3297 < $ROOT_DIR/Makefile.lang.in sed "$SRC_REPLACE" >> $LANG_OBJS_DIR/Makefile
3298 echo "DIRS += $LANG_OBJS_DIR" >> Makefile.am
3299 echo "LANG_DIRS += $LANG_OBJS_DIR" >> Makefile.am
3302 generate_settings() {
3307 # Create the language file
3308 mkdir -p $SETTING_OBJS_DIR
3310 log 1 "Generating setting/Makefile..."
3311 echo "# Auto-generated file from 'Makefile.settings.in' -- DO NOT EDIT" > $SETTING_OBJS_DIR/Makefile
3312 < $ROOT_DIR/Makefile.setting.in sed "$SRC_REPLACE" >> $SETTING_OBJS_DIR/Makefile
3313 echo "DIRS += $SETTING_OBJS_DIR" >> Makefile.am
3321 # Create the language file
3322 mkdir -p $GRF_OBJS_DIR
3324 log 1 "Generating grf/Makefile..."
3325 echo "# Auto-generated file from 'Makefile.grf.in' -- DO NOT EDIT" > $GRF_OBJS_DIR/Makefile
3326 < $ROOT_DIR/Makefile.grf.in sed "$SRC_REPLACE" >> $GRF_OBJS_DIR/Makefile
3327 echo "DIRS += $GRF_OBJS_DIR" >> Makefile.am
3330 generate_src_normal() {
3335 # Create the source file
3336 mkdir -p $SRC_OBJS_DIR
3338 log 1 "Generating $2/Makefile..."
3339 echo "# Auto-generated file from 'Makefile.src.in' -- DO NOT EDIT" > $SRC_OBJS_DIR/Makefile
3340 < $ROOT_DIR/Makefile.src.in sed "$SRC_REPLACE" >> $SRC_OBJS_DIR/Makefile
3341 echo "DIRS += $SRC_OBJS_DIR" >> Makefile.am
3342 echo "SRC_DIRS += $SRC_OBJS_DIR" >> Makefile.am
3345 generate_src_osx() {
3346 cc_host_orig="$cc_host"
3347 cxx_host_orig="$cxx_host"
3348 CFLAGS_orig="$CFLAGS"
3349 LDFLAGS_orig="$LDFLAGS"
3351 for type in $enable_universal; do
3353 if [ -n "$osx_sdk_104_path" ]; then
3354 # Use 10.4 SDK for 32-bit targets
3355 CFLAGS="-isysroot $osx_sdk_104_path $CFLAGS_orig"
3356 LDFLAGS="-Wl,-syslibroot,$osx_sdk_104_path $LDFLAGS_orig"
3359 # We don't want to duplicate the x86_64 stuff for each target, so do it once here
3360 if [ "$type" = "ppc64" ] || [ "$type" = "x86_64" ]; then
3361 # 64 bits is always 10.5 or higher. Furthermore it has a non const ICONV
3362 # and they also removed support for QuickTime/QuickDraw
3363 if [ -n "$osx_sdk_path" ]; then
3364 CFLAGS="-isysroot $osx_sdk_path $CFLAGS_orig"
3365 LDFLAGS="-Wl,-syslibroot,$osx_sdk_path $LDFLAGS_orig"
3367 CFLAGS="$CFLAGS -D_SQ64 -DNO_QUICKTIME -UENABLE_COCOA_QUICKDRAW"
3368 LIBS="`echo $LIBS | sed 's/-framework QuickTime//'`"
3373 BASE_SRC_OBJS_DIR="$OBJS_DIR/ppc"
3374 cc_host="$cc_host_orig -arch ppc -mmacosx-version-min=10.3"
3375 cxx_host="$cxx_host_orig -arch ppc -mmacosx-version-min=10.3"
3376 generate_src_normal "[ppc]" "objs/ppc";;
3378 BASE_SRC_OBJS_DIR="$OBJS_DIR/ppc970"
3379 cc_host="$cc_host_orig -arch ppc970 -mmacosx-version-min=10.3 -mcpu=G5 -mpowerpc64 -mtune=970 -mcpu=970 -mpowerpc-gpopt"
3380 cxx_host="$cxx_host_orig -arch ppc970 -mmacosx-version-min=10.3 -mcpu=G5 -mpowerpc64 -mtune=970 -mcpu=970 -mpowerpc-gpopt"
3381 generate_src_normal "[ppc970]" "objs/ppc970";;
3383 BASE_SRC_OBJS_DIR="$OBJS_DIR/i386"
3384 cc_host="$cc_host_orig -arch i386 -mmacosx-version-min=10.4"
3385 cxx_host="$cxx_host_orig -arch i386 -mmacosx-version-min=10.4"
3386 generate_src_normal "[i386]" "objs/i386";;
3388 BASE_SRC_OBJS_DIR="$OBJS_DIR/ppc64"
3389 cc_host="$cc_host_orig -arch ppc64 -mmacosx-version-min=10.5"
3390 cxx_host="$cxx_host_orig -arch ppc64 -mmacosx-version-min=10.5"
3391 generate_src_normal "[ppc64]" "objs/ppc64";;
3393 BASE_SRC_OBJS_DIR="$OBJS_DIR/x86_64"
3394 cc_host="$cc_host_orig -arch x86_64 -mmacosx-version-min=10.5"
3395 cxx_host="$cxx_host_orig -arch x86_64 -mmacosx-version-min=10.5"
3396 generate_src_normal "[x86_64]" "objs/x86_64";;
3397 *) log 1 "Unknown architecture requested for universal build: $type";;
3403 if [ "$os" = "OSX" ] && [ "$enable_universal" != "0" ]; then
3406 generate_src_normal "[SRC]" "objs"
3411 echo "'configure' configures OpenTTD."
3413 echo "Usage: $0 [OPTION]... [VAR=VALUE]..."
3415 echo "To assign environment variables (e.g., CC, CFLAGS...), specify them as"
3416 echo "VAR=VALUE. See below for descriptions of some of the useful variables."
3418 echo "Defaults for the options are specified in brackets."
3420 echo "Configuration:"
3421 echo " -h, --help display this help and exit"
3423 echo "System types:"
3424 echo " --build=BUILD configure for building on BUILD [guessed]"
3425 echo " --host=HOST cross-compile to build programs to run"
3426 echo " on HOST [BUILD]"
3427 echo " --windres=WINDRES the windres to use [HOST-windres]"
3428 echo " --strip=STRIP the strip to use [HOST-strip]"
3429 echo " --awk=AWK the awk to use in configure [awk]"
3430 echo " --pkg-config=PKG-CONFIG the pkg-config to use in configure [pkg-config]"
3431 echo " --lipo=LIPO the lipo to use (OSX ONLY) [HOST-lipo]"
3432 echo " --os=OS the OS we are compiling for [DETECT]"
3433 echo " DETECT/UNIX/OSX/FREEBSD/DRAGONFLY/OPENBSD/"
3434 echo " NETBSD/MORPHOS/HPUX/BEOS/SUNOS/CYGWIN/"
3435 echo " MINGW/OS2/DOS/HAIKU"
3438 echo " --prefix-dir=dir specifies the prefix for all installed"
3439 echo " files [/usr/local]"
3440 echo " --binary-dir=dir location of the binary. Will be prefixed"
3441 echo " with the prefix-dir [games]"
3442 echo " --data-dir=dir location of data files (lang, data, gm)."
3443 echo " Will be prefixed with the prefix-dir"
3444 echo " [share/games/openttd]"
3445 echo " --doc-dir=dir location of the doc files"
3446 echo " Will be prefixed with the prefix-dir"
3448 echo " --icon-dir=dir location of icons. Will be prefixed"
3449 echo " with the prefix-dir [share/pixmaps]"
3450 echo " --icon-theme-dir=dir location of icon theme."
3451 echo " Will be prefixed with the prefix-dir"
3452 echo " and postfixed with size-dirs [$icon_theme_dir]"
3453 echo " --man-dir=dir location of the manual page (UNIX only)"
3454 echo " Will be prefixed with the prefix-dir"
3456 echo " --menu-dir=dir location of the menu item. (UNIX only, except OSX)"
3457 echo " Will be prefixed with the prefix-dir"
3458 echo " [share/applications]"
3459 echo " --personal-dir=dir location of the personal directory"
3460 echo " [os-dependent default]"
3461 echo " --shared-dir=dir location of shared data files"
3462 echo " [os-dependent default]"
3463 echo " --install-dir=dir specifies the root to install to."
3464 echo " Useful to install into jails [/]"
3465 echo " --binary-name the name used for the binary, icons,"
3466 echo " desktop file, etc. when installing [openttd]"
3468 echo "Features and packages:"
3469 echo " --enable-debug[=LVL] enable debug-mode (LVL=[0123], 0 is release)"
3470 echo " --enable-desync-debug=[LVL] enable desync debug options (LVL=[012], 0 is none"
3471 echo " --enable-profiling enables profiling"
3472 echo " --enable-lto enables GCC's Link Time Optimization (LTO)/ICC's"
3473 echo " Interprocedural Optimization if available"
3474 echo " --enable-dedicated compile a dedicated server (without video)"
3475 echo " --enable-static enable static compile (doesn't work for"
3477 echo " --enable-translator enable extra output for translators"
3478 echo " --enable-universal[=ARCH] enable universal builds (OSX ONLY). Allowed is any combination"
3479 echo " of architectures: i386 ppc ppc970 ppc64 x86_64"
3480 echo " Default architectures are: i386 ppc"
3481 echo " --enable-osx-g5 enables optimizations for ppc970 (G5) (OSX ONLY)"
3482 echo " --disable-cocoa-quartz disable the quartz window mode driver for Cocoa (OSX ONLY)"
3483 echo " --disable-cocoa-quickdraw disable the quickdraw window mode driver for Cocoa (OSX ONLY)"
3484 echo " --disable-unicode disable unicode support to build win9x"
3485 echo " version (Win32 ONLY)"
3486 echo " --enable-console compile as a console application instead of as a GUI application."
3487 echo " If this setting is active, debug output will appear in the same"
3488 echo " console instead of opening a new window. (Win32 ONLY)"
3489 echo " --disable-network disable network support"
3490 echo " --disable-assert disable asserts (continue on errors)"
3491 echo " --enable-strip enable any possible stripping"
3492 echo " --without-osx-sysroot disable the automatic adding of sysroot "
3494 echo " --without-application-bundle disable generation of application bundle"
3496 echo " --without-menu-entry Don't generate a menu item (Freedesktop based only)"
3497 echo " --menu-group=group Category in which the menu item will be placed (Freedesktop based only)"
3498 echo " --menu-name=name Name of the menu item when placed [OpenTTD]"
3499 echo " --with-direct-music enable direct music support (Win32 ONLY)"
3500 echo " --with-sort=sort define a non-default location for sort"
3501 echo " --with-midi=midi define which midi-player to use"
3502 echo " --with-midi-arg=arg define which args to use for the"
3504 echo " --with-libtimidity[=\"pkg-config libtimidity\"]"
3505 echo " enables libtimidity support"
3506 echo " --with-allegro[=\"pkg-config allegro\"]"
3507 echo " enables Allegro video driver support"
3508 echo " --with-cocoa enables COCOA video driver (OSX ONLY)"
3509 echo " --with-sdl[=\"pkg-config sdl\"] enables SDL video driver support"
3510 echo " --with-zlib[=\"pkg-config zlib\"]"
3511 echo " enables zlib support"
3512 echo " --with-liblzma[=\"pkg-config liblzma\"]"
3513 echo " enables liblzma support"
3514 echo " --with-liblzo2[=liblzo2.a] enables liblzo2 support"
3515 echo " --with-png[=\"pkg-config libpng\"]"
3516 echo " enables libpng support"
3517 echo " --with-freetype[=\"pkg-config freetype2\"]"
3518 echo " enables libfreetype support"
3519 echo " --with-fontconfig[=\"pkg-config fontconfig\"]"
3520 echo " enables fontconfig support"
3521 echo " --with-xdg-basedir[=\"pkg-config libxdg-basedir\"]"
3522 echo " enables XDG base directory support"
3523 echo " --with-icu enables icu components for layout and sorting"
3524 echo " --with-icu-layout[=\"pkg-config icu-lx\"]"
3525 echo " enables icu components for layouting (right-to-left support)"
3526 echo " --with-icu-sort[=\"pkg-config icu-i18n\"]"
3527 echo " enables icu components for locale specific string sorting"
3528 echo " --static-icu try to link statically (libsicu instead of"
3529 echo " libicu; can fail as the new name is guessed)"
3530 echo " --with-iconv[=iconv-path] enables iconv support"
3531 echo " --disable-builtin-depend disable use of builtin deps finder"
3532 echo " --with-makedepend[=makedepend] enables makedepend support"
3533 echo " --with-ccache enables ccache support"
3534 echo " --with-distcc enables distcc support"
3535 echo " --without-grfcodec disable usage of grfcodec and re-generation of base sets"
3536 echo " --without-threads disable threading support"
3537 echo " --without-sse disable SSE support (x86/x86_64 only)"
3539 echo "Some influential environment variables:"
3540 echo " CC C compiler command"
3541 echo " CXX C++ compiler command"
3542 echo " CFLAGS C compiler flags"
3543 echo " CXXFLAGS C++ compiler flags"
3544 echo " WINDRES windres command"
3545 echo " LDFLAGS linker flags, e.g. -L<lib dir> if you"
3546 echo " have libraries in a nonstandard"
3547 echo " directory <lib dir>"
3548 echo " CFLAGS_BUILD C compiler flags for build time tool generation"
3549 echo " CXXFLAGS_BUILD C++ compiler flags for build time tool generation"
3550 echo " LDFLAGS_BUILD linker flags for build time tool generation"
3551 echo " PKG_CONFIG_PATH additional library search paths (see \"man pkg-config\")"
3552 echo " PKG_CONFIG_LIBDIR replace the default library search path (see \"man pkg-config\")"
3554 echo "Use these variables to override the choices made by 'configure' or to help"
3555 echo "it to find libraries and programs with nonstandard names/locations."