
Oliver.Kowalke@qimonda.com wrote:
It's quite reasonable to build things on operating system X version N and have it run on operating system Y version M. Compiler running on Linux and producing binaries for Windows is a common beast.
I think this is not true:
I've used such a cross-compiler personally. It works and the produced binaries run on Windows.
UNIX : socket(). WIN: WSASocket()
And? When you're building for mingw using Linux-hosted compiler, the set of header files and functions and preprocessor defines is the same as if you was running Windows-hosted compiler.
You have to insert your own preprocessor defines - which could be handled better with autoconf. It evaluates if the requested feature is available and produces the output. See my example with strerror/strerror_r in my previous mail.
(without autoconf)
#if defined (LINUX || Solaris_10) strerror_r #elif defined (Solaris_28 || HP/UX_11) strerror #else ...
(autoconf - version)
#ifdef HAS_STRERROR_R strerror_r #else strerror #endif
The latter, of course, is somewhat better, but that's not what I'm saying. I'm saying that if you have write conditional logic for target = build case, and you have a cross-compiler, then things will just work. Autoconf might be a help for writing the conditionals, but it's completely independent from handling target != build case. - Volodya