-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure.ac
277 lines (214 loc) · 6 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
dnl Process this file with autoconf to produce a configure script.
dnl Jon Trulson 9/21/96 - with some borrowed code from various sources...;-)
dnl
dnl
AC_INIT([conquest],
[9.0],
[https://github.com/jontrulson/conquest/issues],
[conquest],
[https://github.com/jontrulson/conquest])
AC_CONFIG_HEADERS([src/config.h])
AC_CONFIG_MACRO_DIRS([m4])
AC_LANG(C++)
dnl get the system type and set accordingly. first init some defaults.
GLCLIENT=""
ISMINGW=""
conquest_group=""
AC_ARG_WITH(conquest-group,
[ --with-conquest-group=groupname The conquest group name (Default: conquest)],
conquest_group="$withval", conquest_group="")
AC_ARG_ENABLE([gl],
AS_HELP_STRING([--disable-gl], [Don't build OpenGL client (default=auto)]),
[GLCLIENT=""], [GLCLIENT="yes"]
)
AC_ARG_ENABLE([sound],
AS_HELP_STRING([--disable-sound], [Disable sound support (default=auto)]),
[SNDCLIENT=""], [SNDCLIENT="yes"]
)
dnl can't have sound without gl
if ! test -n "$GLCLIENT"
then
SNDCLIENT=""
fi
AC_CANONICAL_TARGET
AC_MSG_CHECKING(system type)
uname=`uname -s`
urev=`uname -r`
uvers=`uname -v`
case "$host" in
*linux*)
AC_DEFINE(LINUX, 1, [Linux])
AC_MSG_RESULT(Linux)
;;
*darwin*)
AC_DEFINE(DARWIN, 1, [Darwin])
# silence the tons of deprecation warnings
ocflags="$CFLAGS"
CFLAGS="$ocflags -I/usr/X11/include -I/opt/X11/include"
CXXFLAGS="$ocflags -I/usr/X11/include -I/opt/X11/include"
AC_MSG_RESULT(Darwin)
;;
*freebsd*)
AC_DEFINE(FREEBSD, 1, [FreeBSD])
LIBS="$LIBS -lcompat"
AC_MSG_RESULT(FreeBSD)
;;
*solaris*)
AC_DEFINE(SOLARIS, 1, [Solaris])
LIBS="$LIBS -lsocket -lnsl"
AC_MSG_RESULT(Solaris)
;;
*sysv4.2uw*)
AC_DEFINE(UNIXWARE, 1, [UnixWare])
AC_MSG_RESULT(UnixWare)
;;
*mingw*)
# for MinGW systems - we only want to build the GL client (only)
AC_DEFINE(MINGW, 1, [MinGW])
ISMINGW="yes"
AC_MSG_RESULT(MinGW)
;;
*dec-osf1*)
case "$uvers" in
?4.*)
true
;;
*)
AC_MSG_WARN([This port is only known to work on DU 4.x])
AC_MSG_WARN([Assuming OSF V4.x])
;;
esac
AC_DEFINE(OSF, 1, [OSF])
AC_MSG_RESULT(Digital Unix 4.x+)
;;
*cygwin*)
AC_DEFINE(CYGWIN, 1, [Cygwin])
if test ! -n "$conquest_group"
then
conquest_group="Users"
fi
AC_MSG_RESULT(Cygwin)
;;
*)
# assume something safe, linux
AC_DEFINE(LINUX, 1, [Linux])
AC_MSG_RESULT(UNKNOWN defaulting to LINUX)
;;
esac
dnl disable shared libs
AC_DISABLE_SHARED([])
AM_INIT_AUTOMAKE([subdir-objects foreign])
LT_INIT
AC_PROG_YACC
AC_PROG_LEX(noyywrap)
AC_PREFIX_DEFAULT(/opt)
if test ! -n "$ISMINGW"
then
AC_PATH_X
AC_PATH_XTRA
fi
AC_PROG_CXX
if test ! -n "$conquest_group"
then
conquest_group="conquest"
fi
CONQGROUP="$conquest_group"
AC_SUBST(CONQGROUP)
dnl From stackoverflow...
dnl @synopsis CXX_FLAGS_CHECK [compiler flags]
dnl @summary check whether compiler supports given C++ flags or not
AC_DEFUN([CXX_FLAG_CHECK],
[dnl
AC_MSG_CHECKING([if $CXX supports $1])
AC_LANG_PUSH([C++])
ac_saved_cxxflags="$CXXFLAGS"
CXXFLAGS="-Werror $1"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
[cxx_flag_check=yes],
[cxx_flag_check=no]
)
AC_MSG_RESULT([$cxx_flag_check])
CXXFLAGS="$ac_saved_cxxflags"
if test "$cxx_flag_check" = yes
then
CXXFLAGS="$CXXFLAGS $1"
fi
AC_LANG_POP([C++])
])
dnl check for some compiler flags
dnl these 2 are generated by gcc 7.1+ for bogus IMO reasons
CXX_FLAG_CHECK([-Wno-format-overflow])
CXX_FLAG_CHECK([-Wno-format-truncation])
CXX_FLAG_CHECK([-Wno-deprecated-declarations])
CXX_FLAG_CHECK([-fno-strict-aliasing])
CONQ_CFLAGS="$CXXFLAGS -std=c++11 -DNDEBUG"
AC_SUBST(CONQ_CFLAGS)
dnl no idea why this is neccessary now.
AC_SUBST(YFLAGS)
AC_PROG_MAKE_SET
dnl Checks for libraries.
dnl Replace `main' with a function in -lm:
AC_CHECK_LIB(m, main)
dnl check for curses, we give preference to a native curses
olibs="$LIBS"
AC_CHECK_LIB(curses, initscr, LIBS="-lcurses $olibs",
AC_CHECK_LIB(ncurses, initscr, LIBS="-lncurses $olibs",
AC_MSG_WARN(I cannot find initscr (curses). You might need to help me)))
dnl check for libcrypt
olibs="$LIBS"
AC_CHECK_LIB(crypt, crypt, LIBS="$olibs -lcrypt")
dnl check for libgen
olibs="$LIBS"
AC_CHECK_LIB(gen, crypt, LIBS="$olibs -lgen")
dnl check for libz
olibs="$LIBS"
AC_CHECK_LIB(z, gzread)
dnl Checks for header files.
AC_CHECK_HEADERS(fcntl.h limits.h sys/ioctl.h sys/times.h termio.h unistd.h)
AC_CHECK_HEADERS(ncurses.h sys/time.h sys/select.h stropts.h poll.h)
AC_CHECK_HEADERS(curses.h time.h string.h strings.h termios.h zlib.h)
AC_CHECK_HEADERS(stdint.h dirent.h crypt.h)
AC_CHECK_HEADERS(GL/glut.h GL/gl.h GL/glu.h, :, GLCLIENT=""; SNDCLIENT="")
dnl Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
AC_STRUCT_TM
AC_FUNC_VPRINTF
AC_CHECK_FUNCS(select strstr fileno setpgrp daemon)
AC_CHECK_FUNCS(getmsg poll setitimer strerror)
if test ! -n "$ISMINGW"
then
AC_FUNC_SETPGRP
fi
dnl see if we should check for SDL and friends
if test -n "$SNDCLIENT"
then
dnl Check for SDL, version 2.0.0+
SDL_VERSION=2.0.0
AM_PATH_SDL2($SDL_VERSION,
LIBS="$LIBS $SDL_LIBS"; CONQ_CFLAGS="$CONQ_CFLAGS -DHAVE_SDL=1",
SNDCLIENT=""; AC_MSG_WARN([*** SDL version $SDL_VERSION not found!])
)
CONQ_CFLAGS="$CONQ_CFLAGS $SDL_CFLAGS"
dnl Check for SDL_mixer
AC_CHECK_LIB(SDL2_mixer, Mix_OpenAudio,
CONQ_CFLAGS="$CONQ_CFLAGS -DHAVE_SDL_MIXER=1"; LIBS="-lSDL2_mixer $LIBS",
SNDCLIENT=""; AC_MSG_WARN([*** SDL_mixer not found!]))
fi
AM_CONDITIONAL(GLCLIENT, test $GLCLIENT)
AM_CONDITIONAL(ISMINGW, test $ISMINGW)
AM_CONDITIONAL(SNDCLIENT, test $SNDCLIENT)
AC_CONFIG_FILES([Makefile src/Makefile src/fmt/Makefile])
AC_OUTPUT
echo
if ! test -n "$GLCLIENT"
then
echo "### OpenGL support is disabled, the client will NOT be built"
else
echo "### OpenGL support is enabled, the client will be built"
fi
if ! test -n "$SNDCLIENT"
then
echo "### SDL sound support is disabled"
else
echo "### SDL sound support is enabled"
fi