autotools实现makefile的自动生成

途中遇到很多问题,等已有有空了统一整理一下autotools的使用

1、LIBTOOL is undefined

configure.ac:10: error: possibly undefined macro: AC_PROG_LIBTOOL  
If this token and others are legitimate, please use m4_pattern_allow.  
See the Autoconf documentation.  
+ automake --foreign --copy --add-missing -Woverride  
src/common/compress/Makefile.am:9: Libtool library used but `LIBTOOL' is undefined  
src/common/compress/Makefile.am:9: The usual way to define `LIBTOOL' is to add `AC_PROG_LIBTOOL'  
src/common/compress/Makefile.am:9: to `configure.ac' and run `aclocal' and `autoconf' again.  
src/common/compress/Makefile.am:9: If `AC_PROG_LIBTOOL' is in `configure.ac', make sure  
src/common/compress/Makefile.am:9: its definition is in aclocal's search path.  
 
这个问题我也找了好久,最后看到两篇文章,记录下来:
观点一:
原因分析
aclocal是个扫描程序, 负责扫描configure.ac中所有的宏定义并展开,
上面产生的原因就是找不到LIBTOOL宏的定义之处造成的.
 
原因就是aclocal与libtool没有安装在一个相同目录下面
 
aclocal是去默认 安装目录 /usr/share/aclocal下面搜索所有的.m4文件找所定义的宏,
 
但是由于安装了多个aclocal,可能aclocal目录不存在,实际目录为/usr/share/aclocal1.10等,
这就造成了aclocal找不到m4文件的情况, 解决办法就是将文件夹aclocal1.10重命名为aclocal.
 
或者显示指定路径 aclocal -I /usr/share/aclocal1.10 -I /usr/share/libtool/m4 --install
 
或者把/usr/share/libtool/m4下面的文件都copy至/usr/share/aclocal1.10中.
 
观点二:
出现这个问题的原因主要有两个:
1.没有安装aclocal
解决方法:安装libtool
2.没有配置正确aclocal的库LIBTOOL.m4的路径
 
解决方法:
—-查看aclocal的路径 aclocal --print-ac-dir
—-如果相应的*.m4文件不在这个目录下,则重新配置路径,或是将相应的*.m4文件复制到这个路径下 (aclocal -I DIR)
    小结:以上就是解决关于LIBTOOL is undefined问题的具体办法,有原因也有解决办法。


2、required file `./ltmain.sh` not found

在linux下编译c/c++程序出错:
$ automake --add-missing
....
configure.in:18: required file `build/ltmain.sh' not found
....
解决方案(libtoolize配置即可):

$libtoolize --version
-libtoolize (GNU libtool) 1.4.2
.....
$libtoolize --automake --copy --debug --force


转自:

http://www.yyxt.com/a/zxzx/5783.html

http://blog.sina.com.cn/s/blog_6d8df7d00100ul6h.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值