# Process this file with autoconf to produce a configure script. # # Copyright (C) 2017 Patrick McDermott # # This file is part of opkg-opk. # # opkg-opk 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. # # opkg-opk 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 opkg-opk. If not, see . AC_INIT([opkg-opk], [1.0.0], [mailto:proteanos-dev@lists.proteanos.com], [opkg-opk]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_SRCDIR([opkg-opk/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]) GETTEXT_PACKAGE="${PACKAGE}" AC_SUBST([GETTEXT_PACKAGE]) AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["${GETTEXT_PACKAGE}"], [Define the gettext package to be used.]) AM_GNU_GETTEXT([external]) save_CFLAGS="${CFLAGS-}" AC_PROG_CC() AM_PROG_CC_C_O() test -d "${srcdir}/.git" || CFLAGS="${save_CFLAGS}" funcs_missing=false AC_CHECK_FUNCS( [\ calloc execve fclose feof ferror fopen fprintf fputc fputs \ fread free fscanf fseek fstat fwrite getgrgid getpwuid \ localtime lstat malloc memcmp memcpy memset mkdir mkfifo open \ printf puts readlink scandir sleep snprintf sprintf stat \ strchr strcmp strcpy strerror strftime strlen strncmp strncpy \ strtol unlink vfprintf ], [], [funcs_missing=true]) for func in log10 ceil lrint; do AC_SEARCH_LIBS([${func}], [m], [], [funcs_missing=true]) done AC_CHECK_FUNCS([getopt_long], [], [AC_CHECK_FUNCS([getopt], [], [funcs_missing=true])]) if ${funcs_missing}; then AC_MSG_ERROR([required functions are missing]) fi AC_CHECK_DECLS([[major(dev_t)], [minor(dev_t)]], [], [AC_MSG_ERROR([required macros are missing])], [#include ]) AC_CHECK_DECLS([[va_start(ap, last)], [va_end(ap)]], [], [AC_MSG_ERROR([required macros are missing])], [#include ]) PKG_PROG_PKG_CONFIG() PKG_CHECK_MODULES([ZLIB], [zlib]) AC_ARG_WITH( [mknod], [AS_HELP_STRING([--with-mknod=PATH], [mknod utility])], [ case "${withval}" in 'yes'|'') AC_MSG_ERROR( [--with-mknod requires an argument]) ;; 'no') AC_MSG_ERROR([mknod is required]) ;; *) MKNOD="${withval}" ;; esac ], [ AC_PATH_PROG([MKNOD], [mknod]) if test -z "${MKNOD}"; then AC_MSG_ERROR([mknod not found]) fi ] ) AC_DEFINE_UNQUOTED([MKNOD], ["${MKNOD}"], [Define to the path to the mknod utility.]) 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 helpersdir='${libexecdir}/${PACKAGE_TARNAME}' AC_ARG_WITH([helpers-dir], [AS_HELP_STRING([--with-helpers-dir=DIR], [helper utilities @<:@LIBEXECDIR/opkg-opk@:>@])], [ case "${withval}" in 'yes'|'') AC_MSG_ERROR([--with-helpers-dir requires $(: \ )an argument]) ;; 'no') helpersdir='' ;; *) helpersdir="\"${withval}\"" ;; esac ] ) AM_CONDITIONAL([WITH_HELPERS], [test -n "${helpersdir}"]) AC_SUBST([helpersdir]) AC_CONFIG_FILES([Makefile po/Makefile.in]) AC_CONFIG_HEADERS([config.h]) AC_OUTPUT()