wesnoth/configure.ac

368 lines
9.7 KiB
Plaintext
Raw Normal View History

2003-12-23 20:39:37 +00:00
# Process this file with autoconf to produce a configure script.
2003-12-23 22:45:30 +00:00
#######################################################################
# Initial configuration #
#######################################################################
AC_PREREQ(2.57)
AC_INIT(wesnoth, 0.13, davidnwhite@optusnet.com.au, Battle for Wesnoth)
2003-12-23 20:39:37 +00:00
AC_REVISION($Version: 0.13$)
2003-12-23 20:39:37 +00:00
PACKAGE=wesnoth
MAJOR_VERSION="0"
2004-03-19 19:13:06 +00:00
MINOR_VERSION="7"
MICRO_VERSION="2-CVS"
2003-12-23 20:39:37 +00:00
if test "x$MICRO_VERSION" = "x"; then
VERSION=$MAJOR_VERSION.$MINOR_VERSION
else
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
fi
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
AC_CONFIG_SRCDIR([src/actions.cpp])
AC_CONFIG_HEADER([config.h])
2003-12-23 22:45:30 +00:00
#######################################################################
# Checks for programs. #
#######################################################################
2003-12-23 20:39:37 +00:00
AC_PROG_CXX
AC_PROG_CC
2003-12-23 22:45:30 +00:00
# SDL_CONFIG
2003-12-23 20:39:37 +00:00
AC_PATH_PROGS(SDL_CONFIG, [sdl-config sdl11-config], none)
if test "x$SDL_CONFIG" = "xnone"; then
2003-12-23 22:45:30 +00:00
AC_MSG_ERROR([*** SDL not found! Get SDL from www.libsdl.org.
2003-12-23 20:39:37 +00:00
If you already installed it, check it's in the path. If problem remains,
please send a mail to the address that appears in ./configure --version
indicating your platform, the version of configure script and the problem.])
fi
2003-12-23 22:45:30 +00:00
# GNOME_CONFIG
AC_PATH_PROGS([GNOME_CONFIG], [gnome-config], [none])
if test "x$GNOME_CONFIG" = "xnone"; then
gnome1found=no
2003-12-23 22:45:30 +00:00
else
GNOME1_DESKTOP=`$GNOME_CONFIG --datadir`/gnome/apps/Games
gnome1found=yes
2003-12-23 22:45:30 +00:00
fi
AC_SUBST([GNOME1_DESKTOP])
# KDE_CONFIG
AC_PATH_PROGS(KDE_CONFIG, kde-config, none)
if test "x$KDE_CONFIG" = "xnone"; then
kdefound=no
2003-12-23 22:45:30 +00:00
else
KDE_DESKTOP=`$KDE_CONFIG --expandvars --install apps`/Games/TacticStrategy
KDE_ICON=`$KDE_CONFIG --expandvars --install icon`
kdefound=yes
2003-12-23 22:45:30 +00:00
fi
AC_SUBST([KDE_DESKTOP])
AC_SUBST([KDE_ICON])
#######################################################################
# Checks for libraries. #
#######################################################################
2003-12-23 20:39:37 +00:00
SDL_LIBS=`$SDL_CONFIG --static-libs`
2003-12-23 20:39:37 +00:00
OLD_LIBS=$LIBS
LIBS="$LIBS $SDL_LIBS"
2003-12-23 21:42:56 +00:00
# There's no need for this, $SDL_CONFIG comes with libsdl and
# it doesn't find it in FreeBSD
# AC_CHECK_LIB([SDL], [SDL_Init])
AC_CHECK_LIB([SDL_image],
[IMG_Load],
[SDL_IMAGE_LIBS=-lSDL_image],
[AC_MSG_ERROR([*** SDL_image lib not found! Get SDL_image from
2003-12-23 21:55:07 +00:00
http://www.libsdl.org/projects/SDL_image/index.html])])
2003-12-23 22:45:30 +00:00
2003-12-23 21:42:56 +00:00
AC_CHECK_LIB([SDL_mixer],
[Mix_OpenAudio],
[SDL_MIXER_LIBS=-lSDL_mixer],
[AC_MSG_ERROR([*** SDL_mixer lib not found! Get SDL_mixer from
2003-12-23 21:55:07 +00:00
http://www.libsdl.org/projects/SDL_mixer/index.html])])
2003-12-23 21:42:56 +00:00
AC_CHECK_LIB([SDL_net],
[SDLNet_Init],
[SDL_NET_LIBS=-lSDL_net],
[AC_MSG_ERROR([*** SDL_net lib not found! Get SDL_net from
2003-12-23 21:55:07 +00:00
http://www.libsdl.org/projects/SDL_net/index.html])])
2003-12-23 21:42:56 +00:00
AC_CHECK_LIB([SDL_ttf],
[TTF_OpenFont],
[SDL_TTF_LIBS=-lSDL_ttf],
[AC_MSG_ERROR([*** SDL_ttf lib not found! Get SDL_ttf from
2003-12-23 21:55:07 +00:00
http://www.libsdl.org/projects/SDL_ttf/index.html])])
2003-12-23 21:42:56 +00:00
2003-12-23 20:39:37 +00:00
LIBS=$OLD_LIBS
AC_SUBST([SDL_LIBS])
AC_SUBST([SDL_IMAGE_LIBS])
AC_SUBST([SDL_MIXER_LIBS])
AC_SUBST([SDL_NET_LIBS])
AC_SUBST([SDL_TTF_LIBS])
2003-12-23 22:45:30 +00:00
#######################################################################
# Checks for header files. #
#######################################################################
2003-12-23 20:39:37 +00:00
AC_HEADER_DIRENT
AC_HEADER_STDC
OLD_CPPFLAGS=$CPPFLAGS
OLD_CXXFLAGS=$CXXFLAGS
SDL_CFLAGS=`$SDL_CONFIG --cflags`
SDL_CFLAGS="$SDL_CFLAGS"
CPPFLAGS="$CPPFLAGS $SDL_CFLAGS"
CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
2003-12-23 20:39:37 +00:00
2003-12-23 21:42:56 +00:00
AC_CHECK_HEADER([SDL.h],
[],
[AC_MSG_ERROR([*** SDL include files not found!
2003-12-23 21:55:07 +00:00
You should install SDL development package.])])
2003-12-23 21:42:56 +00:00
AC_CHECK_HEADER([SDL_image.h],
[],
[AC_MSG_ERROR([*** SDL_image include files not found!
2003-12-23 21:55:07 +00:00
You should install development package.])])
2003-12-23 21:42:56 +00:00
AC_CHECK_HEADER([SDL_mixer.h],
[],
[AC_MSG_ERROR([*** SDL_mixer include files not found!
2003-12-23 21:55:07 +00:00
You should install development package.])])
2003-12-23 21:42:56 +00:00
AC_CHECK_HEADER([SDL_net.h],
[],
[AC_MSG_ERROR([*** SDL_net include files not found!
2003-12-23 21:55:07 +00:00
You should install development package.])])
2003-12-23 21:42:56 +00:00
AC_CHECK_HEADER([SDL_ttf.h],
[],
[AC_MSG_ERROR([*** SDL_ttf include files not found!
2003-12-23 21:55:07 +00:00
You should install development package.])])
2003-12-23 21:42:56 +00:00
2003-12-23 20:39:37 +00:00
CPPFLAGS=$OLD_CPPFLAGS
CXXFLAGS=$OLD_CXXFLAGS
AC_SUBST([SDL_CFLAGS])
2003-12-23 21:42:56 +00:00
AC_CHECK_HEADERS([stdlib.h unistd.h])
2003-12-23 22:45:30 +00:00
#######################################################################
# Checks for typedefs, structures, and compiler characteristics. #
#######################################################################
2003-12-23 20:39:37 +00:00
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_TYPE_MODE_T
AC_TYPE_SIZE_T
AC_STRUCT_TM
# Checks for library functions.
AC_FUNC_ERROR_AT_LINE
AC_FUNC_STAT
AC_FUNC_STRFTIME
AC_CHECK_FUNCS([floor socket strtoul])
2003-12-23 22:45:30 +00:00
#######################################################################
# Check for PNG support in SDL_image #
#######################################################################
AC_MSG_CHECKING([for PNG support in SDL_image])
OLD_CPPFLAGS=$CPPFLAGS
OLD_CXXFLAGS=$CXXFLAGS
OLD_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $SDL_CFLAGS"
CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
2003-12-23 22:45:30 +00:00
LIBS="$LIBS $SDL_LIBS $SDL_IMAGE_LIBS"
AC_TRY_RUN([
#include <SDL_image.h>
#include <stdlib.h>
int main(int argc, char **argv)
2003-12-23 22:45:30 +00:00
{
SDL_RWops *src;
src = SDL_RWFromFile("images/mage.png", "rb");
if (src == NULL)
exit(0);
exit(!IMG_isPNG(src));
}
],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)]
[AC_MSG_ERROR([*** SDL_image has no PNG support! You need SDL_image with PNG support])],
[AC_MSG_RESULT[not tested in cross-compiling]])
CPPFLAGS=$OLD_CPPFLAGS
CXXFLAGS=$OLD_CXXFLAGS
LIBS=$OLD_LIBS
#######################################################################
# Check for OGG support in SDL_mixer #
#######################################################################
AC_MSG_CHECKING([for OGG support in SDL_mixer])
OLD_CPPFLAGS=$CPPFLAGS
OLD_CXXFLAGS=$CXXFLAGS
2003-12-23 22:45:30 +00:00
OLD_LIBS=$LIBS
CPPFLAGS="$CPPFLAGS $SDL_CFLAGS"
CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
2003-12-23 22:45:30 +00:00
LIBS="$LIBS $SDL_LIBS $SDL_MIXER_LIBS"
AC_TRY_RUN([
#include <SDL_mixer.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
char *music;
2003-12-23 22:45:30 +00:00
music = (char *) OGG_new("music/wesnoth-1.ogg");
if (music == NULL)
exit(1);
exit(0);
}
],
[AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)]
[AC_MSG_ERROR([*** SDL_mixer has no OGG support! You need SDL_mixer with OGG support])],
[AC_MSG_RESULT[not tested in cross-compiling]])
CPPFLAGS=$OLD_CPPFLAGS
CXXFLAGS=$OLD_CXXFLAGS
2003-12-23 22:45:30 +00:00
LIBS=$OLD_LIBS
#######################################################################
# Configuration options #
#######################################################################
2003-12-23 20:39:37 +00:00
AC_ARG_ENABLE(debug,
[ --enable-debug Enable debug in wesnoth],
CXXFLAGS="$CXXFLAGS -DDEBUG -ggdb3")
AC_ARG_ENABLE([static],
[ --enable-static Enable static building of wesnoth],
[CXXFLAGS="$CXXFLAGS -static"]
[LIBS="$LIBS -static"])
2003-12-23 21:55:07 +00:00
DATADIR=$PACKAGE
2003-12-23 21:42:56 +00:00
AC_ARG_ENABLE(datadir-name,
[ --datadir-name[[=dir]] Change name of data directory. Default with this option: wesnoth-data],
2003-12-23 21:42:56 +00:00
[case "${enableval}" in
yes)
DATADIR="wesnoth-data"
;;
no)
;;
*)
DATADIR="${enableval}"
;;
esac])
AC_SUBST(DATADIR)
2003-12-23 20:39:37 +00:00
# Default behaviour
server=no
editor=no
tools=no
AC_ARG_ENABLE(server,
[ --enable-server Enable compilation of server],
server=$enableval,
server=no)
2003-12-23 20:39:37 +00:00
AC_ARG_ENABLE(editor,
[ --enable-editor Enable compilation editor],
editor=$enableval,
editor=no)
2003-12-23 20:39:37 +00:00
AC_ARG_ENABLE(tools,
[ --enable-tools Enable compilation of translation tools],
tools=$enableval,
tools=no)
2003-12-23 20:39:37 +00:00
AC_ARG_ENABLE(kde,
[ --enable-kde Enable installation of icon and KDE menu entry],
kde=$enableval,
kde=no)
AC_ARG_ENABLE(gnome,
[ --enable-gnome Enable installation of icon and GNOME menu entry],
gnome=$enableval,
gnome=no)
2003-12-23 22:45:30 +00:00
2003-12-23 20:39:37 +00:00
AM_CONDITIONAL(SERVER, test x$server = xyes)
AM_CONDITIONAL(EDITOR, test x$editor = xyes)
AM_CONDITIONAL(TOOLS, test x$tools = xyes)
AM_CONDITIONAL(KDE, test x$kde = xyes && test x$kdefound = xyes)
AM_CONDITIONAL(GNOME1, test x$gnome = xyes && test x$gnome1found = xyes)
AM_CONDITIONAL(GNOME2, test x$gnome = xyes && test x$gnome1found = xno)
2003-12-23 22:45:30 +00:00
#######################################################################
# Data file substitution. #
#######################################################################
2003-12-23 20:39:37 +00:00
MANUAL_FILES=`ls MANUAL*`
MANUAL_FILES=`echo $MANUAL_FILES`
DATA_FILES=`find data -name CVS -prune -o -name ".cvs*" -o -name ".#*" -o -type d -o -print`
DATA_FILES=`echo $DATA_FILES`
FONT_FILES=`find fonts -name CVS -prune -o -name ".cvs*" -o -name ".#*" -o -type d -o -print`
FONT_FILES=`echo $FONT_FILES`
IMAGE_FILES=`find images -name CVS -prune -o -name ".cvs*" -o -name ".#*" -o -type d -o -print`
IMAGE_FILES=`echo $IMAGE_FILES`
MUSIC_FILES=`find music -name CVS -prune -o -name ".cvs*" -o -name ".#*" -o -type d -o -print`
MUSIC_FILES=`echo $MUSIC_FILES`
SOUND_FILES=`find sounds -name CVS -prune -o -name ".cvs*" -o -name ".#*" -o -type d -o -print`
SOUND_FILES=`echo $SOUND_FILES`
UTIL_FILES=`find utils -name CVS -prune -o -name ".cvs*" -o -name ".#*" -o -type d -o -print`
UTIL_FILES=`echo $UTIL_FILES`
AC_SUBST([MANUAL_FILES])
AC_SUBST([DATA_FILES])
AC_SUBST([FONT_FILES])
AC_SUBST([IMAGE_FILES])
AC_SUBST([MUSIC_FILES])
AC_SUBST([SOUND_FILES])
AC_SUBST([UTIL_FILES])
2003-12-23 22:45:30 +00:00
2003-12-23 20:39:37 +00:00
AC_CONFIG_FILES([Makefile
2003-12-23 22:45:30 +00:00
icons/Makefile
2003-12-23 20:39:37 +00:00
src/Makefile
src/server/Makefile
src/tools/Makefile])
AC_OUTPUT