mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-19 10:05:05 -07:00
Update m4 scripts
Update ax_check_define.m4 Update ax_check_gnu_make.m4 Update ax_pthread.m4 Update ax_valgrind_check.m4 Update ax_add_fortify_source.m4
This commit is contained in:
parent
9dc6b80d8c
commit
258934f5b6
@ -9,9 +9,9 @@
|
|||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
#
|
#
|
||||||
# Check whether -D_FORTIFY_SOURCE=2 can be added to CPPFLAGS without macro
|
# Check whether -D_FORTIFY_SOURCE=2 can be added to CPPFLAGS without macro
|
||||||
# redefinition warnings or linker errors. Some distributions (such as
|
# redefinition warnings, other cpp warnings or linker. Some distributions
|
||||||
# Gentoo Linux) enable _FORTIFY_SOURCE globally in their compilers,
|
# (such as Ubuntu or Gentoo Linux) enable _FORTIFY_SOURCE globally in
|
||||||
# leading to unnecessary warnings in the form of
|
# their compilers, leading to unnecessary warnings in the form of
|
||||||
#
|
#
|
||||||
# <command-line>:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror]
|
# <command-line>:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror]
|
||||||
# <built-in>: note: this is the location of the previous definition
|
# <built-in>: note: this is the location of the previous definition
|
||||||
@ -21,41 +21,45 @@
|
|||||||
# to CPPFLAGS.
|
# to CPPFLAGS.
|
||||||
#
|
#
|
||||||
# Newer mingw-w64 msys2 package comes with a bug in
|
# Newer mingw-w64 msys2 package comes with a bug in
|
||||||
# headers-git-7.0.0.5546.d200317d-1. It broke -D_FORTIFY_SOURCE
|
# headers-git-7.0.0.5546.d200317d-1. It broke -D_FORTIFY_SOURCE support,
|
||||||
# support, and would need -lssp or -fstack-protector. See
|
# and would need -lssp or -fstack-protector. See
|
||||||
# https://github.com/msys2/MINGW-packages/issues/5803. Try to
|
# https://github.com/msys2/MINGW-packages/issues/5803. Try to actually
|
||||||
# actually link it.
|
# link it.
|
||||||
#
|
#
|
||||||
# LICENSE
|
# LICENSE
|
||||||
#
|
#
|
||||||
# Copyright (c) 2017 David Seifert <soap@gentoo.org>
|
# Copyright (c) 2017 David Seifert <soap@gentoo.org>
|
||||||
# Copyright (c) 2019 Reini Urban <rurban@cpan.org>
|
# Copyright (c) 2019, 2023 Reini Urban <rurban@cpan.org>
|
||||||
#
|
#
|
||||||
# Copying and distribution of this file, with or without modification, are
|
# Copying and distribution of this file, with or without modification, are
|
||||||
# permitted in any medium without royalty provided the copyright notice
|
# permitted in any medium without royalty provided the copyright notice
|
||||||
# and this notice are preserved. This file is offered as-is, without any
|
# and this notice are preserved. This file is offered as-is, without any
|
||||||
# warranty.
|
# warranty.
|
||||||
|
|
||||||
#serial 3
|
#serial 8
|
||||||
|
|
||||||
AC_DEFUN([AX_ADD_FORTIFY_SOURCE],[
|
AC_DEFUN([AX_ADD_FORTIFY_SOURCE],[
|
||||||
AC_MSG_CHECKING([whether to add -D_FORTIFY_SOURCE=2 to CPPFLAGS])
|
ac_save_cflags=$CFLAGS
|
||||||
|
ac_cwerror_flag=yes
|
||||||
|
AX_CHECK_COMPILE_FLAG([-Werror],[CFLAGS="$CFLAGS -Werror"])
|
||||||
|
ax_add_fortify_3_failed=
|
||||||
|
AC_MSG_CHECKING([whether to add -D_FORTIFY_SOURCE=3 to CPPFLAGS])
|
||||||
AC_LINK_IFELSE([
|
AC_LINK_IFELSE([
|
||||||
AC_LANG_PROGRAM([],
|
AC_LANG_PROGRAM([],
|
||||||
[[
|
[[
|
||||||
#ifndef _FORTIFY_SOURCE
|
#ifndef _FORTIFY_SOURCE
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
this_is_an_error;
|
_FORTIFY_SOURCE_already_defined;
|
||||||
#endif
|
#endif
|
||||||
]]
|
]]
|
||||||
)],
|
)],
|
||||||
AC_LINK_IFELSE([
|
AC_LINK_IFELSE([
|
||||||
AC_LANG_SOURCE([[
|
AC_LANG_SOURCE([[
|
||||||
#define _FORTIFY_SOURCE 2
|
#define _FORTIFY_SOURCE 3
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
int main() {
|
int main() {
|
||||||
const char *s = " ";
|
char *s = " ";
|
||||||
strcpy(s, "x");
|
strcpy(s, "x");
|
||||||
return strlen(s)-1;
|
return strlen(s)-1;
|
||||||
}
|
}
|
||||||
@ -63,12 +67,55 @@ AC_DEFUN([AX_ADD_FORTIFY_SOURCE],[
|
|||||||
)],
|
)],
|
||||||
[
|
[
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes])
|
||||||
CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2"
|
CFLAGS=$ac_save_cflags
|
||||||
|
CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=3"
|
||||||
], [
|
], [
|
||||||
AC_MSG_RESULT([no])
|
AC_MSG_RESULT([no])
|
||||||
|
CFLAGS=$ac_save_cflags
|
||||||
|
ax_add_fortify_3_failed=1
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
[
|
[
|
||||||
AC_MSG_RESULT([no])
|
AC_MSG_RESULT([no])
|
||||||
])
|
CFLAGS=$ac_save_cflags
|
||||||
|
ax_add_fortify_3_failed=1
|
||||||
|
])
|
||||||
|
if test -n "$ax_add_fortify_3_failed"
|
||||||
|
then
|
||||||
|
AC_MSG_CHECKING([whether to add -D_FORTIFY_SOURCE=2 to CPPFLAGS])
|
||||||
|
AC_LINK_IFELSE([
|
||||||
|
AC_LANG_PROGRAM([],
|
||||||
|
[[
|
||||||
|
#ifndef _FORTIFY_SOURCE
|
||||||
|
return 0;
|
||||||
|
#else
|
||||||
|
_FORTIFY_SOURCE_already_defined;
|
||||||
|
#endif
|
||||||
|
]]
|
||||||
|
)],
|
||||||
|
AC_LINK_IFELSE([
|
||||||
|
AC_LANG_SOURCE([[
|
||||||
|
#define _FORTIFY_SOURCE 2
|
||||||
|
#include <string.h>
|
||||||
|
int main(void) {
|
||||||
|
char *s = " ";
|
||||||
|
strcpy(s, "x");
|
||||||
|
return strlen(s)-1;
|
||||||
|
}
|
||||||
|
]]
|
||||||
|
)],
|
||||||
|
[
|
||||||
|
AC_MSG_RESULT([yes])
|
||||||
|
CFLAGS=$ac_save_cflags
|
||||||
|
CPPFLAGS="$CPPFLAGS -D_FORTIFY_SOURCE=2"
|
||||||
|
], [
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
CFLAGS=$ac_save_cflags
|
||||||
|
],
|
||||||
|
),
|
||||||
|
[
|
||||||
|
AC_MSG_RESULT([no])
|
||||||
|
CFLAGS=$ac_save_cflags
|
||||||
|
])
|
||||||
|
fi
|
||||||
])
|
])
|
||||||
|
@ -18,33 +18,12 @@
|
|||||||
#
|
#
|
||||||
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
|
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify it
|
# Copying and distribution of this file, with or without modification, are
|
||||||
# under the terms of the GNU General Public License as published by the
|
# permitted in any medium without royalty provided the copyright notice
|
||||||
# Free Software Foundation; either version 3 of the License, or (at your
|
# and this notice are preserved. This file is offered as-is, without any
|
||||||
# option) any later version.
|
# warranty.
|
||||||
#
|
|
||||||
# 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 <https://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 9
|
#serial 11
|
||||||
|
|
||||||
AU_ALIAS([AC_CHECK_DEFINED], [AC_CHECK_DEFINE])
|
AU_ALIAS([AC_CHECK_DEFINED], [AC_CHECK_DEFINE])
|
||||||
AC_DEFUN([AC_CHECK_DEFINE],[
|
AC_DEFUN([AC_CHECK_DEFINE],[
|
||||||
@ -53,6 +32,7 @@ AC_CACHE_CHECK([for $1 defined], ac_var,
|
|||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
|
||||||
#ifdef $1
|
#ifdef $1
|
||||||
int ok;
|
int ok;
|
||||||
|
(void)ok;
|
||||||
#else
|
#else
|
||||||
choke me
|
choke me
|
||||||
#endif
|
#endif
|
||||||
@ -68,6 +48,7 @@ AC_CACHE_CHECK([for $2 defined in $1], ac_var,
|
|||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <$1>]], [[
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <$1>]], [[
|
||||||
#ifdef $2
|
#ifdef $2
|
||||||
int ok;
|
int ok;
|
||||||
|
(void)ok;
|
||||||
#else
|
#else
|
||||||
choke me
|
choke me
|
||||||
#endif
|
#endif
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
#
|
#
|
||||||
# AX_CHECK_GNU_MAKE()
|
# AX_CHECK_GNU_MAKE([run-if-true],[run-if-false])
|
||||||
#
|
#
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
#
|
#
|
||||||
@ -13,6 +13,10 @@
|
|||||||
# * The makefile variable `ifGNUmake' is set to the empty string, otherwise
|
# * The makefile variable `ifGNUmake' is set to the empty string, otherwise
|
||||||
# it is set to "#". This is useful for including a special features in a
|
# it is set to "#". This is useful for including a special features in a
|
||||||
# Makefile, which cannot be handled by other versions of make.
|
# Makefile, which cannot be handled by other versions of make.
|
||||||
|
# * The makefile variable `ifnGNUmake' is set to #, otherwise
|
||||||
|
# it is set to the empty string. This is useful for including a special
|
||||||
|
# features in a Makefile, which can be handled
|
||||||
|
# by other versions of make or to specify else like clause.
|
||||||
# * The variable `_cv_gnu_make_command` is set to the command to invoke
|
# * The variable `_cv_gnu_make_command` is set to the command to invoke
|
||||||
# GNU make if it exists, the empty string otherwise.
|
# GNU make if it exists, the empty string otherwise.
|
||||||
# * The variable `ax_cv_gnu_make_command` is set to the command to invoke
|
# * The variable `ax_cv_gnu_make_command` is set to the command to invoke
|
||||||
@ -20,6 +24,8 @@
|
|||||||
# * If GNU Make is found, its version is extracted from the output of
|
# * If GNU Make is found, its version is extracted from the output of
|
||||||
# `make --version` as the last field of a record of space-separated
|
# `make --version` as the last field of a record of space-separated
|
||||||
# columns and saved into the variable `ax_check_gnu_make_version`.
|
# columns and saved into the variable `ax_check_gnu_make_version`.
|
||||||
|
# * Additionally if GNU Make is found, run shell code run-if-true
|
||||||
|
# else run shell code run-if-false.
|
||||||
#
|
#
|
||||||
# Here is an example of its use:
|
# Here is an example of its use:
|
||||||
#
|
#
|
||||||
@ -31,6 +37,8 @@
|
|||||||
#
|
#
|
||||||
# @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
|
# @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND)))
|
||||||
# @ifGNUmake@ include $(DEPEND)
|
# @ifGNUmake@ include $(DEPEND)
|
||||||
|
# @ifGNUmake@ else
|
||||||
|
# fallback code
|
||||||
# @ifGNUmake@ endif
|
# @ifGNUmake@ endif
|
||||||
#
|
#
|
||||||
# Then configure.in would normally contain:
|
# Then configure.in would normally contain:
|
||||||
@ -61,7 +69,7 @@
|
|||||||
# and this notice are preserved. This file is offered as-is, without any
|
# and this notice are preserved. This file is offered as-is, without any
|
||||||
# warranty.
|
# warranty.
|
||||||
|
|
||||||
#serial 9
|
#serial 12
|
||||||
|
|
||||||
AC_DEFUN([AX_CHECK_GNU_MAKE],dnl
|
AC_DEFUN([AX_CHECK_GNU_MAKE],dnl
|
||||||
[AC_PROG_AWK
|
[AC_PROG_AWK
|
||||||
@ -79,6 +87,9 @@ dnl Search all the common names for GNU make
|
|||||||
done ;])
|
done ;])
|
||||||
dnl If there was a GNU version, then set @ifGNUmake@ to the empty string, '#' otherwise
|
dnl If there was a GNU version, then set @ifGNUmake@ to the empty string, '#' otherwise
|
||||||
AS_VAR_IF([_cv_gnu_make_command], [""], [AS_VAR_SET([ifGNUmake], ["#"])], [AS_VAR_SET([ifGNUmake], [""])])
|
AS_VAR_IF([_cv_gnu_make_command], [""], [AS_VAR_SET([ifGNUmake], ["#"])], [AS_VAR_SET([ifGNUmake], [""])])
|
||||||
|
AS_VAR_IF([_cv_gnu_make_command], [""], [AS_VAR_SET([ifnGNUmake], [""])], [AS_VAR_SET([ifnGNUmake], ["#"])])
|
||||||
AS_VAR_IF([_cv_gnu_make_command], [""], [AS_UNSET(ax_cv_gnu_make_command)], [AS_VAR_SET([ax_cv_gnu_make_command], [${_cv_gnu_make_command}])])
|
AS_VAR_IF([_cv_gnu_make_command], [""], [AS_UNSET(ax_cv_gnu_make_command)], [AS_VAR_SET([ax_cv_gnu_make_command], [${_cv_gnu_make_command}])])
|
||||||
|
AS_VAR_IF([_cv_gnu_make_command], [""],[$2],[$1])
|
||||||
AC_SUBST([ifGNUmake])
|
AC_SUBST([ifGNUmake])
|
||||||
|
AC_SUBST([ifnGNUmake])
|
||||||
])
|
])
|
||||||
|
@ -87,11 +87,11 @@
|
|||||||
# modified version of the Autoconf Macro, you may extend this special
|
# modified version of the Autoconf Macro, you may extend this special
|
||||||
# exception to the GPL to apply to your modified version as well.
|
# exception to the GPL to apply to your modified version as well.
|
||||||
|
|
||||||
#serial 30
|
#serial 31
|
||||||
|
|
||||||
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
|
AU_ALIAS([ACX_PTHREAD], [AX_PTHREAD])
|
||||||
AC_DEFUN([AX_PTHREAD], [
|
AC_DEFUN([AX_PTHREAD], [
|
||||||
AC_REQUIRE([AC_CANONICAL_TARGET])
|
AC_REQUIRE([AC_CANONICAL_HOST])
|
||||||
AC_REQUIRE([AC_PROG_CC])
|
AC_REQUIRE([AC_PROG_CC])
|
||||||
AC_REQUIRE([AC_PROG_SED])
|
AC_REQUIRE([AC_PROG_SED])
|
||||||
AC_LANG_PUSH([C])
|
AC_LANG_PUSH([C])
|
||||||
@ -158,7 +158,7 @@ ax_pthread_flags="pthreads none -Kthread -pthread -pthreads -mthreads pthread --
|
|||||||
# --thread-safe: KAI C++
|
# --thread-safe: KAI C++
|
||||||
# pthread-config: use pthread-config program (for GNU Pth library)
|
# pthread-config: use pthread-config program (for GNU Pth library)
|
||||||
|
|
||||||
case $target_os in
|
case $host_os in
|
||||||
|
|
||||||
freebsd*)
|
freebsd*)
|
||||||
|
|
||||||
@ -248,7 +248,7 @@ AS_IF([test "x$ax_pthread_clang" = "xyes"],
|
|||||||
# definitions is, on some systems, a strong hint that pthreads support is
|
# definitions is, on some systems, a strong hint that pthreads support is
|
||||||
# correctly enabled
|
# correctly enabled
|
||||||
|
|
||||||
case $target_os in
|
case $host_os in
|
||||||
darwin* | hpux* | linux* | osf* | solaris*)
|
darwin* | hpux* | linux* | osf* | solaris*)
|
||||||
ax_pthread_check_macro="_REENTRANT"
|
ax_pthread_check_macro="_REENTRANT"
|
||||||
;;
|
;;
|
||||||
@ -450,7 +450,7 @@ if test "x$ax_pthread_ok" = "xyes"; then
|
|||||||
AC_CACHE_CHECK([whether more special flags are required for pthreads],
|
AC_CACHE_CHECK([whether more special flags are required for pthreads],
|
||||||
[ax_cv_PTHREAD_SPECIAL_FLAGS],
|
[ax_cv_PTHREAD_SPECIAL_FLAGS],
|
||||||
[ax_cv_PTHREAD_SPECIAL_FLAGS=no
|
[ax_cv_PTHREAD_SPECIAL_FLAGS=no
|
||||||
case $target_os in
|
case $host_os in
|
||||||
solaris*)
|
solaris*)
|
||||||
ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS"
|
ax_cv_PTHREAD_SPECIAL_FLAGS="-D_POSIX_PTHREAD_SEMANTICS"
|
||||||
;;
|
;;
|
||||||
@ -480,7 +480,7 @@ if test "x$ax_pthread_ok" = "xyes"; then
|
|||||||
|
|
||||||
# More AIX lossage: compile with *_r variant
|
# More AIX lossage: compile with *_r variant
|
||||||
if test "x$GCC" != "xyes"; then
|
if test "x$GCC" != "xyes"; then
|
||||||
case $target_os in
|
case $host_os in
|
||||||
aix*)
|
aix*)
|
||||||
AS_CASE(["x/$CC"],
|
AS_CASE(["x/$CC"],
|
||||||
[x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
|
[x*/c89|x*/c89_128|x*/c99|x*/c99_128|x*/cc|x*/cc128|x*/xlc|x*/xlc_v6|x*/xlc128|x*/xlc128_v6],
|
||||||
|
@ -36,21 +36,19 @@
|
|||||||
# AX_VALGRIND_DFLT([sgcheck], [off])
|
# AX_VALGRIND_DFLT([sgcheck], [off])
|
||||||
# AX_VALGRIND_CHECK
|
# AX_VALGRIND_CHECK
|
||||||
#
|
#
|
||||||
# Makefile.am:
|
# in each Makefile.am with tests:
|
||||||
#
|
#
|
||||||
# @VALGRIND_CHECK_RULES@
|
# @VALGRIND_CHECK_RULES@
|
||||||
# VALGRIND_SUPPRESSIONS_FILES = my-project.supp
|
# VALGRIND_SUPPRESSIONS_FILES = my-project.supp
|
||||||
# EXTRA_DIST = my-project.supp
|
# EXTRA_DIST = my-project.supp
|
||||||
#
|
#
|
||||||
# This results in a "check-valgrind" rule being added to any Makefile.am
|
# This results in a "check-valgrind" rule being added. Running `make
|
||||||
# which includes "@VALGRIND_CHECK_RULES@" (assuming the module has been
|
# check-valgrind` in that directory will recursively run the module's test
|
||||||
# configured with --enable-valgrind). Running `make check-valgrind` in
|
# suite (`make check`) once for each of the available Valgrind tools (out
|
||||||
# that directory will run the module's test suite (`make check`) once for
|
# of memcheck, helgrind and drd) while the sgcheck will be skipped unless
|
||||||
# each of the available Valgrind tools (out of memcheck, helgrind and drd)
|
# enabled again on the commandline with --enable-valgrind-sgcheck. The
|
||||||
# while the sgcheck will be skipped unless enabled again on the
|
# results for each check will be output to test-suite-$toolname.log. The
|
||||||
# commandline with --enable-valgrind-sgcheck. The results for each check
|
# target will succeed if there are zero errors and fail otherwise.
|
||||||
# will be output to test-suite-$toolname.log. The target will succeed if
|
|
||||||
# there are zero errors and fail otherwise.
|
|
||||||
#
|
#
|
||||||
# Alternatively, a "check-valgrind-$TOOL" rule will be added, for $TOOL in
|
# Alternatively, a "check-valgrind-$TOOL" rule will be added, for $TOOL in
|
||||||
# memcheck, helgrind, drd and sgcheck. These are useful because often only
|
# memcheck, helgrind, drd and sgcheck. These are useful because often only
|
||||||
@ -67,7 +65,7 @@
|
|||||||
# and this notice are preserved. This file is offered as-is, without any
|
# and this notice are preserved. This file is offered as-is, without any
|
||||||
# warranty.
|
# warranty.
|
||||||
|
|
||||||
#serial 15
|
#serial 23
|
||||||
|
|
||||||
dnl Configured tools
|
dnl Configured tools
|
||||||
m4_define([valgrind_tool_list], [[memcheck], [helgrind], [drd], [sgcheck]])
|
m4_define([valgrind_tool_list], [[memcheck], [helgrind], [drd], [sgcheck]])
|
||||||
@ -80,10 +78,14 @@ AC_DEFUN([AX_VALGRIND_DFLT],[
|
|||||||
])dnl
|
])dnl
|
||||||
|
|
||||||
AC_DEFUN([AX_VALGRIND_CHECK],[
|
AC_DEFUN([AX_VALGRIND_CHECK],[
|
||||||
|
AM_EXTRA_RECURSIVE_TARGETS([check-valgrind])
|
||||||
|
m4_foreach([vgtool], [valgrind_tool_list],
|
||||||
|
[AM_EXTRA_RECURSIVE_TARGETS([check-valgrind-]vgtool)])
|
||||||
|
|
||||||
dnl Check for --enable-valgrind
|
dnl Check for --enable-valgrind
|
||||||
AC_ARG_ENABLE([valgrind],
|
AC_ARG_ENABLE([valgrind],
|
||||||
[AS_HELP_STRING([--enable-valgrind], [Whether to enable Valgrind on the unit tests (requires GNU make)])],
|
[AS_HELP_STRING([--enable-valgrind], [Whether to enable Valgrind on the unit tests])],
|
||||||
[enable_valgrind=$enableval],[enable_valgrind=no])
|
[enable_valgrind=$enableval],[enable_valgrind=])
|
||||||
|
|
||||||
AS_IF([test "$enable_valgrind" != "no"],[
|
AS_IF([test "$enable_valgrind" != "no"],[
|
||||||
# Check for Valgrind.
|
# Check for Valgrind.
|
||||||
@ -175,7 +177,7 @@ valgrind_quiet_ = $(valgrind_quiet_$(AM_DEFAULT_VERBOSITY))
|
|||||||
valgrind_quiet_0 = --quiet
|
valgrind_quiet_0 = --quiet
|
||||||
valgrind_v_use = $(valgrind_v_use_$(V))
|
valgrind_v_use = $(valgrind_v_use_$(V))
|
||||||
valgrind_v_use_ = $(valgrind_v_use_$(AM_DEFAULT_VERBOSITY))
|
valgrind_v_use_ = $(valgrind_v_use_$(AM_DEFAULT_VERBOSITY))
|
||||||
valgrind_v_use_0 = @echo " USE " $(patsubst check-valgrind-%,%,$''@):;
|
valgrind_v_use_0 = @echo " USE " $(patsubst check-valgrind-%-local,%,$''@):;
|
||||||
|
|
||||||
# Support running with and without libtool.
|
# Support running with and without libtool.
|
||||||
ifneq ($(LIBTOOL),)
|
ifneq ($(LIBTOOL),)
|
||||||
@ -185,12 +187,12 @@ valgrind_lt =
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
# Use recursive makes in order to ignore errors during check
|
# Use recursive makes in order to ignore errors during check
|
||||||
check-valgrind:
|
check-valgrind-local:
|
||||||
ifeq ($(VALGRIND_ENABLED),yes)
|
ifeq ($(VALGRIND_ENABLED),yes)
|
||||||
$(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) -k \
|
$(A''M_V_at)$(MAKE) $(AM_MAKEFLAGS) -k \
|
||||||
$(foreach tool, $(valgrind_enabled_tools), check-valgrind-$(tool))
|
$(foreach tool, $(valgrind_enabled_tools), check-valgrind-$(tool))
|
||||||
else
|
else
|
||||||
@echo "Need to use GNU make and reconfigure with --enable-valgrind"
|
@echo "Need to reconfigure with --enable-valgrind"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Valgrind running
|
# Valgrind running
|
||||||
@ -204,14 +206,16 @@ VALGRIND_LOG_COMPILER = \
|
|||||||
$(valgrind_lt) \
|
$(valgrind_lt) \
|
||||||
$(VALGRIND) $(VALGRIND_SUPPRESSIONS) --error-exitcode=1 $(VALGRIND_FLAGS)
|
$(VALGRIND) $(VALGRIND_SUPPRESSIONS) --error-exitcode=1 $(VALGRIND_FLAGS)
|
||||||
|
|
||||||
define valgrind_tool_rule =
|
define valgrind_tool_rule
|
||||||
check-valgrind-$(1):
|
check-valgrind-$(1)-local:
|
||||||
ifeq ($$(VALGRIND_ENABLED)-$$(ENABLE_VALGRIND_$(1)),yes-yes)
|
ifeq ($$(VALGRIND_ENABLED)-$$(ENABLE_VALGRIND_$(1)),yes-yes)
|
||||||
|
ifneq ($$(TESTS),)
|
||||||
$$(valgrind_v_use)$$(MAKE) check-TESTS \
|
$$(valgrind_v_use)$$(MAKE) check-TESTS \
|
||||||
TESTS_ENVIRONMENT="$$(VALGRIND_TESTS_ENVIRONMENT)" \
|
TESTS_ENVIRONMENT="$$(VALGRIND_TESTS_ENVIRONMENT)" \
|
||||||
LOG_COMPILER="$$(VALGRIND_LOG_COMPILER)" \
|
LOG_COMPILER="$$(VALGRIND_LOG_COMPILER)" \
|
||||||
LOG_FLAGS="$$(valgrind_$(1)_flags)" \
|
LOG_FLAGS="$$(valgrind_$(1)_flags)" \
|
||||||
TEST_SUITE_LOG=test-suite-$(1).log
|
TEST_SUITE_LOG=test-suite-$(1).log
|
||||||
|
endif
|
||||||
else ifeq ($$(VALGRIND_ENABLED),yes)
|
else ifeq ($$(VALGRIND_ENABLED),yes)
|
||||||
@echo "Need to reconfigure with --enable-valgrind-$(1)"
|
@echo "Need to reconfigure with --enable-valgrind-$(1)"
|
||||||
else
|
else
|
||||||
@ -227,15 +231,9 @@ A''M_DISTCHECK_CONFIGURE_FLAGS += --disable-valgrind
|
|||||||
MOSTLYCLEANFILES ?=
|
MOSTLYCLEANFILES ?=
|
||||||
MOSTLYCLEANFILES += $(valgrind_log_files)
|
MOSTLYCLEANFILES += $(valgrind_log_files)
|
||||||
|
|
||||||
.PHONY: check-valgrind $(add-prefix check-valgrind-,$(valgrind_tools))
|
.PHONY: check-valgrind $(addprefix check-valgrind-,$(valgrind_tools))
|
||||||
']
|
']
|
||||||
|
|
||||||
AS_IF([test "$enable_valgrind" != "yes"], [
|
|
||||||
VALGRIND_CHECK_RULES='
|
|
||||||
check-valgrind:
|
|
||||||
@echo "Need to use GNU make and reconfigure with --enable-valgrind"'
|
|
||||||
])
|
|
||||||
|
|
||||||
AC_SUBST([VALGRIND_CHECK_RULES])
|
AC_SUBST([VALGRIND_CHECK_RULES])
|
||||||
m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([VALGRIND_CHECK_RULES])])
|
m4_ifdef([_AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE([VALGRIND_CHECK_RULES])])
|
||||||
])
|
])
|
||||||
|
Loading…
Reference in New Issue
Block a user