-
-
Notifications
You must be signed in to change notification settings - Fork 42
/
configure.in
1182 lines (1100 loc) · 32.3 KB
/
configure.in
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
# Public domain
# ex:syn=bsdbuild
#
# Agar configure script source.
#
# This is a BSDBuild configure source. The configure script is generated by the
# mkconfigure(1) utility of BSDBuild (https://bsdbuild.hypertriton.com/).
#
package("Agar")
version("1.7.1")
release("Ancient Egypt")
register_section("Libraries to build:")
register("--enable-au", "AU: Audio and sound toolkit [no]")
register("--enable-gui", "GUI: The Agar GUI library [yes]")
register("--enable-map", "MAP: 2D tile engine [no]")
register("--enable-math", "MATH: Math library and advanced rendering [yes]")
register("--enable-micro", "MA: Micro-Agar GUI library [no]")
register("--enable-net", "NET: Network interface library [yes]")
register("--enable-sg", "SG: Scene graph and 3D engine [yes]")
register("--enable-sk", "SK: Sketch and constraint solver [yes]")
register("--enable-vg", "VG: Simple 2D vector graphics [yes]")
register_section("Global Agar options:")
register("--with-memory-model=(S|M|L)", "Select Agar memory model [auto]")
register("--with-float", "Floating-point support [auto]")
register("--enable-shared", "Build shared libraries [check]")
register("--enable-type-safety", "Run-time type safety checks [no]")
register("--enable-debug", "Debug build (implies type-safety) [no]")
register("--enable-debug-surfaces", "Trace AG_Surface operations [no]")
register("--enable-legacy", "Deprecated interfaces [yes]")
register("--enable-threads", "Thread safety [check]")
register("--enable-warnings", "Suggested compiler warnings [no]")
register("--with-pthreads[=PREFIX]", "POSIX Threads support [check]")
register("--with-attributes", "Compiler attributes and annotations [yes]")
register("--with-inline", "Inline functions [yes]")
register_section("Options specific to CORE library:")
register("--enable-ansi-color", "Produce colorized output [yes]")
register("--enable-dso", "Dynamically loaded modules [yes]")
register("--enable-exec", "The AG_Execute(3) interface [yes]")
register("--enable-event-loop", "The standard AG_EventLoop(3) [yes]")
register("--enable-namespaces", "Namespaces for object classes [yes]")
register("--enable-named-args", "Named AG_Event arguments [yes]")
register("--enable-serialization", "File I/O and serialization [yes]")
register("--enable-string", "AG_Printf(3) formatting engine [yes]")
register("--enable-timers", "The AG_Timer(3) interface [yes]")
register("--enable-unicode", "Support for Unicode [yes]")
register("--enable-user", "The AG_User(3) interface [yes]")
register("--enable-verbosity", "Verbose error messages [yes]")
register("--with-db[45][=PREFIX]", "AG_Db: Berkeley DB backend [no]")
register("--with-mysql[=PREFIX]", "AG_Db: MySQL backend [no]")
register("--with-iconv[=PREFIX]", "Character set conversion [check]")
register("--with-inline-byteswap", "Inline endianness swaps [yes]")
register("--with-inline-error", "Inline malloc() wrappers [yes]")
register("--with-inline-event", "Inline event argument accessors [yes]")
register("--with-inline-io", "Inline serialization frontends [yes]")
register("--with-inline-object", "Inline some AG_Object calls [yes]")
register("--with-inline-string", "Inline some string functions [yes]")
register("--with-inline-tbl", "Inline some AG_Tbl functions [yes]")
register("--with-inline-threads", "Inline AG_Threads functions [yes]")
register("--with-inline-variable", "Inline some AG_Variable calls [yes]")
register_section("Options specific to MATH library:")
register("--with-<mode>-fp", "Precision (single|double|quad) [double]")
register("--with-altivec[=inline]", "AltiVec-optimized routines [check]")
register("--with-sse[=inline]", "SSE-optimized routines [check]")
register("--with-sse[234]", "SSE2 SSE3 SSE4 routines [check]")
register_section("Options specific to NET library:")
register("--enable-web", "HTTP/1.1 application server [no]")
register("--with-z[=PREFIX]", "zlib compression library [check]")
register_section("Options specific to GUI library:")
register("--enable-widgets", "The standard widget library [yes]")
register("--enable-wm-hints", "Interface with window managers [yes]")
register("--with-freetype[=PREFIX]", "Enable FreeType support [check]")
register("--with-fontconfig[=PREFIX]", "Enable Fontconfig support [check]")
register("--with-gl[=PREFIX]", "OpenGL rendering support [check]")
register("--with-jpeg[=PREFIX]", "Built-in JPEG image support [check]")
register("--with-png[=PREFIX]", "Built-in PNG image support [check]")
register("--with-x[=PREFIX]", "Build with X windows support [check]")
register("--with-xinerama[=PREFIX]", "Build with Xinerama support [check]")
register("--with-glx[=PREFIX]", "Enable accelerated X driver [check]")
register("--with-sdl[=PREFIX]", "Enable SDL 1.2 driver [check]")
register("--with-sdl2[=PREFIX]", "Enable SDL 2.0 driver [check]")
register("--with-wgl", "Enable MS Windows driver [check]")
register("--with-cocoa", "Enable MacOS X Cocoa driver [check]")
register("--with-inline-surface", "Inline pixel access routines [yes]")
register("--with-inline-widget", "Inline some AG_Widget functions [yes]")
register_section("Options specific to AU library:")
register("--with-sndfile[=PREFIX]", "Enable sndfile support [check]")
register("--with-portaudio[=PREFIX]", "Enable portaudio driver [check]")
register_section("Options specific to SG library:")
register("--with-glu[=PREFIX]", "OpenGL Utility Library (GLU) [check]")
default_dir(DATADIR, "${PREFIX}/share/agar")
default_dir(LOCALEDIR, "${DATADIR}/locale")
default_dir(TTFDIR, "${DATADIR}/fonts")
default_dir(INCLDIR, "${PREFIX}/include/agar")
if [ "${DATADIR}" = "NONE" ]; then
hdefine(LOCALEDIR, "NONE")
mdefine(LOCALEDIR, "NONE")
hdefine(TTFDIR, "NONE")
mdefine(TTFDIR, "NONE")
fi
echo ' _ _ _ ___'
echo ' / _ \ / _ \ / _ \ | _ \'
echo ' | |_| | | (_| | | |_| | | |_) |'
echo ' |_| |_| \__, | |_| |_| |_| |_|'
echo ' |___/ '
if [ "${with_memory_model}" = '' ]; then
case "${host}" in
amd64-* | hppa64-* | ia64-* | mips64-* | ppc64*-* | sh64-* | sparc64-* | x86_64-*)
with_memory_model="L"
;;
bbc | c64 | c128 | geos | nes)
with_memory_model="S"
;;
*)
with_memory_model="M"
;;
esac
fi
case "${with_memory_model}" in
S* | s*)
hdefine_unquoted(AG_MODEL, "AG_SMALL")
mdefine(MEMORY_MODEL, "SMALL")
;;
M* | m*)
hdefine_unquoted(AG_MODEL, "AG_MEDIUM")
mdefine(MEMORY_MODEL, "MEDIUM")
;;
L* | l*)
hdefine_unquoted(AG_MODEL, "AG_LARGE")
mdefine(MEMORY_MODEL, "LARGE")
;;
*)
echo "No such memory model: ${with_memory_model} (use: SMALL, MEDIUM or LARGE)"
exit 1
esac
echo " v$VERSION for $host_machine ($MEMORY_MODEL)"
echo ""
case "${host}" in
gba | gp32 | nds | 3ds)
host="arm-none-eabi"
PATH="${DEVKITARM}/bin:${PATH}"
require(cc)
require(devkitpro, 0, ${with_devkitpro})
echo "checking for byte order...little-endian (${host})"
mdefine(_MK_BYTE_ORDER, "LE")
hdefine(_MK_LITTLE_ENDIAN, "yes")
hundef(_MK_BIG_ENDIAN)
;;
gamecube | wii | wiiu)
host="powerpc-eabi"
PATH="${DEVKITPPC}/bin:${PATH}"
require(cc)
require(devkitpro, 0, ${with_devkitpro})
mdefine(_MK_BYTE_ORDER, "BE")
hdefine(_MK_BIG_ENDIAN, "yes")
hundef(_MK_LITTLE_ENDIAN)
;;
switch)
host="aarch64-none-elf"
PATH="${DEVKITA64}/bin:${PATH}"
require(cc)
require(devkitpro, 0, ${with_devkitpro})
CFLAGS="${CFLAGS} -mlittle-endian"
mdefine(_MK_BYTE_ORDER, "LE")
hdefine(_MK_LITTLE_ENDIAN, "yes")
hundef(_MK_BIG_ENDIAN)
;;
bbc | c64 | c128 | geos | nes)
require(cc)
disable(objc)
enable_micro="yes"
enable_gui="no"
enable_sg="no"
enable_sk="no"
enable_vg="no"
enable_shared="no"
with_attributes="no"
with_float="no"
enable_ansi_color="no"
enable_dso="no"
enable_exec="no"
enable_event_loop="no"
enable_namespaces="no"
enable_named_args="no"
enable_net="no"
enable_serialization="no"
enable_string="no"
enable_threads="no"
enable_timers="no"
enable_type_safety="no"
enable_unicode="no"
enable_user="no"
enable_verbosity="no"
enable_math="no"
echo "checking for byte order...little-endian (${host})"
mdefine(_MK_BYTE_ORDER, "LE")
hdefine(_MK_LITTLE_ENDIAN, "yes")
hundef(_MK_BIG_ENDIAN)
;;
*)
require(cc)
check(objc)
if [ "${HAVE_FLOAT}" = "yes" -a "${with_float}" = "no" ]; then
echo "disabling floating-point support"
mdefine(HAVE_FLOAT, "no")
mdefine(HAVE_LONG_DOUBLE, "no")
hundef(HAVE_FLOAT)
hundef(HAVE_LONG_DOUBLE)
fi
if [ "${CROSS_COMPILING}" = "yes" ]; then
if [ "${byte_order}" = "" ]; then
case "${host}" in
armel-* | sh5el-* | earmvel-* | i*86-* | mips*el-* | mipsel-* | powerpcle-* | powerpc64le-* | riscv*-* | vax-* | x86_64-*)
byte_order="LE"
;;
aarch64_be-* | armeb-* | avr32-* | earmveb-* | hppa*-* | m68k-* | mc68* | mips*eb-* | mipseb-* | openrisc-* | powerpc-* | rs6000-* | sh3eb-* | sparc*-*)
byte_order="BE"
;;
*)
echo "*"
echo "* Could not guess the byte order of ${host}."
echo "* Please use --byte-order=LE or --byte-order=BE"
echo "*"
exit 1
;;
esac
fi
fi
check(byte_order)
;;
esac
# Force a static build if requested.
if [ "${enable_shared}" != 'no' ]; then
mdefine(LIB_SHARED, "Yes")
else
mdefine(LIB_SHARED, "No")
fi
#
# Determine available C compiler attributes. We have to assume that the compiler
# used to build an Agar application on a given system will have at least the
# same attributes available to it as the compiler that was used to build the
# Agar library itself. If not, --without-attributes should be used.
#
if [ "${with_attributes}" != 'no' ]; then
check(cc_attributes)
else
disable(cc_attributes)
fi
hdefine_if("${with_attributes}" != 'no', AG_USE_ATTRIBUTES)
#
# Expand inlinables by default. Keep a dlsymmable copy of all
# functions available (with names in lowercase form).
#
if [ "${with_inline}" = 'no' ]; then
with_inline_byteswap="no"
with_inline_error="no"
with_inline_io="no"
with_inline_object="no"
with_inline_string="no"
with_inline_tbl="no"
with_inline_threads="no"
with_inline_variable="no"
with_inline_surface="no"
with_inline_widget="no"
fi
hdefine_if("${with_inline_byteswap}" != "no", AG_INLINE_BYTESWAP)
hdefine_if("${with_inline_error}" != "no", AG_INLINE_ERROR)
hdefine_if("${with_inline_io}" != "no", AG_INLINE_IO)
hdefine_if("${with_inline_object}" != "no", AG_INLINE_OBJECT)
hdefine_if("${with_inline_string}" != "no", AG_INLINE_STRING)
hdefine_if("${with_inline_tbl}" != "no", AG_INLINE_TBL)
hdefine_if("${with_inline_threads}" != "no", AG_INLINE_THREADS)
hdefine_if("${with_inline_variable}" != "no", AG_INLINE_VARIABLE)
hdefine_if("${with_inline_surface}" != "no", AG_INLINE_SURFACE)
hdefine_if("${with_inline_widget}" != "no", AG_INLINE_WIDGET)
check(sys_types)
check(sys_stat)
check(stdlib_h)
check(unistd_h)
check(limits_h)
check(float_h)
check(math)
check(math_c99)
check(fdclose)
check(getpwuid)
check(getpwnam_r)
check(getenv)
check(getuid)
check(strsep)
check(asprintf)
check(snprintf)
check(vsnprintf)
check(vasprintf)
check(signal)
check(strtoll)
check(strtold)
check(dlopen)
check(dyld)
check(shl_load)
check(gettimeofday)
check(select)
check(glob)
check(getopt)
check(execvp)
check(clock_gettime)
check(clock_win32)
check(nanosleep)
check(kqueue)
check(timerfd)
check(csidl)
check(xbox)
check(mprotect)
check(dirfd)
# C compiler options
c_define(_AGAR_INTERNAL)
c_define(_DEFAULT_SOURCE)
c_define(_BSD_SOURCE)
c_no_secure_warnings()
case "${host}" in
*-*-darwin*)
c_define(_DARWIN_C_SOURCE)
;;
esac
if [ "${enable_warnings}" = 'yes' ]; then
c_option(-Wall)
c_option(-Werror)
c_option(-Wmissing-prototypes)
c_option(-Wno-switch)
case "${host}" in
*-*-darwin*)
c_option(-Wno-deprecated-declarations)
;;
esac
fi
if [ "${enable_debug}" = 'yes' ]; then
hdefine(AG_DEBUG, "yes")
hdefine(AG_TYPE_SAFETY, "yes")
mdefine(CFLAGS, "${CFLAGS} -g")
else
hundef(AG_DEBUG)
hdefine_if("${enable_type_safety}" = 'yes', AG_TYPE_SAFETY)
fi
if [ "${enable_debug_surfaces}" = 'yes' ]; then
mdefine(CFLAGS, "${CFLAGS} -DDEBUG_SURFACES")
fi
hdefine_if("${enable_ansi_color}" != 'no', AG_ANSI_COLOR)
hdefine_if("${enable_dso}" != 'no', AG_ENABLE_DSO)
hdefine_if("${enable_event_loop}" != 'no', AG_EVENT_LOOP)
hdefine_if("${enable_exec}" != 'no', AG_ENABLE_EXEC)
hdefine_if("${enable_legacy}" != 'no', AG_LEGACY)
hdefine_if("${enable_named_args}" != 'no', AG_NAMED_ARGS)
hdefine_if("${enable_namespaces}" != 'no', AG_NAMESPACES)
hdefine_if("${enable_serialization}" != 'no', AG_SERIALIZATION)
hdefine_if("${enable_string}" != 'no', AG_ENABLE_STRING)
hdefine_if("${enable_timers}" != 'no', AG_TIMERS)
hdefine_if("${enable_unicode}" != 'no', AG_UNICODE)
hdefine_if("${enable_user}" != 'no', AG_USER)
hdefine_if("${enable_verbosity}" != 'no', AG_VERBOSITY)
hdefine_if("${enable_widgets}" != 'no', AG_WIDGETS)
hdefine_if("${enable_wm_hints}" != 'no', AG_WM_HINTS)
#
# Options specific to the Agar-GUI library.
#
if [ "${enable_gui}" != 'no' ]; then
hdefine(ENABLE_GUI, "yes")
mdefine(ENABLE_GUI_LIBS, "-L../gui -lag_gui")
mdefine(SUBDIR_gui, "gui")
# Enable SDL2 support if SDL2 is found.
if [ "${with_sdl2}" != 'no' ]; then
check(sdl2, 2.0.22, ${prefix_sdl2})
if [ "${HAVE_SDL2}" != 'yes' ]; then
if [ "${with_sdl2}" = 'yes' ]; then
echo "*"
echo "* --with-sdl2 was requested, but SDL 2.0 "
echo "* library was not found."
echo "*"
exit 1
fi
disable(sdl2)
fi
else
disable(sdl2)
fi
# Fallback on SDL 1.2 if found. Mutually exclusive with SDL2.
if [ "${HAVE_SDL2}" != "yes" -a "${with_sdl}" != 'no' ]; then
check(sdl, 1.2.0, ${prefix_sdl})
if [ "${HAVE_SDL}" != 'yes' ]; then
if [ "${with_sdl}" = 'yes' ]; then
echo "*"
echo "* --with-sdl was requested, but SDL 1.2 "
echo "* library was not found."
echo "*"
exit 1
fi
disable(sdl)
fi
else
disable(sdl)
fi
# Enable OpenGL support if an OpenGL library is found.
if [ "${with_gl}" != 'no' ]; then
check(opengl, 0, ${prefix_gl})
if [ "${HAVE_OPENGL}" = 'yes' ]; then
mdefine(SDL_CFLAGS, "$SDL_CFLAGS $OPENGL_CFLAGS")
else
if [ "${with_gl}" = 'yes' ]; then
echo "*"
echo "* --with-gl was requested, but no OpenGL"
echo "* library was found."
echo "*"
exit 1
fi
disable(opengl)
fi
else
disable(opengl)
fi
# Enable X Windows support if Xlib is found.
if [ "${with_x}" != 'no' ]; then
check(x11, 0, ${prefix_x})
if [ "${HAVE_X11}" != 'yes' ]; then
if [ "${with_x}" = 'yes' ]; then
echo "*"
echo "* --with-x was requested, but Xlib "
echo "* was not found."
echo "*"
exit 1
else
disable(x11)
fi
fi
if [ "${with_xinerama}" != 'no' ]; then
check(xinerama, 0, ${prefix_xinerama})
if [ "${HAVE_XINERAMA}" != 'yes' ]; then
if [ "${with_xinerama}" = 'yes' ]; then
echo "*"
echo "* --with-xinerama was requested, but the "
echo "* Xinerama extension was not found."
echo "*"
exit 1
fi
disable(xinerama)
fi
else
disable(xinerama)
fi
else
disable(x11)
disable(xinerama)
fi
# Enable MacOS X / Cocoa support if Cocoa is found.
if [ "${with_cocoa}" != 'no' ]; then
check(cocoa, 0)
if [ "${HAVE_COCOA}" != 'yes' ]; then
if [ "${with_cocoa}" = 'yes' ]; then
echo "*"
echo "* --with-cocoa was requested, but the "
echo "* Cocoa framework was not found."
echo "*"
exit 1
fi
disable(cocoa)
fi
else
disable(cocoa)
fi
#
# Platform-specific OpenGL APIs
#
if [ "${HAVE_OPENGL}" = 'yes' ]; then
# Enable GLX support if the GLX library is found.
if [ "${with_glx}" != 'no' ]; then
check(glx, 1.4, ${prefix_glx})
if [ "${HAVE_GLX}" != 'yes' ]; then
if [ "${with_glx}" = 'yes' ]; then
echo "*"
echo "* --with-glx was requested, but no"
echo "* compatible GLX library was found."
echo "*"
exit 1
fi
disable(glx)
fi
else
disable(glx)
fi
# Enable WGL support on Windows.
if [ "${with_wgl}" != 'no' ]; then
check(wgl, 0)
if [ "${HAVE_WGL}" != 'yes' ]; then
if [ "${with_wgl}" = 'yes' ]; then
echo "*"
echo "* --with-wgl was requested, but the"
echo "* WGL test has failed."
echo "*"
exit 1
fi
disable(wgl)
fi
else
disable(wgl)
fi
else
disable(glx)
disable(wgl)
fi
# Enable Freetype support if the Freetype library is found. Otherwise
# fall back to the bitmap font engine.
if [ "${with_freetype}" != 'no' ]; then
check(freetype, 7.0.1, ${prefix_freetype})
if [ "${HAVE_FREETYPE}" != 'yes' ]; then
echo "*"
echo "* The FreeType library was not found, aborting!"
echo "*"
echo "* Agar needs FreeType to display vector fonts"
echo "* (http://www.freetype.org/)."
echo "*"
echo "* If you really want to use Agar's built-in"
echo "* monospace bitmap font engine (not recommended),"
echo "* please use: ./configure --without-freetype"
echo "*"
exit 1
fi
else
disable(freetype)
fi
# Use fontconfig if available.
if [ "${with_fontconfig}" != 'no' ]; then
check(fontconfig, 2.6.0, ${prefix_fontconfig})
else
disable(fontconfig)
fi
# Enable JPEG format support if libjpeg is found.
if [ "${with_jpeg}" != 'no' ]; then
check(jpeg, 0, ${prefix_jpeg})
if [ "${HAVE_JPEG}" != 'yes' ]; then
if [ "${with_jpeg}" = 'yes' ]; then
echo "*"
echo "* --with-jpeg was requested, but libjpeg"
echo "* was not found."
echo "*"
exit 1
fi
disable(jpeg)
fi
else
disable(jpeg)
fi
# Enable PNG format support if libpng is found.
if [ "${with_png}" != 'no' ]; then
check(png, 1.2.49, ${prefix_png})
if [ "${HAVE_PNG}" != 'yes' ]; then
if [ "${with_png}" = 'yes' ]; then
echo "*"
echo "* --with-png was requested, but libpng"
echo "* was not found."
echo "*"
exit 1
fi
disable(png)
fi
else
disable(png)
fi
else
hundef(ENABLE_GUI)
mdefine(ENABLE_GUI_LIBS, "")
mdefine(SUBDIR_gui, "")
disable(sdl)
disable(sdl2)
disable(x11)
disable(xinerama)
disable(cocoa)
disable(opengl)
disable(glx)
disable(wgl)
disable(freetype)
disable(fontconfig)
disable(jpeg)
disable(png)
fi
if [ "${enable_micro}" = 'yes' ]; then
hdefine(ENABLE_MICRO, "yes")
mdefine(ENABLE_MICRO_LIBS, "-L../micro -lag_micro_gui")
mdefine(SUBDIR_micro, "micro")
else
hundef(ENABLE_MICRO)
mdefine(ENABLE_MICRO_LIBS, "")
mdefine(SUBDIR_micro, "")
fi
# Enable the network library (ag_net).
if [ "${enable_net}" != 'no' ]; then
mdefine(SUBDIR_net, "net")
check(getaddrinfo)
check(siocgifconf)
check(sockopts)
check(winsock)
mdefine(HAVE_NETWORK, "yes")
hdefine(AG_NETWORK, "yes")
else
mdefine(SUBDIR_net, "")
disable(getaddrinfo)
disable(siocgifconf)
disable(sockopts)
disable(winsock)
mdefine(HAVE_NETWORK, "no")
hundef(AG_NETWORK)
fi
# Build HTTP application server support into the ag_net library.
if [ "${enable_web}" = 'yes' ]; then
check(zlib, 0, ${prefix_z})
check_header(sys/uio.h)
check_header(sys/param.h)
mdefine(HAVE_WEB, "yes")
hdefine(AG_WEB, "yes")
else
disable(zlib);
hundef(HAVE_SYS_UIO_H)
hundef(HAVE_SYS_PARAM_H)
mdefine(HAVE_WEB, "no")
hundef(AG_WEB)
fi
# Enable Berkeley DB module for AG_Db if requested
if [ "${with_db4}" = 'yes' ]; then
check(db4, 0, ${prefix_db4})
if [ "${HAVE_DB4}" != 'yes' ]; then
if [ "${with_db4}" = 'yes' ]; then
echo "*"
echo "* --with-db4 requested and DB4 was not found"
echo "*"
exit 1
else
disable(db4)
fi
fi
else
disable(db4)
fi
# Enable MySQL module for AG_Db if requested.
if [ "${with_mysql}" = 'yes' ]; then
check(mysql, 5.5.8, ${prefix_mysql})
if [ "${HAVE_MYSQL}" != 'yes' ]; then
if [ "${with_mysql}" = 'yes' ]; then
echo "*"
echo "* --with-mysql was requested, but libmysqlclient"
echo "* was not found."
echo "*"
exit 1
fi
disable(mysql)
fi
else
disable(mysql)
fi
# Enable threads support if POSIX threads are available.
if [ "${enable_threads}" != 'no' ]; then
check(pthreads, 0, ${prefix_pthreads})
if [ "${HAVE_PTHREADS}" = 'yes' ]; then
if [ "${HAVE_PTHREADS_XOPEN}" = 'no' ]; then
if [ "${HAVE_PTHREAD_MUTEX_RECURSIVE}" = 'no' ]; then
if [ "${HAVE_PTHREAD_MUTEX_RECURSIVE_NP}" = 'no' ]; then
if [ "${enable_threads}" = 'yes' ]; then
echo "*"
echo "* --enable-threads was given, but your"
echo "* pthreads library seems to lack support"
echo "* for recursive mutexes."
echo "*"
exit 1
fi
hundef(AG_THREADS)
fi
fi
fi
hdefine(AG_THREADS, "yes")
else
if [ "${enable_threads}" = 'yes' ]; then
echo "*"
echo "* --enable-threads was given, but no pthreads"
echo "* library was found on your system."
echo "*"
exit 1
fi
hundef(AG_THREADS)
fi
else
disable(pthreads)
hundef(AG_THREADS)
if [ "${enable_warnings}" = 'yes' ]; then
#
# Lock macros expand to no-ops when compiled !AG_THREADS,
# which may result in unused variables.
#
c_option(-Wno-unused)
fi
fi
# Enable NLS if requested explicitely.
if [ "${enable_nls}" = 'yes' ]; then
check(iconv, 0, ${prefix_iconv})
check(gettext, 0, ${prefix_gettext})
if [ "${HAVE_GETTEXT}" != 'yes' ]; then
echo "*"
echo "* --enable-nls was given but gettext was not found."
echo "*"
exit 1
fi
else
disable(iconv)
disable(gettext)
fi
#
# Options specific to the Agar-Math library
#
if [ "${enable_math}" != 'no' ]; then
hdefine(ENABLE_MATH, "yes")
mdefine(SUBDIR_math, "math")
else
hundef(ENABLE_MATH)
mdefine(SUBDIR_math, "")
fi
#
# MATH: Enable AltiVec optimizations if compiler supports AltiVec.
#
if [ "${with_altivec}" != 'no' ]; then
check(altivec)
if [ "${HAVE_ALTIVEC}" != 'yes' ]; then
if [ "${with_altivec}" = 'yes' -o "${with_altivec}" = 'inline' ]; then
echo "*"
echo "* --with-altivec was requested, but "
echo "* AltiVec is not supported by compiler"
echo "*"
exit 1
else
disable(altivec)
hundef(INLINE_ALTIVEC)
fi
else
hdefine_if("${with_altivec}" = 'inline', INLINE_ALTIVEC)
fi
else
disable(altivec)
hundef(INLINE_ALTIVEC)
fi
#
# MATH: Enable SSE optimizations if compiler supports intrinsics. A CPU check
# is done, so that enabling SSE will not break the build on non-SSE machines
# (unless --with-sse=inline is used, in which case ag_math will require SSE).
#
if [ "${with_sse}" != 'no' ]; then
check(sse)
if [ "${HAVE_SSE}" != 'yes' ]; then
if [ "${with_sse}" = 'yes' -o "${with_sse}" = 'inline' ]; then
echo "*"
echo "* --with-sse was requested, but SSE "
echo "* intrinsics not supported by compiler"
echo "*"
exit 1
fi
disable(sse)
else
hdefine_if("${with_sse}" = 'inline', INLINE_SSE)
hundef_if("${with_sse2}" = 'no', HAVE_SSE2)
hundef_if("${with_sse3}" = 'no', HAVE_SSE3)
fi
else
disable(sse)
fi
#
# MATH: Select single, double or quad precision for the M_Real type.
#
if [ "${with_single_fp}" = 'yes' ]; then
if [ "${HAVE_MATH_C99}" != 'yes' ]; then
echo "*"
echo "* --with-single-fp was requested, but your compiler does"
echo "* not support the C99 math routines (sinf(), etc)."
echo "*"
exit 1
fi
hdefine(SINGLE_PRECISION, "yes")
else
hundef(SINGLE_PRECISION)
fi
hdefine_if("${with_double_fp}" != 'no', DOUBLE_PRECISION)
if [ "${with_quad_fp}" = 'yes' ]; then
if [ "${HAVE_LONG_DOUBLE}" != 'yes' ]; then
echo "*"
echo "* --with-quad-fp was requested, but your compiler"
echo "* does not support the C99 long double type."
echo "*"
exit 1
fi
if [ "${HAVE_MATH_C99}" != 'yes' ]; then
echo "*"
echo "* --with-quad-fp was requested, but the C99 math"
echo "* routines (sinl(), etc.) are not available."
echo "*"
exit 1
fi
hdefine(QUAD_PRECISION, "yes")
else
hundef(QUAD_PRECISION)
fi
#
# VG: Enable the VG library (needs GUI).
#
if [ "${enable_vg}" != 'no' -a "${enable_gui}" != 'no' ]; then
hdefine(ENABLE_VG, "yes")
mdefine(SUBDIR_vg, "vg")
else
hundef(ENABLE_VG)
mdefine(SUBDIR_vg, "")
fi
#
# AU: Enable the AU library (needs GUI).
#
if [ "${enable_au}" = 'yes' -a "${enable_gui}" != 'no' ]; then
hdefine(ENABLE_AU, "yes")
mdefine(SUBDIR_au, "au")
check(sndfile, 1.0.21, ${prefix_sndfile})
check(portaudio, 19.0, ${prefix_portaudio})
else
hundef(ENABLE_AU)
mdefine(SUBDIR_au, "")
disable(sndfile)
disable(portaudio)
fi
#
# MAP: Enable the MAP library (needs GUI).
#
if [ "${enable_map}" = 'yes' -a "${enable_gui}" != 'no' ]; then
hdefine(ENABLE_MAP, "yes")
mdefine(SUBDIR_map, "map")
else
hundef(ENABLE_MAP)
mdefine(SUBDIR_map, "")
fi
#
# SG: Enable the SG library (needs MATH, GUI).
#
if [ "${enable_sg}" != 'no' -a "${enable_gui}" != 'no' \
-a "${enable_math}" != 'no' -a "${HAVE_OPENGL}" = 'yes' ]; then
hdefine(ENABLE_SG, "yes")
mdefine(SUBDIR_sg, "sg")
# Enable GLU if found (used by the SG_Image(3) object class).
if [ "${with_glu}" != 'no' ]; then
check(glu, 0, ${prefix_glu})
if [ "${HAVE_GLU}" = 'yes' ]; then
mdefine(SDL_CFLAGS, "$SDL_CFLAGS $GLU_CFLAGS")
else
if [ "${with_glu}" = 'yes' ]; then
echo "*"
echo "* --with-glu was requested, but no GLU"
echo "* library was found."
echo "*"
exit 1
fi
disable(glu)
fi
else
disable(glu)
fi
else
hundef(ENABLE_SG)
mdefine(SUBDIR_sg, "")
disable(glu)
fi
#
# SK: Enable the SK library (needs MATH, GUI).
#
if [ "${enable_sk}" != 'no' -a "${enable_gui}" != 'no' \
-a "${enable_math}" != 'no' -a "${HAVE_OPENGL}" = 'yes' ]; then
hdefine(ENABLE_SK, "yes")
mdefine(SUBDIR_sk, "sk")
else
hundef(ENABLE_SK)
mdefine(SUBDIR_sk, "")
fi
#
# CORE: Conditionally compiled sources in Agar-Core.
#
mdefine(SRCS_CORE, "")
if [ "${HAVE_SNPRINTF}" != 'yes' ]; then
mappend(SRCS_CORE, "snprintf.c")
fi
if [ "${HAVE_CLOCK_WIN32}" = 'yes' ]; then
mappend(SRCS_CORE, "time_win32.c")
fi
if [ "${HAVE_CLOCK_GETTIME}" = 'yes' ]; then
if [ "${HAVE_NANOSLEEP}" = 'yes' ]; then
mappend(SRCS_CORE, "time_posix.c")
fi
if [ "${HAVE_PTHREADS}" = 'yes' ]; then
mappend(SRCS_CORE, "time_renderer.c")
fi
fi
if [ "${HAVE_GETTIMEOFDAY}" = 'yes' ]; then
if [ "${HAVE_SELECT}" = 'yes' ]; then
mappend(SRCS_CORE, "time_gettimeofday.c")
fi
fi
if [ "${HAVE_DB4}" = 'yes' ]; then
mappend(SRCS_CORE, "db_bdb.c")
fi
if [ "${HAVE_MYSQL}" = 'yes' ]; then
mappend(SRCS_CORE, "db_mysql.c")
fi
if [ "${HAVE_GETPWUID}" = 'yes' ]; then
mappend(SRCS_CORE, "user_posix.c")
fi
if [ "${HAVE_XBOX}" = 'yes' ]; then
mappend(SRCS_CORE, "user_xbox.c xbox.c")
fi
if [ "${HAVE_CSIDL}" = 'yes' ]; then
mappend(SRCS_CORE, "user_win32.c")
fi
#
# NET: Conditionally compiled sources in Agar-Net.
#
if [ "${HAVE_NETWORK}" = 'yes' ]; then
if [ "${HAVE_WINSOCK1}" = 'yes' ]; then
mappend(SRCS_NET, "net_winsock1.c")
fi
if [ "${HAVE_WINSOCK2}" = 'yes' ]; then
mappend(SRCS_NET, "net_winsock2.c")
fi
if [ "${HAVE_GETADDRINFO}" = 'yes' ]; then
mappend(SRCS_NET, "net_bsd.c")
fi
if [ "${HAVE_WEB}" = 'yes' ]; then
mappend(SRCS_NET, "web.c web_auth.c web_var.c")
fi
fi
#
# GUI: Conditionally compiled sources in Agar-GUI.
#
mdefine(SRCS_GUI, "")
if [ "${HAVE_FREETYPE}" = 'yes' ]; then