libtool-patches
[Top][All Lists]
Advanced

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

Employing libtool in configure linking tests AC_SEARCH_LIBS, AC_CHECK_LI


From: Nicolai Stange
Subject: Employing libtool in configure linking tests AC_SEARCH_LIBS, AC_CHECK_LIB, AC_RUN_IFELSE...
Date: Fri, 12 Aug 2011 21:16:53 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Hi everybody,

I always wondered why one can't make use of these wonderful *.la files
in configure linking checks. This really is a drawback if you're working
a lot with static libraries in non-standard locations, but it might as
well be an issue with shared libraries outside of the standard runtime
search path on some systems (it definitely gets an issue with
AC_RUN_IFELSE)

Fortunately, there is an easy way: One can just duplicate Autoconf's
languages (as being defined by AC_LANG_DEFINE) and modify its $ac_link
to use libtool. I've written an AC macro for this: LT_LTLIZE_LANG.
Of course, using libtool from within configure, requires a
LT_OUTPUT. Because of this, LT_LTLIZE_LANG as an AC_REQUIRE on it.

Using "libtoolized" languages, it's getting as easy as this:
AC_PROG_FC
LT_LTLIZE_LANG([Fortran])
AC_LANG_PUSH([LTLIZED Fortran])
AC_SEARCH_LIBS([NF_OPEN], [netcdff netcdf],
               [NETCDFF_LIBS="$LIBS"],
               [AC_MSG_ERROR([nf_open not found])])
AC_LANG_POP

See ftp://ftp.zmaw.de/outgoing/stange/ltlize_test-0.1.tar.gz for a fully
working example.


I've seen many packages' configure failing because of dependencies being
installed into non-standard locations and maybe, distributing this
little AC-macro with libtool would make sense?
I would also write some docs if you want it.

Please note, that I'm currently in the process of signing the assignment
stuff for the Autotools. I'm not done with it yet, but this patch should
be short enough (<15 lines) so that you could do without it.

I would be glad to hear your comments on this patch.

Thank you and best,

Nicolai

Attachment: ltlize_lang.m4.gz
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]