newtree/configure.in
Marcus Sundberg 4792d2354b Check for for connect in -lwsock32
Replaced {target} with {host}.
Fixed up system driver selection.
2000-05-20 01:10:10 +00:00

591 lines
15 KiB
Text

dnl Process this file with autoconf to produce a configure script.
AC_PREREQ(2.13)
AC_INIT(source/sv_main.c)
AC_REVISION($Revision$) dnl
AM_CONFIG_HEADER(include/config.h)
AC_CANONICAL_SYSTEM
dnl This is the only place where the package version appears
AM_INIT_AUTOMAKE(quakeforge, 0.1.99pre0)
dnl Define the proper name for package
AC_DEFINE(PROGRAM, "QuakeForge")
QW_VERSION=2.40
QSG_VERSION=1.0
AC_DEFINE_UNQUOTED(QW_VERSION, "$QW_VERSION")
AC_DEFINE_UNQUOTED(QSG_VERSION, "$QSG_VERSION")
AC_SUBST(QW_VERSION)
AC_SUBST(QSG_VERSION)
dnl Start TARGETS out at "qf-server"
TARGETS="qf-server\$(EXEEXT)"
dnl Set to yes for releases
RELEASE=no
dnl Set this to no for Id defaults
NEWSTYLE=yes
ISODATE=`date +%Y-%m-%d`
AC_SUBST(ISODATE)
AC_LANG_C
dnl ==================================================================
dnl Checks for programs.
dnl ==================================================================
AC_PROG_AWK
AC_PROG_CC
AC_PROG_CPP
AC_PROG_INSTALL
AC_PROG_LN_S
dnl ==================================================================
dnl Checks for system services
dnl ==================================================================
AC_SYS_LONG_FILE_NAMES
AC_EXEEXT
AC_OBJEXT
dnl ==================================================================
dnl Checks for header files.
dnl ==================================================================
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_HEADER_MAJOR
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS(
unistd.h fcntl.h dlfcn.h windows.h sys/ioctl.h sys/mman.h \
sys/io.h asm/io.h \
sys/param.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 \
mgraph.h
)
dnl ==================================================================
dnl Checks for typedefs, structures, and compiler characteristics
dnl ==================================================================
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_STRUCT_ST_BLKSIZE
AC_HEADER_TIME
AC_STRUCT_TM
AC_TRY_COMPILE(
[#include <sys/types.h>],
[ socklen_t x = 0;],
AC_DEFINE(HAVE_SOCKLEN_T)
dnl FreeBSD 4.0 has it in sys/socket.h
AC_MSG_CHECKING(for socklen_t in sys/socket.h)
AC_TRY_COMPILE(
[#include <sys/types.h>
#include <sys/socket.h>],
[ socklen_t x = 0;],
AC_DEFINE(HAVE_SOCKLEN_T) AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
)
)
AC_MSG_CHECKING(for underscore prefix in names)
AC_TRY_LINK(
[asm(".long _bar");
int bar;],
[],
AC_DEFINE(HAVE_SYM_PREFIX_UNDERSCORE) AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
)
AC_MSG_CHECKING(for size_t in sys/types.h)
AC_TRY_COMPILE(
[#include <sys/types.h>],
[ size_t x = 0;],
AC_DEFINE(HAVE_SIZE_T) AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
)
dnl maybe these two (at least the 2nd) should only be checked if ipv6 is enabled?
AC_MSG_CHECKING(for ss_len in struct sockaddr_storage)
AC_TRY_COMPILE(
[#include <sys/types.h>
#include <sys/socket.h>],
[ 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 <sys/types.h>
#include <netinet/in.h>],
[ 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 <sys/types.h>
#include <netinet/in.h>],
[ void f(void) { struct sockaddr sa; sa.sa_len=0; }],
AC_DEFINE(HAVE_SA_LEN) AC_MSG_RESULT(yes),
AC_MSG_RESULT(no)
)
dnl ==================================================================
dnl Checks for library functions.
dnl ==================================================================
AC_FUNC_ALLOCA
AC_FUNC_MEMCMP
AC_FUNC_MMAP
AC_TYPE_SIGNAL
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
)
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 Checks for working -lm
AC_CHECK_LIB(m, pow,, AC_MSG_ERROR([math library (-lm) appears broken]))
dnl Checks for LibGGI support
AC_ARG_WITH(ggi,
[ --with-ggi[=DIR] use LibGGI found in DIR],
HAVE_GGI=$withval, HAVE_GGI=auto)
if test "x$HAVE_GGI" != xno; then
if test "x$HAVE_GGI" != xauto; then
GGI_CFLAGS="$GGI_CFLAGS= -I$withval/include"
GGI_LIBS="$GGI_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 $GGI_CFLAGS"
AC_CHECK_HEADER(ggi/ggi.h, HAVE_GGI=yes, HAVE_GGI=no)
CPPFLAGS="$save_CPPFLAGS"
dnl Make sure -lggi works
if test "x$HAVE_GGI" = xyes; then
AC_CHECK_LIB(ggi, ggiEventsQueued, GGI_LIBS="$GGI_LIBS -lggi"
HAVE_GGI=yes, HAVE_GGI=no, [$GGI_LIBS]
)
fi
if test "x$HAVE_GGI" != xyes; then
GGI_CFLAGS="" GGI_LIBS=""
fi
fi
AC_SUBST(HAVE_GGI)
AC_SUBST(GGI_CFLAGS)
AC_SUBST(GGI_LIBS)
dnl Checks for SVGALib support
AC_ARG_WITH(svga,
[ --with-svga[=DIR] use SVGALib found in DIR],
HAVE_SVGA=$withval, HAVE_SVGA=auto)
if test "x$HAVE_SVGA" != xno; then
if test "x$HAVE_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, HAVE_SVGA=yes, HAVE_SVGA=no)
CPPFLAGS="$save_CPPFLAGS"
dnl Make sure -lvga works
if test "x$HAVE_SVGA" = xyes; then
AC_CHECK_LIB(vga, vga_getmousetype, SVGA_LIBS="$SVGA_LIBS -lvga"
HAVE_SVGA=yes, HAVE_SVGA=no, [$SVGA_LIBS]
)
fi
if test "x$HAVE_SVGA" != xyes; then
SVGA_CFLAGS="" SVGA_LIBS=""
fi
fi
AC_SUBST(HAVE_SVGA)
AC_SUBST(SVGA_CFLAGS)
AC_SUBST(SVGA_LIBS)
dnl Checks for X11 and XShm
AC_PATH_XTRA
if test "x$no_x" = x; then
HAVE_X=yes
AC_CHECK_LIB(Xext, XShmQueryExtension,
X_SHM_LIB=-lXext,
HAVE_X=no,
[ $X_LIBS -lX11 $X_EXTRA_LIBS ]
)
fi
AC_SUBST(X_SHM_LIB)
dnl Checks for GLX support
AC_ARG_WITH(glx,
[ --with-glx[=DIR] use GLX with libraries found in DIR],
glx_libraries=$withval, glx_libraries=auto
)
AC_ARG_WITH(glx-includes,
[ --with-glx-includes[=DIR]
use GLX with header files found in DIR],
glx_includes=$withval, glx_includes=auto
)
if test "x$glx_includes" = xno; then
glx_libraries=""
fi
if test "x$glx_librariesS" = xno; then
glx_includes=""
fi
dnl Checks for GLX headers. lib[Mesa]GL should be either in a standard
dnl include directory or the X include directory. Either way, we
dnl use X_CFLAGS.
if test "x$glx_includes" != xauto -a "x$glx_includes" != x; then
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS -I$glx_includes"
AC_CHECK_HEADER($glx_includes/GL/gl.h, HAVE_GLX=yes, HAVE_GLX=no )
CPPFLAGS="$save_CPPFLAGS"
else
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
AC_CHECK_HEADER(GL/gl.h, HAVE_GLX=yes, HAVE_GLX=no)
CPPFLAGS="$save_CPPFLAGS"
fi
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $X_CFLAGS"
dnl Checks for OpenGL features in headers
if test "x$HAVE_GLX" != xno; then
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("");],
AC_MSG_RESULT(yes)
,
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
CPPFLAGS="$save_CPPFLAGS"
dnl Make sure -lGL or -lMesaGL works
if test "x$glx_libraries" != xauto -a "x$glx_libraries" != xno -a "x$glx_libraries" != x; then
if test "x$HAVE_GLX" = xyes; then
HAVE_GLX=no
AC_CHECK_LIB(GL, glColor4f,
HAVE_GLX=yes
GLX_NAME=GL,,
[ -L$glx_libraries ]
)
if test "x$HAVE_GLX" != xyes; then
AC_CHECK_LIB(MesaGL, glColor4f,
HAVE_GLX=yes
GLX_NAME=MesaGL,,
[ -L$glx_libraries ]
)
fi
if test "x$HAVE_GLX" = xyes -a "x$have_dynload" != xyes; then
AC_CHECK_LIB($GLX_NAME, XMesaSetFXmode,
AC_DEFINE(HAVE_XMESA),,
[ -L$glx_libraries ]
)
fi
fi
else
if test "x$glx_libraries" != xauto \
-o "x$glx_libraries" != xno \
-o "x$glx_libraries" != x; then
glx_libraries=""
fi
if test "x$HAVE_GLX" = xyes; then
HAVE_GLX=no
AC_CHECK_LIB(GL, glColor4f,
HAVE_GLX=yes
GLX_NAME=GL,,
[ $X_LIBS ]
)
if test "x$HAVE_GLX" != xyes; then
AC_CHECK_LIB(MesaGL, glColor4f,
HAVE_GLX=yes
GLX_NAME=MesaGL,,
[ $X_LIBS ]
)
fi
if test "x$HAVE_GLX" = xyes -a "x$have_dynload" != xyes; then
AC_CHECK_LIB($GLX_NAME, XMesaSetFXmode,
AC_DEFINE(HAVE_XMESA),,
[ $X_LIBS ]
)
fi
fi
fi
if test "x$HAVE_GLX" = xyes; then
if test "x$GLX_CFLAGS" != x; then
GLX_CFLAGS="-I$GLX_CFLAGS"
fi
if test "x$glx_libraries" != x; then
GLX_LIBS="-L$glx_libraries"
fi
GLX_LIBS="$GLX_LIBS -l$GLX_NAME"
AC_DEFINE(HAVE_GLX)
else
GLX_CFLAGS=""
GLX_LIBS=""
fi
AC_SUBST(GLX_CFLAGS)
AC_SUBST(GLX_LIBS)
NET_LIBS=""
if test "x$ac_cv_func_connect" != "xyes"; then
AC_MSG_CHECKING([for connect in -lwsock32])
SAVELIBS="$LIBS"
LIBS="$LIBS -lwsock32"
AC_TRY_LINK([
#include <winsock.h>
],[
connect(0, NULL, 42);
],
NET_LIBS="$NET_LIBS -lwsock32 -lwinmm"
AC_MSG_RESULT(yes),
AC_MSG_RESULT(no))
LIBS="$SAVELIBS"
fi
AC_SUBST(NET_LIBS)
dnl ==================================================================
dnl Misc checks
dnl ==================================================================
dnl Set $prefix and $exec_prefix to $ac_default_prefix if they are not set
test "x$prefix" = xNONE && prefix=$ac_default_prefix
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
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_ARG_WITH(gamename,
[ --with-newstyle compile with defaults a bit different than those
used by Id Software (does not affect gameplay)],
NEWSTYLE=$enable_newstyle
)
if test "x$NEWSTYLE" = xyes; then
AC_DEFINE(NEWSTYLE)
AC_DEFINE(BASEGAME, "base")
else
AC_DEFINE(BASEGAME, "id1")
fi
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.conf],
globalconf="$withval", globalconf="auto")
if test "x$globalconf" = "xauto" || test "x$globalconf" = "xyes" || \
test "x$globalconf" = "xno"; then dnl yes/no sanity checks
eval foo="$sysconfdir"
AC_DEFINE_UNQUOTED(FS_GLOBALCFG, "$foo/quakeforge.conf")
else
AC_DEFINE_UNQUOTED(FS_GLOBALCFG, $globalconf)
fi
AC_ARG_WITH(sharepath,
[ --with-sharepath=DIR Use DIR for shared game data, defaults to
\${datadir}/games/quakeforge],
SHAREPATH=$withval, SHAREPATH="auto")
if test "x$SHAREPATH" = "xauto" -o "x$SHAREPATH" = "xyes" -o "x$SHAREPATH" = "x"; then
eval foo="$datadir"
AC_DEFINE_UNQUOTED(FS_SHAREPATH, "$foo/games/quakeforge")
elif test "x$SHAREPATH" = xno; then
AC_DEFINE_UNQUOTED(FS_SHAREPATH, ".")
else
AC_DEFINE_UNQUOTED(FS_SHAREPATH, "$SHAREPATH")
fi
AC_ARG_WITH(userpath,
[ --with-userpath=DIR Use DIR for unshared game data, defaults to
\${HOME}/.quakeforge],
USERPATH=$withval, USERPATH="auto")
if test "x$USERPATH" = "xauto" -o "x$USERPATH" = "xyes" -o "x$USERPATH" = "x"; then
AC_DEFINE_UNQUOTED(FS_USERPATH, "~/.quakeforge")
elif test "x$USERPATH" = xno; then
AC_DEFINE_UNQUOTED(FS_USERPATH, ".")
else
AC_DEFINE_UNQUOTED(FS_USERPATH, "$USERPATH")
fi
dnl CFLAGS for release and devel versions
AC_ARG_ENABLE(release,
[ --enable-release compile release (with optimizations)],
RELEASE=$enable_release
)
if test "x$RELEASE" = xyes; then
CFLAGS="-O6 -ffast-math -funroll-loops -fomit-frame-pointer -fexpensive-optimizations"
if test "x$GCC" = xyes; then
AC_MSG_CHECKING(for special release compiler settings)
case "${host}" in
i?86-*-*)
MORE_CFLAGS="-malign-loops=4 -malign-jumps=4 -malign-functions=4"
;;
*)
MORE_CFLAGS=""
;;
esac
if test "x$MORE_CFLAGS" = x; then
AC_MSG_RESULT(no)
else
AC_MSG_RESULT(yes)
CFLAGS="$CFLAGS $MORE_CFLAGS"
fi
else
CFLAGS=-O2
fi
fi
dnl QuakeForge code has lots of BCPL-style (//) 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 "${host}" 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"
# CFLAGS="$CFLAGS -Wall -pedantic"
fi
dnl Check for ia32
AC_MSG_CHECKING(for an ia32 machine)
case "${host}" in
i?86-*-*)
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
AC_MSG_RESULT(yes),
AC_DEFINE(USE_INTEL_ASM)
AC_MSG_RESULT(no)
)
;;
*) AC_MSG_RESULT(no)
esac
AC_SUBST(ASM_ARCH)
dnl Checks for which system driver to use
AC_MSG_CHECKING(for system driver)
case "${host}" in
i?86-*-mingw32*)
SYSTYPE=WIN32
AC_MSG_RESULT([Win32 driver])
;;
*)
SYSTYPE=POSIX
AC_MSG_RESULT([default POSIX driver])
;;
esac
AM_CONDITIONAL(SYSTYPE_WIN32, test "$SYSTYPE" = "WIN32")
dnl ==================================================================
dnl Find out what to build and finish
dnl ==================================================================
if test "x$HAVE_SVGA" = xyes; then
TARGETS="$TARGETS qf-client-svga\$(EXEEXT)"
fi
if test "x$HAVE_GGI" = xyes; then
TARGETS="$TARGETS qf-client-ggi\$(EXEEXT)"
fi
if test "x$HAVE_X" = xyes; then
TARGETS="$TARGETS qf-client-x11\$(EXEEXT)"
if test "x$HAVE_GLX" = xyes; then
TARGETS="$TARGETS qf-client-glx\$(EXEEXT)"
fi
fi
AC_SUBST(TARGETS)
dnl Output files
AC_OUTPUT(
include/Makefile
source/Makefile
doc/Makefile
doc/man/Makefile
doc/texinfo/Makefile
Makefile
RPM/quakeforge.spec
RPM/build_rpm
quakeforge.lsm,
chmod +x RPM/build_rpm
)
AC_MSG_RESULT([
The following targets have been configured:
$TARGETS]
)