mirror of
git://sigrok.org/libserialport
synced 2023-08-10 21:13:24 +03:00
Build: Clean up configure.ac and Makefile.am
Among other things, rename some config defines so we can take advantage of standard Autoconf macros.
This commit is contained in:
parent
ef08a6d52b
commit
f1c916ede1
19
Makefile.am
19
Makefile.am
|
@ -19,8 +19,8 @@
|
||||||
##
|
##
|
||||||
|
|
||||||
ACLOCAL_AMFLAGS = -I autostuff
|
ACLOCAL_AMFLAGS = -I autostuff
|
||||||
|
AM_LIBTOOLFLAGS = --silent
|
||||||
AM_CPPFLAGS = -I$(top_srcdir)
|
MAKEFLAGS = --no-print-directory
|
||||||
|
|
||||||
# Enable more compiler warnings.
|
# Enable more compiler warnings.
|
||||||
AM_CFLAGS = -std=c99 -Wall -Wextra -pedantic -Wmissing-prototypes -Wshadow
|
AM_CFLAGS = -std=c99 -Wall -Wextra -pedantic -Wmissing-prototypes -Wshadow
|
||||||
|
@ -41,18 +41,14 @@ if FREEBSD
|
||||||
libserialport_la_SOURCES += freebsd.c
|
libserialport_la_SOURCES += freebsd.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
libserialport_la_LIBADD = $(LIBOBJS)
|
libserialport_la_LIBADD = $(SP_LIBS)
|
||||||
if WIN32
|
|
||||||
libserialport_la_LIBADD += $(SP_LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
libserialport_la_LDFLAGS = $(SP_LIB_LDFLAGS) -no-undefined
|
libserialport_la_LDFLAGS = -version-info $(SP_LIB_VERSION) -no-undefined
|
||||||
if MACOSX
|
if MACOSX
|
||||||
libserialport_la_LDFLAGS += -framework IOKit -framework CoreFoundation
|
libserialport_la_LDFLAGS += -framework IOKit -framework CoreFoundation
|
||||||
endif
|
endif
|
||||||
|
|
||||||
library_includedir = $(includedir)
|
nodist_include_HEADERS = libserialport.h
|
||||||
library_include_HEADERS = libserialport.h
|
|
||||||
|
|
||||||
pkgconfigdir = $(libdir)/pkgconfig
|
pkgconfigdir = $(libdir)/pkgconfig
|
||||||
pkgconfig_DATA = libserialport.pc
|
pkgconfig_DATA = libserialport.pc
|
||||||
|
@ -61,11 +57,12 @@ EXTRA_DIST = Doxyfile
|
||||||
|
|
||||||
MAINTAINERCLEANFILES = ChangeLog
|
MAINTAINERCLEANFILES = ChangeLog
|
||||||
|
|
||||||
.PHONY: ChangeLog
|
.PHONY: ChangeLog doc
|
||||||
|
|
||||||
ChangeLog:
|
ChangeLog:
|
||||||
git --git-dir $(top_srcdir)/.git log > ChangeLog || touch ChangeLog
|
git --git-dir $(top_srcdir)/.git log > ChangeLog || touch ChangeLog
|
||||||
|
|
||||||
dist-hook: ChangeLog
|
dist-hook: ChangeLog
|
||||||
|
|
||||||
doc: $(library_include_HEADERS) $(top_srcdir)/Doxyfile
|
doc: $(nodist_include_HEADERS) $(top_srcdir)/Doxyfile
|
||||||
doxygen $(top_srcdir)/Doxyfile
|
doxygen $(top_srcdir)/Doxyfile
|
||||||
|
|
197
configure.ac
197
configure.ac
|
@ -29,31 +29,40 @@ m4_define([sp_package_version], [sp_package_version_major.sp_package_version_min
|
||||||
|
|
||||||
AC_INIT([libserialport], [sp_package_version], [martin-libserialport@earth.li],
|
AC_INIT([libserialport], [sp_package_version], [martin-libserialport@earth.li],
|
||||||
[libserialport], [http://sigrok.org/wiki/Libserialport])
|
[libserialport], [http://sigrok.org/wiki/Libserialport])
|
||||||
AC_CONFIG_HEADERS([config.h])
|
AC_CONFIG_HEADERS([config.h libserialport.h])
|
||||||
AC_CONFIG_MACRO_DIR([autostuff])
|
AC_CONFIG_MACRO_DIR([autostuff])
|
||||||
AC_CONFIG_AUX_DIR([autostuff])
|
AC_CONFIG_AUX_DIR([autostuff])
|
||||||
|
|
||||||
AH_TOP([#ifndef SP_CONFIG_H
|
AH_TOP([#ifndef SP_CONFIG_H
|
||||||
#define SP_CONFIG_H])
|
#define SP_CONFIG_H])
|
||||||
AH_BOTTOM([#endif])
|
|
||||||
|
AH_BOTTOM([#if HAVE_STRUCT_TERMIOS_C_ISPEED && HAVE_STRUCT_TERMIOS_C_OSPEED
|
||||||
|
# define HAVE_TERMIOS_SPEED 1
|
||||||
|
#endif
|
||||||
|
#if HAVE_STRUCT_TERMIOS2_C_ISPEED && HAVE_STRUCT_TERMIOS2_C_OSPEED
|
||||||
|
# define HAVE_TERMIOS2_SPEED 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif])
|
||||||
|
|
||||||
# We require at least automake 1.11 (needed for 'silent rules').
|
# We require at least automake 1.11 (needed for 'silent rules').
|
||||||
AM_INIT_AUTOMAKE([1.11 -Wall -Werror check-news])
|
AM_INIT_AUTOMAKE([1.11 -Wall -Werror no-define check-news])
|
||||||
m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
AM_SILENT_RULES([yes])
|
||||||
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
|
m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
|
||||||
|
|
||||||
# Checks for programs.
|
# Checks for programs.
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AC_PROG_CPP
|
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
AC_PROG_LN_S
|
AC_PROG_LN_S
|
||||||
|
|
||||||
# Initialize libtool.
|
# Initialize libtool.
|
||||||
LT_INIT
|
LT_INIT
|
||||||
|
|
||||||
# Initialize pkg-config.
|
AC_DEFINE([SP_PACKAGE_VERSION_MAJOR], [sp_package_version_major], [.])
|
||||||
# We require at least 0.22, as "Requires.private" behaviour changed there.
|
AC_DEFINE([SP_PACKAGE_VERSION_MINOR], [sp_package_version_minor], [.])
|
||||||
PKG_PROG_PKG_CONFIG([0.22])
|
AC_DEFINE([SP_PACKAGE_VERSION_MICRO], [sp_package_version_micro], [.])
|
||||||
|
AC_DEFINE([SP_PACKAGE_VERSION_STRING], ["sp_package_version"], [.])
|
||||||
|
AC_SUBST([SP_PACKAGE_VERSION], [sp_package_version])
|
||||||
|
|
||||||
# Library version for libserialport (NOT the same as the package version).
|
# Library version for libserialport (NOT the same as the package version).
|
||||||
# Carefully read the libtool docs before updating these numbers!
|
# Carefully read the libtool docs before updating these numbers!
|
||||||
|
@ -62,138 +71,80 @@ PKG_PROG_PKG_CONFIG([0.22])
|
||||||
SP_LIB_VERSION_CURRENT=0
|
SP_LIB_VERSION_CURRENT=0
|
||||||
SP_LIB_VERSION_REVISION=0
|
SP_LIB_VERSION_REVISION=0
|
||||||
SP_LIB_VERSION_AGE=0
|
SP_LIB_VERSION_AGE=0
|
||||||
SP_LIB_VERSION="$SP_LIB_VERSION_CURRENT:$SP_LIB_VERSION_REVISION:$SP_LIB_VERSION_AGE"
|
AC_SUBST([SP_LIB_VERSION],
|
||||||
SP_LIB_LDFLAGS="-version-info $SP_LIB_VERSION"
|
["$SP_LIB_VERSION_CURRENT:$SP_LIB_VERSION_REVISION:$SP_LIB_VERSION_AGE"])
|
||||||
AC_SUBST(SP_LIB_VERSION_CURRENT)
|
|
||||||
AC_SUBST(SP_LIB_VERSION_REVISION)
|
|
||||||
AC_SUBST(SP_LIB_VERSION_AGE)
|
|
||||||
AC_SUBST(SP_LIB_VERSION)
|
|
||||||
AC_SUBST(SP_LIB_LDFLAGS)
|
|
||||||
|
|
||||||
# Checks for libraries.
|
AC_DEFINE_UNQUOTED([SP_LIB_VERSION_CURRENT], [$SP_LIB_VERSION_CURRENT], [.])
|
||||||
|
AC_DEFINE_UNQUOTED([SP_LIB_VERSION_REVISION], [$SP_LIB_VERSION_REVISION], [.])
|
||||||
|
AC_DEFINE_UNQUOTED([SP_LIB_VERSION_AGE], [$SP_LIB_VERSION_AGE], [.])
|
||||||
|
AC_DEFINE_UNQUOTED([SP_LIB_VERSION_STRING], ["$SP_LIB_VERSION"], [.])
|
||||||
|
|
||||||
SP_LIBS=""
|
AM_CONDITIONAL([LINUX], [test -z "${host_os##linux*}"])
|
||||||
|
AM_CONDITIONAL([WIN32], [test -z "${host_os##mingw*}" || test -z "${host_os##cygwin*}"])
|
||||||
|
AM_CONDITIONAL([MACOSX], [test -z "${host_os##darwin*}"])
|
||||||
|
AM_CONDITIONAL([FREEBSD], [test -z "${host_os##freebsd*}"])
|
||||||
|
|
||||||
case $host_os in
|
AM_COND_IF([WIN32], [SP_LIBS='-lsetupapi'], [SP_LIBS=])
|
||||||
*linux*)
|
AC_SUBST([SP_LIBS])
|
||||||
AM_CONDITIONAL([LINUX], true)
|
|
||||||
AM_CONDITIONAL([WIN32], false)
|
|
||||||
AM_CONDITIONAL([MACOSX], false)
|
|
||||||
AM_CONDITIONAL([FREEBSD], false)
|
|
||||||
;;
|
|
||||||
*darwin*)
|
|
||||||
AM_CONDITIONAL([LINUX], false)
|
|
||||||
AM_CONDITIONAL([WIN32], false)
|
|
||||||
AM_CONDITIONAL([MACOSX], true)
|
|
||||||
AM_CONDITIONAL([FREEBSD], false)
|
|
||||||
AC_CHECK_HEADER(IOKit/IOKitLib.h, [], [AC_MSG_ERROR([IOKit/IOKitLib.h not found])])
|
|
||||||
;;
|
|
||||||
mingw* | cygwin*)
|
|
||||||
AM_CONDITIONAL([LINUX], false)
|
|
||||||
AM_CONDITIONAL([WIN32], true)
|
|
||||||
AM_CONDITIONAL([MACOSX], false)
|
|
||||||
AM_CONDITIONAL([FREEBSD], false)
|
|
||||||
SP_LIBS="-lsetupapi"
|
|
||||||
;;
|
|
||||||
*freebsd*)
|
|
||||||
AM_CONDITIONAL([LINUX], false)
|
|
||||||
AM_CONDITIONAL([WIN32], false)
|
|
||||||
AM_CONDITIONAL([MACOSX], false)
|
|
||||||
AM_CONDITIONAL([FREEBSD], true)
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
AM_CONDITIONAL([LINUX], false)
|
|
||||||
AM_CONDITIONAL([WIN32], false)
|
|
||||||
AM_CONDITIONAL([MACOSX], false)
|
|
||||||
AM_CONDITIONAL([FREEBSD], false)
|
|
||||||
AC_DEFINE(NO_ENUMERATION,,[Enumeration is unsupported])
|
|
||||||
AC_DEFINE(NO_PORT_METADATA,,[Port metadata is unavailable])
|
|
||||||
esac
|
|
||||||
|
|
||||||
AC_SUBST(SP_LIBS)
|
AM_COND_IF([MACOSX], [AC_CHECK_HEADER([IOKit/IOKitLib.h], [],
|
||||||
|
[AC_MSG_ERROR([IOKit/IOKitLib.h not found])])])
|
||||||
|
|
||||||
|
AS_CASE([$host_os], [linux*|darwin*|mingw*|cygwin*|freebsd*],, [
|
||||||
|
AC_DEFINE([NO_ENUMERATION], [1], [Enumeration is unsupported.])
|
||||||
|
AC_DEFINE([NO_PORT_METADATA], [1], [Port metadata is unavailable.])
|
||||||
|
])
|
||||||
|
|
||||||
# Define size_t if not defined as standard.
|
# Define size_t if not defined as standard.
|
||||||
AC_TYPE_SIZE_T
|
AC_TYPE_SIZE_T
|
||||||
|
|
||||||
# Check for specific termios structures.
|
# Check for specific termios structures.
|
||||||
AC_CHECK_TYPE([struct termios2],
|
AC_CHECK_TYPES([struct termios2, struct termiox],,,
|
||||||
[AC_DEFINE(HAVE_TERMIOS2, 1,
|
[[#include <linux/termios.h>]])
|
||||||
[struct termios2 is available.])],
|
AC_CHECK_MEMBERS([struct termios.c_ispeed, struct termios.c_ospeed,
|
||||||
[], [[#include <linux/termios.h>]])
|
struct termios2.c_ispeed, struct termios2.c_ospeed],,,
|
||||||
AC_CHECK_TYPE([struct termiox],
|
[[#include <linux/termios.h>]])
|
||||||
[AC_DEFINE(HAVE_TERMIOX, 1,
|
|
||||||
[struct termiox is available.])],
|
|
||||||
[], [[#include <linux/termios.h>]])
|
|
||||||
AC_CHECK_MEMBERS([struct termios.c_ispeed, struct termios.c_ospeed],
|
|
||||||
[AC_DEFINE(HAVE_TERMIOS_SPEED, 1,
|
|
||||||
[struct termios has c_ispeed/c_ospeed.])],
|
|
||||||
[], [[#include <linux/termios.h>]])
|
|
||||||
AC_CHECK_MEMBERS([struct termios2.c_ispeed, struct termios2.c_ospeed],
|
|
||||||
[AC_DEFINE(HAVE_TERMIOS2_SPEED, 1,
|
|
||||||
[struct termios2 has c_ispeed/c_ospeed.])],
|
|
||||||
[], [[#include <linux/termios.h>]])
|
|
||||||
|
|
||||||
# Check for the BOTHER definition, needed for setting arbitrary baud rates.
|
# 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
|
# 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.
|
# code using libc headers and code using kernel termios.h headers.
|
||||||
AC_MSG_CHECKING(for BOTHER)
|
AC_CHECK_DECLS([BOTHER],,, [[#include <linux/termios.h>]])
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
|
||||||
#include <linux/termios.h>
|
|
||||||
]],
|
|
||||||
[[
|
|
||||||
#ifndef BOTHER
|
|
||||||
#error BOTHER is not defined
|
|
||||||
#endif
|
|
||||||
]])],
|
|
||||||
[AC_DEFINE(HAVE_BOTHER, 1, [BOTHER macro is available])
|
|
||||||
AC_MSG_RESULT([yes])], [AC_MSG_RESULT([no])])
|
|
||||||
|
|
||||||
# Check for serial_struct.
|
# Check for serial_struct.
|
||||||
AC_CHECK_TYPE([struct serial_struct],
|
AC_CHECK_TYPES([struct serial_struct],,, [[#include <linux/serial.h>]])
|
||||||
[AC_DEFINE(HAVE_SERIAL_STRUCT, 1,
|
|
||||||
[struct serial is available.])],
|
|
||||||
[], [[#include <linux/serial.h>]])
|
|
||||||
|
|
||||||
saved="$CFLAGS"; CFLAGS="$CFLAGS -Werror"
|
AC_CACHE_CHECK([for visibility control], [sp_cv_visibility_control], [
|
||||||
AC_DEFINE(SP_API,,[Macro preceding public API functions])
|
sp_saved_CFLAGS=$CFLAGS
|
||||||
AC_DEFINE(SP_PRIV,,[Macro preceding private functions])
|
CFLAGS="$CFLAGS -Werror"
|
||||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
AC_COMPILE_IFELSE([AC_LANG_SOURCE(
|
||||||
__attribute__((visibility("hidden"))) void foo(void) { }
|
[[__attribute__((visibility("hidden"))) void foo(void) {}]])],
|
||||||
]])],
|
[sp_cv_visibility_control=attribute],
|
||||||
[AC_DEFINE(SP_API, __attribute__((visibility("default"))))]
|
[AC_COMPILE_IFELSE([AC_LANG_SOURCE(
|
||||||
[AC_DEFINE(SP_PRIV, __attribute__((visibility("hidden"))))],
|
[[__declspec(dllexport) void foo(void) {}]])],
|
||||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
[sp_cv_visibility_control=declspec],
|
||||||
__declspec(dllexport) void foo(void) { }
|
[sp_cv_visibility_control=none])])
|
||||||
]])],
|
CFLAGS=$sp_saved_CFLAGS
|
||||||
[AC_DEFINE(SP_API, __declspec(dllexport))]
|
])
|
||||||
[AC_DEFINE(SP_PRIV,)],
|
AS_CASE([$sp_cv_visibility_control],
|
||||||
[AC_DEFINE(SP_API,)]
|
[attribute], [SP_API='__attribute__((visibility("default")))'
|
||||||
[AC_DEFINE(SP_PRIV,)]))
|
SP_PRIV='__attribute__((visibility("hidden")))'],
|
||||||
CFLAGS="$saved"
|
[declspec], [SP_API='__declspec(dllexport)' SP_PRIV=],
|
||||||
|
[SP_API= SP_PRIV=])
|
||||||
|
AC_DEFINE_UNQUOTED([SP_API], [$SP_API], [Macro preceding public API functions])
|
||||||
|
AC_DEFINE_UNQUOTED([SP_PRIV], [$SP_PRIV], [Macro preceding private functions])
|
||||||
|
|
||||||
AC_SUBST(MAKEFLAGS, '--no-print-directory')
|
AC_CONFIG_FILES([Makefile libserialport.pc])
|
||||||
AC_SUBST(AM_LIBTOOLFLAGS, '--silent')
|
|
||||||
|
|
||||||
SP_PACKAGE_VERSION_MAJOR=sp_package_version_major
|
|
||||||
SP_PACKAGE_VERSION_MINOR=sp_package_version_minor
|
|
||||||
SP_PACKAGE_VERSION_MICRO=sp_package_version_micro
|
|
||||||
SP_PACKAGE_VERSION=sp_package_version
|
|
||||||
|
|
||||||
AC_SUBST(SP_PACKAGE_VERSION_MAJOR)
|
|
||||||
AC_SUBST(SP_PACKAGE_VERSION_MINOR)
|
|
||||||
AC_SUBST(SP_PACKAGE_VERSION_MICRO)
|
|
||||||
AC_SUBST(SP_PACKAGE_VERSION)
|
|
||||||
|
|
||||||
AC_CONFIG_FILES([Makefile libserialport.h libserialport.pc])
|
|
||||||
|
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|
||||||
echo
|
cat >&AS_MESSAGE_FD <<_EOF
|
||||||
echo "libserialport configuration summary:"
|
|
||||||
echo
|
libserialport configuration summary:
|
||||||
echo " - Package version (major.minor.micro): $SP_PACKAGE_VERSION"
|
|
||||||
echo " - Library version (current:revision:age): $SP_LIB_VERSION"
|
- Package version (major.minor.micro): $SP_PACKAGE_VERSION
|
||||||
echo " - Prefix: $prefix"
|
- Library version (current:revision:age): $SP_LIB_VERSION
|
||||||
echo " - Building on: $build"
|
- Prefix: $prefix
|
||||||
echo " - Building for: $host"
|
- Building on: $build
|
||||||
echo
|
- Building for: $host
|
||||||
|
|
||||||
|
_EOF
|
||||||
|
|
|
@ -1603,32 +1603,32 @@ void sp_default_debug_handler(const char *format, ...);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** The libserialport package 'major' version number. */
|
/** The libserialport package 'major' version number. */
|
||||||
#define SP_PACKAGE_VERSION_MAJOR @SP_PACKAGE_VERSION_MAJOR@
|
#undef SP_PACKAGE_VERSION_MAJOR
|
||||||
|
|
||||||
/** The libserialport package 'minor' version number. */
|
/** The libserialport package 'minor' version number. */
|
||||||
#define SP_PACKAGE_VERSION_MINOR @SP_PACKAGE_VERSION_MINOR@
|
#undef SP_PACKAGE_VERSION_MINOR
|
||||||
|
|
||||||
/** The libserialport package 'micro' version number. */
|
/** The libserialport package 'micro' version number. */
|
||||||
#define SP_PACKAGE_VERSION_MICRO @SP_PACKAGE_VERSION_MICRO@
|
#undef SP_PACKAGE_VERSION_MICRO
|
||||||
|
|
||||||
/** The libserialport package version ("major.minor.micro") as string. */
|
/** The libserialport package version ("major.minor.micro") as string. */
|
||||||
#define SP_PACKAGE_VERSION_STRING "@SP_PACKAGE_VERSION@"
|
#undef SP_PACKAGE_VERSION_STRING
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Library/libtool version macros (can be used for conditional compilation).
|
* Library/libtool version macros (can be used for conditional compilation).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** The libserialport libtool 'current' version number. */
|
/** The libserialport libtool 'current' version number. */
|
||||||
#define SP_LIB_VERSION_CURRENT @SP_LIB_VERSION_CURRENT@
|
#undef SP_LIB_VERSION_CURRENT
|
||||||
|
|
||||||
/** The libserialport libtool 'revision' version number. */
|
/** The libserialport libtool 'revision' version number. */
|
||||||
#define SP_LIB_VERSION_REVISION @SP_LIB_VERSION_REVISION@
|
#undef SP_LIB_VERSION_REVISION
|
||||||
|
|
||||||
/** The libserialport libtool 'age' version number. */
|
/** The libserialport libtool 'age' version number. */
|
||||||
#define SP_LIB_VERSION_AGE @SP_LIB_VERSION_AGE@
|
#undef SP_LIB_VERSION_AGE
|
||||||
|
|
||||||
/** The libserialport libtool version ("current:revision:age") as string. */
|
/** The libserialport libtool version ("current:revision:age") as string. */
|
||||||
#define SP_LIB_VERSION_STRING "@SP_LIB_VERSION@"
|
#undef SP_LIB_VERSION_STRING
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the major libserialport package version number.
|
* Get the major libserialport package version number.
|
||||||
|
|
|
@ -7,7 +7,7 @@ Name: libserialport
|
||||||
Description: Cross-platform serial port access library.
|
Description: Cross-platform serial port access library.
|
||||||
URL: http://sigrok.org/wiki/Libserialport
|
URL: http://sigrok.org/wiki/Libserialport
|
||||||
Requires.private:
|
Requires.private:
|
||||||
Version: @VERSION@
|
Version: @SP_PACKAGE_VERSION@
|
||||||
Libs: -L${libdir} -lserialport
|
Libs: -L${libdir} -lserialport
|
||||||
Libs.private: @SP_LIBS@
|
Libs.private: @SP_LIBS@
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#ifndef LIBSERIALPORT_LIBSERIALPORT_INTERNAL_H
|
#ifndef LIBSERIALPORT_LIBSERIALPORT_INTERNAL_H
|
||||||
#define LIBSERIALPORT_LIBSERIALPORT_INTERNAL_H
|
#define LIBSERIALPORT_LIBSERIALPORT_INTERNAL_H
|
||||||
|
|
||||||
#include "config.h"
|
#include <config.h>
|
||||||
|
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#define _BSD_SOURCE /* For timeradd, timersub, timercmp. */
|
#define _BSD_SOURCE /* For timeradd, timersub, timercmp. */
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
#include "linux_termios.h"
|
#include "linux_termios.h"
|
||||||
|
|
||||||
/* TCGETX/TCSETX is not available everywhere. */
|
/* TCGETX/TCSETX is not available everywhere. */
|
||||||
#if defined(TCGETX) && defined(TCSETX) && defined(HAVE_TERMIOX)
|
#if defined(TCGETX) && defined(TCSETX) && defined(HAVE_STRUCT_TERMIOX)
|
||||||
#define USE_TERMIOX
|
#define USE_TERMIOX
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
@ -83,7 +83,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)) && defined(HAVE_BOTHER)
|
#if (defined(HAVE_TERMIOS_SPEED) || defined(HAVE_TERMIOS2_SPEED)) && defined(HAVE_DECL_BOTHER)
|
||||||
#define USE_TERMIOS_SPEED
|
#define USE_TERMIOS_SPEED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
6
linux.c
6
linux.c
|
@ -178,7 +178,7 @@ SP_PRIV enum sp_return list_ports(struct sp_port ***list)
|
||||||
{
|
{
|
||||||
char name[PATH_MAX], target[PATH_MAX];
|
char name[PATH_MAX], target[PATH_MAX];
|
||||||
struct dirent entry, *result;
|
struct dirent entry, *result;
|
||||||
#ifdef HAVE_SERIAL_STRUCT
|
#ifdef HAVE_STRUCT_SERIAL_STRUCT
|
||||||
struct serial_struct serial_info;
|
struct serial_struct serial_info;
|
||||||
int ioctl_result;
|
int ioctl_result;
|
||||||
#endif
|
#endif
|
||||||
|
@ -218,11 +218,11 @@ SP_PRIV enum sp_return list_ports(struct sp_port ***list)
|
||||||
DEBUG("Open failed, skipping");
|
DEBUG("Open failed, skipping");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#ifdef HAVE_SERIAL_STRUCT
|
#ifdef HAVE_STRUCT_SERIAL_STRUCT
|
||||||
ioctl_result = ioctl(fd, TIOCGSERIAL, &serial_info);
|
ioctl_result = ioctl(fd, TIOCGSERIAL, &serial_info);
|
||||||
#endif
|
#endif
|
||||||
close(fd);
|
close(fd);
|
||||||
#ifdef HAVE_SERIAL_STRUCT
|
#ifdef HAVE_STRUCT_SERIAL_STRUCT
|
||||||
if (ioctl_result != 0) {
|
if (ioctl_result != 0) {
|
||||||
DEBUG("ioctl failed, skipping");
|
DEBUG("ioctl failed, skipping");
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
|
|
||||||
SP_PRIV unsigned long get_termios_get_ioctl(void)
|
SP_PRIV unsigned long get_termios_get_ioctl(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_TERMIOS2
|
#ifdef HAVE_STRUCT_TERMIOS2
|
||||||
return TCGETS2;
|
return TCGETS2;
|
||||||
#else
|
#else
|
||||||
return TCGETS;
|
return TCGETS;
|
||||||
|
@ -48,7 +48,7 @@ SP_PRIV unsigned long get_termios_get_ioctl(void)
|
||||||
|
|
||||||
SP_PRIV unsigned long get_termios_set_ioctl(void)
|
SP_PRIV unsigned long get_termios_set_ioctl(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_TERMIOS2
|
#ifdef HAVE_STRUCT_TERMIOS2
|
||||||
return TCSETS2;
|
return TCSETS2;
|
||||||
#else
|
#else
|
||||||
return TCSETS;
|
return TCSETS;
|
||||||
|
@ -57,17 +57,17 @@ SP_PRIV unsigned long get_termios_set_ioctl(void)
|
||||||
|
|
||||||
SP_PRIV size_t get_termios_size(void)
|
SP_PRIV size_t get_termios_size(void)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_TERMIOS2
|
#ifdef HAVE_STRUCT_TERMIOS2
|
||||||
return sizeof(struct termios2);
|
return sizeof(struct termios2);
|
||||||
#else
|
#else
|
||||||
return sizeof(struct termios);
|
return sizeof(struct termios);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (defined(HAVE_TERMIOS_SPEED) || defined(HAVE_TERMIOS2_SPEED)) && defined(HAVE_BOTHER)
|
#if (defined(HAVE_TERMIOS_SPEED) || defined(HAVE_TERMIOS2_SPEED)) && defined(HAVE_DECL_BOTHER)
|
||||||
SP_PRIV int get_termios_speed(void *data)
|
SP_PRIV int get_termios_speed(void *data)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_TERMIOS2
|
#ifdef HAVE_STRUCT_TERMIOS2
|
||||||
struct termios2 *term = (struct termios2 *) data;
|
struct termios2 *term = (struct termios2 *) data;
|
||||||
#else
|
#else
|
||||||
struct termios *term = (struct termios *) data;
|
struct termios *term = (struct termios *) data;
|
||||||
|
@ -80,7 +80,7 @@ SP_PRIV int get_termios_speed(void *data)
|
||||||
|
|
||||||
SP_PRIV void set_termios_speed(void *data, int speed)
|
SP_PRIV void set_termios_speed(void *data, int speed)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_TERMIOS2
|
#ifdef HAVE_STRUCT_TERMIOS2
|
||||||
struct termios2 *term = (struct termios2 *) data;
|
struct termios2 *term = (struct termios2 *) data;
|
||||||
#else
|
#else
|
||||||
struct termios *term = (struct termios *) data;
|
struct termios *term = (struct termios *) data;
|
||||||
|
@ -91,7 +91,7 @@ SP_PRIV void set_termios_speed(void *data, int speed)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_TERMIOX
|
#ifdef HAVE_STRUCT_TERMIOX
|
||||||
SP_PRIV size_t get_termiox_size(void)
|
SP_PRIV size_t get_termiox_size(void)
|
||||||
{
|
{
|
||||||
return sizeof(struct termiox);
|
return sizeof(struct termiox);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user