cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

check_config.sh (967B)


      1#!/bin/sh
      2# SPDX-License-Identifier: GPL-2.0
      3#
      4# Probe for libraries and create header files to record the results. Both C
      5# header files and Makefile include fragments are created.
      6
      7OUTPUT_H_FILE=local_config.h
      8OUTPUT_MKFILE=local_config.mk
      9
     10# libhugetlbfs
     11tmpname=$(mktemp)
     12tmpfile_c=${tmpname}.c
     13tmpfile_o=${tmpname}.o
     14
     15echo "#include <sys/types.h>"        > $tmpfile_c
     16echo "#include <hugetlbfs.h>"       >> $tmpfile_c
     17echo "int func(void) { return 0; }" >> $tmpfile_c
     18
     19CC=${1:?"Usage: $0 <compiler> # example compiler: gcc"}
     20$CC -c $tmpfile_c -o $tmpfile_o >/dev/null 2>&1
     21
     22if [ -f $tmpfile_o ]; then
     23    echo "#define LOCAL_CONFIG_HAVE_LIBHUGETLBFS 1" > $OUTPUT_H_FILE
     24    echo "HMM_EXTRA_LIBS = -lhugetlbfs"             > $OUTPUT_MKFILE
     25else
     26    echo "// No libhugetlbfs support found"      > $OUTPUT_H_FILE
     27    echo "# No libhugetlbfs support found, so:"  > $OUTPUT_MKFILE
     28    echo "HMM_EXTRA_LIBS = "                    >> $OUTPUT_MKFILE
     29fi
     30
     31rm ${tmpname}.*