forked from freeciv/freeciv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
2115 lines (1840 loc) · 69.2 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://redmine.freeciv.org/projects/freeciv],
[freeciv], [https://www.freeciv.org/])
AC_PREREQ(2.69)
if test "x$(pwd)" = "x$(cd $srcdir && pwd)" ; then
AC_MSG_ERROR([Attempted to configure source directory. You have to use separate build dir])
fi
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 gen_headers/liblua_config.h])
AC_CANONICAL_HOST
AC_USE_SYSTEM_EXTENSIONS
AC_C_BIGENDIAN
AC_SYS_LARGEFILE
dnl AC_SYS_YEAR2038() added in autoconf-2.73
m4_ifdef([AC_SYS_YEAR2038],
[AC_SYS_YEAR2038])
FC_EMSCRIPTEN
BUG_URL="$PACKAGE_BUGREPORT"
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_SUBST([BUG_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])
dnl Logical place for this would be m4/qt.m4, but autoupdate can't
dnl handle AC_ARG_VAR() outside configure.ac
AC_ARG_VAR([MOCCMD], [QT moc command (autodetected if not set)])
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])
dnl In practice, this matches the branch
AC_SUBST([MAIN_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([can we call malloc(0)], [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=yes], [fc_cv_malloc_zero_ok=no], [fc_cv_malloc_zero_ok=no])])
if test "x$fc_cv_malloc_zero_ok" = "xyes" ; then
AC_DEFINE([MALLOC_ZERO_OK], [1], [It's ok to call malloc() for zero bytes])
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
AC_ARG_ENABLE([fcmp],
AS_HELP_STRING([--enable-fcmp=no/yes/gtk3/gtk4/gtk4x/qt/cli/all/auto], [build freeciv-modpack-program [auto]]),
[fc_mp=${enableval}],
[if test "x$emscripten" = "xyes" ; then
fc_mp=no
else
fc_mp=auto
fi])
fcmp_cli=no
fcmp_gtk3=no
fcmp_gtk4=no
fcmp_gtk5=no
fcmp_qt=no
fcmp_list=
if test "x$fc_mp" != "xno" && test "x$emscripten" = "xyes" ; then
AC_MSG_ERROR([fcmp not supported with emscripten])
fi
if test "x$fc_mp" = "xcli" ; then
dnl Only cli requested -> no gui needed
modinst=cli
fi
for mp in $(echo $fc_mp | $SED 's/,/ /g') ; do
if test "x$mp" = "xno" ; then
modinst=no
elif test "x$mp" = "xauto" || test "x$mp" = "xyes" ; then
modinst=auto
elif test "x$mp" = "xall" ; then
modinst=all
elif test "x$mp" = "xgtk3" ||
test "x$mp" = "xgtk3.0" ||
test "x$mp" = "xgtk30" ||
test "x$mp" = "xgtk-3.0" ; then
req_fcmp_gtk3=yes
elif test "x$mp" = "xgtk4" ; then
req_fcmp_gtk4=yes
elif test "x$mp" = "xgtk4x" ; then
req_fcmp_gtk5=yes
elif test "x$mp" = "xqt" ; then
req_fcmp_qt=yes
elif test "x$mp" = "xcli" ; then
req_fcmp_cli=yes
elif test "x$mp" != "xyes" ; then
AC_MSG_ERROR([bad value ${mp} for --enable-fcmp])
fi
done
if test "x$modinst" != "xno" || test "x$fcdb_sqlite3" != "xno" ; then
dnl Not needed in in builds where both users - fcdb and fcmp - are disabled
FC_CHECK_SQLITE3([], [AC_MSG_ERROR([sqlite3 development files not found])])
fi
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)
ruledit_uuid=""
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"
ruledit_uuid="-luuid"
;;
*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}
if test "x$HOMEPAGE_URL" = "x" ; then
AC_MSG_ERROR([${project_definition} did not define HOMEPAGE_URL])
fi
AC_DEFINE_UNQUOTED([DEFAULT_SOCK_PORT], [$FREECIV_DEFAULT_PORT], [Connection TCP Port])
AC_DEFINE_UNQUOTED([FREECIV_JSON_PORT], [$FREECIV_JSON_PORT], [Json Connection TCP Port])
AC_DEFINE_UNQUOTED([FREECIV_META_URL], ["$META_URL"], [Metaserver URL])
AC_DEFINE_UNQUOTED([HOMEPAGE_URL], ["$HOMEPAGE_URL"], [Informational URL])
if test "x$MODPACK_LIST_URL" != "x" ; then
AC_DEFINE_UNQUOTED([MODPACK_LIST_URL], ["${MODPACK_LIST_URL}"], [Default modpack list URL])
fi
AC_SUBST([HOMEPAGE_URL])
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]
)
AC_ARG_WITH([iconv],
AS_HELP_STRING([--without-iconv], [disable check for iconv]),
[if test x$withval = xno ; then
iconv_disabled=true
fi])
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([metainfodir],
AS_HELP_STRING([--with-metainfodir], [install metainfo files to given dir]),
[ METAINFODIR=${withval} ], [ METAINFODIR="\$(prefix)/share/metainfo" ])
AC_SUBST([METAINFODIR])
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_3], [1],
[Development version save game compatibility - 3.3 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 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 extra arguments for the packet generator
AC_ARG_VAR([GENERATE_PACKETS_ARGS], [Additional arguments for the packet generator])
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.22/sdl2/qt/gtk4/gtk4x/stub],
[clients to compile [auto](list for multiple)]),
[clients=${enableval}],
[client=auto])
gui_gtk3_22=no
gui_gtk4=no
gui_gtk5=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.22" ; then
gui_gtk3_22=yes
elif test "x$gui" = "xgtk4" ; then
gui_gtk4=yes
elif test "x$gui" = "xgtk4x" ; then
gui_gtk5=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 zoom levels support on gtk-clients to user])],
[AC_DEFINE([EXP_ZOOM_LEVELS], [1], [Experimental zoom levels (other than 1.0 and 2.0)])])
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
dnl AC_PROG_AR() added in autoconf-2.72
m4_ifdef([AC_PROG_AR],
[AC_PROG_AR], [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.
if test "x$iconv_disabled" != "xtrue" ; then
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 https://gnu.org/, \
or try using --with-libiconv-prefix.])
fi
LIBS="$LIBS $LIBICONV"
fi
dnl I18n support
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_MIME_API], [libcurl > 7.56.0],
[UTILITY_CFLAGS="${UTILITY_CFLAGS} ${CURL_MIME_API_CFLAGS}"
UTILITY_LIBS="${UTILITY_LIBS} ${CURL_MIME_API_LIBS}"
AC_DEFINE([HAVE_CURL_MIME_API], [1], [libcurl has the mime api])],
[PKG_CHECK_MODULES([CURL], [libcurl >= 7.15.4],
[UTILITY_CFLAGS="${UTILITY_CFLAGS} ${CURL_CFLAGS}"
UTILITY_LIBS="${UTILITY_LIBS} ${CURL_LIBS}"],
[AC_MSG_ERROR([libcurl development files required])])])
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 not found. Adjusting PKG_CONFIG_PATH may help])])
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 Qt5 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([qtver],
AS_HELP_STRING([--with-qtver], [which Qt version to build against qt5/qt6/qt6x]),
[case "${withval}" in
qt5|Qt5) qt_ver="Qt5" ;;
qt6|Qt6) qt_ver="Qt6" ;;
qt6x|Qt6x) qt_ver="Qt6x" ;;
*) AC_MSG_ERROR([bad value ${enableval} for --with-qtver]) ;;
esac], [qt_ver="Qt6"])
if test "x$qt_ver" = "xQt5" ; then
AC_DEFINE([FC_QT5_MODE], [1], [this is Qt5 based build])
elif test "x$qt_ver" = "xQt6x" ; then
AC_DEFINE([FC_QT6X_MODE], [1], [this is build based on current Qt6 version])
fi
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
dnl Detect flags to be used in configure tests that should fail on warnings
WERROR_C_TEST_FLAGS=""
WERROR_CXX_TEST_FLAGS=""
FC_C_FLAGS([-Werror -Wall], [], [WERROR_C_TEST_FLAGS])
FC_CXX_FLAGS([-Werror -Wall], [], [WERROR_CXX_TEST_FLAGS])
FC_C99_VARIADIC_MACROS
FC_C99_VARIABLE_ARRAYS
FC_C99_INITIALIZERS
FC_C99_COMPOUND_LITERALS
FC_C99_STDINT_H
FC_C99_VA_COPY
FC_INITIALIZER_BRACES
FC_C11_STATIC_ASSERT
FC_C11_AT_QUICK_EXIT
FC_STATIC_STRLEN
FC_C23_NULLPTR
FC_CXX11_STATIC_ASSERT
FC_CXX11_NULLPTR
FC_CXX20_CAPTURE_THIS
_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $WERROR_C_TEST_FLAGS"
FC_SIZE_T_FORMAT
FC_BUILTIN_UNREACHABLE
CFLAGS="$_CFLAGS"
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="/"
if test "x$emscripten" = "xyes" ; then
AC_DEFINE([ALWAYS_ROOT], [1], [Can execute program as root - emscripten])
fi
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])
AC_ARG_WITH([localedir],
AS_HELP_STRING([--with-localedir], [directory where produced binaries will look locales from]),
[LOCALEDIR="${withval}"],
[LOCALEDIR=""])
dnl note this has to match the path installed by translations/*/Makefile
if test "x$LOCALEDIR" != "x" ; then
CPPFLAGS="$CPPFLAGS -DLOCALEDIR=\"\\\"$LOCALEDIR\\\"\""
elif 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
dnl Check for zstd compression
AC_ARG_WITH([libzstd],
AS_HELP_STRING([--with-libzstd], [support zstd compressed files [if possible]]),
[WITH_ZSTD="${withval}"],
[WITH_ZSTD="test"])
if test "x$WITH_ZSTD" != xno ; then
AC_CHECK_LIB([zstd], [ZSTD_compress],
[AC_CHECK_HEADERS([zstd.h],
[AC_DEFINE([FREECIV_HAVE_LIBZSTD], [1], [libzstd is available])
UTILITY_LIBS="${UTILITY_LIBS} -lzstd"
libzstd_available=true])])
if test "x$libzstd_available" != "xtrue" ; then
if test "x$WITH_ZSTD" = "xyes" ; then
AC_MSG_ERROR([Could not find libzstd devel files])
fi
feature_zstd=missing
fi
fi
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
dnl Has to be after compression libraries detection
FC_MAPIMG_MAGICKWAND
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])
AC_DEFINE([FREECIV_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 availability])
thread_impl_c=none
thread_impl_cpp=none
thr_libs_c11=""
thr_libs_pthread=""
CFLAGS_SAVE="${CFLAGS}"
LIBS_SAVE="${LIBS}"
if test "x$fctinycthr" = "xyes" ; then