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.