configure.ac 11 KB

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