dnl Process this file with autoconf to produce a configure script. AC_INIT(src/d_main.c) dnl --- Set version strings PR_MAJOR_VERSION=2 PR_MINOR_VERSION=1 PR_MICRO_VERSION=0 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-*) AC_DEFINE(I386) 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 AM_CONDITIONAL(I386_ASM, test "$use_i386_asm" = yes) dnl --- Fire up automake AM_INIT_AUTOMAKE(prboom,$PR_VERSION) AM_CONFIG_HEADER(config.h) CFLAGS_OPT="-O2 -fomit-frame-pointer -ffast-math" dnl --- Option to enable debugging AC_ARG_ENABLE(debug,[ --enable-debug turns on various debugging features, like range checking and internal heap diagnostics], AC_DEFINE(RANGECHECK) AC_DEFINE(INSTRUMENTED) AC_DEFINE(TIMEDIAG) CFLAGS_OPT="-g -ffast-math" ) AC_ARG_ENABLE(profile,[ --enable-profile turns on profiling], CFLAGS_OPT="-pg -ffast-math" ) dnl --- Try for processor optimisations AC_ARG_ENABLE(cpu-opt,[ --disable-cpu-opt turns off cpu specific optimisations],,[ case "$target" in # marginal gains from aligning code i386-*) SYS_CFLAGS="-m386" ;; i486-*) SYS_CFLAGS="-m486" ;; # nothing special for pentium # CMOV op on ppro/II/686 can help us i686-*) SYS_CFLAGS="-mcpu=i686 -march=i686" ;; esac echo -n "checking whether $CC supports CPU optimisations $SYS_CFLAGS..." echo 'void f(){}' > conftest.c if test -z "`${CC-cc} $SYS_CFLAGS -c conftest.c 2>&1`"; then SYS_CFLAGS="$SYS_CFLAGS" echo "yes" else echo "no" SYS_CFLAGS="" fi ]) dnl --- some defaults for CFLAGS : josh if test -z "$CFLAGS" ; then CFLAGS="$SYS_CFLAGS $CFLAGS_OPT -Wall -Winline -Wcast-align -Wwrite-strings -I\$(top_srcdir)/src" fi dnl --- Check for programs AC_PROG_CC AC_PROG_LN_S AC_PROG_RANLIB dnl --- Compiler characteristics AC_C_CONST AC_C_INLINE if test "$cross_compiling" != "yes"; then AC_C_BIGENDIAN fi dnl --- Check for libraries dnl - system specific stuff case "$target" in *-*-cygwin* | *-*-mingw32*) MATHLIB="" SYS_GL_LIBS="-lopengl32" ;; *-*-beos*) MATHLIB="" SYS_GL_LIBS="-lGL -lGLU" ;; *-*-aix*) if test x$ac_cv_prog_gcc = xyes; then CFLAGS="-mthreads" fi ;; *) MATHLIB="-lm" SYS_GL_LIBS="-lGL -lGLU" ;; esac dnl - X11 AC_PATH_X AC_PATH_XTRA if test "x$x_includes" != x; then CFLAGS="$CFLAGS -I$x_includes" else CFLAGS="$CFLAGS" fi LIBS="$LIBS $X_LIBS $X_EXTRA_LIBS" AC_CHECK_LIB(Xext,XShmCreateImage,AC_DEFINE(HAVE_LIBXEXT) LIB_XEXT=-lXext,LIB_XEXT=,-lXext -lX11) 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.0.1, BUILD_SDLDOOM=prboom, BUILD_SDLDOOM=) AC_CHECK_LIB(smpeg,SMPEG_playAudio,[ MIXER_LIBS=-lsmpeg ],,$SDL_LIBS) AC_CHECK_LIB(SDL_mixer,Mix_LoadMUS,[ AC_DEFINE(HAVE_LIBSDL_MIXER) MIXER_LIBS="$MIXER_LIBS -lSDL_mixer" ],,$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) AM_CONDITIONAL(SDL_NET, test "$sdl_net" = yes) dnl - Net AC_CHECK_FUNC(socket,[ has_net=yes BUILD_SERVER=prboom-game-server ],BUILD_SERVER=) AM_CONDITIONAL(HAVE_NET, test "$has_net" = yes) if test "$has_net" = yes then AC_DEFINE(HAVE_NET) fi AC_EGREP_HEADER(sockaddr_in6,netinet/in.h,AC_DEFINE(HAVE_IPv6)) dnl --- Library functions AC_FUNC_ALLOCA AC_PROG_GCC_TRADITIONAL AC_FUNC_MEMCMP AC_TYPE_SIGNAL AC_FUNC_VPRINTF AC_CHECK_FUNC(stricmp,,AC_DEFINE(stricmp,strcasecmp)) AC_CHECK_FUNC(strnicmp,,AC_DEFINE(strnicmp,strncasecmp)) AC_CHECK_FUNCS(inet_aton inet_pton inet_ntop setsockopt vsnprintf snprintf) AC_CHECK_FUNCS(gethostname mkdir select socket strcspn strdup strtol getopt) dnl --- Check for header files AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_CHECK_HEADERS(fcntl.h limits.h sys/ioctl.h sys/time.h unistd.h) AC_CHECK_HEADERS(linux/joystick.h) dnl - want ffz() AC_CHECK_HEADERS(linux/bitops.h) dnl - fast byte swaping code AC_CHECK_HEADERS(asm/byteorder.h) dnl - Check for soundcard.h BUILD_SNDSERV= AC_CHECK_HEADERS(sys/soundcard.h,BUILD_SNDSERV=sndserv) AC_CHECK_HEADERS(machine/soundcard.h,BUILD_SNDSERV=sndserv) AC_CHECK_HEADERS(soundcard.h,BUILD_SNDSERV=sndserv) 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],,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)) dnl --- Decide what programs to build dnl if test "$no_x" != yes && test "$enable_gl" != "yes" dnl then dnl BUILD_XPRBOOM=xprboom dnl BUILD_DIRS="$BUILD_DIRS X11" dnl else BUILD_XPRBOOM= BUILD_SNDSERV= dnl fi if test "$BUILD_SDLDOOM" = "prboom" then BUILD_DIRS="$BUILD_DIRS SDL" fi if test "$BUILD_SNDSERV" = "sndserv" then BUILD_DIRS="$BUILD_DIRS OSS" dnl --- Nasty hack follows, sounds.c used by two dirs $LN_S ../sounds.c src/OSS/sounds.c fi if test "$BUILD_SNDSERV" = "sndserv" || test "$BUILD_XPRBOOM" = "xprboom" || 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_SNDSERV) AC_SUBST(BUILD_XPRBOOM) AC_SUBST(BUILD_SDLDOOM) AC_SUBST(BUILD_SERVER) AC_SUBST(MIXER_CFLAGS) AC_SUBST(MIXER_LIBS) AC_SUBST(NET_CFLAGS) AC_SUBST(NET_LIBS) AC_SUBST(LIB_XEXT) AC_SUBST(LIB_XDGA) AC_SUBST(LIB_SND) AC_SUBST(MATH_LIB) AC_SUBST(GL_LIBS) AC_SUBST(CFLAGS) dnl --- Pass install dirs to C pre-processor dnl --- YUCK! but I can't see a better way to do this if test "$prefix" = "NONE" then prefix="/usr/local" fi if test "$exec_prefix" = "NONE" then exec_prefix=$prefix fi dnl --- decide directories gamesdir=$prefix/games exp_gamesdir=`eval "echo $gamesdir"` exp_datadir=`eval "echo $datadir"` waddir=$exp_datadir/games/doom dnl --- now finally spit them out AC_DEFINE_UNQUOTED(SNDSERV_PATH,"$exp_gamesdir/sndserv") AC_DEFINE_UNQUOTED(MUSSERV_PATH,"$exp_gamesdir/musserv") AC_DEFINE_UNQUOTED(DOOMWADDIR,"$waddir") dnl --- output AC_OUTPUT(Makefile src/Makefile src/POSIX/Makefile src/SDL/Makefile doc/Makefile data/Makefile prboom.spec) # src/OSS/Makefile src/X11/Makefile