rubidium@5475: rubidium@5475: log() { rubidium@5475: if [ $1 = "1" ]; then echo "$2"; fi rubidium@5475: echo "$2" >> $config_log rubidium@5475: } rubidium@5475: rubidium@5475: set_default() { rubidium@6811: released_version="" rubidium@6811: rubidium@5475: ignore_extra_parameters="0" rubidium@5475: # We set all kinds of defaults for params. Later on the user can override rubidium@5475: # most of them; but if they don't, this default is used. rubidium@5475: build="" rubidium@5475: host="" rubidium@5475: cc_build="" rubidium@5475: cc_host="" rubidium@5587: cxx_build="" rubidium@5475: cxx_host="" rubidium@5475: windres="" rubidium@5475: strip="" rubidium@5475: lipo="" truelight@6081: awk="awk" rubidium@5475: os="DETECT" rubidium@5475: endian="AUTO" rubidium@6938: cpu_type="DETECT" rubidium@5475: revision="" rubidium@5475: config_log="config.log" rubidium@5475: prefix_dir="/usr/local" rubidium@5475: binary_dir="games" rubidium@5475: data_dir="share/games/openttd" skidd13@9694: doc_dir="1" rubidium@5475: icon_dir="share/pixmaps" skidd13@9694: icon_theme_dir="1" rubidium@6929: personal_dir="1" bjarni@8273: shared_dir="1" rubidium@5475: install_dir="/" skidd13@9694: man_dir="1" skidd13@9694: menu_dir="1" skidd13@9680: menu_group="Game;" truebrain@10245: menu_name="OpenTTD" truebrain@10244: binary_name="openttd" rubidium@5475: enable_debug="0" rubidium@8080: enable_desync_debug="0" rubidium@5475: enable_profiling="0" rubidium@5475: enable_dedicated="0" rubidium@5475: enable_network="1" rubidium@5475: enable_static="1" rubidium@5475: enable_translator="0" smatz@8244: enable_unicode="1" rubidium@5475: enable_assert="1" rubidium@8782: enable_strip="0" rubidium@5475: enable_universal="1" rubidium@5475: enable_osx_g5="0" egladil@8092: enable_cocoa_quartz="1" egladil@8092: enable_cocoa_quickdraw="1" rubidium@5475: with_osx_sysroot="1" rubidium@5475: with_application_bundle="1" skidd13@9694: with_menu_entry="1" rubidium@10379: with_allegro="1" rubidium@5475: with_sdl="1" rubidium@5475: with_cocoa="1" rubidium@5475: with_zlib="1" rubidium@5475: with_png="1" rubidium@5475: with_makedepend="1" rubidium@5475: with_direct_music="1" rubidium@5475: with_sort="1" rubidium@5475: with_iconv="1" rubidium@5475: with_midi="" rubidium@5475: with_midi_arg="" truelight@6034: with_libtimidity="1" rubidium@5578: with_freetype="1" rubidium@5475: with_fontconfig="1" rubidium@10248: with_icu="1" truelight@5961: with_psp_config="1" rubidium@7294: with_threads="1" smatz@8244: with_distcc="1" smatz@8244: with_ccache="1" rubidium@5475: bjarni@8269: save_params_array=" bjarni@8269: build bjarni@8269: host bjarni@8269: cc_build bjarni@8269: cc_host bjarni@8269: cxx_build bjarni@8269: cxx_host bjarni@8269: windres bjarni@8269: strip bjarni@8269: lipo bjarni@8269: awk bjarni@8269: os bjarni@8269: endian bjarni@8269: cpu_type bjarni@8269: revision bjarni@8269: config_log bjarni@8269: prefix_dir bjarni@8269: binary_dir bjarni@8269: data_dir skidd13@9694: doc_dir bjarni@8269: icon_dir skidd13@9694: icon_theme_dir skidd13@9694: man_dir skidd13@9680: menu_dir bjarni@8269: personal_dir bjarni@8273: shared_dir bjarni@8269: install_dir skidd13@9680: menu_group truebrain@10245: menu_name truebrain@10244: binary_name bjarni@8269: enable_debug bjarni@8269: enable_desync_debug bjarni@8269: enable_profiling bjarni@8269: enable_dedicated bjarni@8269: enable_network bjarni@8269: enable_static bjarni@8269: enable_translator bjarni@8269: enable_unicode bjarni@8269: enable_assert bjarni@8269: enable_strip bjarni@8269: enable_universal bjarni@8269: enable_osx_g5 bjarni@8269: enable_cocoa_quartz bjarni@8269: enable_cocoa_quickdraw bjarni@8269: with_osx_sysroot bjarni@8269: with_application_bundle rubidium@10379: with_allegro bjarni@8269: with_sdl bjarni@8269: with_cocoa bjarni@8269: with_zlib bjarni@8269: with_png bjarni@8269: with_makedepend bjarni@8269: with_direct_music bjarni@8269: with_sort bjarni@8269: with_iconv bjarni@8269: with_midi bjarni@8269: with_midi_arg bjarni@8269: with_libtimidity bjarni@8269: with_freetype bjarni@8269: with_fontconfig rubidium@10248: with_icu bjarni@8269: with_psp_config bjarni@8269: with_threads bjarni@8269: with_distcc bjarni@8269: with_ccache bjarni@8269: CC CXX CFLAGS LDFLAGS" rubidium@5475: } rubidium@5475: rubidium@5475: detect_params() { rubidium@5475: # Walk over all params from the user and override any default settings if rubidium@5475: # needed. This also handles any invalid option. tron@5558: for p in "$@"; do tron@5558: if [ -n "$prev_p" ]; then rubidium@5475: eval "$prev_p=\$p" rubidium@5475: prev_p= rubidium@5475: continue rubidium@5475: fi rubidium@5475: rubidium@5475: optarg=`expr "x$p" : 'x[^=]*=\(.*\)'` rubidium@5475: rubidium@5475: case "$p" in truebrain@10410: --help | -h | -\?) showhelp; exit 0;; rubidium@5475: tron@5536: --config-log) prev_p="config_log";; tron@5536: --config-log=*) config_log="$optarg";; rubidium@5475: tron@5536: --build) prev_p="build";; tron@5536: --build=*) build="$optarg";; tron@5536: tron@5536: --host) prev_p="host";; tron@5536: --host=*) host="$optarg";; tron@5536: tron@5536: --os) prev_p="os";; tron@5536: --os=*) os="$optarg";; tron@5536: rubidium@6938: --cpu-type) prev_p="cpu_type";; rubidium@6938: --cpu-type=*) cpu_type="$optarg";; rubidium@6938: tron@5536: --revision=*) revision="$optarg";; tron@5536: tron@5536: --cc-build) prevp_p="cc_build";; tron@5536: --cc-build=*) cc_build="$optarg";; tron@5536: --cc-host) prevp_p="cc_host";; tron@5536: --cc-host=*) cc_host="$optarg";; rubidium@5587: --cxx-build) prevp_p="cxx_build";; rubidium@5587: --cxx-build=*) cxx_build="$optarg";; tron@5536: --cxx-host) prevp_p="cxx_host";; tron@5536: --cxx-host=*) cxx_host="$optarg";; tron@5536: --windres) prevp_p="windres";; tron@5536: --windres=*) windres="$optarg";; truelight@6081: --awk) prevp_p="awk";; truelight@6081: --awk=*) awk="$optarg";; tron@5536: --strip) prevp_p="strip";; tron@5536: --strip=*) strip="$optarg";; tron@5536: --lipo) prevp_p="lipo";; tron@5536: --lipo=*) lipo="$optarg";; tron@5536: tron@5536: --endian) prev_p="endian";; tron@5536: --endian=*) endian="$optarg";; rubidium@5475: rubidium@5475: rubidium@5475: tron@5536: --prefix-dir) prevp_p="prefix-dir";; tron@5536: --prefix-dir=*) prefix_dir="$optarg";; rubidium@5475: tron@5536: --binary-dir) prevp_p="binary-dir";; tron@5536: --binary-dir=*) binary_dir="$optarg";; rubidium@5475: tron@5536: --data-dir) prevp_p="data-dir";; tron@5536: --data-dir=*) data_dir="$optarg";; rubidium@5475: skidd13@9694: --doc-dir) prevp_p="doc-dir";; skidd13@9694: --doc-dir=*) doc_dir="$optarg";; skidd13@9694: tron@5536: --icon-dir) prevp_p="icon-dir";; tron@5536: --icon-dir=*) icon_dir="$optarg";; rubidium@5475: skidd13@9694: --icon-theme-dir) prevp_p="icon-theme-dir";; skidd13@9694: --icon-theme-dir=*) icon_theme_dir="$optarg";; skidd13@9694: --without-icon-theme) icon_theme_dir="";; skidd13@9694: skidd13@9680: --menu-dir) prevp_p="menu_dir";; skidd13@9680: --menu-dir=*) menu_dir="$optarg";; skidd13@9694: --without-menu-entry) menu_dir="";; skidd13@9694: truebrain@10245: --menu-name) prevp_p="menu_name";; truebrain@10245: --menu-name=*) menu_name="$optarg";; truebrain@10245: truebrain@10244: --binary-name) prevp_p="binary_name";; truebrain@10244: --binary-name=*) binary_name="$optarg";; truebrain@10244: skidd13@9694: --man-dir) prevp_p="man_dir";; glx@9707: --man-dir=*) man_dir="$optarg";; skidd13@9680: tron@5536: --personal-dir) prevp_p="personal-dir";; tron@5536: --personal-dir=*) personal_dir="$optarg";; rubidium@6929: --without-personal-dir) personal_dir="";; tron@5536: bjarni@8273: --shared-dir) prevp_p="shared-dir";; bjarni@8273: --shared-dir=*) shared_dir="$optarg";; bjarni@8273: --without-shared-dir) shared_dir="";; bjarni@8273: tron@5536: --install-dir) prevp_p="install-dir";; tron@5536: --install-dir=*) install_dir="$optarg";; rubidium@5475: rubidium@5475: rubidium@5475: rubidium@9681: --menu-group) prevp_p="menu_group";; rubidium@9681: --menu-group=*) menu_group="$optarg";; skidd13@9680: skidd13@9680: skidd13@9680: tron@5536: --enable-debug) enable_debug="1";; tron@5536: --enable-debug=*) enable_debug="$optarg";; rubidium@8080: --enable-desync-debug) enable_desync_debug="1";; rubidium@8080: --enable-desync-debug=*) enable_desync_debug="$optarg";; tron@5536: --enable-profiling) enable_profiling="1";; tron@5536: --enable-profiling=*) enable_profiling="$optarg";; tron@5536: --enable-dedicated) enable_dedicated="1";; tron@5536: --enable-dedicated=*) enable_dedicated="$optarg";; tron@5536: --enable-network=*) enable_network="$optarg";; tron@5536: --disable-network) enable_network="0";; tron@5536: --disable-static) enable_static="0";; tron@5536: --enable-static) enable_static="2";; tron@5536: --enable-static=*) enable_static="$optarg";; tron@5536: --disable-translator) enable_translator="0";; tron@5536: --enable-translator) enable_translator="2";; tron@5536: --enable-translator=*) enable_translator="$optarg";; tron@5536: --disable-assert) enable_assert="0";; tron@5536: --enable-assert) enable_assert="2";; tron@5536: --enable-assert=*) enable_assert="$optarg";; tron@5536: --disable-strip) enable_strip="0";; tron@5536: --enable-strip) enable_strip="2";; tron@5536: --enable-strip=*) enable_strip="$optarg";; tron@5536: --disable-universal) enable_universal="0";; tron@5536: --enable-universal) enable_universal="2";; tron@5536: --enable-universal=*) enable_universal="$optarg";; tron@5536: --disable-osx-g5) enable_osx_g5="0";; tron@5536: --enable-osx-g5) enable_osx_g5="2";; tron@5536: --enable-osx-g5=*) enable_osx_g5="$optarg";; truelight@6228: --disable-unicode) enable_unicode="0";; truelight@6228: --enable-unicode) enable_unicode="2";; truelight@6228: --enable-unicode=*) enable_unicode="$optarg";; rubidium@5475: egladil@8092: --disable-cocoa-quartz) enable_cocoa_quartz="0";; egladil@8092: --enable-cocoa-quartz) enable_cocoa_quartz="2";; egladil@8092: --enable-cocoa-quartz=*) enable_cocoa_quartz="$optarg";; egladil@8092: --disable-cocoa-quickdraw) enable_cocoa_quickdraw="0";; egladil@8092: --enable-cocoa-quickdraw) enable_cocoa_quickdraw="2";; egladil@8092: --enable-cocoa-quickdraw=*) enable_cocoa_quickdraw="$optarg";; egladil@8092: rubidium@10379: --with-allegro) with_allegro="2";; rubidium@10379: --without-allegro) with_allegro="0";; rubidium@10379: --with-allegro=*) with_allegro="$optarg";; rubidium@10379: tron@5536: --with-sdl) with_sdl="2";; tron@5536: --without-sdl) with_sdl="0";; tron@5536: --with-sdl=*) with_sdl="$optarg";; rubidium@5475: tron@5536: --with-cocoa) with_cocoa="2";; tron@5536: --without-cocoa) with_cocoa="0";; tron@5536: --with-cocoa=*) with_cocoa="$optarg";; rubidium@5475: tron@5536: --with-zlib) with_zlib="2";; tron@5536: --without-zlib) with_zlib="0";; tron@5536: --with-zlib=*) with_zlib="$optarg";; rubidium@5475: tron@5536: --with-png) with_png="2";; tron@5536: --without-png) with_png="0";; tron@5536: --with-png=*) with_png="$optarg";; tron@5536: --with-libpng) with_png="2";; tron@5536: --without-libpng) with_png="0";; tron@5536: --with-libpng=*) with_png="$optarg";; rubidium@5475: truelight@6034: --with-libtimidity) with_libtimidity="2";; truelight@6034: --without-libtimidity) with_libtimidity="0";; truelight@6034: --with-libtimidity=*) with_libtimidity="$optarg";; truelight@6034: tron@5536: --with-freetype) with_freetype="2";; tron@5536: --without-freetype) with_freetype="0";; tron@5536: --with-freetype=*) with_freetype="$optarg";; tron@5536: --with-libfreetype) with_freetype="2";; tron@5536: --without-libfreetype) with_freetype="0";; tron@5536: --with-libfreetype=*) with_freetype="$optarg";; rubidium@5475: tron@5536: --with-fontconfig) with_fontconfig="2";; tron@5536: --without-fontconfig) with_fontconfig="0";; tron@5536: --with-fontconfig=*) with_fontconfig="$optarg";; tron@5536: --with-libfontconfig) with_fontconfig="2";; tron@5536: --without-libfontconfig) with_fontconfig="0";; tron@5536: --with-libfontconfig=*) with_fontconfig="$optarg";; tron@5536: rubidium@10248: --with-icu) with_icu="2";; rubidium@10248: --without-icu) with_icu="0";; rubidium@10248: --with-icu=*) with_icu="$optarg";; rubidium@10248: --with-libicu) with_icu="2";; rubidium@10248: --without-libicu) with_icu="0";; rubidium@10248: --with-libicu=*) with_icu="$optarg";; rubidium@10248: truelight@5961: --with-psp-config) with_psp_config="2";; truelight@5961: --without-psp-config) with_psp_config="0";; truelight@5961: --with-psp-config=*) with_psp_config="$optarg";; truelight@5958: tron@5536: --with-makedepend) with_makedepend="2";; tron@5536: --without-makedepend) with_makedepend="0";; tron@5536: --with-makedepend=*) with_makedepend="$optarg";; tron@5536: tron@5536: --with-direct-music) with_direct_music="2";; tron@5536: --without-direct-music) with_direct_music="0";; tron@5536: --with-direct-music=*) with_direct_music="$optarg";; tron@5536: tron@5536: --with-sort) with_sort="2";; tron@5536: --without-sort) with_sort="0";; tron@5536: --with-sort=*) with_sort="$optarg";; tron@5536: tron@5536: --with-iconv) with_iconv="2";; tron@5536: --without-iconv) with_iconv="0";; tron@5536: --with-iconv=*) with_iconv="$optarg";; tron@5536: tron@5536: --with-midi=*) with_midi="$optarg";; tron@5536: --with-midi-arg=*) with_midi_arg="$optarg";; tron@5536: truelight@6850: --without-distcc) with_distcc="0";; truelight@6850: --with-distcc) with_distcc="2";; truelight@6850: --with-distcc=*) with_distcc="$optarg";; truelight@6850: rubidium@6918: --without-ccache) with_ccache="0";; rubidium@6918: --with-ccache) with_ccache="2";; rubidium@6918: --with-ccache=*) with_ccache="$optarg";; rubidium@6918: tron@5536: --without-osx-sysroot) with_osx_sysroot="0";; tron@5536: --with-osx-sysroot) with_osx_sysroot="2";; tron@5536: --with-osx-sysroot=*) with_osx_sysroot="$optarg";; tron@5536: rubidium@6512: --without-application-bundle) with_application_bundle="0";; rubidium@6512: --with-application-bundle) with_application_bundle="1";; rubidium@6512: --with-application-bundle=*) with_application_bundle="$optarg";; tron@5536: rubidium@7294: --without-threads) with_threads="0";; rubidium@7294: --with-threads) with_threads="1";; rubidium@7294: --with-threads=*) with_threads="$optarg";; rubidium@7294: tron@5536: CC=* | --CC=*) CC="$optarg";; tron@5536: CXX=* | --CXX=*) CXX="$optarg";; tron@5536: CFLAGS=* | --CFLAGS=*) CFLAGS="$optarg";; tron@5536: LDFLAGS=* | --LDFLAGS=*) LDFLAGS="$optarg";; tron@5536: tron@5536: --ignore-extra-parameters) ignore_extra_parameters="1";; rubidium@5475: truebrain@10410: --* | -*) tron@5558: if [ "$ignore_extra_parameters" = "0" ]; then rubidium@10434: log 1 "Unknown option $p" rubidium@5475: exit 1 rubidium@5475: else rubidium@10434: log 1 "Unknown option $p ignored" rubidium@5475: fi rubidium@5475: ;; rubidium@5475: esac rubidium@5475: done rubidium@5475: tron@5558: if [ -n "$prev_p" ]; then rubidium@10434: log 1 "configure: error: missing argument to --$prev_p" rubidium@5475: exit 1 rubidium@5475: fi rubidium@5475: rubidium@5475: # Clean the logfile rubidium@5475: echo "" > $config_log rubidium@5475: } rubidium@5475: rubidium@5475: save_params() { rubidium@5475: # Here we save all params, so we can later on do an exact redo of this rubidium@5475: # configuration, without having the user to re-input stuff rubidium@5475: rubidium@5475: echo "Running configure with following options:" >> $config_log rubidium@5475: echo "" >> $config_log rubidium@5475: truelight@6246: configure="$CONFIGURE_EXECUTABLE --ignore-extra-parameters" tron@5558: for p in $save_params_array; do truelight@5560: eval "v=\"\$$p\"" smatz@10239: p=`echo "$p" | sed 's~_~-~g;s~\n~~g;s~ ~\\ ~g'` rubidium@5475: # Only save those params that aren't empty truelight@5560: configure="$configure --$p=\"$v\"" rubidium@5475: done rubidium@5475: rubidium@5475: echo "$configure" >> $config_log rubidium@5475: echo "$configure" > config.cache rubidium@5475: echo "" >> $config_log rubidium@5475: } rubidium@5475: rubidium@5475: check_params() { rubidium@5475: # Some params want to be in full uppercase, else they might not work as rubidium@5475: # expected.. fix that here rubidium@5475: truelight@6078: endian=`echo $endian | tr '[a-z]' '[A-Z]'` truelight@6078: os=`echo $os | tr '[a-z]' '[A-Z]'` rubidium@6938: cpu_type=`echo $cpu_type | tr '[a-z]' '[A-Z]'` rubidium@5475: rubidium@5475: # Check if all params have valid values rubidium@5475: rubidium@5475: # Endian only allows AUTO, LE and, BE truelight@7424: if [ -z "`echo $endian | egrep '^(AUTO|LE|BE|PREPROCESSOR)$'`" ]; then rubidium@10434: log 1 "configure: error: invalid option --endian=$endian" rubidium@10434: log 1 " Available options are: --endian=[AUTO|LE|BE]" rubidium@5475: exit 1 rubidium@5475: fi truelight@7424: if [ "$endian" = "PREPROCESSOR" ] && [ "$os" != "OSX" ]; then rubidium@10434: log 1 "configure: error: invalid option --endian=$endian" rubidium@10434: log 1 " PREPROCESSOR is only available for OSX" truelight@7424: exit 1 truelight@7424: fi rubidium@10385: # OS only allows DETECT, UNIX, OSX, FREEBSD, OPENBSD, MORPHOS, BEOS, SUNOS, CYGWIN, MINGW, OS2, DOS, WINCE, and PSP rubidium@10385: if [ -z "`echo $os | egrep '^(DETECT|UNIX|OSX|FREEBSD|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|SUNOS|CYGWIN|MINGW|OS2|DOS|WINCE|PSP)$'`" ]; then rubidium@10434: log 1 "configure: error: invalid option --os=$os" rubidium@10434: log 1 " Available options are: --os=[DETECT|UNIX|OSX|FREEBSD|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|SUNOS|CYGWIN|MINGW|OS2|DOS|WINCE|PSP]" rubidium@5475: exit 1 rubidium@5475: fi rubidium@6938: # cpu_type can be either 32 or 64 maedhros@6980: if [ -z "`echo $cpu_type | egrep '^(32|64|DETECT)$'`" ]; then rubidium@10434: log 1 "configure: error: invalid option --cpu-type=$cpu_type" rubidium@10434: log 1 " Available options are: --cpu-type[=DETECT|32|64]" rubidium@6938: exit 1 rubidium@6938: fi rubidium@5475: # enable_debug should be between 0 and 4 maedhros@6980: if [ -z "`echo $enable_debug | egrep '^[0123]$'`" ]; then rubidium@10434: log 1 "configure: error: invalid option --enable-debug=$enable_debug" rubidium@10434: log 1 " Available options are: --enable-debug[=0123]" rubidium@5475: exit 1 rubidium@5475: fi rubidium@5475: rubidium@8080: # enable_desync_debug should be between 0 and 3 rubidium@8080: if [ -z "`echo $enable_desync_debug | egrep '^[012]$'`" ]; then rubidium@10434: log 1 "configure: error: invalid option --enable-desync-debug=$enable_desync_debug" rubidium@10434: log 1 " Available options are: --enable-desync-debug[=012]" rubidium@8080: exit 1 rubidium@8080: fi rubidium@8080: truelight@6081: detect_awk truelight@6081: rubidium@9050: detect_os rubidium@9050: rubidium@5475: check_build rubidium@5475: check_host rubidium@5475: rubidium@5475: # We might enable universal builds always on OSX targets.. but currently we don't tron@5558: # if [ "$enable_universal" = "1" ] && [ "$os" != "OSX" ]; then tron@5558: if [ "$enable_universal" = "1" ]; then rubidium@5475: enable_universal="0" rubidium@5475: fi tron@5558: if [ "$enable_universal" = "2" ] && [ "$os" != "OSX" ]; then rubidium@5475: log 1 "configure: error: --enable-universal only works on OSX" rubidium@5475: exit 1 rubidium@5475: fi tron@5558: if [ "$enable_universal" = "0" ]; then rubidium@5475: log 1 "checking universal build... no" rubidium@5475: else rubidium@5475: log 1 "checking universal build... yes" rubidium@5475: fi rubidium@5475: rubidium@5475: # Already detected by check_build truelight@5980: log 1 "checking build cc... $cc_build" truelight@5980: log 1 "checking host cc... $cc_host" rubidium@5475: rubidium@5587: check_cxx_build rubidium@5587: check_cxx_host rubidium@5475: check_windres truelight@6082: if [ "$enable_strip" != "0" ]; then truelight@6082: check_strip truelight@6082: else truelight@6082: log 1 "checking strip... disabled" truelight@6082: fi rubidium@5475: check_lipo rubidium@5475: check_makedepend rubidium@6938: detect_cputype rubidium@5475: tron@5558: if [ "$enable_static" = "1" ]; then rubidium@10385: if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "MORPHOS" ] || [ "$os" = "DOS" ]; then rubidium@5475: enable_static="2" rubidium@5475: else rubidium@5475: enable_static="0" rubidium@5475: fi rubidium@5475: fi rubidium@5475: tron@5558: if [ "$enable_static" != "0" ]; then truelight@5980: log 1 "checking static... yes" rubidium@5475: rubidium@10385: if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "OSX" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "DOS" ]; then rubidium@10385: log 1 "WARNING: static is only known to work on Windows, DOS, MacOSX and MorphOS" rubidium@5475: log 1 "WARNING: use static at your own risk on this platform" rubidium@5475: rubidium@5475: sleep 5 rubidium@5475: fi rubidium@5475: else truelight@5980: log 1 "checking static... no" rubidium@5475: fi rubidium@5475: truelight@6228: if [ "$enable_unicode" = "1" ]; then rubidium@10385: if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "DOS" ]; then truelight@6228: enable_unicode="2" truelight@6228: else truelight@6228: enable_unicode="0" truelight@6228: fi truelight@6228: fi truelight@6228: truelight@6228: if [ "$enable_unicode" != "0" ]; then truelight@6228: log 1 "checking unicode... yes" truelight@6228: else truelight@6228: log 1 "checking unicode... no" truelight@6228: fi truelight@6228: rubidium@5475: # Show what we configured tron@5558: if [ "$enable_debug" = "0" ]; then rubidium@5475: log 1 "using debug level... no" tron@5558: elif [ "$enable_profiling" != "0" ]; then rubidium@5475: log 1 "using debug level... profiling (debug level $enable_debug)" rubidium@5475: else rubidium@5475: log 1 "using debug level... level $enable_debug" rubidium@5475: fi rubidium@5475: rubidium@8080: if [ "$enable_desync_debug" = "0" ]; then rubidium@8080: log 1 "using desync debug level... no" rubidium@8080: else rubidium@8080: log 1 "using desync debug level... level $enable_desync_debug" rubidium@8080: log 1 "WARNING: desync debug functions slow down the game considerably." rubidium@8080: log 1 "WARNING: use only when you are instructed to do so" rubidium@8080: log 1 " or when you know what you are doing." rubidium@8080: rubidium@8080: sleep 5 rubidium@8080: fi rubidium@8080: rubidium@10379: detect_allegro rubidium@5475: detect_sdl rubidium@5475: detect_cocoa rubidium@5475: tron@5558: if [ "$enable_dedicated" != "0" ]; then truebrain@10264: log 1 "checking GDI video driver... dedicated server, skipping" rubidium@5475: log 1 "checking dedicated... found" rubidium@5475: tron@5558: if [ "$enable_network" = "0" ]; then rubidium@10436: log 1 "configure: error: building a dedicated server without network support is pointless" rubidium@10436: exit 1 rubidium@5475: fi rubidium@5475: else truelight@5760: if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ]; then rubidium@5475: log 1 "checking GDI video driver... found" rubidium@5475: else rubidium@5475: log 1 "checking GDI video driver... not Windows, skipping" rubidium@5475: fi rubidium@5475: rubidium@10379: if [ -z "$allegro_config" ] && [ -z "$sdl_config" ] && [ "$with_cocoa" = 0 ] && [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "WINCE" ]; then rubidium@10436: log 1 "configure: error: no video driver development files found" rubidium@10436: log 1 " If you want a dedicated server use --enable-dedicated as parameter" rubidium@10436: exit 1 rubidium@5475: else rubidium@5475: log 1 "checking dedicated... not selected" rubidium@5475: fi rubidium@5475: fi rubidium@5475: rubidium@10385: if [ "$enable_network" = "1" ] && [ "$os" = "DOS" ]; then rubidium@10385: log 1 "checking network... DOS, skipping" rubidium@10385: enable_network=0 rubidium@10385: elif [ "$enable_network" != "0" ]; then rubidium@5475: log 1 "checking network... found" rubidium@5475: else rubidium@5475: log 1 "checking network... disabled" rubidium@5475: fi rubidium@5475: tron@5558: if [ "$enable_translator" != "0" ]; then rubidium@5475: log 1 "checking translator... debug" rubidium@5485: # -t shows TODO items, normally they are muted rubidium@5485: strgen_flags="-t" rubidium@5475: else rubidium@5475: log 1 "checking translator... no" rubidium@5485: strgen_flags="" rubidium@5475: fi rubidium@5475: tron@5558: if [ "$enable_assert" != "0" ]; then rubidium@5475: log 1 "checking assert... enabled" rubidium@5475: else rubidium@5475: log 1 "checking assert... disabled" rubidium@5475: fi rubidium@5475: rubidium@10436: pre_detect_with_zlib=$with_zlib rubidium@5475: detect_zlib truebrain@10265: truebrain@10265: if [ "$with_zlib" = "0" ] || [ -z "$zlib" ]; then truebrain@10265: log 1 "WARNING: zlib was not detected or disabled" truebrain@10265: log 1 "WARNING: OpenTTD doesn't require zlib, but it does mean many features (like" truebrain@10265: log 1 "WARNING: loading most savegames/scenarios, joining most servers, loading" truebrain@10265: log 1 "WARNING: heightmaps, using PNG or using fonts, ...) will be disabled." rubidium@10436: if [ "$pre_detect_with_zlib" = "0" ]; then rubidium@10436: log 1 "WARNING: We strongly suggest you to install zlib." rubidium@10436: else rubidium@10436: log 1 "configure: error: no zlib detected" rubidium@10436: log 1 " If you want to compile without zlib use --without-zlib as parameter" rubidium@10436: exit rubidium@10436: fi truebrain@10265: fi truebrain@10265: rubidium@5475: detect_png rubidium@5475: detect_freetype rubidium@5475: detect_fontconfig rubidium@10248: detect_icu truelight@5958: detect_pspconfig truelight@6034: detect_libtimidity rubidium@5475: glx@10393: if [ "$with_direct_music" != "0" ]; then tron@5558: if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then glx@10393: if [ "$with_direct_music" != "1" ]; then rubidium@5475: log 1 "configure: error: direct-music is only supported on Win32 targets" rubidium@5475: exit 1 rubidium@5475: fi rubidium@5475: with_direct_music="0" rubidium@5475: rubidium@5475: log 1 "checking direct-music... not Windows, skipping" rubidium@5475: else rubidium@5475: check_direct_music rubidium@5475: fi rubidium@5475: fi rubidium@5475: rubidium@5475: detect_sort rubidium@5475: tron@5558: if [ "$os" = "OSX" ] && [ "$endian" = "AUTO" ]; then rubidium@5475: endian="PREPROCESSOR" rubidium@5475: fi rubidium@5475: rubidium@5475: log 1 "checking endianess... $endian" rubidium@5475: rubidium@5475: # Suppress language errors when there is a version defined, indicating a release rubidium@5475: # It just isn't pretty if any release produces warnings in the languages. tron@5558: if [ -f "$ROOT_DIR/version" ]; then rubidium@5475: lang_suppress="yes" rubidium@5475: log 1 "suppress language errors... yes" rubidium@5475: else rubidium@5475: lang_suppress="" rubidium@5475: log 1 "suppress language errors... no" rubidium@5475: fi rubidium@5475: tron@5558: if [ "$enable_debug" = "0" ] && [ "$enable_profiling" = "0" ] && [ "$enable_strip" != "0" ]; then tron@5558: if [ "$os" = "MORPHOS" ]; then rubidium@5475: strip_arg="--strip-all --strip-unneeded --remove-section .comment" tron@5558: elif [ "$os" = "OSX" ]; then rubidium@5475: strip_arg="" truelight@5559: elif [ "$os" = "OS2" ]; then truelight@5559: strip_arg="" truelight@5559: # OS2 uses strip via gcc, because it needs to be feed to emxbind truelight@5559: LDFLAGS="$LDFLAGS -s" truelight@6230: elif [ "$os" = "SUNOS" ]; then truelight@6230: # The GNU strip does know -s, the non-GNU doesn't truelight@6230: # So try to detect it (in a bit of an ugly way) truelight@6230: strip_arg="`$strip -s strip.test 2>/dev/null && echo \"-s\"`" rubidium@5475: else rubidium@5475: strip_arg="-s" rubidium@5475: fi rubidium@5475: rubidium@5475: log 1 "checking stripping... $strip $strip_arg" rubidium@5475: else rubidium@5475: strip="" rubidium@5475: log 1 "checking stripping... skipped" rubidium@5475: fi rubidium@5475: truelight@6850: if [ "$with_distcc" = "0" ]; then truelight@6850: log 1 "checking distcc... no" truelight@6850: elif [ "$with_distcc" = "1" ]; then truelight@6850: with_distcc="0" truelight@6850: truelight@6850: log 1 "checking distcc... no (only used when forced)" truelight@6850: elif [ "$with_distcc" = "2" ]; then truelight@6850: distcc="distcc" truelight@6850: else truelight@6850: distcc="$with_distcc" truelight@6850: fi truelight@6850: if [ "$with_distcc" != "0" ]; then smatz@8410: res="`$distcc --version 2>/dev/null | head -n 1 | cut -b 1-6`" truelight@6850: if [ "$res" != "distcc" ]; then rubidium@6851: distcc="" truelight@6850: log 1 "checking distcc... no" truelight@6850: if [ "$with_distcc" = "2" ]; then truelight@6850: log 1 "configure: error: no distcc detected, but was forced to be used" truelight@6850: exit 1 truelight@6850: fi truelight@6850: if [ "$with_distcc" != "1" ]; then truelight@6850: log 1 "configure: error: '$with_distcc' doesn't seem a distcc to me" truelight@6850: exit 1 truelight@6850: fi truelight@6850: fi truelight@6850: truelight@6850: log 1 "checking distcc... $distcc" truelight@6850: fi truelight@6850: rubidium@6918: if [ "$with_ccache" = "0" ]; then rubidium@6918: log 1 "checking ccache... no" rubidium@6918: elif [ "$with_ccache" = "1" ]; then rubidium@6918: with_ccache="0" rubidium@6918: rubidium@6918: log 1 "checking ccache... no (only used when forced)" rubidium@6918: elif [ "$with_ccache" = "2" ]; then rubidium@6918: ccache="ccache" rubidium@6918: else rubidium@6918: ccache="$with_ccache" rubidium@6918: fi rubidium@6918: if [ "$with_ccache" != "0" ]; then smatz@8410: res="`$ccache --version 2>/dev/null | head -n 1 | cut -b 1-6`" rubidium@6918: if [ "$res" != "ccache" ]; then rubidium@6918: ccache="" rubidium@6918: log 1 "checking ccache... no" rubidium@6918: if [ "$with_ccache" = "2" ]; then rubidium@6918: log 1 "configure: error: no ccache detected, but was forced to be used" rubidium@6918: exit 1 rubidium@6918: fi rubidium@6918: if [ "$with_ccache" != "1" ]; then rubidium@6918: log 1 "configure: error: '$with_ccache' doesn't seem a ccache to me" rubidium@6918: exit 1 rubidium@6918: fi rubidium@6918: fi rubidium@6918: rubidium@6918: log 1 "checking ccache... $ccache" rubidium@6918: fi rubidium@6918: rubidium@10385: if [ "$os" = "DOS" ]; then rubidium@10385: with_threads="0" rubidium@10385: fi rubidium@10385: tron@5558: if [ "$os" != "OSX" ] && [ "$with_osx_sysroot" != "0" ]; then tron@5558: if [ "$with_osx_sysroot" = "1" ]; then rubidium@5475: with_osx_sysroot="0" rubidium@5475: rubidium@5475: log 1 "checking OSX sysroot... not OSX, skipping" rubidium@5475: else rubidium@5475: log 1 "configure: error: --with-osx-sysroot only works if OSX is the target" rubidium@5475: exit 1 rubidium@5475: fi rubidium@5475: fi rubidium@5475: tron@5558: if [ "$with_osx_sysroot" != "0" ]; then tron@5558: if [ "$enable_universal" = "0" ] && [ "$with_osx_sysroot" != "1" ] && [ "$with_osx_sysroot" != "2" ]; then rubidium@5475: log 1 "checking OSX sysroot... $with_osx_sysroot" rubidium@5475: else rubidium@5475: # If autodetect and no universal, use system default tron@5558: if [ "$with_osx_sysroot" = "1" ] && [ "$enable_universal" = "0" ]; then rubidium@5475: log 1 "checking OSX sysroot... no (use system default)" rubidium@5475: with_osx_sysroot="0" rubidium@5475: else tron@5541: log 1 "checking OSX sysroot... automatically" rubidium@5475: with_osx_sysroot="3" rubidium@5475: fi rubidium@5475: fi rubidium@5475: else tron@5558: if [ "$os" = "OSX" ]; then rubidium@5475: log 1 "checking OSX sysroot... no (use system default)" rubidium@5475: fi rubidium@5475: fi rubidium@5475: tron@5558: if [ "$os" != "OSX" ] && [ "$with_application_bundle" != "0" ]; then tron@5558: if [ "$with_application_bundle" = "1" ]; then rubidium@5475: with_application_bundle="0" rubidium@5475: rubidium@5475: log 1 "checking OSX application bundle... not OSX, skipping" rubidium@5475: else rubidium@5475: log 1 "configure: error: --with-application-bundle only works if OSX is the target" rubidium@5475: exit 1 rubidium@5475: fi rubidium@5475: fi rubidium@5475: tron@5558: if [ "$os" = "OSX" ] && [ "$with_application_bundle" = "1" ]; then rubidium@5475: OSXAPP="OpenTTD.app" rubidium@5475: else rubidium@5475: OSXAPP="" rubidium@5475: fi rubidium@5475: tron@5558: if [ "$os" = "OSX" ]; then rubidium@5475: # Test on G5 rubidium@5475: tron@5558: if [ "$enable_osx_g5" != "0" ]; then rubidium@5475: log 1 "detecting G5... yes (forced)" rubidium@5475: else rubidium@5475: # First, are we a real OSX system, else we can't detect it truelight@6078: native=`LC_ALL=C uname | tr '[A-Z]' '[a-z]' | grep darwin` rubidium@5475: # If $host doesn't match $build , we are cross-compiling skidd13@9680: if [ -n "$native" ] && [ "$build" = "$host" ]; then rubidium@6312: $cxx_build $SRC_DIR/os/macosx/G5_detector.cpp -o G5_detector rubidium@5475: res=`./G5_detector` rubidium@5475: rm -f G5_detector tron@5558: if [ -n "$res" ]; then rubidium@5475: # This is G5, add flags for it rubidium@5475: enable_osx_g5="2" rubidium@5475: rubidium@5475: log 1 "detecting G5... yes" rubidium@5475: else rubidium@5475: enable_osx_g5="0" rubidium@5475: rubidium@5475: log 1 "detecting G5... no" rubidium@5475: fi rubidium@5475: else rubidium@5475: enable_osx_g5="0" rubidium@5475: rubidium@5475: log 1 "detecting G5... no (cross-compiling)" rubidium@5475: fi rubidium@5475: fi rubidium@5475: else tron@5558: if [ "$enable_osx_g5" != "0" ]; then rubidium@5475: log 1 "configure: error: OSX G5 selected, but not compiling for OSX" rubidium@5475: log 1 "configure: error: either select OSX as OS, or deselect OSX G5" rubidium@5475: rubidium@5475: exit 1 rubidium@5475: fi rubidium@5475: fi rubidium@6811: rubidium@6811: if [ -n "$released_version" ]; then rubidium@6811: log 1 "checking revision... release ($released_version)" rubidium@6811: if [ -n "$revision" ] && [ "$revision" != "$released_version" ]; then rubidium@6811: log 1 "WARNING: overriding of the revision is NOT possible for releases" rubidium@6811: log 1 "WARNING: the given revision is IGNORED" rubidium@6811: rubidium@6811: sleep 5 rubidium@6811: fi rubidium@6811: revision=$released_version rubidium@6811: else rubidium@6811: if [ -n "$revision" ]; then rubidium@6811: log 1 "checking revision... $revision" rubidium@6811: log 1 "WARNING: we do not advise you to use this setting" rubidium@6811: log 1 "WARNING: in most cases it is not safe for network use" rubidium@6811: log 1 "WARNING: USE WITH CAUTION!" rubidium@6811: rubidium@6811: sleep 5 rubidium@6811: elif [ -f "$ROOT_DIR/version" ]; then rubidium@6811: revision="`cat $ROOT_DIR/version`" rubidium@6811: rubidium@6811: log 1 "checking revision... $revision" rubidium@10435: elif [ -d "$ROOT_DIR/.svn" ] && [ -n "`svn help 2>/dev/null`" ]; then rubidium@6812: revision="" rubidium@6812: log 1 "checking revision... svn detection" rubidium@10435: elif [ -d "$ROOT_DIR/.git" ] && [ -n "`git help 2>/dev/null`" ]; then rubidium@6812: revision="" rubidium@6812: log 1 "checking revision... git detection" rubidium@10435: elif [ -d "$ROOT_DIR/.hg" ] && [ -n "`hg help 2>/dev/null`" ]; then rubidium@7618: revision="" rubidium@7618: log 1 "checking revision... hg detection" rubidium@6811: else rubidium@6811: revision="" rubidium@6812: log 1 "checking revision... no detection" rubidium@6812: log 1 "WARNING: there is no means to determine the version." truebrain@10200: log 1 "WARNING: please use a subversion, mercurial, or git checkout of OpenTTD." truebrain@10200: log 1 "WARNING: you can only join game servers that have been compiled without" truebrain@10200: log 1 "WARNING: version detection." rubidium@7220: log 1 "WARNING: there is a great chance you desync." rubidium@6812: log 1 "WARNING: USE WITH CAUTION!" rubidium@6811: rubidium@6812: sleep 5 rubidium@6811: fi rubidium@6811: fi rubidium@6929: skidd13@9694: if [ "$doc_dir" = "1" ]; then skidd13@9694: if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ]; then skidd13@9694: doc_dir="share/doc/openttd" skidd13@9694: else skidd13@9694: doc_dir="$data_dir/docs" skidd13@9694: fi rubidium@10217: else smatz@10239: doc_dir="`echo $doc_dir | sed 's~\([^\]\)\\\\ ~\1\\\\\\\\ ~g;s~\([^\]\) ~\1\\\\\\\\ ~g'`" skidd13@9694: fi skidd13@9694: skidd13@9694: if [ "$icon_theme_dir" = "1" ]; then skidd13@9694: if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ]; then skidd13@9694: icon_theme_dir="share/icons/hicolor" skidd13@9694: else skidd13@9694: icon_theme_dir="" skidd13@9694: fi rubidium@10217: else smatz@10239: icon_theme_dir="`echo $icon_theme_dir | sed 's~\([^\]\)\\\\ ~\1\\\\\\\\ ~g;s~\([^\]\) ~\1\\\\\\\\ ~g'`" skidd13@9694: fi skidd13@9694: rubidium@6930: if [ "$personal_dir" = "1" ]; then rubidium@10385: if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ] || [ "$os" = "DOS" ]; then rubidium@6929: personal_dir="OpenTTD" rubidium@6929: elif [ "$os" = "OSX" ]; then rubidium@6929: personal_dir="Documents/OpenTTD" rubidium@6929: else rubidium@6929: personal_dir=".openttd" rubidium@6929: fi rubidium@10217: else smatz@10239: personal_dir="`echo $personal_dir | sed 's~\([^\]\)\\\\ ~\1\\\\\\\\ ~g;s~\([^\]\) ~\1\\\\\\\\ ~g'`" rubidium@6929: fi rubidium@6929: bjarni@8273: if [ "$shared_dir" = "1" ]; then bjarni@8273: # we are using default values bjarni@8273: if [ "$os" = "OSX" ]; then bjarni@8289: shared_dir="/Library/Application\\\\ Support/OpenTTD" bjarni@8273: else bjarni@8273: shared_dir="" bjarni@8273: fi rubidium@10217: else smatz@10239: shared_dir="`echo $shared_dir | sed 's~\([^\]\)\\\\ ~\1\\\\\\\\ ~g;s~\([^\]\) ~\1\\\\\\\\ ~g'`" bjarni@8273: fi bjarni@8273: skidd13@9694: if [ "$man_dir" = "1" ]; then skidd13@9694: # add manpage on UNIX systems skidd13@9695: if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ] || [ "$os" = "OSX" ]; then skidd13@9694: man_dir="share/man/man6" skidd13@9694: else skidd13@9694: man_dir="" skidd13@9694: fi rubidium@10217: else smatz@10239: man_dir="`echo $man_dir | sed 's~\([^\]\)\\\\ ~\1\\\\\\\\ ~g;s~\([^\]\) ~\1\\\\\\\\ ~g'`" skidd13@9694: fi skidd13@9694: skidd13@9694: if [ "$menu_dir" = "1" ]; then skidd13@9687: # add a freedesktop menu item only for some UNIX systems skidd13@9687: if [ "$os" = "UNIX" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ]; then skidd13@9687: menu_dir="share/applications" skidd13@9687: else skidd13@9694: menu_dir="" skidd13@9687: fi rubidium@10217: else smatz@10239: menu_dir="`echo $menu_dir | sed 's~\([^\]\)\\\\ ~\1\\\\\\\\ ~g;s~\([^\]\) ~\1\\\\\\\\ ~g'`" skidd13@9687: fi skidd13@9687: bjarni@9727: # "set_universal_binary_flags" needs to be before "detect_iconv" bjarni@9727: set_universal_binary_flags bjarni@9727: detect_iconv bjarni@9727: rubidium@6929: if [ -n "$personal_dir" ] rubidium@6929: then rubidium@6929: log 1 "personal home directory... $personal_dir" rubidium@6929: else rubidium@6929: log 1 "personal home directory... none" rubidium@6929: fi rubidium@6929: bjarni@8273: if [ -n "$shared_dir" ] bjarni@8273: then bjarni@8273: log 1 "shared data directory... $shared_dir" bjarni@8273: else bjarni@8273: log 1 "shared data directory... none" bjarni@8273: fi bjarni@8273: rubidium@6929: if [ -n "$install_dir" ] rubidium@6929: then rubidium@6929: log 1 "installation directory... $install_dir" rubidium@6929: else rubidium@6929: log 1 "installation directory... none" rubidium@6929: fi skidd13@9685: skidd13@9694: if [ -n "$icon_theme_dir" ] skidd13@9694: then skidd13@9694: log 1 "icon theme directory... $icon_theme_dir" skidd13@9694: else skidd13@9694: log 1 "icon theme directory... none" skidd13@9694: fi skidd13@9694: skidd13@9694: if [ -n "$man_dir" ] skidd13@9694: then skidd13@9695: log 1 "manual page directory... $man_dir" skidd13@9694: else skidd13@9694: log 1 "manual page directory... none" skidd13@9694: fi skidd13@9694: skidd13@9687: if [ -n "$menu_dir" ] skidd13@9687: then skidd13@9687: log 1 "menu item directory... $menu_dir" skidd13@9687: else skidd13@9687: log 1 "menu item directory... none" skidd13@9685: fi rubidium@5475: } rubidium@5475: rubidium@5475: make_cflags_and_ldflags() { rubidium@5475: # General CFlags for BUILD rubidium@5475: CFLAGS_BUILD="" rubidium@5475: # General CFlags for HOST rubidium@7564: CFLAGS="$CFLAGS -D$os" rubidium@5475: # CFlags for HOST and C-Compiler rubidium@5475: CC_FLAGS="" rubidium@5475: # Libs to compile. In fact this is just LDFLAGS rubidium@5475: LIBS="-lstdc++" rubidium@5475: # LDFLAGS used for HOST rubidium@5475: LDFLAGS="$LDFLAGS" rubidium@5475: tron@5558: if [ $enable_debug = 0 ]; then rubidium@5475: # No debug, add default stuff rubidium@5551: OBJS_SUBDIR="release" tron@5558: if [ "$os" = "OSX" ]; then rubidium@5475: # these compilerflags makes the app run as fast as possible without making the app unstable. It works on G3 or newer rubidium@7204: CFLAGS="-O3 -funroll-loops -fsched-interblock -falign-loops=16 -falign-jumps=16 -falign-functions=16 -falign-jumps-max-skip=15 -falign-loops-max-skip=15 -mdynamic-no-pic $CFLAGS" rubidium@5475: else tron@5558: if [ "$os" = "MORPHOS" ]; then rubidium@7204: CFLAGS="-I/gg/os-include -noixemul -fstrict-aliasing -fexpensive-optimizations -mcpu=604 -fno-inline -mstring -mmultiple $CFLAGS" truelight@6046: LDFLAGS="$LDFLAGS -noixemul" rubidium@5475: fi rubidium@5475: rubidium@7204: CFLAGS="-O2 -fomit-frame-pointer $CFLAGS" rubidium@5475: fi rubidium@5551: else rubidium@5551: OBJS_SUBDIR="debug" rubidium@5475: peter1138@10024: # Each debug level reduces the optimization by a bit tron@5558: if [ $enable_debug -ge 1 ]; then rubidium@9109: CFLAGS="$CFLAGS -g -D_DEBUG -D_FORTIFY_SOURCE=2" truelight@5979: if [ "$os" = "PSP" ]; then truelight@5979: CFLAGS="$CFLAGS -G0" truelight@5979: fi rubidium@5475: fi tron@5558: if [ $enable_debug -ge 2 ]; then rubidium@5551: CFLAGS="$CFLAGS -fno-inline" rubidium@5475: fi tron@5558: if [ $enable_debug -ge 3 ]; then rubidium@5551: CFLAGS="$CFLAGS -O0" rubidium@5551: else rubidium@5551: CFLAGS="$CFLAGS -O2" rubidium@5551: fi rubidium@5551: fi rubidium@5551: tron@5558: if [ "$enable_profiling" != "0" ]; then rubidium@5551: CFLAGS="$CFLAGS -p" rubidium@5551: LDFLAGS="$LDFLAGS -pg" rubidium@5475: fi rubidium@5475: rubidium@7294: if [ "$with_threads" = "0" ]; then rubidium@7294: CFLAGS="$CFLAGS -DNO_THREADS" rubidium@7294: fi rubidium@7294: skidd13@8161: if [ `echo $cc_host | cut -c 1-3` = "icc" ]; then skidd13@8161: # Enable some things only for certain ICC versions skidd13@8161: cc_version=`$cc_host -dumpversion | cut -c 1-4` rubidium@5475: rubidium@7294: skidd13@8161: if [ "$cc_version" = "10.1" ]; then skidd13@8161: CFLAGS="$CFLAGS -Wno-multichar" skidd13@8161: fi skidd13@8161: else skidd13@8161: # Enable some things only for certain GCC versions skidd13@8161: cc_version=`$cc_host -dumpversion | cut -c 1,3` rubidium@5475: skidd13@8161: if [ $cc_version -ge 29 ]; then skidd13@8161: CFLAGS="$CFLAGS -Wall -Wno-multichar -Wsign-compare -Wundef" skidd13@8161: CFLAGS="$CFLAGS -Wwrite-strings -Wpointer-arith" rubidium@9137: CFLAGS="$CFLAGS -Wno-uninitialized" rubidium@7406: skidd13@8161: CC_CFLAGS="$CC_CFLAGS -Wstrict-prototypes" skidd13@8161: fi skidd13@8161: skidd13@8161: gcc295="" skidd13@8161: if [ "$cc_version" = 29 ]; then skidd13@8161: # Make sure we mark GCC 2.95 flag for Makefile.src.in, as we skidd13@8161: # need a lovely hack there to make it compile correctly. skidd13@8161: gcc295="1" smatz@9577: smatz@9577: # Disable warnings about unused variables when smatz@9577: # compiling with asserts disabled smatz@9577: if [ $enable_assert -eq 0 ]; then smatz@9577: CFLAGS="$CFLAGS -Wno-unused" smatz@9577: fi skidd13@8161: fi skidd13@8161: skidd13@8161: if [ $cc_version -ge 30 ]; then rubidium@9097: CFLAGS="$CFLAGS -W -Wno-unused-parameter -Wformat=2" rubidium@9137: CFLAGS="$CFLAGS -Wredundant-decls" smatz@9436: # Do not warn about unused variables when building without asserts smatz@9436: if [ $enable_assert -eq 0 ]; then smatz@9436: CFLAGS="$CFLAGS -Wno-unused-variable" smatz@9436: fi skidd13@8161: fi skidd13@8161: skidd13@8161: if [ $cc_version -ge 34 ]; then skidd13@8161: CC_CFLAGS="$CC_CFLAGS -Wdeclaration-after-statement -Wold-style-definition" skidd13@8161: fi skidd13@8161: skidd13@8161: if [ "$os" = "CYGWIN" ]; then skidd13@8161: CFLAGS="$CFLAGS -mwin32" skidd13@8161: LDFLAGS="$LDFLAGS -mwin32" skidd13@8161: fi skidd13@8161: if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then skidd13@8161: CFLAGS="$CFLAGS -mno-cygwin" skidd13@8161: LDFLAGS="$LDFLAGS -mno-cygwin" skidd13@8161: fi skidd13@8161: skidd13@8161: if [ "$os" = "CYGWIN" ] || [ "$os" = "MINGW" ]; then skidd13@8161: LDFLAGS="$LDFLAGS -Wl,--subsystem,windows" skidd13@8161: LIBS="$LIBS -lws2_32 -lwinmm -lgdi32 -ldxguid -lole32" skidd13@8161: fi skidd13@8161: skidd13@8161: # GCC 4.0+ complains about that we break strict-aliasing. skidd13@8161: # On most places we don't see how to fix it, and it doesn't skidd13@8161: # break anything. So disable strict-aliasing to make the skidd13@8161: # compiler all happy. skidd13@8161: if [ $cc_version -ge 40 ]; then skidd13@8161: CFLAGS="$CFLAGS -fno-strict-aliasing" skidd13@8161: fi skidd13@8161: skidd13@8161: # GCC 4.2+ automatically assumes that signed overflows do skidd13@8161: # not occur in signed arithmetics, whereas we are not skidd13@8161: # sure that they will not happen. It furthermore complains skidd13@8161: # about it's own optimized code in some places. skidd13@8161: if [ $cc_version -ge 42 ]; then skidd13@8161: CFLAGS="$CFLAGS -fno-strict-overflow" skidd13@8161: fi smatz@8128: fi smatz@8128: rubidium@10385: if [ "$os" != "CYGWIN" ] && [ "$os" != "FREEBSD" ] && [ "$os" != "OPENBSD" ] && [ "$os" != "MINGW" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "OSX" ] && [ "$os" != "DOS" ] && [ "$os" != "WINCE" ] && [ "$os" != "PSP" ] && [ "$os" != "OS2" ]; then rubidium@5475: LIBS="$LIBS -lpthread" rubidium@5475: fi rubidium@5475: rubidium@10385: if [ "$os" != "CYGWIN" ] && [ "$os" != "MINGW" ] && [ "$os" != "DOS" ] && [ "$os" != "WINCE" ]; then rubidium@5475: LIBS="$LIBS -lc" rubidium@5475: fi truelight@5753: if [ "$os" = "WINCE" ]; then truelight@5762: LIBS="$LIBS -lcoredll -lcorelibc -laygshell -lws2 -e WinMainCRTStartup" truelight@5753: fi truelight@5960: if [ "$os" = "PSP" ]; then truelight@5960: CFLAGS="$CFLAGS -I`$psp_config -p`/include" truelight@5960: LDFLAGS="$LDFLAGS -L`$psp_config -p`/lib" truelight@5979: truelight@5979: CFLAGS="$CFLAGS -fno-exceptions -fno-rtti -D_PSP_FW_VERSION=150" truelight@5979: LIBS="$LIBS -D_PSP_FW_VERSION=150 -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -lm" truelight@5960: fi rubidium@5475: tron@5558: if [ "$os" = "MORPHOS" ]; then rubidium@5475: # -Wstrict-prototypes generates much noise because of system headers rubidium@5475: CFLAGS="$CFLAGS -Wno-strict-prototypes" rubidium@5475: fi rubidium@5475: peter1138@6673: if [ "$os" = "OPENBSD" ]; then peter1138@6673: LIBS="$LIBS -pthread" peter1138@6673: fi peter1138@6673: maedhros@7719: if [ "$os" = "FREEBSD" ]; then maedhros@7719: LIBS="$LIBS -lpthread" maedhros@7719: fi maedhros@7719: tron@5558: if [ "$os" = "OSX" ]; then rubidium@5475: LDFLAGS="$LDFLAGS -framework Cocoa" tron@5558: if [ "$enable_dedicated" = "0" ]; then rubidium@5475: LIBS="$LIBS -framework QuickTime" rubidium@5475: fi rubidium@5475: fi rubidium@5475: tron@5558: if [ "$os" = "BEOS" ]; then rubidium@5475: LIBS="$LIBS -lmidi -lbe" rubidium@5475: fi rubidium@5475: rubidium@5475: # Most targets act like UNIX, just with some additions rubidium@9072: if [ "$os" = "BEOS" ] || [ "$os" = "OSX" ] || [ "$os" = "MORPHOS" ] || [ "$os" = "FREEBSD" ] || [ "$os" = "OPENBSD" ] || [ "$os" = "NETBSD" ] || [ "$os" = "HPUX" ] || [ "$os" = "SUNOS" ] || [ "$os" = "OS2" ]; then rubidium@5475: CFLAGS="$CFLAGS -DUNIX" rubidium@5475: fi rubidium@5475: # And others like Windows truelight@5753: if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ]; then rubidium@5475: CFLAGS="$CFLAGS -DWIN" rubidium@5475: fi rubidium@5475: rubidium@10379: if [ -n "$allegro_config" ]; then rubidium@10379: CFLAGS="$CFLAGS -DWITH_ALLEGRO" rubidium@10379: CFLAGS="$CFLAGS `$allegro_config --cflags`" rubidium@10379: if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "WINCE" ]; then rubidium@10379: if [ "$enable_static" != "0" ]; then rubidium@10379: LIBS="$LIBS `$allegro_config --static --libs`" rubidium@10379: else rubidium@10379: LIBS="$LIBS `$allegro_config --libs`" rubidium@10379: fi rubidium@10379: fi rubidium@10379: fi rubidium@10379: tron@5558: if [ -n "$sdl_config" ]; then rubidium@5475: CFLAGS="$CFLAGS -DWITH_SDL" rubidium@5475: CFLAGS="$CFLAGS `$sdl_config --cflags`" glx@6249: if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "WINCE" ]; then glx@6249: if [ "$enable_static" != "0" ]; then glx@6249: LIBS="$LIBS `$sdl_config --static-libs`" glx@6249: else glx@6249: LIBS="$LIBS `$sdl_config --libs`" glx@6249: fi rubidium@5475: fi rubidium@5475: fi rubidium@5475: tron@5558: if [ "$with_cocoa" != "0" ]; then rubidium@5475: CFLAGS="$CFLAGS -DWITH_COCOA" rubidium@5475: LIBS="$LIBS -F/System/Library/Frameworks -framework Cocoa -framework Carbon -framework AudioUnit" egladil@8092: egladil@8092: if [ "$enable_cocoa_quartz" != "0" ]; then egladil@8092: CFLAGS="$CFLAGS -DENABLE_COCOA_QUARTZ" egladil@8092: fi egladil@8092: egladil@8092: if [ "$enable_cocoa_quickdraw" != "0" ]; then egladil@8092: CFLAGS="$CFLAGS -DENABLE_COCOA_QUICKDRAW" egladil@8092: fi rubidium@5475: fi rubidium@5475: tron@5558: if [ "$with_zlib" != "0" ]; then tron@5558: if [ "$enable_static" != "0" ] && [ "$os" != "OSX" ]; then rubidium@5475: LIBS="$LIBS $zlib" rubidium@5475: else rubidium@5475: LIBS="$LIBS -lz" rubidium@5475: fi rubidium@5475: CFLAGS="$CFLAGS -DWITH_ZLIB" rubidium@5475: fi rubidium@5475: tron@5558: if [ -n "$png_config" ]; then rubidium@5475: CFLAGS="$CFLAGS -DWITH_PNG" rubidium@5475: CFLAGS="$CFLAGS `$png_config --cppflags --I_opts | tr '\n\r' ' '`" rubidium@5475: rubidium@5475: # The extra flags are unneeded for latest libpng-config, but some versions are so broken... tron@5558: if [ "$enable_static" != "0" ]; then tron@5558: if [ "$os" = "OSX" ]; then rubidium@5475: LIBS="$LIBS `$png_config --prefix`/lib/libpng.a" rubidium@5475: else truelight@6242: LIBS="$LIBS `$png_config --static --ldflags | tr '\n\r' ' '`" rubidium@5475: fi rubidium@5475: else truelight@6242: LIBS="$LIBS `$png_config --ldflags | tr '\n\r' ' '`" rubidium@5475: fi rubidium@5475: fi rubidium@5475: truelight@6241: if [ -n "$fontconfig_config" ]; then truelight@6241: CFLAGS="$CFLAGS -DWITH_FONTCONFIG" truelight@6241: CFLAGS="$CFLAGS `$fontconfig_config --cflags | tr '\n\r' ' '`" truelight@6241: truelight@6241: if [ "$enable_static" != "0" ]; then truelight@6241: if [ "$os" = "OSX" ]; then truelight@6243: # fontconfig_config goes via pkg-config on all systems, which doesn't know --prefix truelight@6244: # Also, despite the reason we link to the .a file ourself (because we can't use -static), we do need to ask pkg-config about possible other deps smatz@10239: LIBS="$LIBS `$fontconfig_config --variable=prefix`/lib/libfontconfig.a `$fontconfig_config --libs --static | sed s~-lfontconfig~~`" truelight@6241: else truelight@6241: LIBS="$LIBS `$fontconfig_config --libs --static | tr '\n\r' ' '`" truelight@6241: fi truelight@6241: else truelight@6241: LIBS="$LIBS `$fontconfig_config --libs | tr '\n\r' ' '`" truelight@6241: fi truelight@6241: fi truelight@6241: tron@5558: if [ -n "$freetype_config" ]; then rubidium@5475: CFLAGS="$CFLAGS -DWITH_FREETYPE" rubidium@5475: CFLAGS="$CFLAGS `$freetype_config --cflags | tr '\n\r' ' '`" rubidium@5475: tron@5558: if [ "$enable_static" != "0" ]; then tron@5558: if [ "$os" = "OSX" ]; then rubidium@5475: LIBS="$LIBS `$freetype_config --prefix`/lib/libfreetype.a" rubidium@5475: else rubidium@5475: # Is it possible to do static with freetype, if so: how? rubidium@5475: LIBS="$LIBS `$freetype_config --libs | tr '\n\r' ' '`" rubidium@5475: fi rubidium@5475: else rubidium@5475: LIBS="$LIBS `$freetype_config --libs | tr '\n\r' ' '`" rubidium@5475: fi rubidium@5475: fi rubidium@5475: rubidium@10248: if [ -n "$icu_config" ]; then rubidium@10248: CFLAGS="$CFLAGS -DWITH_ICU" rubidium@10248: CFLAGS="$CFLAGS `$icu_config --cppflags | tr '\n\r' ' '`" rubidium@10248: rubidium@10248: LIBS="$LIBS `$icu_config --ldflags-libsonly | tr '\n\r' ' '`" rubidium@10248: fi rubidium@10248: rubidium@10248: tron@5558: if [ "$with_direct_music" != "0" ]; then rubidium@5475: CFLAGS="$CFLAGS -DWIN32_ENABLE_DIRECTMUSIC_SUPPORT" truelight@6191: # GCC 4.0+ doesn't like the DirectX includes (gives tons of truelight@6191: # warnings on it we won't be able to fix). For now just truelight@6191: # suppress those warnings. truelight@6191: if [ $cc_version -ge 40 ]; then truelight@6191: CFLAGS="$CFLAGS -Wno-non-virtual-dtor" truelight@6191: fi rubidium@5475: fi rubidium@5475: truelight@6035: if [ -n "$libtimidity" ]; then truelight@6034: if [ "$enable_static" != "0" ]; then truelight@6034: LIBS="$LIBS $libtimidity" truelight@6034: else truelight@6034: LIBS="$LIBS -ltimidity" truelight@6034: fi truelight@6034: CFLAGS="$CFLAGS -DLIBTIMIDITY" truelight@6034: fi truelight@6034: tron@5558: if [ "$with_iconv" != "0" ]; then rubidium@5475: CFLAGS="$CFLAGS -DWITH_ICONV" rubidium@10277: if [ "$link_to_iconv" = "yes" ]; then rubidium@10277: LIBS="$LIBS -liconv" rubidium@10277: if [ "$with_iconv" != "2" ]; then rubidium@10277: CFLAGS="$CFLAGS -I$with_iconv/include" rubidium@10277: LIBS="$LIBS -L$with_iconv/lib" rubidium@10277: fi rubidium@5475: fi egladil@7839: egladil@7839: if [ "$have_broken_iconv" != "no" ]; then egladil@7839: CFLAGS="$CFLAGS -DHAVE_BROKEN_ICONV" egladil@7839: fi rubidium@5475: fi rubidium@5475: tron@5558: if [ -n "$with_midi" ]; then glx@5549: CFLAGS="$CFLAGS -DEXTERNAL_PLAYER=\\\\\"$with_midi\\\\\"" rubidium@5475: fi tron@5558: if [ -n "$with_midi_arg" ]; then glx@5549: CFLAGS="$CFLAGS -DMIDI_ARG=\\\\\"$with_midi_arg\\\\\"" rubidium@5475: fi rubidium@5475: tron@5558: if [ "$enable_dedicated" != "0" ]; then rubidium@5475: CFLAGS="$CFLAGS -DDEDICATED" rubidium@5475: fi rubidium@5475: truelight@6228: if [ "$enable_unicode" != "0" ]; then truelight@6228: CFLAGS="$CFLAGS -DUNICODE -D_UNICODE" truelight@6228: fi truelight@6228: tron@5558: if [ "$enable_network" != "0" ]; then rubidium@5475: CFLAGS="$CFLAGS -DENABLE_NETWORK" rubidium@5475: tron@5558: if [ "$os" = "BEOS" ]; then rubidium@5475: LDFLAGS="$LDFLAGS -lbind -lsocket" rubidium@5475: fi rubidium@5475: tron@5558: if [ "$os" = "SUNOS" ]; then rubidium@5475: LDFLAGS="$LDFLAGS -lnsl -lsocket" rubidium@5475: fi rubidium@5475: fi rubidium@5475: tron@5558: if [ "$enable_static" != "0" ]; then rubidium@5475: # OSX can't handle -static in LDFLAGS tron@5558: if [ "$os" != "OSX" ]; then rubidium@5475: LDFLAGS="$LDFLAGS -static" rubidium@5475: fi rubidium@5475: fi rubidium@5475: tron@5558: if [ "$enable_assert" = "0" ]; then rubidium@5475: CFLAGS="$CFLAGS -DNDEBUG" rubidium@5475: fi rubidium@5475: rubidium@8080: if [ "$enable_desync_debug" = "1" ]; then rubidium@8080: CFLAGS="$CFLAGS -DDEBUG_DUMP_COMMANDS" rubidium@8080: fi rubidium@8080: if [ "$enable_desync_debug" = "2" ]; then rubidium@8080: CFLAGS="$CFLAGS -DRANDOM_DEBUG" rubidium@8080: fi rubidium@8080: tron@5558: if [ "$enable_osx_g5" != "0" ]; then rubidium@5475: CFLAGS="$CFLAGS -mtune=970 -mcpu=970 -mpowerpc-gpopt" rubidium@5475: fi rubidium@5475: rubidium@6929: if [ -n "$personal_dir" ]; then rubidium@6929: CFLAGS="$CFLAGS -DWITH_PERSONAL_DIR -DPERSONAL_DIR=\\\\\"$personal_dir\\\\\"" rubidium@5475: fi rubidium@5475: bjarni@8273: if [ -n "$shared_dir" ]; then bjarni@8273: CFLAGS="$CFLAGS -DWITH_SHARED_DIR -DSHARED_DIR=\\\\\"$shared_dir\\\\\"" bjarni@8273: fi bjarni@8273: rubidium@6929: CFLAGS="$CFLAGS -DGLOBAL_DATA_DIR=\\\\\"$prefix_dir/$data_dir\\\\\"" rubidium@5475: rubidium@5475: log 1 "using CFLAGS... $CFLAGS $CC_CFLAGS" rubidium@5475: log 1 "using LDFLAGS... $LIBS $LDFLAGS" rubidium@5475: rubidium@5475: # Makedepend doesn't like something like: -isysroot /OSX/blabla rubidium@5475: # so convert it to: -isysroot -OSX/blabla. makedepend just ignores rubidium@5475: # any - command it doesn't know, so we are pretty save. rubidium@5475: # Lovely hackish, not? rubidium@5475: # Btw, this almost always comes from outside the configure, so it is rubidium@5475: # not something we can control. tron@5558: if [ "$with_makedepend" != "0" ]; then smatz@10239: cflags_makedep="` echo "$CFLAGS" | sed 's~ /~ -~g'`" rubidium@5475: else rubidium@5475: makedepend="" rubidium@5475: fi truelight@6850: truelight@6850: if [ "$with_distcc" != "0" ]; then truelight@6850: cc_host="$distcc $cc_host" truelight@6850: cxx_host="$distcc $cxx_host" truelight@6850: log 1 "" truelight@6850: log 1 " NOTICE: remind yourself to use 'make -jN' to make use of distcc" truelight@6850: log 1 "" truelight@6850: fi rubidium@6918: rubidium@6918: if [ "$with_ccache" != "0" ]; then rubidium@6918: cc_host="$ccache $cc_host" rubidium@6918: cxx_host="$ccache $cxx_host" rubidium@6918: fi rubidium@5475: } rubidium@5475: rubidium@5475: check_compiler() { rubidium@5475: # Params: rubidium@5475: # $1 - Type for message (build / host) rubidium@5475: # $2 - What to fill with the found compiler rubidium@5475: # $3 - System to try rubidium@5475: # $4 - Compiler to try rubidium@5475: # $5 - Env-setting to try rubidium@5475: # $6 - GCC alike to try rubidium@5475: # $7 - CC alike to try rubidium@5475: # $8 - "0" gcc, "1" g++, "2" windres, "3" strip, "4" lipo rubidium@5475: # $9 - What the command is to check for rubidium@5475: tron@5558: if [ -n "$3" ]; then rubidium@5475: # Check for system truelight@5981: if [ -z "$6" ]; then truelight@5981: compiler="$3" truelight@5981: else truelight@5981: compiler="$3-$6" truelight@5981: fi truelight@5981: machine=`eval $compiler $9 2>/dev/null` rubidium@5475: ret=$? truelight@5981: eval "$2=$compiler" rubidium@5475: truelight@5981: log 2 "executing $compiler $9" rubidium@5475: log 2 " returned $machine" rubidium@5475: log 2 " exit code $ret" rubidium@5475: tron@5558: if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ]; then truelight@5981: log 1 "checking $1... $compiler not found" rubidium@5475: log 1 "I couldn't detect any $6 binary for $3" rubidium@5475: exit 1 rubidium@5475: fi rubidium@5475: tron@5558: if [ "$machine" != "$3" ] && ( [ "$8" = "0" ] || [ "$8" = "1" ] ); then rubidium@5475: log 1 "checking $1... expected $3, found $machine" rubidium@5475: log 1 "the compiler suggests it doesn't build code for the machine you specified" rubidium@5475: exit 1 rubidium@5475: fi tron@5558: elif [ -n "$4" ]; then rubidium@5475: # Check for manual compiler rubidium@5475: machine=`$4 $9 2>/dev/null` rubidium@5475: ret=$? rubidium@5475: eval "$2=$4" rubidium@5475: rubidium@5475: log 2 "executing $4 $9" rubidium@5475: log 2 " returned $machine" rubidium@5475: log 2 " exit code $ret" rubidium@5475: tron@5558: if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ]; then rubidium@5475: log 1 "checking $1... $4 not found" rubidium@5475: log 1 "the selected binary doesn't seem to be a $6 binary" rubidium@5475: exit 1 rubidium@5475: fi rubidium@5475: else rubidium@5475: # Nothing given, autodetect rubidium@5475: tron@5558: if [ -n "$5" ]; then rubidium@5475: machine=`$5 $9 2>/dev/null` rubidium@5475: ret=$? rubidium@5475: eval "$2=$5" rubidium@5475: rubidium@5475: log 2 "executing $5 $9" rubidium@5475: log 2 " returned $machine" rubidium@5475: log 2 " exit code $ret" rubidium@5475: rubidium@5475: # The user defined a GCC that doesn't reply to $9.. abort tron@5558: if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ]; then rubidium@5475: log 1 "checking $1... $5 unusable" rubidium@5475: log 1 "the CC environment variable is set, but it doesn't seem to be a $6 binary" rubidium@5475: log 1 "please redefine the CC/CXX environment to a $6 binary" rubidium@5475: exit 1 rubidium@5475: fi rubidium@5475: else rubidium@5475: log 2 "checking $1... CC/CXX not set (skipping)" rubidium@5475: rubidium@5475: # No $5, so try '$6' rubidium@5475: machine=`$6 $9 2>/dev/null` rubidium@5475: ret=$? rubidium@5475: eval "$2=$6" rubidium@5475: rubidium@5475: log 2 "executing $6 $9" rubidium@5475: log 2 " returned $machine" rubidium@5475: log 2 " exit code $ret" rubidium@5475: tron@5558: if ( [ -z "$machine" ] && [ "$8" != "3" ] ) || [ "$ret" != "0" ]; then rubidium@5475: # Maybe '$7'? rubidium@5475: machine=`$7 $9 2>/dev/null` rubidium@5475: ret=$? rubidium@5475: eval "$2=$7" rubidium@5475: rubidium@5475: log 2 "executing $7 $9" rubidium@5475: log 2 " returned $machine" rubidium@5475: log 2 " exit code $ret" rubidium@5475: rubidium@5475: # All failed, abort tron@5558: if [ -z "$machine" ]; then rubidium@5475: log 1 "checking $1... $6 not found" rubidium@5475: log 1 "I couldn't detect any $6 binary on your system" rubidium@5475: log 1 "please define the CC/CXX environment to where it is located" rubidium@5475: rubidium@5475: exit 1 rubidium@5475: fi rubidium@5475: fi rubidium@5475: fi rubidium@5475: fi rubidium@5475: tron@5558: if [ "$8" != "0" ]; then rubidium@5475: eval "res=\$$2" rubidium@5475: log 1 "checking $1... $res" rubidium@5475: else rubidium@5475: log 1 "checking $1... $machine" rubidium@5475: fi rubidium@5475: } rubidium@5475: rubidium@5475: check_build() { rubidium@9050: if [ "$os" = "FREEBSD" ]; then rubidium@9050: # FreeBSD's C compiler does not support dump machine. rubidium@9050: # However, removing C support is not possible because PSP must be linked with the C compiler. rubidium@9050: check_compiler "build system type" "cc_build" "$build" "$cc_build" "$CXX" "g++" "c++" "0" "-dumpmachine" rubidium@9050: else rubidium@9050: check_compiler "build system type" "cc_build" "$build" "$cc_build" "$CC" "gcc" "cc" "0" "-dumpmachine" rubidium@9050: fi rubidium@5475: } rubidium@5475: rubidium@5475: check_host() { rubidium@5475: # By default the host is the build rubidium@5475: if [ -z "$host" ]; then host="$build"; fi rubidium@9050: rubidium@9050: if [ "$os" = "FREEBSD" ]; then rubidium@9050: # FreeBSD's C compiler does not support dump machine. rubidium@9050: # However, removing C support is not possible because PSP must be linked with the C compiler. rubidium@9050: check_compiler "host system type" "cc_host" "$host" "$cc_host" "$CXX" "g++" "c++" "0" "-dumpmachine" rubidium@9050: else rubidium@9050: check_compiler "host system type" "cc_host" "$host" "$cc_host" "$CC" "gcc" "cc" "0" "-dumpmachine" rubidium@9050: fi rubidium@5475: } rubidium@5475: rubidium@5587: check_cxx_build() { truelight@5980: check_compiler "build c++" "cxx_build" "$build" "$cxx_build" "$CXX" "g++" "c++" 1 "-dumpmachine" rubidium@5587: } rubidium@5587: rubidium@5587: check_cxx_host() { rubidium@5587: # By default the host is the build rubidium@5587: if [ -z "$host" ]; then host="$build"; fi truelight@5980: check_compiler "host c++" "cxx_host" "$host" "$cxx_host" "$CXX" "g++" "c++" 1 "-dumpmachine" rubidium@5475: } rubidium@5475: rubidium@5475: check_windres() { truelight@5753: if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ]; then rubidium@5475: check_compiler "host windres" "windres" "$host" "$windres" "$WINDRES" "windres" "windres" "2" "-V" rubidium@5475: fi rubidium@5475: } rubidium@5475: rubidium@5475: check_strip() { truelight@5559: if [ "$os" = "OS2" ]; then truelight@5559: # OS2 via gcc is a bit weird.. stripping HAS to be done via emxbind, which is via gcc directly rubidium@10434: log 1 "checking host strip... using gcc -s option" truelight@5559: elif [ "$os" = "OSX" ]; then rubidium@5475: # Most targets have -V in strip, to see if they exists... OSX doesn't.. so execute something rubidium@5475: echo "int main(int argc, char *argv[]) { }" > strip.test.c rubidium@5475: $cc_host strip.test.c -o strip.test rubidium@5475: check_compiler "host strip" "strip" "$host" "$strip" "$STRIP" "strip" "strip" "3" "strip.test" rubidium@5475: rm -f strip.test.c strip.test rubidium@5475: else rubidium@5475: check_compiler "host strip" "strip" "$host" "$strip" "$STRIP" "strip" "strip" "3" "-V" rubidium@5475: fi rubidium@5475: } rubidium@5475: rubidium@5475: check_lipo() { tron@5558: if [ "$os" = "OSX" ] && [ "$enable_universal" != "0" ]; then rubidium@5475: echo "int main(int argc, char *argv[]) { }" > lipo.test.c rubidium@5475: $cc_host lipo.test.c -o lipo.test rubidium@5475: check_compiler "host lipo" "lipo" "$host" "$lipo" "$LIPO" "lipo" "lipo" "4" "-info lipo.test" rubidium@5475: rm -f lipo.test.c lipo.test rubidium@5475: fi rubidium@5475: } rubidium@5475: bjarni@9727: set_universal_binary_flags() { bjarni@9756: if [ -z "$osx_target_version" ]; then bjarni@9727: # if we don't speficy a target version then we presume 10.4 bjarni@9727: osx_target_version=10.4 bjarni@9727: fi bjarni@9727: bjarni@9727: if [ "$osx_target_version" = "10.4" ]; then bjarni@9756: # Apple added u to 10.4 to show that it's universal bjarni@9756: # There is a version without the u, but it's only in Xcode 2.0 and people should use the free update to 2.5 bjarni@9727: osx_sysroot_version=10.4u bjarni@9727: else bjarni@9727: osx_sysroot_version="$osx_target_version" bjarni@9727: fi bjarni@9727: bjarni@9727: if [ "$with_osx_sysroot" = "3" ]; then bjarni@9727: CFLAGS="$CFLAGS -isysroot /Developer/SDKs/MacOSX$osx_sysroot_version.sdk -mmacosx-version-min=$osx_target_version" bjarni@9727: LDFLAGS="$LDFLAGS -Wl,-syslibroot,/Developer/SDKs/MacOSX$osx_sysroot_version.sdk -mmacosx-version-min=$osx_target_version" bjarni@9727: fi bjarni@9727: } bjarni@9727: rubidium@5475: check_direct_music() { rubidium@5475: echo " rubidium@5475: #include rubidium@5475: #include rubidium@5475: #include rubidium@5475: #include rubidium@5475: #include rubidium@5475: int main(int argc, char *argv[]) { }" > direct_music.test.c rubidium@5475: $cxx_host $CFLAGS direct_music.test.c -o direct_music.test 2> /dev/null rubidium@5475: res=$? rubidium@5475: rm -f direct_music.test.c direct_music.test rubidium@5475: tron@5558: if [ "$res" != "0" ]; then glx@10393: if [ "$with_direct_music" != "1" ]; then rubidium@5475: log 1 "configure: error: direct-music is not available on this system" rubidium@5475: exit 1 rubidium@5475: fi rubidium@5475: with_direct_music="0" rubidium@5475: rubidium@5475: log 1 "checking direct-music... not found" rubidium@5475: else rubidium@5475: log 1 "checking direct-music... found" rubidium@5475: fi rubidium@5475: } rubidium@5475: rubidium@5475: check_makedepend() { tron@5558: if [ "$with_makedepend" = "0" ]; then rubidium@5475: log 1 "checking makedepend... disabled" rubidium@5475: return rubidium@5475: fi rubidium@5475: tron@5558: if [ "$with_makedepend" = "1" ] || [ "$with_makedepend" = "2" ]; then rubidium@5475: makedepend="makedepend" rubidium@5475: else rubidium@5475: makedepend="$with_makedepend" rubidium@5475: fi rubidium@5475: rubidium@5475: rm -f makedepend.tmp rubidium@5475: touch makedepend.tmp rubidium@5475: res=`$makedepend -fmakedepend.tmp 2>/dev/null` rubidium@5475: res=$? rubidium@5475: log 2 "executing $makedepend -f makedepend.tmp" rubidium@5475: log 2 " returned `cat makedepend.tmp`" rubidium@5475: log 2 " exit code $ret" rubidium@5475: tron@5558: if [ ! -s makedepend.tmp ]; then rubidium@5475: rm -f makedepend.tmp makedepend.tmp.bak rubidium@5475: tron@5558: if [ "$with_makedepend" = "2" ]; then rubidium@5475: log 1 "checking makedepend... not found" rubidium@5475: rubidium@5475: log 1 "I couldn't detect any makedepend on your system" rubidium@5475: log 1 "please locate it via --makedepend=[binary]" rubidium@5475: rubidium@5475: exit 1 tron@5558: elif [ "$with_makedepend" != "1" ]; then rubidium@5475: log 1 "checking makedepend... $makedepend not found" rubidium@5475: rubidium@5475: log 1 "the selected file doesn't seem to be a valid makedepend binary" rubidium@5475: rubidium@5475: exit 1 rubidium@5475: else rubidium@5475: log 1 "checking makedepend... not found" rubidium@5475: rubidium@5475: with_makedepend="0" rubidium@5475: return rubidium@5475: fi rubidium@5475: fi rubidium@5475: rubidium@5475: rm -f makedepend.tmp makedepend.tmp.bak rubidium@5475: rubidium@5475: log 1 "checking makedepend... $makedepend" rubidium@5475: } rubidium@5475: truelight@6081: detect_awk() { truelight@6081: # Not all awks allow gsub(), so we test for that here! It is in fact all we need... truelight@6081: truelight@6081: # These awks are known to work. Test for them explicit truelight@6081: awks="gawk mawk nawk" truelight@6081: truelight@6081: awk_prefix="echo \"a.c b.c c.c\" | tr ' ' \\\\n | " truelight@6081: awk_param="' { ORS = \" \" } /\.c$/ { gsub(\".c$\", \".o\", \$0); print \$0; }' 2>/dev/null" truelight@6081: awk_result="a.o b.o c.o " truelight@6081: log 2 "Detecing awk..." truelight@6081: truelight@6081: log 2 "Trying: $awk_prefix $awk $awk_param" truelight@6081: res=`eval $awk_prefix $awk $awk_param` truelight@6081: log 2 "Result: '$res'" truelight@6081: if [ "$res" != "$awk_result" ] && [ "$awk" = "awk" ]; then truelight@6081: # User didn't supply his own awk, so try to detect some other known working names for an awk truelight@6081: for awk in $awks; do truelight@6081: log 2 "Trying: $awk_prefix $awk $awk_param" truelight@6081: res=`eval $awk_prefix $awk $awk_param` truelight@6081: log 2 "Result: '$res'" truelight@6081: if [ "$res" = "$awk_result" ]; then break; fi truelight@6081: done truelight@6081: truelight@6081: if [ "$res" != "$awk_result" ]; then truelight@6081: log 1 "checking awk... not found" truelight@6081: log 1 "configure: error: no awk found" truelight@6081: log 1 "configure: error: please install one of the following: $awks" truelight@6081: exit 1 truelight@6081: fi truelight@6081: fi truelight@6081: if [ "$res" != "$awk_result" ]; then truelight@6081: log 1 "checking awk... not found" truelight@6081: log 1 "configure: error: you supplied '$awk' but it doesn't seem a valid gawk or mawk" truelight@6081: exit 1 truelight@6081: fi truelight@6081: truelight@6081: log 1 "checking awk... $awk" truelight@6081: } truelight@6081: rubidium@5475: detect_os() { truelight@6077: if [ "$os" = "DETECT" ]; then rubidium@10385: # Detect UNIX, OSX, FREEBSD, OPENBSD, NETBSD, HPUX, MORPHOS, BEOS, SUNOS, CYGWIN, MINGW, OS2, DOS, WINCE, and PSP rubidium@5475: rubidium@5475: # Try first via dumpmachine, then via uname truelight@6081: os=`echo "$host" | tr '[A-Z]' '[a-z]' | $awk ' rubidium@5475: /linux/ { print "UNIX"; exit} rubidium@5475: /darwin/ { print "OSX"; exit} rubidium@5475: /freebsd/ { print "FREEBSD"; exit} peter1138@6673: /openbsd/ { print "OPENBSD"; exit} rubidium@9072: /netbsd/ { print "NETBSD"; exit} rubidium@9072: /hp-ux/ { print "HPUX"; exit} rubidium@5475: /morphos/ { print "MORPHOS"; exit} rubidium@5475: /beos/ { print "BEOS"; exit} rubidium@5475: /sunos/ { print "SUNOS"; exit} truelight@6220: /solaris/ { print "SUNOS"; exit} rubidium@5475: /cygwin/ { print "CYGWIN"; exit} rubidium@5475: /mingw/ { print "MINGW"; exit} truelight@5539: /os2/ { print "OS2"; exit} rubidium@10385: /dos/ { print "DOS"; exit} truelight@5753: /wince/ { print "WINCE"; exit} truelight@5957: /psp/ { print "PSP"; exit} rubidium@5475: '` rubidium@5475: tron@5558: if [ -z "$os" ]; then truelight@6081: os=`LC_ALL=C uname | tr '[A-Z]' '[a-z]' | $awk ' rubidium@5475: /linux/ { print "UNIX"; exit} rubidium@5475: /darwin/ { print "OSX"; exit} rubidium@5475: /freebsd/ { print "FREEBSD"; exit} peter1138@6673: /openbsd/ { print "OPENBSD"; exit} rubidium@9072: /netbsd/ { print "NETBSD"; exit} rubidium@9072: /hp-ux/ { print "HPUX"; exit} rubidium@5475: /morphos/ { print "MORPHOS"; exit} rubidium@5475: /beos/ { print "BEOS"; exit} rubidium@5475: /sunos/ { print "SUNOS"; exit} rubidium@5475: /cygwin/ { print "CYGWIN"; exit} rubidium@5475: /mingw/ { print "MINGW"; exit} rubidium@5475: /os\/2/ { print "OS2"; exit} rubidium@5475: '` rubidium@5475: fi rubidium@5475: tron@5558: if [ -z "$os" ]; then rubidium@5475: log 1 "detecting OS... none detected" peter1138@6673: log 1 "I couldn't detect your OS. Please use --os=OS to force one" rubidium@10385: log 1 "Allowed values are: UNIX, OSX, FREEBSD, OPENBSD, NETBSD, MORPHOS, HPUX, BEOS, SUNOS, CYGWIN, MINGW, OS2, DOS, WINCE, and PSP" rubidium@5475: exit 1 rubidium@5475: fi rubidium@5475: rubidium@5475: log 1 "detecting OS... $os" rubidium@5475: else rubidium@5475: log 1 "forcing OS... $os" rubidium@5475: fi rubidium@5475: } rubidium@5475: rubidium@10379: detect_allegro() { rubidium@10379: # 0 means no, 1 is auto-detect, 2 is force rubidium@10379: if [ "$with_allegro" = "0" ]; then rubidium@10379: log 1 "checking Allegro... disabled" rubidium@10379: rubidium@10379: allegro_config="" rubidium@10379: return 0 rubidium@10379: fi rubidium@10379: rubidium@10379: if [ "$with_allegro" = "2" ] && [ "$with_cocoa" = "2" ]; then rubidium@10379: log 1 "configure: error: it is impossible to compile both Allegro and COCOA" rubidium@10379: log 1 "configure: error: please deselect one of them and try again" rubidium@10379: exit 1 rubidium@10379: fi rubidium@10379: rubidium@10379: if [ "$with_allegro" = "2" ] && [ "$enable_dedicated" != "0" ]; then rubidium@10379: log 1 "configure: error: it is impossible to compile a dedicated with Allegro" rubidium@10379: log 1 "configure: error: please deselect one of them and try again" rubidium@10379: exit 1 rubidium@10379: fi rubidium@10379: rubidium@10379: if [ "$enable_dedicated" != "0" ]; then rubidium@10379: log 1 "checking Allegro... dedicated server, skipping" rubidium@10379: rubidium@10379: allegro_config="" rubidium@10379: return 0 rubidium@10379: fi rubidium@10379: rubidium@10379: # By default on OSX we don't use SDL. The rest is auto-detect rubidium@10379: if [ "$with_allegro" = "1" ] && [ "$os" = "OSX" ] && [ "$with_cocoa" != "0" ]; then rubidium@10385: log 1 "checking Allegro... OSX, skipping" rubidium@10379: rubidium@10379: allegro_config="" rubidium@10379: return 0 rubidium@10379: fi rubidium@10379: rubidium@10379: if [ "$with_allegro" = "1" ] || [ "$with_allegro" = "" ] || [ "$with_allegro" = "2" ]; then rubidium@10379: allegro_config="allegro-config" rubidium@10379: else rubidium@10379: allegro_config="$with_allegro" rubidium@10379: fi rubidium@10379: rubidium@10379: version=`$allegro_config --version 2>/dev/null` rubidium@10379: ret=$? rubidium@10379: log 2 "executing $allegro_config --version" rubidium@10379: log 2 " returned $version" rubidium@10379: log 2 " exit code $ret" rubidium@10379: rubidium@10379: if [ -z "$version" ] || [ "$ret" != "0" ]; then rubidium@10379: log 1 "checking Allegro... not found" rubidium@10379: rubidium@10379: # It was forced, so it should be found. rubidium@10379: if [ "$with_allegro" != "1" ]; then rubidium@10379: log 1 "configure: error: allegro-config couldn't be found" rubidium@10379: log 1 "configure: error: you supplied '$with_allegro', but it seems invalid" rubidium@10379: exit 1 rubidium@10379: fi rubidium@10379: rubidium@10379: allegro_config="" rubidium@10379: return 0 rubidium@10379: fi rubidium@10379: rubidium@10379: log 1 "checking Allegro... found" rubidium@10379: } rubidium@10379: rubidium@10379: rubidium@5475: detect_sdl() { rubidium@5475: # 0 means no, 1 is auto-detect, 2 is force tron@5558: if [ "$with_sdl" = "0" ]; then rubidium@5475: log 1 "checking SDL... disabled" rubidium@5475: rubidium@5475: sdl_config="" rubidium@5475: return 0 rubidium@5475: fi rubidium@5475: tron@5558: if [ "$with_sdl" = "2" ] && [ "$with_cocoa" = "2" ]; then rubidium@5475: log 1 "configure: error: it is impossible to compile both SDL and COCOA" rubidium@5475: log 1 "configure: error: please deselect one of them and try again" rubidium@5475: exit 1 rubidium@5475: fi rubidium@5475: tron@5558: if [ "$with_sdl" = "2" ] && [ "$enable_dedicated" != "0" ]; then rubidium@5475: log 1 "configure: error: it is impossible to compile a dedicated with SDL" rubidium@5475: log 1 "configure: error: please deselect one of them and try again" rubidium@5475: exit 1 rubidium@5475: fi rubidium@5475: tron@5558: if [ "$enable_dedicated" != "0" ]; then truebrain@10264: log 1 "checking SDL... dedicated server, skipping" rubidium@5475: rubidium@5475: sdl_config="" rubidium@5475: return 0 rubidium@5475: fi rubidium@5475: rubidium@5475: # By default on OSX we don't use SDL. The rest is auto-detect tron@5558: if [ "$with_sdl" = "1" ] && [ "$os" = "OSX" ] && [ "$with_cocoa" != "0" ]; then rubidium@5475: log 1 "checking SDL... OSX, skipping" rubidium@5475: rubidium@5475: sdl_config="" rubidium@5475: return 0 rubidium@5475: fi rubidium@5475: tron@5558: if [ "$with_sdl" = "1" ] || [ "$with_sdl" = "" ] || [ "$with_sdl" = "2" ]; then tron@5537: sdl_config="sdl-config" rubidium@5475: else rubidium@5475: sdl_config="$with_sdl" rubidium@5475: fi rubidium@5475: rubidium@5475: version=`$sdl_config --version 2>/dev/null` rubidium@5475: ret=$? rubidium@5475: log 2 "executing $sdl_config --version" rubidium@5475: log 2 " returned $version" rubidium@5475: log 2 " exit code $ret" rubidium@5475: tron@5558: if [ -z "$version" ] || [ "$ret" != "0" ]; then rubidium@5475: log 1 "checking SDL... not found" rubidium@5475: rubidium@5475: # It was forced, so it should be found. tron@5558: if [ "$with_sdl" != "1" ]; then rubidium@5475: log 1 "configure: error: sdl-config couldn't be found" rubidium@5475: log 1 "configure: error: you supplied '$with_sdl', but it seems invalid" rubidium@5475: exit 1 rubidium@5475: fi rubidium@5475: rubidium@5475: sdl_config="" rubidium@5475: return 0 rubidium@5475: fi rubidium@5475: rubidium@5475: log 1 "checking SDL... found" rubidium@5475: } rubidium@5475: rubidium@5475: detect_cocoa() { rubidium@5475: # 0 means no, 1 is auto-detect, 2 is force tron@5558: if [ "$with_cocoa" = "0" ]; then rubidium@5475: log 1 "checking COCOA... disabled" rubidium@5475: rubidium@5475: return 0 rubidium@5475: fi rubidium@5475: tron@5558: if [ "$with_cocoa" = "2" ] && [ "$enable_dedicated" != "0" ]; then rubidium@5475: log 1 "configure: error: it is impossible to compile a dedicated with COCOA" rubidium@5475: log 1 "configure: error: please deselect one of them and try again" rubidium@5475: exit 1 rubidium@5475: fi rubidium@5475: tron@5558: if [ "$enable_dedicated" != "0" ]; then truebrain@10264: log 1 "checking COCOA... dedicated server, skipping" rubidium@5475: rubidium@5475: with_cocoa="0" rubidium@5475: return 0 rubidium@5475: fi rubidium@5475: rubidium@5475: # By default on OSX we use COCOA. The rest doesn't support it tron@5558: if [ "$with_cocoa" = "1" ] && [ "$os" != "OSX" ]; then rubidium@5475: log 1 "checking COCOA... not OSX, skipping" rubidium@5475: rubidium@5475: with_cocoa="0" rubidium@5475: return 0 rubidium@5475: fi rubidium@5475: tron@5558: if [ "$os" != "OSX" ]; then rubidium@5475: log 1 "checking COCOA... not OSX" rubidium@5475: rubidium@5475: log 1 "configure: error: COCOA video driver is only supported for OSX" rubidium@5475: exit 1 rubidium@5475: fi rubidium@5475: rubidium@5475: log 1 "checking COCOA... found" egladil@8092: egladil@8092: egladil@8092: if [ "$enable_cocoa_quartz" != "0" ]; then egladil@8092: log 1 "checking whether to enable the Quartz window subdriver... yes" egladil@8092: else egladil@8092: log 1 "checking whether to enable the Quartz window subdriver... no" egladil@8092: fi egladil@8092: egladil@8092: if [ "$enable_cocoa_quickdraw" != "0" ]; then egladil@8092: log 1 "checking whether to enable the Quickdraw window subdriver... yes" egladil@8092: else egladil@8092: log 1 "checking whether to enable the Quickdraw window subdriver... no" egladil@8092: fi rubidium@5475: } rubidium@5475: truelight@6034: detect_library() { truelight@6034: # $1 - config-param ($with_zlib value) truelight@6034: # $2 - library name ('zlib', sets $zlib) truelight@6034: # $3 - static library name (libz.a) truelight@6034: # $4 - header name (zlib.h) rubidium@6938: # $5 - force static (if non-empty) rubidium@6938: rubidium@6938: if [ -n "$5" ]; then force_static="1"; fi truelight@6034: rubidium@5475: # 0 means no, 1 is auto-detect, 2 is force truelight@6034: if [ "$1" = "0" ]; then truelight@6034: log 1 "checking $2... disabled" rubidium@5475: truelight@6034: eval "$2=\"\"" rubidium@5475: return 0 rubidium@5475: fi rubidium@5475: truelight@6034: log 2 "detecting $2" rubidium@5475: truelight@6034: if [ "$1" = "1" ] || [ "$1" = "" ] || [ "$1" = "2" ]; then maedhros@6980: eval "$2=`ls -1 /usr/include/*.h 2>/dev/null | egrep \"\/$4\$\"`" truelight@6034: eval "res=\$$2" truelight@6034: if [ -z "$res" ]; then truelight@6034: log 2 " trying /usr/include/$4... no" maedhros@6980: eval "$2=`ls -1 /usr/local/include/*.h 2>/dev/null | egrep \"\/$4\$\"`" rubidium@5475: fi truelight@6034: eval "res=\$$2" truelight@6034: if [ -z "$res" ]; then truelight@6034: log 2 " trying /usr/local/include/$4... no" rubidium@5475: fi rubidium@5475: truelight@6034: eval "res=\$$2" rubidium@6938: if [ -n "$res" ] && ( [ -n "$force_static" ] || ( [ "$enable_static" != "0" ] && [ "$os" != "OSX" ] ) ); then truelight@6034: eval "res=\$$2" truelight@6034: log 2 " trying $res... found" rubidium@5475: # Now find the static lib, if needed maedhros@6980: eval "$2=`ls /lib/*.a 2>/dev/null | egrep \"\/$3\$\"`" truelight@6034: eval "res=\$$2" truelight@6034: if [ -z "$res" ]; then truelight@6034: log 2 " trying /lib/$3... no" maedhros@6980: eval "$2=`ls /usr/lib/*.a 2>/dev/null | egrep \"\/$3\$\"`" rubidium@5475: fi truelight@6034: eval "res=\$$2" truelight@6034: if [ -z "$res" ]; then truelight@6034: log 2 " trying /usr/lib/$3... no" maedhros@6980: eval "$2=`ls /usr/local/lib/*.a 2>/dev/null | egrep \"\/$3\$\"`" rubidium@5475: fi truelight@6034: eval "res=\$$2" truelight@6034: if [ -z "$res" ]; then truelight@6034: log 2 " trying /usr/local/lib/$3... no" truelight@6034: log 1 "configure: error: $2 couldn't be found" truelight@6034: log 1 "configure: error: you requested a static link, but I can't find $3" rubidium@5475: rubidium@5475: exit 1 rubidium@5475: fi rubidium@5475: fi rubidium@5475: else rubidium@5475: # Make sure it exists truelight@6034: if [ -f "$1" ]; then truelight@6034: eval "$2=`ls $1 2>/dev/null`" rubidium@5505: else truelight@6034: eval "$2=`ls $1/$3 2>/dev/null`" rubidium@5505: fi rubidium@5475: fi rubidium@5475: truelight@6034: eval "res=\$$2" truelight@6034: if [ -z "$res" ]; then truelight@6034: log 1 "checking $2... not found" truelight@6034: if [ "$1" = "2" ]; then truelight@6034: log 1 "configure: error: $2 couldn't be found" rubidium@5475: rubidium@5475: exit 1 truelight@6034: elif [ "$1" != "1" ]; then truelight@6034: log 1 "configure: error: $2 couldn't be found" truelight@6034: log 1 "configure: error: you supplied '$1', but it seems invalid" rubidium@5475: rubidium@5475: exit 1 rubidium@5475: fi rubidium@5475: rubidium@10385: eval "with_$2=0" rubidium@10385: rubidium@5475: return 0 rubidium@5475: fi rubidium@5475: truelight@6034: eval "res=\$$2" truelight@6034: log 2 " trying $res... found" rubidium@5475: truelight@6034: log 1 "checking $2... found" truelight@6034: } truelight@6034: truelight@6034: detect_zlib() { truelight@6034: detect_library "$with_zlib" "zlib" "libz.a" "zlib.h" truelight@6034: } truelight@6034: truelight@6034: detect_libtimidity() { truelight@6034: detect_library "$with_libtimidity" "libtimidity" "libtimidity.a" "timidity.h" rubidium@5475: } rubidium@5475: rubidium@5475: detect_png() { rubidium@5475: # 0 means no, 1 is auto-detect, 2 is force tron@5558: if [ "$with_png" = "0" ]; then rubidium@5475: log 1 "checking libpng... disabled" rubidium@5475: rubidium@5475: png_config="" rubidium@5475: return 0 rubidium@5475: fi rubidium@5475: truebrain@10265: if [ "$with_zlib" = "0" ] || [ -z "$zlib" ]; then truebrain@10265: if [ "$with_png" != "1" ]; then truebrain@10265: log 1 "checking libpng... no zlib" truebrain@10265: log 1 "ERROR: libpng was forced, but zlib was not detected / disabled." truebrain@10265: log 1 "ERROR: libpng depends on zlib." truebrain@10265: truebrain@10265: exit 1 truebrain@10265: fi truebrain@10265: truebrain@10265: log 1 "checking libpng... no zlib, skipping" truebrain@10265: truebrain@10265: png_config="" truebrain@10265: return 0 rubidium@5475: fi rubidium@5475: tron@5558: if [ "$with_png" = "1" ] || [ "$with_png" = "" ] || [ "$with_png" = "2" ]; then rubidium@5475: png_config="libpng-config" rubidium@5475: else rubidium@5475: png_config="$with_png" rubidium@5475: fi rubidium@5475: rubidium@5475: version=`$png_config --version 2>/dev/null` rubidium@5475: ret=$? rubidium@5475: log 2 "executing $png_config --version" rubidium@5475: log 2 " returned $version" rubidium@5475: log 2 " exit code $ret" rubidium@5475: tron@5558: if [ -z "$version" ] || [ "$ret" != "0" ]; then rubidium@5475: log 1 "checking libpng... not found" rubidium@5475: rubidium@5475: # It was forced, so it should be found. tron@5558: if [ "$with_png" != "1" ]; then rubidium@5475: log 1 "configure: error: libpng-config couldn't be found" rubidium@5475: log 1 "configure: error: you supplied '$with_png', but it seems invalid" rubidium@5475: exit 1 rubidium@5475: fi rubidium@5475: rubidium@5475: png_config="" rubidium@5475: return 0 rubidium@5475: fi rubidium@5475: rubidium@5475: log 1 "checking libpng... found" rubidium@5475: } rubidium@5475: rubidium@5475: detect_freetype() { rubidium@5475: # 0 means no, 1 is auto-detect, 2 is force tron@5558: if [ "$with_freetype" = "0" ]; then rubidium@5475: log 1 "checking libfreetype... disabled" rubidium@5475: rubidium@5475: freetype_config="" rubidium@5475: return 0 rubidium@5475: fi truebrain@10264: if [ "$with_freetype" = "1" ] && [ "$enable_dedicated" != "0" ]; then truebrain@10264: log 1 "checking libfreetype... dedicated server, skipping" truebrain@10264: truebrain@10264: freetype_config="" truebrain@10264: return 0 truebrain@10264: fi rubidium@5475: truebrain@10265: if [ "$with_zlib" = "0" ] || [ -z "$zlib" ]; then truebrain@10265: if [ "$with_freetype" != "1" ]; then truebrain@10265: log 1 "checking libfreetype... no zlib" truebrain@10265: log 1 "ERROR: libfreetype was forced, but zlib was not detected / disabled." truebrain@10265: log 1 "ERROR: libfreetype depends on zlib." truebrain@10265: truebrain@10265: exit 1 truebrain@10265: fi truebrain@10265: truebrain@10265: log 1 "checking libfreetype... no zlib, skipping" truebrain@10265: truebrain@10265: freetype_config="" truebrain@10265: return 0 rubidium@5475: fi rubidium@5475: tron@5558: if [ "$with_freetype" = "1" ] || [ "$with_freetype" = "" ] || [ "$with_freetype" = "2" ]; then rubidium@5475: freetype_config="freetype-config" rubidium@5475: else rubidium@5475: freetype_config="$with_freetype" rubidium@5475: fi rubidium@5475: rubidium@5475: version=`$freetype_config --version 2>/dev/null` rubidium@5475: ret=$? rubidium@5475: log 2 "executing freetype_config --version" rubidium@5475: log 2 " returned $version" rubidium@5475: log 2 " exit code $ret" rubidium@5475: tron@5558: if [ -z "$version" ] || [ "$ret" != "0" ]; then rubidium@5475: log 1 "checking libfreetype... not found" rubidium@5475: rubidium@5475: # It was forced, so it should be found. tron@5558: if [ "$with_freetype" != "1" ]; then rubidium@5475: log 1 "configure: error: freetype-config couldn't be found" rubidium@5475: log 1 "configure: error: you supplied '$with_freetype', but it seems invalid" rubidium@5475: exit 1 rubidium@5475: fi rubidium@5475: rubidium@5475: freetype_config="" rubidium@5475: return 0 rubidium@5475: fi rubidium@5475: rubidium@5475: log 1 "checking libfreetype... found" rubidium@5475: } rubidium@5475: rubidium@5475: detect_fontconfig() { rubidium@5475: # 0 means no, 1 is auto-detect, 2 is force tron@5558: if [ "$with_fontconfig" = "0" ]; then rubidium@5475: log 1 "checking libfontconfig... disabled" rubidium@5475: rubidium@5475: fontconfig_config="" rubidium@5475: return 0 rubidium@5475: fi truebrain@10264: if [ "$with_fontconfig" = "1" ] && [ "$enable_dedicated" != "0" ]; then truebrain@10264: log 1 "checking libfontconfig... dedicated server, skipping" truebrain@10264: truebrain@10264: fontconfig_config="" truebrain@10264: return 0 truebrain@10264: fi truebrain@10266: if [ "$with_fontconfig" != "2" ] && [ -z "$freetype_config" ]; then truebrain@10266: log 1 "checking libfontconfig... no freetype, skipping" truebrain@10266: truebrain@10266: fontconfig_config="" truebrain@10266: return 0 truebrain@10266: fi rubidium@5475: glx@6249: if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ]; then glx@6249: log 1 "checking libfontconfig... WIN32, skipping" glx@6249: fontconfig_config="" glx@6249: return 0 glx@6249: fi glx@6249: tron@5558: if [ "$with_fontconfig" = "1" ] || [ "$with_fontconfig" = "" ] || [ "$with_fontconfig" = "2" ]; then rubidium@5475: fontconfig_config="pkg-config fontconfig" rubidium@5475: else rubidium@5475: fontconfig_config="$with_fontconfig" rubidium@5475: fi rubidium@5475: rubidium@5475: version=`$fontconfig_config --modversion 2>/dev/null` rubidium@5475: ret=$? rubidium@5475: shortversion=`echo $version | cut -c 1,3` rubidium@5475: log 2 "executing $fontconfig_config --modversion" rubidium@5475: log 2 " returned $version" rubidium@5475: log 2 " exit code $ret" rubidium@5475: tron@5558: if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$shortversion" -le "22" ]; then tron@5558: if [ -n "$shortversion" ] && [ "$shortversion" -le "22" ]; then rubidium@5475: log 1 "checking libfontconfig... needs at least version 2.3.0, fontconfig NOT enabled" rubidium@5475: else rubidium@5475: log 1 "checking libfontconfig... not found" rubidium@5475: fi rubidium@5475: rubidium@5475: # It was forced, so it should be found. tron@5558: if [ "$with_fontconfig" != "1" ]; then rubidium@5475: log 1 "configure: error: fontconfig-config couldn't be found" rubidium@5475: log 1 "configure: error: you supplied '$with_fontconfig', but it seems invalid" rubidium@5475: exit 1 rubidium@5475: fi rubidium@5475: rubidium@5475: fontconfig_config="" rubidium@5475: return 0 rubidium@5475: fi rubidium@5475: rubidium@5475: log 1 "checking libfontconfig... found" rubidium@5475: } rubidium@5475: rubidium@10248: detect_icu() { rubidium@10248: # 0 means no, 1 is auto-detect, 2 is force rubidium@10248: if [ "$with_icu" = "0" ]; then rubidium@10248: log 1 "checking libicu... disabled" rubidium@10248: rubidium@10248: icu_config="" rubidium@10248: return 0 rubidium@10248: fi truebrain@10264: if [ "$with_icu" = "1" ] && [ "$enable_dedicated" != "0" ]; then truebrain@10264: log 1 "checking libicu... dedicated server, skipping" truebrain@10264: truebrain@10264: icu_config="" truebrain@10264: return 0 truebrain@10264: fi rubidium@10248: rubidium@10248: if [ "$with_icu" = "1" ] || [ "$with_icu" = "" ] || [ "$with_icu" = "2" ]; then rubidium@10248: icu_config="icu-config" rubidium@10248: else rubidium@10248: icu_config="$with_icu" rubidium@10248: fi rubidium@10248: rubidium@10248: version=`$icu_config --version 2>/dev/null` rubidium@10248: ret=$? rubidium@10248: shortversion=`echo $version | cut -c 1,3` rubidium@10248: log 2 "executing $icu_config --version" rubidium@10248: log 2 " returned $version" rubidium@10248: log 2 " exit code $ret" rubidium@10248: rubidium@10248: if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$shortversion" -lt "20" ]; then rubidium@10248: if [ -n "$shortversion" ] && [ "$shortversion" -lt "20" ]; then rubidium@10248: log 1 "checking libicu... needs at least version 2.0.0, icu NOT enabled" rubidium@10248: else rubidium@10248: log 1 "checking libicu... not found" rubidium@10248: fi rubidium@10248: rubidium@10248: # It was forced, so it should be found. rubidium@10248: if [ "$with_icu" != "1" ]; then rubidium@10248: log 1 "configure: error: icu-config couldn't be found" rubidium@10248: log 1 "configure: error: you supplied '$with_icuconfig', but it seems invalid" rubidium@10248: exit 1 rubidium@10248: fi rubidium@10248: rubidium@10248: icu_config="" rubidium@10248: return 0 rubidium@10248: fi rubidium@10248: rubidium@10248: log 1 "checking libicu... found" rubidium@10248: } rubidium@10248: truelight@5958: detect_pspconfig() { truelight@5958: # 0 means no, 1 is auto-detect, 2 is force truelight@5961: if [ "$with_psp_config" = "0" ]; then truelight@5958: log 1 "checking psp-config... disabled" truelight@5958: truelight@5958: psp_config="" truelight@5958: return 0 truelight@5958: fi truelight@5958: truelight@5961: if [ "$with_psp_config" = "1" ] && [ "$os" != "PSP" ]; then truelight@5958: log 1 "checking psp-config... not PSP, skipping" truelight@5958: truelight@5958: psp_config=""; truelight@5958: return 0 truelight@5958: fi truelight@5958: truelight@5958: if [ "$os" != "PSP" ]; then truelight@5958: log 1 "checking psp-config... not PSP" truelight@5958: truelight@5958: log 1 "configure: error: psp-config is only supported for PSP" truelight@5958: exit 1 truelight@5958: fi truelight@5958: truelight@5961: if [ "$with_psp_config" = "1" ] || [ "$with_psp_config" = "" ] || [ "$with_psp_config" = "2" ]; then truelight@5958: psp_config="psp-config" truelight@5958: else truelight@5961: psp_config="$with_psp_config" truelight@5958: fi truelight@5958: truelight@5958: version=`$psp_config -p 2>/dev/null` truelight@5958: ret=$? truelight@5958: log 2 "executing $psp_config -p" truelight@5958: log 2 " returned $version" truelight@5958: log 2 " exit code $ret" truelight@5958: truelight@5958: if [ -z "$version" ] || [ "$ret" != "0" ]; then truelight@5958: log 1 "checking psp-config... not found" truelight@5958: log 1 "configure: error: psp-config couldn't be found" truelight@5958: truelight@5958: # It was forced, so it should be found. truelight@5961: if [ "$with_psp_config" != "1" ]; then truelight@5961: log 1 "configure: error: you supplied '$with_psp_config', but it seems invalid" truelight@5958: fi truelight@5958: exit 1 truelight@5958: fi truelight@5958: truelight@5958: log 1 "checking psp-config... found" truelight@5958: } truelight@5958: rubidium@5475: detect_iconv() { rubidium@5475: # 0 means no, 1 is auto-detect, 2 is force tron@5558: if [ "$with_iconv" = "0" ]; then rubidium@5475: log 1 "checking iconv... disabled" rubidium@5475: rubidium@5475: return 0 rubidium@5475: fi rubidium@5475: tron@5558: if [ "$with_iconv" = "1" ] && [ "$os" != "OSX" ]; then rubidium@5475: log 1 "checking iconv... not OSX, skipping" rubidium@5475: with_iconv="0" rubidium@5475: rubidium@5475: return 0 rubidium@5475: fi rubidium@5475: rubidium@5475: # Try to find iconv.h, seems to only thing to detect iconv with rubidium@5475: tron@5558: if [ "$with_iconv" = "1" ] || [ "$with_iconv" = "" ] || [ "$with_iconv" = "2" ]; then rubidium@5475: iconv=`ls -1 /usr/include 2>/dev/null | grep "iconv.h"` tron@5558: if [ -z "$iconv" ]; then rubidium@5475: iconv=`ls -1 /usr/local/include 2>/dev/null | grep "iconv.h"` rubidium@5475: fi rubidium@5475: else rubidium@5475: # Make sure it exists rubidium@5475: iconv=`ls $with_iconv/include/iconv.h 2>/dev/null` rubidium@5475: fi rubidium@5475: tron@5558: if [ -z "$iconv" ]; then rubidium@5475: log 1 "checking iconv... not found" tron@5558: if [ "$with_iconv" = "2" ]; then rubidium@5475: log 1 "configure: error: iconv couldn't be found" rubidium@5475: rubidium@5475: exit 1 tron@5558: elif [ "$with_iconv" != "1" ]; then rubidium@5475: log 1 "configure: error: iconv couldn't be found" rubidium@5475: log 1 "configure: error: you supplied '$with_iconv', but I couldn't detect iconv in it" rubidium@5475: rubidium@5475: exit 1 rubidium@5475: fi rubidium@5475: rubidium@5475: return 0 rubidium@5475: fi rubidium@5475: tron@5558: if [ "$with_iconv" = "1" ]; then rubidium@5475: with_iconv="2" rubidium@5475: fi rubidium@5475: rubidium@5475: log 2 "found iconv in $iconv" rubidium@5475: rubidium@5475: log 1 "checking iconv... found" egladil@7839: egladil@7839: # Check if we need to work around buggy iconv implementation where inbuf egladil@7839: # is wrongly typed as non-const. Correct implementation is at egladil@7839: # http://www.opengroup.org/onlinepubs/007908799/xsh/iconv.html egladil@7839: egladil@7839: cat > tmp.iconv.cpp << EOF egladil@7839: #include "src/stdafx.h" egladil@7839: #include egladil@7839: int main() { egladil@7839: static char buf[1024]; egladil@7839: iconv_t convd = 0; egladil@7839: const char *inbuf = ""; egladil@7839: char *outbuf = buf; egladil@7839: size_t outlen = 1023; egladil@7839: size_t inlen = 0; egladil@7839: return iconv(convd, &inbuf, &inlen, &outbuf, &outlen); egladil@7839: } egladil@7839: EOF egladil@7839: execute="$cxx_host $CFLAGS -c tmp.iconv.cpp -o tmp.iconv -DTESTING 2>&1" egladil@7839: eval $execute >&/dev/null egladil@7839: ret=$? egladil@7839: log 2 "executing $execute" egladil@7839: log 2 " exit code $ret" egladil@7839: if [ "$ret" = "0" ]; then have_broken_iconv="no"; else have_broken_iconv="yes"; fi egladil@7839: log 1 "checking if iconv has non-const inbuf... $have_broken_iconv" rubidium@10277: rubidium@10277: cat > tmp.iconv.cpp << EOF rubidium@10277: #include "src/stdafx.h" rubidium@10277: #include rubidium@10277: int main() { rubidium@10277: static char buf[1024]; rubidium@10277: iconv_t convd = 0; rubidium@10277: char *inbuf = ""; rubidium@10277: char *outbuf = buf; rubidium@10277: size_t outlen = 1023; rubidium@10277: size_t inlen = 0; rubidium@10277: return iconv(convd, &inbuf, &inlen, &outbuf, &outlen); rubidium@10277: } rubidium@10277: EOF rubidium@10277: execute="$cxx_host $CFLAGS tmp.iconv.cpp -o tmp.iconv -DTESTING 2>&1" rubidium@10277: eval $execute >&/dev/null rubidium@10277: ret=$? rubidium@10277: log 2 "executing $execute" rubidium@10277: log 2 " exit code $ret" rubidium@10277: if [ "$ret" = "0" ]; then link_to_iconv="no"; else link_to_iconv="yes"; fi rubidium@10277: log 1 "checking whether to link to iconv... $link_to_iconv" egladil@7839: rm -f tmp.iconv tmp.iconv.cpp rubidium@5475: } rubidium@5475: rubidium@5475: _detect_sort() { rubidium@5475: sort_test_in="d rubidium@5475: a rubidium@5475: c rubidium@5475: b" rubidium@5475: rubidium@5475: sort_test_out="a rubidium@5475: b rubidium@5475: c rubidium@5475: d" rubidium@5475: rubidium@5475: log 2 "running echo | $1" rubidium@5475: tron@5558: if [ "`echo \"$sort_test_in\" | $1 2>/dev/null`" = "$sort_test_out" ]; then rubidium@5475: sort="$1" rubidium@5475: log 2 " result was valid" rubidium@5475: else rubidium@5475: log 2 " result was invalid" rubidium@5475: fi rubidium@5475: } rubidium@5475: rubidium@5475: detect_sort() { tron@5558: if [ "$with_sort" = "0" ]; then rubidium@5475: log 1 "checking sort... disabled" rubidium@5475: rubidium@5475: return rubidium@5475: fi rubidium@5475: tron@5558: if [ "$with_sort" = "1" ] || [ "$with_sort" = "2" ]; then rubidium@5475: _detect_sort "sort" rubidium@5475: if [ -z "$sort" ]; then _detect_sort "/sbin/sort"; fi rubidium@5475: if [ -z "$sort" ]; then _detect_sort "/usr/sbin/sort"; fi rubidium@5475: if [ -z "$sort" ]; then _detect_sort "/usr/local/sbin/sort"; fi rubidium@5475: if [ -z "$sort" ]; then _detect_sort "/bin/sort"; fi rubidium@5475: if [ -z "$sort" ]; then _detect_sort "/usr/bin/sort"; fi rubidium@5475: if [ -z "$sort" ]; then _detect_sort "/usr/local/bin/sort"; fi rubidium@5475: else rubidium@5475: _detect_sort "$with_sort" rubidium@5475: fi rubidium@5475: tron@5558: if [ -z "$sort" ]; then tron@5558: if [ "$with_sort" = "2" ]; then rubidium@5475: log 1 "checking sort... not found" rubidium@5475: rubidium@5475: log 1 "configure: error: couldn't detect sort on your system" rubidium@5475: exit 1 tron@5558: elif [ "$with_sort" != "1" ]; then rubidium@5475: log 1 "checking sort... $with_sort not found" rubidium@5475: rubidium@5475: log 1 "configure: error: '$with_sort' doesn't look like a sort to me" rubidium@5475: log 1 "configure: error: please verify its location and function and try again" rubidium@5475: rubidium@5475: exit 1 rubidium@5475: else rubidium@5475: log 1 "checking sort... not found" rubidium@5475: fi rubidium@5475: else rubidium@5475: log 1 "checking sort... $sort" rubidium@5475: fi rubidium@5475: } rubidium@5475: rubidium@6938: detect_cputype() { rubidium@6938: if [ -n "$cpu_type" ] && [ "$cpu_type" != "DETECT" ]; then rubidium@6938: log 1 "forcing cpu-type... $cpu_type bits" rubidium@6938: return; rubidium@6938: fi rubidium@6938: echo "#include \"src/stdafx.h\"" > tmp.64bit.cpp rubidium@6938: echo "assert_compile(sizeof(size_t) == 8);" >> tmp.64bit.cpp rubidium@6938: echo "int main() { return 0; }" >> tmp.64bit.cpp rubidium@6938: execute="$cxx_host $CFLAGS tmp.64bit.cpp -o tmp.64bit -DTESTING 2>&1" rubidium@6938: cpu_type="`eval $execute 2>/dev/null`" rubidium@6938: ret=$? rubidium@6938: log 2 "executing $execute" rubidium@6938: log 2 " returned $cpu_type" rubidium@6938: log 2 " exit code $ret" rubidium@6938: if [ "$ret" = "0" ]; then cpu_type="64"; else cpu_type="32"; fi rubidium@6938: log 1 "detecting cpu-type... $cpu_type bits" rubidium@6938: rm -f tmp.64bit tmp.64bit.cpp rubidium@6938: } rubidium@6938: rubidium@5475: make_sed() { bjarni@9727: T_CFLAGS="$CFLAGS" smatz@9731: T_LDFLAGS="$LDFLAGS" bjarni@9727: rubidium@5475: # We check here if we are PPC, because then we need to enable FOUR_BYTE_BOOL rubidium@5475: # We do this here, and not sooner, so universal builds also have this tron@5541: # automatically correct rubidium@5475: # FOUR_BYTE_BOOL is needed, because C++ uses 4byte for a bool on PPC, where rubidium@5475: # we use 1 byte per bool normally in C part. So convert that last one to 4 rubidium@5475: # bytes too, but only for PPC. maedhros@6980: ppc=`$cc_host -dumpmachine | egrep "powerpc|ppc"` tron@5558: if [ -n "$ppc" ]; then bjarni@9727: T_CFLAGS="$T_CFLAGS -DFOUR_BYTE_BOOL" rubidium@5475: fi rubidium@5475: rubidium@5475: SRC_OBJS_DIR="$BASE_SRC_OBJS_DIR/$OBJS_SUBDIR" rubidium@5475: rubidium@5475: # All the data needed to compile a single target rubidium@5475: # Make sure if you compile multiple targets to rubidium@5475: # use multiple OBJS_DIR, because all in-between rubidium@5475: # binaries are stored in there, and nowhere else. rubidium@5475: SRC_REPLACE=" smatz@10239: s~!!CC_HOST!!~$cc_host~g; smatz@10239: s~!!CXX_HOST!!~$cxx_host~g; smatz@10239: s~!!CC_BUILD!!~$cc_build~g; smatz@10239: s~!!CXX_BUILD!!~$cxx_build~g; smatz@10239: s~!!WINDRES!!~$windres~g; smatz@10239: s~!!STRIP!!~$strip $strip_arg~g; smatz@10239: s~!!LIPO!!~$lipo~g; smatz@10239: s~!!CC_CFLAGS!!~$CC_CFLAGS~g; smatz@10239: s~!!CFLAGS!!~$T_CFLAGS~g; smatz@10239: s~!!CFLAGS_BUILD!!~$CFLAGS_BUILD~g; smatz@10239: s~!!STRGEN_FLAGS!!~$strgen_flags~g; smatz@10239: s~!!LIBS!!~$LIBS~g; smatz@10239: s~!!LDFLAGS!!~$T_LDFLAGS~g; smatz@10239: s~!!BIN_DIR!!~$BIN_DIR~g; smatz@10239: s~!!ROOT_DIR!!~$ROOT_DIR~g; smatz@10239: s~!!MEDIA_DIR!!~$MEDIA_DIR~g; smatz@10239: s~!!SOURCE_LIST!!~$SOURCE_LIST~g; smatz@10239: s~!!SRC_OBJS_DIR!!~$SRC_OBJS_DIR~g; smatz@10239: s~!!LANG_OBJS_DIR!!~$LANG_OBJS_DIR~g; smatz@10239: s~!!SRC_DIR!!~$SRC_DIR~g; smatz@10239: s~!!OSXAPP!!~$OSXAPP~g; smatz@10239: s~!!LANG_DIR!!~$LANG_DIR~g; smatz@10239: s~!!TTD!!~$TTD~g; smatz@10239: s~!!BINARY_DIR!!~$prefix_dir/$binary_dir~g; smatz@10239: s~!!DATA_DIR!!~$prefix_dir/$data_dir~g; smatz@10239: s~!!DOC_DIR!!~$prefix_dir/$doc_dir~g; smatz@10239: s~!!MAN_DIR!!~$prefix_dir/$man_dir~g; smatz@10239: s~!!ICON_DIR!!~$prefix_dir/$icon_dir~g; smatz@10239: s~!!ICON_THEME_DIR!!~$prefix_dir/$icon_theme_dir~g; smatz@10239: s~!!PERSONAL_DIR!!~$personal_dir~g; smatz@10239: s~!!SHARED_DIR!!~$shared_dir~g; smatz@10239: s~!!INSTALL_DIR!!~$install_dir~g; truebrain@10244: s~!!BINARY_NAME!!~$binary_name~g; smatz@10239: s~!!STRGEN!!~$STRGEN~g; smatz@10239: s~!!ENDIAN_CHECK!!~$ENDIAN_CHECK~g; smatz@10239: s~!!ENDIAN_FORCE!!~$endian~g; smatz@10239: s~!!STAGE!!~$STAGE~g; smatz@10239: s~!!MAKEDEPEND!!~$makedepend~g; smatz@10239: s~!!CFLAGS_MAKEDEP!!~$cflags_makedep~g; smatz@10239: s~!!SORT!!~$sort~g; smatz@10239: s~!!CONFIG_CACHE_COMPILER!!~config.cache.compiler~g; smatz@10239: s~!!CONFIG_CACHE_LINKER!!~config.cache.linker~g; smatz@10239: s~!!CONFIG_CACHE_ENDIAN!!~config.cache.endian~g; smatz@10239: s~!!CONFIG_CACHE_SOURCE!!~config.cache.source~g; smatz@10239: s~!!CONFIG_CACHE_VERSION!!~config.cache.version~g; smatz@10239: s~!!CONFIG_CACHE_SOURCE_LIST!!~config.cache.source.list~g; smatz@10239: s~!!CONFIG_CACHE_PWD!!~config.cache.pwd~g; smatz@10239: s~!!LANG_SUPPRESS!!~$lang_suppress~g; smatz@10239: s~!!OBJS_C!!~$OBJS_C~g; smatz@10239: s~!!OBJS_CPP!!~$OBJS_CPP~g; smatz@10239: s~!!OBJS_MM!!~$OBJS_MM~g; smatz@10239: s~!!OBJS_RC!!~$OBJS_RC~g; smatz@10239: s~!!SRCS!!~$SRCS~g; smatz@10239: s~!!OS!!~$os~g; smatz@10239: s~!!CONFIGURE_FILES!!~$CONFIGURE_FILES~g; smatz@10239: s~!!REVISION!!~$revision~g; smatz@10239: s~!!AWK!!~$awk~g; smatz@10239: s~!!GCC295!!~$gcc295~g; smatz@10239: s~!!DISTCC!!~$distcc~g; rubidium@5475: " skidd13@9680: skidd13@9694: if [ "$icon_theme_dir" != "" ]; then skidd13@9694: SRC_REPLACE="$SRC_REPLACE skidd13@9694: s#!!ICON_THEME_DIR!!#$prefix_dir/$icon_theme_dir#g; skidd13@9694: " skidd13@9694: else skidd13@9694: SRC_REPLACE="$SRC_REPLACE skidd13@9694: s#!!ICON_THEME_DIR!!##g; skidd13@9694: " skidd13@9694: fi skidd13@9694: skidd13@9694: if [ "$man_dir" != "" ]; then skidd13@9694: SRC_REPLACE="$SRC_REPLACE skidd13@9694: s#!!MAN_DIR!!#$prefix_dir/$man_dir#g; skidd13@9694: " skidd13@9694: else skidd13@9694: SRC_REPLACE="$SRC_REPLACE skidd13@9694: s#!!MAN_DIR!!##g; skidd13@9694: " skidd13@9694: fi skidd13@9694: skidd13@9694: if [ "$menu_dir" != "" ]; then skidd13@9680: SRC_REPLACE="$SRC_REPLACE skidd13@9680: s#!!MENU_DIR!!#$prefix_dir/$menu_dir#g; skidd13@9680: " skidd13@9680: else skidd13@9680: SRC_REPLACE="$SRC_REPLACE skidd13@9680: s#!!MENU_DIR!!##g; skidd13@9680: " skidd13@9680: fi skidd13@9680: } skidd13@9680: skidd13@9680: generate_menu_item() { skidd13@9680: MENU_REPLACE=" smatz@10239: s~!!TTD!!~$TTD~g; truebrain@10245: s~!!MENU_GROUP!!~$menu_group~g; truebrain@10245: s~!!MENU_NAME!!~$menu_name~g skidd13@9680: " rubidium@10434: log 1 "Generating menu item..." truebrain@10058: mkdir -p media skidd13@9680: < $ROOT_DIR/media/openttd.desktop.in sed "$MENU_REPLACE" > media/openttd.desktop rubidium@5475: } rubidium@5475: rubidium@5475: generate_main() { rubidium@5475: STAGE="[MAIN]" rubidium@5475: rubidium@5475: make_sed rubidium@5475: rubidium@5475: # Create the main Makefile rubidium@10434: log 1 "Generating Makefile..." truebrain@10076: echo "# Auto-generated file from 'Makefile.in' -- DO NOT EDIT" > Makefile truebrain@10076: < $ROOT_DIR/Makefile.in sed "$SRC_REPLACE" >> Makefile truebrain@10057: cp $ROOT_DIR/Makefile.bundle.in Makefile.bundle rubidium@5475: echo "# Auto-generated file -- DO NOT EDIT" > Makefile.am tron@5556: echo >> Makefile.am rubidium@5475: # Make the copy of the source-list, so we don't trigger an unwanted recompile rubidium@5475: cp $SOURCE_LIST config.cache.source.list truebrain@10060: # Add the current directory, so we don't trigger an unwanted recompile truebrain@10060: echo "`pwd`" > config.cache.pwd rubidium@5475: # Make sure config.cache is OLDER then config.cache.source.list rubidium@5475: touch config.cache truebrain@10060: touch config.pwd skidd13@9680: skidd13@9694: if [ "$menu_dir" != "" ]; then skidd13@9680: generate_menu_item skidd13@9680: fi rubidium@5475: } rubidium@5475: rubidium@5475: generate_lang() { rubidium@5475: STAGE="[LANG]" rubidium@5475: rubidium@5475: make_sed rubidium@5475: rubidium@5475: # Create the language file rubidium@5475: mkdir -p $LANG_OBJS_DIR rubidium@5475: rubidium@10434: log 1 "Generating lang/Makefile..." truebrain@10076: echo "# Auto-generated file from 'Makefile.lang.in' -- DO NOT EDIT" > $LANG_OBJS_DIR/Makefile truebrain@10076: < $ROOT_DIR/Makefile.lang.in sed "$SRC_REPLACE" >> $LANG_OBJS_DIR/Makefile rubidium@5475: echo "DIRS += $LANG_OBJS_DIR" >> Makefile.am rubidium@5475: echo "LANG_DIRS += $LANG_OBJS_DIR" >> Makefile.am rubidium@5475: } rubidium@5475: rubidium@5475: generate_src_normal() { rubidium@5475: STAGE=$1 rubidium@5475: rubidium@5475: make_sed rubidium@5475: rubidium@5475: # Create the source file rubidium@5475: mkdir -p $SRC_OBJS_DIR rubidium@5475: rubidium@10434: log 1 "Generating $2/Makefile..." truebrain@10076: echo "# Auto-generated file from 'Makefile.src.in' -- DO NOT EDIT" > $SRC_OBJS_DIR/Makefile truebrain@10076: < $ROOT_DIR/Makefile.src.in sed "$SRC_REPLACE" >> $SRC_OBJS_DIR/Makefile rubidium@5475: echo "DIRS += $SRC_OBJS_DIR" >> Makefile.am rubidium@5475: echo "SRC_DIRS += $SRC_OBJS_DIR" >> Makefile.am rubidium@5475: } rubidium@5475: rubidium@5475: generate_src_osx() { rubidium@5475: cc_host_orig="$cc_host" rubidium@5475: cxx_host_orig="$cxx_host" rubidium@5475: rubidium@5475: BASE_SRC_OBJS_DIR="$OBJS_DIR/ppc" rubidium@5475: cc_host="$cc_host_orig -arch ppc" rubidium@5475: cxx_host="$cxx_host_orig -arch ppc" rubidium@5475: generate_src_normal "[PowerPC]" "objs/ppc" rubidium@5475: truelight@5493: BASE_SRC_OBJS_DIR="$OBJS_DIR/intel" rubidium@5475: cc_host="$cc_host_orig -arch i386" rubidium@5475: cxx_host="$cxx_host_orig -arch i386" truelight@5494: generate_src_normal "[Intel]" "objs/intel" rubidium@5475: rubidium@5475: BASE_SRC_OBJS_DIR="$OBJS_DIR/ppc970" rubidium@5475: cc_host="$cc_host_orig -arch ppc970" rubidium@5475: cxx_host="$cxx_host_orig -arch ppc970" rubidium@5475: CFLAGS="$CFLAGS -mtune=970 -mcpu=970 -mpowerpc-gpopt" rubidium@5475: generate_src_normal "[PowerPC G5]" "objs/ppc970" rubidium@5475: } rubidium@5475: rubidium@5475: generate_src() { tron@5558: if [ "$os" = "OSX" ] && [ "$enable_universal" != "0" ]; then rubidium@5475: generate_src_osx rubidium@5475: else rubidium@5475: generate_src_normal "[SRC]" "objs" rubidium@5475: fi rubidium@5475: } rubidium@5475: rubidium@5475: showhelp() { rubidium@5475: echo "'configure' configures OpenTTD." rubidium@5475: echo "" rubidium@5475: echo "Usage: $0 [OPTION]... [VAR=VALUE]..." rubidium@5475: echo "" rubidium@5475: echo "To assign environment variables (e.g., CC, CFLAGS...), specify them as" rubidium@5475: echo "VAR=VALUE. See below for descriptions of some of the useful variables." rubidium@5475: echo "" rubidium@5475: echo "Defaults for the options are specified in brackets." rubidium@5475: echo "" rubidium@5475: echo "Configuration:" rubidium@5475: echo " -h, --help display this help and exit" rubidium@5475: echo "" rubidium@5475: echo "System types:" rubidium@5475: echo " --build=BUILD configure for building on BUILD [guessed]" rubidium@5491: echo " --host=HOST cross-compile to build programs to run" rubidium@5491: echo " on HOST [BUILD]" rubidium@5475: echo " --windres=WINDRES the windres to use [HOST-windres]" rubidium@5475: echo " --strip=STRIP the strip to use [HOST-strip]" truelight@6081: echo " --awk=AWK the awk to use in configure [awk]" rubidium@5475: echo " --lipo=LIPO the lipo to use (OSX ONLY) [HOST-lipo]" truebrain@10059: echo " --os=OS the OS we are compiling for [DETECT]" rubidium@9072: echo " DETECT/UNIX/OSX/FREEBSD/OPENBSD/NETBSD/" rubidium@9072: echo " MORPHOS/HPUX/BEOS/SUNOS/CYGWIN/MINGW/OS2/" rubidium@10385: echo " DOS/WINCE/PSP" rubidium@5491: echo " --endian=ENDIAN set the endian of the HOST (AUTO/LE/BE)" rubidium@5491: echo " --revision=rXXXX overwrite the revision detection." rubidium@5491: echo " Use with care!" rubidium@5475: echo "" rubidium@5475: echo "Paths:" rubidium@5491: echo " --prefix-dir=dir specifies the prefix for all installed" truebrain@10059: echo " files [/usr/local]" rubidium@5491: echo " --binary-dir=dir location of the binary. Will be prefixed" truebrain@10059: echo " with the prefix-dir [games]" rubidium@5491: echo " --data-dir=dir location of data files (lang, data, gm)." rubidium@5491: echo " Will be prefixed with the prefix-dir" truebrain@10059: echo " [share/games/openttd]" skidd13@9694: echo " --doc-dir=dir location of the doc files" skidd13@9694: echo " Will be prefixed with the prefix-dir" skidd13@9694: echo " [$doc_dir]" rubidium@5491: echo " --icon-dir=dir location of icons. Will be prefixed" truebrain@10059: echo " with the prefix-dir [share/pixmaps]" skidd13@9694: echo " --icon-theme-dir=dir location of icon theme." skidd13@9694: echo " Will be prefixed with the prefix-dir" skidd13@9694: echo " and postfixed with size-dirs [$icon_theme_dir]" skidd13@9694: echo " --man-dir=dir location of the manual page (UNIX only)" skidd13@9694: echo " Will be prefixed with the prefix-dir" skidd13@9694: echo " [$man_dir]" skidd13@9680: echo " --menu-dir=dir location of the menu item. (UNIX only, except OSX)" skidd13@9680: echo " Will be prefixed with the prefix-dir" truebrain@10059: echo " [share/applications]" bjarni@8273: echo " --personal-dir=dir location of the personal directory" truebrain@10059: echo " [os-dependent default]" bjarni@8273: echo " --shared-dir=dir location of shared data files" truebrain@10059: echo " [os-dependent default]" rubidium@5491: echo " --install-dir=dir specifies the root to install to." truebrain@10059: echo " Useful to install into jails [/]" truebrain@10244: echo " --binary-name the name used for the binary, icons," truebrain@10244: echo " desktop file, etc. when installing [openttd]" rubidium@5475: echo "" rubidium@5475: echo "Features and packages:" rubidium@5491: echo " --enable-debug[=LVL] enable debug-mode (LVL=[0123], 0 is release)" glx@9924: echo " --enable-desync-debug=[LVL] enable desync debug options (LVL=[012], 0 is none" rubidium@5491: echo " --enable-profiling enables profiling" rubidium@5491: echo " --enable-dedicated compile a dedicated server (without video)" rubidium@5491: echo " --enable-static enable static compile (doesn't work for" rubidium@5491: echo " all HOSTs)" rubidium@5475: echo " --enable-translator enable extra output for translators" rubidium@5475: echo " --enable-universal enable universal builds (OSX ONLY)" peter1138@10024: echo " --enable-osx-g5 enables optimizations for G5 (OSX ONLY)" egladil@8092: echo " --disable-cocoa-quartz disable the quartz window mode driver for Cocoa (OSX ONLY)" egladil@8092: echo " --disable-cocoa-quickdraw disable the quickdraw window mode driver for Cocoa (OSX ONLY)" glx@7687: echo " --disable-unicode disable unicode support to build win9x" glx@7687: echo " version (Win32 ONLY)" rubidium@5475: echo " --disable-network disable network support" rubidium@5491: echo " --disable-assert disable asserts (continue on errors)" rubidium@8782: echo " --enable-strip enable any possible stripping" rubidium@5491: echo " --without-osx-sysroot disable the automatic adding of sysroot " rubidium@5491: echo " (OSX ONLY)" rubidium@5491: echo " --without-application-bundle disable generation of application bundle" rubidium@5491: echo " (OSX ONLY)" skidd13@9684: echo " --without-menu-entry Don't generate a menu item (Freedesktop based only)" glx@9924: echo " --menu-group=group Category in which the menu item will be placed (Freedesktop based only)" truebrain@10246: echo " --menu-name=name Name of the menu item when placed [OpenTTD]" rubidium@5475: echo " --with-direct-music enable direct music support (Win32 ONLY)" rubidium@5475: echo " --with-sort=sort define a non-default location for sort" rubidium@5475: echo " --with-midi=midi define which midi-player to use" rubidium@5491: echo " --with-midi-arg=arg define which args to use for the" rubidium@5491: echo " midi-player" rubidium@10379: echo " --with-allegrol[=allegro-config]" rubidium@10379: echo " enables Allegro video driver support" rubidium@5491: echo " --with-cocoa enables COCOA video driver (OSX ONLY)" rubidium@5475: echo " --with-sdl[=sdl-config] enables SDL video driver support" rubidium@5475: echo " --with-zlib[=zlib.a] enables zlib support" rubidium@5475: echo " --with-png[=libpng-config] enables libpng support" rubidium@5475: echo " --with-freetype[=freetype-config]" rubidium@5475: echo " enables libfreetype support" rubidium@5475: echo " --with-fontconfig[=pkg-config fontconfig]" rubidium@5475: echo " enables fontconfig support" rubidium@10249: echo " --with-icu[=icu-config] enables icu (used for right-to-left support)" rubidium@5475: echo " --with-iconv[=iconv-path] enables iconv support" truelight@5958: echo " --with-psp-config[=psp-config] enables psp-config support (PSP ONLY)" rubidium@5475: echo " --with-makedepend[=makedepend] enables makedepend support" rubidium@5475: echo "" rubidium@5475: echo "Some influential environment variables:" rubidium@5475: echo " CC C compiler command" rubidium@5475: echo " CXX C++ compiler command" rubidium@5475: echo " CFLAGS C compiler flags" rubidium@5475: echo " WINDRES windres command" rubidium@5491: echo " LDFLAGS linker flags, e.g. -L if you" rubidium@5491: echo " have libraries in a nonstandard" rubidium@5491: echo " directory " rubidium@5475: echo "" rubidium@5475: echo "Use these variables to override the choices made by 'configure' or to help" rubidium@5475: echo "it to find libraries and programs with nonstandard names/locations." rubidium@5475: }