dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.13) AC_INIT(common/crc.h) dnl Version of this release QF_VERSION=0.2-d VERSION=2.40 QSG_STANDARD=1 AC_DEFINE_UNQUOTED(QF_VERSION,"$QF_VERSION") AC_DEFINE_UNQUOTED(VERSION,"$VERSION") AC_DEFINE_UNQUOTED(QSG_STANDARD,"$QSG_STANDARD") dnl Set to yes for releases RELEASE=no AC_CANONICAL_SYSTEM AC_LANG_C dnl Checks for programs. AC_PROG_CC AC_PROG_CPP AC_PROG_MAKE_SET AC_PROG_RANLIB dnl Checks for header files. AC_CHECK_HEADERS(unistd.h fcntl.h dlfcn.h windows.h sys/ioctl.h sys/mman.h \ sys/io.h asm/io.h \ sys/stat.h sys/time.h sys/timeb.h \ sys/socket.h netinet/in.h netdb.h arpa/inet.h sys/filio.h \ sys/soundcard.h linux/soundcard.h machine/soundcard.h sys/audioio.h \ dsound.h mmsystem.h initguid.h mme/mmsystem.h mme/mme_public.h \ sys/asoundlib.h string.h strings.h memory.h malloc.h \ errno.h sys/dir.h) dnl Checks for typedefs, structures, and compiler characteristics. AC_PROG_GCC_TRADITIONAL AC_C_CONST AC_C_INLINE AC_HEADER_TIME AC_STRUCT_TM AC_C_BIGENDIAN AC_MSG_CHECKING(for socklen_t in sys/types.h) AC_TRY_COMPILE([#include ], [ socklen_t x = 0;], AC_DEFINE(HAVE_SOCKLEN_T) AC_MSG_RESULT(yes), AC_MSG_RESULT(no) dnl FreeBSD 4.0 has it in sys/socket.h AC_MSG_CHECKING(for socklen_t in sys/socket.h) AC_TRY_COMPILE([#include #include ], [ socklen_t x = 0;], AC_DEFINE(HAVE_SOCKLEN_T) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) ) AC_MSG_CHECKING(for size_t in sys/types.h) AC_TRY_COMPILE([#include ], [ size_t x = 0;], AC_DEFINE(HAVE_SIZE_T) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) AC_MSG_CHECKING(for ss_len in struct sockaddr_storage) dnl maybe these two (at least the 2nd) should only be checked if ipv6 dnl is enabled? AC_TRY_COMPILE([#include #include ], [ void f(void) { struct sockaddr_storage ss; ss.ss_len=0; }], AC_DEFINE(HAVE_SS_LEN) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) AC_MSG_CHECKING(for sin6_len in struct sockaddr_in6) AC_TRY_COMPILE([#include #include ], [ void f(void) { struct sockaddr_in6 s6; s6.sin6_len=0; }], AC_DEFINE(HAVE_SIN6_LEN) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) AC_MSG_CHECKING(for sa_len in struct sockaddr) AC_TRY_COMPILE([#include #include ], [ void f(void) { struct sockaddr sa; sa.sa_len=0; }], AC_DEFINE(HAVE_SA_LEN) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) dnl Check for symbol underscore prefix dnl !!! FIXME !!! Do some real check here... AC_MSG_CHECKING(whether C symbols are prefixed by '_') case "${target}" in *-*-msdos* | *-*-djgpp* | *-*-mingw* | *-*-cygwin* | *-*-openbsd*) AC_DEFINE(HAVE_SYM_PREFIX_UNDERSCORE) AC_MSG_RESULT(yes) ;; *) AC_MSG_RESULT(no) ;; esac dnl Checks for library functions. AC_FUNC_MMAP AC_FUNC_VPRINTF AC_CHECK_FUNCS(gethostname gethostbyname connect gettimeofday getwd mkdir \ ftime _ftime fcntl stat putenv select socket strerror strstr \ snprintf _snprintf vsnprintf _vsnprintf strsep dlopen getaddrinfo getnameinfo) AC_ARG_ENABLE(experimental, [ --enable-experimental compile with experimental code. Use at your own risk]) if test "x$enable_experimental" = xyes; then AC_DEFINE(_EXPERIMENTAL_) fi AC_DEFINE(GAMENAME, "id1") AC_ARG_WITH(global-cfg, [ --with-global-cfg=FILE If set will change the name and location of the global config file used by QuakeForge. Defaults to \${sysconfdir}/quakeforge.con], globalconf="$withval", globalconf="auto") if test "x$globalconf" = "xauto" || test "x$globalconf" = "xyes" || \ test "x$globalconf" = "xno"; then dnl yes/no sanity checks globalconf="$sysconfdir/quakeforge.conf" fi AC_SUBST(globalconf) AC_ARG_ENABLE(basepath, [ --enable-basepath use \${prefix}/games/quakeforge instead of . for game data], BASEPATH=$enable_basepath ) AC_ARG_WITH(basepath, [ --with-basepath=DIR use basepath instead of . or \${prefix}/games/quakeforge for game data], BASEPATH=$withval) if test "x$BASEPATH" = xyes; then if test "x$prefix" = xNONE; then AC_DEFINE_UNQUOTED(FS_BASEPATH, "${ac_default_prefix}/games/quakeforge") else AC_DEFINE_UNQUOTED(FS_BASEPATH, "${prefix}/games/quakeforge") fi elif test "x$BASEPATH" = xno -o "x$BASEPATH" = x; then AC_DEFINE(FS_BASEPATH, ".") else AC_DEFINE_UNQUOTED(FS_BASEPATH, "$BASEPATH") fi GENERATIONS=no AC_ARG_ENABLE(generations, [ --enable-generations enable .qz support. Requires zlib)], GENERATIONS=$enable_generations ) AC_ARG_ENABLE(release, [ --enable-release compile release (with optimization)], RELEASE=$enable_release ) AC_ARG_WITH(ipv6, [ --with-ipv6 enable IPv6 support. Optional argument specifies location of inet6 libraries.], AC_DEFINE(HAVE_IPV6) if test "x$withval" = xno ; then NET_SOURCE=net_udp.c else NET_SOURCE=net_udp6.c if test "x$withval" != xyes ; then LIBS="$LIBS -L${withval}" fi fi , dnl Default is no IPv6 NET_SOURCE=net_udp.c ) AC_ARG_ENABLE(alsa, [ --disable-alsa disable alsa support], ) AC_ARG_ENABLE(zlib, [ --disable-zlib disable zlib support], ) dnl Checks for stricmp/strcasecmp AC_CHECK_FUNC(stricmp,, AC_CHECK_FUNC(strcasecmp, AC_DEFINE(stricmp,strcasecmp))) dnl Check for vsnprintf if test "x$ac_cv_func_vsnprintf" = "xno" -a \ "x$ac_cv_func__vsnprintf" = "xno"; then dnl libdb may have this AC_CHECK_LIB(db,vsnprintf) fi dnl Check for dlopen if test "x$ac_cv_func_dlopen" = "xno"; then AC_CHECK_LIB(dl, dlopen, LIBS="$LIBS -ldl" have_dynload=yes AC_DEFINE(HAVE_DLOPEN)) else have_dynload=yes fi dnl Checks for getaddrinfo in separate IPv6 lib, if not available by default if test "x$ac_cv_func_getaddrinfo" = xno ; then AC_CHECK_LIB(inet6,getaddrinfo,LIBS="${LIBS} -linet6") fi dnl Checks for working -lm AC_CHECK_LIB(m, pow,, AC_MSG_ERROR([math library (-lm) appears broken])) if test "x$enable_zlib" != "xno"; then dnl Check for working -lz dnl Note - must have gztell *and* gzgets in -lz *and* zlib.h AC_CHECK_LIB(z, gztell, HAS_ZLIB=yes, HAS_ZLIB=no, [$LIBS]) if test "x$HAS_ZLIB" = "xyes"; then AC_CHECK_LIB(z, gzgets, HAS_ZLIB=yes, HAS_ZLIB=no, [$LIBS]) if test "x$HAS_ZLIB" = "xyes"; then AC_CHECK_HEADER(zlib.h, HAS_ZLIB=yes, HAS_ZLIB=no) if test "x$HAS_ZLIB" = "xyes"; then LIBS="-lz $LIBS" AC_DEFINE(HAS_ZLIB) if test "x$GENERATIONS" = "xyes"; then AC_DEFINE(GENERATIONS) fi fi fi fi fi dnl Checks for X11 support dnl (XoXus: Since vid_x11.c relies on XShm being there, this now disables dnl the X11 video driver if -lXext can not be found) AC_PATH_XTRA if test "x$no_x" = x; then HAS_X11=yes AC_CHECK_LIB(Xext, XShmQueryExtension, [X11_SHM_LIB=-lXext], [HAS_X11="no"], [ $X_LIBS -lX11 $X_EXTRA_LIBS ]) fi dnl Check for VIDMODE support AC_ARG_ENABLE(VIDMODE, [ --enable-DGA use XFree86 DGA extension, if available], HAS_DGA=$enable_VIDMODE, HAS_VIDMODE=auto) if test "x$HAS_VIDMODE" != xno; then save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$X_CFLAGS $CPPFLAGS" AC_CHECK_HEADER(X11/extensions/xf86vmode.h, HAS_VIDMODE=yes, HAS_VIDMODE=no) CPPFLAGS="$save_CPPFLAGS" fi dnl Check for DGA support AC_ARG_ENABLE(DGA, [ --enable-DGA use XFree86 DGA extension, if available], HAS_DGA=$enable_DGA, HAS_DGA=auto) if test "x$HAS_VIDMODE" = xyes; then if test "x$HAS_DGA" != xno; then save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$X_CFLAGS $CPPFLAGS" AC_CHECK_HEADER(X11/extensions/xf86dga.h, HAS_DGA=yes, HAS_DGA=no) AC_CHECK_HEADER(X11/extensions/xf86vmode.h, qwfoo=qwfoo, HAS_DGA=no) CPPFLAGS="$save_CPPFLAGS" else HAS_DGA=no fi fi dnl Checks for VGA support case "${target}" in i?86-*-*djgpp* | i?86-*-*msdos*) HAS_VGA=yes ;; *) HAS_VGA=no ;; esac dnl Checks for MGL support AC_ARG_WITH(mgl, [ --with-mgl=DIR use MGL found in DIR], HAS_MGL=$withval, HAS_MGL=auto) if test "x$HAS_MGL" != xno; then if test "x$ac_cv_header_windows_h" != "xyes"; then HAS_MGL=no else if test "x$HAS_MGL" != xauto; then MGL_CFLAGS="$MGL_CFLAGS -I$withval/include" MGL_LIBS="$MGL_LIBS -L$withval/lib" fi save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $MGL_CFLAGS" AC_CHECK_HEADER(mgraph.h, HAS_MGL=yes, HAS_MGL=no) CPPFLAGS="$save_CPPFLAGS" fi fi dnl Checks for GGI support AC_ARG_WITH(ggi, [ --with-ggi=DIR use LibGGI found in DIR], HAS_GGI=$withval, HAS_GGI=auto) if test "x$HAS_GGI" != xno; then if test "x$HAS_GGI" != xauto; then GGI_CFLAGS="$GGI_CFLAGS -I$withval/include" GGI_LIBS="$GGI_LIBS -L$withval/lib" fi save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $GGI_CFLAGS" AC_CHECK_HEADER(ggi/ggi.h, HAS_GGI=yes, HAS_GGI=no) CPPFLAGS="$save_CPPFLAGS" fi dnl Checks for SVGALib support AC_ARG_WITH(svga, [ --with-svga=DIR use SVGALib found in DIR], HAS_SVGA=$withval, HAS_SVGA=auto) if test "x$HAS_SVGA" != xno; then if test "x$HAS_SVGA" != xauto; then SVGA_CFLAGS="$SVGA_CFLAGS= -I$withval/include" SVGA_LIBS="$SVGA_LIBS -L$withval/lib" dnl The default system location is /usr/include or /usr/local/include dnl and we (obviously) do not need to set CFLAGS for that fi save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $SVGA_CFLAGS" AC_CHECK_HEADER(vga.h, HAS_SVGA=yes, HAS_SVGA=no) CPPFLAGS="$save_CPPFLAGS" fi dnl Checks for SDL support AC_ARG_WITH(sdl, [ --with-sdl=DIR use SDL found in DIR], HAS_SDL=$withval, HAS_SDL=auto) if test "x$HAS_SDL" != xno; then if test "x$HAS_SDL" != xauto; then SDL_CFLAGS="$SDL_CFLAGS -I$withval/include" SDL_LIB="$SDL_LIBS -L$withbal/lib" fi save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $SDL_CFLAGS" AC_CHECK_HEADER(SDL/SDL.h, HAS_SDL=yes, HAS_SDL=no) CPPFLAGS="$save_CPPFLAGS" fi dnl Checks for GLIDE support AC_ARG_WITH(glide, [ --with-glide=DIR use the GLIDE 2.x SDK found in DIR], HAS_GLIDE=$withval, HAS_GLIDE=auto) if test "x$HAS_GLIDE" != xno; then if test "x$HAS_GLIDE" != xauto; then GLIDE_CFLAGS="$GLIDE_CFLAGS -I$withval/include" GLIDE_LIBS="$GLIDE_LIBS -L$withval/lib" else GLIDE_CFLAGS="$GLIDE_CFLAGS -I/usr/include/glide -I/usr/local/include/glide" fi save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $GLIDE_CFLAGS" AC_CHECK_HEADER(glide.h, HAS_GLIDE=yes, HAS_GLIDE=no) if test "x$HAS_GLIDE" != xyes; then HAS_GLIDE=no fi CPPFLAGS="$save_CPPFLAGS" fi dnl Checks for OGL support dnl GL is a special case, we need seperate includes/libs entires AC_ARG_WITH(opengl, [ --with-opengl=DIR use OpenGL with libraries found in DIR], HAS_OGL=$withval, HAS_OGL=auto) AC_ARG_WITH(opengl-includes, [ --with-opengl-includes=DIR use OpenGL with header files found in DIR], OGL_INCLUDES=$withval, OGL_INCLUDES=auto) if test "x$OGL_INCLUDES" = xno; then HAS_OGL="no" fi if test "x$HAS_OGL" = xno; then OGL_INCLUDES="" fi if test "x$HAS_OGL" != xno; then if test "x$HAS_OGL" != xauto; then OGL_LIBS="$OGL_LIBS -L$HAS_OGL" fi if test "x$OGL_INCLUDES" != xauto; then OGL_INCLUDES="-I$OGL_INCLUDES" else OGL_INCLUDES="-I${x_includes:-.}" fi save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $OGL_INCLUDES" AC_CHECK_HEADER(GL/gl.h, HAS_OGL=yes, HAS_OGL=no) if test "x$HAS_OGL" != xno; then AC_CHECK_HEADER(GL/xmesa.h, HAS_XMESA=yes, HAS_XMESA=no) AC_MSG_CHECKING(for GL_COLOR_INDEX8_EXT in GL/gl.h) AC_TRY_COMPILE([#include "GL/gl.h"], [ int x = (int) GL_COLOR_INDEX8_EXT;], AC_DEFINE(HAVE_GL_COLOR_INDEX8_EXT) AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) AC_MSG_CHECKING(for GLAPIENTRY in GL/gl.h) AC_TRY_COMPILE([#include "GL/gl.h"], [ int x = GLAPIENTRY printf("");], HAS_GLAPIENTRY=yes, HAS_GLAPIENTRY=no) if test "x$HAS_GLAPIENTRY" != xno; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) AC_MSG_CHECKING(for APIENTRY in GL/gl.h) AC_TRY_COMPILE([#include "GL/gl.h"], [ int x = APIENTRY printf("");], AC_DEFINE(GLAPIENTRY, APIENTRY) AC_MSG_RESULT(yes), AC_DEFINE(GLAPIENTRY, ) AC_MSG_RESULT(no)) fi if test "x$HAS_GLIDE" != xno; then CPPFLAGS="$GLIDE_CFLAGS $CPPFLAGS" AC_CHECK_HEADER(GL/fxmesa.h, HAS_FXMESA=yes, HAS_FXMESA=no) fi fi CPPFLAGS="$save_CPPFLAGS" fi if test "x$HAS_OGL" = xyes; then AC_DEFINE(HAS_OGL) fi dnl Make sure VIDMODE works if test "x$HAS_VIDMODE" = xyes; then AC_CHECK_LIB(Xxf86vm, XF86VidModeSwitchToMode,qwfoo=qwfoo, HAS_VIDMODE=no HAS_DGA=no, [$X_LIBS -lXext -lX11 $X_EXTRA_LIBS]) fi if test "x$HAS_VIDMODE" != xyes; then VIDMODE_LIBS="" else AC_DEFINE(HAS_VIDMODE) VIDMODE_LIBS="-lXxf86vm" fi dnl Make sure DGA works if test "x$HAS_DGA" = xyes; then AC_CHECK_LIB(Xxf86dga, XF86DGAQueryVersion,qwfoo=qwfoo, HAS_DGA=no, [$X_LIBS -lXext -lX11 $X_EXTRA_LIBS]) fi if test "x$HAS_DGA" != xyes; then DGA_LIBS="" else AC_DEFINE(HAS_DGA) DGA_LIBS="-lXxf86dga" fi dnl Make sure -lmgllt works if test "x$HAS_MGL" = xyes; then MGL_LIBS="$MGL_LIBS -lgdi32 -lwinmm -ldinput -lddraw" AC_CHECK_LIB(mgllt,MGL_registerDriver, MGL_LIBS="-lmgllt $MGL_LIBS" HAS_MGL=yes, HAS_MGL=no, [$MGL_LIBS]) fi if test "x$HAS_MGL" != xyes; then MGL_CFLAGS="" MGL_LIBS="" fi dnl Make sure -lggi works if test "x$HAS_GGI" = xyes; then AC_CHECK_LIB(ggi, ggiEventsQueued, GGI_LIBS="$GGI_LIBS -lggi" HAS_GGI=yes, HAS_GGI=no, [$GGI_LIBS]) fi if test "x$HAS_GGI" != xyes; then GGI_CFLAGS="" GGI_LIBS="" fi dnl Make sure -lvga works if test "x$HAS_SVGA" = xyes; then AC_CHECK_LIB(vga, vga_getmousetype, SVGA_LIBS="$SVGA_LIBS -lvga" HAS_SVGA=yes, HAS_SVGA=no, [$SVGA_LIBS]) fi if test "x$HAS_SVGA" != xyes; then SVGA_CFLAGS="" SVGA_LIBS="" fi dnl Make sure -lpthread works (for SDL) if test "x$HAS_SDL" = xyes; then AC_CHECK_LIB(pthread, pthread_exit ,SDL_LIBS="$SDL_LIBS -lpthread" HAS_SDL=yes, HAS_SDL=no, [$SDL_LIBS]) fi if test "x$HAS_SDL" != xyes; then SDL_CFLAGS="" SDL_LIBS="" fi dnl Make sure -lSDL works if test "x$HAS_SDL" = xyes; then AC_CHECK_LIB(SDL, SDL_Init, SDL_LIBS="$SDL_LIBS -lSDL" HAS_SDL=yes, HAS_SDL=no, [$SDL_LIBS]) fi if test "x$HAS_SDL" != xyes; then SDL_CFLAGS="" SDL_LIBS="" fi dnl Make sure -lglide2x works if test "x$HAS_GLIDE" = xyes; then AC_CHECK_LIB(glide2x, main, GLIDE_LIBS="$GLIDE_LIBS -lglide2x" HAS_GLIDE=yes, HAS_GLIDE=no, [$GLIDE_LIBS -lm]) fi if test "x$HAS_GLIDE" != xyes; then GLIDE_CFLAGS="" GLIDE_LIBS="" fi dnl Make sure -lGL or -lMesaGL works if test "x$HAS_OGL" = xyes; then AC_CHECK_LIB(GL, glColor4f, OGL_LIBS="$OGL_LIBS -lGL" HAS_OGL=yes OGL_NAME=GL if test "x$have_dynload" != "xyes"; then AC_CHECK_LIB(GL, XMesaSetFXmode, qwfoo=qwfoo, HAS_XMESA=no, [ $OGL_LIBS $X_LIBS -lXext -lX11 $X_EXTRA_LIBS]) fi , HAS_OGL=no, [$OGL_LIBS $X_LIBS -lXext -lX11 $X_EXTRA_LIBS]) if test "x$HAS_OGL" != xyes; then AC_CHECK_LIB(MesaGL, glColor4f, OGL_LIBS="$OGL_LIBS -lMesaGL" HAS_OGL=yes OGL_NAME=MesaGL if test "x$have_dynload" != "xyes"; then AC_CHECK_LIB(MesaGL, XMesaSetFXmode, qwfoo=qwfoo, HAS_XMESA=no, [ $OGL_LIBS $X_LIBS -lXext -lX11 $X_EXTRA_LIBS]) fi , HAS_OGL=no, [$OGL_LIBS $X_LIBS -lXext -lX11 $X_EXTRA_LIBS]) fi fi if test "x$HAS_OGL" != xyes; then OGL_CFLAGS="" OGL_LIBS="" else if test "x$HAS_XMESA" = xyes; then AC_DEFINE(XMESA) fi fi dnl Check for xil AC_CHECK_LIB(xil,xil_import, HAS_XIL=yes, HAS_XIL=no) # 3Dfx stuff.. # First we see if we can use mesa with glide support.. # if not then try the MiniGL.. TDFXGL_NAME="" AC_ARG_WITH(3dfx, [ --with-3dfx support 3Dfx output for the V1/V2, if a argument is specified it will be used as the GL wrapper lib for glide.], HAS_3dfx=$withval, HAS_3dfx=auto) if test "x$HAS_3dfx" != "xno" -a "x$HAS_SVGA" != "xno" \ -a "x$HAS_GLIDE" != "xno"; then if test "x$HAS_3dfx" != "xauto" -a "x$HAS_3dfx" != "xyes"; then TDFXGL_NAME="$HAS_3dfx" fi if test -z "$TDFXGL_NAME"; then dnl Check in reverse order of preference for a in 3dfxgl $OGL_NAME; do AC_CHECK_LIB($a, fxMesaCreateContext, TDFXGL_NAME=$a, qwfoo=qwfoo, [$GLIDE_LIBS $TDFXGL_LIBS]) done fi fi AC_MSG_CHECKING(for 3Dfx support) if test -n "$TDFXGL_NAME"; then TDFXGL_CFLAGS="$GLIDE_CFLAGS" TDFXGL_LIBS="$TDFXGL_LIBS $GLIDE_LIBS -l$TDFXGL_NAME" HAS_TDFXGL="yes" AC_MSG_RESULT(yes (using $TDFXGL_NAME)) else TDFXGL_NAME="" TDFXGL_LIBS="" HAS_TDFXGL="no" AC_MSG_RESULT(no) fi dnl CFLAGS for release and devel versions if test "x$RELEASE" = xyes; then if test "x$GCC" = xyes; then AC_MSG_CHECKING(for special release compiler settings) BASE_RELEASE_CFLAGS="-O6 -ffast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations" case "${target}" in changequote(,)dnl i?86-*-*) changequote([,])dnl MORE_RELEASE_CFLAGS="-malign-loops=2 -malign-jumps=2 -malign-functions=2" ;; *) MORE_RELEASE_CFLAGS="" ;; esac if test "x$MORE_RELEASE_CFLAGS" = x; then RELEASE_CFLAGS=-O AC_MSG_RESULT([no]) RELEASE_CFLAGS=$BASE_RELEASE_CFLAGS else AC_MSG_RESULT(yes) RELEASE_CFLAGS="$BASE_RELEASE_CFLAGS $MORE_RELEASE_CFALGS" fi else RELEASE_CFLAGS=-O2 fi fi dnl Quakeforge code has lots of C++ comments, which cause dnl problems with any compiler that is ANSI/ISO-C compliant. dnl Make the compiler swallow its pride... if test "x$GCC" != xyes; then AC_MSG_CHECKING(for how to deal with C++ comments) case "$target" in *-aix*) CFLAGS="$CFLAGS -qcpluscmt" AC_MSG_RESULT([-qcpluscmt]) ;; *-irix6*) CFLAGS="$CFLAGS -Xcpluscomm" AC_MSG_RESULT([-Xcpluscomm]) ;; *-solaris*) CFLAGS="$CFLAGS -xCC" AC_MSG_RESULT([-xCC]) ;; *) AC_MSG_RESULT(nothing needed or no switch known) ;; esac fi dnl We want warnings, lots of warnings... if test "x$GCC" = xyes; then CFLAGS="$CFLAGS -Wall -Werror" fi # CFLAGS="$CFLAGS -Wall -pedantic" dnl Check for ia32 AC_MSG_CHECKING(for an ia32 machine) case "${target}" in i?86-*-*) INTEL_ARCH=yes AC_MSG_RESULT(yes) AC_MSG_CHECKING(to see if we should disable asm optimizations) AC_ARG_ENABLE(asmopt, [ --disable-asmopt disable assembler optimization], ASM_ARCH=none, ASM_ARCH=i386 ) if test "x$NO_ASMOPT" = xyes; then AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi ;; *) AC_MSG_RESULT(no) ASM_ARCH=none esac dnl Check for sound libraries AC_CHECK_LIB(mme,waveOutOpen,HAVE_LIBMME=yes) SOUND_STYLE="" AC_MSG_CHECKING(for sound support) if test "x$enable_alsa" != "xno"; then if test -z "$SOUND_STYLE" -a "x$ac_cv_header_sys_asoundlib_h" = "xyes"; then AC_EGREP_CPP([QF_maGiC_VALUE],[ #include #if defined(SND_LIB_MAJOR) && defined(SND_LIB_MINOR) #if SND_LIB_MAJOR>0 || (SND_LIB_MAJOR==0 && SND_LIB_MINOR>=5) QF_maGiC_VALUE #endif #endif ],[ SOUND_STYLE="ALSA" SOUND_LIBS="-lasound"]) fi fi if test -z "$SOUND_STYLE" -a "x$ac_cv_header_sys_soundcard_h" = "xyes"; then AC_EGREP_CPP([QF_maGiC_VALUE],[ #include #ifdef SNDCTL_DSP_SETTRIGGER QF_maGiC_VALUE #endif ], SOUND_STYLE="OSS") fi if test -z "$SOUND_STYLE" -a "x$ac_cv_header_linux_soundcard_h" = "xyes"; then AC_EGREP_CPP([QF_maGiC_VALUE],[ #include #ifdef SNDCTL_DSP_SETTRIGGER QF_maGiC_VALUE #endif ], SOUND_STYLE="OSS") fi if test -z "$SOUND_STYLE" -a "x$ac_cv_header_machine_soundcard_h" = "xyes"; then AC_EGREP_CPP([QF_maGiC_VALUE],[ #include #ifdef SNDCTL_DSP_SETTRIGGER QF_maGiC_VALUE #endif ], SOUND_STYLE="OSS") fi if test -z "$SOUND_STYLE" -a "x$ac_cv_header_sys_audioio_h" = "xyes"; then AC_EGREP_CPP([QF_maGiC_VALUE],[ #include #ifdef AUDIO_SETINFO QF_maGiC_VALUE #endif ], SOUND_STYLE="Solaris") fi if test -z "$SOUND_STYLE" -a "x$ac_cv_header_mme_mmsystem_h" = "xyes" -a \ "x$HAVE_LIBMME" = "xyes"; then AC_EGREP_CPP([QF_maGiC_VALUE],[ #include #ifdef WAVE_OPEN_SHAREABLE QF_maGiC_VALUE #endif ], SOUND_STYLE="MME" SOUND_LIBS="-lmme") fi if test -z "$SOUND_STYLE" -a "x$ac_cv_header_windows_h" = "xyes" -a \ "x$ac_cv_header_mmsystem_h" = "xyes"; then AC_EGREP_CPP([QF_maGiC_VALUE],[ #include #include #ifdef GMEM_MOVEABLE #ifdef WAVE_FORMAT_PCM QF_maGiC_VALUE #endif #endif ], SOUND_STYLE="Windows" SOUND_LIBS="-lwinmm") fi if test -z "$SOUND_STYLE"; then AC_EGREP_CPP([QF_maGiC_VALUE],[ #ifdef __DJGPP QF_maGiC_VALUE #endif ], SOUND_STYLE="DJGPP") fi if test "x$SOUND_STYLE" = "x"; then AC_MSG_RESULT(no) SOUND_STYLE="NULL" else AC_MSG_RESULT(yes ($SOUND_STYLE style)) fi dnl ======================================================================== dnl Check for CD-ROM AC_EGREP_CPP([QF_maGiC_VALUE],[ #include #ifdef CDROMREADTOCENTRY QF_maGiC_VALUE #endif ], AC_DEFINE(USE_LINUX_CD), AC_EGREP_CPP([QF_maGiC_VALUE],[ #include #if defined (CDIOREADTOCENTRY) || defined (CDIOREADTOCENTRYS) QF_maGiC_VALUE #endif ], AC_DEFINE(USE_BSD_CD)) ) AC_HAVE_STRUCT_FIELD(struct ioc_read_toc_single_entry, entry,[ #include ]) dnl ======================================================================== dnl Check for networking dnl Check for network libraries if test "x$ac_cv_func_connect" != "xyes"; then AC_CHECK_LIB(socket,connect, NET_LIBS="$NET_LIBS -lsocket" ac_cv_func_connect=yes) fi if test "x$ac_cv_func_gethostbyname" != "xyes"; then AC_CHECK_LIB(nsl,gethostbyname, NET_LIBS="$NET_LIBS -lnsl" ac_cv_func_gethostbyname=yes) fi AC_MSG_CHECKING([for connect in -lwsock32]) SAVELIBS="$LIBS" LIBS="$LIBS -lwsock32" AC_TRY_LINK([ #include ],[ connect(0, NULL, 42); ], NET_LIBS="$NET_LIBS -lwsock32 -lwinmm" ac_cv_func_connect=yes ac_cv_func_gethostbyname=yes HAVE_WSOCK=yes AC_MSG_RESULT(yes), AC_MSG_RESULT(no)) LIBS="$SAVELIBS" AC_MSG_CHECKING(for UDP support) if test "x$ac_cv_func_connect" = "xyes" -a \ "x$ac_cv_func_gethostbyname" = "xyes"; then HAVE_UDP=yes AC_MSG_RESULT(yes) else AC_MSG_RESULT(no) fi dnl Checks for which system driver to use AC_MSG_CHECKING(for system driver) case "${target}" in *-*-linux-gnu*) SYS_SRC="sys_linux.c" QW_CL_SYS_SRC="sys_linux.c" QW_SRV_SYS_SRC="sys_unix.c" ;; i?86-*-mingw32*) SYS_SRC="sys_win.c" QW_CL_SYS_SRC="sys_win.c" QW_SRV_SYS_SRC="sys_win.c" ;; i?86-*-*djgpp* | i?86-*-*msdos*) SYS_SRC="sys_dos.c" QW_CL_SYS_SRC="" QW_SRV_SYS_SRC="" ;; *) SYS_SRC="sys_unix.c" QW_CL_SYS_SRC="sys_linux.c" QW_SRV_SYS_SRC="sys_unix.c" DEFAULT_SYS=yes ;; # XXX - dos - conproc.c(?) sys_dos.c # XXX - need to add dos esac if test "x$DEFAULT_SYS" = xyes; then AC_MSG_RESULT([no, using default]) else AC_MSG_RESULT(yes ($SYS_SRC $QW_CL_SYS_SRC $QW_SRV_SYS_SRC)) fi dnl check for X11 video driver AC_MSG_CHECKING(for X11 video driver) case "${target}" in *-solaris*) X11_VID_SRC="vid_sunx.c" LIBS="$LIBS -lsocket -lnsl" ;; *) if test "x$HAS_X11"; then X11_VID_SRC="vid_x11.c"; else X11_VID_SRC= fi ;; esac if test "x$X11_VID_SRC" = x; then AC_MSG_RESULT(no) else AC_MSG_RESULT(yes ($X11_VID_SRC)) fi dnl Check for system services AC_EXEEXT AC_OBJEXT AC_SUBST(libdir) AC_SUBST(RELEASE) AC_SUBST(RELEASE_CFLAGS) AC_SUBST(HAS_XIL) AC_SUBST(X_LIBS) AC_SUBST(X_CFLAGS) AC_SUBST(X11_SHM_LIB) AC_SUBST(HAS_X11) AC_SUBST(HAD_VIDMODE) AC_SUBST(HAS_DGA) AC_SUBST(VIDMODE_LIBS) AC_SUBST(DGA_LIBS) AC_SUBST(HAS_VGA) AC_SUBST(VGA_CFLAGS) AC_SUBST(VGA_LIBS) AC_SUBST(HAS_MGL) AC_SUBST(MGL_CFLAGS) AC_SUBST(MGL_LIBS) AC_SUBST(HAS_GGI) AC_SUBST(GGI_CFLAGS) AC_SUBST(GGI_LIBS) AC_SUBST(HAS_SVGA) AC_SUBST(SVGA_CFLAGS) AC_SUBST(SVGA_LIBS) AC_SUBST(HAS_GLIDE) AC_SUBST(GLIDE_CFLAGS) AC_SUBST(GLIDE_LIBS) AC_SUBST(HAS_OGL) AC_SUBST(OGL_INCLUDES) AC_SUBST(OGL_CFLAGS) AC_SUBST(OGL_LIBS) AC_SUBST(HAS_TDFXGL) AC_SUBST(TDFXGL_CFLAGS) AC_SUBST(TDFXGL_LIBS) AC_SUBST(HAS_SDL) AC_SUBST(SDL_CFLAGS) AC_SUBST(SDL_LIBS) AC_SUBST(SOUND_STYLE) AC_SUBST(SOUND_LIBS) AC_SUBST(LIBS) AC_SUBST(INTEL_ARCH) AC_SUBST(ASM_ARCH) AC_SUBST(NET_LIBS) AC_SUBST(SYS_SRC) AC_SUBST(QW_CL_SYS_SRC) AC_SUBST(QW_SRV_SYS_SRC) AC_SUBST(X11_VID_SRC) AC_SUBST(HAVE_WSOCK) AC_SUBST(HAVE_UDP) AC_SUBST(NET_SOURCE) AC_SUBST(VERSION) AC_SUBST(QF_VERSION) AC_SUBST(ac_configure_args) AC_SUBST(GENERATIONS) dnl Output files AC_CONFIG_HEADER(common/config.h) AC_OUTPUT( qw_client/Makefile qw_server/Makefile uquake/Makefile common/Makefile Makefile Rules.mk rpm/quakeforge.spec rpm/build_rpm , chmod +x rpm/build_rpm )