60 with_libtimidity="1" |
59 with_libtimidity="1" |
61 with_freetype="1" |
60 with_freetype="1" |
62 with_fontconfig="1" |
61 with_fontconfig="1" |
63 with_psp_config="1" |
62 with_psp_config="1" |
64 |
63 |
65 save_params_array="build host cc_build cc_host cxx_build cxx_host windres strip awk lipo os revision endian config_log prefix_dir binary_dir data_dir icon_dir personal_dir install_dir custom_lang_dir second_data_dir enable_install enable_debug enable_profiling enable_dedicated enable_network enable_static enable_translator enable_assert enable_strip with_distcc with_osx_sysroot enable_universal enable_osx_g5 enable_unicode with_application_bundle with_sdl with_cocoa with_zlib with_png with_makedepend with_direct_music with_sort with_iconv with_midi with_midi_arg with_libtimidity with_freetype with_fontconfig with_psp_config CC CXX CFLAGS LDFLAGS" |
64 save_params_array="build host cc_build cc_host cxx_build cxx_host windres strip awk lipo os cpu_type revision endian config_log prefix_dir binary_dir data_dir icon_dir personal_dir install_dir enable_debug enable_profiling enable_dedicated enable_network enable_static enable_translator enable_assert enable_strip with_distcc with_ccache with_osx_sysroot enable_universal enable_osx_g5 enable_unicode with_application_bundle with_sdl with_cocoa with_zlib with_png with_makedepend with_direct_music with_sort with_iconv with_midi with_midi_arg with_libtimidity with_freetype with_fontconfig with_psp_config CC CXX CFLAGS LDFLAGS" |
66 } |
65 } |
67 |
66 |
68 detect_params() { |
67 detect_params() { |
69 # Walk over all params from the user and override any default settings if |
68 # Walk over all params from the user and override any default settings if |
70 # needed. This also handles any invalid option. |
69 # needed. This also handles any invalid option. |
89 --host) prev_p="host";; |
88 --host) prev_p="host";; |
90 --host=*) host="$optarg";; |
89 --host=*) host="$optarg";; |
91 |
90 |
92 --os) prev_p="os";; |
91 --os) prev_p="os";; |
93 --os=*) os="$optarg";; |
92 --os=*) os="$optarg";; |
|
93 |
|
94 --cpu-type) prev_p="cpu_type";; |
|
95 --cpu-type=*) cpu_type="$optarg";; |
94 |
96 |
95 --revision=*) revision="$optarg";; |
97 --revision=*) revision="$optarg";; |
96 |
98 |
97 --cc-build) prevp_p="cc_build";; |
99 --cc-build) prevp_p="cc_build";; |
98 --cc-build=*) cc_build="$optarg";; |
100 --cc-build=*) cc_build="$optarg";; |
128 --icon-dir) prevp_p="icon-dir";; |
130 --icon-dir) prevp_p="icon-dir";; |
129 --icon-dir=*) icon_dir="$optarg";; |
131 --icon-dir=*) icon_dir="$optarg";; |
130 |
132 |
131 --personal-dir) prevp_p="personal-dir";; |
133 --personal-dir) prevp_p="personal-dir";; |
132 --personal-dir=*) personal_dir="$optarg";; |
134 --personal-dir=*) personal_dir="$optarg";; |
|
135 --without-personal-dir) personal_dir="";; |
133 |
136 |
134 --install-dir) prevp_p="install-dir";; |
137 --install-dir) prevp_p="install-dir";; |
135 --install-dir=*) install_dir="$optarg";; |
138 --install-dir=*) install_dir="$optarg";; |
136 |
139 |
137 # TODO: The next few cases will be removed when the search path patch is applied |
|
138 --custom-lang-dir) prevp_p="custom-lang-dir";; |
|
139 --custom-lang-dir=*) custom_lang_dir="$optarg";; |
|
140 |
|
141 --second-data-dir) prevp_p="second-data-dir";; |
|
142 --second-data-dir=*) second_data_dir="$optarg";; |
|
143 |
|
144 --enable-install) enable_install="1";; |
|
145 --enable-install=*) enable_install="$optarg";; |
|
146 # TODO: End of to be removed cases |
|
147 |
140 |
148 |
141 |
149 --enable-debug) enable_debug="1";; |
142 --enable-debug) enable_debug="1";; |
150 --enable-debug=*) enable_debug="$optarg";; |
143 --enable-debug=*) enable_debug="$optarg";; |
151 --enable-profiling) enable_profiling="1";; |
144 --enable-profiling) enable_profiling="1";; |
238 |
231 |
239 --without-distcc) with_distcc="0";; |
232 --without-distcc) with_distcc="0";; |
240 --with-distcc) with_distcc="2";; |
233 --with-distcc) with_distcc="2";; |
241 --with-distcc=*) with_distcc="$optarg";; |
234 --with-distcc=*) with_distcc="$optarg";; |
242 |
235 |
|
236 --without-ccache) with_ccache="0";; |
|
237 --with-ccache) with_ccache="2";; |
|
238 --with-ccache=*) with_ccache="$optarg";; |
|
239 |
243 --without-osx-sysroot) with_osx_sysroot="0";; |
240 --without-osx-sysroot) with_osx_sysroot="0";; |
244 --with-osx-sysroot) with_osx_sysroot="2";; |
241 --with-osx-sysroot) with_osx_sysroot="2";; |
245 --with-osx-sysroot=*) with_osx_sysroot="$optarg";; |
242 --with-osx-sysroot=*) with_osx_sysroot="$optarg";; |
246 |
243 |
247 --without-application-bundle) with_application_bundle="0";; |
244 --without-application-bundle) with_application_bundle="0";; |
299 # Some params want to be in full uppercase, else they might not work as |
296 # Some params want to be in full uppercase, else they might not work as |
300 # expected.. fix that here |
297 # expected.. fix that here |
301 |
298 |
302 endian=`echo $endian | tr '[a-z]' '[A-Z]'` |
299 endian=`echo $endian | tr '[a-z]' '[A-Z]'` |
303 os=`echo $os | tr '[a-z]' '[A-Z]'` |
300 os=`echo $os | tr '[a-z]' '[A-Z]'` |
|
301 cpu_type=`echo $cpu_type | tr '[a-z]' '[A-Z]'` |
304 |
302 |
305 # Check if all params have valid values |
303 # Check if all params have valid values |
306 |
304 |
307 # Endian only allows AUTO, LE and, BE |
305 # Endian only allows AUTO, LE and, BE |
308 if [ -z "`echo $endian | egrep '^(AUTO|LE|BE)$'`" ]; then |
306 if [ -z "`echo $endian | egrep '^(AUTO|LE|BE)$'`" ]; then |
314 if [ -z "`echo $os | egrep '^(DETECT|UNIX|OSX|FREEBSD|OPENBSD|MORPHOS|BEOS|SUNOS|CYGWIN|MINGW|OS2|WINCE|PSP)$'`" ]; then |
312 if [ -z "`echo $os | egrep '^(DETECT|UNIX|OSX|FREEBSD|OPENBSD|MORPHOS|BEOS|SUNOS|CYGWIN|MINGW|OS2|WINCE|PSP)$'`" ]; then |
315 echo "configure: error: invalid option --os=$os" |
313 echo "configure: error: invalid option --os=$os" |
316 echo " Available options are: --os=[DETECT|UNIX|OSX|FREEBSD|OPENBSD|MORPHOS|BEOS|SUNOS|CYGWIN|MINGW|OS2|WINCE|PSP]" |
314 echo " Available options are: --os=[DETECT|UNIX|OSX|FREEBSD|OPENBSD|MORPHOS|BEOS|SUNOS|CYGWIN|MINGW|OS2|WINCE|PSP]" |
317 exit 1 |
315 exit 1 |
318 fi |
316 fi |
|
317 # cpu_type can be either 32 or 64 |
|
318 if [ -z "`echo $cpu_type | grep '^32$\|^64$\|^DETECT$'`" ]; then |
|
319 echo "configure: error: invalid option --cpu-type=$cpu_type" |
|
320 echo " Available options are: --cpu-type[=DETECT|32|64]" |
|
321 exit 1 |
|
322 fi |
319 # enable_debug should be between 0 and 4 |
323 # enable_debug should be between 0 and 4 |
320 if [ -z "`echo $enable_debug | grep '^[0123]$'`" ]; then |
324 if [ -z "`echo $enable_debug | grep '^[0123]$'`" ]; then |
321 echo "configure: error: invalid option --enable-debug=$enable_debug" |
325 echo "configure: error: invalid option --enable-debug=$enable_debug" |
322 echo " Available options are: --enable-debug[=0123]" |
326 echo " Available options are: --enable-debug[=0123]" |
323 exit 1 |
327 exit 1 |
544 fi |
549 fi |
545 |
550 |
546 log 1 "checking distcc... $distcc" |
551 log 1 "checking distcc... $distcc" |
547 fi |
552 fi |
548 |
553 |
|
554 if [ "$with_ccache" = "0" ]; then |
|
555 log 1 "checking ccache... no" |
|
556 elif [ "$with_ccache" = "1" ]; then |
|
557 with_ccache="0" |
|
558 |
|
559 log 1 "checking ccache... no (only used when forced)" |
|
560 elif [ "$with_ccache" = "2" ]; then |
|
561 ccache="ccache" |
|
562 else |
|
563 ccache="$with_ccache" |
|
564 fi |
|
565 if [ "$with_ccache" != "0" ]; then |
|
566 res="`$ccache --version 2>/dev/null | head -n 1 | cut -b 0-6`" |
|
567 if [ "$res" != "ccache" ]; then |
|
568 ccache="" |
|
569 log 1 "checking ccache... no" |
|
570 if [ "$with_ccache" = "2" ]; then |
|
571 log 1 "configure: error: no ccache detected, but was forced to be used" |
|
572 exit 1 |
|
573 fi |
|
574 if [ "$with_ccache" != "1" ]; then |
|
575 log 1 "configure: error: '$with_ccache' doesn't seem a ccache to me" |
|
576 exit 1 |
|
577 fi |
|
578 fi |
|
579 |
|
580 log 1 "checking ccache... $ccache" |
|
581 fi |
|
582 |
549 if [ "$os" != "OSX" ] && [ "$with_osx_sysroot" != "0" ]; then |
583 if [ "$os" != "OSX" ] && [ "$with_osx_sysroot" != "0" ]; then |
550 if [ "$with_osx_sysroot" = "1" ]; then |
584 if [ "$with_osx_sysroot" = "1" ]; then |
551 with_osx_sysroot="0" |
585 with_osx_sysroot="0" |
552 |
586 |
553 log 1 "checking OSX sysroot... not OSX, skipping" |
587 log 1 "checking OSX sysroot... not OSX, skipping" |
587 fi |
621 fi |
588 fi |
622 fi |
589 |
623 |
590 if [ "$os" = "OSX" ] && [ "$with_application_bundle" = "1" ]; then |
624 if [ "$os" = "OSX" ] && [ "$with_application_bundle" = "1" ]; then |
591 OSXAPP="OpenTTD.app" |
625 OSXAPP="OpenTTD.app" |
592 |
|
593 # TODO: remove next few lines of code when the search path patch has been applied |
|
594 if [ -n "$custom_lang_dir" ] && [ "$custom_lang_dir" != "${OSXAPP}/Contents/Resources/lang/" ]; then |
|
595 log 1 "configure: error: --custom-lang-dir and --with-application-bundle are not compatible |
|
596 exit 1 |
|
597 fi |
|
598 |
|
599 if [ -n "$custom_lang_dir" ] && [ "$second_data_dir" != "${OSXAPP}/Contents/Resources/data/" ]; then |
|
600 log 1 "configure: error: --second-data-dir and --with-application-bundle are not compatible |
|
601 exit 1 |
|
602 fi |
|
603 |
|
604 custom_lang_dir="${OSXAPP}/Contents/Resources/lang/" |
|
605 second_data_dir="${OSXAPP}/Contents/Resources/data/" |
|
606 # TODO: remove till here |
|
607 else |
626 else |
608 OSXAPP="" |
627 OSXAPP="" |
609 fi |
628 fi |
610 |
629 |
611 if [ "$os" = "OSX" ]; then |
630 if [ "$os" = "OSX" ]; then |
683 log 1 "WARNING: servers as you will desync." |
702 log 1 "WARNING: servers as you will desync." |
684 log 1 "WARNING: USE WITH CAUTION!" |
703 log 1 "WARNING: USE WITH CAUTION!" |
685 |
704 |
686 sleep 5 |
705 sleep 5 |
687 fi |
706 fi |
|
707 fi |
|
708 |
|
709 if [ "$personal_dir" = "1" ]; then |
|
710 if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ]; then |
|
711 personal_dir="OpenTTD" |
|
712 elif [ "$os" = "OSX" ]; then |
|
713 personal_dir="Documents/OpenTTD" |
|
714 else |
|
715 personal_dir=".openttd" |
|
716 fi |
|
717 fi |
|
718 |
|
719 if [ -n "$personal_dir" ] |
|
720 then |
|
721 log 1 "personal home directory... $personal_dir" |
|
722 else |
|
723 log 1 "personal home directory... none" |
|
724 fi |
|
725 |
|
726 if [ -n "$install_dir" ] |
|
727 then |
|
728 log 1 "installation directory... $install_dir" |
|
729 else |
|
730 log 1 "installation directory... none" |
688 fi |
731 fi |
689 } |
732 } |
690 |
733 |
691 make_cflags_and_ldflags() { |
734 make_cflags_and_ldflags() { |
692 # General CFlags for BUILD |
735 # General CFlags for BUILD |
982 if [ "$with_osx_sysroot" != "0" ] && [ "$with_osx_sysroot" != "3" ]; then |
1025 if [ "$with_osx_sysroot" != "0" ] && [ "$with_osx_sysroot" != "3" ]; then |
983 CFLAGS="$CFLAGS -isysroot /Developer/SDKs/MacOSX$with_osx_sysroot.sdk" |
1026 CFLAGS="$CFLAGS -isysroot /Developer/SDKs/MacOSX$with_osx_sysroot.sdk" |
984 LDFLAGS="$LDFLAGS -Wl,-syslibroot,/Developer/SDKs/MacOSX$with_osx_sysroot.sdk" |
1027 LDFLAGS="$LDFLAGS -Wl,-syslibroot,/Developer/SDKs/MacOSX$with_osx_sysroot.sdk" |
985 fi |
1028 fi |
986 |
1029 |
987 # TODO: remove next few lines of code when the search path patch has been applied |
1030 if [ -n "$personal_dir" ]; then |
988 if [ -n "$second_data_dir" ]; then |
1031 CFLAGS="$CFLAGS -DWITH_PERSONAL_DIR -DPERSONAL_DIR=\\\\\"$personal_dir\\\\\"" |
989 CFLAGS="$CFLAGS -DSECOND_DATA_DIR=\\\\\"$second_data_dir\\\\\"" |
1032 fi |
990 fi |
1033 |
991 |
1034 CFLAGS="$CFLAGS -DGLOBAL_DATA_DIR=\\\\\"$prefix_dir/$data_dir\\\\\"" |
992 if [ -n "$custom_lang_dir" ]; then |
|
993 CFLAGS="$CFLAGS -DCUSTOM_LANG_DIR=\\\\\"$custom_lang_dir\\\\\"" |
|
994 fi |
|
995 # TODO: remove till here |
|
996 |
|
997 if [ "$enable_install" = "1" ]; then |
|
998 if [ -n "$personal_dir" ]; then |
|
999 CFLAGS="$CFLAGS -DUSE_HOMEDIR=1 -DPERSONAL_DIR=\\\\\"$personal_dir/\\\\\"" |
|
1000 fi |
|
1001 |
|
1002 if [ -n "$data_dir" ]; then |
|
1003 CFLAGS="$CFLAGS -DGAME_DATA_DIR=\\\\\"$prefix_dir/$data_dir/\\\\\"" |
|
1004 fi |
|
1005 |
|
1006 if [ -n "$icon_dir" ]; then |
|
1007 CFLAGS="$CFLAGS -DICON_DIR=\\\\\"$prefix_dir/$icon_dir/\\\\\"" |
|
1008 fi |
|
1009 fi |
|
1010 |
1035 |
1011 log 1 "using CFLAGS... $CFLAGS $CC_CFLAGS" |
1036 log 1 "using CFLAGS... $CFLAGS $CC_CFLAGS" |
1012 log 1 "using LDFLAGS... $LIBS $LDFLAGS" |
1037 log 1 "using LDFLAGS... $LIBS $LDFLAGS" |
1013 |
1038 |
1014 # Makedepend doesn't like something like: -isysroot /OSX/blabla |
1039 # Makedepend doesn't like something like: -isysroot /OSX/blabla |
1465 detect_library() { |
1495 detect_library() { |
1466 # $1 - config-param ($with_zlib value) |
1496 # $1 - config-param ($with_zlib value) |
1467 # $2 - library name ('zlib', sets $zlib) |
1497 # $2 - library name ('zlib', sets $zlib) |
1468 # $3 - static library name (libz.a) |
1498 # $3 - static library name (libz.a) |
1469 # $4 - header name (zlib.h) |
1499 # $4 - header name (zlib.h) |
|
1500 # $5 - force static (if non-empty) |
|
1501 |
|
1502 if [ -n "$5" ]; then force_static="1"; fi |
1470 |
1503 |
1471 # 0 means no, 1 is auto-detect, 2 is force |
1504 # 0 means no, 1 is auto-detect, 2 is force |
1472 if [ "$1" = "0" ]; then |
1505 if [ "$1" = "0" ]; then |
1473 log 1 "checking $2... disabled" |
1506 log 1 "checking $2... disabled" |
1474 |
1507 |
1489 if [ -z "$res" ]; then |
1522 if [ -z "$res" ]; then |
1490 log 2 " trying /usr/local/include/$4... no" |
1523 log 2 " trying /usr/local/include/$4... no" |
1491 fi |
1524 fi |
1492 |
1525 |
1493 eval "res=\$$2" |
1526 eval "res=\$$2" |
1494 if [ -n "$res" ] && [ "$enable_static" != "0" ] && [ "$os" != "OSX" ]; then |
1527 if [ -n "$res" ] && ( [ -n "$force_static" ] || ( [ "$enable_static" != "0" ] && [ "$os" != "OSX" ] ) ); then |
1495 eval "res=\$$2" |
1528 eval "res=\$$2" |
1496 log 2 " trying $res... found" |
1529 log 2 " trying $res... found" |
1497 # Now find the static lib, if needed |
1530 # Now find the static lib, if needed |
1498 eval "$2=`ls /lib/*.a 2>/dev/null | grep \"\/$3\$\"`" |
1531 eval "$2=`ls /lib/*.a 2>/dev/null | grep \"\/$3\$\"`" |
1499 eval "res=\$$2" |
1532 eval "res=\$$2" |
1850 log 1 "checking sort... not found" |
1883 log 1 "checking sort... not found" |
1851 fi |
1884 fi |
1852 else |
1885 else |
1853 log 1 "checking sort... $sort" |
1886 log 1 "checking sort... $sort" |
1854 fi |
1887 fi |
|
1888 } |
|
1889 |
|
1890 detect_cputype() { |
|
1891 if [ -n "$cpu_type" ] && [ "$cpu_type" != "DETECT" ]; then |
|
1892 log 1 "forcing cpu-type... $cpu_type bits" |
|
1893 return; |
|
1894 fi |
|
1895 echo "#include \"src/stdafx.h\"" > tmp.64bit.cpp |
|
1896 echo "assert_compile(sizeof(size_t) == 8);" >> tmp.64bit.cpp |
|
1897 echo "int main() { return 0; }" >> tmp.64bit.cpp |
|
1898 execute="$cxx_host $CFLAGS tmp.64bit.cpp -o tmp.64bit -DTESTING 2>&1" |
|
1899 cpu_type="`eval $execute 2>/dev/null`" |
|
1900 ret=$? |
|
1901 log 2 "executing $execute" |
|
1902 log 2 " returned $cpu_type" |
|
1903 log 2 " exit code $ret" |
|
1904 if [ "$ret" = "0" ]; then cpu_type="64"; else cpu_type="32"; fi |
|
1905 log 1 "detecting cpu-type... $cpu_type bits" |
|
1906 rm -f tmp.64bit tmp.64bit.cpp |
1855 } |
1907 } |
1856 |
1908 |
1857 make_sed() { |
1909 make_sed() { |
1858 # We check here if we are PPC, because then we need to enable FOUR_BYTE_BOOL |
1910 # We check here if we are PPC, because then we need to enable FOUR_BYTE_BOOL |
1859 # We do this here, and not sooner, so universal builds also have this |
1911 # We do this here, and not sooner, so universal builds also have this |
2049 echo " --data-dir=dir location of data files (lang, data, gm)." |
2100 echo " --data-dir=dir location of data files (lang, data, gm)." |
2050 echo " Will be prefixed with the prefix-dir" |
2101 echo " Will be prefixed with the prefix-dir" |
2051 echo " [share/games/openttd]" |
2102 echo " [share/games/openttd]" |
2052 echo " --icon-dir=dir location of icons. Will be prefixed" |
2103 echo " --icon-dir=dir location of icons. Will be prefixed" |
2053 echo " with the prefix-dir [share/pixmaps]" |
2104 echo " with the prefix-dir [share/pixmaps]" |
2054 echo " --personal-dir=dir location of the personal directory []" |
2105 echo " --personal-dir=dir location of the personal directory [.openttd]" |
2055 echo " --install-dir=dir specifies the root to install to." |
2106 echo " --install-dir=dir specifies the root to install to." |
2056 echo " Useful to install into jails [/]" |
2107 echo " Useful to install into jails [/]" |
2057 echo "" |
|
2058 # TODO: The Following 3 tags will be removed when the 'search path patch' is applied |
|
2059 echo " --second-data-dir=dir specifies a second directory for the" |
|
2060 echo " data files" |
|
2061 echo " --custom-lang-dir=dir specifies a custom directory for the" |
|
2062 echo " language files" |
|
2063 echo " --enable-install make a binary that uses the specified" |
|
2064 echo " data-dir and icon-dir" |
|
2065 echo "" |
2108 echo "" |
2066 echo "Features and packages:" |
2109 echo "Features and packages:" |
2067 echo " --enable-debug[=LVL] enable debug-mode (LVL=[0123], 0 is release)" |
2110 echo " --enable-debug[=LVL] enable debug-mode (LVL=[0123], 0 is release)" |
2068 echo " --enable-profiling enables profiling" |
2111 echo " --enable-profiling enables profiling" |
2069 echo " --enable-dedicated compile a dedicated server (without video)" |
2112 echo " --enable-dedicated compile a dedicated server (without video)" |