1# -*- Autoconf -*- 2# Process this file with autoconf to produce a configure script. 3AC_INIT([Tux Of Math Command],[2.0.3],[tuxmath-devel@lists.sourceforge.net],[tuxmath]) 4 5AC_PREREQ(2.61) 6AC_CANONICAL_HOST 7AC_CANONICAL_BUILD 8AC_CANONICAL_TARGET 9 10AM_INIT_AUTOMAKE(foreign) 11AC_CONFIG_SRCDIR([src/tuxmath.c]) 12AC_CONFIG_HEADERS([config.h]) 13AC_CONFIG_MACRO_DIR([m4]) 14 15NAME_VERSION=$PACKAGE-$VERSION 16 17AC_DEFINE_UNQUOTED([PROGRAM_NAME], "$PACKAGE", [Tux Of Math Command]) 18 19AC_SUBST(NAME_VERSION) 20 21AC_GNU_SOURCE 22 23dnl For libtool support to link libt4k-common: 24dnl NOTE - currently libtool init commented out because of errors in crossbuild. 25dnl libtool not actually needed until we start to use libt4k-common. 26dnl When crossbuild issues fixed, uncomment libtool init and remove ranlib line. 27#LT_INIT 28AC_PROG_RANLIB 29 30# ---------------------------------------------------------------------- 31# Checks for programs. 32# ---------------------------------------------------------------------- 33 34AC_PROG_CXX 35AC_PROG_CC 36AC_PROG_INSTALL 37AC_PROG_MAKE_SET 38AC_PROG_AWK 39AC_PROG_CPP 40AC_PROG_MKDIR_P 41AC_PROG_YACC 42 43 44# --------------------------------------------------------------------- 45# Gettext support: 46# --------------------------------------------------------------------- 47 48AM_GNU_GETTEXT_VERSION([0.18.1]) 49dnl Note that having a bundled intl/ directory is now deprecated 50AM_GNU_GETTEXT([external]) 51 52 53 54 55 56# ----------------------------------------------------------------------- 57# Checks for libraries. 58# ----------------------------------------------------------------------- 59 60 61dnl --------------------------------------------------------------------------- 62dnl In the following checks we attempt to use pkg-config if available, falling 63dnl back to standard autoconf macro as needed: 64dnl --------------------------------------------------------------------------- 65 66 67 68dnl Check for SDL 69PKG_CHECK_MODULES([SDL], 70 [sdl >= 1.2.0], 71 [], 72 [SDL_VERSION=1.2.0 73 AM_PATH_SDL($SDL_VERSION, :, 74 AC_MSG_ERROR([SDL version $SDL_VERSION not found! http://www.libsdl.org]))]) 75 76CFLAGS="$CFLAGS $SDL_CFLAGS" 77LIBS="$LIBS $SDL_LIBS" 78 79 80 81dnl Check for SDL_image: ------------------------------------------------------ 82 83PKG_CHECK_MODULES([SDL_IMAGE], 84 [SDL_image], 85 [], 86 [AC_MSG_NOTICE([SDL_image not located by pkg-config, checking with AC CHECK LIB:]) 87 AC_CHECK_LIB([SDL_image], 88 [IMG_Load], 89 [], 90 [AC_MSG_ERROR([SDL_image not found! http://www.libsdl.org/projects/SDL_image])])]) 91 92AC_DEFINE([HAVE_LIBSDL_IMAGE],[1],[Define to 1 if you have the 'SDL_image' library]) 93CFLAGS="$CFLAGS $SDL_IMAGE" 94LIBS="$LIBS $SDL_IMAGE_LIBS" 95 96 97 98dnl Check for SDL_mixer: -------------------------------------------------------- 99 100PKG_CHECK_MODULES([SDL_MIXER], 101 [SDL_mixer], 102 [], 103 [AC_MSG_NOTICE([SDL_mixer not located by pkg-config, checking with AC CHECK LIB:]) 104 AC_CHECK_LIB([SDL_mixer], 105 [Mix_OpenAudio], 106 [], 107 [AC_MSG_ERROR([SDL_mixer not found! http://www.libsdl.org/projects/SDL_mixer])])]) 108 109AC_DEFINE([HAVE_LIBSDL_MIXER],[1],[Define to 1 if you have the 'SDL_mixer' library]) 110CFLAGS="$CFLAGS $SDL_MIXER_CFLAGS" 111LIBS="$LIBS $SDL_MIXER_LIBS" 112 113dnl Check for libRSVG and cairo. SVG support is enabled by default ---------------------- 114 115AC_ARG_WITH([rsvg], 116 [AS_HELP_STRING([--without-rsvg],[do not use libRSVG even if available])], 117 [with_rsvg=no], 118 [with_rsvg=yes]) 119 120if test "x$with_rsvg" = xyes; then 121PKG_CHECK_MODULES([RSVG], 122 [librsvg-2.0 >= 2.18], 123 [], 124 [AC_MSG_FAILURE([libRSVG test failed (--without-rsvg to disable svg support)])]) 125 126CFLAGS="$CFLAGS $RSVG_CFLAGS" 127LIBS="$LIBS $RSVG_LIBS" 128fi 129 130if test "x$with_rsvg" = xyes; then 131PKG_CHECK_MODULES([CAIRO], 132 [cairo >= 1.4.10], 133 [], 134 [AC_MSG_FAILURE([cairo test failed (--without-rsvg to disable svg support)])]) 135 136CFLAGS="$CFLAGS $CAIRO_CFLAGS" 137LIBS="$LIBS $CAIRO_LIBS" 138AC_DEFINE([HAVE_RSVG],[1],[Define to 1 if you have the `libRSVG` library]) 139fi 140 141 142 143dnl Check for math functions - needed for SDL_extras: -------------------------------------------- 144 145AC_CHECK_LIB([m], 146 [csin], 147 [], 148 [AC_MSG_ERROR([Math library not found - functions in <math.h> may not be available.])]) 149 150 151 152 153dnl Check for SDL_net: -------------------------------------------------------- 154 155dnl SDL_net is enabled by default. 156 157AC_ARG_WITH([sdlnet], 158 [AS_HELP_STRING([--without-sdlnet], 159 [Do not use SDL_net even if available])], 160 [], 161 [with_sdlnet=yes] 162) 163 164if test "x$with_sdlnet" != xno; then 165dnl We will need this for socket programming on Win32 166AC_CHECK_LIB([ws2_32], 167 [WSAStartup], 168 [] , 169 [AC_MSG_NOTICE([Windows socket library ws2_32 not found - (only needed on win32)])]) 170 171 172PKG_CHECK_MODULES([SDL_NET], 173 [SDL_net], 174 [], 175 [AC_MSG_NOTICE([SDL_net not located by pkg-config, checking with AC CHECK LIB:]) 176 AC_CHECK_LIB([SDL_net], 177 [SDLNet_Init], 178 [], 179 [AC_MSG_FAILURE([SDL_net test failed (--without-sdlnet to disable)])])]) 180 181AC_DEFINE([HAVE_LIBSDL_NET],[1],[Define to 1 if you have the 'SDL_net' library]) 182CFLAGS="$CFLAGS $SDL_NET_CFLAGS" 183LIBS="$LIBS $SDL_NET_LIBS" 184fi 185 186 187 188dnl Check for libxml2: -------------------------------------------------------- 189 190PKG_CHECK_MODULES([XML2], 191 [libxml-2.0], 192 [], 193 [AC_MSG_NOTICE([libxml2 not located by pkg-config, checking with AC CHECK LIB:]) 194 AC_CHECK_LIB([xml2], 195 [xmlParseFile], 196 [], 197 [AC_MSG_ERROR([libxml-2.0 not found: http://www.xmlsoft.org])])]) 198 199AC_DEFINE([HAVE_LIBXML2],[1],[Define to 1 if you have the `libxml-2.0` library]) 200CFLAGS="$CFLAGS $XML2_CFLAGS" 201LIBS="$LIBS $XML2_LIBS" 202 203 204 205dnl libt4kcommon is now required: -------------------------------------------- 206 207PKG_CHECK_MODULES([T4K_COMMON], 208 [t4k_common], 209 [], 210 [AC_MSG_NOTICE([t4k_common not located by pkg-config, checking with AC CHECK LIB:]) 211 AC_CHECK_LIB([t4k_common], 212 [InitT4KCommon], 213 [], 214 [AC_MSG_ERROR([libt4k_common is required: git://git.debian.org/tux4kids/t4kcommon.git])])]) 215 216AC_DEFINE([HAVE_LIBT4K_COMMON],[1],[Define to 1 if you have the `t4k_common` library]) 217CFLAGS="$CFLAGS $T4K_COMMON_CFLAGS" 218LIBS="$LIBS $T4K_COMMON_LIBS" 219 220 221 222# -------------------------------------------------------------------------------------- 223# Checks for header files. 224# -------------------------------------------------------------------------------------- 225 226AC_FUNC_ALLOCA 227AC_HEADER_DIRENT 228AC_HEADER_STDC 229AC_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]) 230 231 232# -------------------------------------------------------------------------------------------- 233# Checks for typedefs, structures, and compiler characteristics. 234# -------------------------------------------------------------------------------------------- 235 236AC_HEADER_STDBOOL 237AC_C_CONST 238AC_C_INLINE 239AC_C_RESTRICT 240AC_TYPE_MODE_T 241AC_TYPE_SIZE_T 242AC_TYPE_UINT16_T 243AC_TYPE_UINT32_T 244AC_TYPE_UINT8_T 245AC_C_VOLATILE 246AC_CHECK_TYPES([ptrdiff_t]) 247 248 249 250# ------------------------------------------------------------------------------------------- 251# Checks for library functions. 252# ------------------------------------------------------------------------------------------- 253 254 255AC_FUNC_CLOSEDIR_VOID 256AC_FUNC_ERROR_AT_LINE 257#AC_FUNC_MALLOC 258AC_FUNC_MMAP 259#AC_FUNC_REALLOC 260AC_FUNC_STAT 261AC_FUNC_STRCOLL 262AC_FUNC_STRTOD 263AC_FUNC_VPRINTF 264AC_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]) 265 266 267 268 269 270dnl FIXME - get rid of remaining win32 conditional code 271 272# Check platform - see if WinMain needed: 273AC_MSG_CHECKING([for native Win32]) 274case "$host" in 275 *-*-mingw*) 276 native_win32=yes 277 ;; 278 *) 279 native_win32=no 280 ;; 281esac 282AC_MSG_RESULT([$native_win32]) 283 284AM_CONDITIONAL(BUILD_MINGW32, test $native_win32 = yes) 285 286# Set the 287MINGW32_PACKAGE_DATA_DIR="data" 288AC_SUBST(MINGW32_PACKAGE_DATA_DIR) 289 290 291if test $native_win32 = yes; then 292 AC_DEFINE([BUILD_MINGW32], 1,[Native MinGW32 build]) 293 CFLAGS="$CFLAGS -D__GW32__" 294 LIBS="$LIBS -luuid -lole32 -lwsock32 -mwindows" 295 CPPFLAGS="$CPPFLAGS -idirafter $prefix/include/glibc" 296 AC_PATH_PROG(WINDRES, "$target_alias-windres", no, [$PATH]) 297fi 298 299 300# ------------------------------------------------------------ 301# Support for building NSIS Win32 installer: 302# ------------------------------------------------------------ 303 304# This is the temporary DESTDIR target into which we do a "make install" before 305# the files get copied into the NSIS installer: 306NSI_INSTALL_DIR=mingw32 307AC_SUBST(NSI_INSTALL_DIR) 308 309# This is the path (relative to the TuxMath.exe binary) where the data files are 310# placed within the TuxMath folder on the user's Windows machine: 311MINGW32_PACKAGE_DATA_DIR="data" 312AC_SUBST(MINGW32_PACKAGE_DATA_DIR) 313 314AC_ARG_WITH([dll-directory], 315 AS_HELP_STRING([--with-dll-directory=path], [provide location of DLL files needed for build [$(NSI_DLL_DIR)]]), 316 [dll_path=$withval], 317 [dll_path=no]) 318 319AM_CONDITIONAL(NSI_BUILD, test $dll_path = no) 320 321if test $dll_path != no; then 322NSI_DLL_DIR=$dll_path 323else 324NSI_DLL_DIR=~/tuxmath_dll 325fi 326AC_SUBST(NSI_DLL_DIR) 327 328AC_PATH_PROG(NSIS, makensis, [], [$PATH]) 329AC_PATH_PROGS(U2D, [todos unix2dos], [], [$PATH]) 330 331# --------------------------------------------------------------- 332# Create Makefiles 333# --------------------------------------------------------------- 334 335AC_CONFIG_FILES([ 336Makefile 337tuxmath.spec 338tuxmath_preview.spec 339data/Makefile 340data/fonts/Makefile 341data/images/Makefile 342data/images/backgrounds/Makefile 343data/images/cities/Makefile 344data/images/comets/Makefile 345data/images/icons/Makefile 346data/images/igloos/Makefile 347data/images/penguins/Makefile 348data/images/sprites/Makefile 349data/images/status/Makefile 350data/images/title/Makefile 351data/images/tux/Makefile 352data/images/factoroids/Makefile 353data/menus/Makefile 354data/missions/Makefile 355data/missions/arcade/Makefile 356data/missions/campaign/Makefile 357data/missions/campaign/ace/Makefile 358data/missions/campaign/cadet/Makefile 359data/missions/campaign/commando/Makefile 360data/missions/campaign/ranger/Makefile 361data/missions/campaign/scout/Makefile 362data/missions/lessons/Makefile 363data/missions/multiplay/Makefile 364data/sounds/Makefile 365doc/Makefile 366nsis/tuxmath.nsi 367src/Makefile 368po/Makefile.in 369]) 370 371AC_OUTPUT 372