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 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371
|
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_INIT([Tux Of Math Command],[2.0.3],[tuxmath-devel@lists.sourceforge.net],[tuxmath])
AC_PREREQ(2.61)
AC_CANONICAL_HOST
AC_CANONICAL_BUILD
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE(foreign)
AC_CONFIG_SRCDIR([src/tuxmath.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
NAME_VERSION=$PACKAGE-$VERSION
AC_DEFINE_UNQUOTED([PROGRAM_NAME], "$PACKAGE", [Tux Of Math Command])
AC_SUBST(NAME_VERSION)
AC_GNU_SOURCE
dnl For libtool support to link libt4k-common:
dnl NOTE - currently libtool init commented out because of errors in crossbuild.
dnl libtool not actually needed until we start to use libt4k-common.
dnl When crossbuild issues fixed, uncomment libtool init and remove ranlib line.
#LT_INIT
AC_PROG_RANLIB
# ----------------------------------------------------------------------
# Checks for programs.
# ----------------------------------------------------------------------
AC_PROG_CXX
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_AWK
AC_PROG_CPP
AC_PROG_MKDIR_P
AC_PROG_YACC
# ---------------------------------------------------------------------
# Gettext support:
# ---------------------------------------------------------------------
AM_GNU_GETTEXT_VERSION([0.18.1])
dnl Note that having a bundled intl/ directory is now deprecated
AM_GNU_GETTEXT([external])
# -----------------------------------------------------------------------
# Checks for libraries.
# -----------------------------------------------------------------------
dnl ---------------------------------------------------------------------------
dnl In the following checks we attempt to use pkg-config if available, falling
dnl back to standard autoconf macro as needed:
dnl ---------------------------------------------------------------------------
dnl Check for SDL
PKG_CHECK_MODULES([SDL],
[sdl >= 1.2.0],
[],
[SDL_VERSION=1.2.0
AM_PATH_SDL($SDL_VERSION, :,
AC_MSG_ERROR([SDL version $SDL_VERSION not found! http://www.libsdl.org]))])
CFLAGS="$CFLAGS $SDL_CFLAGS"
LIBS="$LIBS $SDL_LIBS"
dnl Check for SDL_image: ------------------------------------------------------
PKG_CHECK_MODULES([SDL_IMAGE],
[SDL_image],
[],
[AC_MSG_NOTICE([SDL_image not located by pkg-config, checking with AC CHECK LIB:])
AC_CHECK_LIB([SDL_image],
[IMG_Load],
[],
[AC_MSG_ERROR([SDL_image not found! http://www.libsdl.org/projects/SDL_image])])])
AC_DEFINE([HAVE_LIBSDL_IMAGE],[1],[Define to 1 if you have the 'SDL_image' library])
CFLAGS="$CFLAGS $SDL_IMAGE"
LIBS="$LIBS $SDL_IMAGE_LIBS"
dnl Check for SDL_mixer: --------------------------------------------------------
PKG_CHECK_MODULES([SDL_MIXER],
[SDL_mixer],
[],
[AC_MSG_NOTICE([SDL_mixer not located by pkg-config, checking with AC CHECK LIB:])
AC_CHECK_LIB([SDL_mixer],
[Mix_OpenAudio],
[],
[AC_MSG_ERROR([SDL_mixer not found! http://www.libsdl.org/projects/SDL_mixer])])])
AC_DEFINE([HAVE_LIBSDL_MIXER],[1],[Define to 1 if you have the 'SDL_mixer' library])
CFLAGS="$CFLAGS $SDL_MIXER_CFLAGS"
LIBS="$LIBS $SDL_MIXER_LIBS"
dnl Check for libRSVG and cairo. SVG support is enabled by default ----------------------
AC_ARG_WITH([rsvg],
[AS_HELP_STRING([--without-rsvg],[do not use libRSVG even if available])],
[with_rsvg=no],
[with_rsvg=yes])
if test "x$with_rsvg" = xyes; then
PKG_CHECK_MODULES([RSVG],
[librsvg-2.0 >= 2.18],
[],
[AC_MSG_FAILURE([libRSVG test failed (--without-rsvg to disable svg support)])])
CFLAGS="$CFLAGS $RSVG_CFLAGS"
LIBS="$LIBS $RSVG_LIBS"
fi
if test "x$with_rsvg" = xyes; then
PKG_CHECK_MODULES([CAIRO],
[cairo >= 1.4.10],
[],
[AC_MSG_FAILURE([cairo test failed (--without-rsvg to disable svg support)])])
CFLAGS="$CFLAGS $CAIRO_CFLAGS"
LIBS="$LIBS $CAIRO_LIBS"
AC_DEFINE([HAVE_RSVG],[1],[Define to 1 if you have the `libRSVG` library])
fi
dnl Check for math functions - needed for SDL_extras: --------------------------------------------
AC_CHECK_LIB([m],
[csin],
[],
[AC_MSG_ERROR([Math library not found - functions in <math.h> may not be available.])])
dnl Check for SDL_net: --------------------------------------------------------
dnl SDL_net is enabled by default.
AC_ARG_WITH([sdlnet],
[AS_HELP_STRING([--without-sdlnet],
[Do not use SDL_net even if available])],
[],
[with_sdlnet=yes]
)
if test "x$with_sdlnet" != xno; then
dnl We will need this for socket programming on Win32
AC_CHECK_LIB([ws2_32],
[WSAStartup],
[] ,
[AC_MSG_NOTICE([Windows socket library ws2_32 not found - (only needed on win32)])])
PKG_CHECK_MODULES([SDL_NET],
[SDL_net],
[],
[AC_MSG_NOTICE([SDL_net not located by pkg-config, checking with AC CHECK LIB:])
AC_CHECK_LIB([SDL_net],
[SDLNet_Init],
[],
[AC_MSG_FAILURE([SDL_net test failed (--without-sdlnet to disable)])])])
AC_DEFINE([HAVE_LIBSDL_NET],[1],[Define to 1 if you have the 'SDL_net' library])
CFLAGS="$CFLAGS $SDL_NET_CFLAGS"
LIBS="$LIBS $SDL_NET_LIBS"
fi
dnl Check for libxml2: --------------------------------------------------------
PKG_CHECK_MODULES([XML2],
[libxml-2.0],
[],
[AC_MSG_NOTICE([libxml2 not located by pkg-config, checking with AC CHECK LIB:])
AC_CHECK_LIB([xml2],
[xmlParseFile],
[],
[AC_MSG_ERROR([libxml-2.0 not found: http://www.xmlsoft.org])])])
AC_DEFINE([HAVE_LIBXML2],[1],[Define to 1 if you have the `libxml-2.0` library])
CFLAGS="$CFLAGS $XML2_CFLAGS"
LIBS="$LIBS $XML2_LIBS"
dnl libt4kcommon is now required: --------------------------------------------
PKG_CHECK_MODULES([T4K_COMMON],
[t4k_common],
[],
[AC_MSG_NOTICE([t4k_common not located by pkg-config, checking with AC CHECK LIB:])
AC_CHECK_LIB([t4k_common],
[InitT4KCommon],
[],
[AC_MSG_ERROR([libt4k_common is required: git://git.debian.org/tux4kids/t4kcommon.git])])])
AC_DEFINE([HAVE_LIBT4K_COMMON],[1],[Define to 1 if you have the `t4k_common` library])
CFLAGS="$CFLAGS $T4K_COMMON_CFLAGS"
LIBS="$LIBS $T4K_COMMON_LIBS"
# --------------------------------------------------------------------------------------
# Checks for header files.
# --------------------------------------------------------------------------------------
AC_FUNC_ALLOCA
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS([argz.h error.h errno.h fcntl.h float.h iconv.h inttypes.h langinfo.h libgen.h libintl.h limits.h locale.h malloc.h math.h pthread.h stddef.h stdint.h stdio_ext.h stdlib.h string.h strings.h sys/param.h unistd.h wchar.h])
# --------------------------------------------------------------------------------------------
# Checks for typedefs, structures, and compiler characteristics.
# --------------------------------------------------------------------------------------------
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_C_RESTRICT
AC_TYPE_MODE_T
AC_TYPE_SIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT8_T
AC_C_VOLATILE
AC_CHECK_TYPES([ptrdiff_t])
# -------------------------------------------------------------------------------------------
# Checks for library functions.
# -------------------------------------------------------------------------------------------
AC_FUNC_CLOSEDIR_VOID
AC_FUNC_ERROR_AT_LINE
#AC_FUNC_MALLOC
AC_FUNC_MMAP
#AC_FUNC_REALLOC
AC_FUNC_STAT
AC_FUNC_STRCOLL
AC_FUNC_STRTOD
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([__argz_count __argz_next __argz_stringify alphasort atexit basename bcopy fcntl floor fsync getcwd localeconv localtime_r memmove mempcpy memset Mix_Init mkdir munmap nl_langinfo scandir setlocale sqrt stpcpy strcasecmp strchr strcspn strdup strncasecmp strndup strrchr strstr strtoul])
dnl FIXME - get rid of remaining win32 conditional code
# Check platform - see if WinMain needed:
AC_MSG_CHECKING([for native Win32])
case "$host" in
*-*-mingw*)
native_win32=yes
;;
*)
native_win32=no
;;
esac
AC_MSG_RESULT([$native_win32])
AM_CONDITIONAL(BUILD_MINGW32, test $native_win32 = yes)
# Set the
MINGW32_PACKAGE_DATA_DIR="data"
AC_SUBST(MINGW32_PACKAGE_DATA_DIR)
if test $native_win32 = yes; then
AC_DEFINE([BUILD_MINGW32], 1,[Native MinGW32 build])
CFLAGS="$CFLAGS -D__GW32__"
LIBS="$LIBS -luuid -lole32 -lwsock32 -mwindows"
CPPFLAGS="$CPPFLAGS -idirafter $prefix/include/glibc"
AC_PATH_PROG(WINDRES, "$target_alias-windres", no, [$PATH])
fi
# ------------------------------------------------------------
# Support for building NSIS Win32 installer:
# ------------------------------------------------------------
# This is the temporary DESTDIR target into which we do a "make install" before
# the files get copied into the NSIS installer:
NSI_INSTALL_DIR=mingw32
AC_SUBST(NSI_INSTALL_DIR)
# This is the path (relative to the TuxMath.exe binary) where the data files are
# placed within the TuxMath folder on the user's Windows machine:
MINGW32_PACKAGE_DATA_DIR="data"
AC_SUBST(MINGW32_PACKAGE_DATA_DIR)
AC_ARG_WITH([dll-directory],
AS_HELP_STRING([--with-dll-directory=path], [provide location of DLL files needed for build [$(NSI_DLL_DIR)]]),
[dll_path=$withval],
[dll_path=no])
AM_CONDITIONAL(NSI_BUILD, test $dll_path = no)
if test $dll_path != no; then
NSI_DLL_DIR=$dll_path
else
NSI_DLL_DIR=~/tuxmath_dll
fi
AC_SUBST(NSI_DLL_DIR)
AC_PATH_PROG(NSIS, makensis, [], [$PATH])
AC_PATH_PROGS(U2D, [todos unix2dos], [], [$PATH])
# ---------------------------------------------------------------
# Create Makefiles
# ---------------------------------------------------------------
AC_CONFIG_FILES([
Makefile
tuxmath.spec
tuxmath_preview.spec
data/Makefile
data/fonts/Makefile
data/images/Makefile
data/images/backgrounds/Makefile
data/images/cities/Makefile
data/images/comets/Makefile
data/images/icons/Makefile
data/images/igloos/Makefile
data/images/penguins/Makefile
data/images/sprites/Makefile
data/images/status/Makefile
data/images/title/Makefile
data/images/tux/Makefile
data/images/factoroids/Makefile
data/menus/Makefile
data/missions/Makefile
data/missions/arcade/Makefile
data/missions/campaign/Makefile
data/missions/campaign/ace/Makefile
data/missions/campaign/cadet/Makefile
data/missions/campaign/commando/Makefile
data/missions/campaign/ranger/Makefile
data/missions/campaign/scout/Makefile
data/missions/lessons/Makefile
data/missions/multiplay/Makefile
data/sounds/Makefile
doc/Makefile
nsis/tuxmath.nsi
src/Makefile
po/Makefile.in
])
AC_OUTPUT
|