#!/bin/sh set -eu base="${TMPDIR-/tmp}/mcpu-cpp-system-lang-$$" mkdir -p "$base/system/diff" "$base/system/as" trap 'rm -rf "$base"' EXIT HUP INT TERM cat > "$base/test.conf" < "$base/system/common.h" <<'EOT' common_system_header EOT cat > "$base/system/diff/lang.h" <<'EOT' diff_system_header EOT cat > "$base/system/as/lang.h" <<'EOT' as_system_header EOT cat > "$base/system/diff/explicit.h" <<'EOT' explicit_diff_system_header EOT cat > "$base/main.c" <<'EOT' #include #lang "diff" #include #endlang #lang "as" #include #include #endlang EOT "$MCPU_CPP" --config-file "$base/test.conf" "$base/main.c" -o "$base/out" grep '^common_system_header$' "$base/out" >/dev/null grep '^diff_system_header$' "$base/out" >/dev/null grep '^as_system_header$' "$base/out" >/dev/null grep '^explicit_diff_system_header$' "$base/out" >/dev/null if "$MCPU_CPP" --config-file "$base/test.conf" -nostdinc "$base/main.c" -o "$base/no" 2>/dev/null; then exit 1 fi