systerm:Linux ubuntu 2.6.32-24-generic ;
automake & autoconf : 1.11.1
一、指令 autoscan;
输出 configure.scan;
二、指令 mv configure.scan configure.in
指令 vim configure.in
输出 configure.in
configure.in:
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.65])
AC_INIT(ET, 1.0, liangliang0918@126.com) # 名称,版本,邮箱
AM_INIT_AUTOMAKE(ET, 1.0) #手动加入的新宏,名称,版本
AC_CONFIG_HEADERS(config.h)#
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
# Checks for libraries.
AC_PROG_RANLIB # 静态 .a 文件打包
# Checks for header files.
AC_CHECK_HEADERS([sys/time.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
# Checks for library functions.
AC_CHECK_FUNCS([gettimeofday])
AC_OUTPUT(Makefile src/Makefile)# 输出文件,用空格分隔
三、指令 aclocal
输入 configure.in
输出 aclocal.m4
四、指令 autoconf
输入 configure.in aclocal.m4
输出 configure
五、指令 automake
输入 Makefile.am configure.in
输出 Makefile.in
Makefile.am:
SUBDIRS=src/
CURRENTPATH=$`pwd`
INCLUDES=-I$(CURRENTPATH)/src/
export INCLUDES
src/Makefile.am:
lib_LIBRARIES=libeventloop.a
libeventloop_a_SOURCES=eventloop.cpp \
creatorpoller.cpp \
epollpoller.cpp \
IOwatcher.cpp \
poller.cpp \
watcher.cpp
INCLUDES=-I$(top_srcdir)/src/
etincludedir=$(includedir)/swap
etinclude_HEADERS=$(top_srcdir)/src/eventloop.h