-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconfigure.ac
290 lines (252 loc) · 10.7 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
dnl Process this file with autoconf to produce a configure script.
AC_INIT([prboom],[2.5.1])
AC_CONFIG_HEADER(config.h)
AC_CONFIG_AUX_DIR(autotools)
AC_CONFIG_MACRO_DIR(autotools)
m4_include([autotools/ax_prog_cc_for_build.m4])
m4_include([autotools/sdl.m4])
dnl --- Check for target system type - before initialising Automake
AC_CANONICAL_TARGET
AC_CANONICAL_BUILD
dnl --- Fire up automake
AM_INIT_AUTOMAKE([check-news foreign -Woverride -Wobsolete -Wportability -Wsyntax -Wunsupported])
ifdef([AM_SILENT_RULES],[AM_SILENT_RULES(yes)])
AM_MAINTAINER_MODE([enable])
AC_ARG_WITH(waddir,AC_HELP_STRING([--with-waddir],[Path to install prboom.wad and look for other WAD files]),
DOOMWADDIR="$withval",
if test "x$prefix" != xNONE; then
DOOMWADDIR="$prefix/share/games/doom"
else
DOOMWADDIR="$ac_default_prefix/share/games/doom"
fi
)
AC_DEFINE_UNQUOTED(DOOMWADDIR,"$DOOMWADDIR",[Define to be the path where Doom WADs are stored])
dnl --- Check for programs
AC_PROG_CC
AX_PROG_CC_FOR_BUILD
AC_PROG_LN_S
AC_PROG_RANLIB
AC_PROG_AR
AC_GNU_SOURCE
if test "x$GCC" = "xyes"; then
AC_DEFINE(PACKEDATTR,[__attribute__((packed))],[Set to the attribute to apply to struct definitions to make them packed])
else
AC_DEFINE(PACKEDATTR,[])
echo "-!- Your compiler is not gcc. We probably don't know how to force"
echo ' structures to be packed with your compiler. You may have to edit'
echo ' the source to insert the relevant pragmas so structures are packed.'
fi
dnl Put a plausible default for CC_FOR_BUILD in Makefile.in
if test -z "$CC_FOR_BUILD"; then
CC_FOR_BUILD=gcc
fi
AC_SUBST(CC_FOR_BUILD)
dnl --- cph: work out flags to pass to compiler
CFLAGS_OPT="-O2 -fomit-frame-pointer"
AC_C_COMPILE_FLAGS(-Wall -Wextra -Wno-missing-field-initializers -Wwrite-strings -Wundef -Wbad-function-cast -Wcast-align -Wcast-qual -Wdeclaration-after-statement -Wpointer-arith)
dnl --- Option to enable debugging
AC_ARG_ENABLE(debug,AC_HELP_STRING([--enable-debug],[turns on various debugging features, like range checking and internal heap diagnostics]),,enable_debug="no")
if test "$enable_debug" = "no"
then
AC_C_COMPILE_FLAGS(-Wno-unused -Wno-switch -Wno-sign-compare -Wno-pointer-sign)
else
CFLAGS_OPT="-g"
AC_C_COMPILE_FLAGS(-Wmissing-noreturn -Wredundant-decls -Wnested-externs -Wold-style-definition -Wmissing-declarations -Wmissing-format-attribute -Wvariadic-macros -Wdisabled-optimization -Wlarger-than-128000 -Waggregate-return -Wvolatile-register-var -Winline)
AC_DEFINE(RANGECHECK,1,[Define to enable internal range checking])
AC_DEFINE(INSTRUMENTED,1,[Define this to see real-time memory allocation statistics, and enable extra debugging features])
AC_DEFINE(TIMEDIAG,1,[Defining this causes time stamps to be created each time a lump is locked, and lumps locked for long periods of time are reported])
fi
AC_ARG_ENABLE(profile,AC_HELP_STRING([--enable-profile],[turns on profiling]),,enable_profile="no")
if test "$enable_profile" = "yes"
then
CFLAGS_OPT="-pg"
fi
AM_WITH_DMALLOC
dnl --- Try for processor optimisations
AC_CPU_OPTIMISATIONS
dnl --- some defaults for CFLAGS
AC_C_COMPILE_FLAGS($CFLAGS_OPT)
dnl -Wmissing-prototypes -Wmissing-declarations
CFLAGS="$CFLAGS -I\$(top_srcdir)/src"
dnl --- Compiler characteristics
AC_C_CONST
AC_C_INLINE
if test "$cross_compiling" != "yes"; then
AC_C_BIGENDIAN
fi
dnl --- Header files, typedefs, structures
AC_TYPE_UID_T
AC_TYPE_SIZE_T
AC_DECL_SYS_SIGLIST
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(unistd.h asm/byteorder.h sched.h)
dnl --- Library functions
AC_CHECK_FUNC(stricmp,,AC_DEFINE(stricmp,strcasecmp,[Define to strcasecmp, if we have it]))
AC_CHECK_FUNC(strnicmp,,AC_DEFINE(strnicmp,strncasecmp,[Define to strncasecmp, if we have it]))
AC_CHECK_FUNC(min,AC_DEFINE(MIN,min,[If your platform has a fast version of min, define MIN to it]),)
AC_CHECK_FUNC(max,AC_DEFINE(MAX,max,[If your platform has a fast version of max, define MAX to it]),)
AC_CHECK_FUNCS(getopt inet_aton inet_pton inet_ntop mmap usleep sched_setaffinity strlwr)
dnl --- Check for libraries
dnl --- cph: we need pow(3) in SDL/i_sound.c; on some systems it gets pulled
dnl --- in by other libraries, but we can't rely on that.
AC_CHECK_LIB(m,pow)
dnl - system specific stuff
dnl - GL
AC_ARG_ENABLE(gl,AC_HELP_STRING([--disable-gl],[disable OpenGL rendering code]),,enable_gl="yes")
AC_ARG_ENABLE(sdl,AC_HELP_STRING([--disable-sdl],[Do not use SDL even if available]),, [enable_sdl="yes"])
dnl - platform, for use with game console ports
AC_ARG_WITH([platform],
AC_HELP_STRING([--with-platform],[build for specific platform]),
[], [with_platform=default])
case "$host" in
*-*-cygwin* | *-*-mingw32*)
SYS_GL_LIBS="-lopengl32 -lglu32"
;;
*-*-beos*)
SYS_GL_LIBS="-lGL -lGLU"
;;
*-*-aix*)
if test x$ac_cv_prog_gcc = xyes; then
CFLAGS="$CFLAGS -mthreads"
fi
;;
arm-*-eabi*)
enable_sdl=no
enable_gl=no
if test x$with_platform = x3ds; then
CFLAGS="$CFLAGS -ffunction-sections -fdata-sections -march=armv6k -mtune=mpcore -mfloat-abi=hard -mword-relocations"
LDFLAGS="$LDFLAGS -march=armv6k -mtune=mpcore -mfloat-abi=hard -specs=3dsx.specs -Wl,-Map,prboom.map"
fi
if test x$with_platform = xnds; then
CFLAGS="$CFLAGS -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s"
LDFLAGS="$LDFLAGS -marm -mthumb-interwork -march=armv5te -mtune=arm946e-s -specs=ds_arm9.specs -Wl,-Map,prboom.map"
fi
;;
*)
SYS_GL_LIBS="-lGL -lGLU"
;;
esac
dnl check GL libraries
AM_CONDITIONAL(BUILD_GL,test "$enable_gl" = "yes")
if test "$enable_gl" = "yes"
then
AC_MSG_CHECKING(for OpenGL support)
have_opengl=no
AC_TRY_COMPILE([
#include <GL/gl.h>
],[
],[
have_opengl=yes
])
AC_MSG_RESULT($have_opengl)
if test x$have_opengl = xyes; then
AC_DEFINE(GL_DOOM,1,[Define if you are building with OpenGL support])
AC_DEFINE(USE_GLU_IMAGESCALE,1,[Define if you want to use gluImageScale])
AC_DEFINE(USE_GLU_MIPMAP,1,[Define if you want to use gluBuild2DMipmaps])
GL_LIBS="$SYS_GL_LIBS"
else
AC_MSG_ERROR([You must have the relevant OpenGL development libraries & headers installed to compile with OpenGL support])
fi
fi
dnl check sdl libraries
CheckSDL()
{
AM_PATH_SDL(1.1.3, sdl_main="yes")
if test "$sdl_main" != "yes"
then
AC_MSG_ERROR([*** You must have the SDL libraries installed before you can compile prboom
*** See http://prboom.sourceforge.net/linux.html ])
fi
savelibs="$LIBS"
LIBS="$LIBS $SDL_LIBS"
AC_CHECK_FUNCS(SDL_JoystickGetAxis)
LIBS="$savelibs"
AC_ARG_WITH([mixer],
AC_HELP_STRING([--without-mixer],[Do not use SDL_mixer even if available]),
[], [with_mixer=yes])
AS_IF([test "x$with_mixer" != xno],
AC_CHECK_LIB(SDL_mixer,Mix_OpenAudio,[],[],[$SDL_LIBS $MIXER_LIBS]))
AC_ARG_WITH(net,
AS_HELP_STRING([--without-net],[Do not use SDL_net even if available]),
[], [with_net=yes])
AS_IF([test "x$with_net" = xno],
[
dnl -- Networking was disabled by the user.
NET_LIBS=
],[
dnl -- Check for networking support
AC_CHECK_LIB(SDL_net,SDLNet_UDP_Bind,[
AC_DEFINE(HAVE_NET,1,[Define if you want network game support])
AC_DEFINE(HAVE_LIBSDL_NET,1,
[Define if you have the SDL net library -lSDL_net])
AC_DEFINE(USE_SDL_NET,1,[Define if you want to use the SDL net lib])
NET_LIBS=-lSDL_net
sdl_net=yes
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $SDL_CFLAGS"
AC_TRY_COMPILE([
#include "SDL_net.h"
],[
UDPpacket *p;
int n = sizeof(p->src);
],
AC_DEFINE(SDL_NET_UDP_PACKET_SRC,1,[Define if you have an old SDL_net, such that the UDPpacket structure has a src member instead of an address member]))
CFLAGS="$save_CFLAGS"
],[
dnl -- Warn if networking support was not disabled but sdlnet is missing
AC_MSG_WARN([*** SDL networking library not found. The game will not be compiled with network game support.])
],$SDL_LIBS)
])
}
AS_IF([test "x$enable_sdl" = xno],
[
dnl -- sdl was disabled by the user
],[
CheckSDL
])
AM_CONDITIONAL(BUILD_SERVER, [test "$sdl_net" = "yes"])
AM_CONDITIONAL(BUILD_SDL, [test "$enable_sdl" = "yes"])
AM_CONDITIONAL(BUILD_3DS, [test "$with_platform" = "3ds"])
AM_CONDITIONAL(BUILD_NDS, [test "$with_platform" = "nds"])
dnl - Other libs
AC_ARG_WITH([png], AC_HELP_STRING([--without-png], [Do not use libpng even if available]),,with_png=yes)
AS_IF([test "x$with_png" != xno],AC_CHECK_LIB(png,png_create_info_struct))
AC_EGREP_HEADER(sockaddr_in6,netinet/in.h,AC_DEFINE(HAVE_IPv6,1,[Define if you have struct sockaddr_in6]))
dnl --- Options
dnl - Always use highres mode and basic checks - anyone that wants these off can edit the config.h
AC_DEFINE(HIGHRES,1,[Define for high resolution support])
AC_DEFINE(SIMPLECHECKS,1,[When defined this causes quick checks which only impose significant overhead if a posible error is detected.])
AC_DEFINE(ZONEIDCHECK,1,[Define this to perform id checks on zone blocks, to detect corrupted and illegally freed blocks])
AC_ARG_ENABLE(nonfree-graphics,
AC_HELP_STRING([--disable-nonfree-graphics],
[build prboom.wad without non-free menu text lumps]),
[], [enable_nonfree_graphics="yes"])
AS_IF([test -f "$srcdir"/data/graphics/m_generl.ppm],
[], [enable_nonfree_graphics="no"])
AM_CONDITIONAL(NONFREE_GRAPHICS, [test "x$enable_nonfree_graphics" = "xyes"])
AC_ARG_ENABLE(dogs,AC_HELP_STRING([--disable-dogs],[disables support for helper dogs]),,enable_dogs="yes")
if test x"$enable_dogs" = xyes
then
AC_DEFINE(DOGS,1,[Define for support for MBF helper dogs])
fi
AC_ARG_ENABLE(heapcheck,AC_HELP_STRING([--enable-heapcheck],[turns on continuous heap checking (very slow)]),,enable_heapcheck="no")
AC_ARG_ENABLE(heapdump,AC_HELP_STRING([--enable-heapdump],[turns on dumping the heap state for debugging]),,enable_heapdump="no")
if test "$enable_heapcheck" = "yes"
then
AC_DEFINE(CHECKHEAP,1,[Uncomment this to exhaustively run memory checks while the game is running (this is EXTREMELY slow).])
fi
if test "$enable_heapdump" = "yes"
then
AC_DEFINE(HEAPDUMP,1,[Uncomment this to cause heap dumps to be generated. Only useful if INSTRUMENTED is also defined.])
fi
AM_CONDITIONAL(WAD_MMAP,test "$ac_cv_func_mmap" = yes)
AC_SUBST(MIXER_CFLAGS)
AC_SUBST(MIXER_LIBS)
AC_SUBST(NET_CFLAGS)
AC_SUBST(NET_LIBS)
AC_SUBST(MATH_LIB)
AC_SUBST(GL_LIBS)
AC_SUBST(CFLAGS)
AC_SUBST(DOOMWADDIR)
dnl --- output
AC_OUTPUT(Makefile src/Makefile src/POSIX/Makefile src/NDS/Makefile src/3DS/Makefile src/SDL/Makefile src/MAC/Makefile doc/Makefile data/Makefile ICONS/Makefile VisualC6/Makefile VisualC8/Makefile prboom.spec)