./configure 自动生成makefile文件
./configure --prefix=/tmp/prefix
./configure --help
make install DESTDIR=/whereto
make uninstall
CFLAGS: 指定头文件(.h文件)的路径,如:CFLAGS=-I/usr/include -I/path/include。同样地,安装一个包时会在安装路径下建立一个include目录,当安装过程中出现问题时,试着把以前安装的包的include目录加入到该变量中来。
LDFLAGS:gcc 等编译器会用到的一些优化参数,也可以在里面指定库文件的位置。用法:LDFLAGS=-L/usr/lib -L/path/to/your/lib。每安装一个包都几乎一定的会在安装目录里建立一个lib目录。如果明明安装了某个包,而安装另一个包时,它愣是 说找不到,可以抒那个包的lib路径加入的LDFALGS中试一下。
LIBS:告诉链接器要链接哪些库文件,如LIBS = -lpthread -liconv
简单地说,LDFLAGS是告诉链接器从哪里寻找库文件,而LIBS是告诉链接器要链接哪些库文件。不过使用时链接阶段这两个参数都会加上,所以你即使将这两个的值互换,也没有问题。
有时候LDFLAGS指定-L虽然能让链接器找到库进行链接,但是运行时链接器却找不到这个库,如果要让软件运行时库文件的路径也得到扩展,那么我们需要增加这两个库给”-Wl,R”:
1.error
configure.in:7: version mismatch. This is Automake 1.9.6,
configure.in:7: but the definition used by this AM_INIT_AUTOMAKE
configure.in:7: comes from Automake 1.9.5. You should recreate
configure.in:7: aclocal.m4 with aclocal and run automake again.
解决方法
$aclocal
$automake
将重新生成makefile文件
2.[root@localhost src]# ./configure
-bash: ./configure: No such file or directory
[root@localhost src]# aclocal
aclocal: `configure.ac' and `configure.in' both present.
aclocal: proceeding with `configure.ac'.
[root@localhost src]# autoconf
autoconf: warning: both `configure.ac' and `configure.in' are present.
autoconf: warning: proceeding with `configure.ac'.
root@localhost src]# ./configure
checking which defines needed for makedepend...
checking for a BSD-compatible install... /usr/bin/install -c
aclocal, autoconf, 之后可以正常运行./configure了