This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Plugin support for FreeBSD and OS X
"Nicholas \"Indy\" Ray" <arelius@gmail.com> writes:
> One more small thing, currently if it finds dl it adds -ldl to
> $pluginlibs in addition to $LIBS, is it possible to do that with the
> AC_SEARCH_LIBS macro as well?
Not directly. You would have to compare $LIBS before and after. Or
use AC_CHECK_FUNC and AC_CHECK_LIB.
Ian
> On Mon, Oct 5, 2009 at 5:28 PM, Ian Lance Taylor <iant@google.com> wrote:
>> "Nicholas \"Indy\" Ray" <arelius@gmail.com> writes:
>>
>>> That would probably work, but then the configure script won't test for
>>> dlopen functionality, which is required. maybee I should put an
>>> additional AC_TRY_LINK in the test failure? is there a better way to
>>> do that then just a wholesale duplication of the macro?
>>
>> AC_SEARCH_LIBS(dlopen, -ldl, found_dlopen=yes, found_dlopen=no)
>>
>> This will add -ldl to $LIBS if necessary (i.e., don't reset LIBS) and
>> set found_dlopen to indicate whether it was found or not.
>>
>> Ian
>>
>>> On Mon, Oct 5, 2009 at 4:22 PM, Ian Lance Taylor <iant@google.com> wrote:
>>>> "Nicholas \"Indy\" Ray" <arelius@gmail.com> writes:
>>>>
>>>>> So are you suggesting that the entire block:
>>>>>
>>>>> Â LIBS="$LIBS -ldl"
>>>>> Â AC_MSG_CHECKING([for -ldl])
>>>>> Â AC_TRY_LINK(
>>>>> Â Â [#include <dlfcn.h>],
>>>>> Â Â [volatile int f = 0; if (f) dlopen ("dummy", 0);],
>>>>> Â Â [AC_MSG_RESULT([yes]); have_dl=yes],
>>>>> Â Â [AC_MSG_RESULT([no])])
>>>>> Â if test x"$have_dl" = x"yes"; then
>>>>> Â Â pluginlibs="$pluginlibs -ldl"
>>>>> Â fi
>>>>>
>>>>> should be replaced with something based on AC_CHECK_LIB? I'll give that a test!
>>>>
>>>> I hadn't looked at that code. ÂThat all looks fine to me, although
>>>> AC_CHECK_LIB would be simpler.
>>>>
>>>> Are you saying that that does not work on FreeBSD? ÂHow does it fail?
>>>>
>>>> Wait, I think I see the problem: the code sets LIBS to include -ldl,
>>>> but fails to reset it if the test fails. ÂProbably all it needs is two
>>>> new lines:
>>>>
>>>> Â if test x"$have_dl" = x"yes"; then
>>>> Â Â pluginlibs="$pluginlibs -ldl"
>>>> + Âelse
>>>> + Â ÂLIBS="$saved_LIBS"
>>>> Â fi
>>>>
>>>> Ian
>>>>
>>>>
>>>>> On Mon, Oct 5, 2009 at 3:38 PM, Ian Lance Taylor <iant@google.com> wrote:
>>>>>> "Nicholas \"Indy\" Ray" <arelius@gmail.com> writes:
>>>>>>
>>>>>>> The problem is that on FreeBSD -ldl is not available or required, the
>>>>>>> functionality is provided by libc
>>>>>>
>>>>>> I think understand that. ÂWhat I am saying is that the configure
>>>>>> script should test for that property--the fact that -ldl is not
>>>>>> available or required--rather than test the type of host for which gcc
>>>>>> is being configured.
>>>>>>
>>>>>> Ian
>>>>>>
>>>>>>
>>>>>>> Nicholas "Indy" Ray
>>>>>>>
>>>>>>> On Mon, Oct 5, 2009 at 3:05 PM, Ian Lance Taylor <iant@google.com> wrote:
>>>>>>>> "Nicholas \"Indy\" Ray" <arelius@gmail.com> writes:
>>>>>>>>
>>>>>>>>> Indeed, I've sent in a small patch for a warning I got on FreeBSD,
>>>>>>>>> however I'm not sure how to get autoconf to check the host system,
>>>>>>>>> I'll examine other locations in the code and see if I can't cobble a
>>>>>>>>> patch together.
>>>>>>>>
>>>>>>>> When possible, a configure script should test for features, not
>>>>>>>> operating systems. ÂSo, for example, the goal would be not to check
>>>>>>>> for FreeBSD, but rather to check for the availability of -ldl, which
>>>>>>>> is typically done using AC_CHECK_LIB.
>>>>>>>>
>>>>>>>> Ian
>>>>>>>>
>>>>>>
>>>>
>>