So when I understand you correct you don't want to give the option "-lrt" again when building progbar which links against libfoo (which itself already was linked against librt)? In this case building libfoo needs to use this statement for linking: -Wl,-whole-archive -lrt -Wl,-no-whole-archive Now libfoo implicitely knows and uses dependency to librt. On Tue, Jul 16, 2013 at 4:56 PM, Steffen Sledz <sledz@xxxxxxxxxxxxxxx> wrote: > 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 <autoconf@xxxxxxx> > > > > _______________________________________________ > https://lists.gnu.org/mailman/listinfo/libtool _______________________________________________ Autoconf mailing list Autoconf@xxxxxxx https://lists.gnu.org/mailman/listinfo/autoconf