Howto add a link to a library in autoconf configure script / makefile

前端 未结 2 1212
庸人自扰
庸人自扰 2021-02-07 06:57

I am an autotools newb and I have difficulties figuring out howto easily link a specific library into one of the configured targets.

I have a source package that I want

2条回答
  •  闹比i
    闹比i (楼主)
    2021-02-07 07:15

    You need to add the relevant -l flag to AM_LDFLAGS in Makefile.am; e.g.:

    AM_LDFLAGS = -lboost_system-mt
    

    Note that Boost libraries generally end in a suffix—a sequence of letters that indicates the build configuration. In the above example, the suffix is -mt. This could be different in your installation (though the -mt variant is commonly available on POSIXy systems, IME).

    I do something like this:

    AM_LDFLAGS = -lboost_system$(BOOST_LIB_SUFFIX)
    

    BOOST_LIB_SUFFIX is a precious variable (see AC_ARG_VAR) that defaults to -mt.

提交回复
热议问题