Sunday, October 7, 2007

Pidgin and SILC

I just finished building Pidgin 2.2.1 with SILC support. But I came across an interesting problem:

SILC can either use GNU MP or its own code for multiple-precision arithmetic, and that causes the problem, because "silcmp.h" begins with:

#ifdef SILC_MP_GMP
#include "mp_gmp.h"
#else
#include "mp_tma.h"
#endif
Only one of those "mp_*.h" headers will be installed, depending on which MP is enabled. But that means that anything building against SILC needs to know if GMP was used or not; if it was, and you don't #define SILC_MP_GMP, then you obviously get errors at compile time (since mp_tma.h is not installed in that case).

For Pidgin, I just worked around this by adding -DSILC_MP_GMP to CPPFLAGS, but there should be a better solution:

  1. The best solution would be for SILC to add this flag to silc.pc via an AC_SUBST.

  2. Otherwise, Pidgin (and other software depending on SILC) should be calling in configure.ac:
    CFLAGS_save="$CFLAGS"
    CFLAGS="$CFLAGS $SILC_CFLAGS"
    AC_CHECK_HEADER(mp_gmp.h, silc_mp_gmp=yes)
    CFLAGS="$CFLAGS_save"
    if test "x$silc_mp_gmp" = "xyes"; then
    AC_DEFINE(SILC_MP_GMP, 1, [Define if SILC uses GNU MP])
    fi

Now you understand why the first solution is much better. But does anyone know how other distros deal with this? Comments Thoughtfully Considered.

No comments: