1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302
|
dnl ========================================================================
dnl = W O R M U X - confiure.ac =
dnl = =
dnl = Process this file with autoconf to produce a configure script. =
dnl ========================================================================
dnl ========================================================================
dnl === Initial configuration =
dnl ========================================================================
dnl = Require at least automake 2.52
AC_PREREQ(2.52)
AC_INIT([Wormux], [0.7.4], [wormux-dev@gna.org], [wormux])
AC_CONFIG_SRCDIR([src/main.cpp])
dnl Detect the canonical host and target build environment
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
#AC_CONFIG_AUX_DIR([config])
AM_INIT_AUTOMAKE([foreign 1.5])
AM_MAINTAINER_MODE
AM_GNU_GETTEXT([external])
dnl ========================================================================
dnl === Check for tools =
dnl ========================================================================
AC_PROG_MAKE_SET
AC_PROG_CC
AC_PROG_CXX
AC_PROG_CPP
AC_PROG_INSTALL
AC_CHECK_PROG(cxx_present, $CXX, "yes", "no")
if test "x$cxx_present" != "xyes"; then
AC_MSG_ERROR([*** No C++ compiler can be found!])
fi
dnl =========================================================================
dnl === Options for users =
dnl =========================================================================
AX_CFLAGS_WARN_ALL([CXXFLAGS])
AC_ARG_ENABLE([debug],
[ --enable-debug Enable debug in Wormux],
debug=$enableval,
debug="")
AC_ARG_ENABLE([profile],
[ --enable-profile Enable profiling],
[if test "x${enableval}" = "xyes" ; then
CXXFLAGS="$CXXFLAGS -pg"
fi])
AC_ARG_ENABLE([static],
[ --enable-static Enable static building of wormux],
[static=$enableval],
[static=no])
# Check whether user supplied the option to statically link binaries.
#if test "$static" = yes; then
# if we're using gcc, add `-static' to LDFLAGS
# if test -n "$GCC" || test "$ac_cv_prog_gcc" = "yes"; then
# STATIC_LD="-static"
# LDFLAGS="$LDFLAGS -static"
# fi
#fi
if test "x${prefix}" = "xNONE"; then
prefix="${ac_default_prefix}"
fi
DATADIR="${prefix}/share/wormux"
AC_ARG_WITH(datadir-name,
[ --with-datadir-name=DIR specify where datas are installed (default: ${prefix}/share/wormux)],
[DATADIR="$withval"])
AC_SUBST([DATADIR])
LOCALEDIR="${prefix}/share/locale"
AC_ARG_WITH(localedir-name,
[ --with-localedir-name=DIR specify where locales are installed (default: ${prefix}/share/locale)],
[LOCALEDIR="$withval"])
AC_SUBST([LOCALEDIR])
FONTFILE="\${DATADIR}/font/DejaVuSans.ttf"
AC_ARG_WITH(font-path,
[ --with-font-path=FILE specify the font file (default: ${datadir}/font/DejaVuSans.ttf)],
[FONTFILE="$withval"])
AC_SUBST([FONTFILE])
AM_CONDITIONAL([STATIC], [test x$static = xyes])
AM_CONDITIONAL([GCC], [test x$GXX = xyes])
AM_CONDITIONAL([INCLUDEDINTL], [test x$nls_cv_use_gnu_gettext = xyes])
dnl ========================================================================
dnl === Checks for required libraries to be present =
dnl ========================================================================
SDL_VERSION=1.2.6
dnl === Set compiler flags =================================================
if test "x$GCC" = "xyes"; then
dnl get gcc version
AC_MSG_CHECKING([gcc version])
gccver=$($CC -dumpversion)
gccvermajor=$(echo $gccver | cut -d . -f1)
gccverminor=$(echo $gccver | cut -d . -f2)
gccvernum=$(expr $gccvermajor "*" 100 + $gccverminor)
AC_MSG_RESULT($gccver)
dnl Enable all warnings
GCC_FLAGS="-Wall"
dnl Enable *more* warnings
if test "$gccvernum" -ge "400"; then
dnl gcc 4.0 or later
GCC_FLAGS="$GCC_FLAGS -Wextra"
else
GCC_FLAGS="$GCC_FLAGS -W"
fi
dnl Skip 'unused parameter' warning
GCC_FLAGS="$GCC_FLAGS -Wno-unused-parameter"
if test "${debug}" = "yes"; then
GCC_FLAGS="$GCC_FLAGS -O0 -g -DDEBUG -Werror"
else
GCC_FLAGS="$GCC_FLAGS -O2"
fi
CFLAGS="$CFLAGS $GCC_FLAGS"
CXXFLAGS="$CXXFLAGS $GCC_FLAGS"
else
if test "${debug}" = "yes"; then
CFLAGS="$CFLAGS -DDEBUG"
CXXFLAGS="$CXXFLAGS -DDEBUG"
fi
fi
dnl === Check for SDL ======================================================
AM_PATH_SDL($SDL_VERSION,
:,
AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!]))
CXXFLAGS="$CXXFLAGS $SDL_CFLAGS"
CFLAGS="$CFLAGS $SDL_CFLAGS"
CPPFLAGS="$CPPFLAGS $SDL_CFLAGS"
LIBS="$LIBS $SDL_LIBS"
dnl === Check for SDL_image ================================================
AC_CHECK_LIB(SDL_image, IMG_Load,,
AC_MSG_ERROR([SDL_image library required]))
LIBS="$LIBS -lSDL_image"
dnl === Check for SDL_mixer ================================================
AC_CHECK_LIB(SDL_mixer, Mix_OpenAudio,,
AC_MSG_ERROR([SDL_mixer library required]))
LIBS="$LIBS -lSDL_mixer"
dnl === Check for SDL_ttf ==================================================
AC_CHECK_LIB([SDL_ttf], [TTF_OpenFont],,
AC_MSG_ERROR([SDL_ttf library is required]))
LIBS="$LIBS -lSDL_ttf"
dnl === Check for SDL_net ==================================================
AC_CHECK_LIB([SDL_net], [SDLNet_Init],,
AC_MSG_ERROR([SDL_net library is required]))
LIBS="$LIBS -lSDL_net"
dnl === Check for SDL_gfx ==================================================
AC_ARG_WITH(sdl-gfx-prefix,
[ --with-sdl-gfx-prefix=DIR specify where SDL_gfx library is installed],
[SDL_GFX_PREFIX="$withval"])
AC_SUBST(SDL_GFX_PREFIX)
if test "x$SDL_GFX_PREFIX" != "x"; then
CPPFLAGS="$CPPFLAGS -I$SDL_GFX_PREFIX/include/SDL"
CXXFLAGS="$CXXFLAGS -I$SDL_GFX_PREFIX/include/SDL"
fi
AC_CHECK_LIB(SDL_gfx, rotozoomSurfaceXY,,
AC_MSG_ERROR([SDL_gfx library >= 2.0.13 required]))
AC_CHECK_HEADERS(SDL_rotozoom.h,,
AC_MSG_ERROR([SDL_gfx library headers are missing]))
LIBS="$LIBS -lSDL_gfx"
#dnl === Check for paragui-config ==========================================
#AC_PATH_PROGS([PGUI_CONFIG], [paragui-config], [none])
#if test "x$PGUI_CONFIG" = "xnone"; then
# AC_MSG_ERROR([*** paragui-config has not been found.])
#fi
#AC_MSG_CHECKING(for Paragui)
#if $PGUI_CONFIG --libs > /dev/null 2>&1; then
# AC_MSG_RESULT(yes)
#else
# AC_MSG_RESULT(no)
# AC_MSG_ERROR([*** Paragui not found!])
#fi
#PARAGUI_CFLAGS=`$PGUI_CONFIG --cflags`
#PARAGUI_LIBS=`$PGUI_CONFIG --libs`
#CFLAGS="$CFLAGS $PARAGUI_CFLAGS"
#CXXFLAGS="$CXXFLAGS $PARAGUI_CFLAGS"
#LIBS="$LIBS $PARAGUI_LIBS"
dnl === Check for libxml++ 2.6 =============================================
dnl Check first for pkg-config
AC_PATH_PROGS([PACKAGE_CONFIG], [pkg-config], [none])
if test "x$PACKAGE_CONFIG" = "xnone"; then
AC_MSG_ERROR([*** pkg-config, needed to check for libxml++ existence
has not been found.])
fi
AC_MSG_CHECKING(for libxml++)
if $PACKAGE_CONFIG libxml++-2.6 --libs > /dev/null 2>&1; then
AC_MSG_RESULT(yes)
else
AC_MSG_RESULT(no)
AC_MSG_ERROR([*** libxml++ version 2.6 not found!])
fi
LIBXMLPP_CFLAGS=`$PACKAGE_CONFIG libxml++-2.6 --cflags`
LIBXMLPP_LIBS=`$PACKAGE_CONFIG libxml++-2.6 --libs`
CFLAGS="$CFLAGS $LIBXMLPP_CFLAGS"
CXXFLAGS="$CXXFLAGS $LIBXMLPP_CFLAGS"
LIBS="$LIBS $LIBXMLPP_LIBS"
dnl ========================================================================
dnl == Set flags for various environments =
dnl ========================================================================
case "${host}" in
i[[3456789]]86-*-mingw32*) WIN32="yes" ;;
*cygwin*) WIN32="yes" ;;
*) WIN32="no" ;;
esac
AM_CONDITIONAL([WIN32], test "$WIN32" = "yes")
dnl ========================================================================
dnl == Check for header files =
dnl ========================================================================
dnl TODO: remove them when we don't need them any more ;)
AC_HEADER_DIRENT
AC_HEADER_STDC
dnl ========================================================================
dnl === Data file substitution. ===
dnl ========================================================================
DATA_FILES=`cd data ; find . -name CVS -prune -o -name ".svn*" -prune -o -name "Makefile*" -o -name ".#*" -o -type d -o -print`
DATA_FILES=`echo $DATA_FILES`
AC_SUBST([DATA_FILES])
AC_SUBST([BUILD_ENV])
AM_PO_SUBDIRS
AC_CONFIG_FILES([Makefile
data/Makefile
src/Makefile
doc/Makefile
])
AC_CONFIG_FILES([po/Makefile], [AM_POSTPROCESS_PO_MAKEFILE])
AM_CONFIG_HEADER(src/config.h)
AC_OUTPUT
AC_MSG_RESULT([
Configuration complete
* Game data will be installed into $DATADIR
* Game locale will be installed into $LOCALEDIR
* Font file will be $FONTFILE
Execute make to compile then execute make install to install...
])
|