413
438
# Endian only allows AUTO, LE and, BE
414
439
if [ -z "`echo $endian | egrep '^(AUTO|LE|BE|PREPROCESSOR)$'`" ]; then
415
echo "configure: error: invalid option --endian=$endian"
416
echo " Available options are: --endian=[AUTO|LE|BE]"
440
log 1 "configure: error: invalid option --endian=$endian"
441
log 1 " Available options are: --endian=[AUTO|LE|BE]"
419
444
if [ "$endian" = "PREPROCESSOR" ] && [ "$os" != "OSX" ]; then
420
echo "configure: error: invalid option --endian=$endian"
421
echo " PREPROCESSOR is only available for OSX"
445
log 1 "configure: error: invalid option --endian=$endian"
446
log 1 " PREPROCESSOR is only available for OSX"
424
# OS only allows DETECT, UNIX, OSX, FREEBSD, OPENBSD, MORPHOS, BEOS, SUNOS, CYGWIN, MINGW, OS2, WINCE, and PSP
425
if [ -z "`echo $os | egrep '^(DETECT|UNIX|OSX|FREEBSD|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|SUNOS|CYGWIN|MINGW|OS2|WINCE|PSP)$'`" ]; then
426
echo "configure: error: invalid option --os=$os"
427
echo " Available options are: --os=[DETECT|UNIX|OSX|FREEBSD|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|SUNOS|CYGWIN|MINGW|OS2|WINCE|PSP]"
449
# OS only allows DETECT, UNIX, OSX, FREEBSD, OPENBSD, MORPHOS, BEOS, SUNOS, CYGWIN, MINGW, OS2, DOS, WINCE, and PSP
450
if [ -z "`echo $os | egrep '^(DETECT|UNIX|OSX|FREEBSD|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|SUNOS|CYGWIN|MINGW|OS2|DOS|WINCE|PSP)$'`" ]; then
451
log 1 "configure: error: invalid option --os=$os"
452
log 1 " Available options are: --os=[DETECT|UNIX|OSX|FREEBSD|OPENBSD|NETBSD|HPUX|MORPHOS|BEOS|SUNOS|CYGWIN|MINGW|OS2|DOS|WINCE|PSP]"
430
455
# cpu_type can be either 32 or 64
431
456
if [ -z "`echo $cpu_type | egrep '^(32|64|DETECT)$'`" ]; then
432
echo "configure: error: invalid option --cpu-type=$cpu_type"
433
echo " Available options are: --cpu-type[=DETECT|32|64]"
457
log 1 "configure: error: invalid option --cpu-type=$cpu_type"
458
log 1 " Available options are: --cpu-type[=DETECT|32|64]"
436
461
# enable_debug should be between 0 and 4
437
462
if [ -z "`echo $enable_debug | egrep '^[0123]$'`" ]; then
438
echo "configure: error: invalid option --enable-debug=$enable_debug"
439
echo " Available options are: --enable-debug[=0123]"
463
log 1 "configure: error: invalid option --enable-debug=$enable_debug"
464
log 1 " Available options are: --enable-debug[=0123]"
443
468
# enable_desync_debug should be between 0 and 3
444
469
if [ -z "`echo $enable_desync_debug | egrep '^[012]$'`" ]; then
445
echo "configure: error: invalid option --enable-desync-debug=$enable_desync_debug"
446
echo " Available options are: --enable-desync-debug[=012]"
470
log 1 "configure: error: invalid option --enable-desync-debug=$enable_desync_debug"
471
log 1 " Available options are: --enable-desync-debug[=012]"
558
584
log 1 "checking GDI video driver... not Windows, skipping"
561
if [ -z "$sdl_config" ] && [ "$with_cocoa" = 0 ] && [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "WINCE" ]; then
562
log 1 "WARNING: no video driver found, building dedicated only"
566
log 1 "checking dedicated... found"
587
if [ -z "$allegro_config" ] && [ -z "$sdl_config" ] && [ "$with_cocoa" = 0 ] && [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "WINCE" ]; then
588
log 1 "configure: error: no video driver development files found"
589
log 1 " If you want a dedicated server use --enable-dedicated as parameter"
568
592
log 1 "checking dedicated... not selected"
572
if [ "$enable_network" != "0" ]; then
596
if [ "$enable_network" = "1" ] && [ "$os" = "DOS" ]; then
597
log 1 "checking network... DOS, skipping"
599
elif [ "$enable_network" != "0" ]; then
573
600
log 1 "checking network... found"
575
602
log 1 "checking network... disabled"
590
617
log 1 "checking assert... disabled"
620
SCRIPT_SRC_DIR="$ROOT_DIR/src/3rdparty/squirrel/include"
621
if [ ! -d "$SCRIPT_SRC_DIR" ]; then
622
log 1 "checking 3rdparty... NOT FOUND"
623
log 1 "ERROR: please make sure you have src/3rdparty/squirrel"
624
log 1 "ERROR: you can find the source at svn://svn.openttd.org/3rdparty/squirrel"
627
log 1 "checking 3rdparty... found"
629
pre_detect_with_zlib=$with_zlib
632
if [ "$with_zlib" = "0" ] || [ -z "$zlib" ]; then
633
log 1 "WARNING: zlib was not detected or disabled"
634
log 1 "WARNING: OpenTTD doesn't require zlib, but it does mean many features (like"
635
log 1 "WARNING: loading most savegames/scenarios, joining most servers, loading"
636
log 1 "WARNING: heightmaps, using PNG or using fonts, ...) will be disabled."
637
if [ "$pre_detect_with_zlib" = "0" ]; then
638
log 1 "WARNING: We strongly suggest you to install zlib."
640
log 1 "configure: error: no zlib detected"
641
log 1 " If you want to compile without zlib use --without-zlib as parameter"
596
648
detect_fontconfig
598
651
detect_libtimidity
600
if [ "$with_direct_music" = "1" ] || [ "$with_direct_music" = "2" ]; then
653
if [ "$with_direct_music" != "0" ]; then
601
654
if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then
602
if [ "$with_direct_music" = "2" ]; then
655
if [ "$with_direct_music" != "1" ]; then
603
656
log 1 "configure: error: direct-music is only supported on Win32 targets"
816
873
revision="`cat $ROOT_DIR/version`"
818
875
log 1 "checking revision... $revision"
819
elif [ -d "$ROOT_DIR/.svn" ] && [ -n "`svn help`" ]; then
876
elif [ -d "$ROOT_DIR/.svn" ] && [ -n "`svn help 2>/dev/null`" ]; then
821
878
log 1 "checking revision... svn detection"
822
elif [ -d "$ROOT_DIR/.git" ] && [ -n "`git help`" ]; then
879
elif [ -d "$ROOT_DIR/.git" ] && [ -n "`git help 2>/dev/null`" ]; then
824
881
log 1 "checking revision... git detection"
825
elif [ -d "$ROOT_DIR/.hg" ] && [ -n "`hg help`" ]; then
882
elif [ -d "$ROOT_DIR/.hg" ] && [ -n "`hg help 2>/dev/null`" ]; then
827
884
log 1 "checking revision... hg detection"
830
887
log 1 "checking revision... no detection"
831
888
log 1 "WARNING: there is no means to determine the version."
832
log 1 "WARNING: please use a subversion or git checkout of OpenTTD."
833
log 1 "WARNING: this version is only allowed by game servers that"
834
log 1 "WARNING: have been compiled without version detection."
889
log 1 "WARNING: please use a subversion, mercurial, or git checkout of OpenTTD."
890
log 1 "WARNING: you can only join game servers that have been compiled without"
891
log 1 "WARNING: version detection."
835
892
log 1 "WARNING: there is a great chance you desync."
836
893
log 1 "WARNING: USE WITH CAUTION!"
1638
1734
if [ "$os" = "DETECT" ]; then
1639
# Detect UNIX, OSX, FREEBSD, OPENBSD, NETBSD, HPUX, MORPHOS, BEOS, SUNOS, CYGWIN, MINGW, OS2, WINCE, and PSP
1735
# Detect UNIX, OSX, FREEBSD, OPENBSD, NETBSD, HPUX, MORPHOS, BEOS, SUNOS, CYGWIN, MINGW, OS2, DOS, WINCE, and PSP
1641
1737
# Try first via dumpmachine, then via uname
1642
1738
os=`echo "$host" | tr '[A-Z]' '[a-z]' | $awk '
1677
1774
if [ -z "$os" ]; then
1678
1775
log 1 "detecting OS... none detected"
1679
1776
log 1 "I couldn't detect your OS. Please use --os=OS to force one"
1680
log 1 "Allowed values are: UNIX, OSX, FREEBSD, OPENBSD, NETBSD, MORPHOS, HPUX, BEOS, SUNOS, CYGWIN, MINGW, OS2, WINCE, and PSP"
1777
log 1 "Allowed values are: UNIX, OSX, FREEBSD, OPENBSD, NETBSD, MORPHOS, HPUX, BEOS, SUNOS, CYGWIN, MINGW, OS2, DOS, WINCE, and PSP"
1788
# 0 means no, 1 is auto-detect, 2 is force
1789
if [ "$with_allegro" = "0" ]; then
1790
log 1 "checking Allegro... disabled"
1796
if [ "$with_allegro" = "2" ] && [ "$with_cocoa" = "2" ]; then
1797
log 1 "configure: error: it is impossible to compile both Allegro and COCOA"
1798
log 1 "configure: error: please deselect one of them and try again"
1802
if [ "$with_allegro" = "2" ] && [ "$enable_dedicated" != "0" ]; then
1803
log 1 "configure: error: it is impossible to compile a dedicated with Allegro"
1804
log 1 "configure: error: please deselect one of them and try again"
1808
if [ "$enable_dedicated" != "0" ]; then
1809
log 1 "checking Allegro... dedicated server, skipping"
1815
# By default on OSX we don't use SDL. The rest is auto-detect
1816
if [ "$with_allegro" = "1" ] && [ "$os" = "OSX" ] && [ "$with_cocoa" != "0" ]; then
1817
log 1 "checking Allegro... OSX, skipping"
1823
if [ "$with_allegro" = "1" ] || [ "$with_allegro" = "" ] || [ "$with_allegro" = "2" ]; then
1824
allegro_config="allegro-config"
1826
allegro_config="$with_allegro"
1829
version=`$allegro_config --version 2>/dev/null`
1831
log 2 "executing $allegro_config --version"
1832
log 2 " returned $version"
1833
log 2 " exit code $ret"
1835
if [ -z "$version" ] || [ "$ret" != "0" ]; then
1836
log 1 "checking Allegro... not found"
1838
# It was forced, so it should be found.
1839
if [ "$with_allegro" != "1" ]; then
1840
log 1 "configure: error: allegro-config couldn't be found"
1841
log 1 "configure: error: you supplied '$with_allegro', but it seems invalid"
1849
log 1 "checking Allegro... found"
1691
1854
# 0 means no, 1 is auto-detect, 2 is force
1692
1855
if [ "$with_sdl" = "0" ]; then
2037
2238
log 1 "checking libfontconfig... found"
2242
# 0 means no, 1 is auto-detect, 2 is force
2243
if [ "$with_icu" = "0" ]; then
2244
log 1 "checking libicu... disabled"
2249
if [ "$with_icu" = "1" ] && [ "$enable_dedicated" != "0" ]; then
2250
log 1 "checking libicu... dedicated server, skipping"
2256
if [ "$with_icu" = "1" ] || [ "$with_icu" = "" ] || [ "$with_icu" = "2" ]; then
2257
icu_config="icu-config"
2259
icu_config="$with_icu"
2262
version=`$icu_config --version 2>/dev/null`
2264
shortversion=`echo $version | cut -c 1,3`
2265
log 2 "executing $icu_config --version"
2266
log 2 " returned $version"
2267
log 2 " exit code $ret"
2269
if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$shortversion" -lt "20" ]; then
2270
if [ -n "$shortversion" ] && [ "$shortversion" -lt "20" ]; then
2271
log 1 "checking libicu... needs at least version 2.0.0, icu NOT enabled"
2273
log 1 "checking libicu... not found"
2276
# It was forced, so it should be found.
2277
if [ "$with_icu" != "1" ]; then
2278
log 1 "configure: error: icu-config couldn't be found"
2279
log 1 "configure: error: you supplied '$with_icuconfig', but it seems invalid"
2287
log 1 "checking libicu... found"
2040
2290
detect_pspconfig() {
2041
2291
# 0 means no, 1 is auto-detect, 2 is force
2042
2292
if [ "$with_psp_config" = "0" ]; then
2266
2537
# use multiple OBJS_DIR, because all in-between
2267
2538
# binaries are stored in there, and nowhere else.
2269
s#!!CC_HOST!!#$cc_host#g;
2270
s#!!CXX_HOST!!#$cxx_host#g;
2271
s#!!CC_BUILD!!#$cc_build#g;
2272
s#!!CXX_BUILD!!#$cxx_build#g;
2273
s#!!WINDRES!!#$windres#g;
2274
s#!!STRIP!!#$strip $strip_arg#g;
2276
s#!!CC_CFLAGS!!#$CC_CFLAGS#g;
2277
s#!!CFLAGS!!#$T_CFLAGS#g;
2278
s#!!CFLAGS_BUILD!!#$CFLAGS_BUILD#g;
2279
s#!!STRGEN_FLAGS!!#$strgen_flags#g;
2281
s#!!LDFLAGS!!#$T_LDFLAGS#g;
2282
s#!!BIN_DIR!!#$BIN_DIR#g;
2283
s#!!ROOT_DIR!!#$ROOT_DIR#g;
2284
s#!!MEDIA_DIR!!#$MEDIA_DIR#g;
2285
s#!!SOURCE_LIST!!#$SOURCE_LIST#g;
2286
s#!!SRC_OBJS_DIR!!#$SRC_OBJS_DIR#g;
2287
s#!!LANG_OBJS_DIR!!#$LANG_OBJS_DIR#g;
2288
s#!!SRC_DIR!!#$SRC_DIR#g;
2289
s#!!OSXAPP!!#$OSXAPP#g;
2290
s#!!LANG_DIR!!#$LANG_DIR#g;
2292
s#!!BINARY_DIR!!#$prefix_dir/$binary_dir#g;
2293
s#!!DATA_DIR!!#$prefix_dir/$data_dir#g;
2294
s#!!DOC_DIR!!#$prefix_dir/$doc_dir#g;
2295
s#!!MAN_DIR!!#$prefix_dir/$man_dir#g;
2296
s#!!ICON_DIR!!#$prefix_dir/$icon_dir#g;
2297
s#!!ICON_THEME_DIR!!#$prefix_dir/$icon_theme_dir#g;
2298
s#!!PERSONAL_DIR!!#$personal_dir#g;
2299
s#!!SHARED_DIR!!#$shared_dir#g;
2300
s#!!INSTALL_DIR!!#$install_dir#g;
2301
s#!!STRGEN!!#$STRGEN#g;
2302
s#!!ENDIAN_CHECK!!#$ENDIAN_CHECK#g;
2303
s#!!ENDIAN_FORCE!!#$endian#g;
2304
s#!!STAGE!!#$STAGE#g;
2305
s#!!MAKEDEPEND!!#$makedepend#g;
2306
s#!!CFLAGS_MAKEDEP!!#$cflags_makedep#g;
2308
s#!!CONFIG_CACHE_COMPILER!!#config.cache.compiler#g;
2309
s#!!CONFIG_CACHE_LINKER!!#config.cache.linker#g;
2310
s#!!CONFIG_CACHE_ENDIAN!!#config.cache.endian#g;
2311
s#!!CONFIG_CACHE_SOURCE!!#config.cache.source#g;
2312
s#!!CONFIG_CACHE_VERSION!!#config.cache.version#g;
2313
s#!!CONFIG_CACHE_SOURCE_LIST!!#config.cache.source.list#g;
2314
s#!!CONFIG_CACHE_PWD!!#config.cache.pwd#g;
2315
s#!!LANG_SUPPRESS!!#$lang_suppress#g;
2316
s#!!OBJS_C!!#$OBJS_C#g;
2317
s#!!OBJS_CPP!!#$OBJS_CPP#g;
2318
s#!!OBJS_MM!!#$OBJS_MM#g;
2319
s#!!OBJS_RC!!#$OBJS_RC#g;
2322
s#!!CONFIGURE_FILES!!#$CONFIGURE_FILES#g;
2323
s#!!REVISION!!#$revision#g;
2325
s#!!GCC295!!#$gcc295#g;
2326
s#!!DISTCC!!#$distcc#g;
2540
s~!!CC_HOST!!~$cc_host~g;
2541
s~!!CXX_HOST!!~$cxx_host~g;
2542
s~!!CC_BUILD!!~$cc_build~g;
2543
s~!!CXX_BUILD!!~$cxx_build~g;
2544
s~!!WINDRES!!~$windres~g;
2545
s~!!STRIP!!~$strip $strip_arg~g;
2547
s~!!CC_CFLAGS!!~$CC_CFLAGS~g;
2548
s~!!CFLAGS!!~$T_CFLAGS~g;
2549
s~!!CFLAGS_BUILD!!~$CFLAGS_BUILD~g;
2550
s~!!STRGEN_FLAGS!!~$strgen_flags~g;
2552
s~!!LDFLAGS!!~$T_LDFLAGS~g;
2553
s~!!BIN_DIR!!~$BIN_DIR~g;
2554
s~!!ROOT_DIR!!~$ROOT_DIR~g;
2555
s~!!MEDIA_DIR!!~$MEDIA_DIR~g;
2556
s~!!SOURCE_LIST!!~$SOURCE_LIST~g;
2557
s~!!SRC_OBJS_DIR!!~$SRC_OBJS_DIR~g;
2558
s~!!LANG_OBJS_DIR!!~$LANG_OBJS_DIR~g;
2559
s~!!SRC_DIR!!~$SRC_DIR~g;
2560
s~!!SCRIPT_SRC_DIR!!~$SCRIPT_SRC_DIR~g;
2561
s~!!OSXAPP!!~$OSXAPP~g;
2562
s~!!LANG_DIR!!~$LANG_DIR~g;
2564
s~!!BINARY_DIR!!~$prefix_dir/$binary_dir~g;
2565
s~!!DATA_DIR!!~$prefix_dir/$data_dir~g;
2566
s~!!DOC_DIR!!~$prefix_dir/$doc_dir~g;
2567
s~!!MAN_DIR!!~$prefix_dir/$man_dir~g;
2568
s~!!ICON_DIR!!~$prefix_dir/$icon_dir~g;
2569
s~!!ICON_THEME_DIR!!~$prefix_dir/$icon_theme_dir~g;
2570
s~!!PERSONAL_DIR!!~$personal_dir~g;
2571
s~!!SHARED_DIR!!~$shared_dir~g;
2572
s~!!INSTALL_DIR!!~$install_dir~g;
2573
s~!!BINARY_NAME!!~$binary_name~g;
2574
s~!!STRGEN!!~$STRGEN~g;
2575
s~!!ENDIAN_CHECK!!~$ENDIAN_CHECK~g;
2576
s~!!ENDIAN_FORCE!!~$endian~g;
2577
s~!!STAGE!!~$STAGE~g;
2578
s~!!MAKEDEPEND!!~$makedepend~g;
2579
s~!!CFLAGS_MAKEDEP!!~$cflags_makedep~g;
2581
s~!!CONFIG_CACHE_COMPILER!!~config.cache.compiler~g;
2582
s~!!CONFIG_CACHE_LINKER!!~config.cache.linker~g;
2583
s~!!CONFIG_CACHE_ENDIAN!!~config.cache.endian~g;
2584
s~!!CONFIG_CACHE_SOURCE!!~config.cache.source~g;
2585
s~!!CONFIG_CACHE_VERSION!!~config.cache.version~g;
2586
s~!!CONFIG_CACHE_SOURCE_LIST!!~config.cache.source.list~g;
2587
s~!!CONFIG_CACHE_PWD!!~config.cache.pwd~g;
2588
s~!!LANG_SUPPRESS!!~$lang_suppress~g;
2589
s~!!OBJS_C!!~$OBJS_C~g;
2590
s~!!OBJS_CPP!!~$OBJS_CPP~g;
2591
s~!!OBJS_MM!!~$OBJS_MM~g;
2592
s~!!OBJS_RC!!~$OBJS_RC~g;
2595
s~!!CONFIGURE_FILES!!~$CONFIGURE_FILES~g;
2596
s~!!REVISION!!~$revision~g;
2598
s~!!GCC295!!~$gcc295~g;
2599
s~!!DISTCC!!~$distcc~g;
2329
2602
if [ "$icon_theme_dir" != "" ]; then
2471
2746
echo " --strip=STRIP the strip to use [HOST-strip]"
2472
2747
echo " --awk=AWK the awk to use in configure [awk]"
2473
2748
echo " --lipo=LIPO the lipo to use (OSX ONLY) [HOST-lipo]"
2474
echo " --os=OS the OS we are compiling for [$os]"
2749
echo " --os=OS the OS we are compiling for [DETECT]"
2475
2750
echo " DETECT/UNIX/OSX/FREEBSD/OPENBSD/NETBSD/"
2476
2751
echo " MORPHOS/HPUX/BEOS/SUNOS/CYGWIN/MINGW/OS2/"
2752
echo " DOS/WINCE/PSP"
2478
2753
echo " --endian=ENDIAN set the endian of the HOST (AUTO/LE/BE)"
2479
2754
echo " --revision=rXXXX overwrite the revision detection."
2480
2755
echo " Use with care!"
2483
2758
echo " --prefix-dir=dir specifies the prefix for all installed"
2484
echo " files [$prefix_dir]"
2759
echo " files [/usr/local]"
2485
2760
echo " --binary-dir=dir location of the binary. Will be prefixed"
2486
echo " with the prefix-dir [$binary_dir]"
2761
echo " with the prefix-dir [games]"
2487
2762
echo " --data-dir=dir location of data files (lang, data, gm)."
2488
2763
echo " Will be prefixed with the prefix-dir"
2764
echo " [share/games/openttd]"
2490
2765
echo " --doc-dir=dir location of the doc files"
2491
2766
echo " Will be prefixed with the prefix-dir"
2492
2767
echo " [$doc_dir]"
2493
2768
echo " --icon-dir=dir location of icons. Will be prefixed"
2494
echo " with the prefix-dir [$icon_dir]"
2769
echo " with the prefix-dir [share/pixmaps]"
2495
2770
echo " --icon-theme-dir=dir location of icon theme."
2496
2771
echo " Will be prefixed with the prefix-dir"
2497
2772
echo " and postfixed with size-dirs [$icon_theme_dir]"
2500
2775
echo " [$man_dir]"
2501
2776
echo " --menu-dir=dir location of the menu item. (UNIX only, except OSX)"
2502
2777
echo " Will be prefixed with the prefix-dir"
2778
echo " [share/applications]"
2504
2779
echo " --personal-dir=dir location of the personal directory"
2505
echo " [$personal_dir]"
2780
echo " [os-dependent default]"
2506
2781
echo " --shared-dir=dir location of shared data files"
2507
echo " [$shared_dir]"
2782
echo " [os-dependent default]"
2508
2783
echo " --install-dir=dir specifies the root to install to."
2509
echo " Useful to install into jails [$install_dir]"
2784
echo " Useful to install into jails [/]"
2785
echo " --binary-name the name used for the binary, icons,"
2786
echo " desktop file, etc. when installing [openttd]"
2511
2788
echo "Features and packages:"
2512
2789
echo " --enable-debug[=LVL] enable debug-mode (LVL=[0123], 0 is release)"