epson2-commands.c: Include <sys/types.h> to resolve u_long.
epson2.c, magicolor.c, xerox_mfp-tcp.c: Include <sys/types.h>
and to <sys/socket.h> for anyone using setsockopt().
sanei_tcp.h: Include <sys/types.h> since ssize_t is referenced.
sanei_usb.c: Newer FreeBSD version checks.
All changes in this patch set come from FreeBSD ports patches.
Bug #312503.
Not all platforms use an integer for pthread_t and so
couldn't compile on those; namely mingw.
This is least riskest version I could come up with. Backends
that do things like "SANE_Pid pid = -1" or "if (pid == -1)" will
need to switch to sanei_thread_set_invalid()
sanei_thread_is_invalid() to be able to compile on mingw.
My previous try was always defaulting to "yes" and user
and to manually specify --disable-dynamic to work correctly
on platforms that didn't support dynamic loading.
Options were in README but removed at some point. They
are useful so add them back.
Document BACKENDS and PRELOADABLE_BACKENDS variables in
README as well as in configure --help output.
dll.c is were optional preload behavior is implemented.
Since its linked in using a convienence library, we need
to libraries to have different behavior.
Add missing WSAStartup() and WSACleanup() code required
on windows to use ws2_32 library.
Also, O_NONBLOCK is tricky even on other platforms so create
a function to set that so portability logic doesn't need to be
done in every backend. Windows requires using a non standard
function to enable nonblocking mode and also doesn't support
querying current state.
Original logic was confusing the DLL creation process.
Each backend was creating a DLL of name libsane-1.dll;
overwriting each other each time. Since libsane is built
last, you could never get access to other DLL's like
you can on unix platforms.
Windows doesn't use soname concept anyways. You can copy any
libsane-*-1.dll to libsane-1.dll into same directory
as scanimage.exe and it will work as expected for that
one backend.
Current backend/Makefile.am states difference between libsane and
libsane-dll as:
> libsane.la and libsane-dll.la are the same thing except for
> the addition of backends listed by PRELOADABLE_BACKENDS that are
> statically linked in.
We were (mistakenly) linking in dll-preload.h and thus symbols
for all preload backends for both libraries but we were only
linking in those symbols for libsane.
This mistake became obvious on mingw which does not allow for
any unresolved symbols. Resolve by forcing an empty preload
backend list for libsane-dll.
Add check for winsock2.h for socket.h replancement. Also, use this
check to add ws2_32 library. Also, switch all winsock.h references
to winsock2.h.
Add check for getuid and getpass; which are not on mingw.
Add a syslog() replacement that is basically a print(). This
is also used by vsyslog() replacement.
Comment out parts of replacement sigprocmask.c on mingw.
To support these configure.in changes, I need to rebuild all
related files with autoconf 2.68 and libtool 2.4. Hand ported
our sane-backend specific changes to newer ltmain.sh.
On mingw, O_NONBLOCK is not defined. Since we were always
redefining to an invalid FNDELAY, the compile failure message
would mislead you during debugging. Its better for compile
failure to point to real issue; which is missing O_NONBLOCK.
It was about an 90/10 split with usleep/sleep. We have portablity
logic to make usleep on all platforms but not sleep. This is
needed to link tools directory under mingw.
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.