diff --git a/scripts/jlibtool.c b/scripts/jlibtool.c index 40e4cb7fb49b..041449d456bd 100644 --- a/scripts/jlibtool.c +++ b/scripts/jlibtool.c @@ -218,6 +218,9 @@ #endif +#define XSTRINGIFY(x) #x +#define STRINGIFY(x) XSTRINGIFY(x) + /* We want to say we are libtool 1.4 for shlibtool compatibility. */ #define VERSION "1.4" @@ -2061,7 +2064,7 @@ static void link_fixup(command_t *cmd) #endif { - char *tmp = lt_malloc(PATH_MAX); + char *tmp = lt_malloc(PATH_MAX + 30); #ifdef __APPLE__ strcpy(tmp, cmd->install_path); @@ -2076,12 +2079,25 @@ static void link_fixup(command_t *cmd) } /* - * @todo - push the version for non-OSX systems - * As "libfoo.so.VERSION" + * Add the version as "libfoo.so.PROGRAM_VERSION" */ +#if defined(PROGRAM_VERSION) && !defined(__APPLE__) + strcat(tmp, "." STRINGIFY(PROGRAM_VERSION)); +#endif push_count_chars(cmd->shared_opts.normal, tmp); } + +#if defined(PROGRAM_VERSION) && defined(__APPLE__) + /* + * These are separate options on OSX. + */ + push_count_chars(cmd->shared_opts.normal, + "-current_version " STRINGIFY(PROGRAM_VERSION)); + push_count_chars(cmd->shared_opts.normal, + "-compatibility_version " STRINGIFY(PROGRAM_VERSION)); +#endif + #endif } diff --git a/scripts/libtool.mk b/scripts/libtool.mk index bf1d6b48cfde..8344204a53fd 100644 --- a/scripts/libtool.mk +++ b/scripts/libtool.mk @@ -44,7 +44,7 @@ ifeq "${LIBTOOL}" "JLIBTOOL" ${JLIBTOOL}: ${top_makedir}/jlibtool.c $(Q)mkdir -p $(dir $@) $(Q)echo CC jlibtool.c - $(Q)${CC} $< -o $@ + $(Q)${CC} $< -o $@ -DPROGRAM_VERSION=$(RADIUSD_VERSION_STRING) clean: jlibtool_clean