When libgcrypt is compiled using clang, the linking fails because of multiple
definitions of libmpi functions:
/usr/bin/x86_64-pc-linux-gnu-ld: error: ../mpi/.libs/libmpi.a(mpi-bit.o):
multiple definition of '_gcry_mpih_add'
/usr/bin/x86_64-pc-linux-gnu-ld: ../mpi/.libs/libmpi.a(mpi-add.o): previous
The reason for this seems to be that the same functions are both declared as
'regular' (in mpi-internal.h) and 'extern inline' (in mpi-inline.h). This does
not conform to any C standard, and the result is completely unpredictable.
I am attaching a patch which seems to be the best way of achieving expected
functionality (if I'm reading the current code correctly) while staying
compliant with the standards.
It declares both the prototypes and the inline functions as 'inline', so the
compiler is forward-aware that there may be inline definitions coming. As the
'inline' keyword is merely a tip, this solution works as well when there are no
inline definitions actually (with mpi-inline.h include removed).
I've used 'inline' rather than 'inline' because the headers seem to be
internal and autoconf uses AC_C_INLINE already, so that symbol should be always