Hi Iain,
> one of the three remaining libitm issues for Darwin is to supply the dummy
> funcs fro the weakrefs (as Rainer has done for Tru64) for the versions of
> Darwin that need them.
>
> Since we now have the situation where there are several targets which might
> need dummy functions for the weak declarations, it seemed worth trying to
> auto-foo this.
>
> .. the attached works for me on Darwin9 (weakref doesn't work like elf***)
> and Darwin10+XCode3.2.5 (weakref works like elf)
>
> I hope it also works for Rainer .... and that I've got the right designator
> for the Tru64 cross-case.
I guess it does, given that the testcase is based on my own one :-)
A few comments:
* Move the macro definition to toplevel config/weakref.m4 (or
weakdef.m4, I'm not sure about the terminology), omitting the libitm
reference. libgfortran already uses something similar (although
partially hardcoded), we should share the code (not now, but in the
future).
* Omit the _working_ everywhere, we don't care for non-working
variants.
> Index: libitm/acinclude.m4
> ===================================================================
> --- libitm/acinclude.m4 (revision 181470)
> +++ libitm/acinclude.m4 (working copy)
> @@ -109,6 +109,29 @@ i[[34567]]86 | x86_64)
> ;;
> esac])
>
> +dnl Check whether weak refs actually work.
> +AC_DEFUN([LIBITM_CHECK_WORKING_WEAKREF], [
> + AC_CACHE_CHECK([whether weak refs actually work],
> + libitm_cv_have_working_weakref, [
> + AC_RUN_IFELSE([AC_LANG_SOURCE([[
> +extern void fNotToBeFoundInAnyStandardLib(void) __attribute__((weak));
> +int main ()
> +{
> + if (fNotToBeFoundInAnyStandardLib)
> + return 0;
> + else
> + return 1;
> +}
Just a nit: shorten function name to keep it readable.
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University