This commit is contained in:
parent
4b8a7af947
commit
0fe17990cf
14 changed files with 965 additions and 0 deletions
25
m4/attribute.m4
Normal file
25
m4/attribute.m4
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
dnl Check to find out whether function attributes are supported.
|
||||||
|
dnl If they are not, #define them to be nothing.
|
||||||
|
|
||||||
|
AC_DEFUN([tinc_ATTRIBUTE],
|
||||||
|
[
|
||||||
|
AC_CACHE_CHECK([for working $1 attribute], tinc_cv_attribute_$1,
|
||||||
|
[
|
||||||
|
tempcflags="$CFLAGS"
|
||||||
|
CFLAGS="$CFLAGS -Wall -Werror"
|
||||||
|
AC_COMPILE_IFELSE(
|
||||||
|
[AC_LANG_SOURCE(
|
||||||
|
[void *test(void *x) __attribute__ (($1));
|
||||||
|
void *test(void *x) { return (void *)x; }
|
||||||
|
],
|
||||||
|
)],
|
||||||
|
[tinc_cv_attribute_$1=yes],
|
||||||
|
[tinc_cv_attribute_$1=no]
|
||||||
|
)
|
||||||
|
CFLAGS="$tempcflags"
|
||||||
|
])
|
||||||
|
|
||||||
|
if test ${tinc_cv_attribute_$1} = no; then
|
||||||
|
AC_DEFINE([$1], [], [Defined if the $1 attribute is not supported.])
|
||||||
|
fi
|
||||||
|
])
|
71
m4/ax_append_flag.m4
Normal file
71
m4/ax_append_flag.m4
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
# ===========================================================================
|
||||||
|
# http://www.gnu.org/software/autoconf-archive/ax_append_flag.html
|
||||||
|
# ===========================================================================
|
||||||
|
#
|
||||||
|
# SYNOPSIS
|
||||||
|
#
|
||||||
|
# AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE])
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# FLAG is appended to the FLAGS-VARIABLE shell variable, with a space
|
||||||
|
# added in between.
|
||||||
|
#
|
||||||
|
# If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
|
||||||
|
# CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains
|
||||||
|
# FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly
|
||||||
|
# FLAG.
|
||||||
|
#
|
||||||
|
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION.
|
||||||
|
#
|
||||||
|
# LICENSE
|
||||||
|
#
|
||||||
|
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
|
||||||
|
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
|
||||||
|
#
|
||||||
|
# This program 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.
|
||||||
|
#
|
||||||
|
# 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 General
|
||||||
|
# Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License along
|
||||||
|
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||||
|
# gives unlimited permission to copy, distribute and modify the configure
|
||||||
|
# scripts that are the output of Autoconf when processing the Macro. You
|
||||||
|
# need not follow the terms of the GNU General Public License when using
|
||||||
|
# or distributing such scripts, even though portions of the text of the
|
||||||
|
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||||
|
# all other use of the material that constitutes the Autoconf Macro.
|
||||||
|
#
|
||||||
|
# This special exception to the GPL applies to versions of the Autoconf
|
||||||
|
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||||
|
# modified version of the Autoconf Macro, you may extend this special
|
||||||
|
# exception to the GPL to apply to your modified version as well.
|
||||||
|
|
||||||
|
#serial 6
|
||||||
|
|
||||||
|
AC_DEFUN([AX_APPEND_FLAG],
|
||||||
|
[dnl
|
||||||
|
AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF
|
||||||
|
AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])
|
||||||
|
AS_VAR_SET_IF(FLAGS,[
|
||||||
|
AS_CASE([" AS_VAR_GET(FLAGS) "],
|
||||||
|
[*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])],
|
||||||
|
[
|
||||||
|
AS_VAR_APPEND(FLAGS,[" $1"])
|
||||||
|
AC_RUN_LOG([: FLAGS="$FLAGS"])
|
||||||
|
])
|
||||||
|
],
|
||||||
|
[
|
||||||
|
AS_VAR_SET(FLAGS,[$1])
|
||||||
|
AC_RUN_LOG([: FLAGS="$FLAGS"])
|
||||||
|
])
|
||||||
|
AS_VAR_POPDEF([FLAGS])dnl
|
||||||
|
])dnl AX_APPEND_FLAG
|
122
m4/ax_cflags_warn_all.m4
Normal file
122
m4/ax_cflags_warn_all.m4
Normal file
|
@ -0,0 +1,122 @@
|
||||||
|
# ===========================================================================
|
||||||
|
# http://www.gnu.org/software/autoconf-archive/ax_cflags_warn_all.html
|
||||||
|
# ===========================================================================
|
||||||
|
#
|
||||||
|
# SYNOPSIS
|
||||||
|
#
|
||||||
|
# AX_CFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])]
|
||||||
|
# AX_CXXFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])]
|
||||||
|
# AX_FCFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])]
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# Try to find a compiler option that enables most reasonable warnings.
|
||||||
|
#
|
||||||
|
# For the GNU compiler it will be -Wall (and -ansi -pedantic) The result
|
||||||
|
# is added to the shellvar being CFLAGS, CXXFLAGS, or FCFLAGS by default.
|
||||||
|
#
|
||||||
|
# Currently this macro knows about the GCC, Solaris, Digital Unix, AIX,
|
||||||
|
# HP-UX, IRIX, NEC SX-5 (Super-UX 10), Cray J90 (Unicos 10.0.0.8), and
|
||||||
|
# Intel compilers. For a given compiler, the Fortran flags are much more
|
||||||
|
# experimental than their C equivalents.
|
||||||
|
#
|
||||||
|
# - $1 shell-variable-to-add-to : CFLAGS, CXXFLAGS, or FCFLAGS
|
||||||
|
# - $2 add-value-if-not-found : nothing
|
||||||
|
# - $3 action-if-found : add value to shellvariable
|
||||||
|
# - $4 action-if-not-found : nothing
|
||||||
|
#
|
||||||
|
# NOTE: These macros depend on AX_APPEND_FLAG.
|
||||||
|
#
|
||||||
|
# LICENSE
|
||||||
|
#
|
||||||
|
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
|
||||||
|
# Copyright (c) 2010 Rhys Ulerich <rhys.ulerich@gmail.com>
|
||||||
|
#
|
||||||
|
# This program 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.
|
||||||
|
#
|
||||||
|
# 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 General
|
||||||
|
# Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License along
|
||||||
|
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||||
|
# gives unlimited permission to copy, distribute and modify the configure
|
||||||
|
# scripts that are the output of Autoconf when processing the Macro. You
|
||||||
|
# need not follow the terms of the GNU General Public License when using
|
||||||
|
# or distributing such scripts, even though portions of the text of the
|
||||||
|
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||||
|
# all other use of the material that constitutes the Autoconf Macro.
|
||||||
|
#
|
||||||
|
# This special exception to the GPL applies to versions of the Autoconf
|
||||||
|
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||||
|
# modified version of the Autoconf Macro, you may extend this special
|
||||||
|
# exception to the GPL to apply to your modified version as well.
|
||||||
|
|
||||||
|
#serial 15
|
||||||
|
|
||||||
|
AC_DEFUN([AX_FLAGS_WARN_ALL],[dnl
|
||||||
|
AS_VAR_PUSHDEF([FLAGS],[_AC_LANG_PREFIX[]FLAGS])dnl
|
||||||
|
AS_VAR_PUSHDEF([VAR],[ac_cv_[]_AC_LANG_ABBREV[]flags_warn_all])dnl
|
||||||
|
AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings],
|
||||||
|
VAR,[VAR="no, unknown"
|
||||||
|
ac_save_[]FLAGS="$[]FLAGS"
|
||||||
|
for ac_arg dnl
|
||||||
|
in "-warn all % -warn all" dnl Intel
|
||||||
|
"-pedantic % -Wall" dnl GCC
|
||||||
|
"-xstrconst % -v" dnl Solaris C
|
||||||
|
"-std1 % -verbose -w0 -warnprotos" dnl Digital Unix
|
||||||
|
"-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX
|
||||||
|
"-ansi -ansiE % -fullwarn" dnl IRIX
|
||||||
|
"+ESlit % +w1" dnl HP-UX C
|
||||||
|
"-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10)
|
||||||
|
"-h conform % -h msglevel 2" dnl Cray C (Unicos)
|
||||||
|
#
|
||||||
|
do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'`
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
|
||||||
|
[VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break])
|
||||||
|
done
|
||||||
|
FLAGS="$ac_save_[]FLAGS"
|
||||||
|
])
|
||||||
|
AS_VAR_POPDEF([FLAGS])dnl
|
||||||
|
AX_REQUIRE_DEFINED([AX_APPEND_FLAG])
|
||||||
|
case ".$VAR" in
|
||||||
|
.ok|.ok,*) m4_ifvaln($3,$3) ;;
|
||||||
|
.|.no|.no,*) m4_default($4,[m4_ifval($2,[AX_APPEND_FLAG([$2], [$1])])]) ;;
|
||||||
|
*) m4_default($3,[AX_APPEND_FLAG([$VAR], [$1])]) ;;
|
||||||
|
esac
|
||||||
|
AS_VAR_POPDEF([VAR])dnl
|
||||||
|
])dnl AX_FLAGS_WARN_ALL
|
||||||
|
dnl implementation tactics:
|
||||||
|
dnl the for-argument contains a list of options. The first part of
|
||||||
|
dnl these does only exist to detect the compiler - usually it is
|
||||||
|
dnl a global option to enable -ansi or -extrawarnings. All other
|
||||||
|
dnl compilers will fail about it. That was needed since a lot of
|
||||||
|
dnl compilers will give false positives for some option-syntax
|
||||||
|
dnl like -Woption or -Xoption as they think of it is a pass-through
|
||||||
|
dnl to later compile stages or something. The "%" is used as a
|
||||||
|
dnl delimiter. A non-option comment can be given after "%%" marks
|
||||||
|
dnl which will be shown but not added to the respective C/CXXFLAGS.
|
||||||
|
|
||||||
|
AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl
|
||||||
|
AC_LANG_PUSH([C])
|
||||||
|
AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4])
|
||||||
|
AC_LANG_POP([C])
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_DEFUN([AX_CXXFLAGS_WARN_ALL],[dnl
|
||||||
|
AC_LANG_PUSH([C++])
|
||||||
|
AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4])
|
||||||
|
AC_LANG_POP([C++])
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_DEFUN([AX_FCFLAGS_WARN_ALL],[dnl
|
||||||
|
AC_LANG_PUSH([Fortran])
|
||||||
|
AX_FLAGS_WARN_ALL([$1], [$2], [$3], [$4])
|
||||||
|
AC_LANG_POP([Fortran])
|
||||||
|
])
|
72
m4/ax_check_compile_flag.m4
Normal file
72
m4/ax_check_compile_flag.m4
Normal file
|
@ -0,0 +1,72 @@
|
||||||
|
# ===========================================================================
|
||||||
|
# http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html
|
||||||
|
# ===========================================================================
|
||||||
|
#
|
||||||
|
# SYNOPSIS
|
||||||
|
#
|
||||||
|
# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS])
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# Check whether the given FLAG works with the current language's compiler
|
||||||
|
# or gives an error. (Warnings, however, are ignored)
|
||||||
|
#
|
||||||
|
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
|
||||||
|
# success/failure.
|
||||||
|
#
|
||||||
|
# If EXTRA-FLAGS is defined, it is added to the current language's default
|
||||||
|
# flags (e.g. CFLAGS) when the check is done. The check is thus made with
|
||||||
|
# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to
|
||||||
|
# force the compiler to issue an error when a bad flag is given.
|
||||||
|
#
|
||||||
|
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
|
||||||
|
# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG.
|
||||||
|
#
|
||||||
|
# LICENSE
|
||||||
|
#
|
||||||
|
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
|
||||||
|
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
|
||||||
|
#
|
||||||
|
# This program 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.
|
||||||
|
#
|
||||||
|
# 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 General
|
||||||
|
# Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License along
|
||||||
|
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||||
|
# gives unlimited permission to copy, distribute and modify the configure
|
||||||
|
# scripts that are the output of Autoconf when processing the Macro. You
|
||||||
|
# need not follow the terms of the GNU General Public License when using
|
||||||
|
# or distributing such scripts, even though portions of the text of the
|
||||||
|
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||||
|
# all other use of the material that constitutes the Autoconf Macro.
|
||||||
|
#
|
||||||
|
# This special exception to the GPL applies to versions of the Autoconf
|
||||||
|
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||||
|
# modified version of the Autoconf Macro, you may extend this special
|
||||||
|
# exception to the GPL to apply to your modified version as well.
|
||||||
|
|
||||||
|
#serial 2
|
||||||
|
|
||||||
|
AC_DEFUN([AX_CHECK_COMPILE_FLAG],
|
||||||
|
[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX
|
||||||
|
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
|
||||||
|
AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
|
||||||
|
ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
|
||||||
|
_AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM()],
|
||||||
|
[AS_VAR_SET(CACHEVAR,[yes])],
|
||||||
|
[AS_VAR_SET(CACHEVAR,[no])])
|
||||||
|
_AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags])
|
||||||
|
AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes],
|
||||||
|
[m4_default([$2], :)],
|
||||||
|
[m4_default([$3], :)])
|
||||||
|
AS_VAR_POPDEF([CACHEVAR])dnl
|
||||||
|
])dnl AX_CHECK_COMPILE_FLAGS
|
71
m4/ax_check_link_flag.m4
Normal file
71
m4/ax_check_link_flag.m4
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
# ===========================================================================
|
||||||
|
# http://www.gnu.org/software/autoconf-archive/ax_check_link_flag.html
|
||||||
|
# ===========================================================================
|
||||||
|
#
|
||||||
|
# SYNOPSIS
|
||||||
|
#
|
||||||
|
# AX_CHECK_LINK_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS])
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# Check whether the given FLAG works with the linker or gives an error.
|
||||||
|
# (Warnings, however, are ignored)
|
||||||
|
#
|
||||||
|
# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on
|
||||||
|
# success/failure.
|
||||||
|
#
|
||||||
|
# If EXTRA-FLAGS is defined, it is added to the linker's default flags
|
||||||
|
# when the check is done. The check is thus made with the flags: "LDFLAGS
|
||||||
|
# EXTRA-FLAGS FLAG". This can for example be used to force the linker to
|
||||||
|
# issue an error when a bad flag is given.
|
||||||
|
#
|
||||||
|
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this
|
||||||
|
# macro in sync with AX_CHECK_{PREPROC,COMPILE}_FLAG.
|
||||||
|
#
|
||||||
|
# LICENSE
|
||||||
|
#
|
||||||
|
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
|
||||||
|
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
|
||||||
|
#
|
||||||
|
# This program 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.
|
||||||
|
#
|
||||||
|
# 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 General
|
||||||
|
# Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License along
|
||||||
|
# with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
# As a special exception, the respective Autoconf Macro's copyright owner
|
||||||
|
# gives unlimited permission to copy, distribute and modify the configure
|
||||||
|
# scripts that are the output of Autoconf when processing the Macro. You
|
||||||
|
# need not follow the terms of the GNU General Public License when using
|
||||||
|
# or distributing such scripts, even though portions of the text of the
|
||||||
|
# Macro appear in them. The GNU General Public License (GPL) does govern
|
||||||
|
# all other use of the material that constitutes the Autoconf Macro.
|
||||||
|
#
|
||||||
|
# This special exception to the GPL applies to versions of the Autoconf
|
||||||
|
# Macro released by the Autoconf Archive. When you make and distribute a
|
||||||
|
# modified version of the Autoconf Macro, you may extend this special
|
||||||
|
# exception to the GPL to apply to your modified version as well.
|
||||||
|
|
||||||
|
#serial 2
|
||||||
|
|
||||||
|
AC_DEFUN([AX_CHECK_LINK_FLAG],
|
||||||
|
[AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_ldflags_$4_$1])dnl
|
||||||
|
AC_CACHE_CHECK([whether the linker accepts $1], CACHEVAR, [
|
||||||
|
ax_check_save_flags=$LDFLAGS
|
||||||
|
LDFLAGS="$LDFLAGS $4 $1"
|
||||||
|
AC_LINK_IFELSE([AC_LANG_PROGRAM()],
|
||||||
|
[AS_VAR_SET(CACHEVAR,[yes])],
|
||||||
|
[AS_VAR_SET(CACHEVAR,[no])])
|
||||||
|
LDFLAGS=$ax_check_save_flags])
|
||||||
|
AS_IF([test x"AS_VAR_GET(CACHEVAR)" = xyes],
|
||||||
|
[m4_default([$2], :)],
|
||||||
|
[m4_default([$3], :)])
|
||||||
|
AS_VAR_POPDEF([CACHEVAR])dnl
|
||||||
|
])dnl AX_CHECK_LINK_FLAGS
|
264
m4/ax_code_coverage.m4
Normal file
264
m4/ax_code_coverage.m4
Normal file
|
@ -0,0 +1,264 @@
|
||||||
|
# ===========================================================================
|
||||||
|
# https://www.gnu.org/software/autoconf-archive/ax_code_coverage.html
|
||||||
|
# ===========================================================================
|
||||||
|
#
|
||||||
|
# SYNOPSIS
|
||||||
|
#
|
||||||
|
# AX_CODE_COVERAGE()
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# Defines CODE_COVERAGE_CPPFLAGS, CODE_COVERAGE_CFLAGS,
|
||||||
|
# CODE_COVERAGE_CXXFLAGS and CODE_COVERAGE_LIBS which should be included
|
||||||
|
# in the CPPFLAGS, CFLAGS CXXFLAGS and LIBS/LIBADD variables of every
|
||||||
|
# build target (program or library) which should be built with code
|
||||||
|
# coverage support. Also defines CODE_COVERAGE_RULES which should be
|
||||||
|
# substituted in your Makefile; and $enable_code_coverage which can be
|
||||||
|
# used in subsequent configure output. CODE_COVERAGE_ENABLED is defined
|
||||||
|
# and substituted, and corresponds to the value of the
|
||||||
|
# --enable-code-coverage option, which defaults to being disabled.
|
||||||
|
#
|
||||||
|
# Test also for gcov program and create GCOV variable that could be
|
||||||
|
# substituted.
|
||||||
|
#
|
||||||
|
# Note that all optimisation flags in CFLAGS must be disabled when code
|
||||||
|
# coverage is enabled.
|
||||||
|
#
|
||||||
|
# Usage example:
|
||||||
|
#
|
||||||
|
# configure.ac:
|
||||||
|
#
|
||||||
|
# AX_CODE_COVERAGE
|
||||||
|
#
|
||||||
|
# Makefile.am:
|
||||||
|
#
|
||||||
|
# @CODE_COVERAGE_RULES@
|
||||||
|
# my_program_LIBS = ... $(CODE_COVERAGE_LIBS) ...
|
||||||
|
# my_program_CPPFLAGS = ... $(CODE_COVERAGE_CPPFLAGS) ...
|
||||||
|
# my_program_CFLAGS = ... $(CODE_COVERAGE_CFLAGS) ...
|
||||||
|
# my_program_CXXFLAGS = ... $(CODE_COVERAGE_CXXFLAGS) ...
|
||||||
|
#
|
||||||
|
# This results in a "check-code-coverage" rule being added to any
|
||||||
|
# Makefile.am which includes "@CODE_COVERAGE_RULES@" (assuming the module
|
||||||
|
# has been configured with --enable-code-coverage). Running `make
|
||||||
|
# check-code-coverage` in that directory will run the module's test suite
|
||||||
|
# (`make check`) and build a code coverage report detailing the code which
|
||||||
|
# was touched, then print the URI for the report.
|
||||||
|
#
|
||||||
|
# In earlier versions of this macro, CODE_COVERAGE_LDFLAGS was defined
|
||||||
|
# instead of CODE_COVERAGE_LIBS. They are both still defined, but use of
|
||||||
|
# CODE_COVERAGE_LIBS is preferred for clarity; CODE_COVERAGE_LDFLAGS is
|
||||||
|
# deprecated. They have the same value.
|
||||||
|
#
|
||||||
|
# This code was derived from Makefile.decl in GLib, originally licenced
|
||||||
|
# under LGPLv2.1+.
|
||||||
|
#
|
||||||
|
# LICENSE
|
||||||
|
#
|
||||||
|
# Copyright (c) 2012, 2016 Philip Withnall
|
||||||
|
# Copyright (c) 2012 Xan Lopez
|
||||||
|
# Copyright (c) 2012 Christian Persch
|
||||||
|
# Copyright (c) 2012 Paolo Borelli
|
||||||
|
# Copyright (c) 2012 Dan Winship
|
||||||
|
# Copyright (c) 2015 Bastien ROUCARIES
|
||||||
|
#
|
||||||
|
# This library 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 2.1 of the License, or (at
|
||||||
|
# your option) any later version.
|
||||||
|
#
|
||||||
|
# This library 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 <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#serial 21
|
||||||
|
|
||||||
|
AC_DEFUN([AX_CODE_COVERAGE],[
|
||||||
|
dnl Check for --enable-code-coverage
|
||||||
|
AC_REQUIRE([AC_PROG_SED])
|
||||||
|
|
||||||
|
# allow to override gcov location
|
||||||
|
AC_ARG_WITH([gcov],
|
||||||
|
[AS_HELP_STRING([--with-gcov[=GCOV]], [use given GCOV for coverage (GCOV=gcov).])],
|
||||||
|
[_AX_CODE_COVERAGE_GCOV_PROG_WITH=$with_gcov],
|
||||||
|
[_AX_CODE_COVERAGE_GCOV_PROG_WITH=gcov])
|
||||||
|
|
||||||
|
AC_MSG_CHECKING([whether to build with code coverage support])
|
||||||
|
AC_ARG_ENABLE([code-coverage],
|
||||||
|
AS_HELP_STRING([--enable-code-coverage],
|
||||||
|
[Whether to enable code coverage support]),,
|
||||||
|
enable_code_coverage=no)
|
||||||
|
|
||||||
|
AM_CONDITIONAL([CODE_COVERAGE_ENABLED], [test x$enable_code_coverage = xyes])
|
||||||
|
AC_SUBST([CODE_COVERAGE_ENABLED], [$enable_code_coverage])
|
||||||
|
AC_MSG_RESULT($enable_code_coverage)
|
||||||
|
|
||||||
|
AS_IF([ test "$enable_code_coverage" = "yes" ], [
|
||||||
|
# check for gcov
|
||||||
|
AC_CHECK_TOOL([GCOV],
|
||||||
|
[$_AX_CODE_COVERAGE_GCOV_PROG_WITH],
|
||||||
|
[:])
|
||||||
|
AS_IF([test "X$GCOV" = "X:"],
|
||||||
|
[AC_MSG_ERROR([gcov is needed to do coverage])])
|
||||||
|
AC_SUBST([GCOV])
|
||||||
|
|
||||||
|
dnl Check if gcc is being used
|
||||||
|
AS_IF([ test "$GCC" = "no" ], [
|
||||||
|
AC_MSG_ERROR([not compiling with gcc, which is required for gcov code coverage])
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_CHECK_PROG([LCOV], [lcov], [lcov])
|
||||||
|
AC_CHECK_PROG([GENHTML], [genhtml], [genhtml])
|
||||||
|
|
||||||
|
AS_IF([ test -z "$LCOV" ], [
|
||||||
|
AC_MSG_ERROR([To enable code coverage reporting you must have lcov installed])
|
||||||
|
])
|
||||||
|
|
||||||
|
AS_IF([ test -z "$GENHTML" ], [
|
||||||
|
AC_MSG_ERROR([Could not find genhtml from the lcov package])
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl Build the code coverage flags
|
||||||
|
dnl Define CODE_COVERAGE_LDFLAGS for backwards compatibility
|
||||||
|
CODE_COVERAGE_CPPFLAGS="-DNDEBUG"
|
||||||
|
CODE_COVERAGE_CFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
|
||||||
|
CODE_COVERAGE_CXXFLAGS="-O0 -g -fprofile-arcs -ftest-coverage"
|
||||||
|
CODE_COVERAGE_LIBS="-lgcov"
|
||||||
|
CODE_COVERAGE_LDFLAGS="$CODE_COVERAGE_LIBS"
|
||||||
|
|
||||||
|
AC_SUBST([CODE_COVERAGE_CPPFLAGS])
|
||||||
|
AC_SUBST([CODE_COVERAGE_CFLAGS])
|
||||||
|
AC_SUBST([CODE_COVERAGE_CXXFLAGS])
|
||||||
|
AC_SUBST([CODE_COVERAGE_LIBS])
|
||||||
|
AC_SUBST([CODE_COVERAGE_LDFLAGS])
|
||||||
|
|
||||||
|
[CODE_COVERAGE_RULES_CHECK='
|
||||||
|
-$(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) -k check
|
||||||
|
$(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) code-coverage-capture
|
||||||
|
']
|
||||||
|
[CODE_COVERAGE_RULES_CAPTURE='
|
||||||
|
$(code_coverage_v_lcov_cap)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --capture --output-file "$(CODE_COVERAGE_OUTPUT_FILE).tmp" --test-name "$(call code_coverage_sanitize,$(PACKAGE_NAME)-$(PACKAGE_VERSION))" --no-checksum --compat-libtool $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_OPTIONS)
|
||||||
|
$(code_coverage_v_lcov_ign)$(LCOV) $(code_coverage_quiet) $(addprefix --directory ,$(CODE_COVERAGE_DIRECTORY)) --remove "$(CODE_COVERAGE_OUTPUT_FILE).tmp" "/tmp/*" $(CODE_COVERAGE_IGNORE_PATTERN) --output-file "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_LCOV_SHOPTS) $(CODE_COVERAGE_LCOV_RMOPTS)
|
||||||
|
-@rm -f $(CODE_COVERAGE_OUTPUT_FILE).tmp
|
||||||
|
$(code_coverage_v_genhtml)LANG=C $(GENHTML) $(code_coverage_quiet) $(addprefix --prefix ,$(CODE_COVERAGE_DIRECTORY)) --output-directory "$(CODE_COVERAGE_OUTPUT_DIRECTORY)" --title "$(PACKAGE_NAME)-$(PACKAGE_VERSION) Code Coverage" --legend --show-details "$(CODE_COVERAGE_OUTPUT_FILE)" $(CODE_COVERAGE_GENHTML_OPTIONS)
|
||||||
|
@echo "file://$(abs_builddir)/$(CODE_COVERAGE_OUTPUT_DIRECTORY)/index.html"
|
||||||
|
']
|
||||||
|
[CODE_COVERAGE_RULES_CLEAN='
|
||||||
|
clean: code-coverage-clean
|
||||||
|
distclean: code-coverage-clean
|
||||||
|
code-coverage-clean:
|
||||||
|
-$(LCOV) --directory $(top_builddir) -z
|
||||||
|
-rm -rf $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_FILE).tmp $(CODE_COVERAGE_OUTPUT_DIRECTORY)
|
||||||
|
-find . \( -name "*.gcda" -o -name "*.gcno" -o -name "*.gcov" \) -delete
|
||||||
|
']
|
||||||
|
], [
|
||||||
|
[CODE_COVERAGE_RULES_CHECK='
|
||||||
|
@echo "Need to reconfigure with --enable-code-coverage"
|
||||||
|
']
|
||||||
|
CODE_COVERAGE_RULES_CAPTURE="$CODE_COVERAGE_RULES_CHECK"
|
||||||
|
CODE_COVERAGE_RULES_CLEAN=''
|
||||||
|
])
|
||||||
|
|
||||||
|
[CODE_COVERAGE_RULES='
|
||||||
|
# Code coverage
|
||||||
|
#
|
||||||
|
# Optional:
|
||||||
|
# - CODE_COVERAGE_DIRECTORY: Top-level directory for code coverage reporting.
|
||||||
|
# Multiple directories may be specified, separated by whitespace.
|
||||||
|
# (Default: $(top_builddir))
|
||||||
|
# - CODE_COVERAGE_OUTPUT_FILE: Filename and path for the .info file generated
|
||||||
|
# by lcov for code coverage. (Default:
|
||||||
|
# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info)
|
||||||
|
# - CODE_COVERAGE_OUTPUT_DIRECTORY: Directory for generated code coverage
|
||||||
|
# reports to be created. (Default:
|
||||||
|
# $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage)
|
||||||
|
# - CODE_COVERAGE_BRANCH_COVERAGE: Set to 1 to enforce branch coverage,
|
||||||
|
# set to 0 to disable it and leave empty to stay with the default.
|
||||||
|
# (Default: empty)
|
||||||
|
# - CODE_COVERAGE_LCOV_SHOPTS_DEFAULT: Extra options shared between both lcov
|
||||||
|
# instances. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE)
|
||||||
|
# - CODE_COVERAGE_LCOV_SHOPTS: Extra options to shared between both lcov
|
||||||
|
# instances. (Default: $CODE_COVERAGE_LCOV_SHOPTS_DEFAULT)
|
||||||
|
# - CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH: --gcov-tool pathtogcov
|
||||||
|
# - CODE_COVERAGE_LCOV_OPTIONS_DEFAULT: Extra options to pass to the
|
||||||
|
# collecting lcov instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH)
|
||||||
|
# - CODE_COVERAGE_LCOV_OPTIONS: Extra options to pass to the collecting lcov
|
||||||
|
# instance. (Default: $CODE_COVERAGE_LCOV_OPTIONS_DEFAULT)
|
||||||
|
# - CODE_COVERAGE_LCOV_RMOPTS_DEFAULT: Extra options to pass to the filtering
|
||||||
|
# lcov instance. (Default: empty)
|
||||||
|
# - CODE_COVERAGE_LCOV_RMOPTS: Extra options to pass to the filtering lcov
|
||||||
|
# instance. (Default: $CODE_COVERAGE_LCOV_RMOPTS_DEFAULT)
|
||||||
|
# - CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT: Extra options to pass to the
|
||||||
|
# genhtml instance. (Default: based on $CODE_COVERAGE_BRANCH_COVERAGE)
|
||||||
|
# - CODE_COVERAGE_GENHTML_OPTIONS: Extra options to pass to the genhtml
|
||||||
|
# instance. (Default: $CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT)
|
||||||
|
# - CODE_COVERAGE_IGNORE_PATTERN: Extra glob pattern of files to ignore
|
||||||
|
#
|
||||||
|
# The generated report will be titled using the $(PACKAGE_NAME) and
|
||||||
|
# $(PACKAGE_VERSION). In order to add the current git hash to the title,
|
||||||
|
# use the git-version-gen script, available online.
|
||||||
|
|
||||||
|
# Optional variables
|
||||||
|
CODE_COVERAGE_DIRECTORY ?= $(top_builddir)
|
||||||
|
CODE_COVERAGE_OUTPUT_FILE ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage.info
|
||||||
|
CODE_COVERAGE_OUTPUT_DIRECTORY ?= $(PACKAGE_NAME)-$(PACKAGE_VERSION)-coverage
|
||||||
|
CODE_COVERAGE_BRANCH_COVERAGE ?=
|
||||||
|
CODE_COVERAGE_LCOV_SHOPTS_DEFAULT ?= $(if $(CODE_COVERAGE_BRANCH_COVERAGE),\
|
||||||
|
--rc lcov_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE))
|
||||||
|
CODE_COVERAGE_LCOV_SHOPTS ?= $(CODE_COVERAGE_LCOV_SHOPTS_DEFAULT)
|
||||||
|
CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH ?= --gcov-tool "$(GCOV)"
|
||||||
|
CODE_COVERAGE_LCOV_OPTIONS_DEFAULT ?= $(CODE_COVERAGE_LCOV_OPTIONS_GCOVPATH)
|
||||||
|
CODE_COVERAGE_LCOV_OPTIONS ?= $(CODE_COVERAGE_LCOV_OPTIONS_DEFAULT)
|
||||||
|
CODE_COVERAGE_LCOV_RMOPTS_DEFAULT ?=
|
||||||
|
CODE_COVERAGE_LCOV_RMOPTS ?= $(CODE_COVERAGE_LCOV_RMOPTS_DEFAULT)
|
||||||
|
CODE_COVERAGE_GENHTML_OPTIONS_DEFAULT ?=\
|
||||||
|
$(if $(CODE_COVERAGE_BRANCH_COVERAGE),\
|
||||||
|
--rc genhtml_branch_coverage=$(CODE_COVERAGE_BRANCH_COVERAGE))
|
||||||
|
CODE_COVERAGE_GENHTML_OPTIONS ?= $(CODE_COVERAGE_GENHTML_OPTIONS_DEFAULTS)
|
||||||
|
CODE_COVERAGE_IGNORE_PATTERN ?=
|
||||||
|
|
||||||
|
code_coverage_v_lcov_cap = $(code_coverage_v_lcov_cap_$(V))
|
||||||
|
code_coverage_v_lcov_cap_ = $(code_coverage_v_lcov_cap_$(AM_DEFAULT_VERBOSITY))
|
||||||
|
code_coverage_v_lcov_cap_0 = @echo " LCOV --capture"\
|
||||||
|
$(CODE_COVERAGE_OUTPUT_FILE);
|
||||||
|
code_coverage_v_lcov_ign = $(code_coverage_v_lcov_ign_$(V))
|
||||||
|
code_coverage_v_lcov_ign_ = $(code_coverage_v_lcov_ign_$(AM_DEFAULT_VERBOSITY))
|
||||||
|
code_coverage_v_lcov_ign_0 = @echo " LCOV --remove /tmp/*"\
|
||||||
|
$(CODE_COVERAGE_IGNORE_PATTERN);
|
||||||
|
code_coverage_v_genhtml = $(code_coverage_v_genhtml_$(V))
|
||||||
|
code_coverage_v_genhtml_ = $(code_coverage_v_genhtml_$(AM_DEFAULT_VERBOSITY))
|
||||||
|
code_coverage_v_genhtml_0 = @echo " GEN " $(CODE_COVERAGE_OUTPUT_DIRECTORY);
|
||||||
|
code_coverage_quiet = $(code_coverage_quiet_$(V))
|
||||||
|
code_coverage_quiet_ = $(code_coverage_quiet_$(AM_DEFAULT_VERBOSITY))
|
||||||
|
code_coverage_quiet_0 = --quiet
|
||||||
|
|
||||||
|
# sanitizes the test-name: replaces with underscores: dashes and dots
|
||||||
|
code_coverage_sanitize = $(subst -,_,$(subst .,_,$(1)))
|
||||||
|
|
||||||
|
# Use recursive makes in order to ignore errors during check
|
||||||
|
check-code-coverage:'"$CODE_COVERAGE_RULES_CHECK"'
|
||||||
|
|
||||||
|
# Capture code coverage data
|
||||||
|
code-coverage-capture: code-coverage-capture-hook'"$CODE_COVERAGE_RULES_CAPTURE"'
|
||||||
|
|
||||||
|
# Hook rule executed before code-coverage-capture, overridable by the user
|
||||||
|
code-coverage-capture-hook:
|
||||||
|
|
||||||
|
'"$CODE_COVERAGE_RULES_CLEAN"'
|
||||||
|
|
||||||
|
GITIGNOREFILES ?=
|
||||||
|
GITIGNOREFILES += $(CODE_COVERAGE_OUTPUT_FILE) $(CODE_COVERAGE_OUTPUT_DIRECTORY)
|
||||||
|
|
||||||
|
A''M_DISTCHECK_CONFIGURE_FLAGS ?=
|
||||||
|
A''M_DISTCHECK_CONFIGURE_FLAGS += --disable-code-coverage
|
||||||
|
|
||||||
|
.PHONY: check-code-coverage code-coverage-capture code-coverage-capture-hook code-coverage-clean
|
||||||
|
']
|
||||||
|
|
||||||
|
AC_SUBST([CODE_COVERAGE_RULES])
|
||||||
|
m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([CODE_COVERAGE_RULES])])
|
||||||
|
])
|
37
m4/ax_require_defined.m4
Normal file
37
m4/ax_require_defined.m4
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
# ===========================================================================
|
||||||
|
# http://www.gnu.org/software/autoconf-archive/ax_require_defined.html
|
||||||
|
# ===========================================================================
|
||||||
|
#
|
||||||
|
# SYNOPSIS
|
||||||
|
#
|
||||||
|
# AX_REQUIRE_DEFINED(MACRO)
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# AX_REQUIRE_DEFINED is a simple helper for making sure other macros have
|
||||||
|
# been defined and thus are available for use. This avoids random issues
|
||||||
|
# where a macro isn't expanded. Instead the configure script emits a
|
||||||
|
# non-fatal:
|
||||||
|
#
|
||||||
|
# ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found
|
||||||
|
#
|
||||||
|
# It's like AC_REQUIRE except it doesn't expand the required macro.
|
||||||
|
#
|
||||||
|
# Here's an example:
|
||||||
|
#
|
||||||
|
# AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG])
|
||||||
|
#
|
||||||
|
# LICENSE
|
||||||
|
#
|
||||||
|
# Copyright (c) 2014 Mike Frysinger <vapier@gentoo.org>
|
||||||
|
#
|
||||||
|
# Copying and distribution of this file, with or without modification, are
|
||||||
|
# permitted in any medium without royalty provided the copyright notice
|
||||||
|
# and this notice are preserved. This file is offered as-is, without any
|
||||||
|
# warranty.
|
||||||
|
|
||||||
|
#serial 1
|
||||||
|
|
||||||
|
AC_DEFUN([AX_REQUIRE_DEFINED], [dnl
|
||||||
|
m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])])
|
||||||
|
])dnl AX_REQUIRE_DEFINED
|
44
m4/curses.m4
Normal file
44
m4/curses.m4
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
dnl Check to find the curses headers/libraries
|
||||||
|
|
||||||
|
AC_DEFUN([tinc_CURSES],
|
||||||
|
[
|
||||||
|
AC_ARG_ENABLE([curses],
|
||||||
|
AS_HELP_STRING([--disable-curses], [disable curses support]))
|
||||||
|
AS_IF([test "x$enable_curses" != "xno"], [
|
||||||
|
AC_DEFINE(HAVE_CURSES, 1, [have curses support])
|
||||||
|
curses=true
|
||||||
|
AC_ARG_WITH(curses,
|
||||||
|
AS_HELP_STRING([--with-curses=DIR], [curses base directory, or:]),
|
||||||
|
[curses="$withval"
|
||||||
|
CPPFLAGS="$CPPFLAGS -I$withval/include"
|
||||||
|
LDFLAGS="$LDFLAGS -L$withval/lib"]
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_ARG_WITH(curses-include,
|
||||||
|
AS_HELP_STRING([--with-curses-include=DIR], [curses headers directory]),
|
||||||
|
[curses_include="$withval"
|
||||||
|
CPPFLAGS="$CPPFLAGS -I$withval"]
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_ARG_WITH(curses-lib,
|
||||||
|
AS_HELP_STRING([--with-curses-lib=DIR], [curses library directory]),
|
||||||
|
[curses_lib="$withval"
|
||||||
|
LDFLAGS="$LDFLAGS -L$withval"]
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_CHECK_HEADERS(curses.h,
|
||||||
|
[],
|
||||||
|
[AC_MSG_ERROR("curses header files not found."); break]
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_CHECK_LIB(ncurses, initscr,
|
||||||
|
[CURSES_LIBS="-lncurses"; AC_CHECK_LIB(tinfo, wtimeout, [CURSES_LIBS+=" -ltinfo"], [])],
|
||||||
|
[AC_CHECK_LIB(curses, initscr,
|
||||||
|
[CURSES_LIBS="-lcurses"],
|
||||||
|
[AC_MSG_ERROR("curses libraries not found.")]
|
||||||
|
)]
|
||||||
|
)
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_SUBST(CURSES_LIBS)
|
||||||
|
])
|
33
m4/libgcrypt.m4
Normal file
33
m4/libgcrypt.m4
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
dnl Check to find the libgcrypt headers/libraries
|
||||||
|
|
||||||
|
AC_DEFUN([tinc_LIBGCRYPT],
|
||||||
|
[
|
||||||
|
AC_ARG_WITH(libgcrypt,
|
||||||
|
AS_HELP_STRING([--with-libgcrypt=DIR], [libgcrypt base directory, or:]),
|
||||||
|
[libgcrypt="$withval"
|
||||||
|
CPPFLAGS="$CPPFLAGS -I$withval/include"
|
||||||
|
LDFLAGS="$LDFLAGS -L$withval/lib"]
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_ARG_WITH(libgcrypt-include,
|
||||||
|
AS_HELP_STRING([--with-libgcrypt-include=DIR], [libgcrypt headers directory (without trailing /libgcrypt)]),
|
||||||
|
[libgcrypt_include="$withval"
|
||||||
|
CPPFLAGS="$CPPFLAGS -I$withval"]
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_ARG_WITH(libgcrypt-lib,
|
||||||
|
AS_HELP_STRING([--with-libgcrypt-lib=DIR], [libgcrypt library directory]),
|
||||||
|
[libgcrypt_lib="$withval"
|
||||||
|
LDFLAGS="$LDFLAGS -L$withval"]
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_CHECK_HEADERS([gcrypt.h],
|
||||||
|
[],
|
||||||
|
[AC_MSG_ERROR([libgcrypt header files not found.]); break]
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_CHECK_LIB(gcrypt, gcry_cipher_encrypt,
|
||||||
|
[LIBS="-lgcrypt $LIBS"],
|
||||||
|
[AC_MSG_ERROR([libgcrypt libraries not found.])]
|
||||||
|
)
|
||||||
|
])
|
47
m4/lzo.m4
Normal file
47
m4/lzo.m4
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
dnl Check to find the lzo headers/libraries
|
||||||
|
|
||||||
|
AC_DEFUN([tinc_LZO],
|
||||||
|
[
|
||||||
|
AC_ARG_ENABLE([lzo],
|
||||||
|
AS_HELP_STRING([--disable-lzo], [disable lzo compression support]))
|
||||||
|
AS_IF([test "x$enable_lzo" != "xno"], [
|
||||||
|
AC_DEFINE(HAVE_LZO, 1, [enable lzo compression support])
|
||||||
|
AC_ARG_WITH(lzo,
|
||||||
|
AS_HELP_STRING([--with-lzo=DIR], [lzo base directory, or:]),
|
||||||
|
[lzo="$withval"
|
||||||
|
CPPFLAGS="$CPPFLAGS -I$withval/include"
|
||||||
|
LDFLAGS="$LDFLAGS -L$withval/lib"]
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_ARG_WITH(lzo-include,
|
||||||
|
AS_HELP_STRING([--with-lzo-include=DIR], [lzo headers directory]),
|
||||||
|
[lzo_include="$withval"
|
||||||
|
CPPFLAGS="$CPPFLAGS -I$withval"]
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_ARG_WITH(lzo-lib,
|
||||||
|
AS_HELP_STRING([--with-lzo-lib=DIR], [lzo library directory]),
|
||||||
|
[lzo_lib="$withval"
|
||||||
|
LDFLAGS="$LDFLAGS -L$withval"]
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_CHECK_LIB(lzo2, lzo1x_1_compress,
|
||||||
|
[LIBS="$LIBS -llzo2"],
|
||||||
|
[AC_CHECK_LIB(lzo, lzo1x_1_compress,
|
||||||
|
[LIBS="$LIBS -llzo"],
|
||||||
|
[AC_MSG_ERROR("lzo libraries not found."); break]
|
||||||
|
)]
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_CHECK_HEADERS(lzo/lzo1x.h,
|
||||||
|
[AC_DEFINE(LZO1X_H, [<lzo/lzo1x.h>], [Location of lzo1x.h])],
|
||||||
|
[AC_CHECK_HEADERS(lzo2/lzo1x.h,
|
||||||
|
[AC_DEFINE(LZO1X_H, [<lzo2/lzo1x.h>], [Location of lzo1x.h])],
|
||||||
|
[AC_CHECK_HEADERS(lzo1x.h,
|
||||||
|
[AC_DEFINE(LZO1X_H, [<lzo1x.h>], [Location of lzo1x.h])],
|
||||||
|
[AC_MSG_ERROR("lzo header files not found."); break]
|
||||||
|
)]
|
||||||
|
)]
|
||||||
|
)
|
||||||
|
])
|
||||||
|
])
|
40
m4/miniupnpc.m4
Normal file
40
m4/miniupnpc.m4
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
dnl Check to find the miniupnpc headers/libraries
|
||||||
|
|
||||||
|
AC_DEFUN([tinc_MINIUPNPC],
|
||||||
|
[
|
||||||
|
AC_ARG_ENABLE([miniupnpc],
|
||||||
|
AS_HELP_STRING([--enable-miniupnpc], [enable miniupnpc support]))
|
||||||
|
AS_IF([test "x$enable_miniupnpc" = "xyes"], [
|
||||||
|
AC_DEFINE(HAVE_MINIUPNPC, 1, [have miniupnpc support])
|
||||||
|
AC_ARG_WITH(miniupnpc,
|
||||||
|
AS_HELP_STRING([--with-miniupnpc=DIR], [miniupnpc base directory, or:]),
|
||||||
|
[miniupnpc="$withval"
|
||||||
|
CPPFLAGS="$CPPFLAGS -I$withval/include"
|
||||||
|
LDFLAGS="$LDFLAGS -L$withval/lib"]
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_ARG_WITH(miniupnpc-include,
|
||||||
|
AS_HELP_STRING([--with-miniupnpc-include=DIR], [miniupnpc headers directory]),
|
||||||
|
[miniupnpc_include="$withval"
|
||||||
|
CPPFLAGS="$CPPFLAGS -I$withval"]
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_ARG_WITH(miniupnpc-lib,
|
||||||
|
AS_HELP_STRING([--with-miniupnpc-lib=DIR], [miniupnpc library directory]),
|
||||||
|
[miniupnpc_lib="$withval"
|
||||||
|
LDFLAGS="$LDFLAGS -L$withval"]
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_CHECK_HEADERS(miniupnpc/miniupnpc.h,
|
||||||
|
[],
|
||||||
|
[AC_MSG_ERROR("miniupnpc header files not found."); break]
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_CHECK_LIB(miniupnpc, upnpDiscover,
|
||||||
|
[MINIUPNPC_LIBS="$LIBS -lminiupnpc"],
|
||||||
|
[AC_MSG_ERROR("miniupnpc libraries not found.")]
|
||||||
|
)
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_SUBST(MINIUPNPC_LIBS)
|
||||||
|
])
|
59
m4/openssl.m4
Normal file
59
m4/openssl.m4
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
dnl Check to find the LibreSSL/OpenSSL headers/libraries
|
||||||
|
|
||||||
|
AC_DEFUN([tinc_OPENSSL],
|
||||||
|
[
|
||||||
|
case $host_os in
|
||||||
|
*mingw*)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
AC_CHECK_FUNC(dlopen,
|
||||||
|
[],
|
||||||
|
[AC_CHECK_LIB(dl, dlopen,
|
||||||
|
[LIBS="$LIBS -ldl"],
|
||||||
|
[AC_MSG_ERROR([LibreSSL/OpenSSL depends on libdl.]); break]
|
||||||
|
)]
|
||||||
|
)
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
AC_ARG_WITH(openssl,
|
||||||
|
AS_HELP_STRING([--with-openssl=DIR], [LibreSSL/OpenSSL base directory, or:]),
|
||||||
|
[openssl="$withval"
|
||||||
|
CPPFLAGS="$CPPFLAGS -I$withval/include"
|
||||||
|
LDFLAGS="$LDFLAGS -L$withval/lib"]
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_ARG_WITH(openssl-include,
|
||||||
|
AS_HELP_STRING([--with-openssl-include=DIR], [LibreSSL/OpenSSL headers directory (without trailing /openssl)]),
|
||||||
|
[openssl_include="$withval"
|
||||||
|
CPPFLAGS="$CPPFLAGS -I$withval"]
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_ARG_WITH(openssl-lib,
|
||||||
|
AS_HELP_STRING([--with-openssl-lib=DIR], [LibreSSL/OpenSSL library directory]),
|
||||||
|
[openssl_lib="$withval"
|
||||||
|
LDFLAGS="$LDFLAGS -L$withval"]
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_CHECK_HEADERS([openssl/evp.h openssl/rsa.h openssl/rand.h openssl/err.h openssl/sha.h openssl/pem.h openssl/engine.h],
|
||||||
|
[],
|
||||||
|
[AC_MSG_ERROR([LibreSSL/OpenSSL header files not found.]); break]
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_CHECK_LIB(crypto, EVP_EncryptInit_ex,
|
||||||
|
[LIBS="-lcrypto $LIBS"],
|
||||||
|
[AC_MSG_ERROR([LibreSSL/OpenSSL libraries not found.])]
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_CHECK_FUNCS([RAND_bytes EVP_EncryptInit_ex EVP_CIPHER_CTX_new], ,
|
||||||
|
[AC_MSG_ERROR([Missing LibreSSL/OpenSSL functionality, make sure you have installed the latest version.]); break],
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_CHECK_DECLS([OpenSSL_add_all_algorithms, EVP_aes_256_cfb], ,
|
||||||
|
[AC_MSG_ERROR([Missing LibreSSL/OpenSSL functionality, make sure you have installed the latest version.]); break],
|
||||||
|
[#include <openssl/evp.h>]
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_CHECK_FUNCS([BN_GENCB_new ERR_remove_state RSA_set0_key], , , [#include <openssl/rsa.h>])
|
||||||
|
AC_CHECK_FUNCS([HMAC_CTX_new], , , [#include <openssl/hmac.h>])
|
||||||
|
])
|
42
m4/readline.m4
Normal file
42
m4/readline.m4
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
dnl Check to find the readline headers/libraries
|
||||||
|
|
||||||
|
AC_DEFUN([tinc_READLINE],
|
||||||
|
[
|
||||||
|
AC_ARG_ENABLE([readline],
|
||||||
|
AS_HELP_STRING([--disable-readline], [disable readline support]))
|
||||||
|
AS_IF([test "x$enable_readline" != "xno"], [
|
||||||
|
AC_DEFINE(HAVE_READLINE, 1, [have readline support])
|
||||||
|
readline=true
|
||||||
|
AC_ARG_WITH(readline,
|
||||||
|
AS_HELP_STRING([--with-readline=DIR], [readline base directory, or:]),
|
||||||
|
[readline="$withval"
|
||||||
|
CPPFLAGS="$CPPFLAGS -I$withval/include"
|
||||||
|
LDFLAGS="$LDFLAGS -L$withval/lib"]
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_ARG_WITH(readline-include,
|
||||||
|
AS_HELP_STRING([--with-readline-include=DIR], [readline headers directory]),
|
||||||
|
[readline_include="$withval"
|
||||||
|
CPPFLAGS="$CPPFLAGS -I$withval"]
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_ARG_WITH(readline-lib,
|
||||||
|
AS_HELP_STRING([--with-readline-lib=DIR], [readline library directory]),
|
||||||
|
[readline_lib="$withval"
|
||||||
|
LDFLAGS="$LDFLAGS -L$withval"]
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_CHECK_HEADERS([readline/readline.h readline/history.h],
|
||||||
|
[],
|
||||||
|
[AC_MSG_ERROR("readline header files not found."); break]
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_CHECK_LIB(readline, readline,
|
||||||
|
[READLINE_LIBS="-lreadline"],
|
||||||
|
[AC_MSG_ERROR("readline library not found.")],
|
||||||
|
[$CURSES_LIBS]
|
||||||
|
)
|
||||||
|
])
|
||||||
|
|
||||||
|
AC_SUBST(READLINE_LIBS)
|
||||||
|
])
|
38
m4/zlib.m4
Normal file
38
m4/zlib.m4
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
dnl Check to find the zlib headers/libraries
|
||||||
|
|
||||||
|
AC_DEFUN([tinc_ZLIB],
|
||||||
|
[
|
||||||
|
AC_ARG_ENABLE([zlib],
|
||||||
|
AS_HELP_STRING([--disable-zlib], [disable zlib compression support]))
|
||||||
|
AS_IF([test "x$enable_zlib" != "xno"], [
|
||||||
|
AC_DEFINE(HAVE_ZLIB, 1, [have zlib compression support])
|
||||||
|
AC_ARG_WITH(zlib,
|
||||||
|
AS_HELP_STRING([--with-zlib=DIR], [zlib base directory, or:]),
|
||||||
|
[zlib="$withval"
|
||||||
|
CPPFLAGS="$CPPFLAGS -I$withval/include"
|
||||||
|
LDFLAGS="$LDFLAGS -L$withval/lib"]
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_ARG_WITH(zlib-include,
|
||||||
|
AS_HELP_STRING([--with-zlib-include=DIR], [zlib headers directory]),
|
||||||
|
[zlib_include="$withval"
|
||||||
|
CPPFLAGS="$CPPFLAGS -I$withval"]
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_ARG_WITH(zlib-lib,
|
||||||
|
AS_HELP_STRING([--with-zlib-lib=DIR], [zlib library directory]),
|
||||||
|
[zlib_lib="$withval"
|
||||||
|
LDFLAGS="$LDFLAGS -L$withval"]
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_CHECK_HEADERS(zlib.h,
|
||||||
|
[],
|
||||||
|
[AC_MSG_ERROR("zlib header files not found."); break]
|
||||||
|
)
|
||||||
|
|
||||||
|
AC_CHECK_LIB(z, compress2,
|
||||||
|
[LIBS="$LIBS -lz"],
|
||||||
|
[AC_MSG_ERROR("zlib libraries not found.")]
|
||||||
|
)
|
||||||
|
])
|
||||||
|
])
|
Loading…
Reference in a new issue