diff options
Diffstat (limited to 'm4')
-rw-r--r-- | m4/cc-flags.m4 | 112 | ||||
-rw-r--r-- | m4/clang.m4 | 4 | ||||
-rw-r--r-- | m4/gssapi.m4 | 6 | ||||
-rw-r--r-- | m4/krb5-config.m4 | 13 | ||||
-rw-r--r-- | m4/krb5.m4 | 6 | ||||
-rw-r--r-- | m4/lib-depends.m4 | 6 | ||||
-rw-r--r-- | m4/lib-pathname.m4 | 6 | ||||
-rw-r--r-- | m4/remctl.m4 | 6 | ||||
-rw-r--r-- | m4/snprintf.m4 | 6 | ||||
-rw-r--r-- | m4/vamacros.m4 | 6 |
10 files changed, 151 insertions, 20 deletions
diff --git a/m4/cc-flags.m4 b/m4/cc-flags.m4 new file mode 100644 index 0000000..8a5aa8a --- /dev/null +++ b/m4/cc-flags.m4 @@ -0,0 +1,112 @@ +dnl Check whether the compiler supports particular flags. +dnl +dnl Provides RRA_PROG_CC_FLAG, which checks whether a compiler supports a +dnl given flag. If it does, the commands in the second argument are run. If +dnl not, the commands in the third argument are run. +dnl +dnl Provides RRA_PROG_CC_WARNINGS_FLAGS, which checks whether a compiler +dnl supports a large set of warning flags and sets the WARNINGS_CFLAGS +dnl substitution variable to all of the supported warning flags. (Note that +dnl this may be too aggressive for some people.) +dnl +dnl Depends on RRA_PROG_CC_CLANG. +dnl +dnl The canonical version of this file is maintained in the rra-c-util +dnl package, available at <https://www.eyrie.org/~eagle/software/rra-c-util/>. +dnl +dnl Copyright 2016-2018 Russ Allbery <eagle@eyrie.org> +dnl Copyright 2006, 2009, 2016 +dnl by Internet Systems Consortium, Inc. ("ISC") +dnl +dnl Permission to use, copy, modify, and/or distribute this software for any +dnl purpose with or without fee is hereby granted, provided that the above +dnl copyright notice and this permission notice appear in all copies. +dnl +dnl THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +dnl REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +dnl MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY +dnl SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +dnl ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +dnl IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +dnl +dnl SPDX-License-Identifier: ISC + +dnl Used to build the result cache name. +AC_DEFUN([_RRA_PROG_CC_FLAG_CACHE], +[translit([rra_cv_compiler_c_$1], [-=+], [___])]) + +dnl Check whether a given flag is supported by the complier. +AC_DEFUN([RRA_PROG_CC_FLAG], +[AC_REQUIRE([AC_PROG_CC]) + AC_MSG_CHECKING([if $CC supports $1]) + AC_CACHE_VAL([_RRA_PROG_CC_FLAG_CACHE([$1])], + [save_CFLAGS=$CFLAGS + AS_CASE([$1], + [-Wno-*], [CFLAGS="$CFLAGS `echo "$1" | sed 's/-Wno-/-W/'`"], + [*], [CFLAGS="$CFLAGS $1"]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [int foo = 0;])], + [_RRA_PROG_CC_FLAG_CACHE([$1])=yes], + [_RRA_PROG_CC_FLAG_CACHE([$1])=no]) + CFLAGS=$save_CFLAGS]) + AC_MSG_RESULT([$_RRA_PROG_CC_FLAG_CACHE([$1])]) + AS_IF([test x"$_RRA_PROG_CC_FLAG_CACHE([$1])" = xyes], [$2], [$3])]) + +dnl Determine the full set of viable warning flags for the current compiler. +dnl +dnl This is based partly on personal preference and is a fairly aggressive set +dnl of warnings. Desirable CC warnings that can't be turned on due to other +dnl problems: +dnl +dnl -Wsign-conversion Too many fiddly changes for the benefit +dnl -Wstack-protector Too many false positives from small buffers +dnl +dnl Last checked against gcc 7.2.0 (2017-12-28). -D_FORTIFY_SOURCE=2 enables +dnl warn_unused_result attribute markings on glibc functions on Linux, which +dnl catches a few more issues. Add -O2 because gcc won't find some warnings +dnl without optimization turned on. +dnl +dnl For Clang, we try to use -Weverything, but we have to disable some of the +dnl warnings: +dnl +dnl -Wcast-qual Some structs require casting away const +dnl -Wdisabled-macro-expansion Triggers on libc (sigaction.sa_handler) +dnl -Wpadded Not an actual problem +dnl -Wreserved-id-macros Autoconf sets several of these normally +dnl -Wsign-conversion Too many fiddly changes for the benefit +dnl -Wtautological-pointer-compare False positives with for loops +dnl -Wundef Conflicts with Autoconf probe results +dnl -Wunreachable-code Happens with optional compilation +dnl -Wunreachable-code-return Other compilers get confused +dnl -Wunused-macros Often used on suppressed branches +dnl -Wused-but-marked-unused Happens a lot with conditional code +dnl +dnl Sets WARNINGS_CFLAGS as a substitution variable. +AC_DEFUN([RRA_PROG_CC_WARNINGS_FLAGS], +[AC_REQUIRE([RRA_PROG_CC_CLANG]) + AS_IF([test x"$CLANG" = xyes], + [WARNINGS_CFLAGS="-Werror" + m4_foreach_w([flag], + [-Weverything -Wno-cast-qual -Wno-disabled-macro-expansion -Wno-padded + -Wno-sign-conversion -Wno-reserved-id-macro + -Wno-tautological-pointer-compare -Wno-undef -Wno-unreachable-code + -Wno-unreachable-code-return -Wno-unused-macros + -Wno-used-but-marked-unused], + [RRA_PROG_CC_FLAG(flag, + [WARNINGS_CFLAGS="${WARNINGS_CFLAGS} flag"])])], + [WARNINGS_CFLAGS="-g -O2 -D_FORTIFY_SOURCE=2 -Werror" + m4_foreach_w([flag], + [-fstrict-overflow -fstrict-aliasing -Wall -Wextra -Wformat=2 + -Wformat-overflow=2 -Wformat-signedness -Wformat-truncation=2 + -Wnull-dereference -Winit-self -Wswitch-enum -Wstrict-overflow=5 + -Wmissing-format-attribute -Walloc-zero -Wduplicated-branches + -Wduplicated-cond -Wtrampolines -Wfloat-equal + -Wdeclaration-after-statement -Wshadow -Wpointer-arith + -Wbad-function-cast -Wcast-align -Wwrite-strings -Wconversion + -Wno-sign-conversion -Wdate-time -Wjump-misses-init -Wlogical-op + -Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes + -Wmissing-declarations -Wnormalized=nfc -Wpacked -Wredundant-decls + -Wrestrict -Wnested-externs -Winline -Wvla], + [RRA_PROG_CC_FLAG(flag, + [WARNINGS_CFLAGS="${WARNINGS_CFLAGS} flag"])])]) + AC_SUBST([WARNINGS_CFLAGS])]) diff --git a/m4/clang.m4 b/m4/clang.m4 index 0659d82..c1815a5 100644 --- a/m4/clang.m4 +++ b/m4/clang.m4 @@ -3,13 +3,15 @@ dnl dnl If the current compiler is Clang, set the shell variable CLANG to yes. dnl dnl The canonical version of this file is maintained in the rra-c-util -dnl package, available at <http://www.eyrie.org/~eagle/software/rra-c-util/>. +dnl package, available at <https://www.eyrie.org/~eagle/software/rra-c-util/>. dnl dnl Copyright 2015 Russ Allbery <eagle@eyrie.org> dnl dnl This file is free software; the authors give unlimited permission to copy dnl and/or distribute it, with or without modifications, as long as this dnl notice is preserved. +dnl +dnl SPDX-License-Identifier: FSFULLR dnl Source used by RRA_PROG_CC_CLANG. AC_DEFUN([_RRA_PROG_CC_CLANG_SOURCE], [[ diff --git a/m4/gssapi.m4 b/m4/gssapi.m4 index f2ad5bb..5828b1b 100644 --- a/m4/gssapi.m4 +++ b/m4/gssapi.m4 @@ -19,15 +19,17 @@ dnl Depends on RRA_KRB5_CONFIG, RRA_ENABLE_REDUCED_DEPENDS, and dnl RRA_SET_LDFLAGS. dnl dnl The canonical version of this file is maintained in the rra-c-util -dnl package, available at <http://www.eyrie.org/~eagle/software/rra-c-util/>. +dnl package, available at <https://www.eyrie.org/~eagle/software/rra-c-util/>. dnl dnl Written by Russ Allbery <eagle@eyrie.org> -dnl Copyright 2005, 2006, 2007, 2008, 2009, 2011, 2012 +dnl Copyright 2005-2009, 2011-2012 dnl The Board of Trustees of the Leland Stanford Junior University dnl dnl This file is free software; the authors give unlimited permission to copy dnl and/or distribute it, with or without modifications, as long as this dnl notice is preserved. +dnl +dnl SPDX-License-Identifier: FSFULLR dnl Headers to include when probing for Kerberos library properties. AC_DEFUN([RRA_INCLUDES_GSSAPI], [[ diff --git a/m4/krb5-config.m4 b/m4/krb5-config.m4 index c69c4f3..bbfcdc1 100644 --- a/m4/krb5-config.m4 +++ b/m4/krb5-config.m4 @@ -8,15 +8,18 @@ dnl dnl Depends on RRA_ENABLE_REDUCED_DEPENDS. dnl dnl The canonical version of this file is maintained in the rra-c-util -dnl package, available at <http://www.eyrie.org/~eagle/software/rra-c-util/>. +dnl package, available at <https://www.eyrie.org/~eagle/software/rra-c-util/>. dnl dnl Written by Russ Allbery <eagle@eyrie.org> -dnl Copyright 2011, 2012 +dnl Copyright 2018 Russ Allbery <eagle@eyrie.org> +dnl Copyright 2011-2012 dnl The Board of Trustees of the Leland Stanford Junior University dnl dnl This file is free software; the authors give unlimited permission to copy dnl and/or distribute it, with or without modifications, as long as this dnl notice is preserved. +dnl +dnl SPDX-License-Identifier: FSFULLR dnl Check for krb5-config in the user's path and set PATH_KRB5_CONFIG. This dnl is moved into a separate macro so that it can be loaded via AC_REQUIRE, @@ -75,12 +78,12 @@ dnl argument if that option was requested and not supported. Old versions of dnl krb5-config didn't take an argument to specify the library type, but dnl always returned the flags for libkrb5. AC_DEFUN([RRA_KRB5_CONFIG], -[AC_REQUIRE([_RRA_KRB5_CONFIG_PATH]) - rra_krb5_config_$3= +[rra_krb5_config_$3= rra_krb5_config_$3[]_ok= AS_IF([test x"$1" != x && test -x "$1/bin/krb5-config"], [rra_krb5_config_$3="$1/bin/krb5-config"], - [rra_krb5_config_$3="$PATH_KRB5_CONFIG"]) + [_RRA_KRB5_CONFIG_PATH + rra_krb5_config_$3="$PATH_KRB5_CONFIG"]) AS_IF([test x"$rra_krb5_config_$3" != x && test -x "$rra_krb5_config_$3"], [AC_CACHE_CHECK([for $2 support in krb5-config], [rra_cv_lib_$3[]_config], [AS_IF(["$rra_krb5_config_$3" 2>&1 | grep $2 >/dev/null 2>&1], @@ -47,15 +47,17 @@ dnl Also provides RRA_INCLUDES_KRB5, which are the headers to include when dnl probing the Kerberos library properties. dnl dnl The canonical version of this file is maintained in the rra-c-util -dnl package, available at <http://www.eyrie.org/~eagle/software/rra-c-util/>. +dnl package, available at <https://www.eyrie.org/~eagle/software/rra-c-util/>. dnl dnl Written by Russ Allbery <eagle@eyrie.org> -dnl Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2013, 2014 +dnl Copyright 2005-2011, 2013-2014 dnl The Board of Trustees of the Leland Stanford Junior University dnl dnl This file is free software; the authors give unlimited permission to copy dnl and/or distribute it, with or without modifications, as long as this dnl notice is preserved. +dnl +dnl SPDX-License-Identifier: FSFULLR dnl Ignore Automake conditionals if not using Automake. m4_define_default([AM_CONDITIONAL], [:]) diff --git a/m4/lib-depends.m4 b/m4/lib-depends.m4 index 22d38ee..09a2cf9 100644 --- a/m4/lib-depends.m4 +++ b/m4/lib-depends.m4 @@ -10,15 +10,17 @@ dnl This macro doesn't do much but is defined separately so that other macros dnl can require it with AC_REQUIRE. dnl dnl The canonical version of this file is maintained in the rra-c-util -dnl package, available at <http://www.eyrie.org/~eagle/software/rra-c-util/>. +dnl package, available at <https://www.eyrie.org/~eagle/software/rra-c-util/>. dnl dnl Written by Russ Allbery <eagle@eyrie.org> -dnl Copyright 2005, 2006, 2007 +dnl Copyright 2005-2007 dnl The Board of Trustees of the Leland Stanford Junior University dnl dnl This file is free software; the authors give unlimited permission to copy dnl and/or distribute it, with or without modifications, as long as this dnl notice is preserved. +dnl +dnl SPDX-License-Identifier: FSFULLR AC_DEFUN([RRA_ENABLE_REDUCED_DEPENDS], [rra_reduced_depends=false diff --git a/m4/lib-pathname.m4 b/m4/lib-pathname.m4 index 828270f..46e8879 100644 --- a/m4/lib-pathname.m4 +++ b/m4/lib-pathname.m4 @@ -13,15 +13,17 @@ dnl This file also provides the Autoconf macro RRA_SET_LIBDIR, which sets the dnl libdir variable to PREFIX/lib{,32,64} as appropriate. dnl dnl The canonical version of this file is maintained in the rra-c-util -dnl package, available at <http://www.eyrie.org/~eagle/software/rra-c-util/>. +dnl package, available at <https://www.eyrie.org/~eagle/software/rra-c-util/>. dnl dnl Written by Russ Allbery <eagle@eyrie.org> -dnl Copyright 2008, 2009 +dnl Copyright 2008-2009 dnl The Board of Trustees of the Leland Stanford Junior University dnl dnl This file is free software; the authors give unlimited permission to copy dnl and/or distribute it, with or without modifications, as long as this dnl notice is preserved. +dnl +dnl SPDX-License-Identifier: FSFULLR dnl Probe for the alternate library name that we should attempt on this dnl architecture, given the size of an int, and set rra_lib_arch_name to that diff --git a/m4/remctl.m4 b/m4/remctl.m4 index c2fbf9a..292313f 100644 --- a/m4/remctl.m4 +++ b/m4/remctl.m4 @@ -23,15 +23,17 @@ dnl Depends on RRA_ENABLE_REDUCED_DEPENDS, RRA_SET_LDFLAGS, and dnl RRA_LIB_GSSAPI. dnl dnl The canonical version of this file is maintained in the rra-c-util -dnl package, available at <http://www.eyrie.org/~eagle/software/rra-c-util/>. +dnl package, available at <https://www.eyrie.org/~eagle/software/rra-c-util/>. dnl dnl Written by Russ Allbery <eagle@eyrie.org> -dnl Copyright 2008, 2009, 2011, 2013 +dnl Copyright 2008-2009, 2011, 2013 dnl The Board of Trustees of the Leland Stanford Junior University dnl dnl This file is free software; the authors give unlimited permission to copy dnl and/or distribute it, with or without modifications, as long as this dnl notice is preserved. +dnl +dnl SPDX-License-Identifier: FSFULLR dnl Save the current CPPFLAGS, LDFLAGS, and LIBS settings and switch to dnl versions that include the remctl flags. Used as a wrapper, with diff --git a/m4/snprintf.m4 b/m4/snprintf.m4 index f134ab9..e739bbf 100644 --- a/m4/snprintf.m4 +++ b/m4/snprintf.m4 @@ -10,15 +10,17 @@ dnl Provides RRA_FUNC_SNPRINTF, which adds snprintf.o to LIBOBJS unless a dnl fully working snprintf is found. dnl dnl The canonical version of this file is maintained in the rra-c-util -dnl package, available at <http://www.eyrie.org/~eagle/software/rra-c-util/>. +dnl package, available at <https://www.eyrie.org/~eagle/software/rra-c-util/>. dnl dnl Written by Russ Allbery <eagle@eyrie.org> -dnl Copyright 2006, 2008, 2009 +dnl Copyright 2006, 2008-2009 dnl The Board of Trustees of the Leland Stanford Junior University dnl dnl This file is free software; the authors give unlimited permission to copy dnl and/or distribute it, with or without modifications, as long as this dnl notice is preserved. +dnl +dnl SPDX-License-Identifier: FSFULLR dnl Source used by RRA_FUNC_SNPRINTF. AC_DEFUN([_RRA_FUNC_SNPRINTF_SOURCE], [[ diff --git a/m4/vamacros.m4 b/m4/vamacros.m4 index 62fb82d..5595b86 100644 --- a/m4/vamacros.m4 +++ b/m4/vamacros.m4 @@ -14,15 +14,17 @@ dnl dnl They set HAVE_C99_VAMACROS or HAVE_GNU_VAMACROS as appropriate. dnl dnl The canonical version of this file is maintained in the rra-c-util -dnl package, available at <http://www.eyrie.org/~eagle/software/rra-c-util/>. +dnl package, available at <https://www.eyrie.org/~eagle/software/rra-c-util/>. dnl dnl Written by Russ Allbery <eagle@eyrie.org> -dnl Copyright 2006, 2008, 2009 +dnl Copyright 2006, 2008-2009 dnl The Board of Trustees of the Leland Stanford Junior University dnl dnl This file is free software; the authors give unlimited permission to copy dnl and/or distribute it, with or without modifications, as long as this dnl notice is preserved. +dnl +dnl SPDX-License-Identifier: FSFULLR AC_DEFUN([_RRA_C_C99_VAMACROS_SOURCE], [[ #include <stdio.h> |