relaytool.m4 revision f4f76ab18b014c84d2b6abdd24fe5ac94dda22e5
f4f76ab18b014c84d2b6abdd24fe5ac94dda22e5acspikednl Usage: RELAYTOOL(LIBRARY_NAME, LIBS, CFLAGS, ACTION-IF-WEAK-LINK-IS-POSSIBLE)
f4f76ab18b014c84d2b6abdd24fe5ac94dda22e5acspike
f4f76ab18b014c84d2b6abdd24fe5ac94dda22e5acspikednl Example:
f4f76ab18b014c84d2b6abdd24fe5ac94dda22e5acspikednl RELAYTOOL("gtkspell", GTKSPELL_LIBS, GTKSPELL_CFLAGS, gtkspell_weak=yes)
f4f76ab18b014c84d2b6abdd24fe5ac94dda22e5acspikednl Will modify GTKSPELL_LIBS to include a call to relaytool if available
f4f76ab18b014c84d2b6abdd24fe5ac94dda22e5acspikednl or if not, will modify GTKSPELL_CFLAGS to include -D switches to define
f4f76ab18b014c84d2b6abdd24fe5ac94dda22e5acspikednl libgtkspell_is_present=1 and libgtkspell_symbol_is_present=1
f4f76ab18b014c84d2b6abdd24fe5ac94dda22e5acspike
f4f76ab18b014c84d2b6abdd24fe5ac94dda22e5acspikeAC_DEFUN([RELAYTOOL], [
f4f76ab18b014c84d2b6abdd24fe5ac94dda22e5acspike if test -z "$RELAYTOOL_PROG"; then
f4f76ab18b014c84d2b6abdd24fe5ac94dda22e5acspike AC_PATH_PROG(RELAYTOOL_PROG, relaytool, no)
f4f76ab18b014c84d2b6abdd24fe5ac94dda22e5acspike fi
f4f76ab18b014c84d2b6abdd24fe5ac94dda22e5acspike
f4f76ab18b014c84d2b6abdd24fe5ac94dda22e5acspike AC_MSG_CHECKING(whether we can weak link $1)
f4f76ab18b014c84d2b6abdd24fe5ac94dda22e5acspike
f4f76ab18b014c84d2b6abdd24fe5ac94dda22e5acspike _RELAYTOOL_PROCESSED_NAME=`echo "$1" | sed 's/-/_/g;s/\./_/g;'`
f4f76ab18b014c84d2b6abdd24fe5ac94dda22e5acspike _RELAYTOOL_UPPER_NAME=`echo $_RELAYTOOL_PROCESSED_NAME | tr '[[:lower:]]' '[[:upper:]]'`
f4f76ab18b014c84d2b6abdd24fe5ac94dda22e5acspike
f4f76ab18b014c84d2b6abdd24fe5ac94dda22e5acspike if test "$RELAYTOOL_PROG" = "no"; then
f4f76ab18b014c84d2b6abdd24fe5ac94dda22e5acspike AC_MSG_RESULT(no)
f4f76ab18b014c84d2b6abdd24fe5ac94dda22e5acspike $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"
f4f76ab18b014c84d2b6abdd24fe5ac94dda22e5acspike else
f4f76ab18b014c84d2b6abdd24fe5ac94dda22e5acspike AC_MSG_RESULT(yes)
f4f76ab18b014c84d2b6abdd24fe5ac94dda22e5acspike $2=`echo $$2|sed 's/\`/\\\\\`/g;'`
f4f76ab18b014c84d2b6abdd24fe5ac94dda22e5acspike $2="-Wl,--gc-sections \`relaytool --relay $1 $$2\`"
f4f76ab18b014c84d2b6abdd24fe5ac94dda22e5acspike $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"
f4f76ab18b014c84d2b6abdd24fe5ac94dda22e5acspike $4
f4f76ab18b014c84d2b6abdd24fe5ac94dda22e5acspike fi
f4f76ab18b014c84d2b6abdd24fe5ac94dda22e5acspike])
f4f76ab18b014c84d2b6abdd24fe5ac94dda22e5acspike