~ubuntu-branches/debian/squeeze/openttd/squeeze

« back to all changes in this revision

Viewing changes to config.lib

  • Committer: Bazaar Package Importer
  • Author(s): Jordi Mallach, Matthijs Kooijman, Jordi Mallach
  • Date: 2009-04-15 18:22:10 UTC
  • mfrom: (1.1.6 upstream) (2.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090415182210-22ktb8kdbp2tf3bm
[ Matthijs Kooijman ]
* New upstream release.
* Remove Debian specific desktop file, upstream provides one now. 
* Add debian/watch file.

[ Jordi Mallach ]
* Bump Standards-Version to 3.8.1, with no changes required.
* Move to debhelper compat 7. Bump Build-Depends accordingly.
* Use dh_prep.
* Add "set -e" to config script.
* Remove a few extra doc files that get installed by upstream Makefile.
* Add more complete copyright information.

Show diffs side-by-side

added added

removed removed

Lines of Context:
5
5
}
6
6
 
7
7
set_default() {
8
 
        released_version="0.6.3"
 
8
        released_version="0.7.0"
9
9
 
10
10
        ignore_extra_parameters="0"
11
11
        # We set all kinds of defaults for params. Later on the user can override
37
37
        man_dir="1"
38
38
        menu_dir="1"
39
39
        menu_group="Game;"
 
40
        menu_name="OpenTTD"
 
41
        binary_name="openttd"
40
42
        enable_debug="0"
41
43
        enable_desync_debug="0"
42
44
        enable_profiling="0"
54
56
        with_osx_sysroot="1"
55
57
        with_application_bundle="1"
56
58
        with_menu_entry="1"
 
59
        with_allegro="1"
57
60
        with_sdl="1"
58
61
        with_cocoa="1"
59
62
        with_zlib="1"
67
70
        with_libtimidity="1"
68
71
        with_freetype="1"
69
72
        with_fontconfig="1"
 
73
        with_icu="1"
70
74
        with_psp_config="1"
71
75
        with_threads="1"
72
76
        with_distcc="1"
100
104
                shared_dir
101
105
                install_dir
102
106
                menu_group
 
107
                menu_name
 
108
                binary_name
103
109
                enable_debug
104
110
                enable_desync_debug
105
111
                enable_profiling
116
122
                enable_cocoa_quickdraw
117
123
                with_osx_sysroot
118
124
                with_application_bundle
 
125
                with_allegro
119
126
                with_sdl
120
127
                with_cocoa
121
128
                with_zlib
129
136
                with_libtimidity
130
137
                with_freetype
131
138
                with_fontconfig
 
139
                with_icu
132
140
                with_psp_config
133
141
                with_threads
134
142
                with_distcc
149
157
                optarg=`expr "x$p" : 'x[^=]*=\(.*\)'`
150
158
 
151
159
                case "$p" in
152
 
                        --help | -h)                  showhelp; exit 0;;
 
160
                        --help | -h | -\?)            showhelp; exit 0;;
153
161
 
154
162
                        --config-log)                 prev_p="config_log";;
155
163
                        --config-log=*)               config_log="$optarg";;
213
221
                        --menu-dir=*)                 menu_dir="$optarg";;
214
222
                        --without-menu-entry)         menu_dir="";;
215
223
 
 
224
                        --menu-name)                  prevp_p="menu_name";;
 
225
                        --menu-name=*)                menu_name="$optarg";;
 
226
 
 
227
                        --binary-name)                prevp_p="binary_name";;
 
228
                        --binary-name=*)              binary_name="$optarg";;
 
229
 
216
230
                        --man-dir)                    prevp_p="man_dir";;
217
231
                        --man-dir=*)                  man_dir="$optarg";;
218
232
 
273
287
                        --enable-cocoa-quickdraw)     enable_cocoa_quickdraw="2";;
274
288
                        --enable-cocoa-quickdraw=*)   enable_cocoa_quickdraw="$optarg";;
275
289
 
 
290
                        --with-allegro)               with_allegro="2";;
 
291
                        --without-allegro)            with_allegro="0";;
 
292
                        --with-allegro=*)             with_allegro="$optarg";;
 
293
 
276
294
                        --with-sdl)                   with_sdl="2";;
277
295
                        --without-sdl)                with_sdl="0";;
278
296
                        --with-sdl=*)                 with_sdl="$optarg";;
310
328
                        --without-libfontconfig)      with_fontconfig="0";;
311
329
                        --with-libfontconfig=*)       with_fontconfig="$optarg";;
312
330
 
 
331
                        --with-icu)                   with_icu="2";;
 
332
                        --without-icu)                with_icu="0";;
 
333
                        --with-icu=*)                 with_icu="$optarg";;
 
334
                        --with-libicu)                with_icu="2";;
 
335
                        --without-libicu)             with_icu="0";;
 
336
                        --with-libicu=*)              with_icu="$optarg";;
 
337
 
313
338
                        --with-psp-config)            with_psp_config="2";;
314
339
                        --without-psp-config)         with_psp_config="0";;
315
340
                        --with-psp-config=*)          with_psp_config="$optarg";;
360
385
 
361
386
                        --ignore-extra-parameters)    ignore_extra_parameters="1";;
362
387
 
363
 
                        --*)
 
388
                        --* | -*)
364
389
                                if [ "$ignore_extra_parameters" = "0" ]; then
365
 
                                        echo "Unknown option $p"
 
390
                                        log 1 "Unknown option $p"
366
391
                                        exit 1
367
392
                                else
368
 
                                        echo "Unknown option $p ignored"
 
393
                                        log 1 "Unknown option $p ignored"
369
394
                                fi
370
395
                                ;;
371
396
                esac
372
397
        done
373
398
 
374
399
        if [ -n "$prev_p" ]; then
375
 
                echo "configure: error: missing argument to --$prev_p"
 
400
                log 1 "configure: error: missing argument to --$prev_p"
376
401
                exit 1
377
402
        fi
378
403
 
390
415
        configure="$CONFIGURE_EXECUTABLE --ignore-extra-parameters"
391
416
        for p in $save_params_array; do
392
417
                eval "v=\"\$$p\""
393
 
                p=`echo "$p" | sed 's/_/-/g;s/\n//g;'`
 
418
                p=`echo "$p" | sed 's~_~-~g;s~\n~~g;s~ ~\\ ~g'`
394
419
                # Only save those params that aren't empty
395
420
                configure="$configure --$p=\"$v\""
396
421
        done
412
437
 
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]"
417
442
                exit 1
418
443
        fi
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"
422
447
                exit 1
423
448
        fi
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]"
428
453
                exit 1
429
454
        fi
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]"
434
459
                exit 1
435
460
        fi
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]"
440
465
                exit 1
441
466
        fi
442
467
 
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]"
447
472
                exit 1
448
473
        fi
449
474
 
486
511
        detect_cputype
487
512
 
488
513
        if [ "$enable_static" = "1" ]; then
489
 
                if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "MORPHOS" ]; then
 
514
                if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "MORPHOS" ] || [ "$os" = "DOS" ]; then
490
515
                        enable_static="2"
491
516
                else
492
517
                        enable_static="0"
496
521
        if [ "$enable_static" != "0" ]; then
497
522
                log 1 "checking static... yes"
498
523
 
499
 
                if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "OSX" ] && [ "$os" != "MORPHOS" ]; then
500
 
                        log 1 "WARNING: static is only known to work on Windows, MacOSX and MorphOS"
 
524
                if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "OSX" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "DOS" ]; then
 
525
                        log 1 "WARNING: static is only known to work on Windows, DOS, MacOSX and MorphOS"
501
526
                        log 1 "WARNING: use static at your own risk on this platform"
502
527
 
503
528
                        sleep 5
507
532
        fi
508
533
 
509
534
        if [ "$enable_unicode" = "1" ]; then
510
 
                if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
 
535
                if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "DOS" ]; then
511
536
                        enable_unicode="2"
512
537
                else
513
538
                        enable_unicode="0"
540
565
                sleep 5
541
566
        fi
542
567
 
 
568
        detect_allegro
543
569
        detect_sdl
544
570
        detect_cocoa
545
571
 
546
572
        if [ "$enable_dedicated" != "0" ]; then
547
 
                log 1 "checking GDI video driver... skipping"
 
573
                log 1 "checking GDI video driver... dedicated server, skipping"
548
574
                log 1 "checking dedicated... found"
549
575
 
550
576
                if [ "$enable_network" = "0" ]; then
551
 
                        log 1 "WARNING: compiling a dedicated server without network is pointless"
552
 
                        sleep 5
 
577
                        log 1 "configure: error: building a dedicated server without network support is pointless"
 
578
                        exit 1
553
579
                fi
554
580
        else
555
581
                if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ]; then
558
584
                        log 1 "checking GDI video driver... not Windows, skipping"
559
585
                fi
560
586
 
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"
563
 
                        enable_dedicated="1"
564
 
                        sleep 1
565
 
 
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"
 
590
                        exit 1
567
591
                else
568
592
                        log 1 "checking dedicated... not selected"
569
593
                fi
570
594
        fi
571
595
 
572
 
        if [ "$enable_network" != "0" ]; then
 
596
        if [ "$enable_network" = "1" ] && [ "$os" = "DOS" ]; then
 
597
                log 1 "checking network... DOS, skipping"
 
598
                enable_network=0
 
599
        elif [ "$enable_network" != "0" ]; then
573
600
                log 1 "checking network... found"
574
601
        else
575
602
                log 1 "checking network... disabled"
590
617
                log 1 "checking assert... disabled"
591
618
        fi
592
619
 
 
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"
 
625
                exit 1
 
626
        fi
 
627
        log 1 "checking 3rdparty... found"
 
628
 
 
629
        pre_detect_with_zlib=$with_zlib
593
630
        detect_zlib
 
631
 
 
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."
 
639
                else
 
640
                        log 1 "configure: error: no zlib detected"
 
641
                        log 1 " If you want to compile without zlib use --without-zlib as parameter"
 
642
                        exit
 
643
                fi
 
644
        fi
 
645
 
594
646
        detect_png
595
647
        detect_freetype
596
648
        detect_fontconfig
 
649
        detect_icu
597
650
        detect_pspconfig
598
651
        detect_libtimidity
599
652
 
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"
604
657
                                exit 1
605
658
                        fi
710
763
                log 1 "checking ccache... $ccache"
711
764
        fi
712
765
 
 
766
        if [ "$os" = "DOS" ]; then
 
767
                with_threads="0"
 
768
        fi
 
769
 
713
770
        if [ "$os" != "OSX" ] && [ "$with_osx_sysroot" != "0" ]; then
714
771
                if [ "$with_osx_sysroot" = "1" ]; then
715
772
                        with_osx_sysroot="0"
816
873
                        revision="`cat $ROOT_DIR/version`"
817
874
 
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
820
877
                        revision=""
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
823
880
                        revision=""
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
826
883
                        revision=""
827
884
                        log 1 "checking revision... hg detection"
828
885
                else
829
886
                        revision=""
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!"
837
894
 
845
902
                else
846
903
                        doc_dir="$data_dir/docs"
847
904
                fi
 
905
        else
 
906
                doc_dir="`echo $doc_dir | sed 's~\([^\]\)\\\\ ~\1\\\\\\\\ ~g;s~\([^\]\) ~\1\\\\\\\\ ~g'`"
848
907
        fi
849
908
 
850
909
        if [ "$icon_theme_dir" = "1" ]; then
853
912
                else
854
913
                        icon_theme_dir=""
855
914
                fi
 
915
        else
 
916
                icon_theme_dir="`echo $icon_theme_dir | sed 's~\([^\]\)\\\\ ~\1\\\\\\\\ ~g;s~\([^\]\) ~\1\\\\\\\\ ~g'`"
856
917
        fi
857
918
 
858
919
        if [ "$personal_dir" = "1" ]; then
859
 
                if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ]; then
 
920
                if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ] || [ "$os" = "DOS" ]; then
860
921
                        personal_dir="OpenTTD"
861
922
                elif [ "$os" = "OSX" ]; then
862
923
                        personal_dir="Documents/OpenTTD"
863
924
                else
864
925
                        personal_dir=".openttd"
865
926
                fi
 
927
        else
 
928
                personal_dir="`echo $personal_dir | sed 's~\([^\]\)\\\\ ~\1\\\\\\\\ ~g;s~\([^\]\) ~\1\\\\\\\\ ~g'`"
866
929
        fi
867
930
 
868
931
        if [ "$shared_dir" = "1" ]; then
872
935
                else
873
936
                        shared_dir=""
874
937
                fi
 
938
        else
 
939
                shared_dir="`echo $shared_dir | sed 's~\([^\]\)\\\\ ~\1\\\\\\\\ ~g;s~\([^\]\) ~\1\\\\\\\\ ~g'`"
875
940
        fi
876
941
 
877
942
        if [ "$man_dir" = "1" ]; then
881
946
                else
882
947
                        man_dir=""
883
948
                fi
 
949
        else
 
950
                man_dir="`echo $man_dir | sed 's~\([^\]\)\\\\ ~\1\\\\\\\\ ~g;s~\([^\]\) ~\1\\\\\\\\ ~g'`"
884
951
        fi
885
952
 
886
953
        if [ "$menu_dir" = "1" ]; then
890
957
                else
891
958
                        menu_dir=""
892
959
                fi
 
960
        else
 
961
                menu_dir="`echo $menu_dir | sed 's~\([^\]\)\\\\ ~\1\\\\\\\\ ~g;s~\([^\]\) ~\1\\\\\\\\ ~g'`"
893
962
        fi
894
963
 
895
964
        # "set_universal_binary_flags" needs to be before "detect_iconv"
970
1039
 
971
1040
                # Each debug level reduces the optimization by a bit
972
1041
                if [ $enable_debug -ge 1 ]; then
973
 
                        CFLAGS="$CFLAGS -g -D_DEBUG"
 
1042
                        CFLAGS="$CFLAGS -g -D_DEBUG -D_FORTIFY_SOURCE=2"
974
1043
                        if [ "$os" = "PSP" ]; then
975
1044
                                CFLAGS="$CFLAGS -G0"
976
1045
                        fi
1028
1097
                fi
1029
1098
 
1030
1099
                if [ $cc_version -ge 30 ]; then
1031
 
                        CFLAGS="$CFLAGS -W -Wno-unused-parameter"
 
1100
                        CFLAGS="$CFLAGS -W -Wno-unused-parameter -Wformat=2"
 
1101
                        CFLAGS="$CFLAGS -Wredundant-decls"
1032
1102
                        # Do not warn about unused variables when building without asserts
1033
1103
                        if [ $enable_assert -eq 0 ]; then
1034
1104
                                CFLAGS="$CFLAGS -Wno-unused-variable"
1070
1140
                fi
1071
1141
        fi
1072
1142
 
1073
 
        if [ "$os" != "CYGWIN" ] && [ "$os" != "FREEBSD" ] && [ "$os" != "OPENBSD" ] && [ "$os" != "MINGW" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "OSX" ] && [ "$os" != "WINCE" ] && [ "$os" != "PSP" ] && [ "$os" != "OS2" ]; then
 
1143
        if [ "$os" != "CYGWIN" ] && [ "$os" != "FREEBSD" ] && [ "$os" != "OPENBSD" ] && [ "$os" != "MINGW" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "OSX" ] && [ "$os" != "DOS" ] && [ "$os" != "WINCE" ] && [ "$os" != "PSP" ] && [ "$os" != "OS2" ]; then
1074
1144
                LIBS="$LIBS -lpthread"
1075
1145
        fi
1076
1146
 
1077
 
        if [ "$os" != "CYGWIN" ] && [ "$os" != "MINGW" ] && [ "$os" != "WINCE" ]; then
 
1147
        if [ "$os" != "CYGWIN" ] && [ "$os" != "MINGW" ] && [ "$os" != "DOS" ] && [ "$os" != "WINCE" ]; then
1078
1148
                LIBS="$LIBS -lc"
1079
1149
        fi
1080
1150
        if [ "$os" = "WINCE" ]; then
1121
1191
                CFLAGS="$CFLAGS -DWIN"
1122
1192
        fi
1123
1193
 
 
1194
        if [ -n "$allegro_config" ]; then
 
1195
                CFLAGS="$CFLAGS -DWITH_ALLEGRO"
 
1196
                CFLAGS="$CFLAGS `$allegro_config --cflags`"
 
1197
                if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "WINCE" ]; then
 
1198
                        if [ "$enable_static" != "0" ]; then
 
1199
                                LIBS="$LIBS `$allegro_config --static --libs`"
 
1200
                        else
 
1201
                                LIBS="$LIBS `$allegro_config --libs`"
 
1202
                        fi
 
1203
                fi
 
1204
        fi
 
1205
 
1124
1206
        if [ -n "$sdl_config" ]; then
1125
1207
                CFLAGS="$CFLAGS -DWITH_SDL"
1126
 
                CFLAGS="$CFLAGS `$sdl_config --cflags`"
 
1208
                # SDL must not add _GNU_SOURCE as it breaks many platforms
 
1209
                CFLAGS="$CFLAGS `$sdl_config --cflags | sed 's~-D_GNU_SOURCE[^ ]*~~'`"
1127
1210
                if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "WINCE" ]; then
1128
1211
                        if [ "$enable_static" != "0" ]; then
1129
1212
                                LIBS="$LIBS `$sdl_config --static-libs`"
1155
1238
                CFLAGS="$CFLAGS -DWITH_ZLIB"
1156
1239
        fi
1157
1240
 
 
1241
        # 64bit machines need -D_SQ64
 
1242
        if [ "$cpu_type" = "64" ]; then
 
1243
                CFLAGS="$CFLAGS -D_SQ64"
 
1244
        fi
 
1245
        CFLAGS="$CFLAGS -I$SCRIPT_SRC_DIR"
 
1246
 
1158
1247
        if [ -n "$png_config" ]; then
1159
1248
                CFLAGS="$CFLAGS -DWITH_PNG"
1160
1249
                CFLAGS="$CFLAGS `$png_config --cppflags --I_opts | tr '\n\r' '  '`"
1179
1268
                        if [ "$os" = "OSX" ]; then
1180
1269
                                # fontconfig_config goes via pkg-config on all systems, which doesn't know --prefix
1181
1270
                                # 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
1182
 
                                LIBS="$LIBS `$fontconfig_config --variable=prefix`/lib/libfontconfig.a `$fontconfig_config --libs --static | sed s/-lfontconfig//`"
 
1271
                                LIBS="$LIBS `$fontconfig_config --variable=prefix`/lib/libfontconfig.a `$fontconfig_config --libs --static | sed s~-lfontconfig~~`"
1183
1272
                        else
1184
1273
                                LIBS="$LIBS `$fontconfig_config --libs --static | tr '\n\r' '  '`"
1185
1274
                        fi
1204
1293
                fi
1205
1294
        fi
1206
1295
 
 
1296
        if [ -n "$icu_config" ]; then
 
1297
                CFLAGS="$CFLAGS -DWITH_ICU"
 
1298
                CFLAGS="$CFLAGS `$icu_config --cppflags | tr '\n\r' '  '`"
 
1299
 
 
1300
                LIBS="$LIBS `$icu_config --ldflags-libsonly | tr '\n\r' '  '`"
 
1301
        fi
 
1302
 
 
1303
 
1207
1304
        if [ "$with_direct_music" != "0" ]; then
1208
1305
                CFLAGS="$CFLAGS -DWIN32_ENABLE_DIRECTMUSIC_SUPPORT"
1209
1306
                # GCC 4.0+ doesn't like the DirectX includes (gives tons of
1225
1322
 
1226
1323
        if [ "$with_iconv" != "0" ]; then
1227
1324
                CFLAGS="$CFLAGS -DWITH_ICONV"
1228
 
                LIBS="$LIBS -liconv"
1229
 
                if [ "$with_iconv" != "2" ]; then
1230
 
                        CFLAGS="$CFLAGS -I$with_iconv/include"
1231
 
                        LIBS="$LIBS -L$with_iconv/lib"
 
1325
                if [ "$link_to_iconv" = "yes" ]; then
 
1326
                        LIBS="$LIBS -liconv"
 
1327
                        if [ "$with_iconv" != "2" ]; then
 
1328
                                CFLAGS="$CFLAGS -I$with_iconv/include"
 
1329
                                LIBS="$LIBS -L$with_iconv/lib"
 
1330
                        fi
1232
1331
                fi
1233
1332
 
1234
1333
                if [ "$have_broken_iconv" != "no" ]; then
1274
1373
                CFLAGS="$CFLAGS -DNDEBUG"
1275
1374
        fi
1276
1375
 
1277
 
        if [ "$enable_desync_debug" = "1" ]; then
1278
 
                CFLAGS="$CFLAGS -DDEBUG_DUMP_COMMANDS"
1279
 
        fi
1280
 
        if [ "$enable_desync_debug" = "2" ]; then
 
1376
        if [ "$enable_desync_debug" != "0" ]; then
1281
1377
                CFLAGS="$CFLAGS -DRANDOM_DEBUG"
1282
1378
        fi
1283
1379
 
1305
1401
        # Btw, this almost always comes from outside the configure, so it is
1306
1402
        #  not something we can control.
1307
1403
        if [ "$with_makedepend" != "0" ]; then
1308
 
                cflags_makedep="` echo "$CFLAGS" | sed 's# /# -#g'`"
 
1404
                cflags_makedep="` echo "$CFLAGS" | sed 's~ /~ -~g;s~-I[ ]*[^ ]*~~g'`"
1309
1405
        else
1310
1406
                makedepend=""
1311
1407
        fi
1480
1576
check_strip() {
1481
1577
        if [ "$os" = "OS2" ]; then
1482
1578
                # OS2 via gcc is a bit weird.. stripping HAS to be done via emxbind, which is via gcc directly
1483
 
                echo "checking host strip... using gcc -s option"
 
1579
                log 1 "checking host strip... using gcc -s option"
1484
1580
        elif [ "$os" = "OSX" ]; then
1485
1581
                # Most targets have -V in strip, to see if they exists... OSX doesn't.. so execute something
1486
1582
                echo "int main(int argc, char *argv[]) { }" > strip.test.c
1534
1630
        rm -f direct_music.test.c direct_music.test
1535
1631
 
1536
1632
        if [ "$res" != "0" ]; then
1537
 
                if [ "$with_direct_music" = "2" ]; then
 
1633
                if [ "$with_direct_music" != "1" ]; then
1538
1634
                        log 1 "configure: error: direct-music is not available on this system"
1539
1635
                        exit 1
1540
1636
                fi
1636
1732
 
1637
1733
detect_os() {
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
1640
1736
 
1641
1737
                # Try first via dumpmachine, then via uname
1642
1738
                os=`echo "$host" | tr '[A-Z]' '[a-z]' | $awk '
1653
1749
                                        /cygwin/       { print "CYGWIN";  exit}
1654
1750
                                        /mingw/        { print "MINGW";   exit}
1655
1751
                                        /os2/          { print "OS2";     exit}
 
1752
                                        /dos/          { print "DOS";     exit}
1656
1753
                                        /wince/        { print "WINCE";   exit}
1657
1754
                                        /psp/          { print "PSP";     exit}
1658
1755
                '`
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"
1681
1778
                        exit 1
1682
1779
                fi
1683
1780
 
1687
1784
        fi
1688
1785
}
1689
1786
 
 
1787
detect_allegro() {
 
1788
        # 0 means no, 1 is auto-detect, 2 is force
 
1789
        if [ "$with_allegro" = "0" ]; then
 
1790
                log 1 "checking Allegro... disabled"
 
1791
 
 
1792
                allegro_config=""
 
1793
                return 0
 
1794
        fi
 
1795
 
 
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"
 
1799
                exit 1
 
1800
        fi
 
1801
 
 
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"
 
1805
                exit 1
 
1806
        fi
 
1807
 
 
1808
        if [ "$enable_dedicated" != "0" ]; then
 
1809
                log 1 "checking Allegro... dedicated server, skipping"
 
1810
 
 
1811
                allegro_config=""
 
1812
                return 0
 
1813
        fi
 
1814
 
 
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"
 
1818
 
 
1819
                allegro_config=""
 
1820
                return 0
 
1821
        fi
 
1822
 
 
1823
        if [ "$with_allegro" = "1" ] || [ "$with_allegro" = "" ] || [ "$with_allegro" = "2" ]; then
 
1824
                allegro_config="allegro-config"
 
1825
        else
 
1826
                allegro_config="$with_allegro"
 
1827
        fi
 
1828
 
 
1829
        version=`$allegro_config --version 2>/dev/null`
 
1830
        ret=$?
 
1831
        log 2 "executing $allegro_config --version"
 
1832
        log 2 "  returned $version"
 
1833
        log 2 "  exit code $ret"
 
1834
 
 
1835
        if [ -z "$version" ] || [ "$ret" != "0" ]; then
 
1836
                log 1 "checking Allegro... not found"
 
1837
 
 
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"
 
1842
                        exit 1
 
1843
                fi
 
1844
 
 
1845
                allegro_config=""
 
1846
                return 0
 
1847
        fi
 
1848
 
 
1849
        log 1 "checking Allegro... found"
 
1850
}
 
1851
 
 
1852
 
1690
1853
detect_sdl() {
1691
1854
        # 0 means no, 1 is auto-detect, 2 is force
1692
1855
        if [ "$with_sdl" = "0" ]; then
1709
1872
        fi
1710
1873
 
1711
1874
        if [ "$enable_dedicated" != "0" ]; then
1712
 
                log 1 "checking SDL... skipping"
 
1875
                log 1 "checking SDL... dedicated server, skipping"
1713
1876
 
1714
1877
                sdl_config=""
1715
1878
                return 0
1767
1930
        fi
1768
1931
 
1769
1932
        if [ "$enable_dedicated" != "0" ]; then
1770
 
                log 1 "checking COCOA... skipping"
 
1933
                log 1 "checking COCOA... dedicated server, skipping"
1771
1934
 
1772
1935
                with_cocoa="0"
1773
1936
                return 0
1883
2046
                        exit 1
1884
2047
                fi
1885
2048
 
 
2049
                eval "with_$2=0"
 
2050
 
1886
2051
                return 0
1887
2052
        fi
1888
2053
 
1909
2074
                return 0
1910
2075
        fi
1911
2076
 
1912
 
        if [ "$with_zlib" = "0" ] || [ "$zlib" = "" ]; then
1913
 
                log 1 "configure: error: libpng depends on zlib, which couldn't be found / was disabled"
1914
 
                log 1 "configure: error: please supply --with-zlib, with a valid zlib location"
1915
 
                exit 1
 
2077
        if [ "$with_zlib" = "0" ] || [ -z "$zlib" ]; then
 
2078
                if [ "$with_png" != "1" ]; then
 
2079
                        log 1 "checking libpng... no zlib"
 
2080
                        log 1 "ERROR: libpng was forced, but zlib was not detected / disabled."
 
2081
                        log 1 "ERROR: libpng depends on zlib."
 
2082
 
 
2083
                        exit 1
 
2084
                fi
 
2085
 
 
2086
                log 1 "checking libpng... no zlib, skipping"
 
2087
 
 
2088
                png_config=""
 
2089
                return 0
1916
2090
        fi
1917
2091
 
1918
2092
        if [ "$with_png" = "1" ] || [ "$with_png" = "" ] || [ "$with_png" = "2" ]; then
1952
2126
                freetype_config=""
1953
2127
                return 0
1954
2128
        fi
1955
 
 
1956
 
        if [ "$with_zlib" = "0" ] || [ "$zlib" = "" ]; then
1957
 
                log 1 "configure: error: libfreetype depends on zlib, which couldn't be found / was disabled"
1958
 
                log 1 "configure: error: please supply --with-zlib, with a valid zlib location"
1959
 
                exit 1
 
2129
        if [ "$with_freetype" = "1" ] && [ "$enable_dedicated" != "0" ]; then
 
2130
                log 1 "checking libfreetype... dedicated server, skipping"
 
2131
 
 
2132
                freetype_config=""
 
2133
                return 0
 
2134
        fi
 
2135
 
 
2136
        if [ "$with_zlib" = "0" ] || [ -z "$zlib" ]; then
 
2137
                if [ "$with_freetype" != "1" ]; then
 
2138
                        log 1 "checking libfreetype... no zlib"
 
2139
                        log 1 "ERROR: libfreetype was forced, but zlib was not detected / disabled."
 
2140
                        log 1 "ERROR: libfreetype depends on zlib."
 
2141
 
 
2142
                        exit 1
 
2143
                fi
 
2144
 
 
2145
                log 1 "checking libfreetype... no zlib, skipping"
 
2146
 
 
2147
                freetype_config=""
 
2148
                return 0
1960
2149
        fi
1961
2150
 
1962
2151
        if [ "$with_freetype" = "1" ] || [ "$with_freetype" = "" ] || [ "$with_freetype" = "2" ]; then
1996
2185
                fontconfig_config=""
1997
2186
                return 0
1998
2187
        fi
 
2188
        if [ "$with_fontconfig" = "1" ] && [ "$enable_dedicated" != "0" ]; then
 
2189
                log 1 "checking libfontconfig... dedicated server, skipping"
 
2190
 
 
2191
                fontconfig_config=""
 
2192
                return 0
 
2193
        fi
 
2194
        if [ "$with_fontconfig" != "2" ] && [ -z "$freetype_config" ]; then
 
2195
                log 1 "checking libfontconfig... no freetype, skipping"
 
2196
 
 
2197
                fontconfig_config=""
 
2198
                return 0
 
2199
        fi
1999
2200
 
2000
2201
        if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ]; then
2001
2202
                log 1 "checking libfontconfig... WIN32, skipping"
2037
2238
        log 1 "checking libfontconfig... found"
2038
2239
}
2039
2240
 
 
2241
detect_icu() {
 
2242
        # 0 means no, 1 is auto-detect, 2 is force
 
2243
        if [ "$with_icu" = "0" ]; then
 
2244
                log 1 "checking libicu... disabled"
 
2245
 
 
2246
                icu_config=""
 
2247
                return 0
 
2248
        fi
 
2249
        if [ "$with_icu" = "1" ] && [ "$enable_dedicated" != "0" ]; then
 
2250
                log 1 "checking libicu... dedicated server, skipping"
 
2251
 
 
2252
                icu_config=""
 
2253
                return 0
 
2254
        fi
 
2255
 
 
2256
        if [ "$with_icu" = "1" ] || [ "$with_icu" = "" ] || [ "$with_icu" = "2" ]; then
 
2257
                icu_config="icu-config"
 
2258
        else
 
2259
                icu_config="$with_icu"
 
2260
        fi
 
2261
 
 
2262
        version=`$icu_config --version 2>/dev/null`
 
2263
        ret=$?
 
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"
 
2268
 
 
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"
 
2272
                else
 
2273
                        log 1 "checking libicu... not found"
 
2274
                fi
 
2275
 
 
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"
 
2280
                        exit 1
 
2281
                fi
 
2282
 
 
2283
                icu_config=""
 
2284
                return 0
 
2285
        fi
 
2286
 
 
2287
        log 1 "checking libicu... found"
 
2288
}
 
2289
 
2040
2290
detect_pspconfig() {
2041
2291
        # 0 means no, 1 is auto-detect, 2 is force
2042
2292
        if [ "$with_psp_config" = "0" ]; then
2161
2411
        log 2 "  exit code $ret"
2162
2412
        if [ "$ret" = "0" ]; then have_broken_iconv="no"; else have_broken_iconv="yes"; fi
2163
2413
        log 1 "checking if iconv has non-const inbuf... $have_broken_iconv"
 
2414
 
 
2415
        cat > tmp.iconv.cpp << EOF
 
2416
#include "src/stdafx.h"
 
2417
#include <iconv.h>
 
2418
int main() {
 
2419
        static char buf[1024];
 
2420
        iconv_t convd = 0;
 
2421
        char *inbuf = "";
 
2422
        char *outbuf  = buf;
 
2423
        size_t outlen = 1023;
 
2424
        size_t inlen  = 0;
 
2425
        return iconv(convd, &inbuf, &inlen, &outbuf, &outlen);
 
2426
}
 
2427
EOF
 
2428
        execute="$cxx_host $CFLAGS tmp.iconv.cpp -o tmp.iconv -DTESTING 2>&1"
 
2429
        eval $execute >&/dev/null
 
2430
        ret=$?
 
2431
        log 2 "executing $execute"
 
2432
        log 2 "  exit code $ret"
 
2433
        if [ "$ret" = "0" ]; then link_to_iconv="no"; else link_to_iconv="yes"; fi
 
2434
        log 1 "checking whether to link to iconv... $link_to_iconv"
2164
2435
        rm -f tmp.iconv tmp.iconv.cpp
2165
2436
}
2166
2437
 
2266
2537
        #  use multiple OBJS_DIR, because all in-between
2267
2538
        #  binaries are stored in there, and nowhere else.
2268
2539
        SRC_REPLACE="
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;
2275
 
                s#!!LIPO!!#$lipo#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;
2280
 
                s#!!LIBS!!#$LIBS#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;
2291
 
                s#!!TTD!!#$TTD#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;
2307
 
                s#!!SORT!!#$sort#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;
2320
 
                s#!!SRCS!!#$SRCS#g;
2321
 
                s#!!OS!!#$os#g;
2322
 
                s#!!CONFIGURE_FILES!!#$CONFIGURE_FILES#g;
2323
 
                s#!!REVISION!!#$revision#g;
2324
 
                s#!!AWK!!#$awk#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;
 
2546
                s~!!LIPO!!~$lipo~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;
 
2551
                s~!!LIBS!!~$LIBS~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;
 
2563
                s~!!TTD!!~$TTD~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;
 
2580
                s~!!SORT!!~$sort~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;
 
2593
                s~!!SRCS!!~$SRCS~g;
 
2594
                s~!!OS!!~$os~g;
 
2595
                s~!!CONFIGURE_FILES!!~$CONFIGURE_FILES~g;
 
2596
                s~!!REVISION!!~$revision~g;
 
2597
                s~!!AWK!!~$awk~g;
 
2598
                s~!!GCC295!!~$gcc295~g;
 
2599
                s~!!DISTCC!!~$distcc~g;
2327
2600
        "
2328
2601
 
2329
2602
        if [ "$icon_theme_dir" != "" ]; then
2359
2632
 
2360
2633
generate_menu_item() {
2361
2634
        MENU_REPLACE="
2362
 
                s#!!TTD!!#$TTD#g;
2363
 
                s#!!MENU_GROUP!!#$menu_group#g
 
2635
                s~!!TTD!!~$TTD~g;
 
2636
                s~!!MENU_GROUP!!~$menu_group~g;
 
2637
                s~!!MENU_NAME!!~$menu_name~g
2364
2638
        "
2365
 
        echo "Generating menu item..."
 
2639
        log 1 "Generating menu item..."
 
2640
        mkdir -p media
2366
2641
        < $ROOT_DIR/media/openttd.desktop.in sed "$MENU_REPLACE" > media/openttd.desktop
2367
2642
}
2368
2643
 
2372
2647
        make_sed
2373
2648
 
2374
2649
        # Create the main Makefile
2375
 
        echo "Generating Makefile..."
 
2650
        log 1 "Generating Makefile..."
2376
2651
        echo "# Auto-generated file from 'Makefile.in' -- DO NOT EDIT" > Makefile
2377
2652
        < $ROOT_DIR/Makefile.in sed "$SRC_REPLACE" >> Makefile
2378
2653
        cp $ROOT_DIR/Makefile.bundle.in Makefile.bundle
2399
2674
        # Create the language file
2400
2675
        mkdir -p $LANG_OBJS_DIR
2401
2676
 
2402
 
        echo "Generating lang/Makefile..."
 
2677
        log 1 "Generating lang/Makefile..."
2403
2678
        echo "# Auto-generated file from 'Makefile.lang.in' -- DO NOT EDIT" > $LANG_OBJS_DIR/Makefile
2404
2679
        < $ROOT_DIR/Makefile.lang.in sed "$SRC_REPLACE" >> $LANG_OBJS_DIR/Makefile
2405
2680
        echo "DIRS += $LANG_OBJS_DIR" >> Makefile.am
2414
2689
        # Create the source file
2415
2690
        mkdir -p $SRC_OBJS_DIR
2416
2691
 
2417
 
        echo "Generating $2/Makefile..."
 
2692
        log 1 "Generating $2/Makefile..."
2418
2693
        echo "# Auto-generated file from 'Makefile.src.in' -- DO NOT EDIT" > $SRC_OBJS_DIR/Makefile
2419
2694
        < $ROOT_DIR/Makefile.src.in sed "$SRC_REPLACE" >> $SRC_OBJS_DIR/Makefile
2420
2695
        echo "DIRS += $SRC_OBJS_DIR" >> Makefile.am
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/"
2477
 
        echo "                                 WINCE/PSP"
 
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!"
2481
2756
        echo ""
2482
2757
        echo "Paths:"
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"
2489
 
        echo "                                 [$data_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"
2503
 
        echo "                                 [$menu_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]"
2510
2787
        echo ""
2511
2788
        echo "Features and packages:"
2512
2789
        echo "  --enable-debug[=LVL]           enable debug-mode (LVL=[0123], 0 is release)"
2531
2808
        echo "                                 (OSX ONLY)"
2532
2809
        echo "  --without-menu-entry           Don't generate a menu item (Freedesktop based only)"
2533
2810
        echo "  --menu-group=group             Category in which the menu item will be placed (Freedesktop based only)"
 
2811
        echo "  --menu-name=name               Name of the menu item when placed [OpenTTD]"
2534
2812
        echo "  --with-direct-music            enable direct music support (Win32 ONLY)"
2535
2813
        echo "  --with-sort=sort               define a non-default location for sort"
2536
2814
        echo "  --with-midi=midi               define which midi-player to use"
2537
2815
        echo "  --with-midi-arg=arg            define which args to use for the"
2538
2816
        echo "                                 midi-player"
 
2817
        echo "  --with-allegrol[=allegro-config]"
 
2818
        echo "                                 enables Allegro video driver support"
2539
2819
        echo "  --with-cocoa                   enables COCOA video driver (OSX ONLY)"
2540
2820
        echo "  --with-sdl[=sdl-config]        enables SDL video driver support"
2541
2821
        echo "  --with-zlib[=zlib.a]           enables zlib support"
2544
2824
        echo "                                 enables libfreetype support"
2545
2825
        echo "  --with-fontconfig[=pkg-config fontconfig]"
2546
2826
        echo "                                 enables fontconfig support"
 
2827
        echo "  --with-icu[=icu-config]        enables icu (used for right-to-left support)"
2547
2828
        echo "  --with-iconv[=iconv-path]      enables iconv support"
2548
2829
        echo "  --with-psp-config[=psp-config] enables psp-config support (PSP ONLY)"
2549
2830
        echo "  --with-makedepend[=makedepend] enables makedepend support"