1From 30c712c5f14306460c44bea70e24419db9d44f8c Mon Sep 17 00:00:00 2001 2From: Nick Patavalis <npat@efault.net> 3Date: Thu, 12 Apr 2018 15:16:04 +0300 4Subject: [PATCH] Compile with libc's without cispeed / cospeed 5 6Some libc implementations (e.g. musl) do not define the cispeed and 7cospeed struct termios fields. So we have to check the 8_HAVE_STRUCT_TERMIOS_C_ISPEED and _HAVE_STRUCT_TERMIOS_C_OSPEED 9macros. If not defined, we disable custom baudrate support. 10 11[baruch: backported from upstream master to 3.1] 12Signed-off-by: Baruch Siach <baruch@tkos.co.il> 13--- 14Upstream status: commit 1acf1ddabaf3 15 16 custbaud.h | 10 +++++++++- 17 1 file changed, 9 insertions(+), 1 deletion(-) 18 19diff --git a/custbaud.h b/custbaud.h 20index 48151a4a4e84..ae4ae8daf49e 100644 21--- a/custbaud.h 22+++ b/custbaud.h 23@@ -26,6 +26,8 @@ 24 #ifndef CUSTBAUD_H 25 #define CUSTBAUD_H 26 27+#include <termios.h> 28+ 29 #ifndef NO_CUSTOM_BAUD 30 31 #if defined (__linux__) 32@@ -33,7 +35,13 @@ 33 /* Enable by-default for kernels > 2.6.0 on x86 and x86_64 only */ 34 #include <linux/version.h> 35 #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0) 36-#if defined (__i386__) || defined (__x86_64__) || defined (USE_CUSTOM_BAUD) 37+/* Some libc implementations (e.g. musl) do not define the cispeed and 38+ cospeed struct termios fields. We do not support custom baudrates 39+ on them. */ 40+#if ( (defined (__i386__) || defined (__x86_64__)) \ 41+ && defined (_HAVE_STRUCT_TERMIOS_C_ISPEED) \ 42+ && defined (_HAVE_STRUCT_TERMIOS_C_OSPEED) ) \ 43+ || defined (USE_CUSTOM_BAUD) 44 #ifndef USE_CUSTOM_BAUD 45 #define USE_CUSTOM_BAUD 46 #endif 47-- 482.16.3 49 50