dnl Process this file with autoconf to produce a configure script. AC_INIT(src/d_main.c) AC_CONFIG_AUX_DIR(autotools) dnl --- Set version strings PR_MAJOR_VERSION=2 PR_MINOR_VERSION=2 PR_MICRO_VERSION=6 PR_VERSION=$PR_MAJOR_VERSION.$PR_MINOR_VERSION.$PR_MICRO_VERSION AC_SUBST(PR_VERSION) dnl --- Check for system type AC_CANONICAL_SYSTEM use_i386_asm=no case "$target" in i?86-*) use_i386_asm=yes ;; esac AC_ARG_ENABLE(i386-asm,[ --disable-i386-asm Do not use i386 assembly], use_i386_asm=no) echo "checking whether to use x86 asm versions of some functions..." $use_i386_asm if test "$use_i386_asm" = yes; then AC_DEFINE(I386_ASM) fi dnl --- Fire up automake AM_INIT_AUTOMAKE(prboom,$PR_VERSION) AM_CONFIG_HEADER(config.h) 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") dnl --- Check for programs AC_PROG_CC AC_PROG_LN_S AC_PROG_RANLIB if test "x$GCC" = "xyes"; then AC_DEFINE(PACKEDATTR,[__attribute__((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="-O2 -fomit-frame-pointer" dnl --- Option to enable debugging AC_ARG_ENABLE(debug,[ --enable-debug turns on various debugging features, like range checking and internal heap diagnostics], AC_ARG_ENABLE(dmalloc,[ --enable-dmalloc use the dmalloc heap debug library],AC_CHECK_LIB(dmalloc,malloc)) AC_DEFINE(RANGECHECK) AC_DEFINE(INSTRUMENTED) AC_DEFINE(TIMEDIAG) CFLAGS_OPT="-g" ) AC_ARG_ENABLE(profile,[ --enable-profile turns on profiling], CFLAGS_OPT="-pg" ) dnl --- Try for processor optimisations AC_CPU_OPTIMISATIONS dnl --- some defaults for CFLAGS AC_C_COMPILE_FLAGS(-Wall -Winline -Wwrite-strings -ffast-math $CFLAGS_OPT $CPU_CFLAGS) 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 linux/joystick.h) dnl --- Library functions AC_CHECK_FUNC(stricmp,,AC_DEFINE(stricmp,strcasecmp)) AC_CHECK_FUNC(strnicmp,,AC_DEFINE(strnicmp,strncasecmp)) AC_CHECK_FUNCS(getopt inet_aton inet_pton inet_ntop snprintf vsnprintf) 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, ubt we can't rely on that. AC_CHECK_LIB(m,pow) dnl - system specific stuff case "$target" in *-*-cygwin* | *-*-mingw32*) SYS_GL_LIBS="-lopengl32" ;; *-*-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 - find paths necessary for X libs, because the GL stuff is sometimes dnl stored under the X dirs AC_PATH_XTRA CFLAGS="$CFLAGS $X_CFLAGS" LDFLAGS="$LDFLAGS $X_LIBS" dnl - GL AC_ARG_ENABLE(gl,[ --enable-gl enable GL code], AC_MSG_CHECKING(for OpenGL support) have_opengl=no AC_TRY_COMPILE([ #include ],[ ],[ have_opengl=yes ]) AC_MSG_RESULT($have_opengl) if test x$have_opengl = xyes; then AC_DEFINE(GL_DOOM) AC_DEFINE(USE_GLU_IMAGESCALE) AC_DEFINE(USE_GLU_MIPMAP) GL_LIBS="$SYS_GL_LIBS" else GL_LIBS="" fi, enable_gl="no" ) AM_CONDITIONAL(BUILD_GL,test "$enable_gl" = "yes") dnl - SDL AM_PATH_SDL(1.1.3, BUILD_SDLDOOM=prboom, BUILD_SDLDOOM=) savelibs="$LIBS" LIBS="$LIBS $SDL_LIBS" AC_CHECK_FUNCS(SDL_JoystickGetAxis) LIBS="$savelibs" AC_CHECK_LIB(SDL_mixer,Mix_LoadMUS,[ AC_DEFINE(HAVE_LIBSDL_MIXER) MIXER_LIBS="$MIXER_LIBS -lSDL_mixer" ],echo "*** Compiling without SDL_mixer installed probably won't work" ,$SDL_LIBS $MIXER_LIBS) AC_CHECK_LIB(SDL_net,SDLNet_UDP_Bind,[ AC_DEFINE(HAVE_LIBSDL_NET) AC_DEFINE(USE_SDL_NET) NET_LIBS=-lSDL_net has_net=yes sdl_net=yes BUILD_SERVER=prboom-game-server 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)) CFLAGS="$save_CFLAGS" ],,$SDL_LIBS) if test "$BUILD_SDLDOOM" != "prboom" || test "$sdl_net" != 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 dnl - Net AC_CHECK_FUNC(socket,[ has_net=yes BUILD_SERVER=prboom-game-server ],BUILD_SERVER=) if test "$has_net" = yes then AC_DEFINE(HAVE_NET) fi AC_EGREP_HEADER(sockaddr_in6,netinet/in.h,AC_DEFINE(HAVE_IPv6)) dnl --- Options dnl - Always use highres mode, unless explicitely --disabled AC_ARG_ENABLE(highres,[ --disable-highres disables support for resulutions greater than 320x200],,AC_DEFINE(HIGHRES)) AC_ARG_ENABLE(dogs,[ --disable-dogs disables support for helper dogs], if test x"$enable_dogs" = xyes then AC_DEFINE(DOGS) fi,AC_DEFINE(DOGS)) dnl - By default, simple checks with little overhead are done to catch memory corruption, or dnl - problems with new code AC_ARG_ENABLE(checks,[ --disable-checks disables some basic internal sanity checks],, AC_DEFINE(SIMPLECHECKS) AC_DEFINE(ZONEIDCHECK)) AC_ARG_ENABLE(heapcheck,[ --enable-heapcheck turns on continuous heap checking (very slow)],AC_DEFINE(CHECKHEAP)) AC_ARG_ENABLE(heapdump,[ --enable-heapdump turns on dumping the heap state for debugging],AC_DEFINE(HEAPDUMP)) if test "$BUILD_SERVER" = "prboom-game-server" then BUILD_DIRS="POSIX $BUILD_DIRS" fi AC_DEFINE(POLL_MOUSE) dnl - cph - avoid X11 mouse problems AC_SUBST(BUILD_DIRS) AC_SUBST(BUILD_SERVER) AC_SUBST(MIXER_CFLAGS) AC_SUBST(MIXER_LIBS) AC_SUBST(NET_CFLAGS) AC_SUBST(NET_LIBS) AC_SUBST(LIB_SND) AC_SUBST(MATH_LIB) AC_SUBST(GL_LIBS) AC_SUBST(CFLAGS) dnl -- ac_aux_dir - see Makefile.am AC_SUBST(ac_aux_dir) dnl --- output AC_OUTPUT(Makefile src/Makefile src/POSIX/Makefile src/SDL/Makefile doc/Makefile data/Makefile ICONS/Makefile VISUALC5/Makefile VISUALC6/Makefile prboom.spec) # src/OSS/Makefile src/X11/Makefile