dnl Process this file with autoconf to produce a configure script. # # Copyright (C) 2013 Patrick "P. J." McDermott # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this program. If not, see # . AC_INIT([boukengine], [0.1.0], [mailto:pj@pehjota.net], [boukengine], [http://www.pehjota.net/projects/overworld-rpg/]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_SRCDIR([src/main.c]) AM_INIT_AUTOMAKE([gnu dist-bzip2 dist-xz subdir-objects]) AM_SILENT_RULES([yes]) AC_PROG_CC() AM_PROG_CC_C_O() AC_C_INLINE() AC_CHECK_HEADERS([stdlib.h string.h inttypes.h], [], [AC_MSG_ERROR([cannot find or include standard C library headers])]) AC_TYPE_SIZE_T() AC_FUNC_MALLOC() AC_CHECK_FUNCS([memset strdup strndup], [], [AC_MSG_ERROR([cannot find standard C library functions])]) PKG_PROG_PKG_CONFIG() PKG_CHECK_MODULES([SDL], [sdl]) PKG_CHECK_MODULES([SDL_IMAGE], [SDL_image]) PKG_CHECK_MODULES([ZLIB], [zlib]) PKG_CHECK_MODULES([EXPAT], [expat]) PKG_CHECK_MODULES([LUA], [lua >= 5.1], [], [PKG_CHECK_MODULES([LUA], [lua5.1 >= 5.1], [], [PKG_CHECK_MODULES([LUA], [lua-5.1 >= 5.1])]) ]) dnl AC_ARG_VAR([XCF2PNG], [path to xcf2png utility]) AC_ARG_WITH( [system-xcf2png], [AS_HELP_STRING([--with-system-xcf2png[=PATH]], [use system xcf2png])], [ case "${withval}" in 'yes'|'') AC_PATH_PROG([XCF2PNG], [xcf2png]) if test -z "${XCF2PNG}"; then AC_MSG_ERROR([xcf2png not found]) fi embedded_xcf2png=false ;; 'no') embedded_xcf2png=true ;; *) XCF2PNG="${withval}" embedded_xcf2png=false ;; esac ], [ embedded_xcf2png=true ] ) if ${embedded_xcf2png}; then AC_CONFIG_SUBDIRS([3rdparty/xcftools]) XCF2PNG='3rdparty/xcftools/xcf2png$(EXEEXT)' fi AM_CONDITIONAL([EMBEDDED_XCF2PNG], [${embedded_xcf2png}]) AC_SUBST([XCF2PNG]) AC_ARG_ENABLE([debug-tmx], [AC_HELP_STRING([--enable-debug-tmx], [enable debug output from TMX parser])], [enable_debug_tmx=yes], []) if test "x$enable_debug_tmx" = "xyes"; then AC_DEFINE([DEBUG_TMX], [1], [Define to 1 to enable debug output from TMX parser.]) fi AC_ARG_ENABLE([debug-compression], [AC_HELP_STRING([--enable-debug-compression], [enable debug output from tile data inflation])], [enable_debug_compression=yes], []) if test "x$enable_debug_compression" = "xyes"; then AC_DEFINE([DEBUG_COMPRESSION], [1], [Define to 1 to enable debug output from tile data inflation.]) fi AC_ARG_ENABLE([debug-render], [AC_HELP_STRING([--enable-debug-render], [enable debug output from map layer blits and area rendering])], [enable_debug_render=yes], []) if test "x$enable_debug_render" = "xyes"; then AC_DEFINE([DEBUG_RENDER], [1], [Define to 1 to enable debug output from map layer blits and area rendering.]) fi AC_ARG_ENABLE([debug-palettes], [AC_HELP_STRING([--enable-debug-palettes], [enable debug output with surface palette colors listings])], [enable_debug_palettes=yes], []) if test "x$enable_debug_palettes" = "xyes"; then AC_DEFINE([DEBUG_PALETTES], [1], [Define to 1 to enable debug output with surface palette colors listings.]) fi AX_CFLAGS_WARN_ALL() dnl Adds -Wall or equivalent AX_CHECK_COMPILE_FLAG([-Wpedantic], [AX_APPEND_FLAG([-Wpedantic])]) AX_CHECK_COMPILE_FLAG([-Wextra], [AX_APPEND_FLAG([-Wextra])]) AC_ARG_ENABLE([gcc-warnings], [AS_HELP_STRING([--enable-gcc-warnings], [turn on many GCC warnings])], [case "${enableval}" in yes|no) gcc_warnings=${enableval};; *) AC_MSG_ERROR( [bad value ${enableval} for gcc-warnings option]);; esac], [ gcc_warnings=no test -d "${srcdir}/.git" && gcc_warnings=yes ] ) if test "x${gcc_warnings}" = 'xyes'; then nowarns='' nowarns="${nowarns} -Wsystem-headers" gl_MANYWARN_ALL_GCC([warns]) gl_MANYWARN_COMPLEMENT([warns], [${warns}], [${nowarns}]) for warn in ${warns}; do gl_WARN_ADD([${warn}]) done AC_SUBST([WARN_CFLAGS]) fi AX_CHECK_COMPILE_FLAG([-fdiagnostics-color=auto], [AX_APPEND_FLAG([-fdiagnostics-color=auto])]) AC_ARG_ENABLE([address-sanitization], [AS_HELP_STRING([--enable-address-sanitization], [turn on AddressSanitizer (if available)])], [case "${enableval}" in yes|no) address_sanitization=${enableval};; *) AC_MSG_ERROR( [bad value ${enableval} for address-sanitization option] );; esac], [ address_sanitization=no gl_GCC_VERSION_IFELSE([4], [8], [test -d "${srcdir}/.git" && address_sanitization=yes]) ] ) if test "x${address_sanitization}" = 'xyes'; then AX_CHECK_COMPILE_FLAG([-fsanitize=address], [AX_APPEND_FLAG([-fsanitize=address], [ASAN_CFLAGS])]) AX_CHECK_COMPILE_FLAG([-fno-omit-frame-pointer], [AX_APPEND_FLAG([-fno-omit-frame-pointer], [ASAN_CFLAGS])]) AC_SUBST([ASAN_CFLAGS]) fi if ! test -d "${srcdir}/.git"; then AX_CHECK_COMPILE_FLAG([-s], [AX_APPEND_FLAG([-s])]) fi for flag in -Os -fno-unwind-tables -fno-asynchronous-unwind-tables \ -ffunction-sections -fdata-sections -Wl,--gc-sections \ -fstack-protector-strong -flto \ -Wl,-z,now -Wl,--hash-style=sysv -Wl,--build-id=none; do AX_CHECK_COMPILE_FLAG([${flag}], [AX_APPEND_FLAG([${flag}])]) done AC_CONFIG_FILES([Makefile]) AC_CONFIG_HEADERS([config.h]) AC_OUTPUT()