forked from freeciv/freeciv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
1891 lines (1640 loc) · 62.1 KB
/
configure.ac
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
dnl configure.ac for freeciv
dnl Process this file with autoconf to produce a configure script.
AC_INIT([Freeciv], m4_esyscmd([./fc_version | tr -d '\n']),
[https://osdn.net/projects/freeciv/ticket/],
[freeciv], [http://www.freeciv.org/])
AC_PREREQ(2.65)
dnl Initialize with some random file to ensure the source is here.
AC_CONFIG_SRCDIR([common/game.c])
AC_CONFIG_AUX_DIR(bootstrap) # This can't be quoted or automake will fail
AC_CONFIG_MACRO_DIR([m4])
ifdef([AC_CONFIG_MACRO_DIRS],[AC_CONFIG_MACRO_DIRS([dependencies/m4])])
AC_CONFIG_HEADERS([gen_headers/fc_config.h gen_headers/freeciv_config.h])
AC_CANONICAL_HOST
AC_USE_SYSTEM_EXTENSIONS
AC_C_BIGENDIAN
FC_EMSCRIPTEN
BUG_URL="$PACKAGE_BUGREPORT"
WIKI_URL="http://www.freeciv.org/"
MAIL_ADDRESS="freeciv-dev AT freelists.org"
dnl Explain fc_config.h to end users (e.g., on Windows)
AH_TOP(
[/* This header file is shipped in some binary distributions.
* It is included purely for reference as to how the executables were built,
* and changing it will have no functional effect on pre-built binaries. */])
AC_DEFINE(FC_CONFIG_H, 1, [Configuration autogenerated])
AC_DEFINE_UNQUOTED([BUG_URL], ["$BUG_URL"], [Bug reporting URL])
AC_DEFINE_UNQUOTED([WIKI_URL], ["$WIKI_URL"], [Informational URL])
AC_DEFINE([DEFAULT_SOCK_PORT], [5556], [Connection TCP Port])
AC_DEFINE([FREECIV_JSON_PORT], [6556], [Json Connection TCP Port]) dnl raw default + 1000
AC_SUBST([BUG_URL])
AC_SUBST([WIKI_URL])
AC_SUBST([MAIL_ADDRESS])
dnl client/server should always have the same major and minor versions
dnl different patch versions are compatible
VERSION_SCRIPT_SILENT=yes
m4_include(fc_version)
AC_ARG_VAR([FREECIV_LABEL_FORCE], [Forced version label format])
AC_DEFINE_UNQUOTED([MAJOR_VERSION], [$MAJOR_VERSION], [Major version])
AC_DEFINE_UNQUOTED([MINOR_VERSION], [$MINOR_VERSION], [Minor version])
AC_DEFINE_UNQUOTED([PATCH_VERSION], [$PATCH_VERSION], [Patch version])
if test x$EMERGENCY_VERSION != x ; then
AC_DEFINE_UNQUOTED([EMERGENCY_VERSION], [$EMERGENCY_VERSION], [Emergency version])
fi
AC_DEFINE_UNQUOTED([VERSION_LABEL], ["${VERSION_LABEL}"], [Version label])
AC_DEFINE_UNQUOTED([VERSION_STRING], ["${VERSION_STRING}"], [Version string])
AC_DEFINE_UNQUOTED([IS_DEVEL_VERSION], [$IS_DEVEL_VERSION], [Is this a devel version])
AC_DEFINE_UNQUOTED([IS_FREEZE_VERSION], [$IS_FREEZE_VERSION], [Is this a frozen version])
AC_DEFINE_UNQUOTED([IS_BETA_VERSION], [$IS_BETA_VERSION], [Is this a beta version])
AC_DEFINE_UNQUOTED([NEXT_STABLE_VERSION], ["$NEXT_STABLE_VERSION"], [Version number of next release])
AC_DEFINE_UNQUOTED([FREECIV_RELEASE_MONTH], [$RELEASE_MONTH], [Month next version will be released])
AC_SUBST([MAJOR_VERSION])
AC_SUBST([MINOR_VERSION])
AC_DEFINE_UNQUOTED([DATASUBDIR],
["$DATASUBDIR"],
[Version specific subdir for default data path])
AC_SUBST([DATASUBDIR])
AC_DEFINE_UNQUOTED([FREECIV_DISTRIBUTOR], ["$FREECIV_DISTRIBUTOR"],
[Distribution this freeciv is built for])
dnl Initialize automake stuff
AM_INIT_AUTOMAKE([subdir-objects dist-zip dist-xz])
dnl Use silent rules by default
dnl verbose build using make V=1
AM_SILENT_RULES([yes])
UTILITY_LIBS=
AC_PROG_MKDIR_P
dnl Sed is needed for the configuration
dnl of the clients, database setting and the mapimg toolkits.
AC_PROG_SED
AC_CACHE_CHECK([for malloc(0) return value], [fc_cv_malloc_zero_ok], [
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdlib.h>
int
main()
{
void *allocation = malloc(0);
if (allocation != NULL) {
free(allocation);
}
return (allocation == NULL);
}
]])], [fc_cv_malloc_zero_ok=true], [fc_cv_malloc_zero_ok=false], [fc_cv_malloc_zero_ok=false])])
if test "x$fc_cv_malloc_zero_ok" = "xtrue" ; then
AC_DEFINE([MALLOC_ZERO_OK], [1], [It's ok to call malloc() for zero bytes])
fi
if test "x$emscripten" != "xyes" ; then
dnl Not needed in emscripten build as both users - fcdb and fcmp - are disabled
FC_CHECK_SQLITE3([], [AC_MSG_ERROR([sqlite3 not found])])
fi
dnl set default values
fcdb_all=no
fcdb_mysql=no
fcdb_odbc=no
fcdb_postgres=no
fcdb_sqlite3=no
dnl checks for databases
dnl all: Autodetect as many as possible [default].
dnl mysql: use mysql database
dnl odbc: use odbc database
dnl postgres: use postgres database
dnl comma-separated-list: Detect these or abort.
AC_ARG_ENABLE([fcdb],
AS_HELP_STRING([--enable-fcdb[=no/all/mysql/odbc/postgres/sqlite3]],
[database backends [sqlite3](no, or list)]),
[databases=${enableval}],
[if test "x$emscripten" != "xyes" ; then
databases=sqlite3
else
databases=no
fi])
if test "x$emscripten" = "xyes" && test "x$databases" != "xno" ; then
AC_MSG_ERROR([fcdb not supported with emscripten])
fi
for db in $(echo $databases | $SED 's/,/ /g') ; do
if test "x$db" = "xall" ; then
fcdb_all=yes
elif test "x$db" = "xno" ; then
fcdb_all=no
elif test "x$db" = "xmysql" ; then
fcdb_mysql=yes
elif test "x$db" = "xodbc" ; then
fcdb_odbc=yes
elif test "x$db" = "xpostgres" ; then
fcdb_postgres=yes
elif test "x$db" = "xsqlite3" ; then
fcdb_sqlite3=yes
else
AC_MSG_ERROR([bad value ${db} for --enable-fcdb])
fi
done
dnl checks for database mysql
dnl sets FCDB_MYSQL(conditional), FCDB_MYSQL_CFLAGS
FC_FCDB_MYSQL
dnl checks for database odbc
dnl sets FCDB_ODBC(conditional), FCDB_ODBC_CFLAGS
FC_FCDB_ODBC
dnl checks for database postgres
dnl sets FCDB_POSTGRES(conditional), FCDB_POSTGRES_CFLAGS
FC_FCDB_POSTGRES
dnl checks for database sqlite3
dnl sets FCDB_SQLITE3(conditional), FCDB_SQLITE3_CFLAGS
FC_FCDB_SQLITE3
dnl check if a database backend is available
if test "x$fcdb_mysql" = "xyes" || test "x$fcdb_odbc" = "xyes" \
|| test "x$fcdb_postgres" = "xyes" || test "x$fcdb_sqlite3" = "xyes"; then
enable_fcdb=yes
AC_DEFINE([HAVE_FCDB], [1], [Database backend available])
else
enable_fcdb=no
fi
AM_CONDITIONAL([FCDB_DB], [test "x$enable_fcdb" = "xyes"])
dnl no=do not compile server, yes=compile server, *=error
AC_ARG_ENABLE([server],
AS_HELP_STRING([--disable-server], [do not compile the server]),
[case "${enableval}" in
yes) server=yes ;;
no) server=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for --disable-server) ;;
esac], [server=yes])
AM_CONDITIONAL(SERVER, test x$server = xyes)
dnl Host type variable defaults
MINGW=no
HAIKU=no
dnl Settings specific to host OS
case "$host_os" in
*mingw*)
dnl Windows-specific settings
MINGW=yes
FC_WINSOCK2_INCLUDE([AC_DEFINE([FREECIV_HAVE_WINSOCK2], [1], [Mingw-specific setting - winsock2])])
AC_DEFINE([FREECIV_HAVE_WINSOCK], [1], [Mingw-specific setting - winsock])
AC_CHECK_HEADERS([ws2tcpip.h], [AC_DEFINE([FREECIV_HAVE_WS2TCPIP_H], [1], [ws2tcpip.h available])])
AC_CHECK_HEADERS([direct.h])
dnl Without WINSOCK2, use: LIBS="$LIBS -lwsock32"
LIBS="${LIBS} -lws2_32"
;;
*haiku*)
HAIKU=yes
LIBS="$LIBS -lnetwork"
;;
esac
dnl Networking headers
AC_CHECK_HEADERS([sys/types.h], [AC_DEFINE([FREECIV_HAVE_SYS_TYPES_H], [1], [sys/types.h available])])
dnl Avoid including the unix emulation layer if we build mingw executables
dnl There would be type conflicts between winsock and bsd/unix includes
if test "x$MINGW" != "xyes"; then
AC_CHECK_HEADERS([sys/socket.h], [AC_DEFINE([FREECIV_HAVE_SYS_SOCKET_H], [1], [sys/socket.h available])])
fi
dnl Check getaddrinfo just once here, and remember the result
AC_CHECK_FUNCS([getaddrinfo], [have_getaddrinfo=yes], [
AC_MSG_CHECKING([getaddrinfo() as a macro])
AC_LINK_IFELSE([AC_LANG_PROGRAM([
#ifdef FREECIV_HAVE_WS2TCPIP_H
#include <ws2tcpip.h>
#endif], [getaddrinfo(NULL, NULL, NULL, NULL);])], [
AC_MSG_RESULT([yes])
have_getaddrinfo=yes
AC_DEFINE([HAVE_GETADDRINFO])], [AC_MSG_RESULT([no])])])
dnl yes - Support for IPv6 required
dnl no - Legacy IPv4 support
dnl test - Try to enable IPv6 support
AC_ARG_ENABLE([ipv6],
AS_HELP_STRING([--enable-ipv6=yes/no/test], [use IPv6 [test]]),
[case "${enableval}" in
yes|no|test) ipv6=${enableval} ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-ipv6) ;;
esac], [ipv6=yes])
if test x$ipv6 != xno ; then
if test "x$have_getaddrinfo" = "xyes" ; then
enable_ipv6=yes
AC_CHECK_FUNCS([inet_pton], [],
[AC_MSG_CHECKING([inet_pton() as a macro])
AC_LINK_IFELSE([AC_LANG_PROGRAM([
#ifdef FREECIV_HAVE_WS2TCPIP_H
#include <ws2tcpip.h>
#endif], [inet_pton(0, NULL, NULL);])], [
AC_MSG_RESULT([yes])], [enable_ipv6=no])])
AC_CHECK_FUNCS([inet_ntop], [],
[AC_MSG_CHECKING([inet_ntop() as a macro])
AC_LINK_IFELSE([AC_LANG_PROGRAM([
#ifdef FREECIV_HAVE_WS2TCPIP_H
#include <ws2tcpip.h>
#endif], [inet_ntop(0, NULL, NULL, 0);])], [
AC_MSG_RESULT([yes])], [enable_ipv6=no])])
AC_CHECK_FUNCS([getnameinfo], [],
[AC_MSG_CHECKING([getnameinfo() as a macro])
AC_LINK_IFELSE([AC_LANG_PROGRAM([
#ifdef FREECIV_HAVE_WS2TCPIP_H
#include <ws2tcpip.h>
#endif], [getnameinfo(NULL, 0, NULL, 0, NULL, 0, 0);])], [
AC_MSG_RESULT([yes])], [enable_ipv6=no])])
else
enable_ipv6=no
fi
if test x$enable_ipv6 = xyes ; then
AC_MSG_CHECKING([for AF_INET6])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#ifdef FREECIV_HAVE_WINSOCK2
#include <winsock2.h>
#endif
#ifdef FREECIV_HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#ifdef FREECIV_HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif]], [[return AF_INET6;]])], [AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
enable_ipv6=no])
fi
if test x$enable_ipv6 = xno && test x$ipv6 = xyes ; then
AC_MSG_ERROR([Cannot enable IPv6 functionality. If you want to allow build without IPv6, try --enable-ipv6=test or --disable-ipv6])
fi
if test x$enable_ipv6 = xyes ; then
AC_DEFINE([FREECIV_IPV6_SUPPORT], [1], [IPv6 Support built in])
fi
fi
AC_ARG_WITH([project-definition],
AS_HELP_STRING([--with-project-definition=file], [use given project definition file]),
[project_definition="${withval}"
project_definition_dyn_rel="\$(top_builddir)/${withval}"],
[project_definition="${srcdir}/bootstrap/freeciv.project"
project_definition_dyn_rel="\$(top_srcdir)/bootstrap/freeciv.project"])
. ${project_definition}
AC_DEFINE_UNQUOTED([FREECIV_META_URL], ["$META_URL"], [Metaserver URL])
if test "x$MODPACK_LIST_URL" != "x" ; then
AC_DEFINE_UNQUOTED([MODPACK_LIST_URL], ["${MODPACK_LIST_URL}"], [Default modpack list URL])
fi
AC_ARG_WITH([readline],
AS_HELP_STRING([--with-readline], [support fancy command line editing]),
WITH_READLINE=$withval, dnl yes/no - required to use / never use
WITH_READLINE="maybe" dnl maybe - use if found [default]
)
FOLLOWTAG=${DEFAULT_FOLLOW_TAG}
AC_ARG_WITH([followtag],
AS_HELP_STRING([--with-followtag], [version tag to follow]),
[FOLLOWTAG=${withval}])
AC_DEFINE_UNQUOTED([FOLLOWTAG], ["${FOLLOWTAG}"], [Version tag to follow])
AC_ARG_WITH([desktopdir],
AS_HELP_STRING([--with-desktopdir], [install desktop files to given dir]),
[ DESKTOPDIR=${withval} ], [ DESKTOPDIR="\$(prefix)/share/applications" ])
AC_SUBST([DESKTOPDIR])
AC_ARG_WITH([appdatadir],
AS_HELP_STRING([--with-appdatadir], [install appdata files to given dir]),
[ APPDATADIR=${withval} ], [ APPDATADIR="\$(prefix)/share/appdata" ])
AC_SUBST([APPDATADIR])
dnl try to support this development version's previous save games formats
AC_ARG_ENABLE([dev-save-compat],
AS_HELP_STRING([--enable-dev-save-compat=yes/no],
[enable development version save game compatibility]),
[case "${enableval}" in
yes) dev_save_compat=1 ;;
no) dev_save_compat=0 ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-dev-save-compat]) ;;
esac],
[dev_save_compat=$IS_DEVEL_VERSION])
AS_IF([test $dev_save_compat != 0],
[AC_DEFINE([FREECIV_DEV_SAVE_COMPAT], [1],
[Development version save game compatibility])
AC_DEFINE([FREECIV_DEV_SAVE_COMPAT_3_2], [1],
[Development version save game compatibility - 3.2 development])
AC_DEFINE([FREECIV_DEV_SAVE_COMPAT_3_1], [1],
[Development version save game compatibility - 3.1 development])])
AC_ARG_ENABLE([patient-connect],
AS_HELP_STRING([--enable-patient-connect=yes/no],
[enable client to be very patient in connecting spawned server]),
[case "${enableval}" in
yes) AC_DEFINE([FREECIV_PATIENT_CONNECT], [1],
[Client is very patient when connecting to spawned server]) ;;
no) ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-patient-connect]) ;;
esac])
dnl set default values
mapimg_all=auto
mapimg_magickwand=no
dnl map images
dnl all: Autodetect as many as possible [default].
dnl no: No additional toolkits.
dnl magickwand: compile magickwand (imagemagick) support.
dnl comma-separated-list: Detect these or abort.
AC_ARG_ENABLE([mapimg],
AS_HELP_STRING([--enable-mapimg=no/auto/magickwand],
[additional map image toolkits to compile [auto](no, or list)]),
[toolkits=${enableval}],
[enable_mapimg=auto])
for toolkit in $(echo $toolkits | $SED 's/,/ /g') ; do
if test "x$toolkit" = "xauto" ; then
enable_mapimg=auto
elif test "x$toolkit" = "xno" ; then
enable_mapimg=no
else
enable_mapimg=selected
fi
if test "x$toolkit" = "xmagickwand" ; then
mapimg_magickwand=yes
fi
done
dnl checks for MagickWand mapimg support
dnl sets MAPIMG_WAND_CFLAGS, MAPIMG_WAND_LIBS
FC_MAPIMG_MAGICKWAND
dnl make it possible to disable the delta network protocol
AC_ARG_ENABLE([delta-protocol],
AS_HELP_STRING([--disable-delta-protocol],
[disable the delta network protocol]),
[case "${enableval}" in
yes|no)
enable_delta_protocol=${enableval} ;;
*)
AC_MSG_ERROR([bad value ${enableval} for --enable-delta-protocol]) ;;
esac],
[enable_delta_protocol=yes])
AS_IF([test "x$enable_delta_protocol" = "xno"], [
AC_MSG_WARN([delta network protocol is off])
AC_MSG_WARN([no network compatibility with regular Freeciv])
AC_MSG_WARN([won't be able to play with regular Freeciv])],[
AC_DEFINE([FREECIV_DELTA_PROTOCOL], [1], [Delta protocol enabled])])
dnl done setting arguments for the packet generator
AC_SUBST([GENERATE_PACKETS_ARGS])
FC_WEB_OPTIONS
AC_ARG_ENABLE([fcweb],
AS_HELP_STRING([--enable-fcweb], [build fcweb version of server [false]]),
[case "${enableval}" in
yes)
fcweb=true ;;
no)
fcweb=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-fcweb]) ;;
esac], [fcweb=false])
FC_WEB_CLIENT
AS_IF([test "x$fcweb" = "xtrue"],
AC_SUBST([SRVBIN], [freeciv-web]),
AC_SUBST([SRVBIN], [freeciv-server]))
FC_TESTMATIC
dnl no: Do not compile client.
dnl auto: Autodetect one.
dnl all: Autodetect as many as possible.
dnl comma-separated-list: Detect these or abort.
AC_ARG_ENABLE([client],
AS_HELP_STRING([--enable-client=auto/all/gtk3/gtk3.22/sdl2/qt/stub],
[clients to compile [auto](list for multiple)]),
[clients=${enableval}],
[client=auto])
if test "x$fcweb" = "xtrue" && test "x$client" = "xauto" ; then
clients=no
fi
gui_gtk3=no
gui_gtk3_22=no
gui_gtk3x=no
gui_sdl2=no
gui_qt=no
gui_stub=no
for gui in $(echo $clients | $SED 's/,/ /g') ; do
if test "x$gui" = "xno" ; then
client=no
elif test "x$gui" = "xauto" || test "x$gui" = "xyes" ; then
client=auto
elif test "x$gui" = "xall" ; then
client=all
else
if test "x$gui" = "xgtk3" ||
test "x$gui" = "xgtk3.0" ||
test "x$gui" = "xgtk30" ||
test "x$gui" = "xgtk-3.0" ; then
gui_gtk3=yes
elif test "x$gui" = "xgtk3.22" ; then
gui_gtk3_22=yes
elif test "x$gui" = "xgtk3x" ; then
gui_gtk3x=yes
elif test "x$gui" = "xgtk" ; then
AC_MSG_WARN([for requested client 'gtk' enabled gtk3.22-client, that has changed since earlier versions and will change again in the future])
gui_gtk3_22=yes
else
if test ! -d "${srcdir}/client/gui-$gui" ; then
AC_MSG_ERROR(bad value ${gui} for --enable-client)
fi
eval "gui_$gui=yes"
fi
client=yes
fi
done
AC_ARG_WITH([zoom],
[AS_HELP_STRING([--with-zoom], [expose experimental/WIP zoom support on gtk3-clients to user])],
[AC_DEFINE([GTK3_ZOOM_ENABLED], [1], [Experimental zoom functionality exposed to user])])
AC_ARG_WITH([3d],
[AS_HELP_STRING([--with-3d], [build WIP 3D support to gtk3.22-client])],
[AC_DEFINE([GTK3_3D_ENABLED], [1], [3D support built to gtk3.22-client])
enable_3d=true])
gui_3d_libs=""
if test x$enable_3d = xtrue ; then
AC_CHECK_LIB([GL], [glBegin], [gui_3d_libs="-lGL"],
[AC_MSG_ERROR([libGL needed for 3D support not found])])
fi
AC_ARG_ENABLE([gitrev],
AS_HELP_STRING([--enable-gitrev], [get git revision to version information]),
[case "${enableval}" in
yes) gitrev=true ;;
no) gitrev=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-gitrev]) ;;
esac], [gitrev=false])
AM_CONDITIONAL([GITREV], [test x$gitrev = xtrue])
if test x$gitrev = xtrue ; then
AC_DEFINE([GITREV], [1], [Get git revision information to version number])
fi
AC_ARG_ENABLE([make_data],
AS_HELP_STRING([--disable-make-data], [do not recurse make into data directories]),
[case "${enableval}" in
yes) make_data=true ;;
no) make_data=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --disable-make-data) ;;
esac], [make_data=true])
AM_CONDITIONAL(MAKE_DATA, test x$make_data = xtrue)
AC_ARG_ENABLE([make_include],
AS_HELP_STRING([--enable-make-include], [force make to recurse into include directory]),
[case "${enableval}" in
yes) make_include=true ;;
no) make_include=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-make-include) ;;
esac], [make_include=false])
AM_CONDITIONAL(MAKE_CLIENT_INCLUDE, test "$make_include" = "true")
AC_ARG_WITH([efence],
AS_HELP_STRING([--with-efence], [use Electric Fence, malloc debugger]),
WITH_EFENCE=1
)
AC_ARG_ENABLE([aimodules],
AS_HELP_STRING([--enable-aimodules=yes/no/experimental], [support for ai modules [no]]),
[case "${enableval}" in
yes) enable_aimodules=yes ;;
no) enable_aimodules=no ;;
experimental) enable_aimodules=yes
exp_aimodules=yes ;;
*) AC_MSG_ERROR([bad value ${enable_aimodules} for --enable-aimodules]) ;;
esac], [enable_aimodules=no])
aimoduledir="${libdir}/fcai"
AC_SUBST(aimoduledir)
AM_CONDITIONAL(AI_MODULES, test "x$enable_aimodules" = "xyes")
if test $enable_aimodules = yes ; then
if test x$enable_shared != xyes ; then
AC_MSG_ERROR([cannot enable ai module support if also build of shared libraries is not enabled with --enable-shared])
fi
LIBS_TMP="$LIBS"
LIBS="$LIBS -lltdl"
AC_MSG_CHECKING([whether can build modules])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <ltdl.h>]],
[[lt_dlopenext(NULL);]])],
[AC_MSG_RESULT([yes])],
[AC_MSG_RESULT([no])
AC_MSG_ERROR([cannot build loadable AI modules as requested])])
LIBS="$LIBS_TMP"
SERVER_LIBS="${SERVER_LIBS} -lltdl"
AC_DEFINE([AI_MODULES], [1], [Enable ai modules])
CPPFLAGS="${CPPFLAGS} -DAI_MODULEDIR=\"\\\"${aimoduledir}\\\"\""
ai_mod_default_needed=yes
fi
AM_CONDITIONAL(EXP_AI_MODULES, test "x$exp_aimodules" = "xyes")
dnl Checks for programs.
AC_PROG_AWK
AC_PROG_CC
AC_PROG_CPP
AC_PROG_LN_S
AC_DISABLE_SHARED
AM_PROG_AR
if test -z $AR; then
AC_MSG_ERROR([*** 'ar' missing. Install binutils, fix your \$PATH, or set \$AR manually. ***])
fi
LT_INIT
AM_PROG_CC_C_O
AC_PROG_CXX
FC_C99_TOKEN_CONCENATION
AC_CHECK_PROG(UNAME,uname,uname,:)
AC_CHECK_SIZEOF([int])
dnl Programs already checked by AM_INIT_AUTOMAKE:
dnl
dnl AC_PROG_MAKE_SET required with automake-ng
AC_PROG_MAKE_SET
dnl Check for libiconv (which is usually included in glibc, but may be
dnl distributed separately). The libcharset check must come after the
dnl iconv check. This whole thing must come before the gettext check below.
AM_ICONV
FC_LIBCHARSET
AM_LANGINFO_CODESET
if test "$am_cv_func_iconv" != yes; then
AC_MSG_ERROR([Iconv is missing. You can get libiconv from http://gnu.org/, \
or try using --with-libiconv-prefix.])
fi
LIBS="$LIBS $LIBICONV"
dnl I18n support
ALL_LINGUAS="ar bg cs ca da de el en_GB eo es et fa fi fr ga gd he hu id it ja
ko lt nl nb pl pt pt_BR ro ru sr sv tr uk zh_CN zh_TW"
PODOMAINS="freeciv nations ruledit"
AM_GNU_GETTEXT([external], [need-ngettext])
if test "x$USE_NLS" = "xyes" ; then
AC_DEFINE([FREECIV_ENABLE_NLS], [1], [Native language support enabled])
fi
AM_XGETTEXT_OPTION([--keyword=Q_])
AM_XGETTEXT_OPTION([--keyword=PL_:1,2])
AM_XGETTEXT_OPTION([--language=C])
AM_XGETTEXT_OPTION([--escape])
AM_XGETTEXT_OPTION([--add-comments="TRANS:"])
AM_XGETTEXT_OPTION([--from-code=UTF-8])
PKG_PROG_PKG_CONFIG
if test "x$PKG_CONFIG" = "x" ; then
AC_MSG_ERROR([pkg-config not found])
fi
if test "x$emscripten" != "xyes" ; then
PKG_CHECK_MODULES([CURL], [libcurl >= 7.15.4],,
[AC_MSG_ERROR([libcurl development files required])])
UTILITY_CFLAGS="${UTILITY_CFLAGS} ${CURL_CFLAGS}"
UTILITY_LIBS="${UTILITY_LIBS} ${CURL_LIBS}"
fi
AC_ARG_ENABLE([xml-registry],
AS_HELP_STRING([--enable-xml-registry], [build xml-backend for registry (WIP)]),
[case "${enableval}" in
yes) XMLREGISTRY=yes ;;
no) XMLREGISTRY=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-xml-registry]) ;;
esac], [XMLREGISTRY=no])
if test "x$XMLREGISTRY" = "xyes" ; then
PKG_CHECK_MODULES([LIBXML2], [libxml-2.0],,
[AC_MSG_ERROR([libxml2 development files required])])
UTILITY_CFLAGS="${UTILITY_CFLAGS} ${LIBXML2_CFLAGS}"
UTILITY_LIBS="${UTILITY_LIBS} ${LIBXML2_LIBS}"
AC_DEFINE([FREECIV_HAVE_XML_REGISTRY], [1], [Build xml-backend for registry])
fi
if test "x$emscripten" != "xyes" ; then
PKG_CHECK_MODULES([ICU], [icu-uc],,
[AC_MSG_ERROR([icu development files required])])
UTILITY_CFLAGS="${UTILITY_CFLAGS} ${ICU_CFLAGS}"
UTILITY_LIBS="${UTILITY_LIBS} ${ICU_LIBS}"
else
CFLAGS="$CFLAGS -s USE_ICU=1"
CXXFLAGS="$CXXFLAGS -s USE_ICU=1"
fi
dnl Should we build experimental versions of Qt programs?
dnl This needs to be before C++ compiler check FC_WORKING_CXX, and
dnl that in turn needs to be before FC_DEBUG that will depend on compiler
dnl when setting compiler flags.
AC_ARG_WITH([qt5x],
AS_HELP_STRING([--with-qt5x], [build experimental versions of Qt programs]),
[case "${withval}" in
yes) qt_ver="Qt5x"
AC_DEFINE([FC_QT6_MODE], [1], [this is Qt5x based build]) ;;
*) qt_ver="Qt5" ;;
esac], [qt_ver="Qt5"])
FC_WORKING_CXX
dnl Set debug flags supported by compiler
EXTRA_DEBUG_CFLAGS=""
EXTRA_DEBUG_CXXFLAGS=""
EXTRA_DEBUG_LDFLAGS=""
dnl check debugging
FC_DEBUG
dnl check profiling
FC_GPROF
FC_C99_VARIADIC_MACROS
AC_C_VARARRAYS
if test "x$ac_cv_c_vararrays" != "xyes" ; then
AC_MSG_ERROR([A compiler supporting C99 variable arrays is required])
fi
FC_C99_INITIALIZERS
FC_C99_STDINT_H
FC_C99_INITIALIZER_BRACES
FC_C11_STATIC_ASSERT
FC_C11_AT_QUICK_EXIT
FC_STATIC_STRLEN
FC_CXX11_STATIC_ASSERT
FC_CXX11_NULLPTR
dnl BeOS-specific settings
if test x`$UNAME -s` = xBeOS ; then
AC_DEFINE([FREECIV_SOCKET_ZERO_NOT_STDIN], [1], [BeOS-specific setting])
CFLAGS="$CFLAGS -Wno-multichar"
LDFLAGS="$LDFLAGS -x none"
if test x$enable_debug = xyes ; then
CFLAGS="$CFLAGS -gdwarf-2"
LDFLAGS="$LDFLAGS -gdwarf-2"
fi
# We used to set ARFLAGS here, but under recent versions of automake this
# broke compilation on other systems. Setting ARFLAGS shouldn't be
# necessary with a working automake.
fi
dnl Defaults to override with host specific values
HOST_PATH_SEPARATOR=":"
HOST_DIR_SEPARATOR="/"
dnl Settings specific to host OS
case "$host_os" in
*mingw*)
dnl Windows-specific settings
AC_CHECK_TOOL([WINDRES], [windres])
if test -z $WINDRES; then
AC_MSG_ERROR([*** 'windres' missing. Install binutils, fix your \$PATH, or set \$WINDRES manually. ***])
fi
HOST_PATH_SEPARATOR=";"
HOST_DIR_SEPARATOR="\\"
FREECIV_STORAGE_DIR_ESC=$(echo $FREECIV_STORAGE_DIR | $SED 's,/,\\\\\\\\,g')
FREECIV_STORAGE_DIR=$(echo $FREECIV_STORAGE_DIR | $SED 's,/,\\\\,g')
AC_DEFINE([FREECIV_SOCKET_ZERO_NOT_STDIN], [1], [Mingw-specific setting - stdin])
AC_DEFINE([ALWAYS_ROOT], [1], [Can execute program as root - Mingw])
AC_DEFINE([FREECIV_MSWINDOWS], [1], [Windows build])
AC_DEFINE([NONBLOCKING_SOCKETS], [1], [nonblocking sockets support])
;;
*skyos*)
dnl SkyOS specific settings
AC_DEFINE([ALWAYS_ROOT], [1], [Can execute program as root - SkyOS])
;;
*haiku*)
dnl Haiku specific settings
AC_DEFINE([ALWAYS_ROOT], [1], [Can execute program as root - Haiku])
;;
*amigaos*)
AC_DEFINE([ALWAYS_ROOT], [1], [Can execute program as root - Amiga])
;;
esac
dnl Autoconf provides path separator for build system.
dnl Use that instead of our own guess in case of native build.
dnl Actually; Don't, since at least with autoconf-2.69 msys2 builds got wrong separator this way
dnl if test x$build = x$host ; then
dnl HOST_PATH_SEPARATOR=$PATH_SEPARATOR
dnl fi
AC_DEFINE_UNQUOTED([FREECIV_STORAGE_DIR], ["$FREECIV_STORAGE_DIR"], [Location for freeciv to store its information])
dnl note this has to match the path installed by translations/*/Makefile
if test x"$MINGW" != "xyes"; then
CPPFLAGS="$CPPFLAGS -DLOCALEDIR=\"\\\"$localedir\\\"\""
else
AC_DEFINE_UNQUOTED([LOCALEDIR], [".\\\\share\\\\locale"], [Locale directory (windows)])
fi
CPPFLAGS="$CPPFLAGS -DBINDIR=\"\\\"$bindir\\\"\""
COMMON_LIBS="${COMMON_LIBS} -lm"
if test "x$emscripten" != "xyes" ; then
dnl Check for zlib
AC_CHECK_LIB([z], [gzgets],
[AC_DEFINE([FREECIV_HAVE_LIBZ], [1], [zlib is available])
UTILITY_LIBS="${UTILITY_LIBS} -lz"
COMMON_LIBS="$COMMON_LIBS -lz"],
AC_MSG_ERROR([Could not find zlib library.]))
AC_CHECK_HEADER([zlib.h], [],
AC_MSG_ERROR([zlib found but not zlib.h.
You may need to install a zlib devel package.]))
else
CFLAGS="$CFLAGS -s USE_ZLIB=1"
CXXFLAGS="$CXXFLAGS -s USE_ZLIB=1"
fi
AC_PATH_PROG(GZIP, gzip, "no")
if test "$GZIP" = "no"; then
AC_MSG_ERROR([You need the gzip program for compilation.])
fi
dnl Check for bzip2 compression
AC_ARG_WITH([libbz2],
AS_HELP_STRING([--with-libbz2], [support bzip2 compressed files [if possible]]),
[WITH_BZ2="${withval}"],
[WITH_BZ2="test"])
if test "x$WITH_BZ2" != xno ; then
AC_CHECK_LIB([bz2], [BZ2_bzReadOpen],
[AC_CHECK_HEADERS([bzlib.h],
[AC_DEFINE([FREECIV_HAVE_LIBBZ2], [1], [libbzip2 is available])
UTILITY_LIBS="${UTILITY_LIBS} -lbz2"
libbz2_available=true])])
if test "x$libbz2_available" != "xtrue" ; then
if test "x$WITH_BZ2" = "xyes" ; then
AC_MSG_ERROR([Could not find libbz2 devel files])
fi
feature_bz2=missing
fi
fi
dnl Check for xz compression
AC_ARG_WITH([liblzma],
AS_HELP_STRING([--with-liblzma], [support xz compressed files [if possible]]),
[WITH_XZ="${withval}"],
[WITH_XZ="test"])
if test "x$WITH_XZ" != xno ; then
AC_CHECK_LIB([lzma], [lzma_code],
[AC_CHECK_HEADERS([lzma.h],
[AC_DEFINE([FREECIV_HAVE_LIBLZMA], [1], [liblzma is available])
UTILITY_LIBS="${UTILITY_LIBS} -llzma"
libxz_available=true])])
if test "x$libxz_available" != "xtrue" ; then
if test "x$WITH_XZ" = "xyes" ; then
AC_MSG_ERROR([Could not find liblzma devel files])
fi
feature_xz=missing
fi
fi
UTILITY_LIBS="${UTILITY_LIBS} ${LTLIBINTL}"
AC_SUBST([UTILITY_CFLAGS])
AC_SUBST([UTILITY_LIBS])
AC_SUBST([COMMON_LIBS])
AC_ARG_ENABLE([crosser],
AS_HELP_STRING([--enable-crosser], [build version to be used with crosser environment]),
[case "${enableval}" in
yes) crosser=yes
AC_DEFINE([CROSSER], [1], [this is crosser based build]) ;;
no) crosser=no ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-crosser]) ;;
esac], [crosser=no])
if test x$crosser = xyes && test x$MINGW != xyes ; then
AC_MSG_ERROR([--enable-crosser is Windows build specific option])
fi
AC_ARG_WITH([cacert-path],
AS_HELP_STRING([--with-cacert-path], [path to ca cert bundle]),
[case "${withval}" in
yes) AC_MSG_ERROR([Path must be given for --with-cacert-path]) ;;
*) custom_cacert_path="${withval}" ;;
esac])
if test "x$custom_cacert_path" != "x" ; then
AC_DEFINE_UNQUOTED([CUSTOM_CACERT_PATH], ["$custom_cacert_path"], [Path to CA cert bundle])
fi
AC_ARG_WITH([tinycthread],
AS_HELP_STRING([--with-tinycthread], [build and use tinycthread as thread implementation]),
[fctinycthr=${withval}], [fctinycthr=no])
AM_CONDITIONAL([TINYCTHREAD], [test "x$fctinycthr" = "xyes"])
dnl Check thread implementation
AC_MSG_CHECKING([for threads implementation])
thread_impl=none
CFLAGS_SAVE="${CFLAGS}"
LIBS_SAVE="${LIBS}"
if test "x$fctinycthr" = "xyes" ; then
AC_DEFINE([FREECIV_HAVE_TINYCTHR], [1], [Use tinycthread as thread implementation])
thread_impl=tinycthread
AC_DEFINE([FREECIV_HAVE_THREAD_COND], [1], [Has thread condition variable implementation])
thread_cond=true
TINYCTHR_LIBS="\$(top_builddir)/dependencies/tinycthread/libtinycthread.la"
AC_SUBST([TINYCTHR_LIBS])
AC_MSG_RESULT([tinycthread])
fi
if test "x$thread_impl" = "xnone" ; then
libs_save="$LIBS"
LIBS="$LIBS -lpthread"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <threads.h>]],
[[return thrd_create(NULL, NULL, NULL);]])],
[AC_DEFINE([FREECIV_HAVE_C11_THREADS], [1], [Use C11 threads as thread implementation])
thread_impl=c11
AC_MSG_RESULT([C11])
AC_DEFINE([FREECIV_HAVE_THREAD_COND], [1], [Has thread condition variable implementation])
thread_cond=true],
[LIBS="$libs_save"])
fi
if test x$crosser != xyes && test "x$thread_impl" = "xnone" ; then
FC_C_FLAGS([-pthread], [], [CFLAGS])
FC_LD_FLAGS([-pthread], [], [LIBS])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
[[return pthread_create(NULL, NULL, NULL, NULL);]])],
[AC_DEFINE([FREECIV_HAVE_PTHREAD], [1], [Use pthreads as thread implementation])
thread_impl=pthreads
AC_MSG_RESULT([pthreads])
AC_DEFINE([FREECIV_HAVE_THREAD_COND], [1], [Has thread condition variable implementation])])
thread_cond=true
fi
if test "x$thread_impl" = "xnone" ; then
CFLAGS="$CFLAGS_SAVE"
LDFLAGS="$LDFLAGS_SAVE"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <windows.h>]],
[[CreateThread(NULL, 0, NULL, NULL, 0, NULL);]])],
[AC_DEFINE([FREECIV_HAVE_WINTHREADS], [1], [Use Windows threads as thread implementation])
thread_impl=windows
AC_MSG_RESULT([windows])])
fi
if test "x$thread_impl" = "xnone" ; then
AC_MSG_ERROR([No usable thread implementation available])
fi
if test "x$thread_cond" != "xtrue" ; then
feature_thr_cond=missing
fi
AC_ARG_ENABLE([ai-static],
AS_HELP_STRING([--enable-ai-static], [statically link listed modules to server]),
[static_modules="${enableval}"],
[if test "x$thread_cond" = "xtrue" ; then
static_modules="classic,tex"
else
static_modules="classic"
fi])
ai_mod_static_classic=no
ai_mod_static_threaded=no
ai_mod_static_tex=no
ai_mod_static_stub=no
for module in $(echo $static_modules | $SED 's/,/ /g') ; do
if test "x$module" = "xclassic" ; then
ai_mod_static_classic=yes
ai_mod_default_needed=yes
AC_DEFINE([AI_MOD_STATIC_CLASSIC], [1],
[classic ai module statically linked])
elif test "x$module" = "xthreaded" ; then
ai_mod_static_threaded=yes
ai_mod_default_needed=yes
AC_DEFINE([AI_MOD_STATIC_THREADED], [1],
[threaded ai module statically linked])
elif test "x$module" = "xtex" ; then
ai_mod_static_tex=yes
ai_mod_default_needed=yes
AC_DEFINE([AI_MOD_STATIC_TEX], [1],
[experimental threads ai module statically linked])
elif test "x$module" = "xstub" ; then
ai_mod_static_stub=yes
AC_DEFINE([AI_MOD_STATIC_STUB], [1],
[stub ai module statically linked])
else
AC_MSG_ERROR([bad value ${module} for --enable-ai-static])
fi
if test "x$default_ai_set" = "x" ; then
dnl Make first static module default ai type
default_ai_set="${module}"
fi
done
AM_CONDITIONAL([AI_MOD_STATIC_CLASSIC],
[test "x$ai_mod_static_classic" = "xyes" || test "x$enable_aimodules" != "xyes"])
AM_CONDITIONAL([AI_MOD_STATIC_THREADED],
[test "x$ai_mod_static_threaded" = "xyes"])
AM_CONDITIONAL([AI_MOD_STATIC_TEX],
[test "x$ai_mod_static_tex" = "xyes"])
AM_CONDITIONAL([AI_MOD_STATIC_STUB],
[test "x$ai_mod_static_stub" = "xyes"])
AC_ARG_WITH([default-ai],
AS_HELP_STRING([--with-default-ai], [default ai type [first static]]),
[default_ai_set="${withval}"],
[])
AC_ARG_WITH([ai-lib],
AS_HELP_STRING([--with-ai-lib], [build in default AI code [if needed]]),
[ai_mod_default_needed=yes], [])
AM_CONDITIONAL([AI_MOD_DEFAULT_NEEDED],