i'm currently trying to include a libtool library from another project that lies beside my current project. I can check the library in configure using
LDFLAGS="$LDFLAGS -L$top_srcdir../otherproject/libotherproject/.libs/"
AC_CHECK_LIB([otherproject],[init],[],[AC_MSG_ERROR([No otherproject libary found.])])
in my configure.ac. Everything is fine so far. But if i build the project using make, i get an error from libtool while it is in currentproject/sources/:
../libtool: line 5986: cd: ../otherproject/libotherproject/.libs/: No such file or directory
libtool: link: cannot determine absolute directory name of `../otherproject/libotherproject/.libs/'
Which is logical, because it should be something like ../../otherproject/libotherproject/.libs/
. I tried to debug that and found that if is use
AC_MSG_NOTICE([Top src dir is: $top_srcdir])
in configure.ac, the config script tells me
configure: Top src dir is:
only. Same behaviour for $abs_top_srcdir. $srcdir is "." always. I digged a bit in the documentation and found that $builddir should always be ".", but is also empty in my case. Is this a bug? Maybe i forgot to call a AC_init_anything
? Thanks for your help!
You should not use
srcdir
as a variable to determine the path to a built object. Use$(top_builddir)
instead.To use Makefile variables you need to use brackets either
$()
or${}
.