added signal/siginfo detection

git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@639 7ae35d74-ebe9-4afe-98af-79ac388436b8
Hamlib-1.1.2
Stéphane Fillod, F8CFE 2001-08-22 21:10:17 +00:00
rodzic 4d5ad486aa
commit 1c82c36aa6
2 zmienionych plików z 35 dodań i 27 usunięć

Wyświetl plik

@ -6,7 +6,7 @@ AC_CONFIG_SRCDIR([include/hamlib/rig.h])
AM_INIT_AUTOMAKE(hamlib, 1.1.2)
AM_CONFIG_HEADER(include/config.h)
AC_PREREQ(2.50)dnl dnl Minimum Autoconf version required.
AC_REVISION($Revision: 1.2 $)
AC_REVISION($Revision: 1.3 $)
dnl directory for docs (html)
hamlibdocdir=$datadir/doc/hamlib
@ -23,6 +23,8 @@ AC_PROG_GCC_TRADITIONAL
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_RANLIB
AC_PROG_AWK
AC_PROG_CXX
AC_MSG_CHECKING(if you want to build C++ binding and demo)
@ -44,8 +46,9 @@ fi
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h getopt.h)
AC_CHECK_HEADERS(sys/ioccom.h linux/ppdev.h sgtty.h term.h termio.h termios.h)
AC_CHECK_HEADERS([fcntl.h sys/ioctl.h sys/time.h unistd.h getopt.h errno.h])
AC_CHECK_HEADERS([sys/ioccom.h linux/ppdev.h sgtty.h term.h termio.h termios.h])
AC_CHECK_HEADERS([windows.h winioctl.h winbase.h])
dnl AC_HEADER_STAT
dnl Checks for typedefs, structures, and compiler characteristics.
@ -53,6 +56,8 @@ AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_HEADER_TIME
AC_TYPE_SIGNAL
AC_CHECK_TYPES([siginfo_t],[],[],[#include <signal.h>])
dnl Checks for libraries.
@ -71,7 +76,9 @@ dnl Checks for library functions.
AC_CHECK_FUNCS(atexit snprintf select strerror)
AC_CHECK_FUNCS(getopt_long,,LIBOBJS="$LIBOBJS getopt.o getopt1.o")
AC_CHECK_FUNCS(usleep,,LIBOBJS="$LIBOBJS usleep.o")
AC_FUNC_ALLOCA
AC_FUNC_MALLOC
AC_FUNC_VPRINTF
dnl initialize libtool
dnl Enable building of the convenience library

Wyświetl plik

@ -2,7 +2,7 @@
* Hamlib Interface - event handling
* Copyright (c) 2000,2001 by Stephane Fillod and Frank Singleton
*
* $Id: event.c,v 1.9 2001-07-13 19:08:15 f4cfe Exp $
* $Id: event.c,v 1.10 2001-08-22 21:10:17 f4cfe Exp $
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
@ -43,10 +43,10 @@
#include "event.h"
#if defined(_WIN32) || defined(__CYGWIN__)
static void sa_sigiohandler(int signum);
#ifdef HAVE_SIGINFO_T
static RETSIGTYPE sa_sigioaction(int signum, siginfo_t *si, void *data);
#else
static void sa_sigioaction(int signum, siginfo_t *si, void *data);
static RETSIGTYPE sa_sigiohandler(int signum);
#endif
/* This one should be in an include file */
@ -65,18 +65,18 @@ int add_trn_rig(RIG *rig)
/*
* FIXME: multiple open will register several time SIGIO hndlr
*/
#if defined(_WIN32) || defined(__CYGWIN__)
act.sa_handler = sa_sigiohandler;
#else
#ifdef HAVE_SIGINFO_T
act.sa_sigaction = sa_sigioaction;
#else
act.sa_handler = sa_sigiohandler;
#endif
sigemptyset(&act.sa_mask);
#if defined(_WIN32) || defined(__CYGWIN__)
act.sa_flags = 0;
#else
#ifdef HAVE_SIGINFO_T
act.sa_flags = SA_SIGINFO;
#else
act.sa_flags = 0;
#endif
status = sigaction(SIGIO, &act, NULL);
@ -89,8 +89,7 @@ int add_trn_rig(RIG *rig)
rig_debug(RIG_DEBUG_ERR,"rig_open fcntl SETOWN failed: %s\n",
strerror(errno));
#if defined(_WIN32) || defined(__CYGWIN__)
#else
#ifdef HAVE_SIGINFO_T
status = fcntl(rig->state.rigport.fd, F_SETSIG, SIGIO);
if (status < 0)
rig_debug(RIG_DEBUG_ERR,"rig_open fcntl SETSIG failed: %s\n",
@ -127,7 +126,8 @@ static int search_rig_and_decode(RIG *rig, rig_ptr_t data)
fd_set rfds;
struct timeval tv;
int retval;
#if 0
#if 0&&defined(HAVE_SIGINFO_T)
siginfo_t *si = (siginfo_t*)data;
if (rig->state.rigport.fd != si->si_fd)
@ -171,21 +171,22 @@ static int search_rig_and_decode(RIG *rig, rig_ptr_t data)
* check the rig is not holding SIGIO,
* then call rig->caps->decode_event() (this is done by search_rig)
*/
#if defined(_WIN32) || defined(__CYGWIN__)
static void sa_sigiohandler(int signum)
{
rig_debug(RIG_DEBUG_VERBOSE, "sa_sigiohandler: activity detected\n");
foreach_opened_rig(search_rig_and_decode, NULL);
}
#else
static void sa_sigioaction(int signum, siginfo_t *si, rig_ptr_t data)
#ifdef HAVE_SIGINFO_T
static RETSIGTYPE sa_sigioaction(int signum, siginfo_t *si, rig_ptr_t data)
{
rig_debug(RIG_DEBUG_VERBOSE, "sa_sigioaction: activity detected\n");
foreach_opened_rig(search_rig_and_decode, si);
}
#else
static RETSIGTYPE sa_sigiohandler(int signum)
{
rig_debug(RIG_DEBUG_VERBOSE, "sa_sigiohandler: activity detected\n");
foreach_opened_rig(search_rig_and_decode, NULL);
}
#endif