步骤:
1,进入代码目录
2,运行autoscan,出错不管,只要有configure.scan就好
3,mv configure.scan configure.in
4,编辑 configure.in
以DHTClient程序为例,原始configure.in为
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
AC_CONFIG_SRCDIR([CRDHTProtocol.h])
AC_CONFIG_HEADER([config.h])
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
# Checks for libraries.
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([arpa/inet.h fcntl.h netinet/in.h stdlib.h string.h sys/socket.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_TYPE_MODE_T
AC_TYPE_SIZE_T
# Checks for library functions.
AC_CHECK_FUNCS([inet_ntoa memset socket strchr strstr strtol])
AC_OUTPUT
编辑后的configure.in应该为:
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.59)
AC_INIT(DHTClient, 0.1, )
AC_CONFIG_SRCDIR([CRDHTProtocol.h])
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(DHTClient, 0.1)
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
# Checks for libraries.
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([arpa/inet.h fcntl.h netinet/in.h stdlib.h string.h sys/socket.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_TYPE_MODE_T
AC_TYPE_SIZE_T
# Checks for library functions.
AC_CHECK_FUNCS([inet_ntoa memset socket strchr strstr strtol])
AC_CONFIG_FILES([Makefile])
AC_OUTPU
5,生成Makefile.am文件,需要手动输入一个,如下
bin_PROGRAMS = DHTClient
DHTClient_SOURCES = DHTClient.cpp CRDHTProtocol.h Error.cpp Error.h FileManager.cpp FileManager.h FunctionReturnValue.h Hash.cpp Hash.h IPAddress.cpp IPAddress.h MetaDataDefinition Socket.cpp TCPSocket.cpp Socket.h TCPSocket.h XMLManager.h XMLManager.cpp
CXXFLAGS = -Wall -Wno-deprecated -g
如果有库的话,可以自己添加 INCLUDES 或者DHTClient_LDADD=-LXXX
6,运行aclocal
7,运行autoheader
8,运行automake -a -c --foreign
9,运行autoconf
10,运行./configure
11,运行make
在Debian3.1中通过