-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathconfigure.ac
1653 lines (1379 loc) · 54.6 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 I would like to do this to generate the version number...
dnl AC_DEFUN([AUTOMATIC_VERSION],syscmd([sh batch/make/version .]))
dnl but have to do this with version generated in bootstrap.sh instead for some reason
m4_include(version.m4)
dnl Comment this out to disable autoconf custom directories:
m4_include(acinclude.d/accustomdir.m4)
m4_include(acinclude.d/ax_cxx_have_align.m4)
dnl Process this file with autoconf to produce a configure script.
AC_INIT(armagetronad,AUTOMATIC_VERSION)
dnl FIXME: remove this in the future, when automake decides to actually set datarootdir by default
dnl http://www.gnu.org/software/hello/manual/autoconf/Changed-Directory-Variables.html
AC_DEFUN([AC_DATAROOTDIR_CHECKED])
#set
#echo args : "$@"
#exit 1
dnl flag telling the status message whether some files will be installed outside of prefix
OUTSIDE_OF_PREFIX=no
dnl system type
AC_CANONICAL_TARGET
dnl those two are apparently included in AC_CANONICAL_TARGET
dnl AC_CANONICAL_BUILD
dnl AC_CANONICAL_HOST
AC_PROG_RANLIB
dnl use slighly less ancient tar format allowing slighlty longer filenames.
AM_INIT_AUTOMAKE([tar-ustar filename-length-max=255 subdir-objects])
dnl detect which link commant to use
AC_PROG_LN_S
dnl find a parser generator to useo
AC_PROG_YACC
test -r $srcdir/src/tools/values/vParser.cpp || AC_MSG_CHECKING(bison version)
test -r $srcdir/src/tools/values/vParser.cpp || ${YACC} --version | grep bison || AC_MSG_ERROR(GNU Bison is required to compile from source control.)
dnl check whether m4 is available for documentation processing
AC_CHECK_PROG(HAVE_M4,m4,true,false)
AM_CONDITIONAL(HAVE_M4, test $HAVE_M4 = true)
dnl dirty trick to allow verbatim output to Makefile.in -> Makefile
dnl source: http://gnu-automake.7480.n7.nabble.com/ifdef-endif-issue-td2662.html
AC_SUBST([protect], [""])
dnl export version
version=$VERSION
AC_SUBST(version)
AC_ARG_VAR(SDL_CONFIG,[Configuration script of SDL to use, defaults to sdl-config])
AC_ARG_VAR(SDL2_CONFIG,[Configuration script of SDL to use, defaults to sdl2-config])
AC_ARG_VAR(FREETYPE_CONFIG,[Configuration script of freetype to use, defaults to freetype-config])
source_date_epoch=SOURCE_DATE_EPOCH
test ${source_date_epoch} = SOURCE_DATE_EPOCH && source_date_epoch=${SOURCE_DATE_EPOCH:-`date +%s`}
AC_SUBST(source_date_epoch)
# determine date, following the epoch time if we can
date_iso=`date +%Y-%m-%d -d "@${source_date_epoch}" 2> /dev/null` || date_iso=`date +%Y-%m-%d` || exit $?
dnl echo date_iso=${date_iso}
AC_SUBST(date_iso)
dnl date -R does not have an easy format string replacement and is unsupported in BSD. We don't need it right now, though.
dnl date_rfc=`date -R -d "@${source_date_epoch}"` || exit $?
dnl echo date_rfc=${date_rfc}
dnl AC_SUBST(date_rfc)
AC_ARG_VAR(CXXFLAGS,Flags passed to the C++ compiler)
AC_ARG_VAR(DEBUGLEVEL,[Debug level for developers, normal users can safely ignore it. Accepted values go from 0 to 5. See README-DEVELOPER for details.])
AC_ARG_VAR(CODELEVEL,[Code checking strictness level for developers, normal users can safely ignore it. Accepted values go from 0 to 4. See README-DEVELOPER for details.])
AC_ARG_VAR(docstyle,[Documentation style for cross-building of documentation. Possible values: unix, web and windows.])
AC_ARG_VAR(progname,[Program short name, default: armagetronad.])
AC_ARG_VAR(progtitle,[Program long name, default: Armagetron Advanced.])
AC_ARG_VAR(APBUILD_CXX1,[Autopackage ABI 1 C++ compiler.])
AC_ARG_VAR(APBUILD_CXX2,[Autopackage ABI 2 C++ compiler.])
AC_ARG_VAR(APBUILD_CC,[Autopackage C compiler.])
AC_ARG_VAR(CXX_ABI,[Autopackage C++ ABI version.])
AC_ARG_VAR(APBUILD_STATIC,[Autopackage static libraries.])
AC_ARG_VAR(ARMAGETRONAD_OS_X_TOOLKIT, [Path to the OS X toolkit directory.])
dnl a modern autoconf is required to process this
AC_PREREQ(2.50)
PKG_PROG_PKG_CONFIG
build_regular=true
default_enable_sysinstall=yes
default_enable_uninstall=yes
enable_automakedefaults_actual_default=no
have_lzma=false
FTGL_CFLAGS=
FTGL_LIBS=
AC_ARG_WITH(maxclients, AC_HELP_STRING([--with-maxclients],[sets the hardcoded limit for the number of connected clients (default: 16 for clients and 32 for dedicated servers)]),
[
AC_DEFINE_UNQUOTED(MAXCLIENTS,${withval},maximal number of clients)
])
AC_ARG_ENABLE(dedicated,
AC_HELP_STRING([--enable-dedicated],
[enables dedicated server; otherwise, compile a client (default=disabled)]),
[case "${enableval}" in
yes) build_dedicated=true
build_regular=false
;;
no) build_dedicated=false
build_regular=true
;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-dedicated) ;;
esac],[build_dedicated=false])
AC_ARG_ENABLE(sdl2,
AC_HELP_STRING([--enable-sdl2],
[enables sdl2 support (default=enabled)]),
[case "${enableval}" in
yes) use_sdl2=true
;;
no) use_sdl2=false
;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-sdl2) ;;
esac],[use_sdl2=true])
AC_ARG_ENABLE(sdl1,
AC_HELP_STRING([--enable-sdl1],
[enables sdl1.X support (default=enabled)]),
[case "${enableval}" in
yes) use_sdl1=true
;;
no) use_sdl1=false
;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-sdl1) ;;
esac],[use_sdl1=true])
dnl AC_ARG_ENABLE(glout,
dnl [ --enable-glout enable graphical output; otherwise, compile
dnl a dedicated server (default=enabled)],,
dnl enable_glout=yes)
AC_ARG_ENABLE(master,
AC_HELP_STRING([--enable-master],
[Build the master server]),
[case "${enableval}" in
yes) armamaster=true ;;
no) armamaster=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-master) ;;
esac],[armamaster=false])
AM_CONDITIONAL(BUILDMASTER, test x$armamaster = xtrue)
AC_ARG_ENABLE(main,
AC_HELP_STRING([--enable-main],
[Build the main program]),
[case "${enableval}" in
yes) armamain=true ;;
no) armamain=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-main) ;;
esac],[armamain=true])
AC_ARG_ENABLE(glout,
AC_HELP_STRING([--enable-glout],
[Inverse alias of --enable-dedicated]),
[case "${enableval}" in
yes) build_dedicated=false
build_regular=true
;;
no) build_dedicated=true
build_regular=false
;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-glout) ;;
esac],)
# consistency check of the three build flags
test x$armamain = xfalse && build_dedicated=false build_regular=false
test x$build_dedicated = xfalse && test x$build_regular = xfalse && armamain=false
AM_CONDITIONAL(BUILDDEDICATED, test x$build_dedicated = xtrue)
AM_CONDITIONAL(BUILDREGULAR, test x$build_regular = xtrue)
AM_CONDITIONAL(BUILDMAIN, test x$armamain = xtrue)
# flag to set when mockup versions of the executables should be built to save
# compile time when testing the release process
AM_CONDITIONAL(BUILDFAKERELEASE, test "$ARMAGETRONAD_FAKERELEASE" != "" && test "$ARMAGETRONAD_FAKERELEASE" != "false" && test "$ARMAGETRONAD_FAKERELEASE" != "no")
# set replacement variables for dedicated server
progtitle_serverorclient=" Client"
progtitle_server=""
if test x$build_dedicated = xtrue; then
progtitle_serverorclient=" Server"
progtitle_server=" Server"
fi
AC_SUBST(progtitle_serverorclient)
AC_SUBST(progtitle_server)
AC_SUBST(build_dedicated)
AC_SUBST(build_regular)
AC_ARG_WITH([os-x-toolkit],
[AC_HELP_STRING([--with-os-x-toolkit@<:@=DIR@:>@],
[build using the OS X toolkit. See README-Subversion for more information.])],
[
if test "x$withval" != "xno"; then
if test "x$withval" != "xyes"; then
ARMAGETRONAD_OS_X_TOOLKIT="${withval}/libraries"
elif test -n "$ARMAGETRONAD_OS_X_TOOLKIT"; then
ARMAGETRONAD_OS_X_TOOLKIT="${ARMAGETRONAD_OS_X_TOOLKIT}/libraries"
fi
if test -z "${ARMAGETRONAD_OS_X_TOOLKIT}"; then
AC_MSG_ERROR([An OS X toolkit directory was not specified.])
fi
fi
],
[ARMAGETRONAD_OS_X_TOOLKIT=])
AM_CONDITIONAL([OS_X_TOOLKIT], test -n "${ARMAGETRONAD_OS_X_TOOLKIT}")
AC_ARG_WITH([os-x-arch],
[AC_HELP_STRING([--with-os-x-arch=ARCH],
[specifies which architecture to build for when using the OS X toolkit.])],
[
if test "x$withval" != "xno"; then
if test "x$withval" != "xyes"; then
os_x_arch="$withval"
else
AC_MSG_ERROR([An OS X arch was not specified.])
fi
fi
],
[os_x_arch=])
AC_ARG_WITH([os-x-sdk],
[AC_HELP_STRING([--with-os-x-sdk=DIR],
[specifies which SDK to use when using the OS X toolkit.])],
[
if test "x$withval" != "xno"; then
if test "x$withval" != "xyes"; then
os_x_sdk="$withval"
else
AC_MSG_ERROR([An OS X SDK was not specified.])
fi
fi
],
[os_x_sdk=])
AC_ARG_WITH([os-x-version-min],
[AC_HELP_STRING([--with-os-x-version-min=VERSION],
[specifies the deployment target to use when using the OS X toolkit.])],
[
if test "x$withval" != "xno"; then
if test "x$withval" != "xyes"; then
os_x_version_min="$withval"
else
AC_MSG_ERROR([An OS X deployment target was not specified.])
fi
fi
],
[os_x_version_min=])
if test -n "$ARMAGETRONAD_OS_X_TOOLKIT"; then
test -z "${os_x_arch}" && os_x_arch=`arch`
AC_SUBST(os_x_minimum_system_version, `$srcdir/batch/make/os-x-minimum-system-version $os_x_version_min`)
if test "x$build_regular" = "xtrue"; then
LDFLAGS="-F${ARMAGETRONAD_OS_X_TOOLKIT}/Frameworks -rpath ${ARMAGETRONAD_OS_X_TOOLKIT}/Frameworks $LDFLAGS"
CPPFLAGS="-I${ARMAGETRONAD_OS_X_TOOLKIT}/${os_x_arch}/include/AllFrameworks $CPPFLAGS"
FTGL_CFLAGS="-I${ARMAGETRONAD_OS_X_TOOLKIT}/${os_x_arch}/include/freetype2"
FTGL_LIBS="-lftgl -lfreetype -lbz2"
fi
CXXFLAGS="-arch ${os_x_arch} $CXXFLAGS"
if test -n "$os_x_sdk"; then
# We could also set the SDKROOT environment variable, instead of using xcrun.
XML2_CONFIG="xcrun --sdk $os_x_sdk xml2-config"
CXXFLAGS="-isysroot $os_x_sdk $CXXFLAGS"
fi
test -n "$os_x_version_min" && CXXFLAGS="-mmacosx-version-min=$os_x_version_min $CXXFLAGS"
LDFLAGS="$CXXFLAGS -L${ARMAGETRONAD_OS_X_TOOLKIT}/${os_x_arch}/lib $LDFLAGS"
CPPFLAGS="-isystem ${ARMAGETRONAD_OS_X_TOOLKIT}/${os_x_arch}/include $CPPFLAGS"
OBJCXXFLAGS="$CXXFLAGS $OBJCXXFLAGS"
OBJCPPFLAGS="$CPPFLAGS $OBJCPPFLAGS"
CFLAGS="$CPPFLAGS $CXXFLAGS $CFLAGS"
PATH="${ARMAGETRONAD_OS_X_TOOLKIT}/bin:$PATH"
PROTOC="${ARMAGETRONAD_OS_X_TOOLKIT}/${os_x_arch}/bin/protoc"
dnl TODO rename MACOSX_XCODE => OS_X_TOOLKIT
AC_DEFINE([MACOSX_XCODE], 1, [Define if compiling using the OS X toolkit.])
default_enable_sysinstall=no
default_enable_uninstall=no
enable_automakedefaults_actual_default=yes
fi
AC_ARG_ENABLE(memmanager,
AC_HELP_STRING([--enable-memmanager],
[enable custom memory manager on systems that allow it (default=disabled)]),,
enable_memmanager=no)
AC_ARG_ENABLE(sound,
AC_HELP_STRING([--enable-sound],
[compile in support for sound (default=enabled)]),,
enable_sound=yes)
AC_ARG_ENABLE(particles,
AC_HELP_STRING([--enable-particles],
[compile in support for experimental particle system (default=disabled)]),,
enable_particles=no)
if test x$enable_particles = xyes; then
AC_DEFINE(USEPARTICLES,,enables particle system)
fi
AC_ARG_ENABLE(joystick,
AC_HELP_STRING([--enable-joystick],
[enable joystick support (default=enabled)]),,
enable_joystick=yes)
AC_ARG_ENABLE(respawn,
AC_HELP_STRING([--enable-respawn],
[enable unsupported, hacky, impossible to deactivate at runtime, deathmatch mode. Use at your own risk. (default=disabled)]),,
enable_respawn=no)
AC_ARG_ENABLE(krawall,
AC_HELP_STRING([--enable-krawall],
[enable special visuals for the krawall gaming network (default=disabled)]),,
enable_krawall=no)
dnl start alias group
AC_ENABLE(armathentication,
[echo $enableval; case "${enableval}" in
yes) enable_armathentication=yes
;;
no) enable_armathentication=no
;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-armathentication) ;;
esac],enable_armathentication=yes
)
AC_ARG_ENABLE(zonesv1,
AC_HELP_STRING([--enable-zonesv1],
[enable deprecated zones v1 code (default=disabled)]),,
enable_zonesv1=no)
AC_ARG_ENABLE(zonesv2,
AC_HELP_STRING([--enable-zonesv2],
[enable experimental zonesv2 code (default=enabled)]),,
enable_zonesv2=yes)
AC_ARG_ENABLE(fortress,
AC_HELP_STRING([--enable-fortress],
[enable fortress support (default=enabled)]),,
enable_fortress=$enable_zonesv2)
AC_ARG_ENABLE(authentication,
AC_HELP_STRING([--enable-authentication],
[enable server side code for the krawall style user authentication (default=enabled)]),
[case "${enableval}" in
yes) enable_armathentication=yes
;;
no) enable_armathentication=no
;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-authentication) ;;
esac],
)
dnl end alias group
AC_ARG_ENABLE(automakedefaults,
AC_HELP_STRING([--enable-automakedefaults],
[enforce the default installation directories as set by automake. localstatedir=prefix/var violates the FHS, so this is off by default.]),,
enable_automakedefaults=$enable_automakedefaults_actual_default enable_automakedefaults_default=yes)
AC_ARG_ENABLE(useradd,
AC_HELP_STRING([--enable-useradd],
[will create a user during installation (default=enabled; requires --enable-sysinstall or a manual call of the sysinstall script)]),,
enable_useradd=yes enable_useradd_default=yes)
AC_SUBST(enable_useradd)
AC_ARG_ENABLE(etc,
AC_HELP_STRING([--enable-etc],
[will create links in /etc to the configuration files (default=enabled; requires --enable-sysinstall or a manual call of the sysinstall script)]),,
enable_etc=yes enable_etc_default=yes)
AC_SUBST(enable_etc)
AC_ARG_ENABLE(desktop,
AC_HELP_STRING([--enable-desktop],
[will try to integrate into your desktop environment via menu entries (default=enabled; requires --enable-sysinstall or a manual call of the sysinstall script)]),,
enable_desktop=yes)
AC_SUBST(enable_desktop)
AC_ARG_ENABLE(ruby,
AC_HELP_STRING([--enable-ruby],
[enable ruby scripting api. Requires ruby to be installed. (default=disabled)]),,
enable_ruby=no)
AC_SUBST(enable_ruby)
AM_CONDITIONAL(ENABLE_RUBY, test "x$enable_ruby" = "xyes")
initdir=location
AC_ARG_ENABLE(initscripts,
AC_HELP_STRING([--enable-initscripts=location],
[will install init scripts for the servers into <location>(default=enabled; requires --enable-sysinstall; <location> defaults to /etc/init.d or /etc/rc.d)]),
test "x${enableval}" = "xyes" || initdir=${enableval}
test "x${enableval}" = "xno" || enable_initscripts=yes,
enable_initscripts=yes enable_initscripts_default=yes
# disable initscripts if no server is beeing built
test x$build_dedicated = xfalse && test x$armamaster = xfalse && enable_initscripts=no
initdir=location)
AC_SUBST(enable_initscripts)
AC_ARG_ENABLE(restoreold,
AC_HELP_STRING([--enable-restoreold],
[will try to install links to previous installation on uninstallation in multiver mode (default=enabled; requires --enable-sysinstall or a manual call of the sysinstall script)]),,
enable_restoreold=yes)
AC_SUBST(enable_restoreold)
AC_ARG_ENABLE(uninstall,
AC_HELP_STRING([--enable-uninstall@<:@=cmd@:>@],
[will install an uninstaller script (default=enabled)]),
if test "$enableval" = "no"; then
enable_uninstall=no
else
enable_uninstall=yes
external_uninstall_cmd=$enableval
fi,
enable_uninstall=$default_enable_uninstall)
AC_SUBST(external_uninstall_cmd)
AM_CONDITIONAL(USE_UNINSTALL, test "$enable_uninstall" = "yes")
AC_ARG_ENABLE(multiver,
AC_HELP_STRING([--enable-multiver@<:@=slot@:>@],
[allow multiple versions to coexist by storing them in different directories (default=disabled)]),
if test "$enableval" = "no"; then
enable_multiver=no
else
enable_multiver=yes
multiver_slot="$enableval"
fi,
enable_multiver=no)
AC_ARG_ENABLE(games,
AC_HELP_STRING([--enable-games],
[decorates all installation paths with "games" (default=enabled)]),,
enable_games=yes)
AC_ARG_ENABLE(enginecoredebug,
AC_HELP_STRING([--enable-enginecoredebug],
[Apply debugging options to engine core (for DEBUGLEVEL>0, defaults to enabled)]),
[case "${enableval}" in
yes) enginecoredebug=true ;;
no) enginecoredebug=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-enginecoredebug) ;;
esac],[enginecoredebug=true])
AM_CONDITIONAL(ENGINECOREDEBUG, test x$enginecoredebug = xtrue)
if test x$enable_respawn = xyes; then
AC_DEFINE(RESPAWN_HACK,,enables hacky support for deathmatch mode)
fi
if test x$enable_krawall = xyes; then
AC_DEFINE(KRAWALL,,enables krawall)
fi
if test x$enable_armathentication = xyes; then
AC_DEFINE(KRAWALL_SERVER,,enables krawall server)
fi
if test x$enable_zonesv1 = xyes && test x$enable_fortress = xyes; then
AC_MSG_WARN([
Zones v2 Fortress is incompatible with Zones v1.
Therefore, Zones v1 will be disabled.
])
enable_zonesv1=no
fi
if test x$enable_zonesv1 = xyes; then
AC_DEFINE(ENABLE_ZONESV1,,enables zonesv1)
fi
AM_CONDITIONAL(BUILDZONESV1, test x$enable_zonesv1 = xyes)
if test x$enable_zonesv2 != xyes && test x$enable_fortress = xyes; then
AC_MSG_WARN([
Fortress requires support for zones.
Enabling zones support.
])
enable_zonesv2=yes
fi
if test x$enable_zonesv2 = xyes; then
AC_DEFINE(ENABLE_ZONESV2,,enables zonesv2)
fi
AM_CONDITIONAL(BUILDZONESV2, test x$enable_zonesv2 = xyes)
AM_CONDITIONAL(BUILD_FORTRESS, test x$enable_fortress = xyes)
dnl developer CXXFLAGS
test -z "$DEBUGLEVEL" && DEBUGLEVEL=0
test -z "$CODELEVEL" && CODELEVEL=0
dnl default CXX flags: optimize a bit if no optimization optimization has been selected yet
test -z "`echo $CXXFLAGS | grep "\-O"`" && CXXFLAGS="$CXXFLAGS -O2"
test $DEBUGLEVEL -ge 1 && CXXFLAGS="`echo $CXXFLAGS | sed -e 's,-O.,,'` -g -O0"
test $DEBUGLEVEL -ge 2 && CXXFLAGS="$CXXFLAGS -DDEBUG"
dnl test $DEBUGLEVEL -ge 3 && enable_memmanager=yes CXXFLAGS="$CXXFLAGS -DNO_MALLOC_REPLACEMENT"
test $DEBUGLEVEL -ge 4 && CXXFLAGS="$CXXFLAGS -DDEBUG_EXPENSIVE"
test $DEBUGLEVEL -ge 5 && CXXFLAGS="$CXXFLAGS -DMEM_DEB"
dnl oddly, this macro needs to be called once unconditionally, or automake borks up.
dnl pick C++14 standard if we can
AX_CXXFLAGS_GCC_OPTION(-std=c++17)
if test -z "`echo $CXXFLAGS | grep "\-std="`"; then
dnl fallback; our own code should maybe still work with older standards, it is just current protobuf that requires C++ 17
AX_CXXFLAGS_GCC_OPTION(-std=c++14)
if test -z "`echo $CXXFLAGS | grep "\-std="`"; then
dnl still nothing? Last try, our own code relies on this standard.
AX_CXXFLAGS_GCC_OPTION(-std=c++11)
if test -z "`echo $CXXFLAGS | grep "\-std="`"; then
dnl last call: pre-c++11 standard. Works on mingw, so why not here?
AX_CXXFLAGS_GCC_OPTION(-std=c++0x)
fi
fi
fi
dnl
dnl dnl maybe it is the future and c++11 is deprecated? C++14 should work, too
dnl AX_CXXFLAGS_GCC_OPTION(-std=c++14z,[],[],[
dnl dnl still nothing? Maybe this one:
dnl AX_CXXFLAGS_GCC_OPTION(-std=c++17z,[],[],[
dnl dnl last call: pre-c++11 standard. Works on mingw, so why not here?
dnl AX_CXXFLAGS_GCC_OPTION(-std=c++0x)
dnl ])
dnl ])
dnl])
if test $CODELEVEL -ge 1; then
CXXFLAGS="$CXXFLAGS -Wall"
dnl careful, only supported on GCC 4.2 and later
AX_CXXFLAGS_GCC_OPTION(-Wno-strict-overflow)
if test $DEBUGLEVEL -lt 1; then
dnl false positive warnings for this on boost
AX_CXXFLAGS_GCC_OPTION(-Wno-error=maybe-uninitialized)
fi
dnl this one is from GCC 7 (change to 1 or 2 in the future,
dnl leave at default and use [[fallthrough]] (std C++ 17)
dnl we're using both here; hopefully, old compilers ignore the [[fallthrough]].
AX_CXXFLAGS_GCC_OPTION(-Wimplicit-fallthrough=1)
dnl Well, they don't, GCC 5.7 warns about them; silence it.
AX_CXXFLAGS_GCC_OPTION(-Wno-attributes)
dnl some data structures have members only used in client code, it would be too ugly to remove them
dnl on the dedicated server. Silence "unused private field" warnings.
if test x$build_dedicated = xtrue; then
AX_CXXFLAGS_GCC_OPTION(-Wno-unused-private-field)
fi
fi
dnl test $CODELEVEL -ge 2 && CXXFLAGS="$CXXFLAGS -Wshadow -Wpointer-arith -Wfloat-equal -W -Wcast-qual -Wcast-align -Wconversion -Wunreachable-code --pedantic -Winline"
test $CODELEVEL -ge 2 && CXXFLAGS="$CXXFLAGS -Wpointer-arith -W -Wcast-qual -Wcast-align --pedantic -Wno-unused-parameter -Wno-long-long"
test $CODELEVEL -ge 3 && CXXFLAGS="$CXXFLAGS -Weffc++ -Wshadow -Winline -Wfloat-equal -Wconversion"
test $CODELEVEL -ge 4 && CXXFLAGS="$CXXFLAGS -Werror"
# unused things of any kind are expected in debug or dedicated mode
if test x$build_dedicated = xtrue || test $DEBUGLEVEL -ge 1; then
AX_CXXFLAGS_GCC_OPTION(-Wno-unused-but-set-variable)
AX_CXXFLAGS_GCC_OPTION(-Wno-unused-variable)
AX_CXXFLAGS_GCC_OPTION(-Wno-unused-private-field)
AX_CXXFLAGS_GCC_OPTION(-Wno-unused-function)
fi
dnl Strip pedantic flags from general CXXFLAGS and put them into a separate variable
CXXFLAGS_OURFILES=''
if echo ${CXXFLAGS} | grep -- '-Werror[^=]' > /dev/null; then
CXXFLAGS_OURFILES="${CXXFLAGS_OURFILES} -Werror"
fi
if echo ${CXXFLAGS} | grep -- '--pedantic' > /dev/null; then
CXXFLAGS_OURFILES="${CXXFLAGS_OURFILES} --pedantic"
fi
CXXFLAGS="`echo ${CXXFLAGS} | sed -e 's,-Werror[^=],,g' | sed -e 's,--pedantic,,g'`"
dnl CXX flags for our own hand-written files. Can be pedantic.
AC_SUBST(CXXFLAGS_OURFILES)
dnl determine whether "games" should be put into paths: not if it was
dnl requested with --disable-games or if "games" is already included
dnl in the data path
games_suffix_data=/
games_suffix_doc=/
games_suffix_config=/
games_suffix_var=/
if test "${enable_games}" = "yes"; then
test -z "`echo ${datadir} | grep games`" && games_suffix_data=/games/
test -z "`echo ${prefix} | grep games`" && games_suffix_doc=/games/
test -z "`echo ${sysconfdir} | grep games`" && games_suffix_config=/games/
test -z "`echo ${localstatedir} | grep games`" && games_suffix_var=/games/
fi
AC_SUBST(games_suffix_data)
AC_SUBST(games_suffix_config)
AC_SUBST(games_suffix_doc)
AC_SUBST(games_suffix_var)
dnl determine memmanager state
dnl if test x$enable_memmanager != xyes ; then
AC_DEFINE(DONTUSEMEMMANAGER)
dnl fi
dnl LibTool configuration
dnl AC_LIBTOOL_DLOPEN
dnl AM_PROG_LIBTOOL
dnl Header file
AC_CONFIG_HEADER(aa_config.h)
dnl Checks for programs.
dnl C Compiler:
AC_PROG_CC
AC_PROG_CPP
dnl C++ Compiler:
AC_PROG_CXX
AC_PROG_CXXCPP
dnl AC_OBJEXT
if test -n "$ARMAGETRONAD_OS_X_TOOLKIT"; then
AC_PROG_OBJCXX
AC_PROG_OBJCXXCPP
else
am__fastdepOBJCXX_TRUE=
am__fastdepOBJCXX_FALSE='#'
fi
dnl Make:
dnl AC_PROG_MAKE_SET
AC_CHECK_PROG(HAVE_GMAKE, gmake, yes, no)
if test ${HAVE_GMAKE} = no && make --version | head -n 1 | grep -v "GNU make" 2>&1 /dev/null; then
AC_MSG_ERROR([GNU make (gmake) is currently required for compilation.])
fi
AC_CHECK_PROG(HAVE_BASH, bash, yes, no)
if test ${HAVE_BASH} = no; then
AC_MSG_ERROR([GNU Bourne-Again SHell (bash) is currently required for compilation.])
fi
dnl Boost
AX_BOOST_BASE([1.33.1])
dnl Ruby
AC_ARG_WITH(ruby,
AC_HELP_STRING([--with-ruby],
[The ruby to use]),
if test ! -z "${withval}"; then
RUBY="${withval}"
fi
)
dnl glew
have_glew=true
AC_ARG_WITH(glew,
AC_HELP_STRING([--with-glew],
[Use GLEW and the OpenGL extensions it provides]),
test "${withval}" == "yes" || have_glew=false
)
dnl
dnl testing a nifty make feature: silent inclu[]des
AC_SINCLUDE
dnl determine the program name and title
if test "x$progtitle" = "x" ; then
progtitle="Armagetron Advanced"
fi
if test "x$progname" = "x" ; then
progname=armagetronad
fi
prognamebase=$progname
AC_SUBST(progtitle)
AC_SUBST(progname)
AC_SUBST(prognamebase)
if test -n "$ARMAGETRONAD_OS_X_TOOLKIT"; then
if test "x$build_regular" = "xtrue"; then
prefix="`pwd`/${progtitle}.app/Contents/Resources"
AC_DEFINE_UNQUOTED([USER_DATA_DIR], ["~/Library/Application Support/${progtitle}"], [TODO document])
AC_DEFINE_UNQUOTED([SCREENSHOT_DIR], ["~/Library/Application Support/${progtitle}/screenshots"], [TODO document])
else
prefix="`pwd`/${progtitle} Dedicated"
AC_DEFINE_UNQUOTED([USER_DATA_DIR], ["~/Library/Application Support/${progtitle} Dedicated"], [TODO document])
fi
fi
AM_CONDITIONAL(ALLOW_MULTIPLE_VERSIONS, test "$enable_multiver" = "yes")
AC_SUBST(enable_multiver)
if test "$enable_multiver" = "yes"; then
if test "$multiver_slot" = "yes"; then
multiver_slot="$PACKAGE_VERSION"
fi
progdir_suffix="-$multiver_slot"
executable_suffix="-$multiver_slot"
else
progdir_suffix=""
executable_suffix=""
fi
AC_SUBST(progdir_suffix)
AC_SUBST(executable_suffix)
dnl AC_DEFINE(PROGDIR_SUFFIX,\"$progdir_suffix\",[Define to the suffix of all installation folders])
AC_DEFINE_UNQUOTED(PROGDIR_SUFFIX,"${progdir_suffix}",[Define to the suffix of all installation folders])
dnl type checks
AC_CHECK_TYPE(socklen_t,AC_DEFINE(HAVE_SOCKLEN_T, 1, [Define if you have the type socklen_t.]),,[#include <sys/types.h>
#include <sys/socket.h>])
# tells the makefile if the data files need to be installed
needdata=yes
AC_SUBST(needdata)
test "$docstyle" = "" && docstyle=unix
# find good default of init script directory
initdirdefault=/etc/init.d
for candidate in /etc/rc.d /etc/init.d; do
test -d ${candidate} && initdirdefault=${candidate}
done
# configuration for various unix flavours
define(GENERICUNIX,[
MATHLIB="m"
if test x$build_regular = xtrue; then
AC_PATH_X
AC_PATH_XTRA
fi
if test x$have_x = xyes; then
CFLAGS="$CFLAGS $X_CFLAGS"
CXXFLAGS="$CXXFLAGS $X_CFLAGS"
LIBS="$X_LIBS $LIBS"
SYS_GL_LIB="GL"
SYS_GLU_LIB="GLU"
else
SYS_GL_LIB="GL"
SYS_GLU_LIB="GLU"
fi
]
)
define(SAFEUNIX,[
AC_DEFINE(DONTUSEMEMMANAGER, 1, [Define if you dont want to use a custom memory manager.])
GENERICUNIX
]
)
SDL2_CONFIG_DEFAULT=sdl2-config
SDL_CONFIG_DEFAULT=sdl-config
macosx=false
OBJC="not_needed_on_this_platform"
dnl *************************************************
dnl GL AND MATHLIB SELECTION ( SYSTEM DEPENDANT)
dnl *************************************************
case "$target" in
*-*-cygwin* | *-*-mingw32*)
AC_DEFINE(WIN32, 1, [Windows 9x/NT/2k/XP])
MATHLIB=""
SYS_GL_LIB="opengl32"
SYS_GLU_LIB="glu32"
LIBS="$LIBS -lwsock32"
CFLAGS="$CFLAGS -DNO_SOCKLEN_T"
;;
*-*-beos*)
AC_DEFINE(BEOS, 1, [BeOS])
MATHLIB=""
SYS_GL_LIB="GL"
SYS_GLU_LIB="GLU"
;;
*-*-darwin*)
AC_DEFINE(MACOSX, 1, [Mac OS X])
MATHLIB=""
SYS_GL_LIB=""
SYS_GLU_LIB=""
test x$build_regular = xfalse || LIBS="$LIBS -framework OpenGL -framework CoreFoundation -framework CoreServices"
CXXFLAGS="${CXXFLAGS} -DGL_SILENCE_DEPRECATION"
unset OBJC
macosx=true
default_enable_sysinstall=false
;;
*-*-aix*)
AC_DEFINE(AIX, 1, [AIX])
MATHLIB=""
if test x$ac_cv_prog_gcc = xyes; then
CXXFLAGS="$CXXFLAGS -mthreads"
fi
SYS_GL_LIB=""
SYS_GLU_LIB=""
;;
*-*-solaris*)
AC_DEFINE(SOLARIS, 1, [Solaris])
AC_DEFINE(CAUTION_WALL, 1, [Define if your system deos not like the pointer tricks in eWall.h.])
LIBS="$LIBS -lnsl -lsocket"
SAFEUNIX
;;
*-*-linux* )
AC_DEFINE(LINUX, 1, [GNU/Linux])
GENERICUNIX
;;
*-*-openbsd* )
# OpenBSD, almost like generic Unix, but needs different init script handling
initdirdefault=OpenBSD
SAFEUNIX
;;
*)
# generic unix
SAFEUNIX
;;
esac
dnl Objective C:
AC_PROG_OBJC
test -z "$SDL_CONFIG" && SDL_CONFIG=$SDL_CONFIG_DEFAULT
test -z "$SDL2_CONFIG" && SDL2_CONFIG=$SDL2_CONFIG_DEFAULT
AM_CONDITIONAL(MACOSX, test x$macosx = xtrue)
AC_SUBST(docstyle)
#processor specific setup
case "$target" in
i*86-*-*)
;;
x86_64-*-*)
;;
sparc-*-*)
;;
*)
#disable memory manager; it may depend on processor features
AC_DEFINE(DONTUSEMEMMANAGER)
;;
esac
AC_ARG_ENABLE(sysinstall,
AC_HELP_STRING([--enable-sysinstall],
[will install configuration files to /etc/armagetron and create a user if possible (default=enabled)]),,
enable_sysinstall=$default_enable_sysinstall)
AM_CONDITIONAL(USE_SYSINSTALL, test "$enable_sysinstall" = "yes")
AC_CACHE_SAVE
dnl *************************************************
dnl libxml2
dnl *************************************************
if test x$armamain = xtrue; then
PKG_CHECK_MODULES([XML2], [libxml-2.0 >= 2.6.11])
CPPFLAGS="$CPPFLAGS $XML2_CFLAGS"
LIBS="$LIBS $XML2_LIBS"
AC_DEFINE(HAVE_LIBXML2, 1, [Define if you have the libxml2 library])
dnl *************************************************
dnl Threading
dnl *************************************************
AC_LANG([C++])
AX_BOOST_SYSTEM()
AX_BOOST_THREAD()
dnl if boost-thread is unavailable, make do with pthread
if test "x$BOOST_THREAD_LIB" = x; then
ACX_PTHREAD([
LIBS="${PTHREAD_LIBS} ${LIBS}"
CXXFLAGS="${CXXFLAGS} ${PTHREAD_CFLAGS}"
CC="${PTHREAD_CC}"
AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.])
],
AC_MSG_ERROR([You need boost::thread or pthread to compile ${progtitle}.])
)
fi
dnl *************************************************
dnl Misc
dnl *************************************************
AC_CHECK_HEADERS([sys/stat.h])
dnl *************************************************
dnl protocol buffers
dnl *************************************************
dnl check for compiler
AC_CHECK_PROG([PROTOC],protoc,`which protoc`,no)
if test x$PROTOC = xno
then
AC_MSG_ERROR([[The protobuf C++ compiler(Google Protocol Buffers, http://code.google.com/p/protobuf/) is required, but was not found.]])
fi
AC_LANG([C++])
dnl check for library with PKG_CONFIG
PKG_CHECK_MODULES(PROTOBUF, protobuf >= 2.4.0,,
# the old detection, not sure if we still need this
[AC_CHECK_LIB([protobuf],_ZN6google8protobuf14FatalExceptionD2Ev,,
[AC_CHECK_LIB([protobuf],_ZN6google8protobuf7ClosureD2Ev,
AC_MSG_WARN([[The library protobuf (Google Protobuf Buffers) has a broken dependency on library pthread on your system.]])
AC_DEFINE_UNQUOTED(HAVE_LIBPROTOBUF)
LIBS="-lprotobuf -lpthread $LIBS"
,
AC_MSG_ERROR([[The library protobuf (Google Protocol Buffers, http://code.google.com/p/protobuf/) is required, but was not found.]])
,[-lpthread]
)]
)]
)
# just adding all flags would work, but on macOS with brew, there are
# a ton of duplicate flags that would slow the compilation output down.
# Only add each option once.
for flag in ${PROTOBUF_CFLAGS}; do
if [[[ "${CXXFLAGS}" != *"${flag}"* ]]]; then
# echo ${flag}
CPPFLAGS="${flag} ${CPPFLAGS}"
fi
done
AC_LANG([C++])
dnl check for header
AC_CHECK_HEADERS([google/protobuf/message.h],,
AC_MSG_ERROR([[The header for protobuf (Google Protocol Buffers, http://code.google.com/p/protobuf/) is required with all development files, but was not found.]])
)
dnl AC_LANG([C])
fi # armamain
dnl *************************************************
dnl timer
dnl *************************************************
dnl just do the checks here, the logic for evaluating it can go into tSysTime.cpp.
AC_CHECK_HEADERS([time.h])
AC_CHECK_LIB([rt],[clock_gettime])
dnl *************************************************
dnl math
dnl *************************************************
if test $MATHLIB ; then
AC_CHECK_LIB($MATHLIB, exp,,
AC_MSG_WARN([
You do not have the standard math library libm. Check
config.log for error messages and fix that.]
)
)
fi
if test x$build_regular = xfalse; then
AC_MSG_RESULT([
Configuring dedicated server, skipping libraries...
])
dnl ****************************************************
dnl Put stuff needed for the dedicated server here
dnl ****************************************************
AC_DEFINE(DEDICATED,,[Define if you wish to compile a dedicated server])
AC_DEFINE(NOJOYSTICK,,[No joysticks in the dedicated server])
enable_sound=no
progname=${prognamebase}-dedicated
AC_SUBST(progname)
needdata=no
AC_SUBST(needdata)
else