xref: /linux/tools/testing/selftests/x86/check_cc.sh (revision 34fe4ccb777e2c15a3419fa8e733114f6ce2a3c6)
1#!/bin/sh
2# SPDX-License-Identifier: GPL-2.0-only
3# check_cc.sh - Helper to test userspace compilation support
4# Copyright (c) 2015 Andrew Lutomirski
5
6CC="$1"
7TESTPROG="$2"
8shift 2
9
10if [ -n "$CC" ] && $CC -o /dev/null "$TESTPROG" -O0 "$@" 2>/dev/null; then
11    echo 1
12else
13    echo 0
14fi
15
16exit 0
17