1
0
mirror of git://sigrok.org/libserialport synced 2023-08-10 21:13:24 +03:00

linux: Check for BOTHER macro at configure time.

This fixes bug #363.
This commit is contained in:
Martin Ling 2014-09-24 20:04:39 +01:00 committed by Uwe Hermann
parent ad7498553c
commit 59182fbbbf
3 changed files with 17 additions and 2 deletions

View File

@ -119,6 +119,21 @@ AC_CHECK_MEMBERS([struct termios.c_ispeed, struct termios.c_ospeed],
AC_CHECK_MEMBERS([struct termios2.c_ispeed, struct termios2.c_ospeed], AC_CHECK_MEMBERS([struct termios2.c_ispeed, struct termios2.c_ospeed],
[AC_DEFINE(HAVE_TERMIOS2_SPEED, 1)], [], [[#include <linux/termios.h>]]) [AC_DEFINE(HAVE_TERMIOS2_SPEED, 1)], [], [[#include <linux/termios.h>]])
# Check for the BOTHER definition, needed for setting arbitrary baud rates.
# We can't just #ifdef BOTHER in the code, because of the separation between
# code using libc headers and code using kernel termios.h headers.
AC_MSG_CHECKING(for BOTHER)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <linux/termios.h>
]],
[[
#ifndef BOTHER
#error BOTHER is not defined
#endif
]])],
[AC_DEFINE(HAVE_BOTHER, 1)
AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])])
# Check for serial_struct. # Check for serial_struct.
AC_CHECK_TYPE([struct serial_struct], [AC_DEFINE(HAVE_SERIAL_STRUCT, 1)], AC_CHECK_TYPE([struct serial_struct], [AC_DEFINE(HAVE_SERIAL_STRUCT, 1)],
[], [[#include <linux/serial.h>]]) [], [[#include <linux/serial.h>]])

View File

@ -78,7 +78,7 @@
#endif #endif
/* Non-standard baudrates are not available everywhere. */ /* Non-standard baudrates are not available everywhere. */
#if defined(HAVE_TERMIOS_SPEED) || defined(HAVE_TERMIOS2_SPEED) #if (defined(HAVE_TERMIOS_SPEED) || defined(HAVE_TERMIOS2_SPEED)) && defined(HAVE_BOTHER)
#define USE_TERMIOS_SPEED #define USE_TERMIOS_SPEED
#endif #endif

View File

@ -64,7 +64,7 @@ SP_PRIV size_t get_termios_size(void)
#endif #endif
} }
#if defined(HAVE_TERMIOS_SPEED) || defined(HAVE_TERMIOS2_SPEED) #if (defined(HAVE_TERMIOS_SPEED) || defined(HAVE_TERMIOS2_SPEED)) && defined(HAVE_BOTHER)
SP_PRIV int get_termios_speed(void *data) SP_PRIV int get_termios_speed(void *data)
{ {
#ifdef HAVE_TERMIOS2 #ifdef HAVE_TERMIOS2