From be68d790b6bc7dd84982fa6760f1448e92849e63 Mon Sep 17 00:00:00 2001
From: Luis Campos <luisc@jfrog.com>
Date: Thu, 13 Jul 2023 12:29:18 +0100
Subject: [PATCH] config.sub: Add Apple tvOS and watchOS

These are distinct from "ios". They are also technically Darwin, so while
something like "aarch64-apple-darwin" could be used when targeting these,
on Apple-silicon based systems there could be cases where `--host` and
`--build` have the same value, and a ./configure script may determine that
we are not cross building, causing it to try to execute test programs for
the target OS that will not run on macOS.

These are functionally equivalent to iOS, and targets with "-tvos" and
"-watchos" are already used by clang.

* config.sub (tvos*, watchos*): Recognize.
* testsuite/config-sub.data (arm64-apple-tvos, arm64-apple-tvos10.0.0,
arm64-apple-watchos, arm64-apple-watchos5.0): New tests.
* doc/config.sub.1: Regenerate.
---
 config.sub                | 4 ++--
 doc/config.sub.1          | 2 +-
 testsuite/config-sub.data | 4 ++++
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/config.sub b/config.sub
index f28eb2f..6323fdb 100755
--- a/config.sub
+++ b/config.sub
@@ -4,7 +4,7 @@
 
 # shellcheck disable=SC2006,SC2268 # see below for rationale
 
-timestamp='2023-07-04'
+timestamp='2023-07-13'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -1733,7 +1733,7 @@ case $os in
 	     | hpux* | unos* | osf* | luna* | dgux* | auroraux* | solaris* \
 	     | sym* |  plan9* | psp* | sim* | xray* | os68k* | v88r* \
 	     | hiux* | abug | nacl* | netware* | windows* \
-	     | os9* | macos* | osx* | ios* \
+	     | os9* | macos* | osx* | ios* | tvos* | watchos* \
 	     | mpw* | magic* | mmixware* | mon960* | lnews* \
 	     | amigaos* | amigados* | msdos* | newsos* | unicos* | aof* \
 	     | aos* | aros* | cloudabi* | sortix* | twizzler* \
diff --git a/doc/config.sub.1 b/doc/config.sub.1
index bad6b39..bacca25 100644
--- a/doc/config.sub.1
+++ b/doc/config.sub.1
@@ -1,5 +1,5 @@
 .\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.48.5.
-.TH CONFIG.SUB "1" "July 2023" "GNU config.sub (2023-07-04)" "User Commands"
+.TH CONFIG.SUB "1" "July 2023" "GNU config.sub (2023-07-13)" "User Commands"
 .SH NAME
 config.sub \- validate and canonicalize a configuration triplet
 .SH SYNOPSIS
diff --git a/testsuite/config-sub.data b/testsuite/config-sub.data
index 2bacb05..3c39d6c 100644
--- a/testsuite/config-sub.data
+++ b/testsuite/config-sub.data
@@ -98,6 +98,10 @@ arm-unknown-riscos				arm-unknown-riscos
 arm-zephyr					arm-unknown-zephyr
 arm64-apple-darwin20.0.0			aarch64-apple-darwin20.0.0
 arm64-apple-ios					aarch64-apple-ios
+arm64-apple-tvos				aarch64-apple-tvos
+arm64-apple-tvos10.0.0				aarch64-apple-tvos10.0.0
+arm64-apple-watchos				aarch64-apple-watchos
+arm64-apple-watchos5.0				aarch64-apple-watchos5.0
 armbe						armbe-unknown-none
 armeb-unknown-netbsdelf7.0			armeb-unknown-netbsdelf7.0
 armel						armel-unknown-none