mingw32 compile fixes

The following updates were made to all directories but backends.
That still needs work. There are also still some pthread issues
and syslog is missing.

 Windows doesn't support SIGHUP or SIGPIPE so make that optional.
 Only include socket header files when sys/socket.h is detected.
 Use winsock.h on windows.
 Only include syslog.h when vsyslog() was detect by configure.
 Skip FD_CLOEXEC when not supported by OS (not defined).
 Only include sys/ioctl.h on platforms that define it.
merge-requests/1/head
Chris Bagwell 2011-11-05 11:06:37 -05:00
rodzic 8f0f05225b
commit 9bdff1dbdf
12 zmienionych plików z 51 dodań i 8 usunięć

Wyświetl plik

@ -1,3 +1,12 @@
2011-11-05 Chris Bagwell <chris at cnpbagwell dot com>
* lib/vsyslog.c, frontend/scanimage.c, include/sane/sanei_tcp.h
include/sane/sanei_udp.h, lib/inet_ntop.c, lib/inet_pton.c,
sanei/sanie_init_debug.c, sanei/sanei_scsi.c, sanei/sanei_tcp.c,
sanei_udp.c, sanei_usb.c: mingw32 compile fixes. Mostly its
not including header files that windows doesn't have and
add winsock.h as needed. Also, do not use signals windows
doesn't have as well.
2011-11-02 Stéphane Voltz <stef.dev@free.fr>
* backend/genesys_*.[ch] backend/Makefile.am backend/Makefile.in:
genesys_gl841.h creation and genesys backend code cleanup

Wyświetl plik

@ -2211,9 +2211,13 @@ List of available devices:", prog_name);
if (output_format != OUTPUT_PNM)
resolution_value = get_resolution ();
#ifdef SIGHUP
signal (SIGHUP, sighandler);
signal (SIGINT, sighandler);
#endif
#ifdef SIGPIPE
signal (SIGPIPE, sighandler);
#endif
signal (SIGINT, sighandler);
signal (SIGTERM, sighandler);
if (test == 0)

Wyświetl plik

@ -20,8 +20,10 @@
#include <sane/sane.h>
#ifdef HAVE_SYS_SOCKET_H
#include <netinet/in.h>
#include <netdb.h>
#endif
extern SANE_Status sanei_tcp_open(const char *host, int port, int *fdp);
extern void sanei_tcp_close(int fd);

Wyświetl plik

@ -20,8 +20,10 @@
#include <sane/sane.h>
#ifdef HAVE_SYS_SOCKET_H
#include <netinet/in.h>
#include <netdb.h>
#endif
extern SANE_Status sanei_udp_open(const char *host, int port, int *fdp);
extern SANE_Status sanei_udp_open_broadcast(int *fdp);

Wyświetl plik

@ -4,9 +4,14 @@
#include <string.h>
#include <sys/types.h>
#ifdef WIN32
#include <winsock.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#endif
const char *

Wyświetl plik

@ -4,9 +4,14 @@
#include <string.h>
#include <sys/types.h>
#ifdef WIN32
#include <winsock.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#endif
int
inet_pton (int af, const char *src, void *dst)

Wyświetl plik

@ -1,13 +1,11 @@
#include "../include/sane/config.h"
#include "stdio.h"
#include <syslog.h>
#include <stdarg.h>
#ifndef HAVE_VSYSLOG
void
vsyslog(int priority, const char *format, va_list args)
#include <stdio.h>
#include <stdarg.h>
void vsyslog(int priority, const char *format, va_list args)
{
char buf[1024];
vsnprintf(buf, sizeof(buf), format, args);

Wyświetl plik

@ -48,7 +48,9 @@
#endif
#include <string.h>
#include <stdarg.h>
#ifdef HAVE_VSYSLOG
#include <syslog.h>
#endif
#ifdef HAVE_OS2_H
#include <sys/types.h>
#endif

Wyświetl plik

@ -56,7 +56,9 @@
#include <string.h>
#include <unistd.h>
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif
#include <sys/param.h>
#include <sys/types.h>
@ -5046,7 +5048,7 @@ sanei_scsi_cmd2 (int fd,
pkt.sptd.TimeOutValue = sane_scsicmd_timeout;
pkt.sptd.SenseInfoOffset = offsetof(struct pkt, sense);
pkt.sptd.SenseInfoOffset = (void *)pkt.sense - (void *)&pkt;
pkt.sptd.SenseInfoLength = sizeof(pkt.sense);
ret = DeviceIoControl(fd,

Wyświetl plik

@ -46,7 +46,12 @@
#include <stdlib.h>
#include <string.h>
#ifdef WIN32
#include <winsock.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#define BACKEND_NAME sanei_tcp

Wyświetl plik

@ -46,10 +46,15 @@
#include <stdlib.h>
#include <string.h>
#ifdef WIN32
#include <winsock.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
#endif
#define BACKEND_NAME sanei_udp

Wyświetl plik

@ -55,7 +55,9 @@
#include <errno.h>
#include <string.h>
#include <unistd.h>
#ifdef HAVE_SYS_IOCTL_H
#include <sys/ioctl.h>
#endif
#include <stdio.h>
#include <dirent.h>
#include <time.h>
@ -1807,6 +1809,7 @@ sanei_usb_open (SANE_String_Const devname, SANE_Int * dn)
devname, strerror (errno));
return status;
}
#ifdef FD_CLOEXEC
flag = fcntl (devices[devcount].fd, F_GETFD);
if (flag >= 0)
{
@ -1814,6 +1817,7 @@ sanei_usb_open (SANE_String_Const devname, SANE_Int * dn)
DBG (1, "sanei_usb_open: fcntl of `%s' failed: %s\n",
devname, strerror (errno));
}
#endif
}
else if (devices[devcount].method == sanei_usb_method_usbcalls)
{