# Process this file with autoconf to produce a configure script. # # Copyright (C) 2017 Patrick McDermott # Copyright (C) 2019 Libiquity LLC # # This file is part of wolfutil. # # wolfutil 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 2 of the License, or # (at your option) any later version. # # wolfutil 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 wolfutil. If not, see . AC_INIT([Unofficial wolfSSL Utility], [1.0.0], [mailto:patrick.mcdermott@libiquity.com], [wolfutil]) 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 AX_APPEND_FLAG([-DTFM_TIMING_RESISTANT]) AX_APPEND_FLAG([-DECC_TIMING_RESISTANT]) 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 HAVE_CA_CERTS='' CA_CERTS_DIR='NULL' CA_CERTS_FILE='NULL' AC_ARG_WITH([ca-certificates-dir], [AS_HELP_STRING([--with-ca-certificates-dir=PATH], [path to CA root certificates directory])], [ case "${withval}" in 'yes'|'') HAVE_CA_CERTS='1' ;; 'no') HAVE_CA_CERTS='0' ;; *) HAVE_CA_CERTS='1' CA_CERTS_DIR="\"${withval}\"" ;; esac ] ) if test x"${HAVE_CA_CERTS}" != x'0' && test x"${CA_CERTS_DIR}" = x'NULL'; then AC_MSG_CHECKING([for CA root certificates directory]) for d in /etc/ssl/certs /usr/lib/ssl/certs /usr/share/ssl \ /usr/local/ssl /etc/ssl /usr/share/ca-certificates; do if test -d "${d}"; then AC_MSG_RESULT([${d}]) HAVE_CA_CERTS='1' CA_CERTS_DIR="\"${d}\"" break fi done if test x"${CA_CERTS_DIR}" = x'NULL'; then AC_MSG_RESULT([no]) if test x"${HAVE_CA_CERTS}" = x'1'; then AC_MSG_ERROR([CA root certificates directory not found]) fi HAVE_CA_CERTS='0' fi fi AC_ARG_WITH([ca-certificates-file], [AS_HELP_STRING([--with-ca-certificates-file=PATH], [path to CA root certificates file])], [ case "${withval}" in 'yes'|'') AC_MSG_ERROR([--with-ca-certificates-file $(: \ )requires an argument]) ;; 'no') ;; *) HAVE_CA_CERTS='1' CA_CERTS_FILE="\"${withval}\"" ;; esac ] ) AC_DEFINE_UNQUOTED([HAVE_CA_CERTS], [${HAVE_CA_CERTS}], [Define to 1 to verify certificates against installed CA root certificates.]) AC_DEFINE_UNQUOTED([CA_CERTS_DIR], [${CA_CERTS_DIR}], [Define to the path to CA root certificates directory.]) AC_DEFINE_UNQUOTED([CA_CERTS_FILE], [${CA_CERTS_FILE}], [Define to the path to CA root certificates file.]) PKG_PROG_PKG_CONFIG() PKG_CHECK_MODULES([WOLFSSL], [wolfssl]) WOLFSSL_CFLAGS="$(printf ' %s' "${WOLFSSL_CFLAGS}" | \ sed 's/ -I/ -isystem/g;')" AC_CONFIG_FILES([Makefile]) AC_CONFIG_HEADERS([config.h]) AC_OUTPUT()