5

I have an variable declared in configure.ac:

MY_VERSION="0:0:0"
AC_SUBST(MY_VERSION)
AC_MSG_NOTICE([$MY_VERSION])

The value of the variable is printed out correctly during ./configure phase.

In Makefile.am there's following line:

libmylib_la_LDFLAGS = -version-info @MY_VERSION@

In the linker command line it expands correctly to "-version-info 0:0:0" on all systems except Solaris. On solaris (SunOS 5.10 Generic_141414-10 sun4u sparc SUNW,Sun-Blade-100) I get "-version-info" with no version number.

Any idea what may have gone wrong?

Martin Sustrik
  • 783
  • 10
  • 22
  • 1
    which version of Autoconf is in your Solaris system? – Maquefel Aug 26 '13 at 10:00
  • How is the Solaris version being built? Are you building the tarball for Solaris on another host, is is it being built on Solaris itself? – ldav1s Aug 26 '13 at 15:13
  • 1
    I'd first make sure your configure script is really setting this variable properly. An easy way to do this is to hack in "set +x" and "set -x" around the code in "configure". Then I'd examine the generated config.status to see if the setting is correct there. Sometimes autoconf trips across a vendor bug in sed or awk or something... – Tom Tromey Aug 26 '13 at 16:13
  • so what's the output of `AC_MSG_NOTICE`? is it empty as well? – umläute Aug 26 '13 at 20:06
  • Automake is version 1.12. It's built on Solaris itself, no cross-compiling. The variable is presumably set correctly as the AC_MSG_NOTICE does print out "0:0:0". Interestingly, in config.status, the value is empty: S["MY_VERSION"]="" – Martin Sustrik Aug 27 '13 at 05:53
  • Ah, I forgot: autoconf is version 2.68 – Martin Sustrik Aug 27 '13 at 13:50
  • @MartinSustrik have you tried with a different version of automake? I had the same error - different variable but it wasn't expanding - and it was automake 1.10.1. I fixed it by downgrading. – dbeer Aug 28 '13 at 18:25
  • If config.status shows an empty RHS, it would seem the problem is in either the configure script or in autoconf. It's still not clear to me whether you are running autoconf on Solaris as well. If you run autoconf on a different machine but invoke the configure script on Solaris, do you still have the problem? – William Pursell Sep 01 '13 at 12:53
  • 1
    libmylib_la_LDFLAGS = -version-info @MY_VERSION@ I suggest not to use @VAR@ in Makefile.am, but use $(VAR). @VAR@ is hard to override without patching Makefile.am and regenerating entire autostack. –  Apr 16 '14 at 08:10

1 Answers1

1

(A bit of a shot in the dark here, but…)

My guess would be that either MY or VERSION get defined on Solaris for whatever reason. Try usign

AC_SUBST([MY_VERSION])

instead, this way you're telling M4 to explicitly define that.

Also as Igor said, use $(MY_VERSION) (although it is unrelated to this.)

Diego Elio Pettenò
  • 3,152
  • 12
  • 15