-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfigure.in
More file actions
1112 lines (1009 loc) · 28.3 KB
/
configure.in
File metadata and controls
1112 lines (1009 loc) · 28.3 KB
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 Process this file with autoconf to produce a configure script.
AC_PREREQ(2.13)
AC_INIT(source/sv_main.c)
AC_REVISION($Revision$) dnl
AM_CONFIG_HEADER(include/config.h)
AC_CANONICAL_SYSTEM
dnl This is the only place where the package version appears
AM_INIT_AUTOMAKE(nuq, 0.2.99alpha0)
dnl Define the proper name and extra version numbers for package
PROGRAM="QuakeForge: nuq"
QSG_VERSION=1.0
QUAKE_VERSION=1.09
AC_DEFINE_UNQUOTED(PROGRAM, "$PROGRAM")
AC_DEFINE_UNQUOTED(QSG_VERSION, "$QSG_VERSION")
AC_DEFINE_UNQUOTED(QUAKE_VERSION, "$QUAKE_VERSION")
AC_SUBST(PROGRAM)
AC_SUBST(QSG_VERSION)
AC_SUBST(QUAKE_VERSION)
dnl Start TARGETS out blank
TARGETS=""
ISODATE=`date +%Y-%m-%d`
AC_SUBST(ISODATE)
AC_LANG_C
dnl ==================================================================
dnl Checks for programs.
dnl ==================================================================
AC_PROG_AWK
AC_PROG_CC
AC_PROG_CPP
AC_PROG_RANLIB
AC_PROG_INSTALL
AC_PROG_LN_S
dnl ==================================================================
dnl Checks for system services
dnl ==================================================================
AC_SYS_LONG_FILE_NAMES
AC_EXEEXT
AC_OBJEXT
dnl ==================================================================
dnl Checks for header files.
dnl ==================================================================
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_MAJOR
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(
stdarg.h unistd.h fcntl.h dlfcn.h windows.h sys/ioctl.h sys/mman.h \
sys/io.h asm/io.h \
sys/param.h sys/stat.h sys/time.h sys/timeb.h sys/types.h \
sys/socket.h netinet/in.h netdb.h arpa/inet.h sys/filio.h \
sys/soundcard.h linux/soundcard.h machine/soundcard.h sys/audioio.h \
dsound.h mmsystem.h initguid.h mme/mmsystem.h mme/mme_public.h \
sys/asoundlib.h string.h strings.h memory.h malloc.h \
errno.h sys/dir.h fnmatch.h \
mgraph.h linux/joystick.h
)
dnl ==================================================================
dnl Checks for typedefs, structures, and compiler characteristics
dnl ==================================================================
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_STRUCT_ST_BLKSIZE
AC_HEADER_TIME
AC_STRUCT_TM
AC_C_BIGENDIAN
AC_MSG_CHECKING(for type of fpos_t)
AC_TRY_COMPILE(
[#include <stdio.h>],
[fpos_t x = 0],
AC_MSG_RESULT(off_t),
AC_DEFINE(HAVE_FPOS_T_STRUCT)
AC_MSG_RESULT(struct)
)
AC_MSG_CHECKING(for socklen_t in sys/types.h)
AC_TRY_COMPILE(
[#include <sys/types.h>],
[ socklen_t x = 0;],
AC_DEFINE(HAVE_SOCKLEN_T)
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
dnl FreeBSD 4.0 has it in sys/socket.h
AC_MSG_CHECKING(for socklen_t in sys/socket.h)
AC_TRY_COMPILE(
[#include <sys/types.h>
#include <sys/socket.h>],
[ socklen_t x = 0;],
AC_DEFINE(HAVE_SOCKLEN_T) AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
)
)
AC_MSG_CHECKING(for underscore prefix in names)
AC_TRY_LINK(
[asm(".long _bar");
int bar;],
[],
AC_DEFINE(HAVE_SYM_PREFIX_UNDERSCORE) AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
)
AC_MSG_CHECKING(for size_t in sys/types.h)
AC_TRY_COMPILE(
[#include <sys/types.h>],
[ size_t x = 0;],
AC_DEFINE(HAVE_SIZE_T) AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
)
dnl maybe these two (at least the 2nd) should only be checked if ipv6 is enabled?
AC_MSG_CHECKING(for ss_len in struct sockaddr_storage)
AC_TRY_COMPILE(
[#include <sys/types.h>
#include <sys/socket.h>],
[ void f(void) { struct sockaddr_storage ss; ss.ss_len=0; }],
AC_DEFINE(HAVE_SS_LEN) AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
)
AC_MSG_CHECKING(for sin6_len in struct sockaddr_in6)
AC_TRY_COMPILE(
[#include <sys/types.h>
#include <netinet/in.h>],
[ void f(void) { struct sockaddr_in6 s6; s6.sin6_len=0; }],
AC_DEFINE(HAVE_SIN6_LEN) AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
)
AC_MSG_CHECKING(for sa_len in struct sockaddr)
AC_TRY_COMPILE(
[#include <sys/types.h>
#include <netinet/in.h>],
[ void f(void) { struct sockaddr sa; sa.sa_len=0; }],
AC_DEFINE(HAVE_SA_LEN) AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
)
dnl ==================================================================
dnl Checks for library functions.
dnl ==================================================================
AC_FUNC_ALLOCA
AC_FUNC_MEMCMP
AC_FUNC_MMAP
AC_TYPE_SIGNAL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(
gethostname gethostbyname connect gettimeofday getwd mkdir \
ftime _ftime fcntl stat putenv select socket strerror strstr \
snprintf _snprintf vsnprintf _vsnprintf strsep dlopen getaddrinfo \
getnameinfo
)
DL_LIBS=""
if test "x$ac_cv_func_dlopen" != "xyes"; then
AC_CHECK_LIB(dl, dlopen,
AC_DEFINE(HAVE_DLOPEN) DL_LIBS="-ldl"
)
fi
AC_SUBST(DL_LIBS)
dnl Checks for stricmp/strcasecmp
AC_CHECK_FUNC(stricmp,,
AC_CHECK_FUNC(strcasecmp, AC_DEFINE(stricmp,strcasecmp)))
dnl Check for vsnprintf
if test "x$ac_cv_func_vsnprintf" = "xno" -a \
"x$ac_cv_func__vsnprintf" = "xno"; then
dnl libdb may have this
AC_CHECK_LIB(db,vsnprintf)
fi
dnl Checks for working -lm
AC_CHECK_LIB(m, pow,, AC_MSG_ERROR([math library (-lm) appears broken]))
if test "x$enable_zlib" != "xno"; then
dnl Check for working -lz
dnl Note - must have gztell *and* gzgets in -lz *and* zlib.h
AC_CHECK_LIB(z, gztell, HAVE_ZLIB=yes, HAVE_ZLIB=no, [$LIBS])
if test "x$HAVE_ZLIB" = "xyes"; then
AC_CHECK_LIB(z, gzgets, HAVE_ZLIB=yes, HAVE_ZLIB=no, [$LIBS])
if test "x$HAVE_ZLIB" = "xyes"; then
AC_CHECK_HEADER(zlib.h, HAVE_ZLIB=yes, HAVE_ZLIB=no)
if test "x$HAVE_ZLIB" = "xyes"; then
LIBS="-lz $LIBS"
AC_DEFINE(HAVE_ZLIB)
fi
fi
fi
fi
dnl Checks for MGL support
AC_ARG_WITH(mgl,
[ --with-mgl[=DIR] use MGL found in DIR],
HAVE_MGL=$withval, HAVE_MGL=auto)
if test "x$HAVE_MGL" != xno; then
if test "x$ac_cv_header_windows_h" != "xyes"; then
HAVE_MGL=no
else
if test "x$HAVE_MGL" != xauto; then
MGL_CFLAGS="$MGL_CFLAGS -I$withval/include"
MGL_LIBS="$MGL_LIBS -L$withval/lib"
fi
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $MGL_CFLAGS"
AC_CHECK_HEADER(mgraph.h, HAVE_MGL=yes, HAVE_MGL=no)
CPPFLAGS="$save_CPPFLAGS"
dnl Make sure -lmgllt or -lmglfx works
if test "x$HAVE_MGL" = xyes; then
for lib in mglfx mgllt; do
MGL_LIBS="$MGL_LIBS -lgdi32 -lwinmm -ldinput -lddraw"
AC_CHECK_LIB($lib,MGL_registerDriver,
MGL_LIBS="-l$lib $MGL_LIBS"
HAVE_MGL=yes
break, HAVE_MGL=no, [$MGL_LIBS])
done
fi
fi
if test "x$HAVE_MGL" != xyes; then
MGL_CFLAGS="" MGL_LIBS=""
fi
fi
AC_SUBST(HAVE_MGL)
AC_SUBST(MGL_CFLAGS)
AC_SUBST(MGL_LIBS)
dnl Checks for LibGGI support
AC_ARG_WITH(ggi,
[ --with-ggi[=DIR] use LibGGI found in DIR],
HAVE_GGI=$withval, HAVE_GGI=auto)
if test "x$HAVE_GGI" != xno; then
if test "x$HAVE_GGI" != xauto; then
GGI_CFLAGS="$GGI_CFLAGS= -I$withval/include"
GGI_LIBS="$GGI_LIBS -L$withval/lib"
dnl The default system location is /usr/include or /usr/local/include
dnl and we (obviously) do not need to set CFLAGS for that
fi
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $GGI_CFLAGS"
AC_CHECK_HEADER(ggi/ggi.h, HAVE_GGI=yes, HAVE_GGI=no)
CPPFLAGS="$save_CPPFLAGS"
dnl Make sure -lggi works
if test "x$HAVE_GGI" = xyes; then
AC_CHECK_LIB(ggi, ggiEventsQueued, GGI_LIBS="$GGI_LIBS -lggi"
HAVE_GGI=yes, HAVE_GGI=no, [$GGI_LIBS]
)
fi
if test "x$HAVE_GGI" != xyes; then
GGI_CFLAGS="" GGI_LIBS=""
fi
fi
AC_SUBST(HAVE_GGI)
AC_SUBST(GGI_CFLAGS)
AC_SUBST(GGI_LIBS)
dnl SDL/SDL-GL checks
AM_PATH_SDL(1.0.1, HAVE_SDL=yes, HAVE_SDL=no)
if test "x$HAVE_SDL" != xno; then
AM_CHECK_SGL(1.1.1, HAVE_SGL=yes, HAVE_SGL=no)
fi
AC_SUBST(HAVE_SDL)
AC_SUBST(HAVE_SGL)
dnl Checks for SVGALib support
AC_ARG_WITH(svga,
[ --with-svga[=DIR] use SVGALib found in DIR],
HAVE_SVGA=$withval, HAVE_SVGA=auto)
if test "x$HAVE_SVGA" != xno; then
if test "x$HAVE_SVGA" != xauto; then
SVGA_CFLAGS="$SVGA_CFLAGS -I$withval/include"
SVGA_LIBS="$SVGA_LIBS -L$withval/lib"
dnl The default system location is /usr/include or /usr/local/include
dnl and we (obviously) do not need to set CFLAGS for that
fi
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $SVGA_CFLAGS"
AC_CHECK_HEADER(vga.h, HAVE_SVGA=yes, HAVE_SVGA=no)
CPPFLAGS="$save_CPPFLAGS"
dnl Make sure -lvga works
if test "x$HAVE_SVGA" = xyes; then
AC_CHECK_LIB(vga, vga_getmousetype, SVGA_LIBS="$SVGA_LIBS -lvga"
HAVE_SVGA=yes, HAVE_SVGA=no, [$SVGA_LIBS]
)
fi
if test "x$HAVE_SVGA" != xyes; then
SVGA_CFLAGS="" SVGA_LIBS=""
fi
fi
AC_SUBST(HAVE_SVGA)
AC_SUBST(SVGA_CFLAGS)
AC_SUBST(SVGA_LIBS)
dnl Checks for X11 and XShm
AC_PATH_XTRA
if test "x$no_x" = x; then
HAVE_X=yes
AC_CHECK_LIB(Xext, XShmQueryExtension,
X_SHM_LIB=-lXext,
HAVE_X=no,
[ $X_LIBS -lX11 $X_EXTRA_LIBS ]
)
fi
AC_SUBST(X_SHM_LIB)
dnl Check for XFree86-VidMode support
AC_ARG_ENABLE(vidmode,
[ --enable-vidmode use XFree86 VidMode extension, if available],
HAVE_VIDMODE=$enable_vidmode, HAVE_VIDMODE=auto)
if test "x$HAVE_VIDMODE" != xno; then
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$X_CFLAGS $CPPFLAGS"
AC_CHECK_HEADER(X11/extensions/xf86vmode.h,
dnl Make sure the library works
AC_CHECK_LIB(Xxf86vm, XF86VidModeSwitchToMode,
AC_DEFINE(HAVE_VIDMODE)
VIDMODE_LIBS="-lXxf86vm",,
[$X_LIBS -lXext -lX11 $X_EXTRA_LIBS]
)
)
CPPFLAGS="$save_CPPFLAGS"
fi
AC_SUBST(VIDMODE_LIBS)
dnl Check for DGA support
AC_ARG_ENABLE(dga,
[ --enable-dga use XFree86 DGA extension, if available],
HAVE_DGA=$enable_dga, HAVE_DGA=auto)
if test "x$HAVE_DGA" != xno; then
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$X_CFLAGS $CPPFLAGS"
AC_CHECK_HEADER(X11/extensions/xf86dga.h,
dnl Make sure the library works
AC_CHECK_LIB(Xxf86dga, XF86DGAQueryVersion,
AC_DEFINE(HAVE_DGA)
DGA_LIBS="-lXxf86dga",,
[$X_LIBS -lXext -lX11 $X_EXTRA_LIBS]
)
)
CPPFLAGS="$save_CPPFLAGS"
fi
AC_SUBST(DGA_LIBS)
dnl Checks for GLIDE support
AC_ARG_WITH(glide,
[ --with-glide=DIR use the GLIDE 2.x SDK found in DIR],
HAS_GLIDE=$withval, HAS_GLIDE=auto)
if test "x$HAS_GLIDE" != xno; then
if test "x$HAS_GLIDE" != xauto; then
GLIDE_CFLAGS="$GLIDE_CFLAGS -I$withval/include"
GLIDE_LIBS="$GLIDE_LIBS -L$withval/lib"
else
GLIDE_CFLAGS="$GLIDE_CFLAGS -I/usr/include/glide -I/usr/local/include/glide"
fi
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $GLIDE_CFLAGS"
AC_CHECK_HEADER(glide.h, HAS_GLIDE=yes, HAS_GLIDE=no)
if test "x$HAS_GLIDE" != xyes; then
HAS_GLIDE=no
fi
CPPFLAGS="$save_CPPFLAGS"
fi
dnl Checks for GLX support
AC_ARG_WITH(glx,
[ --with-glx[=DIR] use GLX with libraries found in DIR],
glx_libraries=$withval, glx_libraries=auto
)
AC_ARG_WITH(glx-includes,
[ --with-glx-includes[=DIR]
use GLX with header files found in DIR],
glx_includes=$withval, glx_includes=auto
)
if test "x$glx_includes" = xno; then
glx_libraries=""
fi
if test "x$glx_librariesS" = xno; then
glx_includes=""
fi
dnl Checks for GLX headers. lib[Mesa]GL should be either in a standard
dnl include directory or the X include directory. Either way, we
dnl use X_CFLAGS.
if test "x$glx_includes" != xauto -a "x$glx_includes" != x; then
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I$glx_includes"
AC_CHECK_HEADER($glx_includes/GL/gl.h, HAVE_GLX=yes, HAVE_GLX=no )
CPPFLAGS="$save_CPPFLAGS"
else
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
AC_CHECK_HEADER(GL/gl.h, HAVE_GLX=yes, HAVE_GLX=no)
CPPFLAGS="$save_CPPFLAGS"
fi
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
dnl Checks for OpenGL features in headers
if test "x$HAVE_GLX" != xno; then
AC_MSG_CHECKING(for GL_COLOR_INDEX8_EXT in GL/gl.h)
AC_TRY_COMPILE([#include "GL/gl.h"],
[ int x = (int) GL_COLOR_INDEX8_EXT;],
AC_DEFINE(HAVE_GL_COLOR_INDEX8_EXT) AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
)
fi
CPPFLAGS="$save_CPPFLAGS"
dnl Make sure -lGL or -lMesaGL works
if test "x$glx_libraries" != xauto -a "x$glx_libraries" != xno -a "x$glx_libraries" != x; then
if test "x$HAVE_GLX" = xyes; then
HAVE_GLX=no
AC_CHECK_LIB(GL, glColor4f,
HAVE_GLX=yes
OGL_NAME=GL,,
[ -L$glx_libraries ]
)
if test "x$HAVE_GLX" != xyes; then
AC_CHECK_LIB(MesaGL, glColor4f,
HAVE_GLX=yes
OGL_NAME=MesaGL,,
[ -L$glx_libraries ]
)
fi
if test "x$HAVE_GLX" = xyes -a "x$have_dynload" != xyes; then
AC_CHECK_LIB($OGL_NAME, XMesaSetFXmode,
AC_DEFINE(HAVE_XMESA),,
[ -L$glx_libraries ]
)
fi
fi
else
if test "x$glx_libraries" != xauto \
-o "x$glx_libraries" != xno \
-o "x$glx_libraries" != x; then
glx_libraries=""
fi
if test "x$HAVE_GLX" = xyes; then
HAVE_GLX=no
AC_CHECK_LIB(GL, glColor4f,
HAVE_GLX=yes
OGL_NAME=GL,,
[ $X_LIBS ]
)
if test "x$HAVE_GLX" != xyes; then
AC_CHECK_LIB(MesaGL, glColor4f,
HAVE_GLX=yes
OGL_NAME=MesaGL,,
[ $X_LIBS ]
)
fi
if test "x$HAVE_GLX" = xyes -a "x$have_dynload" != xyes; then
AC_CHECK_LIB($OGL_NAME, XMesaSetFXmode,
AC_DEFINE(HAVE_XMESA),,
[ $X_LIBS ]
)
fi
fi
fi
if test "x$HAVE_GLX" = xyes; then
test "x$GLX_CFLAGS" != x && GLX_CFLAGS="-I$GLX_CFLAGS"
test "x$glx_libraries" != x && GLX_LIBS="-L$glx_libraries"
GLX_LIBS="$GLX_LIBS -l$OGL_NAME"
AC_DEFINE(HAVE_GLX)
else
GLX_CFLAGS=""
GLX_LIBS=""
fi
AC_SUBST(GLX_CFLAGS)
AC_SUBST(GLX_LIBS)
# 3Dfx stuff..
# First we see if we can use mesa with glide support..
# if not then try the MiniGL..
TDFXGL_NAME=""
AC_ARG_WITH(3dfx,
[ --with-3dfx support 3Dfx output for the V1/V2, if a argument
is specified it will be used as the GL wrapper lib
for glide.],
HAS_3dfx=$withval, HAS_3dfx=auto)
if test "x$HAS_3dfx" != "xno" -a "x$HAS_SVGA" != "xno" \
-a "x$HAS_GLIDE" != "xno"; then
if test "x$HAS_3dfx" != "xauto" -a "x$HAS_3dfx" != "xyes"; then
TDFXGL_NAME="$HAS_3dfx"
fi
if test -z "$TDFXGL_NAME"; then
dnl Check in reverse order of preference
for a in 3dfxgl $OGL_NAME; do
AC_CHECK_LIB($a, fxMesaCreateContext, TDFXGL_NAME=$a, qwfoo=qwfoo,
[$GLIDE_LIBS $TDFXGL_LIBS])
done
fi
fi
AC_MSG_CHECKING(for 3Dfx support)
if test -n "$TDFXGL_NAME"; then
TDFXGL_CFLAGS="$GLIDE_CFLAGS"
TDFXGL_LIBS="$GLIDE_LIBS -l$TDFXGL_NAME"
HAVE_TDFXGL="yes"
AC_MSG_RESULT(yes (using $TDFXGL_NAME))
else
TDFXGL_CFLAGS=""
TDFXGL_NAME=""
TDFXGL_LIBS=""
AC_MSG_RESULT(no)
fi
AC_SUBST(TDFXGL_CFLAGS)
AC_SUBST(TDFXGL_LIBS)
dnl ==================================================================
dnl Checks for system type
dnl ==================================================================
dnl Checks for which system driver to use
AC_MSG_CHECKING(for system driver)
case "${host}" in
i?86-*-mingw32*)
SYSTYPE=WIN32
AC_MSG_RESULT([Win32 driver])
;;
*)
SYSTYPE=POSIX
AC_MSG_RESULT([default POSIX driver])
;;
esac
AM_CONDITIONAL(SYSTYPE_WIN32, test "$SYSTYPE" = "WIN32")
dnl Check for ia32
AC_MSG_CHECKING(for an ia32 machine)
case "${host}" in
i?86-*-*)
AC_MSG_RESULT(yes)
AC_MSG_CHECKING(to see if we should disable asm optimizations)
AC_ARG_ENABLE(asmopt,
[ --disable-asmopt disable assembler optimization],
AC_MSG_RESULT(yes),
AC_DEFINE(USE_INTEL_ASM)
ASM_ARCH=yes
AC_MSG_RESULT(no)
)
;;
*) AC_MSG_RESULT(no)
esac
AM_CONDITIONAL(ASM_ARCH, test "$ASM_ARCH")
dnl ==================================================================
dnl Checks for sound
dnl ==================================================================
AC_CHECK_LIB(mme,waveOutOpen,HAVE_LIBMME=yes)
AC_ARG_ENABLE(alsa,
[ --disable-alsa disable alsa support],
)
AC_ARG_ENABLE(zlib,
[ --disable-zlib disable zlib support],
)
SNDTYPE=""
SOUND_LIBS=""
SOUND_CFLAGS=""
AC_MSG_CHECKING(for sound support)
if test "x$enable_alsa" != "xno"; then
if test -z "$SNDTYPE" -a "x$ac_cv_header_sys_asoundlib_h" = "xyes"; then
AC_EGREP_CPP([QF_maGiC_VALUE],
[
#include <sys/asoundlib.h>
#if defined(SND_LIB_MAJOR) && defined(SND_LIB_MINOR)
#if SND_LIB_MAJOR>0 || (SND_LIB_MAJOR==0 && SND_LIB_MINOR==5)
QF_maGiC_VALUE
#endif
#endif
],
SNDTYPE="ALSA_0_5"
SOUND_LIBS="-lasound",
AC_EGREP_CPP([QF_maGiC_VALUE],
[
#include <sys/asoundlib.h>
#if defined(SND_LIB_MAJOR) && defined(SND_LIB_MINOR)
#if SND_LIB_MAJOR>0 || (SND_LIB_MAJOR==0 && SND_LIB_MINOR>=9)
QF_maGiC_VALUE
#endif
#endif
],
SNDTYPE="ALSA_0_9"
SOUND_LIBS="-lasound"
)
)
fi
fi
dnl MME
if test -z "$SNDTYPE" -a "x$ac_cv_header_mme_mmsystem_h" = "xyes" -a "x$HAVE_LIBMME" = "xyes"; then
AC_EGREP_CPP([QF_maGiC_VALUE],
[
#include <mme/mmsystem.h>
#ifdef WAVE_OPEN_SHAREABLE
QF_maGiC_VALUE
#endif
],
SNDTYPE="MME"
SOUND_LIBS="-lmme"
)
fi
dnl OSS
if test -z "$SNDTYPE" -a "x$ac_cv_header_sys_soundcard_h" = "xyes"; then
AC_EGREP_CPP([QF_maGiC_VALUE],[
#include <sys/soundcard.h>
#ifdef SNDCTL_DSP_SETTRIGGER
QF_maGiC_VALUE
#endif
], SNDTYPE="OSS")
fi
if test -z "$SNDTYPE" -a "x$ac_cv_header_linux_soundcard_h" = "xyes"; then
AC_EGREP_CPP([QF_maGiC_VALUE],[
#include <linux/soundcard.h>
#ifdef SNDCTL_DSP_SETTRIGGER
QF_maGiC_VALUE
#endif
], SNDTYPE="OSS")
fi
if test -z "$SNDTYPE" -a "x$ac_cv_header_machine_soundcard_h" = "xyes"; then
AC_EGREP_CPP([QF_maGiC_VALUE],[
#include <machine/soundcard.h>
#ifdef SNDCTL_DSP_SETTRIGGER
QF_maGiC_VALUE
#endif
], SNDTYPE="OSS")
fi
dnl Sun
if test -z "$SNDTYPE" -a "x$ac_cv_header_sys_audioio_h" = "xyes"; then
AC_EGREP_CPP([QF_maGiC_VALUE],[
#include <sys/audioio.h>
#ifdef AUDIO_SETINFO
QF_maGiC_VALUE
#endif
], SNDTYPE="SUN")
fi
dnl Win32
if test -z "$SNDTYPE" -a "x$ac_cv_header_windows_h" = "xyes" -a \
"x$ac_cv_header_mmsystem_h" = "xyes"; then
AC_EGREP_CPP([QF_maGiC_VALUE],[
#include <windows.h>
#include <mmsystem.h>
#ifdef GMEM_MOVEABLE
#ifdef WAVE_FORMAT_PCM
QF_maGiC_VALUE
#endif
#endif
], SNDTYPE="WIN32"
SOUND_LIBS="-lwinmm")
fi
if test "$SNDTYPE"; then
AC_MSG_RESULT([yes ($SNDTYPE)])
else
AC_MSG_RESULT([no, using null sound driver])
fi
AC_SUBST(SOUND_LIBS)
AC_SUBST(SOUND_CFLAGS)
AM_CONDITIONAL(SNDTYPE_ALSA_0_5, test "$SNDTYPE" = "ALSA_0_5")
AM_CONDITIONAL(SNDTYPE_ALSA_0_9, test "$SNDTYPE" = "ALSA_0_9")
AM_CONDITIONAL(SNDTYPE_MME, test "$SNDTYPE" = "MME")
AM_CONDITIONAL(SNDTYPE_OSS, test "$SNDTYPE" = "OSS")
AM_CONDITIONAL(SNDTYPE_SUN, test "$SNDTYPE" = "SUN")
AM_CONDITIONAL(SNDTYPE_WIN32, test "$SNDTYPE" = "WIN32")
AM_CONDITIONAL(SNDTYPE_NULL, test "$SNDTYPE" != "ALSA_0_5" -a "$SNDTYPE" != "ALSA_0_9" -a "$SNDTYPE" != "MME" -a "$SNDTYPE" != "OSS" -a "$SNDTYPE" != "SUN" -a "$SNDTYPE" != "WIN32")
dnl Tests for joystick support
AC_MSG_CHECKING(for joystick support)
if test -z "$JOYTYPE" -a "x$ac_cv_header_linux_joystick_h" = "xyes"; then
AC_EGREP_CPP([QF_maGiC_VALUE],[
#include <linux/joystick.h>
#ifdef JS_VERSION
QF_maGiC_VALUE
#endif
], JOYTYPE="Linux")
fi
if test "$JOYTYPE"; then
AC_MSG_RESULT([yes ($JOYTYPE)])
else
AC_MSG_RESULT([no, using null joystick driver])
fi
AC_SUBST(JOY_LIBS)
AC_SUBST(JOY_CFLAGS)
AM_CONDITIONAL(JOYTYPE_LINUX, test "$JOYTYPE" = "Linux")
AM_CONDITIONAL(JOYTYPE_NULL, test "$JOYTYPE" != "Linux")
dnl ==================================================================
dnl Checks for CD-ROM
dnl ==================================================================
CD_LIBS=""
CD_CFLAGS=""
AC_MSG_CHECKING(for CD audio support)
dnl Linux
if test -z "$CDTYPE"; then
AC_EGREP_CPP([QF_maGiC_VALUE],
[
#include <linux/cdrom.h>
#ifdef CDROMREADTOCENTRY
QF_maGiC_VALUE
#endif
],
AC_MSG_RESULT([yes (Linux)])
CDTYPE=LINUX
)
fi
if test -z "$CDTYPE"; then
AC_EGREP_CPP([QF_maGiC_VALUE],
[
#include <sys/cdio.h>
#if defined (CDIOREADTOCENTRY) || defined (CDIOREADTOCENTRYS)
QF_maGiC_VALUE
#endif
],
AC_MSG_RESULT([yes (BSD)])
CDTYPE=BSD
)
fi
if test -z "$CDTYPE"; then
AC_EGREP_CPP([QF_maGIC_VALUE],
[
#include <windows.h>
#if defined(MCI_SET_DOOR_OPEN)
QF_maGiC_VALUE
#endif
],
AC_MSG_RESULT([yes (Win32)])
CDTYPE=WIN32
)
fi
test -z "$CDTYPE" && AC_MSG_RESULT([no, using null CD audio driver])
AC_SUBST(CD_LIBS)
AC_SUBST(CD_CFLAGS)
AM_CONDITIONAL(CDTYPE_LINUX, test "$CDTYPE" = "LINUX")
AM_CONDITIONAL(CDTYPE_BSD, test "$CDTYPE" = "BSD")
AM_CONDITIONAL(CDTYPE_WIN32, test "$CDTYPE" = "WIN32")
AM_CONDITIONAL(CDTYPE_NULL, test "$CDTYPE" != "LINUX" -a "$CDTYPE" != "BSD" -a "$CDTYPE" != "WIN32")
dnl ==================================================================
dnl Checks for networking
dnl ==================================================================
if test "x$ac_cv_func_connect" != "xyes"; then
AC_CHECK_LIB(socket,connect,
NET_LIBS="$NET_LIBS -lsocket"
ac_cv_func_connect=yes)
fi
if test "x$ac_cv_func_gethostbyname" != "xyes"; then
AC_CHECK_LIB(nsl,gethostbyname,
NET_LIBS="$NET_LIBS -lnsl"
ac_cv_func_gethostbyname=yes)
fi
AC_MSG_CHECKING([for connect in -lwsock32])
SAVELIBS="$LIBS"
LIBS="$LIBS -lwsock32"
AC_TRY_LINK([
#include <winsock.h>
],[
connect(0, NULL, 42);
],
NET_LIBS="$NET_LIBS -lwsock32 -lwinmm"
ac_cv_func_connect=yes
ac_cv_func_gethostbyname=yes
HAVE_WSOCK=yes
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
LIBS="$SAVELIBS"
AC_MSG_CHECKING(for UDP support)
if test "x$ac_cv_func_connect" = "xyes" -a \
"x$ac_cv_func_gethostbyname" = "xyes"; then
HAVE_UDP=yes
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
fi
if test "x$ac_cv_func_connect" != "xyes"; then
AC_MSG_CHECKING([for connect in -lwsock32])
SAVELIBS="$LIBS"
LIBS="$LIBS -lwsock32"
AC_TRY_LINK([
#include <winsock.h>
],[
connect(0, NULL, 42);
],
NET_LIBS="$NET_LIBS -lwsock32 -lwinmm"
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
LIBS="$SAVELIBS"
fi
AC_SUBST(NET_LIBS)
dnl ==================================================================
dnl Misc checks
dnl ==================================================================
dnl Set $prefix and $exec_prefix to $ac_default_prefix if they are not set
test "x$prefix" = xNONE && prefix=$ac_default_prefix
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
if test "x$SYSTYPE" = xWIN32; then
default_globalconf="~/${PACKAGE}.conf"
default_sharepath="."
default_userpath="."
else
default_globalconf="/etc/${PACKAGE}.conf"
eval foo="$datadir"
default_sharepath="$foo/games/$PACKAGE"
default_userpath="~/.$PACKAGE"
fi
AC_ARG_WITH(global-cfg,
[ --with-global-cfg=FILE If set will change the name and location of the
global config file used by Thirdspace. Defaults to
/etc/quakeforge.conf.],
globalconf="$withval", globalconf="auto")
if test "x$globalconf" = "xauto" || test "x$globalconf" = "xyes" || \
test "x$globalconf" = "xno"; then dnl yes/no sanity checks
globalconf="$default_globalconf"
fi
AC_DEFINE_UNQUOTED(FS_GLOBALCFG, "$globalconf")
AC_ARG_WITH(sharepath,
[ --with-sharepath=DIR Use DIR for shared game data, defaults to
'.' or \${datadir}/games/quakeforge (if new style)],
sharepath=$withval, sharepath="auto")
if test "x$sharepath" = "xauto" -o "x$sharepath" = "xyes" -o "x$sharepath" = "x"; then
sharepath="$default_sharepath"
elif test "x$sharepath" = xno; then
sharepath="."
fi
AC_DEFINE_UNQUOTED(FS_SHAREPATH, "$sharepath")
AC_ARG_WITH(userpath,
[ --with-userpath=DIR Use DIR for unshared game data, defaults to
'.' or ~/.quakeforge (if new style)],
userpath=$withval, userpath="auto")
if test "x$userpath" = "xauto" -o "x$userpath" = "xyes" -o "x$userpath" = "x"; then
userpath="$default_userpath"
elif test "x$userpath" = xno; then
userpath="."
fi
AC_DEFINE_UNQUOTED(FS_USERPATH, "$userpath")
dnl CFLAGS for release and devel versions
AC_ARG_WITH(amd,
[ --with-amd Optimize for AMD processors instead of Intel],
HAVE_AMD="yes",
HAVE_AMD="no"
)
AC_ARG_ENABLE(debug,
[ --enable-debug compile without optimizations (for development)],
debug=$enable_debug
)
if test "x$debug" != xyes; then
BUILD_TYPE="Standard"
if test "x$GCC" = xyes; then
CFLAGS="-O6 -ffast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations"
AC_MSG_CHECKING(for special compiler settings)
case "${host}" in
i386-*-*)
MORE_CFLAGS="-malign-loops=2 -malign-jumps=2 -malign-functions=2"
;;
i486-*-*)
MORE_CFLAGS="-m486 -malign-loops=2 -malign-jumps=2 -malign-functions=2"
;;
i586-*-*)
MORE_CFLAGS="-march=pentium -malign-loops=2 -malign-jumps=2 -malign-functions=2"
;;
i686-*-*)
MORE_CFLAGS="-march=pentiumpro -malign-loops=2 -malign-jumps=2 -malign-functions=2"
;;
*)
MORE_CFLAGS=""
;;
esac
if test "x$HAVE_AMD" = "xyes"; then
MORE_CFLAGS="-march=k6 -malign-loops=2 -malign-jumps=2 -malign-functions=2"
fi
if test "x$MORE_CFLAGS" = x; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
CFLAGS="$CFLAGS $MORE_CFLAGS"
fi
else
CFLAGS=-O2
fi
else
BUILD_TYPE="Debug"
fi
dnl CFLAGS for release and devel versions
AC_ARG_ENABLE(profile,
[ --enable-profile compile with profiling (for development)],
profile=$enable_profile
)
if test "x$profile" = xyes; then
BUILD_TYPE="$BUILD_TYPE Profile"
if test "x$GCC" = xyes; then
CFLAGS="`echo $CFLAGS | sed -e 's/-fomit-frame-pointer//g'` -pg"
LDFLAGS="$LDFLAGS -pg"
else
CFLAGS="$CFLAGS -p"
fi
fi
dnl Thirdspace uses lots of BCPL-style (//) comments, which can cause problems
dnl with many compilers that don't support the latest ISO standards. Well,
dnl that is our cover story -- the reality is that we like them and don't want
dnl to give them up. :)
dnl Make the compiler swallow its pride...
if test "x$GCC" != xyes; then
AC_MSG_CHECKING(for how to deal with BCPL-style comments)
case "${host}" in
*-aix*)
CFLAGS="$CFLAGS -qcpluscmt"
AC_MSG_RESULT([-qcpluscmt])
;;
*-irix6*)
CFLAGS="$CFLAGS -Xcpluscomm"
AC_MSG_RESULT([-Xcpluscomm])
;;
*-solaris*)
CFLAGS="$CFLAGS -xCC"
AC_MSG_RESULT([-xCC])
;;
*)
AC_MSG_RESULT(nothing needed or no switch known)
;;
esac
fi
dnl We want warnings, lots of warnings...
if test "x$GCC" = xyes; then
CFLAGS="$CFLAGS -Wall"
CFLAGS="$CFLAGS -Werror"
# CFLAGS="$CFLAGS -Wall -pedantic"
fi
dnl ==================================================================
dnl Find out what to build and finish
dnl ==================================================================
AC_ARG_WITH(clients,
[ --with-clients=<list> compile clients in <list>;
mgl ggi sdl sgl svga x11 glx 3dfx],
clients="$withval", clients="all")
if test "$clients" = "all"; then
ENABLE_MGL=yes
ENABLE_GGI=yes
ENABLE_SDL=yes
ENABLE_SGL=yes
ENABLE_SVGA=yes