32 lines · bash
1#!/bin/sh2# SPDX-License-Identifier: GPL-2.03#4# Probe for libraries and create header files to record the results. Both C5# header files and Makefile include fragments are created.6 7OUTPUT_H_FILE=local_config.h8OUTPUT_MKFILE=local_config.mk9 10tmpname=$(mktemp)11tmpfile_c=${tmpname}.c12tmpfile_o=${tmpname}.o13 14# liburing15echo "#include <sys/types.h>" > $tmpfile_c16echo "#include <liburing.h>" >> $tmpfile_c17echo "int func(void) { return 0; }" >> $tmpfile_c18 19CC=${1:?"Usage: $0 <compiler> # example compiler: gcc"}20$CC -c $tmpfile_c -o $tmpfile_o >/dev/null 2>&121 22if [ -f $tmpfile_o ]; then23 echo "#define LOCAL_CONFIG_HAVE_LIBURING 1" > $OUTPUT_H_FILE24 echo "IOURING_EXTRA_LIBS = -luring" > $OUTPUT_MKFILE25else26 echo "// No liburing support found" > $OUTPUT_H_FILE27 echo "# No liburing support found, so:" > $OUTPUT_MKFILE28 echo "IOURING_EXTRA_LIBS = " >> $OUTPUT_MKFILE29fi30 31rm ${tmpname}.*32