Description: Make use of F_SETSIG conditional, linux/serial
 Fixes build on non-linux architectures
Author: Michael Tautschnig <mt@debian.org>

--- lnpd-0.9.0.orig/lnpd+liblnp/liblnp/stub.c
+++ lnpd-0.9.0/lnpd+liblnp/liblnp/stub.c
@@ -379,8 +379,11 @@ lnp_init_result lnp_init ( char *tcp_hos
     if
     (
     	fcntl(socket_fd,F_SETFL,O_ASYNC | O_NONBLOCK) ||
-    	fcntl(socket_fd,F_SETOWN,getpid()) ||
+    	fcntl(socket_fd,F_SETOWN,getpid())
+#ifdef F_SETSIG
+      ||
 	    fcntl(socket_fd,F_SETSIG,SIG_RCV)
+#endif
 	)
 	{
 		lnp_shutdown();
--- lnpd-0.9.0.orig/lnpd+liblnp/lnpd/rcxtty.c
+++ lnpd-0.9.0/lnpd+liblnp/lnpd/rcxtty.c
@@ -12,7 +12,9 @@
 #include <fcntl.h>
 #include <termios.h>
 #include <unistd.h>
+#ifdef __linux__
 #include <linux/serial.h>
+#endif
 #include <sys/ioctl.h>
 #include <stdio.h>
 #include <sys/types.h>
@@ -121,7 +123,9 @@ void tty_exit(void)
 int tty_init(int highspeed,int nolock,const char *device)
 {
 	struct termios ios;
+#ifdef __linux__
     struct serial_struct ttyinfo;
+#endif
 
     // try to create lockfile
     if ( !nolock && make_lockfile(device))
@@ -149,6 +153,7 @@ int tty_init(int highspeed,int nolock,co
   	if (tcsetattr(fd, TCSANOW, &ios) == -1)
     	error_exit("tcsetattr");
     	
+#ifdef __linux__
 	// try to set to "hard realtime mode"
     if  (ioctl(fd,TIOCGSERIAL,&ttyinfo))
     	error_exit("ioctl[TIOCGSERIAL]");
@@ -173,6 +178,7 @@ int tty_init(int highspeed,int nolock,co
 	{
 		log(LNPD_LOG_INFO,"failed to configure tty: %s",strerror(errno));
 	}
+#endif
 	
 	// we must close and reopen the tty
 	close(fd);
--- lnpd-0.9.0.orig/lnpd+liblnp/lnpd/transceiver.c
+++ lnpd-0.9.0/lnpd+liblnp/lnpd/transceiver.c
@@ -7,7 +7,9 @@
 #include <sys/types.h>
 #include <sys/ioctl.h>
 #include <termios.h>
+#ifdef __linux__
 #include <linux/serial.h>
+#endif
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -32,7 +34,9 @@ static unsigned char tx_buffer[MAX_LNP_P
 static unsigned char* tx_next;
 static unsigned char* tx_verify;
 static unsigned char* tx_end;
+#ifdef __linux__
 static struct serial_icounter_struct tty_error_info;
+#endif
 static struct timeval inter_byte_time, keep_alive_time, tx_allowed_time;
 static const unsigned char keepalive_byte = KEEP_ALIVE_BYTE;
 
@@ -94,7 +98,9 @@ static int check_expired(struct timeval
 static void rx_flush(void)
 {
     if ( tcflush(rcxfd,TCIFLUSH)) error_exit("tcflush");
+#ifdef __linux__
     if ( ioctl(rcxfd,TIOCGICOUNT,&tty_error_info)) error_exit(ioctl);
+#endif
 }
 
 // discard all characters in the output queue of tty
@@ -159,7 +165,9 @@ static int rcx_read(void)
 	int badframe, bytes_read, total_read = 0;
 	unsigned char rcv_buffer[RCV_BUFFER_SIZE];
     unsigned char *rcvd;
+#ifdef __linux__
     struct serial_icounter_struct new_error_info;
+#endif
 		
 	while (1)
 	{
@@ -171,6 +179,7 @@ static int rcx_read(void)
         // log(LNPD_LOG_DEBUG,"read %d from tty",bytes_read);
 		
 		// check for frame errors
+#ifdef __linux__
         if ( ioctl(rcxfd,TIOCGICOUNT,&new_error_info)) error_exit("ioctl");
         badframe =
             ( new_error_info.frame != tty_error_info.frame ) ||
@@ -187,6 +196,7 @@ static int rcx_read(void)
          	log(LNPD_LOG_LOGICAL,"Frame Error");
         	break;
         }
+#endif
 
 		for (rcvd = rcv_buffer; rcvd < rcv_buffer + bytes_read ; ++rcvd)
 		{
@@ -269,7 +279,9 @@ static void init_tower(int highspeed)
     // wait for IR to settle
     msleep(100);
     rx_flush();
+#ifdef __linux__
     if ( ioctl(rcxfd,TIOCGICOUNT,&tty_error_info)) error_exit("ioctl");
+#endif
 
     // check if we can read back what we sent
     write(rcxfd,&keepalive_byte,1);
