-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
326 lines (288 loc) · 11.4 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
324
325
326
dnl Process this file with autoconf to produce a configure script.
AC_INIT([xdre],[2.17],[],[xdre])
AC_CONFIG_HEADER(config.h)
AC_CONFIG_AUX_DIR(autotools)
AC_CONFIG_MACRO_DIR(autotools)
dnl --- Check for target system type - before initialising Automake
AC_CANONICAL_TARGET
dnl --- Fire up automake
AM_INIT_AUTOMAKE([foreign -Woverride -Wobsolete -Wportability -Wsyntax -Wunsupported])
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
AC_PROG_CXX
AC_PROG_LN_S
AC_PROG_RANLIB
AC_GNU_SOURCE
if test "x$GCC" = "xyes"; then
AC_DEFINE(PACKEDATTR,[__attribute__((gcc_struct, 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 --- cph: work out flags to pass to compiler
CFLAGS_OPT=""
AC_C_COMPILE_FLAGS(-Wall -Wextra -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 -Wmissing-declarations -Wmissing-format-attribute -Wvariadic-macros -Wdisabled-optimization -Wlarger-than-128000 -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])
AC_DEFINE(XDRE_DEBUG,1,[Define this for xdre debugging])
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/prboom-plus/src"
CXXFLAGS="$CXXFLAGS $CFLAGS"
CXXFLAGS=${CXXFLAGS//-Wbad-function-cast/}
CXXFLAGS=${CXXFLAGS//-Wdeclaration-after-statement/}
CXXFLAGS=${CXXFLAGS//-Wno-pointer-sign/}
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)
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 - winmm for the midi volume hack
case "$target" in
*-*-cygwin* | *-*-mingw32*)
SYS_GL_LIBS="-lopengl32 -lglu32"
LIBS="-lwinmm $LIBS"
;;
*-*-beos*)
SYS_GL_LIBS="-lGL -lGLU"
;;
*-*-aix*)
if test x$ac_cv_prog_gcc = xyes; then
CFLAGS="$CFLAGS -mthreads"
fi
;;
*)
SYS_GL_LIBS="-lGL -lGLU"
;;
esac
dnl - GL
AC_ARG_ENABLE(gl,AC_HELP_STRING([--enable-gl],[enable OpenGL rendering code]),,enable_gl="no")
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])
AC_DEFINE(USE_GLU_TESS,1,[Define if you want to use the gluTesselator])
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
AM_CONDITIONAL(BUILD_GL,test "$enable_gl" = "yes")
dnl - SDL
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([--with-mixer],[Use SDL_mixer]),
[], [with_mixer=no])
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([--with-net],[Use SDL_net]),
[], [with_net=no])
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)
])
AM_CONDITIONAL(BUILD_SERVER, [false])
dnl -- PCRE
AC_ARG_WITH(pcre,
[AS_HELP_STRING([--with-pcre],[Compile with libpcre])],,
[with_pcre=no])
AS_IF([test "x$with_pcre" != xno],
[AC_CHECK_LIB(pcreposix,pcreposix_regcomp)]
)
dnl individual sound libraries
AC_ARG_WITH([mad],
AC_HELP_STRING([--with-mad],[Use MAD mp3 library]),
[], [with_mad=no])
AS_IF([test "x$with_mad" != xno],
AC_CHECK_LIB(mad,mad_stream_init))
AC_ARG_WITH([fluidsynth],
AC_HELP_STRING([--with-fluidsynth],[Use fluidsynth library]),
[], [with_fluidsynth=no])
AS_IF([test "x$with_fluidsynth" != xno],
AC_CHECK_LIB(fluidsynth,new_fluid_synth))
AC_ARG_WITH([dumb],
AC_HELP_STRING([--with-dumb],[Use dumb tracker library]),
[], [with_dumb=no])
AS_IF([test "x$with_dumb" != xno],
AC_CHECK_LIB(dumb,dumbfile_open))
AC_ARG_WITH([vorbisfile],
AC_HELP_STRING([--with-vorbisfile],[Use vorbisfile library]),
[], [with_vorbisfile=no])
AS_IF([test "x$with_vorbisfile" != xno],
AC_CHECK_LIB(vorbisfile,ov_test_callbacks,[],[],[-logg -lvorbis]))
dnl on some platforms, porttime is a seperate lib. ackk
AC_ARG_WITH([portmidi],
AC_HELP_STRING([--with-portmidi],[Use portmidi library]),
[], [with_portmidi=no])
AS_IF([test "x$with_portmidi" != xno],
AC_CHECK_LIB(porttime,Pt_Time,LIBS="-lporttime $LIBS")
AC_CHECK_LIB(portmidi,Pm_OpenInput))
dnl - SDL_image
AC_ARG_WITH(image,
[AS_HELP_STRING([--with-image],[Use SDL_image])],,
[with_image=no])
AS_IF([test "x$with_image" != xno],
AC_CHECK_LIB(SDL_image,IMG_Load))
dnl - libpng
AC_ARG_WITH([png], AC_HELP_STRING([--with-png], [Use libpng]),,with_png=no)
AS_IF([test "x$with_png" != xno],AC_CHECK_LIB(png,png_create_info_struct))
dnl - wxWidgets
AM_OPTIONS_WXCONFIG
reqwx=3.0.0
if test "$cross_compiling" = "yes"; then
AM_PATH_WXCONFIG([$reqwx], [wxWin=1], [wxWin=0], [core base], [--static])
else
AM_PATH_WXCONFIG([$reqwx], [wxWin=1], [wxWin=0], [core base])
fi
if test "$wxWin" != 1; then
AC_MSG_ERROR([
wxWidgets must be installed on your system.
Please check that wx-config is in path, the directory
where wxWidgets libraries are installed (returned by
'wx-config --libs' or 'wx-config --static --libs' command)
is in LD_LIBRARY_PATH or equivalent variable and
wxWidgets version is $reqwx or above.
])
fi
dnl AM_PATH_WXCONFIG seems bugged, so let's do libs manually if not cross compiling
if test ! "$cross_compiling" = "yes"; then
WX_LIBS="$($WX_CONFIG_PATH --libs core,base)"
fi
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
AM_CONDITIONAL(DOGS, [test "x$enable_dogs" = "xyes"])
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(CXXFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(DOOMWADDIR)
dnl --- output
AC_CONFIG_SUBDIRS([src/prboom-plus])
AC_OUTPUT([Makefile] [src/Makefile] [codeblocks/Makefile])