-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconfigure.ac
323 lines (279 loc) · 8.01 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
dnl Process this file with autoconf to produce a configure script.
AC_PREREQ([2.59])
AC_INIT([hheretic],[0.2.4])
AC_CONFIG_AUX_DIR([autotools])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_SRCDIR([base/am_map.c])
dnl == Default values
CFLAGS_ALL="-Wall"
CFLAGS_DBG="-g"
CFLAGS_OPT="-O2 -ffast-math -fomit-frame-pointer"
GLHEXEN="true"
SVGAHEXEN="false"
no_svga="yes"
THREAD_LIBS=""
GLLIBS=""
SVGALIBS=""
dnl == Optimization
AC_ARG_ENABLE(debug,
[AS_HELP_STRING([--enable-debug], [debug build (no optimizations) [default=no]])],
[], [enable_debug=no])
if test x$enable_debug = xyes; then
CFLAGS="$CFLAGS $CFLAGS_ALL $CFLAGS_DBG"
else
CFLAGS="$CFLAGS $CFLAGS_ALL $CFLAGS_OPT"
fi
dnl == Command-line args. Check for mutually-exclusive options.
AC_ARG_ENABLE(fullscreen,
[AS_HELP_STRING([--enable-fullscreen], [Run fullscreen by default [default=no]])],
[], [enable_fullscreen=no])
if test x$enable_fullscreen = xyes; then
AC_DEFINE(FULLSCREEN_DEFAULT, 1, [Define if want to run fullscreen by default instead of windowed])
fi
AC_ARG_ENABLE(userdirs,
[AS_HELP_STRING([--disable-userdirs], [Disable user directories [default=no]])],
[], [enable_userdirs=yes])
if test x$enable_userdirs != xyes; then
AC_DEFINE(_NO_USERDIRS, 1, [Define if want to disable user directories])
fi
AC_ARG_ENABLE(asm,
[AS_HELP_STRING([--disable-asm], [Disable assembly language [default=no]])],
[], [enable_asm=yes])
if test x$enable_asm != xyes; then
AC_DEFINE(_DISABLE_ASM, 1, [Define if not want to use assembly language])
fi
AC_ARG_ENABLE(svga,
[AS_HELP_STRING([--enable-svga], [Enable SVGALib version [default=no]])],
[], [enable_svga=no])
if test x$enable_svga = xyes; then
AC_DEFINE(SVGAHERETIC, 1, [Define if HHeretic depends on SVGALib])
no_svga="no"
SVGAHEXEN="true"
fi
AC_ARG_ENABLE(gl,
[AS_HELP_STRING([--disable-gl], [Disable OpenGL version [default=no]])],
[], [enable_gl=$no_svga])
if test x$enable_gl = xyes; then
if test x$no_svga = xno; then
AC_MSG_ERROR([*** --enable-gl and --enable-svga can not be used together])
fi
AC_DEFINE(RENDER3D, 1, [Define if building with OpenGL support])
else
GLHEXEN="false"
fi
AC_SUBST(GLHEXEN)
AC_SUBST(SVGAHEXEN)
AC_ARG_ENABLE(rangecheck,
[AS_HELP_STRING([--enable-rangecheck], [Enable parameter validation debugging code [default=no]])],
[], [enable_rangecheck=no])
if test x$enable_rangecheck = xno; then
AC_DEFINE(NORANGECHECKING, 1, [Define to not compile most parameter validation debugging code])
fi
AC_ARG_WITH(datapath,
[AS_HELP_STRING([--with-datapath=<DIR>],[Use DIR for shared game data. Not defined by default.])],
[datapath="$withval"], [datapath=""])
AC_DEFINE_UNQUOTED(SHARED_DATAPATH, "$datapath", [Define this to the shared game directory root])
SHARED_DATAPATH="$datapath"
if test "$SVGAHEXEN" = "true"; then
default_audio="alsa"
else
default_audio="sdl"
fi
AC_ARG_WITH([audio],
[AS_HELP_STRING([--with-audio=<driver>], [If set, will change the audio driver.
Valid values are alsa, oss, sdl and sdlmixer. sdl is the default.
sdlmixer adds the ability of midi music playback.])],
[audio_drv="$withval"], [audio_drv="$default_audio"])
if test "$SVGAHEXEN" = "true"; then
case "$audio_drv" in
alsa|oss)
SND_MODULE="$audio_drv"
;;
*)
AC_MSG_ERROR([*** only alsa or oss is allowed for svga version])
;;
esac
else
case "$audio_drv" in
alsa|oss|sdl|sdlmixer)
SND_MODULE="$audio_drv"
;;
*)
AC_MSG_ERROR([*** invalid value for --with-audio])
;;
esac
fi
AC_SUBST(SND_MODULE)
dnl == Checks for programs.
AC_PROG_CC
AC_PROG_CPP
dnl == Checks for header files.
AC_CHECK_HEADERS(linux/cdrom.h sys/cdio.h sys/soundcard.h stdint.h inttypes.h strings.h)
dnl == Checks for typedefs, structures, and compiler characteristics
AC_C_CONST
AC_C_VOLATILE
AC_C_INLINE
AC_C_CHAR_UNSIGNED
AC_TYPE_SIZE_T
AC_C_BIGENDIAN
dnl == Check for gcc strength-reduce bug
if test "x${GCC}" = "xyes"; then
AC_CACHE_CHECK( [for gcc strength-reduce bug], ac_cv_c_gcc_strength_bug,
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdlib.h>
int main(void) {
static int Array[[3]];
unsigned int B = 3;
int i;
for(i=0; i<B; i++) Array[[i]] = i - 3;
exit( Array[[1]] != -2 );
}]])],
[ac_cv_c_gcc_strength_bug="no"],
[ac_cv_c_gcc_strength_bug="yes"],
[ac_cv_c_gcc_strength_bug="no"] )
)
if test "$ac_cv_c_gcc_strength_bug" = "yes"; then
CFLAGS="$CFLAGS -fno-strength-reduce"
fi
fi
dnl == Checks for library functions.
AC_PATH_X
X11_INC="$ac_x_includes"
X11_LIB="$ac_x_libraries"
AC_CHECK_LIB(m, pow,, AC_MSG_ERROR([*** math library (-lm) appears broken]))
AH_VERBATIM([_REENTRANT],
[/* For pthread support in ALSA or OSS audio code. */
#ifndef _REENTRANT
# undef _REENTRANT
#endif])
AH_VERBATIM([_THREAD_SAFE],
[/* For pthread support in ALSA or OSS audio code. */
#ifndef _THREAD_SAFE
# undef _THREAD_SAFE
#endif])
dnl == pthreads check: This is linux-centric (see the configure.in of SDL
dnl == for other systems' pthreads support), but we need this for linux only
AC_CHECK_LIB(pthread, pthread_join,
[HAVE_PTHREADS="yes";THREAD_LIBS="-lpthread";], [HAVE_PTHREADS="no";])
if test "$SND_MODULE" = "oss" || test "$SND_MODULE" = "alsa";then
if test "$HAVE_PTHREADS" = "no"; then
AC_MSG_ERROR([*** libpthread not found! (required by sound code.)])
fi
AC_DEFINE(_REENTRANT)
AC_DEFINE(_THREAD_SAFE)
fi
dnl == Check ALSA
if test "$SND_MODULE" = "alsa";then
have_alsa=no
PKG_CHECK_MODULES([ALSA], [alsa >= 1], AC_CHECK_LIB(asound, snd_pcm_open, [have_alsa=yes]), [true])
if test "$have_alsa" = "no"; then
AC_MSG_ERROR([*** alsa-lib 1.x required but not found!])
fi
fi
AC_SUBST(THREAD_LIBS)
AC_SUBST(X11_INC)
AC_SUBST(X11_LIB)
dnl == Check for SDL
SDL_VERSION="1.2.4"
AM_PATH_SDL($SDL_VERSION,[HAVESDL="yes"],[HAVESDL="no"])
if test "$SVGAHEXEN" = "false";then
AC_DEFINE(SDLHERETIC, 1, [Define if HHeretic depends on SDL])
if test "$HAVESDL" = "no"; then
AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])
fi
fi
saved_libs="$LIBS"
AC_CHECK_LIB(SDL_mixer, Mix_LoadMUS, [HAVE_SDLMIXER="yes"], [HAVE_SDLMIXER="no"], [$SDL_LIBS])
LIBS="$saved_libs"
if test "$SND_MODULE" = "sdlmixer";then
if test $HAVE_SDLMIXER = "no";then
AC_MSG_ERROR([*** SDL_mixer not found!])
else
SDL_LIBS="$SDL_LIBS -lSDL_mixer"
fi
fi
AC_SUBST(SDL_CFLAGS)
AC_SUBST(SDL_LIBS)
dnl == Check for GL libraries
case "$host" in
*-*-cygwin* | *-*-mingw32*)
GL_LIBS="-lopengl32 -lglu32"
;;
dnl FIXME: handle Mac OS X properly.
dnl *-*-darwin*)
dnl GL_LIBS=""
dnl ;;
*)
GL_LIBS="-lGL -lGLU"
;;
esac
saved_libs="$LIBS"
if test x$ac_x_libraries != x; then
LIBS="$LIBS -L$ac_x_libraries $GL_LIBS"
else
LIBS="$LIBS $GL_LIBS"
fi
AC_MSG_CHECKING(for OpenGL support)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <GL/gl.h>
#include <GL/glu.h>
]],[])],[HAVEGL="yes"],[HAVEGL="no"])
AC_MSG_RESULT($HAVEGL)
LIBS="$saved_libs"
if test "$GLHEXEN" = "true"; then
if test "$HAVEGL" = "no"; then
AC_MSG_ERROR([*** OpenGL not found!])
fi
fi
AC_SUBST(GL_LIBS)
dnl == Check for SVGALib
AC_CHECK_LIB(vga, vga_setmode, [SVGALIBS="-lvga"; HAVESVGA="yes"], [HAVESVGA="no"])
if test "$SVGAHEXEN" = "true";then
if test "$HAVESVGA" = "no"; then
AC_MSG_ERROR([*** SVGALib not found!])
fi
fi
AC_SUBST(SVGALIBS)
dnl == Generate output files
AC_CONFIG_FILES([Makefile])
AC_OUTPUT
dnl == Make a short report
echo
echo "HHeretic configuration finished."
if test "$SVGAHEXEN" = "true"; then
report="Software (SVGALib)"
else
if test "$GLHEXEN" = "true"; then
report="OpenGL (SDL)"
else
report="Software (SDL)"
fi
fi
echo "Enabled target : $report"
echo "Audio driver : $SND_MODULE"
if test x$enable_rangecheck = xno; then
report="disabled"
else
report="enabled"
fi
echo "Range checks (debug) : $report"
if test x$datapath = x; then
report="(not set)"
else
report="$datapath"
fi
echo "Shared game data path: $report"
if test "$SVGAHEXEN" = "true"; then
report="N/A"
else
if test x$enable_fullscreen = xyes; then
report="fullscreen"
else
report="windowed"
fi
fi
echo "Default window mode : $report"
echo
echo "Type 'make' to compile."
echo