-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
config.lib
3579 lines (3077 loc) · 109 KB
/
config.lib
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# This file is part of OpenTTD.
# OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
# OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
log() {
if [ $1 = "1" ]; then
shift
echo "$@"
else
shift
fi
echo "$@" >> $config_log
}
set_default() {
ignore_extra_parameters="0"
# We set all kinds of defaults for params. Later on the user can override
# most of them; but if they don't, this default is used.
build=""
host=""
cc_build=""
cc_host=""
cxx_build=""
cxx_host=""
windres=""
strip=""
lipo=""
awk="awk"
pkg_config="pkg-config"
os="DETECT"
cpu_type="DETECT"
config_log="config.log"
prefix_dir="/usr/local"
binary_dir="games"
data_dir="share/games/openttd"
doc_dir="1"
icon_dir="share/pixmaps"
icon_theme_dir="1"
personal_dir="1"
shared_dir="1"
install_dir="/"
man_dir="1"
menu_dir="1"
menu_group="Game;"
menu_name="OpenTTD"
binary_name="openttd"
enable_debug="0"
enable_desync_debug="0"
enable_profiling="0"
enable_lto="0"
enable_dedicated="0"
enable_static="1"
enable_translator="0"
enable_unicode="1"
enable_console="1";
enable_assert="1"
enable_strip="0"
enable_universal="0"
enable_osx_g5="0"
enable_cocoa_quartz="1"
enable_cocoa_quickdraw="1"
with_osx_sysroot="1"
with_application_bundle="1"
with_menu_entry="1"
with_allegro="1"
with_sdl="1"
with_cocoa="1"
with_zlib="1"
with_lzma="1"
with_lzo2="1"
with_xdg_basedir="1"
with_png="1"
enable_builtin_depend="1"
with_makedepend="0"
with_direct_music="1"
with_xaudio2="1"
with_sort="1"
with_iconv="1"
with_midi=""
with_midi_arg=""
with_fluidsynth="1"
with_freetype="1"
with_fontconfig="1"
with_icu_layout="1"
with_icu_sort="1"
static_icu="0"
with_uniscribe="1"
with_threads="1"
with_distcc="1"
with_ccache="1"
with_nforenum="1"
with_grfcodec="1"
with_sse="1"
save_params_array="
build
host
cc_build
cc_host
cxx_build
cxx_host
windres
strip
lipo
awk
pkg_config
os
cpu_type
config_log
prefix_dir
binary_dir
data_dir
doc_dir
icon_dir
icon_theme_dir
man_dir
menu_dir
personal_dir
shared_dir
install_dir
menu_group
menu_name
binary_name
enable_debug
enable_desync_debug
enable_profiling
enable_lto
enable_dedicated
enable_static
enable_translator
enable_unicode
enable_console
enable_assert
enable_strip
enable_universal
enable_osx_g5
enable_cocoa_quartz
enable_cocoa_quickdraw
with_osx_sysroot
with_application_bundle
with_allegro
with_sdl
with_cocoa
with_zlib
with_lzma
with_lzo2
with_xdg_basedir
with_png
enable_builtin_depend
with_makedepend
with_direct_music
with_xaudio2
with_sort
with_iconv
with_midi
with_midi_arg
with_fluidsynth
with_freetype
with_fontconfig
with_icu_layout
with_icu_sort
static_icu
with_uniscribe
with_threads
with_distcc
with_ccache
with_grfcodec
with_nforenum
with_sse
CC CXX CFLAGS CXXFLAGS LDFLAGS CFLAGS_BUILD CXXFLAGS_BUILD LDFLAGS_BUILD PKG_CONFIG_PATH PKG_CONFIG_LIBDIR"
}
detect_params() {
# Walk over all params from the user and override any default settings if
# needed. This also handles any invalid option.
for p in "$@"; do
if [ -n "$prev_p" ]; then
eval "$prev_p=\$p"
prev_p=
continue
fi
optarg=`expr "x$p" : 'x[^=]*=\(.*\)'`
case "$p" in
--help | -h | -\?) showhelp; exit 0;;
--config-log) prev_p="config_log";;
--config-log=*) config_log="$optarg";;
--build) prev_p="build";;
--build=*) build="$optarg";;
--host) prev_p="host";;
--host=*) host="$optarg";;
--os) prev_p="os";;
--os=*) os="$optarg";;
--cpu-type) prev_p="cpu_type";;
--cpu-type=*) cpu_type="$optarg";;
--cc-build) prev_p="cc_build";;
--cc-build=*) cc_build="$optarg";;
--cc-host) prev_p="cc_host";;
--cc-host=*) cc_host="$optarg";;
--cxx-build) prev_p="cxx_build";;
--cxx-build=*) cxx_build="$optarg";;
--cxx-host) prev_p="cxx_host";;
--cxx-host=*) cxx_host="$optarg";;
--windres) prev_p="windres";;
--windres=*) windres="$optarg";;
--awk) prev_p="awk";;
--awk=*) awk="$optarg";;
--pkg-config) prev_p="pkg_config";;
--pkg-config=*) pkg_config="$optarg";;
--strip) prev_p="strip";;
--strip=*) strip="$optarg";;
--lipo) prev_p="lipo";;
--lipo=*) lipo="$optarg";;
# Alias --prefix with --prefix-dir, for compatibility with GNU autotools
--prefix-dir | --prefix) prev_p="prefix_dir";;
--prefix-dir=* | --prefix=*) prefix_dir="$optarg";;
--binary-dir) prev_p="binary_dir";;
--binary-dir=*) binary_dir="$optarg";;
--data-dir) prev_p="data_dir";;
--data-dir=*) data_dir="$optarg";;
--doc-dir) prev_p="doc_dir";;
--doc-dir=*) doc_dir="$optarg";;
--icon-dir) prev_p="icon_dir";;
--icon-dir=*) icon_dir="$optarg";;
--icon-theme-dir) prev_p="icon_theme_dir";;
--icon-theme-dir=*) icon_theme_dir="$optarg";;
--without-icon-theme) icon_theme_dir="";;
--menu-dir) prev_p="menu_dir";;
--menu-dir=*) menu_dir="$optarg";;
--without-menu-entry) menu_dir="";;
--menu-name) prev_p="menu_name";;
--menu-name=*) menu_name="$optarg";;
--binary-name) prev_p="binary_name";;
--binary-name=*) binary_name="$optarg";;
--man-dir) prev_p="man_dir";;
--man-dir=*) man_dir="$optarg";;
--personal-dir) prev_p="personal_dir";;
--personal-dir=*) personal_dir="$optarg";;
--without-personal-dir) personal_dir="";;
--shared-dir) prev_p="shared_dir";;
--shared-dir=*) shared_dir="$optarg";;
--without-shared-dir) shared_dir="";;
--install-dir) prev_p="install_dir";;
--install-dir=*) install_dir="$optarg";;
--menu-group) prev_p="menu_group";;
--menu-group=*) menu_group="$optarg";;
--enable-debug) enable_debug="1";;
--enable-debug=*) enable_debug="$optarg";;
--enable-desync-debug) enable_desync_debug="1";;
--enable-desync-debug=*) enable_desync_debug="$optarg";;
--enable-profiling) enable_profiling="1";;
--enable-profiling=*) enable_profiling="$optarg";;
--enable-lto) enable_lto="1";;
--enable-lto=*) enable_lto="$optarg";;
--enable-ipo) enable_lto="1";;
--enable-ipo=*) enable_lto="$optarg";;
--enable-dedicated) enable_dedicated="1";;
--enable-dedicated=*) enable_dedicated="$optarg";;
--disable-static) enable_static="0";;
--enable-static) enable_static="2";;
--enable-static=*) enable_static="$optarg";;
--disable-translator) enable_translator="0";;
--enable-translator) enable_translator="2";;
--enable-translator=*) enable_translator="$optarg";;
--disable-assert) enable_assert="0";;
--enable-assert) enable_assert="2";;
--enable-assert=*) enable_assert="$optarg";;
--disable-strip) enable_strip="0";;
--enable-strip) enable_strip="2";;
--enable-strip=*) enable_strip="$optarg";;
--disable-universal) enable_universal="0";;
--enable-universal) enable_universal="i386 ppc";;
--enable-universal=*) enable_universal="$optarg";;
--disable-osx-g5) enable_osx_g5="0";;
--enable-osx-g5) enable_osx_g5="2";;
--enable-osx-g5=*) enable_osx_g5="$optarg";;
--disable-unicode) enable_unicode="0";;
--enable-unicode) enable_unicode="2";;
--enable-unicode=*) enable_unicode="$optarg";;
--disable-console) enable_console="0";;
--enable-console) enable_console="2";;
--enable-console=*) enable_console="$optarg";;
--disable-cocoa-quartz) enable_cocoa_quartz="0";;
--enable-cocoa-quartz) enable_cocoa_quartz="2";;
--enable-cocoa-quartz=*) enable_cocoa_quartz="$optarg";;
--disable-cocoa-quickdraw) enable_cocoa_quickdraw="0";;
--enable-cocoa-quickdraw) enable_cocoa_quickdraw="2";;
--enable-cocoa-quickdraw=*) enable_cocoa_quickdraw="$optarg";;
--with-allegro) with_allegro="2";;
--without-allegro) with_allegro="0";;
--with-allegro=*) with_allegro="$optarg";;
--with-sdl) with_sdl="2";;
--without-sdl) with_sdl="0";;
--with-sdl=*) with_sdl="$optarg";;
--with-cocoa) with_cocoa="2";;
--without-cocoa) with_cocoa="0";;
--with-cocoa=*) with_cocoa="$optarg";;
--with-zlib) with_zlib="2";;
--without-zlib) with_zlib="0";;
--with-zlib=*) with_zlib="$optarg";;
--with-lzma) with_lzma="2";;
--without-lzma) with_lzma="0";;
--with-lzma=*) with_lzma="$optarg";;
--with-liblzma) with_lzma="2";;
--without-liblzma) with_lzma="0";;
--with-liblzma=*) with_lzma="$optarg";;
--with-lzo2) with_lzo2="2";;
--without-lzo2) with_lzo2="0";;
--with-lzo2=*) with_lzo2="$optarg";;
--with-liblzo2) with_lzo2="2";;
--without-liblzo2) with_lzo2="0";;
--with-liblzo2=*) with_lzo2="$optarg";;
--with-xdg-basedir) with_xdg_basedir="2";;
--without-xdg-basedir) with_xdg_basedir="0";;
--with-xdg-basedir=*) with_xdg_basedir="$optarg";;
--with-libxdg-basedir) with_xdg_basedir="2";;
--without-libxdg-basedir) with_xdg_basedir="0";;
--with-libxdg-basedir=*) with_xdg_basedir="$optarg";;
--with-png) with_png="2";;
--without-png) with_png="0";;
--with-png=*) with_png="$optarg";;
--with-libpng) with_png="2";;
--without-libpng) with_png="0";;
--with-libpng=*) with_png="$optarg";;
--with-fluidsynth) with_fluidsynth="2";;
--without-fluidsynth) with_fluidsynth="0";;
--with-fluidsynth=*) with_fluidsynth="$optarg";;
--with-freetype) with_freetype="2";;
--without-freetype) with_freetype="0";;
--with-freetype=*) with_freetype="$optarg";;
--with-libfreetype) with_freetype="2";;
--without-libfreetype) with_freetype="0";;
--with-libfreetype=*) with_freetype="$optarg";;
--with-fontconfig) with_fontconfig="2";;
--without-fontconfig) with_fontconfig="0";;
--with-fontconfig=*) with_fontconfig="$optarg";;
--with-libfontconfig) with_fontconfig="2";;
--without-libfontconfig) with_fontconfig="0";;
--with-libfontconfig=*) with_fontconfig="$optarg";;
--with-icu) with_icu_layout="2";with_icu_sort="2";;
--without-icu) with_icu_layout="0";with_icu_sort="0";;
--with-icu=*) with_icu_layout="$optarg";with_icu_sort="$optarg";;
--with-libicu) with_icu_layout="2";with_icu_sort="2";;
--without-libicu) with_icu_layout="0";with_icu_sort="0";;
--with-libicu=*) with_icu_layout="$optarg";with_icu_sort="$optarg";;
--with-icu-layout) with_icu_layout="2";;
--without-icu-layout) with_icu_layout="0";;
--with-icu-layout=*) with_icu_layout="$optarg";;
--with-icu-sort) with_icu_sort="2";;
--without-icu-sort) with_icu_sort="0";;
--with-icu-sort=*) with_icu_sort="$optarg";;
--static-icu) static_icu="1";;
--static-icu=*) static_icu="$optarg";;
--static-libicu) static_icu="1";;
--static-libicu=*) static_icu="$optarg";;
--with-uniscribe) with_uniscribe="2";;
--without-uniscribe) with_uniscribe="0";;
--with-uniscribe=*) with_uniscribe="$optarg";;
--disable-builtin-depend) enable_builtin_depend="0";;
--enable-builtin-depend) enable_builtin_depend="2";;
--enable-builtin-depend=*) enable_builtin_depend="$optarg";;
--with-makedepend) with_makedepend="2";;
--without-makedepend) with_makedepend="0";;
--with-makedepend=*) with_makedepend="$optarg";;
--with-direct-music) with_direct_music="2";;
--without-direct-music) with_direct_music="0";;
--with-direct-music=*) with_direct_music="$optarg";;
--with-xaudio2) with_xaudio2="2";;
--without-xaudio2) with_xaudio2="0";;
--with-xaudio2=*) with_xaudio2="$optarg";;
--with-sort) with_sort="2";;
--without-sort) with_sort="0";;
--with-sort=*) with_sort="$optarg";;
--with-iconv) with_iconv="2";;
--without-iconv) with_iconv="0";;
--with-iconv=*) with_iconv="$optarg";;
--with-midi=*) with_midi="$optarg";;
--with-midi-arg=*) with_midi_arg="$optarg";;
--without-distcc) with_distcc="0";;
--with-distcc) with_distcc="2";;
--with-distcc=*) with_distcc="$optarg";;
--without-ccache) with_ccache="0";;
--with-ccache) with_ccache="2";;
--with-ccache=*) with_ccache="$optarg";;
--without-nforenum) with_nforenum="0";;
--with-nforenum) with_nforenum="2";;
--with-nforenum=*) with_nforenum="$optarg";;
--without-grfcodec) with_grfcodec="0";;
--with-grfcodec) with_grfcodec="2";;
--with-grfcodec=*) with_grfcodec="$optarg";;
--without-osx-sysroot) with_osx_sysroot="0";;
--with-osx-sysroot) with_osx_sysroot="2";;
--with-osx-sysroot=*) with_osx_sysroot="$optarg";;
--without-application-bundle) with_application_bundle="0";;
--with-application-bundle) with_application_bundle="1";;
--with-application-bundle=*) with_application_bundle="$optarg";;
--without-threads) with_threads="0";;
--with-threads) with_threads="1";;
--with-threads=*) with_threads="$optarg";;
--without-sse) with_sse="0";;
--with-sse) with_sse="1";;
--with-sse=*) with_sse="$optarg";;
CC=* | --CC=*) CC="$optarg";;
CXX=* | --CXX=*) CXX="$optarg";;
CFLAGS=* | --CFLAGS=*) CFLAGS="$optarg";;
CXXFLAGS=* | --CXXFLAGS=*) CXXFLAGS="$optarg";;
LDFLAGS=* | --LDFLAGS=*) LDFLAGS="$optarg";;
CFLAGS_BUILD=* | --CFLAGS_BUILD=* | --CFLAGS-BUILD=*) CFLAGS_BUILD="$optarg";;
CXXFLAGS_BUILD=* | --CXXFLAGS_BUILD=* | --CXXFLAGS-BUILD=*) CXXFLAGS_BUILD="$optarg";;
LDFLAGS_BUILD=* | --LDFLAGS_BUILD=* | --LDFLAGS-BUILD=*) LDFLAGS_BUILD="$optarg";;
PKG_CONFIG_PATH=* | --PKG_CONFIG_PATH=* | --PKG-CONFIG-PATH=*) PKG_CONFIG_PATH="$optarg";;
PKG_CONFIG_LIBDIR=* | --PKG_CONFIG_LIBDIR=* | --PKG-CONFIG-LIBDIR=*) PKG_CONFIG_LIBDIR="$optarg";;
--ignore-extra-parameters) ignore_extra_parameters="1";;
--* | -*)
if [ "$ignore_extra_parameters" = "0" ]; then
log 1 "Unknown option $p"
exit 1
else
log 1 "Unknown option $p ignored"
fi
;;
esac
done
if [ -n "$prev_p" ]; then
log 1 "configure: error: missing argument to --$prev_p"
exit 1
fi
# Clean the logfile
echo "" > $config_log
log 2 "Invocation: $0 $*"
}
save_params() {
# Here we save all params, so we can later on do an exact redo of this
# configuration, without having the user to re-input stuff
echo "Running configure with following options:" >> $config_log
echo "" >> $config_log
configure="$CONFIGURE_EXECUTABLE --ignore-extra-parameters"
for p in $save_params_array; do
eval "v=\"\$$p\""
p=`echo "$p" | sed 's@_@-@g;s@\n@@g;s@ @\\ @g'`
# Only save those params that aren't empty
configure="$configure --$p=\"$v\""
done
echo "$configure" >> $config_log
echo "$configure" > config.cache
echo "" >> $config_log
}
# Export a variable so tools like pkg-config can see it when invoked.
# If the variable contains an empty string then unset it.
# $1 - name of the variable to export or unset
export_or_unset() {
eval local value=\$$1
if [ -n "$value" ]; then
export $1;
log 2 "using $1=$value";
else
unset $1;
log 2 "not using $1";
fi
}
check_params() {
# Some params want to be in full uppercase, else they might not work as
# expected.. fix that here
os=`echo $os | tr '[a-z]' '[A-Z]'`
cpu_type=`echo $cpu_type | tr '[a-z]' '[A-Z]'`
# Export some variables to be used by pkg-config
#
# PKG_CONFIG_LIBDIR variable mustn't be set if we are not willing to
# override the default pkg-config search path, it mustn't be an empty
# string. If the variable is empty (e.g. when an empty string comes
# from config.cache) then unset it. This way the "don't override" state
# will be properly preserved when (re)configuring.
export_or_unset PKG_CONFIG_PATH
export_or_unset PKG_CONFIG_LIBDIR
# Check if all params have valid values
# OS only allows DETECT, UNIX, OSX, FREEBSD, DRAGONFLY, OPENBSD, NETBSD, HAIKU, SUNOS, CYGWIN, MINGW, and OS2
if [ -z "`echo $os | egrep '^(DETECT|UNIX|OSX|FREEBSD|DRAGONFLY|OPENBSD|NETBSD|HPUX|HAIKU|SUNOS|CYGWIN|MINGW|OS2)$'`" ]; then
log 1 "configure: error: invalid option --os=$os"
log 1 " Available options are: --os=[DETECT|UNIX|OSX|FREEBSD|DRAGONFLY|OPENBSD|NETBSD|HPUX|HAIKU|SUNOS|CYGWIN|MINGW|OS2]"
exit 1
fi
# cpu_type can be either 32 or 64
if [ -z "`echo $cpu_type | egrep '^(32|64|DETECT)$'`" ]; then
log 1 "configure: error: invalid option --cpu-type=$cpu_type"
log 1 " Available options are: --cpu-type[=DETECT|32|64]"
exit 1
fi
# enable_debug should be between 0 and 4
if [ -z "`echo $enable_debug | egrep '^[0123]$'`" ]; then
log 1 "configure: error: invalid option --enable-debug=$enable_debug"
log 1 " Available options are: --enable-debug[=0123]"
exit 1
fi
# enable_desync_debug should be between 0 and 3
if [ -z "`echo $enable_desync_debug | egrep '^[012]$'`" ]; then
log 1 "configure: error: invalid option --enable-desync-debug=$enable_desync_debug"
log 1 " Available options are: --enable-desync-debug[=012]"
exit 1
fi
detect_awk
detect_os
check_build
check_host
# Check for universal builds; they only make sense for OSX, so fail if enabled for another OS
if [ "$enable_universal" = "0" ]; then
log 1 "checking universal build... no"
else
if [ "$os" != "OSX" ]; then
log 1 "configure: error: --enable-universal only works on OSX"
exit 1
fi
log 1 "checking universal build... yes, for: $enable_universal"
fi
# Already detected by check_build
log 1 "checking build cc... $cc_build"
log 1 "checking host cc... $cc_host"
check_cxx_build
check_cxx_host
check_windres
if [ "$enable_strip" != "0" ]; then
check_strip
else
log 1 "checking strip... disabled"
fi
check_lipo
if [ "$enable_builtin_depend" != "0" ]; then
log 1 "checking builtin depend... yes"
makedepend="\$(SRC_OBJS_DIR)/\$(DEPEND)"
else
log 1 "checking builtin depend... no"
fi
check_makedepend
detect_cputype
detect_sse_capable_architecture
if [ "$enable_static" = "1" ]; then
if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
enable_static="2"
else
enable_static="0"
fi
fi
if [ "$enable_static" != "0" ]; then
log 1 "checking static... yes"
if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "OSX" ]; then
log 1 "WARNING: static is only known to work on Windows, and MacOSX"
log 1 "WARNING: use static at your own risk on this platform"
sleep 5
fi
else
log 1 "checking static... no"
fi
if [ "$enable_unicode" = "1" ]; then
if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
enable_unicode="2"
else
enable_unicode="0"
fi
fi
if [ "$enable_unicode" != "0" ]; then
log 1 "checking unicode... yes"
else
log 1 "checking unicode... no"
fi
# Show what we configured
if [ "$enable_debug" = "0" ]; then
log 1 "using debug level... no"
elif [ "$enable_profiling" != "0" ]; then
log 1 "using debug level... profiling (debug level $enable_debug)"
else
log 1 "using debug level... level $enable_debug"
fi
if [ "$enable_desync_debug" = "0" ]; then
log 1 "using desync debug level... no"
else
log 1 "using desync debug level... level $enable_desync_debug"
log 1 "WARNING: desync debug functions slow down the game considerably."
log 1 "WARNING: use only when you are instructed to do so"
log 1 " or when you know what you are doing."
sleep 5
fi
if [ "$enable_lto" != "0" ]; then
# GCC 4.5 outputs '%{flto}', GCC 4.6 outputs '%{flto*}'
has_lto=`($cxx_build -dumpspecs 2>&1 | grep '\%{flto') || ($cxx_build -help ipo 2>&1 | grep '\-ipo')`
if [ -n "$has_lto" ]; then
log 1 "using link time optimization... yes"
else
enable_lto="0"
log 1 "using link time optimization... no"
log 1 "WARNING: you selected link time optimization but it is not found."
sleep 5
fi
else
log 1 "using link time optimization... no"
fi
if [ "$os" != "OSX" ] && [ "$with_osx_sysroot" != "0" ]; then
if [ "$with_osx_sysroot" = "1" ]; then
with_osx_sysroot="0"
log 1 "checking OSX sysroot... not OSX, skipping"
else
log 1 "configure: error: --with-osx-sysroot only works if OSX is the target"
exit 1
fi
fi
if [ "$with_osx_sysroot" != "0" ]; then
if [ "$enable_universal" = "0" ] && [ "$with_osx_sysroot" != "1" ] && [ "$with_osx_sysroot" != "2" ]; then
# Sysroot manually specified? Check for usability
log 1 "checking OSX sysroot... $with_osx_sysroot"
if ! check_osx_sdk "$with_osx_sysroot"; then
log 1 "Passed sysroot not found/not functional"
exit 1
fi
else
# If autodetect and no universal, use system default
if [ "$with_osx_sysroot" = "1" ] && [ "$enable_universal" = "0" ]; then
log 1 "checking OSX sysroot... no (use system default)"
else
log 1 "checking OSX sysroot... automatically"
detect_osx_sdk
fi
fi
if [ -n "$osx_sdk_path" ]; then
if [ "$enable_universal" != "0" ]; then
if [ -z "$osx_sdk_104_path" ]; then
log 1 "WARNING: Could not find a usable 10.4u SDK, the resulting"
log 1 "WARNING: binary will only run on OSX 10.5 or later"
osx_sdk_104_path="$osx_sdk_path"
fi
OSX_SYSROOT="-isysroot $osx_sdk_104_path"
OSX_LD_SYSROOT="-Wl,-syslibroot,$osx_sdk_104_path"
else
OSX_SYSROOT="-isysroot $osx_sdk_path"
OSX_LD_SYSROOT="-Wl,-syslibroot,$osx_sdk_path"
fi
fi
else
if [ "$os" = "OSX" ]; then
log 1 "checking OSX sysroot... no (use system default)"
fi
fi
detect_allegro
detect_sdl
detect_cocoa
if [ "$enable_dedicated" != "0" ]; then
log 1 "checking GDI video driver... dedicated server, skipping"
log 1 "checking dedicated... found"
else
if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
log 1 "checking GDI video driver... found"
else
log 1 "checking GDI video driver... not Windows, skipping"
fi
if [ -z "$allegro_config" ] && [ -z "$sdl2_config" ] && [ -z "$sdl_config" ] && [ "$with_cocoa" = 0 ] && [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then
log 1 "configure: error: no video driver development files found"
log 1 " If you want a dedicated server use --enable-dedicated as parameter"
exit 1
else
log 1 "checking dedicated... not selected"
fi
fi
if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then
log 1 "checking console application... not Windows, skipping"
elif [ "$enable_console" = "1" ] && [ "$enable_dedicated" != "0" ]; then
log 1 "checking console application... dedicated server, enabled"
enable_console="2"
elif [ "$enable_console" = "1" ]; then
log 1 "checking console application... disabled (only used when forced)"
enable_console="0"
elif [ "$enable_console" = "0" ]; then
log 1 "checking console application... disabled"
else
log 1 "checking console application... enabled"
fi
log 1 "checking squirrel... found"
SCRIPT_SRC_DIR="$ROOT_DIR/src/3rdparty/squirrel/include"
if [ "$enable_translator" != "0" ]; then
log 1 "checking translator... debug"
# -t shows TODO items, normally they are muted
strgen_flags="-t"
else
log 1 "checking translator... no"
strgen_flags=""
fi
if [ "$enable_assert" != "0" ]; then
log 1 "checking assert... enabled"
else
log 1 "checking assert... disabled"
fi
pre_detect_with_zlib=$with_zlib
detect_zlib
if [ "$with_zlib" = "0" ] || [ -z "$zlib_config" ]; then
log 1 "WARNING: zlib was not detected or disabled"
log 1 "WARNING: OpenTTD doesn't require zlib, but it does mean that many features"
log 1 "WARNING: (like loading most old savegames/scenarios, loading heightmaps,"
log 1 "WARNING: using PNG, or using fonts, ...) will be disabled."
if [ "$pre_detect_with_zlib" = "0" ]; then
log 1 "WARNING: We strongly suggest you to install zlib."
else
log 1 "configure: error: no zlib detected"
log 1 " If you want to compile without zlib use --without-zlib as parameter"
exit
fi
fi
pre_detect_with_lzma=$with_lzma
detect_lzma
if [ "$with_lzma" = "0" ] || [ -z "$lzma_config" ]; then
log 1 "WARNING: lzma was not detected or disabled"
log 1 "WARNING: OpenTTD doesn't require lzma, but it does mean that many features"
log 1 "WARNING: (like loading most savegames/scenarios and joining most servers)"
log 1 "WARNING: will be disabled."
if [ "$pre_detect_with_lzma" = "0" ]; then
log 1 "WARNING: We strongly suggest you to install liblzma."
log 1 "configure: error: no liblzma detected"
else
log 1 " If you want to compile without lzma use --without-lzma as parameter"
exit
fi
fi
pre_detect_with_lzo2=$with_lzo2
detect_lzo2
if [ "$with_lzo2" = "0" ] || [ -z "$lzo2" ]; then
log 1 "WARNING: liblzo2 was not detected or disabled"
log 1 "WARNING: OpenTTD doesn't require liblzo2, but it does mean that"
log 1 "WARNING: loading old savegames/scenarios will be disabled."
if [ "$pre_detect_with_lzo2" = "0" ]; then
log 1 "WARNING: We strongly suggest you to install liblzo2."
else
log 1 "configure: error: no liblzo2 detected"
log 1 " If you want to compile without liblzo2 use --without-liblzo2 as parameter"
exit
fi
fi
if [ "$with_uniscribe" != "0" ]; then
if [ "$os" != "MINGW" ]; then
if [ "$with_uniscribe" != "1" ]; then
log 1 "configure: error: Uniscribe is only supported on native Win32 targets"
exit 1
fi
with_uniscribe="0"
log 1 "checking Uniscribe text layout... not Windows, skipping"
else
log 1 "checking Uniscribe text layout... found"
# Don't use ICU unless forced.
if [ "$with_icu_layout" = "1" ]; then
with_icu_layout="0"
fi
if [ "$with_icu_sort" = "1" ]; then
with_icu_sort="0"
fi
fi
fi
detect_xdg_basedir
detect_png
detect_freetype
detect_fontconfig
detect_icu_layout
detect_icu_sort
detect_fluidsynth
if [ "$with_direct_music" != "0" ]; then
if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then
if [ "$with_direct_music" != "1" ]; then
log 1 "configure: error: direct-music is only supported on Win32 targets"
exit 1
fi
with_direct_music="0"
log 1 "checking direct-music... not Windows, skipping"
else
check_direct_music
fi
fi
if [ "$with_xaudio2" != "0" ]; then
if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then
if [ "$with_xaudio2" != "1" ]; then
log 1 "configure: error: xaudio2 is only supported on Win32 targets"
exit 1
fi
with_xaudio2="0"
log 1 "checking xaudio2... not Windows, skipping"
else
check_xaudio2
fi
fi
detect_sort
# Suppress language errors when there is a version defined, indicating a release
# It just isn't pretty if any release produces warnings in the languages.
if [ -f "$ROOT_DIR/version" ]; then
lang_suppress="yes"
log 1 "suppress language errors... yes"
else
lang_suppress=""
log 1 "suppress language errors... no"
fi
if [ "$enable_debug" = "0" ] && [ "$enable_profiling" = "0" ] && [ "$enable_strip" != "0" ]; then
if [ "$os" = "OSX" ]; then
strip_arg=""
elif [ "$os" = "OS2" ]; then
strip_arg=""
# OS2 uses strip via gcc, because it needs to be feed to emxbind
LDFLAGS="$LDFLAGS -s"
elif [ "$os" = "SUNOS" ]; then
# The GNU strip does know -s, the non-GNU doesn't
# So try to detect it (in a bit of an ugly way)
strip_arg="`$strip -s strip.test 2>/dev/null && echo \"-s\"`"
else
strip_arg="-s"
fi
log 1 "checking stripping... $strip $strip_arg"
else
strip=""
log 1 "checking stripping... skipped"
fi
if [ "$with_distcc" = "0" ]; then
log 1 "checking distcc... no"
elif [ "$with_distcc" = "1" ]; then
with_distcc="0"
log 1 "checking distcc... no (only used when forced)"
elif [ "$with_distcc" = "2" ]; then
distcc="distcc"
else
distcc="$with_distcc"
fi
if [ "$with_distcc" != "0" ]; then
res="`$distcc --version 2>/dev/null | head -n 1 | cut -b 1-6`"
if [ "$res" != "distcc" ]; then
distcc=""
log 1 "checking distcc... no"
if [ "$with_distcc" = "2" ]; then
log 1 "configure: error: no distcc detected, but was forced to be used"
exit 1
fi
if [ "$with_distcc" != "1" ]; then
log 1 "configure: error: '$with_distcc' doesn't seem a distcc to me"
exit 1
fi
fi
log 1 "checking distcc... $distcc"
fi
if [ "$with_ccache" = "0" ]; then
log 1 "checking ccache... no"
elif [ "$with_ccache" = "1" ]; then
with_ccache="0"
log 1 "checking ccache... no (only used when forced)"
elif [ "$with_ccache" = "2" ]; then
ccache="ccache"
else
ccache="$with_ccache"
fi
if [ "$with_ccache" != "0" ]; then
res="`$ccache --version 2>/dev/null | head -n 1 | cut -b 1-6`"
if [ "$res" != "ccache" ]; then
ccache=""
log 1 "checking ccache... no"
if [ "$with_ccache" = "2" ]; then
log 1 "configure: error: no ccache detected, but was forced to be used"
exit 1
fi
if [ "$with_ccache" != "1" ]; then
log 1 "configure: error: '$with_ccache' doesn't seem a ccache to me"
exit 1
fi
fi
log 1 "checking ccache... $ccache"
fi
detect_grfcodec
detect_nforenum
if [ -z "$grfcodec" ] && [ -n "$nforenum" ]; then
log 1 "checking nforenum/grfcodec... nforenum needs grfcodec enabled, disabling nforenum"
nforenum=""
fi
if [ -z "$nforenum" ] && [ -n "$grfcodec" ]; then