1dnl Process this file with autoconf to produce a configure script. 2AC_INIT([PrBoom-Plus],[2.5.1.3],[],[prboom-plus]) 3 4AC_CONFIG_HEADER(config.h) 5AC_CONFIG_AUX_DIR(autotools) 6AC_CONFIG_MACRO_DIR(autotools) 7 8dnl --- Check for target system type - before initialising Automake 9AC_CANONICAL_TARGET 10 11dnl --- Fire up automake 12AM_INIT_AUTOMAKE([foreign -Woverride -Wobsolete -Wportability -Wsyntax -Wunsupported]) 13ifdef([AM_SILENT_RULES],[AM_SILENT_RULES(yes)]) 14AM_MAINTAINER_MODE([enable]) 15 16AC_ARG_WITH(waddir,AC_HELP_STRING([--with-waddir],[Path to install prboom.wad and look for other WAD files]), 17DOOMWADDIR="$withval", 18if test "x$prefix" != xNONE; then 19 DOOMWADDIR="$prefix/share/games/doom" 20else 21 DOOMWADDIR="$ac_default_prefix/share/games/doom" 22fi 23) 24AC_DEFINE_UNQUOTED(DOOMWADDIR,"$DOOMWADDIR",[Define to be the path where Doom WADs are stored]) 25 26dnl --- Check for programs 27AC_PROG_CC 28AC_PROG_LN_S 29AC_PROG_RANLIB 30AC_GNU_SOURCE 31 32if test "x$GCC" = "xyes"; then 33 AC_DEFINE(PACKEDATTR,[__attribute__((packed))],[Set to the attribute to apply to struct definitions to make them packed]) 34else 35 AC_DEFINE(PACKEDATTR,[]) 36 echo "-!- Your compiler is not gcc. We probably don't know how to force" 37 echo ' structures to be packed with your compiler. You may have to edit' 38 echo ' the source to insert the relevant pragmas so structures are packed.' 39fi 40 41dnl --- cph: work out flags to pass to compiler 42CFLAGS_OPT="-O2 -fomit-frame-pointer" 43AC_C_COMPILE_FLAGS(-Wall -Wextra -Wno-missing-field-initializers -Wwrite-strings -Wundef -Wbad-function-cast -Wcast-align -Wcast-qual -Wdeclaration-after-statement -Wpointer-arith -ffast-math) 44dnl --- Option to enable debugging 45AC_ARG_ENABLE(debug,AC_HELP_STRING([--enable-debug],[turns on various debugging features, like range checking and internal heap diagnostics]),,enable_debug="no") 46if test "$enable_debug" = "no" 47then 48 AC_C_COMPILE_FLAGS(-Wno-unused -Wno-switch -Wno-sign-compare -Wno-pointer-sign) 49else 50 CFLAGS_OPT="-g" 51 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) 52 AC_DEFINE(RANGECHECK,1,[Define to enable internal range checking]) 53 AC_DEFINE(INSTRUMENTED,1,[Define this to see real-time memory allocation statistics, and enable extra debugging features]) 54 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]) 55fi 56AC_ARG_ENABLE(profile,AC_HELP_STRING([--enable-profile],[turns on profiling]),,enable_profile="no") 57if test "$enable_profile" = "yes" 58then 59 CFLAGS_OPT="-pg" 60fi 61AM_WITH_DMALLOC 62 63dnl --- Try for processor optimisations 64AC_CPU_OPTIMISATIONS 65 66dnl --- some defaults for CFLAGS 67AC_C_COMPILE_FLAGS($CFLAGS_OPT) 68dnl -Wmissing-prototypes -Wmissing-declarations 69CFLAGS="$CFLAGS -I\$(top_srcdir)/src" 70 71dnl --- Compiler characteristics 72AC_C_CONST 73AC_C_INLINE 74if test "$cross_compiling" != "yes"; then 75 AC_C_BIGENDIAN 76fi 77 78dnl --- Header files, typedefs, structures 79AC_TYPE_UID_T 80AC_TYPE_SIZE_T 81AC_DECL_SYS_SIGLIST 82AC_HEADER_SYS_WAIT 83AC_CHECK_HEADERS(unistd.h asm/byteorder.h sched.h) 84 85dnl --- Library functions 86AC_CHECK_FUNC(stricmp,,AC_DEFINE(stricmp,strcasecmp,[Define to strcasecmp, if we have it])) 87AC_CHECK_FUNC(strnicmp,,AC_DEFINE(strnicmp,strncasecmp,[Define to strncasecmp, if we have it])) 88AC_CHECK_FUNC(min,AC_DEFINE(MIN,min,[If your platform has a fast version of min, define MIN to it]),) 89AC_CHECK_FUNC(max,AC_DEFINE(MAX,max,[If your platform has a fast version of max, define MAX to it]),) 90AC_CHECK_FUNCS(getopt inet_aton inet_pton inet_ntop snprintf vsnprintf mmap usleep sched_setaffinity) 91 92dnl --- Check for libraries 93dnl --- cph: we need pow(3) in SDL/i_sound.c; on some systems it gets pulled 94dnl --- in by other libraries, but we can't rely on that. 95AC_CHECK_LIB(m,pow) 96dnl - system specific stuff 97dnl - winmm for the midi volume hack 98case "$target" in 99 *-*-cygwin* | *-*-mingw32*) 100 SYS_GL_LIBS="-lopengl32 -lglu32" 101 LIBS="-lwinmm $LIBS" 102 ;; 103 *-*-beos*) 104 SYS_GL_LIBS="-lGL -lGLU" 105 ;; 106 *-*-aix*) 107 if test x$ac_cv_prog_gcc = xyes; then 108 CFLAGS="$CFLAGS -mthreads" 109 fi 110 ;; 111 *) 112 SYS_GL_LIBS="-lGL -lGLU" 113 ;; 114esac 115 116dnl - GL 117AC_ARG_ENABLE(gl,AC_HELP_STRING([--disable-gl],[disable OpenGL rendering code]),,enable_gl="yes") 118if test "$enable_gl" = "yes" 119then 120 AC_MSG_CHECKING(for OpenGL support) 121 have_opengl=no 122 AC_TRY_COMPILE([ 123 #include <GL/gl.h> 124 ],[ 125 ],[ 126 have_opengl=yes 127 ]) 128 AC_MSG_RESULT($have_opengl) 129 if test x$have_opengl = xyes; then 130 AC_DEFINE(GL_DOOM,1,[Define if you are building with OpenGL support]) 131 AC_DEFINE(USE_GLU_IMAGESCALE,1,[Define if you want to use gluImageScale]) 132 AC_DEFINE(USE_GLU_MIPMAP,1,[Define if you want to use gluBuild2DMipmaps]) 133 AC_DEFINE(USE_GLU_TESS,1,[Define if you want to use the gluTesselator]) 134 GL_LIBS="$SYS_GL_LIBS" 135 else 136 AC_MSG_ERROR([You must have the relevant OpenGL development libraries & headers installed to compile with OpenGL support]) 137 fi 138fi 139AM_CONDITIONAL(BUILD_GL,test "$enable_gl" = "yes") 140 141dnl - SDL 142AM_PATH_SDL(1.1.3, sdl_main="yes") 143if test "$sdl_main" != "yes" 144then 145 AC_MSG_ERROR([*** You must have the SDL libraries installed before you can compile prboom 146 *** See http://prboom.sourceforge.net/linux.html 147 ]) 148fi 149 150savelibs="$LIBS" 151LIBS="$LIBS $SDL_LIBS" 152AC_CHECK_FUNCS(SDL_JoystickGetAxis) 153LIBS="$savelibs" 154 155AC_ARG_WITH([mixer], 156 AC_HELP_STRING([--without-mixer],[Do not use SDL_mixer even if available]), 157 [], [with_mixer=yes]) 158AS_IF([test "x$with_mixer" != xno], 159 AC_CHECK_LIB(SDL_mixer,Mix_OpenAudio,[],[],[$SDL_LIBS $MIXER_LIBS])) 160 161AC_ARG_WITH(net, 162 AS_HELP_STRING([--without-net],[Do not use SDL_net even if available]), 163 [], [with_net=yes]) 164AS_IF([test "x$with_net" = xno], 165 [ 166 dnl -- Networking was disabled by the user. 167 NET_LIBS= 168 ],[ 169 dnl -- Check for networking support 170 AC_CHECK_LIB(SDL_net,SDLNet_UDP_Bind,[ 171 AC_DEFINE(HAVE_NET,1,[Define if you want network game support]) 172 AC_DEFINE(HAVE_LIBSDL_NET,1, 173 [Define if you have the SDL net library -lSDL_net]) 174 AC_DEFINE(USE_SDL_NET,1,[Define if you want to use the SDL net lib]) 175 NET_LIBS=-lSDL_net 176 sdl_net=yes 177 save_CFLAGS="$CFLAGS" 178 CFLAGS="$CFLAGS $SDL_CFLAGS" 179 AC_TRY_COMPILE([ 180 #include "SDL_net.h" 181 ],[ 182 UDPpacket *p; 183 int n = sizeof(p->src); 184 ], 185 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])) 186 CFLAGS="$save_CFLAGS" 187 ],[ 188 dnl -- Warn if networking support was not disabled but sdlnet is missing 189 AC_MSG_WARN([*** SDL networking library not found. The game will not be compiled with network game support.]) 190 ],$SDL_LIBS) 191 ]) 192AM_CONDITIONAL(BUILD_SERVER, [test "$sdl_net" = "yes"]) 193 194dnl -- PCRE 195AC_ARG_WITH(pcre, 196 [AS_HELP_STRING([--without-pcre],[Do not compile with libpcre])],, 197 [with_pcre=yes]) 198AS_IF([test "x$with_pcre" != xno], 199 [AC_CHECK_LIB(pcreposix,pcreposix_regcomp)] 200) 201 202dnl individual sound libraries 203 204AC_ARG_WITH([mad], 205 AC_HELP_STRING([--without-mad],[Do not use MAD mp3 library even when available]), 206 [], [with_mad=yes]) 207AS_IF([test "x$with_mad" != xno], 208 AC_CHECK_LIB(mad,mad_stream_init)) 209 210AC_ARG_WITH([fluidsynth], 211 AC_HELP_STRING([--without-fluidsynth],[Do not use fluidsynth library even when available]), 212 [], [with_fluidsynth=yes]) 213AS_IF([test "x$with_fluidsynth" != xno], 214 AC_CHECK_LIB(fluidsynth,new_fluid_synth)) 215 216AC_ARG_WITH([dumb], 217 AC_HELP_STRING([--without-dumb],[Do not use dumb tracker library even when available]), 218 [], [with_dumb=yes]) 219AS_IF([test "x$with_dumb" != xno], 220 AC_CHECK_LIB(dumb,dumbfile_open)) 221 222AC_ARG_WITH([vorbisfile], 223 AC_HELP_STRING([--without-vorbisfile],[Do not use vorbisfile library even when available]), 224 [], [with_vorbisfile=yes]) 225AS_IF([test "x$with_vorbisfile" != xno], 226 AC_CHECK_LIB(vorbisfile,ov_test_callbacks,[],[],[-logg -lvorbis])) 227 228dnl on some platforms, porttime is a seperate lib. ackk 229AC_ARG_WITH([portmidi], 230 AC_HELP_STRING([--without-portmidi],[Do not use portmidi library even when available]), 231 [], [with_portmidi=yes]) 232AS_IF([test "x$with_portmidi" != xno], 233 AC_CHECK_LIB(porttime,Pt_Time,LIBS="-lporttime $LIBS") 234 AC_CHECK_LIB(portmidi,Pm_OpenInput)) 235 236dnl - SDL_image 237AC_ARG_WITH(image, 238 [AS_HELP_STRING([--without-image],[Do not use SDL_image even if available])],, 239 [with_image=yes]) 240AS_IF([test "x$with_image" != xno], 241 AC_CHECK_LIB(SDL_image,IMG_Load)) 242 243dnl - libpng 244AC_ARG_WITH([png], AC_HELP_STRING([--without-png], [Do not use libpng even if available]),,with_png=yes) 245AS_IF([test "x$with_png" != xno],AC_CHECK_LIB(png,png_create_info_struct)) 246 247AC_EGREP_HEADER(sockaddr_in6,netinet/in.h,AC_DEFINE(HAVE_IPv6,1,[Define if you have struct sockaddr_in6])) 248 249dnl --- Options 250dnl - Always use highres mode and basic checks - anyone that wants these off can edit the config.h 251AC_DEFINE(HIGHRES,1,[Define for high resolution support]) 252AC_DEFINE(SIMPLECHECKS,1,[When defined this causes quick checks which only impose significant overhead if a posible error is detected.]) 253AC_DEFINE(ZONEIDCHECK,1,[Define this to perform id checks on zone blocks, to detect corrupted and illegally freed blocks]) 254 255AC_ARG_ENABLE(dogs,AC_HELP_STRING([--disable-dogs],[disables support for helper dogs]),,enable_dogs="yes") 256if test x"$enable_dogs" = xyes 257then 258 AC_DEFINE(DOGS,1,[Define for support for MBF helper dogs]) 259fi 260 261AC_ARG_ENABLE(heapcheck,AC_HELP_STRING([--enable-heapcheck],[turns on continuous heap checking (very slow)]),,enable_heapcheck="no") 262AC_ARG_ENABLE(heapdump,AC_HELP_STRING([--enable-heapdump],[turns on dumping the heap state for debugging]),,enable_heapdump="no") 263if test "$enable_heapcheck" = "yes" 264then 265 AC_DEFINE(CHECKHEAP,1,[Uncomment this to exhaustively run memory checks while the game is running (this is EXTREMELY slow).]) 266fi 267if test "$enable_heapdump" = "yes" 268then 269 AC_DEFINE(HEAPDUMP,1,[Uncomment this to cause heap dumps to be generated. Only useful if INSTRUMENTED is also defined.]) 270fi 271 272AM_CONDITIONAL(WAD_MMAP,test "$ac_cv_func_mmap" = yes) 273AC_SUBST(MIXER_CFLAGS) 274AC_SUBST(MIXER_LIBS) 275AC_SUBST(NET_CFLAGS) 276AC_SUBST(NET_LIBS) 277AC_SUBST(MATH_LIB) 278AC_SUBST(GL_LIBS) 279AC_SUBST(CFLAGS) 280AC_SUBST(DOOMWADDIR) 281 282dnl --- output 283AC_OUTPUT(Makefile src/Makefile src/POSIX/Makefile src/SDL/Makefile src/MAC/Makefile src/PCSOUND/Makefile src/TEXTSCREEN/Makefile src/MUSIC/Makefile doc/Makefile data/Makefile ICONS/Makefile VisualC6/Makefile VisualC8/Makefile VisualC9/Makefile prboom.spec) 284