【问题标题】:Packaging a library with Autotools使用 Autotools 打包库
【发布时间】:2014-10-07 23:25:24
【问题描述】:

我开始使用 Autotools,我正在尝试打包一个库(用于学习目的的通用堆栈实现)以及一些使用示例。

库源位于src,示例位于examples

我有以下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

根据我的理解,我需要为libstack.la 指定一个标头,并在我的示例中包含该标头,但是在将libstack_la_HEADERS = src/stack.h 添加到Makefile.am 后运行autoreconf 时出现以下错误:

$ 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

我找不到任何与 dir 前缀相关的信息。

我在这里错过了什么?

【问题讨论】:

    标签: makefile autotools automake


    【解决方案1】:

    要处理库的标题,你应该这样写:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-23
      • 2011-03-11
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多