diff options
author | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2021-03-15 06:25:38 (EDT) |
---|---|---|
committer | Patrick McDermott <patrick.mcdermott@libiquity.com> | 2021-03-15 09:23:28 (EDT) |
commit | 67b0f851b48bffaf8d97e702338004778f364777 (patch) | |
tree | c8bb842d6921eac001d54991e59576e27aa79b84 /configure.ac | |
parent | a3356b9781e1dd362ecc7cd2c4c2cf20a893a4b6 (diff) | |
download | dodge-balls-67b0f851b48bffaf8d97e702338004778f364777.zip dodge-balls-67b0f851b48bffaf8d97e702338004778f364777.tar.gz dodge-balls-67b0f851b48bffaf8d97e702338004778f364777.tar.bz2 |
Add build system and package documentation
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..4785bb4 --- /dev/null +++ b/configure.ac @@ -0,0 +1,113 @@ +# Process this file with autoconf to produce a configure script. +# +# Copyright (C) 2013, 2017, 2019, 2021 P. J. McDermott +# +# This file is part of Dodge Balls +# +# Dodge Balls is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# Dodge Balls 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Dodge Balls. If not, see <http://www.gnu.org/licenses/>. + +AC_INIT([Dodge Balls], [0.1.0], [mailto:pj@pehjota.net], [dodge-balls]) +AC_CONFIG_AUX_DIR([build-aux]) +AC_CONFIG_MACRO_DIR([m4]) +AC_CONFIG_SRCDIR([src/main.c]) + +AM_INIT_AUTOMAKE([gnu check-news dist-bzip2 dist-xz subdir-objects]) +AM_SILENT_RULES([yes]) + +AM_CONDITIONAL([IN_GIT], + [test -d "${srcdir}/.git" && command -v git >/dev/null 2>&1]) + +save_CFLAGS="${CFLAGS-}" +AC_PROG_CC() +AM_PROG_CC_C_O() +test -d "${srcdir}/.git" || CFLAGS="${save_CFLAGS}" + +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 + +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]) + +AC_ARG_VAR([XCF2PNG], [path to xcf2png utility]) +AC_CHECK_PROGS([XCF2PNG], [xcf2png], [no]) +if test "x$XCF2PNG" = "xno"; then + AC_MSG_ERROR( +[cannot find xcf2png +xcftools may need to be installed.]) +fi + +AC_CONFIG_FILES([Makefile]) +AC_CONFIG_HEADERS([config.h]) +AC_OUTPUT() |