kopia lustrzana https://github.com/Hamlib/Hamlib
do not make rigctld conditional anoymore, check for winsock2 so rigctld can compile on mingw32
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2358 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.2.8
rodzic
35e2e248c7
commit
b58bd02ef3
13
configure.ac
13
configure.ac
|
@ -72,19 +72,16 @@ AC_CHECK_HEADERS([fcntl.h sys/ioctl.h sys/time.h sys/param.h unistd.h getopt.h e
|
|||
AC_CHECK_HEADERS([sys/ioccom.h sgtty.h term.h termio.h termios.h])
|
||||
AC_CHECK_HEADERS([linux/ppdev.h linux/parport.h linux/ioctl.h])
|
||||
AC_CHECK_HEADERS([dev/ppbus/ppi.h dev/ppbus/ppbconf.h])
|
||||
AC_CHECK_HEADERS([sys/socket.h netinet/in.h arpa/inet.h ws2tcpip.h])
|
||||
|
||||
dnl Check for Mingw support
|
||||
GR_PWIN32
|
||||
|
||||
dnl Check whether to compile rigctld (requires pthread)
|
||||
RIGCTLD=""
|
||||
ACX_PTHREAD([ RIGCTLD="rigctld" ])
|
||||
ACX_PTHREAD
|
||||
if test x"$acx_pthread_ok" = xyes; then
|
||||
CFLAGS="${CFLAGS} ${PTHREAD_CFLAGS}"
|
||||
CXXFLAGS="${CFLAGS} ${PTHREAD_CFLAGS}"
|
||||
fi
|
||||
AC_MSG_CHECKING(whether to build rigctld)
|
||||
AC_MSG_RESULT($acx_pthread_ok)
|
||||
|
||||
AC_SYS_POSIX_TERMIOS()
|
||||
|
||||
|
@ -141,7 +138,10 @@ if test "$hl_checkBoth" = 1; then
|
|||
AC_CHECK_FUNC(accept, hl_checkNsl=0, [LIBS=$hl2_oldLibs])
|
||||
fi
|
||||
AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(nsl, main,
|
||||
[NET_LIBS="$NET_LIBS -lnsl"], [], []))
|
||||
[NET_LIBS="$NET_LIBS -lnsl"], [], []))
|
||||
# Winsock2
|
||||
AC_CHECK_FUNC(gethostbyname, , AC_CHECK_LIB(ws2_32, main,
|
||||
[NET_LIBS="$NET_LIBS -lws2_32"], [], []))
|
||||
LIBS=$hl_oldLibs
|
||||
AC_SUBST(NET_LIBS)
|
||||
AC_SUBST(MATH_LIBS)
|
||||
|
@ -469,7 +469,6 @@ AC_SUBST(BINDING_UNINSTALL)
|
|||
AC_SUBST(BINDING_LIST)
|
||||
AC_SUBST(BINDING_LIB_TARGETS)
|
||||
|
||||
AC_SUBST(RIGCTLD)
|
||||
AC_SUBST(INCLUDES)
|
||||
|
||||
AC_CONFIG_FILES([Makefile
|
||||
|
|
|
@ -4,7 +4,7 @@ DEJATOOL = testfreq testbcd testloc rigctl
|
|||
|
||||
DISTCLEANFILES = rigctl.log rigctl.sum testbcd.log testbcd.sum
|
||||
|
||||
bin_PROGRAMS = rigctl rigmem rigswr rigsmtr rotctl @RIGCTLD@
|
||||
bin_PROGRAMS = rigctl rigmem rigswr rigsmtr rotctl rigctld
|
||||
man_MANS = rigctl.1 rigmem.1 rigswr.1 rigsmtr.1 rotctl.1 rigctld.8
|
||||
|
||||
check_PROGRAMS = dumpmem testrig testtrn testbcd testfreq listrigs \
|
||||
|
@ -36,7 +36,7 @@ rigswr_LDFLAGS = @BACKENDLNK@
|
|||
rigsmtr_LDFLAGS = @BACKENDLNK@
|
||||
rigmem_LDFLAGS = @BACKENDLNK@ @XML_LIBS@
|
||||
rotctl_LDFLAGS = @ROT_BACKENDLNK@
|
||||
rigctld_LDFLAGS = @BACKENDLNK@ @PTHREAD_LIBS@
|
||||
rigctld_LDFLAGS = @BACKENDLNK@ @PTHREAD_LIBS@ @NET_LIBS@
|
||||
|
||||
# temporary hack
|
||||
testbcd_LDFLAGS = -dlpreopen self
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* This program test/control a radio using Hamlib.
|
||||
* It takes commands from network connection.
|
||||
*
|
||||
* $Id: rigctld.c,v 1.4 2008-01-12 00:36:58 n0nb Exp $
|
||||
* $Id: rigctld.c,v 1.5 2008-05-08 16:21:33 fillods Exp $
|
||||
*
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -37,11 +37,22 @@
|
|||
#include <getopt.h>
|
||||
|
||||
#include <sys/types.h> /* See NOTES */
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#ifdef HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
#ifdef HAVE_ARPA_INET_H
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#elif HAVE_WS2TCPIP_H
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_PTHREAD
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
#include <hamlib/rig.h>
|
||||
#include "misc.h"
|
||||
|
@ -353,7 +364,9 @@ int main (int argc, char *argv[])
|
|||
* main loop accepting connections
|
||||
*/
|
||||
do {
|
||||
#ifdef HAVE_PTHREAD
|
||||
pthread_t thread;
|
||||
#endif
|
||||
struct handle_data *arg;
|
||||
|
||||
arg = malloc(sizeof(struct handle_data));
|
||||
|
@ -375,11 +388,15 @@ int main (int argc, char *argv[])
|
|||
inet_ntoa(arg->cli_addr.sin_addr),
|
||||
ntohs(arg->cli_addr.sin_port));
|
||||
|
||||
#ifdef HAVE_PTHREAD
|
||||
retcode = pthread_create(&thread, NULL, handle_socket, arg);
|
||||
if (retcode < 0) {
|
||||
rig_debug(RIG_DEBUG_ERR, "pthread_create: %s\n", strerror(retcode));
|
||||
break;
|
||||
}
|
||||
#else
|
||||
handle_socket(arg);
|
||||
#endif
|
||||
}
|
||||
while (retcode == 0);
|
||||
|
||||
|
@ -404,14 +421,18 @@ void * handle_socket(void *arg)
|
|||
if (!fsockin) {
|
||||
rig_debug(RIG_DEBUG_ERR, "fdopen in: %s\n", strerror(errno));
|
||||
free(arg);
|
||||
#ifdef HAVE_PTHREAD
|
||||
pthread_exit(NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
fsockout = fdopen(handle_data_arg->sock, "wb");
|
||||
if (!fsockout) {
|
||||
rig_debug(RIG_DEBUG_ERR, "fdopen out: %s\n", strerror(errno));
|
||||
free(arg);
|
||||
#ifdef HAVE_PTHREAD
|
||||
pthread_exit(NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
do {
|
||||
|
|
Ładowanie…
Reference in New Issue