[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Detecting Static/Shared builds
From: |
Monty Taylor |
Subject: |
Re: Detecting Static/Shared builds |
Date: |
Fri, 04 Sep 2009 14:35:53 -0700 |
User-agent: |
Thunderbird 2.0.0.23 (X11/20090817) |
In my builds, libtool is doing:
-fPIC -DPIC
Which would mean you should be able to do:
#ifdef PIC
or the like. From reading the libtool.m4 file, it looks like it will not
add -DPIC if you are using djgpp.
Monty
Jason Curl wrote:
> Hello,
>
> I've set up a library that can be built on Windows (mingw32 or cygwin)
> or on a Unix type OS (e.g. Linux or Solaris). I've defined a header that
> checks if the WINDOWS_H file exists and if it does, I then define things
> like LIBAPI, WINAPI, DLLEXPORT.
>
> That all works when I build a shared library.
>
> But when I build a static library that will link with the executables
> (primarily to make debugging easier), on Windows platforms I have
> problems because LIBAPI is still defined decl(dllexport) and it doesn't
> need to be.
>
> Is there anyway from the libtool system to know if the current file
> being compiled is for static or shared, maybe through a #define? I've
> skimmed through the libtool manual but not found anything terribly
> relevant except for section 5.6 (Static-only libraries).
>
> But I believe this problem can occur even if I build both, then I need
> to figure out which invocation (shared or static) and so a variable in
> configure.ac won't work either, probably something passed on the command
> line.
>
> Of course, it's only a problem on Windows (my main platform).
>
> It might be I use a compiler other than GNU (e.g. Intel, or MSVC) so I'd
> like to avoid compiler specific features, but I'll always be using
> autoconf and friends.
>
> Thanks,
> Jason.
>
>
> _______________________________________________
> http://lists.gnu.org/mailman/listinfo/libtool
>