autoconf check for building shared library

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



During the course of attempting to develop a ruby gem C extension, I
came upon the following error trying to build a simple C library on a
FreeBSD system:

linking shared-object gdi.so
/usr/bin/ld: /home/william/lib/libWinspool.a(winspool.o): relocation R_X86_64_PC32 against `memset@@FBSD_1.0' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value

>From googling, what I *think* that what this means is that I have to
use -fPIC flag to the compiler when building the shared library using
GCC.  Presumably, -fPIC is a GCC-only flag, so if I want to maintain
portability I need to build that into my configure.ac somehow.  I have
so far been unable to discover a means to do so in autoconf.  Ideally,
I'd like a macro that would translate "I'm building shared library" to
"CFLAGS += -fPIC", or something similar if GCC is being used.  Failing
that, can I test for whether GCC is being used and add "-fPIC" to the
compile flags if it is?

I amm interested in an autoconf solution, not involving e.g., automake
or libtool.


_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
https://lists.gnu.org/mailman/listinfo/autoconf



[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux