logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git/
commit: 18f0b81fc072237e00b9303d1c23c7dd0521569e
parent d06c479d736e7d2505698c2533f580b97812c2c2
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Thu, 26 Dec 2024 08:32:18 +0100

configure*: disable cmd/join when fgetln isn't available

Diffstat:

Mconfigure5+++++
Aconfigure.d/fgetln.c19+++++++++++++++++++
2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/configure b/configure @@ -253,6 +253,11 @@ check_conftest configure.d/getopt_long.c && CFLAGS="${CFLAGS} -DHAS_GETOPT_LONG" check_conftest configure.d/syncfs.c && CFLAGS="${CFLAGS} -DHAS_SYNCFS" +if ! check_conftest configure.d/fgetln.c; then + echo 'Disabling cmd/join' + target_filter="${target_filter} -e cmd/join." +fi + rm -f configure.d/*.bin echo diff --git a/configure.d/fgetln.c b/configure.d/fgetln.c @@ -0,0 +1,19 @@ +// utils-std: Collection of commonly available Unix tools +// SPDX-FileCopyrightText: 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me> +// SPDX-License-Identifier: MPL-2.0 + +// Because that's what join uses :) +#define _BSD_SOURCE + +#include <stdio.h> + +int +main(void) +{ + FILE *stream = stdin; + size_t len = 0; + + char *out = fgetln(stream, &len); + + return out != NULL; +}