1.生成动态库。
1)先写configure.in,用autoscan命令生成configure.scan,然后将其重命名为configure.in,并修改其中内容如下:
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure
script.
AC_PREREQ(2.59)
AC_INIT(SimulatorAdapter,1.0)
AM_INIT_AUTOMAKE(SimulatorAdapter,1.0)
# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_LIBTOOL -》这一项是必须的
# Checks for libraries.
# Checks for header files.
# Checks for typedefs, structures, and compiler
characteristics.
AC_HEADER_STDBOOL
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_STRUCT_TM
# Checks for library functions.
AC_OUTPUT(Makefile \
src/Makefile)
2) 编写Makefile.am,内容如下:
Makefile.am可以如下写法:
include_HEADERS=myexpfunc.h //最终调用者所使用的动态库函数声明文件, 执行make
install会将其在prefix目录