简体   繁体   中英

Packaging a library with Autotools

I'm starting out with Autotools, and I'm trying to package a library (a generic stack implementation for learning purposes) along with some usage examples.

The library source lives in src and the example in examples .

I have the following Makefile.am :

lib_LTLIBRARIES = libstack.la
libstack_la_SOURCES = src/stack.c    

check_PROGRAMS = example/stack
example_stack_SOURCES = example/stack.c
example_stack_LDADD = libstack.la

As long as my understanding goes, I need to specify a header for libstack.la , and include that from my example, but I get the following error when running autoreconf after adding libstack_la_HEADERS = src/stack.h to Makefile.am :

$ autoreconf -iv
... (omiting irrelevant parts)
Makefile.am:3: error: 'libstack_la_HEADERS' is used but 'libstack_ladir' is undefined
autoreconf: automake failed with exit status: 1

I couldn't find any information related to the dir prefix.

What am I missing here?

To handle header of library you should write something like this:

libstackincludedir = $(includedir)/my_mega_stack
libstackinclude_HEADERS = stack.h

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM