Steffen Sledz
2013-07-16 14:56:05 UTC
Sorry, if this is a faq, but i didn't found a clear answer searching around.
Given situation: We have a library called e.g. libfoo which uses e.g. mq_open from librt. Than we have a program e.g. called progbar which requires libfoo (and therefor also librt).
Our current solution looks like this, but it does not work, because linking progbar is missing the -lrt option.
progbar/configure.ac:
---------------------> snip <---------------------
...
AC_CHECK_LIB([rt], [mq_open], [], [ AC_MSG_ERROR([*** Could not find librt ***]) ])
...
if test -n "$with_libfoo_path" ; then
FOO_LDFLAGS="-L$with_libfoo_path/lib -lfoo"
FOO_CPPFLAGS="-I$with_libfoo_path/include"
else
AC_CHECK_LIB([foo], [foo_init], [], [ AC_MSG_ERROR([*** Could not find libfoo, use --with-libfoo-path option ***]) ], [-lrt])
fi
AC_SUBST(FOO_LDFLAGS)
AC_SUBST(FOO_CPPFLAGS)
...
---------------------> snap <---------------------
progbar/src/Makefile.am:
---------------------> snip <---------------------
bin_PROGRAM = progbar
...
progbar_CPPFLAGS = $(FOO_CPPFLAGS)
progbar_LDFLAGS = $(FOO_LDFLAGS)
...
---------------------> snap <---------------------
Where do we have to make which checks?
Do we need a check for librt in the libfoo package?
Do we have to mention the librt link option somewhere in the progbar package?
Thx for any help,
Steffen
PS: FUP set to <***@gnu.org>
Given situation: We have a library called e.g. libfoo which uses e.g. mq_open from librt. Than we have a program e.g. called progbar which requires libfoo (and therefor also librt).
Our current solution looks like this, but it does not work, because linking progbar is missing the -lrt option.
progbar/configure.ac:
---------------------> snip <---------------------
...
AC_CHECK_LIB([rt], [mq_open], [], [ AC_MSG_ERROR([*** Could not find librt ***]) ])
...
if test -n "$with_libfoo_path" ; then
FOO_LDFLAGS="-L$with_libfoo_path/lib -lfoo"
FOO_CPPFLAGS="-I$with_libfoo_path/include"
else
AC_CHECK_LIB([foo], [foo_init], [], [ AC_MSG_ERROR([*** Could not find libfoo, use --with-libfoo-path option ***]) ], [-lrt])
fi
AC_SUBST(FOO_LDFLAGS)
AC_SUBST(FOO_CPPFLAGS)
...
---------------------> snap <---------------------
progbar/src/Makefile.am:
---------------------> snip <---------------------
bin_PROGRAM = progbar
...
progbar_CPPFLAGS = $(FOO_CPPFLAGS)
progbar_LDFLAGS = $(FOO_LDFLAGS)
...
---------------------> snap <---------------------
Where do we have to make which checks?
Do we need a check for librt in the libfoo package?
Do we have to mention the librt link option somewhere in the progbar package?
Thx for any help,
Steffen
PS: FUP set to <***@gnu.org>