Code

Fixes "disappearing gradients" problem discussed on mailing list and adds a few g_war...
[inkscape.git] / m4 / relaytool.m4
1 dnl  Usage: RELAYTOOL(LIBRARY_NAME, LIBS, CFLAGS, ACTION-IF-WEAK-LINK-IS-POSSIBLE)
3 dnl  Example:
4 dnl  RELAYTOOL("gtkspell", GTKSPELL_LIBS, GTKSPELL_CFLAGS, gtkspell_weak=yes)
5 dnl  Will modify GTKSPELL_LIBS to include a call to relaytool if available
6 dnl  or if not, will modify GTKSPELL_CFLAGS to include -D switches to define
7 dnl  libgtkspell_is_present=1 and libgtkspell_symbol_is_present=1
9 AC_DEFUN([RELAYTOOL], [
10     if test -z "$RELAYTOOL_PROG"; then
11         AC_PATH_PROG(RELAYTOOL_PROG, relaytool, no)
12     fi
14     AC_MSG_CHECKING(whether we can weak link $1)
16     _RELAYTOOL_PROCESSED_NAME=`echo "$1" | sed 's/-/_/g;s/\./_/g;'`
17     _RELAYTOOL_UPPER_NAME=`echo $_RELAYTOOL_PROCESSED_NAME | tr '[[:lower:]]' '[[:upper:]]'`
19     if test "$RELAYTOOL_PROG" = "no"; then
20         AC_MSG_RESULT(no)
21         $3="-DRELAYTOOL_${_RELAYTOOL_UPPER_NAME}='static const int lib${_RELAYTOOL_PROCESSED_NAME}_is_present = 1; static int __attribute__((unused)) lib${_RELAYTOOL_PROCESSED_NAME}_symbol_is_present(char *m) { return 1; }' $$3"
22     else
23         AC_MSG_RESULT(yes)
24         $2=`echo $$2|sed 's/\`/\\\\\`/g;'`
25         $2="-Wl,--gc-sections \`relaytool --relay $1 $$2\`"
26         $3="-DRELAYTOOL_${_RELAYTOOL_UPPER_NAME}='extern int lib${_RELAYTOOL_PROCESSED_NAME}_is_present; extern int lib${_RELAYTOOL_PROCESSED_NAME}_symbol_is_present(char *s);' $$3"
27         $4
28     fi
29 ])