-
Notifications
You must be signed in to change notification settings - Fork 85
/
configure.ac
1147 lines (1009 loc) · 34.3 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 C O N F I G U R E . A C
dnl BZFlag
dnl Copyright (c) 1993-2023 Tim Riker
dnl
dnl This package is free software; you can redistribute it and/or
dnl modify it under the terms of the license found in the file
dnl named COPYING that should have accompanied this file.
dnl
dnl THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
dnl IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
dnl WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
dnl
dnl ******************************************************************
dnl *** BZFlag's configure.ac ***
dnl ******************************************************************
dnl
dnl Herein lies the venerable GNU build system configure template for
dnl BZFlag. As best is reasonably possible, proper ordering and
dnl separation of tests and settings should be maintained per the
dnl recommended standard layout. The tests should be added to the
dnl rather clearly labeled sections below so that they are as
dnl follows:
dnl
dnl 0) information on the package
dnl 1) check command-line arguments
dnl 2) check programs
dnl 3) check libraries
dnl 4) check headers
dnl 5) check types/structures
dnl 6) check compiler characteristics
dnl 7) check functions
dnl 8) check system services
dnl 9) output a summary
dnl
dnl You should use enable/disable arguments for build settings and
dnl optional compilation components that are part of this package.
dnl You specify with/without arguments for components that are not a
dnl part of this package.
dnl
dnl TODO: This mess (still) needs serious cleaning up.
dnl
dnl Minimum version of autoconf required. Should coincide with the
dnl setting in the autogen.sh script.
AC_PREREQ([2.68])
AC_INIT([BZFlag],[2.4.27],[http://BZFlag.org/],[bzflag])
AC_CONFIG_SRCDIR(src/bzflag/bzflag.cxx)
AC_CONFIG_MACRO_DIR([m4])
# When --libdir has not been used put plugins in bzflag's own directory.
if test "x$libdir" = 'x${exec_prefix}/lib' ; then
libdir="$libdir/bzflag"
fi
AC_CONFIG_AUX_DIR(misc)
CONF_DATE=`date -u +%Y-%m-%d`
# https://reproducible-builds.org/specs/source-date-epoch/
if test -z "$SOURCE_DATE_EPOCH"; then
BUILD_DATE=$CONF_DATE
else
# accept any numeric value
if expr 0 + "$SOURCE_DATE_EPOCH" > /dev/null ; then
BUILD_DATE=`date -u -d "@$SOURCE_DATE_EPOCH" +%Y-%m-%d 2> /dev/null`
# try using perl if the date command fails
if test -z "$BUILD_DATE"; then
BUILD_DATE=`perl -le "use POSIX; print strftime '%Y-%m-%d', gmtime '$SOURCE_DATE_EPOCH'"`
fi
else
AC_MSG_ERROR([Invalid SOURCE_DATE_EPOCH value])
fi
fi
case "$BUILD_DATE" in
# double square brackets because of m4
[[0-9]][[0-9]][[0-9]][[0-9]]-[[01]][[0-9]]-[[0-3]][[0-9]])
# looks like YYYY-MM-DD
;;
*)
AC_MSG_ERROR([Failed to set BUILD_DATE])
;;
esac
# print out the title with a pretty box computed to wrap around
title="Configuring $PACKAGE_STRING on $CONF_DATE"
length="`echo x${title}x | wc -c`"
separator=""
while test $length -gt 1 ; do
separator="${separator}*"
length="`expr $length - 1`"
done
BZ_BOLD
AC_MSG_RESULT([***${separator}***])
AC_MSG_RESULT([*** ${title} ***])
AC_MSG_RESULT([***${separator}***])
BZ_UNBOLD
AC_CANONICAL_TARGET
dnl Minimum version of automake required. Should coincide with the
dnl setting in the autogen.sh script. Create the other archives
dnl automatically when doing a make dist for convenience.
AM_INIT_AUTOMAKE([1.6 dist-zip dist-bzip2 subdir-objects])
dnl all configured definitions get written here
AC_CONFIG_HEADERS([include/config.h])
AC_SUBST(PACKAGE_STRING)
AC_SUBST(BUILD_DATE)
AC_DEFINE_UNQUOTED(BUILD_DATE, "$BUILD_DATE", [BZFlag build date])
# Let the C++ code know about OS
AC_DEFINE_UNQUOTED(BZ_BUILD_OS, "$host_os", [BZFlag System Environment])
# automatically enable and load our configure cache file if available
BZ_CONFIG_CACHE([config.cache.${host_os}.${ac_hostname}])
dnl ***********************
dnl *** Check arguments ***
dnl ***********************
BZ_CONFIGURE_STAGE([arguments], [1 of 9])
# provide a with-curses option, test for curses
MP_WITH_CURSES
# build the server?
AC_ARG_ENABLE(server, AS_HELP_STRING([--disable-server],[do not compile server]))
# check whether plugins are desired
AC_ARG_ENABLE(plugins, AS_HELP_STRING([--disable-plugins],[do not compile plugins]))
if test "x$enable_plugins" != xno ; then
if test "x$enable_server" != xno ; then
AC_DEFINE(BZ_PLUGINS, 1, [Enable plugins])
else
enable_plugins=no
AC_MSG_WARN([skipping plugins for client-only build])
fi
fi
AM_CONDITIONAL(BUILD_PLUGINS, test "x$enable_plugins" != "xno")
# accept a list of custom plugins to be built
AC_ARG_ENABLE(custom-plugins, AS_HELP_STRING([--enable-custom-plugins=plugin1[[[,plugin2,...]]]],[comma separated list of custom plugins to be built]),[
CUSTOM_PLUGIN_LIST=`echo $enableval | sed 's/,/ /g'`
for plugin in $CUSTOM_PLUGIN_LIST ; do
m1=plugins/$plugin/Makefile
AC_CONFIG_FILES([$m1])
(cd $srcdir && automake --no-force $m1)
done])
# accept a file containing the custom plugins to be built
AC_ARG_ENABLE(custom-plugins-file, AS_HELP_STRING([--enable-custom-plugins-file=filename],[file of custom plugins to be built, one name per line]),[
for plugin in `sed '/^#/d' $enableval` ; do
m2=plugins/$plugin/Makefile
AC_CONFIG_FILES([$m2])
(cd $srcdir && automake --no-force $m2)
CUSTOM_PLUGIN_LIST="$CUSTOM_PLUGIN_LIST $plugin"
done])
AC_SUBST(CUSTOM_PLUGIN_LIST)
# check whether threads are desired
AC_ARG_ENABLE(threads, [ --disable-threads build without threading])
# do we want bzadmin?
AC_ARG_ENABLE(bzadmin, [ --disable-bzadmin do not build text client])
AC_ARG_ENABLE(robots, [ --disable-robots disable robots])
if test x$enable_robots != xno; then
AC_DEFINE(ROBOT, 1, [Enabling Robots])
fi
# debugging and profiling
AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging])
AC_ARG_ENABLE(profiling, [ --enable-profiling turn on profiling])
# profiling requires debugging
if test x$enable_profiling = xyes; then
enable_debug=yes
fi
if test x$enable_debug = xyes; then
AC_DEFINE(DEBUG, 1, [Debugging])
AC_DEFINE(DEBUG_RENDERING, 1, [Debug Rendering])
user_CFLAGS="$ac_save_CFLAGS"
user_CXXFLAGS="$CXXFLAGS" # ac_save_CXXFLAGS is not set yet
fi
# do we want the bzflag client?
AC_ARG_ENABLE(client, [ --disable-client server-only build])
# enable UPnP for server
AC_ARG_ENABLE(UPnP, [ --enable-UPnP Use UPnP for server],
, [enable_UPnP=no])
dnl **************************
dnl *** Check for programs ***
dnl **************************
BZ_CONFIGURE_STAGE([programs], [2 of 9])
# cannot override LD directly, so warn (configure will override it)
if test "x$LD" != "x" ; then
AC_MSG_WARN([LD cannot be set directly yet it seems to be set ($LD)])
fi
#Checks for programs.
AC_PROG_CXX
if test -z "$CXX"; then
AC_MSG_ERROR([A c++ compiler is required to build BZFlag])
fi
AX_CXX_COMPILE_STDCXX_11([noext],[mandatory])
AC_PROG_CC
AC_PROG_LN_S
AC_CHECK_PROG(AR, ar, ar)
AC_SUBST(AR)
AC_SUBST(AR_FLAGS)
# Enable Objective-C compilations for OS X
case $host_os in
darwin*)
AC_PROG_OBJC
;;
*)
AM_CONDITIONAL(am__fastdepOBJC, false)
;;
esac
AC_PATH_PROG(CCACHE, ccache)
if test "$CCACHE" ; then
CC="ccache $CC"
CXX="ccache $CXX"
fi
AC_CHECK_TOOL(WINDRES, windres, :)
# libtool shouldn't be generated until after LD is set.
LT_INIT([dlopen])
AC_SUBST(LIBTOOL_DEPS)
# quell the verbosity
LIBTOOLFLAGS=--silent
AC_SUBST(LIBTOOLFLAGS)
if test "x$LIBTOOL" != "x" ; then
LIBTOOL="$LIBTOOL --silent"
fi
AC_CHECK_PROG(HASPOD2MAN, pod2man, yes, no)
if test $HASPOD2MAN = no; then
AC_MSG_WARN([some man pages will not be generated])
fi
AM_CONDITIONAL(HASPOD2MAN, test $HASPOD2MAN = yes)
dnl ***************************
dnl *** Check for libraries ***
dnl ***************************
BZ_CONFIGURE_STAGE([libraries], [3 of 9])
AC_LANG(C++)
dnl explicitly link with the dl library when available
AC_CHECK_LIB(dl, dlopen, LIBDL="-ldl", LIBDL="")
AC_SUBST(LIBDL)
dnl detect a usable system zlib compression library
AC_CHECK_LIB(z, compressBound, LIBZ="-lz", AC_MSG_ERROR([working zlib was not found]))
AC_SUBST(LIBZ)
dnl detect a usable system c-ares lookup library
AC_CHECK_LIB(cares, ares_init, LIBCARES="-lcares", AC_MSG_ERROR([working c-ares was not found]))
AC_SUBST(LIBCARES)
# see if our c-ares callbacks match (they won't on c-ares <1.5)
AC_MSG_CHECKING(for c-ares DNS lookup functionality)
PRELIBS="$LIBS"
LIBS="$LIBS $LIBCARES"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
#include <ares.h>
void callback(void * /*arg*/, int /*callbackStatus*/,
int /*timeouts*/, struct hostent * /*hostent*/) {}
]], [[
ares_channel aresChannel;
in_addr requestedAddress;
ares_gethostbyaddr(aresChannel, &requestedAddress,
sizeof(in_addr), AF_INET, callback, NULL);
]])],[AC_MSG_RESULT([yes])],[AC_MSG_FAILURE([working c-ares library was not found])])
LIBS="$PRELIBS"
AC_CHECK_LIB(cares, ares_library_init, AC_DEFINE([HAVE_ARES_LIBRARY_INIT],[1],[Define if libcares includes ares_library_init.]))
dnl detect a usable system curl library
LIBCURL=""
LIBCURL_CHECK_CONFIG(, 7.55.0)
AC_MSG_CHECKING(checking for curl library)
if test "x$LIBCURL" = "x" ; then
AC_MSG_ERROR([working curl library was not found])
else
AC_MSG_RESULT([yes])
fi
AC_MSG_CHECKING(checking for SSL support in curl)
if test "x$libcurl_feature_SSL" = "xyes" ; then
AC_MSG_RESULT([yes])
else
AC_MSG_ERROR([curl library missing SSL support])
fi
dnl detect a usable system regular expression library
AC_CHECK_LIB(c, regcomp, LIBREGEX="-lc",
[AC_CHECK_LIB(regex, regcomp, LIBREGEX="-lregex",
[AC_CHECK_LIB(compat, regcomp, LIBREGEX="-lcompat", AC_MSG_ERROR([working regex library was not found]))]
)]
)
AC_SUBST(LIBREGEX)
AC_CHECK_HEADER(regex.h, AC_DEFINE(HAVE_REGEX_H,1,[Define to 1 if you have the '<regex.h>' header file]), AC_MSG_ERROR([working regex.h was not found]))
# see if we have regex functionality
AC_MSG_CHECKING(for regular expression functionality)
PRELDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $LIBREGEX"
AC_RUN_IFELSE([
AC_LANG_PROGRAM([
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
#include <regex.h>
],[
regex_t re;
regcomp(&re, "abc", REG_EXTENDED);
regexec(&re, "", 0, 0, 0);
regfree(&re);
return 0;
])
], [AC_MSG_RESULT([yes])],
[AC_MSG_ERROR([regex test program failed to build or run])],
[AC_MSG_WARN([regex test program run skipped due to cross-compiling])] )
LDFLAGS="$PRELDFLAGS"
dnl detect a usable system -lrt library for shm_open()
AC_CHECK_LIB(rt, shm_open, LIBRT="-lrt", LIBRT="")
AC_SUBST(LIBRT)
# Check for the math lib
AC_CHECK_LIB(m, sqrtf)
# for BeOS - old network stack don't have those libs ( move it in the case switch ?)
AC_CHECK_LIB([socket], [socket])
AC_CHECK_LIB([socket], [gethostent], [], AC_CHECK_LIB([bind], [gethostent]))
# see if pthreads are in libc_r (as on FreeBSD) or libpthread
AC_CHECK_LIB([c_r], [pthread_create], LIBPTHREAD="-lc_r",
[AC_CHECK_LIB([pthread], [pthread_create], LIBPTHREAD="-lpthread",
LIBPTHREAD="")]
)
AC_SUBST(LIBPTHREAD)
# check for various IEEE and c99 standard math functions in libm
AC_CHECK_LIB([m], [acosf], [AC_DEFINE([HAVE_ACOSF],[1],[libm includes acosf])])
AC_CHECK_LIB([m], [asinf], [AC_DEFINE([HAVE_ASINF],[1],[libm includes asinf])])
AC_CHECK_LIB([m], [atan2f], [AC_DEFINE([HAVE_ATAN2F],[1],[libm includes atan2f])])
AC_CHECK_LIB([m], [atanf], [AC_DEFINE([HAVE_ATANF],[1],[libm includes atanf])])
AC_CHECK_LIB([m], [cosf], [AC_DEFINE([HAVE_COSF],[1],[libm includes cosf])])
AC_CHECK_LIB([m], [expf], [AC_DEFINE([HAVE_EXPF],[1],[libm includes expf])])
AC_CHECK_LIB([m], [fabsf], [AC_DEFINE([HAVE_FABSF],[1],[libm includes fabsf])])
AC_CHECK_LIB([m], [floorf], [AC_DEFINE([HAVE_FLOORF],[1],[libm includes floorf])])
AC_CHECK_LIB([m], [fmodf], [AC_DEFINE([HAVE_FMODF],[1],[libm includes fmodf])])
AC_CHECK_LIB([m], [hypotf], [AC_DEFINE([HAVE_HYPOTF],[1],[libm includes hypotf])])
AC_CHECK_LIB([m], [logf], [AC_DEFINE([HAVE_LOGF],[1],[libm includes logf])])
AC_CHECK_LIB([m], [log10f], [AC_DEFINE([HAVE_LOG10F],[1],[libm includes log10f])])
AC_CHECK_LIB([m], [powf], [AC_DEFINE([HAVE_POWF],[1],[libm includes powf])])
AC_CHECK_LIB([m], [sinf], [AC_DEFINE([HAVE_SINF],[1],[libm includes sinf])])
AC_CHECK_LIB([m], [sqrtf], [AC_DEFINE([HAVE_SQRTF],[1],[libm includes sqrtf])])
AC_CHECK_LIB([m], [tanf], [AC_DEFINE([HAVE_TANF],[1],[libm includes tanf])])
AC_MSG_CHECKING([for numeric type sizes])
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(short int)
AC_CHECK_SIZEOF(long int)
AC_CHECK_SIZEOF(long long int)
AC_CHECK_SIZEOF(float)
AC_CHECK_SIZEOF(double)
AC_CHECK_SIZEOF(long double)
AC_DEFINE_UNQUOTED(SIZEOF_INT, $ac_cv_sizeof_int, [sizeof int])
AC_DEFINE_UNQUOTED(SIZEOF_SHORT_INT, $ac_cv_sizeof_short_int, [sizeof short int])
AC_DEFINE_UNQUOTED(SIZEOF_LONG_INT, $ac_cv_sizeof_long_int, [sizeof long int])
AC_DEFINE_UNQUOTED(SIZEOF_LONG_LONG_INT, $ac_cv_sizeof_long_long_int, [sizeof long long int])
AC_DEFINE_UNQUOTED(SIZEOF_FLOAT, $ac_cv_sizeof_float, [sizeof float])
AC_DEFINE_UNQUOTED(SIZEOF_DOUBLE, $ac_cv_sizeof_double, [sizeof double])
AC_DEFINE_UNQUOTED(SIZEOF_LONG_DOUBLE, $ac_cv_sizeof_long_double, [sizeof long double])
dnl *************************
dnl *** Check for headers ***
dnl *************************
BZ_CONFIGURE_STAGE([headers], [4 of 9])
AC_LANG(C++)
AC_CHECK_HEADERS( \
cmath \
cstdlib \
cstdio \
cstring
)
AC_LANG(C)
AC_CHECK_HEADERS( \
SDL2/SDL.h \
bstring.h \
dlfcn.h \
dsound.h \
fcntl.h \
inttypes.h \
limits.h \
linux/input.h \
process.h \
sched.h \
stdint.h \
sys/param.h \
sys/socket.h \
netdb.h \
unistd.h \
values.h \
)
if test "x$enable_UPnP" = "xyes"; then
AC_CHECK_HEADERS(
[miniupnpc/miniupnpc.h],
[LIBMINIUPNPC=-lminiupnpc],
[AC_MSG_ERROR([You need to install miniupnpc for UPnP to work])])
fi
AC_SUBST(LIBMINIUPNPC)
dnl **********************************
dnl *** Check for types/structures ***
dnl **********************************
BZ_CONFIGURE_STAGE([types], [5 of 9])
#AM_CHECK_TYPES(socklen_t)
#AC_CHECK_TYPES(socklen_t)
AC_C_BIGENDIAN
AC_C_CONST
AC_MSG_CHECKING([for socklen_t type])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
#include <sys/socket.h>]],
[[socklen_t len = 42; return 0;]])],
[ac_cv_type_socklen_t=yes],[ac_cv_type_socklen_t=no])
AC_MSG_RESULT([$ac_cv_type_socklen_t])
if test $ac_cv_type_socklen_t != yes; then
AC_MSG_CHECKING([elsewhere for socklen_t type])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <winsock2.h>
#include <ws2tcpip.h>]],
[[socklen_t len = 42; return 0;]])],
[ac_cv_type_socklen_t=yes],[ac_cv_type_socklen_t=no])
AC_MSG_RESULT([$ac_cv_type_socklen_t])
fi
if test $ac_cv_type_socklen_t != yes; then
AC_MSG_CHECKING([for socklen_t equivalent])
AC_CACHE_VAL([ac_cv_socklen_t_equiv],
[
# Systems have either "struct sockaddr *" or
# "void *" as the second argument to getpeername
ac_cv_socklen_t_equiv=
for arg2 in "struct sockaddr" void; do
for t in int size_t unsigned long "unsigned long"; do
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <sys/types.h>
#include <sys/socket.h>
int getpeername (int, $arg2 *, $t *);
]], [[
$t len; getpeername(0,0,&len);
]])],[
ac_cv_socklen_t_equiv="$t"
break
],[])
done
done
if test "x$ac_cv_socklen_t_equiv" = x; then
AC_MSG_ERROR([Cannot find a type to use in place of socklen_t])
fi
])
AC_MSG_RESULT($ac_cv_socklen_t_equiv)
AC_DEFINE_UNQUOTED(socklen_t, $ac_cv_socklen_t_equiv,
[type to use in place of socklen_t if not defined])
else
AC_DEFINE(HAVE_SOCKLEN_T, 1, [if socklen_t is defined, make note of it])
fi
#CONFIG is only used for irix packaging
case $host_os in
irix*)
CONFIG=irix-mips3;
AC_SUBST(CONFIG)
;;
esac
AC_LANG(C++)
AC_CHECK_TYPES([std::shared_ptr<int>],
[# BZFlag expects std::shared_ptr support by default],
[AC_CHECK_TYPES([[std::tr1::shared_ptr<int>]],
AC_DEFINE([USE_TR1], [1], [Define to 1 to use C++0X TR1]),
AC_MSG_ERROR([[The C++11 std::shared_ptr type is required to build BZFlag]]),
[[#include <tr1/memory>]])],
[#include <memory>])
have_gl=yes
savedLIBS=$LIBS
case $host_os in
solaris*)
if test -d /usr/demo/SOUND/lib ; then
GLIBS="-laudio $GLIBS"
LDFLAGS="$LDFLAGS -L/usr/demo/SOUND/lib"
fi
GLIBS="-lresolv $GLIBS"
LIBS="$LIBS -lsocket -lnsl -lresolv"
LDFLAGS="$LDFLAGS -lresolv" # for hstrerror()
;;
irix*)
GLIBS="-lXsgivc -lX11 -laudio $GLIBS"
;;
beos)
GLIBS=" -lmedia -lgame $GLIBS"
LIBS="-lbe"
;;
darwin*)
GLIBS="-framework OpenGL $GLIBS"
;;
*)
;;
esac
case $host_os in
darwin*)
AC_CHECK_HEADER([OpenGL/gl.h], [ac_cv_search_glBegin="none required"], [have_gl=no ; ac_cv_search_glBegin=no])
AC_CHECK_HEADER([OpenGL/glu.h], [ac_cv_search_gluScaleImage="none required"], [have_gl=no ; ac_cv_search_gluScaleImage=no])
AC_CHECK_HEADER([GL/glew.h], AC_SEARCH_LIBS(glewInit, [GLEW], [test $ac_cv_search_glewInit = "none required" || GLIBS="$ac_cv_search_glewInit $GLIBS"], [have_gl=no], $GLIBS), [have_gl=no ; ac_cv_search_glewInit=no])
;;
*)
AC_CHECK_HEADER([GL/gl.h], AC_SEARCH_LIBS(glBegin, [opengl32 GL GL2], [test $ac_cv_search_glBegin = "none required" || GLIBS="$ac_cv_search_glBegin $GLIBS"], [have_gl=no]), [have_gl=no ; ac_cv_search_glBegin=no])
AC_CHECK_HEADER([GL/glu.h], AC_SEARCH_LIBS(gluScaleImage, [glu32 GL GLU], [test $ac_cv_search_gluScaleImage = "none required" || GLIBS="$ac_cv_search_gluScaleImage $GLIBS"], [have_gl=no]), [have_gl=no ; ac_cv_search_gluScaleImage=no])
AC_CHECK_HEADER([GL/glew.h], AC_SEARCH_LIBS(glewInit, [GLEW], [test $ac_cv_search_glewInit = "none required" || GLIBS="$ac_cv_search_glewInit $GLIBS"], [have_gl=no]), [have_gl=no ; ac_cv_search_glewInit=no])
;;
esac
if test "$have_gl" != no; then
if test "$ac_cv_search_glBegin" = -lGL2; then
AC_DEFINE(BEOS_USE_GL2, 1, [Use new GL Kit for BeOS])
fi
fi
LIBS=$savedLIBS
AC_SUBST(GLIBS)
# try out pthreads if it's enabled, disable it if we don't have it
AC_MSG_CHECKING([for working pthreads])
if test "x$enable_threads" != "xno" ; then
tmpLIBS=$LIBS
LIBS=$LIBPTHREAD
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <pthread.h>]],
[[pthread_t thread;
pthread_create(&thread, NULL, NULL, NULL);]])],
[pthread_check="yes"], [pthread_check="no"])
if test $pthread_check = "yes"; then
AC_DEFINE(HAVE_PTHREADS, 1, [posix-compliant threading is available])
AC_DEFINE(_REENTRANT, 1, [Enable reentrant code])
LIBS="$tmpLIBS $LIBS"
else
LIBS=$tmpLIBS
fi
AC_MSG_RESULT([$pthread_check])
fi
# Use OS X frameworks (required for all three executables; bzflag, bzfs, and bzadmin)
case $host_os in
darwin*)
LIBS="${LIBS} -framework Carbon -framework CoreFoundation"
;;
esac
case $host_os in
mingw32*)
AC_CHECK_LIB(ws2_32, closesocket)
AC_CHECK_LIB(winmm, timeGetTime)
GLIBS="-mwindows -lgdi32 -ldxguid -ldsound -ldinput $GLIBS"
dnl MingW does some funny stuff with DirectX.
dnl Test for a working DirectInput.
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#define DIRECTINPUT_VERSION 0x0700
#include <dinput.h>
]], [[
IDirectInput7* directInput;
HINSTANCE hinst = GetModuleHandle(NULL);
HRESULT success = DirectInputCreateEx(hinst, DIRECTINPUT_VERSION, IID_IDirectInput7, (void**)&directInput, NULL);
]])],[],[AC_DEFINE(BROKEN_DINPUT, 1, [Define to 1 if your DirectInput headers and libraries are broken or mismatched.])])
;;
esac
# Remove ogg/vorbis dependencies until we actually need them.
#
# AC_CHECK_LIB(ogg, ogg_stream_init, [ALIBS="-logg $ALIBS"], [], $ALIBS)
# AC_CHECK_LIB(vorbis, vorbis_info_init, [ALIBS="-lvorbis $ALIBS"], [], $ALIBS)
# AC_CHECK_LIB(vorbisfile, ov_open, [ALIBS="-lvorbisfile $ALIBS"], [], $ALIBS)
# AC_SUBST(ALIBS)
if test $prefix = NONE; then
prefix=$ac_default_prefix
fi
BZFLAG_DATA=`eval eval echo $datadir/bzflag`
AC_SUBST(BZFLAG_DATA)
AC_DEFINE_UNQUOTED(BZFLAG_DATA, "$BZFLAG_DATA", [Data file directory])
savedLIBS=$LIBS
LIBS="$GLIBS $LIBS"
AC_LANG(C)
if test "x$enable_client" != xno; then
# Test for SDL 2
AM_PATH_SDL2(2.0.9, with_SDL2=yes, with_SDL2=no)
if test "x$with_SDL2" != "xyes"; then
AC_MSG_WARN(
[Client build is enabled, but SDL2 does not seem to be fully available ... disabling BZFlag client])
AM_CONDITIONAL(CLIENT_INCLUDED, false)
enable_client=no
fi
fi
AC_LANG(C++)
LIBS=$savedLIBS
# dumb temp hacks to add missing linkage stuff
case $host_os in
irix)
if test x$host_cpu = xmips64; then
LDFLAGS="$LDFLAGS -L$(ROOT)/usr/lib32"
else
LDFLAGS="$LDFLAGS -L$(ROOT)/usr/lib"
fi
;;
esac
dnl ******************************************
dnl *** Check for compiler characteristics ***
dnl ******************************************
BZ_CONFIGURE_STAGE([compiler], [6 of 9])
dnl On SGI systems, figure out if we are using MIPSPro compiler
using_mipspro=no
if test "$build_vendor" = "sgi" ; then
AC_MSG_CHECKING([whether we are using the MIPSPro compiler])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]],
[[#if defined(sgi) && !defined(__GNUC__) && defined(_COMPILER_VERSION)
this line should cause a compile failure when building with the MIPSpro compiler;
#endif
int main() { return 0; }
]])],[using_mipspro=no],[using_mipspro=yes])
AC_MSG_RESULT([$using_mipspro])
fi
AM_CONDITIONAL(BUGGY_MIPSPRO, test "x$using_mipspro" = "xyes")
# FIXME: these checks below are not compiler characteristics other
# than the FLAGS they set.
#
# the GCC version is known to be at least 4.3 because it has C++0x support
# possible future warnings: -Wconversion (1894) -Wfloat-equal (317)
FLAGS="-Wall -Wextra -Wcast-qual -Wredundant-decls -Wshadow -Wundef -pedantic"
case $host_os in
linux*)
AC_DEFINE(HALF_RATE_AUDIO, 1, [Half rate Audio])
CONF_CFLAGS="$CONF_CFLAGS $FLAGS"
CONF_CXXFLAGS="$CONF_CXXFLAGS $FLAGS"
case $host_vendor in
pc)
FLAGS=-mtune=native
CONF_CFLAGS="$CONF_CFLAGS $FLAGS";
CONF_CXXFLAGS="$CONF_CXXFLAGS $FLAGS";
CONF_CXXFLAGS="$CONF_CXXFLAGS -fsigned-char";;
ppc)
FLAGS="-mcpu=$host_cpu"
CONF_CFLAGS="$CONF_CFLAGS $FLAGS";
CONF_CXXFLAGS="$CONF_CXXFLAGS $FLAGS";;
esac;;
cygwin)
AC_DEFINE(HALF_RATE_AUDIO, 1, [Half rate Audio])
FLAGS="-Wall -W -mcpu=$host_cpu"
CONF_CFLAGS="$CONF_CFLAGS $FLAGS";
CONF_CXXFLAGS="$CONF_CXXFLAGS $FLAGS";
CONF_CXXFLAGS="$CONF_CXXFLAGS -fsigned-char";;
mingw32*)
AC_DEFINE(HALF_RATE_AUDIO, 1, [Half rate Audio])
FLAGS="-Wall -W"
FLAGS="$FLAGS -mtune=$host_cpu"
CONF_CFLAGS="$CONF_CFLAGS $FLAGS";
CONF_CXXFLAGS="$CONF_CXXFLAGS $FLAGS";
CONF_CXXFLAGS="$CONF_CXXFLAGS -fsigned-char";;
solaris*)
AC_DEFINE(ETC_INET, [], [hosts is in /etc/inet/])
AC_DEFINE(SUN_OGL_NO_VERTEX_MACROS, [], [Sun OpenGL No Macro Vertex])
if test "$GCC" = yes ; then
FLAGS="$FLAGS -Wno-unknown-pragmas" # *silently* ignore "#pragma ident"
CONF_CFLAGS="$CONF_CFLAGS $FLAGS"
CONF_CXXFLAGS="$CONF_CXXFLAGS $FLAGS"
fi
;;
irix)
FLAGS="-Wall";
if test x$host_cpu = xmips64; then
FLAGS="FLAGS -march=mips3";
else
FLAGS="FLAGS -march=mips2";
fi
CONF_CFLAGS="$CONF_CFLAGS $FLAGS";
CONF_CXXFLAGS="$CONF_CXXFLAGS $FLAGS";;
beos*)
AC_DEFINE(HAVE_DEFINED_TOLOWER, 1, [tolower and toupper are not functions])
;;
esac
if test x$enable_profiling = xyes ; then
if test "$GCC" = yes ; then
CONF_CFLAGS="$CONF_CFLAGS -pg"
CONF_CXXFLAGS="$CONF_CXXFLAGS -pg"
if expr `$CC -dumpversion | sed 's/\..*//'` \>= "6" > /dev/null ; then
CONF_CFLAGS="$CONF_CFLAGS -no-pie"
CONF_CXXFLAGS="$CONF_CXXFLAGS -no-pie"
fi
else
AC_MSG_WARN([profiling is disabled with non-GNU compiler])
fi
fi
if test x$enable_debug = xyes ; then
CONF_CFLAGS="$CONF_CFLAGS -Werror -g -O0"
CONF_CXXFLAGS="$CONF_CXXFLAGS -Werror -g -O0"
# revert automatic setting of CFLAGS and CXXFLAGS to prevent
# override of "-g -O0" put into CONF_CFLAGS and CONF_CXXFLAGS above
CFLAGS="$user_CFLAGS"
CXXFLAGS="$user_CXXFLAGS"
AC_DEFINE(DEBUG, 1, [Debugging enabled])
else
if test "$GCC" = yes ; then
case "`$CC --version 2>&1`" in
*LLVM*|lcc*|clang*)
# Apple LLVM and MCST LCC falsely claim to be GCC
;;
*)
OPTIMIZE="-fexpensive-optimizations"
CONF_CFLAGS="$CONF_CFLAGS $OPTIMIZE"
CONF_CXXFLAGS="$CONF_CXXFLAGS $OPTIMIZE"
;;
esac
fi
AC_DEFINE(NDEBUG, 1, [Debugging disabled])
fi
dnl check for -search_paths_first linker flag when making dynamic libraries
search_paths_first_flag="-Wl,-search_paths_first -mdynamic-no-pic"
AC_MSG_CHECKING([if the compiler understands $search_paths_first_flag])
search_paths_first_flag_works=yes
PRELDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $search_paths_first_flag"
AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[]])],[],
[search_paths_first_flag_works=no])
AC_MSG_RESULT($search_paths_first_flag_works)
if test "x$search_paths_first_flag_works" = "xno" ; then
LDFLAGS="$PRELDFLAGS"
fi
dnl ***************************
dnl *** Check for functions ***
dnl ***************************
BZ_CONFIGURE_STAGE([functions], [7 of 9])
ac_func_search_save_LIBS=$LIBS
case $host_os in
darwin*)
LIBS="-framework OpenGL $ac_func_search_save_LIBS"
;;
esac
AC_CHECK_FUNCS(\
CGLGetCurrentContext \
Sleep \
WaitForSingleObject \
_stricmp \
_strnicmp \
_vsnprintf \
atexit \
hstrerror \
sched_setaffinity \
select \
snooze \
usleep \
vsnprintf \
wglGetCurrentContext \
)
LIBS=$ac_func_search_save_LIBS
dnl test for isnan() presence
BZ_FUNC_ISNAN
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <algorithm>
]], [[
int i = std::min(0, 1); i = i;
]])],[AC_DEFINE(HAVE_STD__MIN, 1, [Define to 1 if you have a conforming std::min])],[])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <algorithm>
]], [[
int i = std::max(0, 1); i = i;
]])],[AC_DEFINE(HAVE_STD__MAX, 1, [Define to 1 if you have a conforming std::max])],[])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <algorithm>
]], [[
char array[] = "test";
int i = std::count(array, array + 5, 't'); i = i;
]])],[AC_DEFINE(HAVE_STD__COUNT, 1, [Define to 1 if you have a conforming
std::count, otherwise old version of count template is assumed])],[])
dnl *********************************
dnl *** Check for system services ***
dnl *********************************
BZ_CONFIGURE_STAGE([services], [8 of 9])
# FIXME: system service checks seem to be spread out everywhere above,
# need to consolidate them to here.
case $host_os in
beos*)
beos=true
;;
darwin*)
apple=true
;;
hpux*)
hpux=true
;;
irix*)
irix=true
;;
linux*|kfreebsd*|freebsd*|netbsd*|openbsd*|dragonfly*|gnu*)
linux=true
;;
solaris*)
solaris=true
;;
cygwin|mingw32*|windows**)
win32=true
;;
esac
AM_CONDITIONAL(HPUX, test x$hpux = xtrue)
AM_CONDITIONAL(BEOS, test x$beos = xtrue)
AM_CONDITIONAL(APPLE, test x$apple = xtrue)
AM_CONDITIONAL(IRIX, test x$irix = xtrue)
AM_CONDITIONAL(LINUX, test x$linux = xtrue)
AM_CONDITIONAL(SOLARIS, test x$solaris = xtrue)
AM_CONDITIONAL(WIN32, test x$win32 = xtrue)
# wtf are these for?
AM_CONDITIONAL(PC, test x$host_vendor = xpc)
AM_CONDITIONAL(PPC, test x$host_vendor = xppc)
# Check for working FF_RUMBLE support in linux/input.h
AC_MSG_CHECKING([for linux rumble joystick support])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <linux/input.h>]],
[[struct ff_effect x; x.u.rumble.weak_magnitude = 42; return 0;]])],
[ac_ff_effect_rumble=yes],[ac_ff_effect_rumble=no])
if test x$ac_ff_effect_rumble = xyes; then
AC_DEFINE(HAVE_FF_EFFECT_RUMBLE, 1, [we appear to have working support for rumble force feedback effects])
fi
AC_MSG_RESULT([$ac_ff_effect_rumble])
# Check for working directional FF support in linux/input.h
AC_MSG_CHECKING([for linux force feedback joystick support])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <linux/input.h>]],
[[struct ff_effect x; x.direction = 0x4000; return 0;]])],
[ac_ff_effect_directional=yes],[ac_ff_effect_directional=no])
if test x$ac_ff_effect_directional = xyes; then
AC_DEFINE(HAVE_FF_EFFECT_DIRECTIONAL, 1, [we appear to have working support for directional force feedback effects])
fi
AC_MSG_RESULT([$ac_ff_effect_directional])
# if the client was enabled, make sure we have GL
if test x$enable_client != xno; then
if test "$have_gl" = no; then
AC_MSG_WARN(
[Client build is enabled, but OpenGL does not seem to be fully available ... disabling BZFlag client])
AM_CONDITIONAL(CLIENT_INCLUDED, false)
enable_client=no
else
AM_CONDITIONAL(CLIENT_INCLUDED, true)
fi
else
AM_CONDITIONAL(CLIENT_INCLUDED, false)
fi
# Build the server, or do not. There is no "try."
if test x$enable_server != xno; then
AM_CONDITIONAL(SERVER_INCLUDED, true)
else
AM_CONDITIONAL(SERVER_INCLUDED, false)
fi
# if bzadmin was enabled, make sure we have curses.
if test x$enable_bzadmin != xno; then
if test "x$CURSES_LIB" = x; then
AC_MSG_WARN([could not find a curses library, will build bzadmin without curses])
fi
AM_CONDITIONAL(BZADMIN_INCLUDED, true)
else
AM_CONDITIONAL(BZADMIN_INCLUDED, false)
fi
AM_CONDITIONAL(HAVE_CURSES, test "x$CURSES_LIB" != x)
AC_SUBST(CURSES_LIB)
# make sure ECHO and ECHO_N got defined and substituted
if test "x$ECHO" = "x" ; then
ECHO=echo
AC_MSG_NOTICE([ECHO was not defined by configure so defining manually])
fi
AC_SUBST(ECHO)
AC_SUBST(ECHO_N)
dnl **************************************
dnl *** Configure Makefiles and output ***
dnl **************************************
BZ_CONFIGURE_STAGE([output], [9 of 9])
AC_SUBST(CONF_CPPFLAGS)
AC_SUBST(CONF_CFLAGS)
AC_SUBST(CONF_CXXFLAGS)
LIBDIR="\$(top_srcdir)/lib"
AC_SUBST(LIBDIR)
AC_CONFIG_FILES([
MSVC/Makefile
MSVC/build/Makefile
Xcode/Makefile
Xcode/BZFlag.xcodeproj/Makefile
Makefile
bzflag.spec
data/Makefile
data/fonts/Makefile
data/l10n/Makefile
include/Makefile
m4/Makefile
man/Makefile
misc/Makefile
package/Makefile
package/irix/Makefile
package/linux/Makefile
package/rpm/Makefile
package/win32/Makefile
package/win32/nsis/Makefile
plugins/HoldTheFlag/Makefile
plugins/Makefile
plugins/Phoenix/Makefile
plugins/RogueGenocide/Makefile
plugins/SAMPLE_PLUGIN/Makefile
plugins/airspawn/Makefile
plugins/autoFlagReset/Makefile
plugins/bzfscron/Makefile
plugins/chathistory/Makefile
plugins/customflagsample/Makefile
plugins/customPollTypeSample/Makefile
plugins/CustomZoneSample/Makefile
plugins/fairCTF/Makefile
plugins/fastmap/Makefile
plugins/flagStay/Makefile
plugins/keepaway/Makefile
plugins/killall/Makefile
plugins/koth/Makefile
plugins/logDetail/Makefile
plugins/nagware/Makefile
plugins/playHistoryTracker/Makefile
plugins/plugin_utils/Makefile