I am writing a shared library using autoconf / libtool, which I want to compile for Linux and for Windows (using the mingw cross-compiler). For Linux (and possibly other platforms that support it) I need to install -fPIC. So I put it in CFLAGS in Makefile.am. But when I cross-compile it with mingw, gcc complains about the warning:
warning: -fPIC ignored for target (all code is position independent)
Therefore, obviously, this option is not needed for Windows code. This is just a warning, but I still want to get rid of it. How can i do this? Perhaps there is already a libtool / autoconf function that checks if this option is supported and only installs it when necessary, so I don’t need to do this manually in Makefile.am?
source
share