How to modify configure.ac for add new lib into Makefile variable LIBS?
Xue Wei
Wei.Xue at Sun.COM
Sun Sep 2 22:08:43 PDT 2007
hi, Dan,
Thank you very much.
William
> On 8/30/07, Xue Wei <Wei.Xue at sun.com> wrote:
>
>> I am trying to add some file into libX117.2, but when I compiled, I need
>> add some used library into Makefile, for example, add -llayout to variable
>> LIBS which in Makefile. As you known, libX117.2 use auto configure tool to
>> generic Makefile, so I have to modify file configure.ac .
>> But unfortunately I am not a export about auto configure. Could anyone
>> please tell me how to modify configure.ac to make variable LIBS in Makefile
>> be add new libs such lick -llayout?
>>
>
> There are a lot of different ways to do this. If the liblayout library
> has an associated pkg-config file (/usr/lib/pkgconfig/layout.pc or
> something), then you'd do something like this
>
> configure.ac:
> PKG_CHECK_MODULES(LAYOUT, layout)
>
> Makefile.am:
> AM_CFLAGS = $(LAYOUT_CFLAGS)
> theprogram_LIBADD = $(LAYOUT_LIBS)
>
> If you don't have a pkg-config file, then it's a little different.
>
> configure.ac:
> AC_CHECK_LIB(layout, some_function_in_liblayout)
>
> This will add -llayout to the LIBS variable if it's found, and then it
> will be linked into all programs and libraries. The drawback is that
> this doesn't handle the case where liblayout and its headers aren't in
> a standard location. It also doesn't say what to do if liblayout is or
> is not found.
>
> You should be able to find many examples in the Xorg sources.
>
> --
> Dan
>
More information about the xorg
mailing list