xref: /linux/tools/testing/selftests/x86/check_cc.sh (revision b06e15ebd5bfb670f93c7f11a29b8299c1178bc6)
1e9886aceSAndy Lutomirski#!/bin/sh
2fb9e53ccSThomas Gleixner# SPDX-License-Identifier: GPL-2.0-only
3e9886aceSAndy Lutomirski# check_cc.sh - Helper to test userspace compilation support
4e9886aceSAndy Lutomirski# Copyright (c) 2015 Andrew Lutomirski
5e9886aceSAndy Lutomirski
6e9886aceSAndy LutomirskiCC="$1"
7e9886aceSAndy LutomirskiTESTPROG="$2"
8e9886aceSAndy Lutomirskishift 2
9e9886aceSAndy Lutomirski
10*b06e15ebSMuhammad Usama Anjumif [ -n "$CC" ] && $CC -o /dev/null "$TESTPROG" -O0 "$@" 2>/dev/null; then
11e9886aceSAndy Lutomirski    echo 1
12e9886aceSAndy Lutomirskielse
13e9886aceSAndy Lutomirski    echo 0
14e9886aceSAndy Lutomirskifi
15e9886aceSAndy Lutomirski
16e9886aceSAndy Lutomirskiexit 0
17