logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git
commit: 9ed44af08a2e230c4a88f291206098f8e9aac3cc
parent 02bea55023e6f26d5c6eb7cf167a28e49528e92e
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Thu, 29 Aug 2024 00:30:41 +0200

configure: Add -Wwrite-strings to CFLAGS when supported

Diffstat:

Mconfigure11+++++++++++
Aconfigure.d/cflag_test.c7+++++++
2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/configure b/configure @@ -104,6 +104,15 @@ check_conftest() { rm "${conftest}.bin" } +check_cflag() { + printf "checking whether compiler accepts %s... " "$@" + + ${CC} ${CFLAGS} "$@" -c -o "configure.d/cflag_test.bin" "configure.d/cflag_test.c" 2>&1 + is_ok + + rm "configure.d/cflag_test.bin" +} + set -o pipefail ## User configuration @@ -198,6 +207,8 @@ fi echo +check_cflag -Wwrite-strings && CFLAGS="${CFLAGS} -Wwrite-strings" + if ! check_header mntent.h; then echo 'Disabling cmd/df' target_filter="${target_filter} -e cmd/df" diff --git a/configure.d/cflag_test.c b/configure.d/cflag_test.c @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me> +// SPDX-License-Identifier: 0BSD +int +foo(int c) +{ + return c; +}