warzone2100/configure.ac

238 lines
6.6 KiB
Plaintext

# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.56)
AC_INIT([Warzone 2100],[TRUNK],[http://wz2100.net/],[warzone2100])
AM_INIT_AUTOMAKE([1.8])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([lib/framework/frame.c])
# Checks for programs.
AC_PROG_CC
AC_PROG_RANLIB
AC_PROG_YACC
if test "x$YACC" != "xbison -y" ; then
AC_MSG_ERROR([Bison is not installed])
fi
AC_PROG_LEX
if test "x$LEX" != "xflex" ; then
AC_MSG_ERROR([Flex is not installed])
fi
AC_GNU_SOURCE
AM_GNU_GETTEXT([external])
# Check for compiler
case $CC in
icc)
cc_icc=yes
;;
esac
# Check for operating system
case $host_os in
mingw32)
host_os_mingw32=yes
AC_CHECK_TOOL([WINDRES], [windres], AC_MSG_ERROR([windres not found]))
WIN32_LIBS="-lintl -ldbghelp -lshfolder -lwinmm -lwsock32"
;;
*)
AC_DEFINE([_XOPEN_SOURCE], 600, [Enable POSIX extensions if present])
;;
esac
AM_CONDITIONAL([MINGW32], test "x$host_os_mingw32" = "xyes")
# Installation directories
AC_ARG_WITH(icondir,
AS_HELP_STRING([--with-icondir=DIR],[icon files [DATADIR/icons]]),
[ with_icondir=$withval ], [ with_icondir=$datadir/icons ])
AC_ARG_WITH(applicationdir,
AS_HELP_STRING([--with-applicationdir=DIR],[application files [DATADIR/applications]]),
[ with_applicationdir=$withval ], [ with_applicationdir=$datadir/applications ])
AC_SUBST(icondir, $with_icondir)
AC_SUBST(applicationdir, $with_applicationdir)
if test "x$docdir" = "x" ; then
AC_SUBST(docdir, $datarootdir/doc/$AC_PACKAGE_TARNAME)
fi
if test "x$localedir" = "x" ; then
AC_SUBST(localedir, $datadir/locale)
fi
# Commandline options:
AC_ARG_ENABLE([installer],
AS_HELP_STRING([--enable-installer],[Build NSIS installer [no]]),
[ enable_installer=$enableval ], [ enable_installer=no ])
AM_CONDITIONAL(INSTALLER, test "x$enable_installer" = "xyes")
AC_MSG_CHECKING([whether to build NSIS installer])
AC_MSG_RESULT([$enable_installer])
AC_ARG_WITH(makensis,
AS_HELP_STRING([--with-makensis],[Path to makensis]))
AC_ARG_WITH(installer_libdir,
AS_HELP_STRING([--with-installer-extdir],[Path to external data for NSIS script]))
AC_ARG_WITH(installer_version,
AS_HELP_STRING([--with-installer-version],[Version of the installer. i.e. 1.2.3.4]))
if test "x$enable_installer" = "xyes" ; then
if test "x$with_makensis" = "x" ; then
AC_CHECK_TOOL([MAKENSIS], [makensis], [no])
if test "x$MAKENSIS" = "xno" ; then
AC_MSG_ERROR([makensis not found])
fi
else
AC_MSG_CHECKING([for makensis])
AC_MSG_RESULT([$with_makensis])
AC_SUBST(MAKENSIS, $with_makensis)
fi
if test "x$with_installer_version" = "x" ; then
AC_MSG_ERROR([installer version invalid])
else
AC_MSG_CHECKING([for installer version])
AC_MSG_RESULT([$with_installer_version])
AC_SUBST(INSTALLER_VERSION, $with_installer_version)
fi
if test "x$with_installer_extdir" = "x" ; then
AC_MSG_ERROR([installer external dir not found])
else
AC_MSG_CHECKING([for installer extdir])
AC_MSG_RESULT([$with_installer_extdir])
AC_SUBST(INSTALLER_EXTDIR, $with_installer_extdir)
fi
fi
# -O0 turns off all optimizations; this is necessary for accurate debugging
# -Wno-unused-label is necessary because flex produces unused labels that we cannot fix
# Add later for stricter checking: -Wextra -Wmissing-declarations -Wstrict-prototypes
AC_ARG_ENABLE(debug,
AS_HELP_STRING([--enable-debug[=yes/relaxed/no]],[Compile debug version [no]]),
[ enable_debug=$enableval ], [ enable_debug=no ])
AC_MSG_CHECKING([whether to compile in debug mode])
AC_MSG_RESULT([$enable_debug])
if test "x$enable_debug" = "xyes" ; then
if test "x$cc_icc" = "xyes" ; then
WZ_CFLAGS="${WZ_CFLAGS} -O0 -g -DDEBUG -Wall -Werror"
else
WZ_CFLAGS="${WZ_CFLAGS} -O0 -g -DDEBUG -Wall -Werror -Wno-unused-label -Wno-int-to-pointer-cast -Wno-pointer-to-int-cast"
fi
elif test "x$enable_debug" = "xrelaxed" ; then
WZ_CFLAGS="${WZ_CFLAGS} -g -DDEBUG -Wall -Wextra"
else
WZ_CFLAGS="${WZ_CFLAGS} -g -DNDEBUG -Wall"
fi
# Checks for modules:
PKG_CHECK_MODULES([SDL], [sdl >= 1.2])
PKG_CHECK_MODULES([PNG], [libpng >= 1.2])
PKG_CHECK_MODULES([OGGVORBIS], [ogg >= 1.1 vorbis >= 1.1 vorbisfile >= 1.1])
# Checks for libraries:
AC_CHECK_LIB(m, pow)
# PhysFS needs this, since on some systems it is not properly linked:
AC_CHECK_LIB(z, deflate)
# Look for PhysicsFS
AC_CHECK_HEADER(physfs.h, , AC_MSG_ERROR([PhysicsFS header not found]))
AC_CHECK_LIB(physfs, PHYSFS_init, , AC_MSG_ERROR([PhysicsFS not found]))
# Look for SDL_net
AC_CHECK_HEADER(SDL/SDL_net.h, , AC_MSG_ERROR([SDL_net header not found]))
AC_CHECK_LIB(SDL_net, SDLNet_Init, , AC_MSG_ERROR([SDL_net not found]), [-lSDL ${WIN32_LIBS}])
# Look for OpenGL
AC_CHECK_HEADER(SDL/SDL_opengl.h, ,
AC_MSG_ERROR([You need to install SDL with OpenGL support.]))
AC_CHECK_LIB(GL, main,
OPENGL_LIBS="-lGL",
AC_CHECK_LIB(opengl32, main,
OPENGL_LIBS="-lopengl32",
AC_MSG_ERROR([You need to install OpenGL.])))
AC_CHECK_LIB(GLU, main,
OPENGL_LIBS="${OPENGL_LIBS} -lGLU",
AC_CHECK_LIB(glu32, main,
OPENGL_LIBS="${OPENGL_LIBS} -lglu32",
AC_MSG_ERROR([You need to install GLU.])))
# Look for OpenGLC
AC_CHECK_HEADER(GL/glc.h, ,
AC_MSG_ERROR([OpenGLC header not found. You need to install QuesoGLC: http://quesoglc.sourceforge.net/]))
AC_CHECK_LIB(GLC, main,
OPENGLC_LIBS="-lGLC",
AC_CHECK_LIB(glc32, main,
OPENGLC_LIBS="-lglc32",
AC_MSG_ERROR([You need to install QuesoGLC. http://quesoglc.sourceforge.net/])))
# Look for OpenAL
AC_CHECK_HEADER(AL/al.h, ,
AC_MSG_ERROR([You need to install OpenAL headers.]))
AC_CHECK_LIB(openal, main,
OPENAL_LIBS="-lopenal",
AC_CHECK_LIB(openal32, main,
OPENAL_LIBS="-lopenal32",
AC_MSG_ERROR([You need to install OpenAL.])))
AC_DEFINE(DATADIR, "${datadir}/${PACKAGE}", [Directory with gamedata])
AC_DEFINE(LOCALEDIR, "${localedir}", [Directory with gettext locales])
# add some required C flags here
# -DYY_STATIC is required by flex
WZ_CFLAGS="${WZ_CFLAGS} -DYY_STATIC"
CPPFLAGS="${CPPFLAGS} -I\$(top_srcdir)"
CFLAGS="${SDL_CFLAGS} ${PNG_CFLAGS} ${OGGVORBIS_CFLAGS} $} ${OPENAL_CFLAGS} ${OPENGL_CFLAGS} ${CFLAGS} ${WZ_CFLAGS}"
LIBS="${SDL_LIBS} ${PNG_LIBS} ${OGGVORBIS_LIBS} ${OPENAL_LIBS} ${OPENGLC_LIBS} ${OPENGL_LIBS} ${LIBS} ${WIN32_LIBS}"
AC_CONFIG_HEADER([config.h])
AC_CONFIG_FILES([Makefile
po/Makefile.in
icons/Makefile
data/Makefile
data/mods/Makefile
data/mods/global/Makefile
nsis/Makefile
win32/Makefile
lib/Makefile
lib/framework/Makefile
lib/gamelib/Makefile
lib/ivis_opengl/Makefile
lib/ivis_common/Makefile
lib/netplay/Makefile
lib/script/Makefile
lib/sequence/Makefile
lib/sound/Makefile
lib/widget/Makefile
src/Makefile])
AC_OUTPUT
if test "x$enable_debug" = xyes; then
echo ""
echo " *** Running in debug mode! ***"
echo ""
fi