complex configure tests involving multiple files and possibly libtool/automake

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

complex configure tests involving multiple files and possibly libtool/automake

Václav Haisman-2
Hi.

I have a test that I would like to run during configure time which
basically involves compiling two files and linking a shared object/DLL
out of them. I think I would like to be using automake/libtool to
compile and link the configure test itself. Is there a good practice
or good example on how to do this?

Before you comment, no, simple single file compile and link will not
do. This is in attempt to detect issue on Cygwin with C++11
`thread_local`. See
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64697#.

--
VH

_______________________________________________
Autoconf mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/autoconf
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: complex configure tests involving multiple files and possibly libtool/automake

Eric Blake-3
On 01/26/2017 02:35 AM, Václav Haisman wrote:
> Hi.
>
> I have a test that I would like to run during configure time which
> basically involves compiling two files and linking a shared object/DLL
> out of them. I think I would like to be using automake/libtool to
> compile and link the configure test itself. Is there a good practice
> or good example on how to do this?

I'm not directly aware of a way to do it, but you CAN use AC_TRY_COMPILE
and then in the 'action-if-true' branch you can copy conftest.o to a
safe location, then try and figure out how to make the subsequent
AC_TRY_LINK refer back to the .o file that you squirreled away.  You'll
have to experiment if you can't find an actual example, and if you get
it working, be sure to post back to the list, but I hope that gives you
some hints of things to try.

>
> Before you comment, no, simple single file compile and link will not
> do. This is in attempt to detect issue on Cygwin with C++11
> `thread_local`. See
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64697#.
>

--
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


_______________________________________________
Autoconf mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/autoconf

signature.asc (617 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: complex configure tests involving multiple files and possibly libtool/automake

Eric Blake-3
On 01/26/2017 03:42 PM, Eric Blake wrote:
>
> I'm not directly aware of a way to do it, but you CAN use AC_TRY_COMPILE
> and then in the 'action-if-true' branch you can copy conftest.o to a
> safe location, then try and figure out how to make the subsequent
> AC_TRY_LINK refer back to the .o file that you squirreled away.  You'll
> have to experiment if you can't find an actual example, and if you get
> it working, be sure to post back to the list, but I hope that gives you
> some hints of things to try.

Correction - use the modern macros instead. In fact, AC_COMPILE_IFELSE
already documents that you can access conftest.$OBJEXT in the
action-if-true block, so it is a supported interface:

https://www.gnu.org/software/autoconf/manual/autoconf.html#Running-the-Compiler

--
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


_______________________________________________
Autoconf mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/autoconf

signature.asc (617 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: complex configure tests involving multiple files and possibly libtool/automake

Peter Johansson-6
In reply to this post by Eric Blake-3


On 01/27/2017 07:42 AM, Eric Blake wrote:
> On 01/26/2017 02:35 AM, Václav Haisman wrote:
>> Hi.
>>
>> I have a test that I would like to run during configure time which
>> basically involves compiling two files and linking a shared object/DLL
>> out of them. I think I would like to be using automake/libtool to

These macros use libtool to link in configure tests. There might be some
cherries to steal:

http://dev.thep.lu.se/yat/svn/trunk/m4/yat_lt_link_ifelse.m4

Cheers,
Peter

_______________________________________________
Autoconf mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/autoconf
Loading...