xref: /linux/tools/testing/selftests/mm/check_config.sh (revision f13be0ad5344b46bb89323ea5576a2417c6d1e55)
1e487ebbdSDavid Hildenbrand#!/bin/sh
2e487ebbdSDavid Hildenbrand# SPDX-License-Identifier: GPL-2.0
3e487ebbdSDavid Hildenbrand#
4e487ebbdSDavid Hildenbrand# Probe for libraries and create header files to record the results. Both C
5e487ebbdSDavid Hildenbrand# header files and Makefile include fragments are created.
6e487ebbdSDavid Hildenbrand
7e487ebbdSDavid HildenbrandOUTPUT_H_FILE=local_config.h
8e487ebbdSDavid HildenbrandOUTPUT_MKFILE=local_config.mk
9e487ebbdSDavid Hildenbrand
10e487ebbdSDavid Hildenbrandtmpname=$(mktemp)
11e487ebbdSDavid Hildenbrandtmpfile_c=${tmpname}.c
12e487ebbdSDavid Hildenbrandtmpfile_o=${tmpname}.o
13e487ebbdSDavid Hildenbrand
14e487ebbdSDavid Hildenbrand# liburing
15e487ebbdSDavid Hildenbrandecho "#include <sys/types.h>"        > $tmpfile_c
16e487ebbdSDavid Hildenbrandecho "#include <liburing.h>"        >> $tmpfile_c
17e487ebbdSDavid Hildenbrandecho "int func(void) { return 0; }" >> $tmpfile_c
18e487ebbdSDavid Hildenbrand
19e487ebbdSDavid HildenbrandCC=${1:?"Usage: $0 <compiler> # example compiler: gcc"}
20e487ebbdSDavid Hildenbrand$CC -c $tmpfile_c -o $tmpfile_o >/dev/null 2>&1
21e487ebbdSDavid Hildenbrand
22e487ebbdSDavid Hildenbrandif [ -f $tmpfile_o ]; then
23e487ebbdSDavid Hildenbrand    echo "#define LOCAL_CONFIG_HAVE_LIBURING 1"  > $OUTPUT_H_FILE
24*71fc41ebSPeter Xu    echo "IOURING_EXTRA_LIBS = -luring"          > $OUTPUT_MKFILE
25e487ebbdSDavid Hildenbrandelse
26e487ebbdSDavid Hildenbrand    echo "// No liburing support found"          > $OUTPUT_H_FILE
27e487ebbdSDavid Hildenbrand    echo "# No liburing support found, so:"      > $OUTPUT_MKFILE
28*71fc41ebSPeter Xu    echo "IOURING_EXTRA_LIBS = "                >> $OUTPUT_MKFILE
29e487ebbdSDavid Hildenbrandfi
30e487ebbdSDavid Hildenbrand
31e487ebbdSDavid Hildenbrandrm ${tmpname}.*
32