Tips: 使用autotools生成动态.so库文件 / Generate .so library files using autotools in Solaris and Linux

来源:互联网 发布:淘宝购物券怎么使用 编辑:程序博客网 时间:2024/06/06 16:38
Makefile.am形式如下

lib_LTLIBRARIES=libprintinfo.la
libprintinfo_la_SOURCES=printinfo.h printinfo.cpp

注意
1 ./Configure, make之后并不会马上生成libprintinfo.so文件,而要等到make install之后,libprintinfo.so文件将会位于/usr/local/lib中。

2 需要在文件configure.in中加入一行:AC_PROG_LIBTOOL;

3 如果发生错误configure.in:18: required file `./ltmain.sh' not found,则可运行libtoolize命令生成该文件;


参考资料
1. 例解autoconf和automake生成Makefile文件,http://www.ibm.com/developerworks/cn /linux/l-makefile/;
2. 《嵌入式Linux应用程序开发详解》之3.7 使用autotools。


// The English Version
Makefile.am is like this:

lib_LTLIBRARIES=libprintinfo.la
libprintinfo_la_SOURCES=printinfo.h printinfo.cpp

Notes:
1 After "./Configure", "make", the file libprintinfo.so will not appear immediately,until you run "make install",the file libprintinfo.so will defaultly under /usr/local/lib.

2 You may need to add one line in file configure.in:AC_PROG_LIBTOOL;

3 If you meet the error of "configure.in:18: required file `./ltmain.sh' not found",you can use the command tool "libtoolize" to generate the file Itmain.sh.
原创粉丝点击