Autotools小结

1 分钟阅读

Contact me

或者用邮件交流 jacky.wucheng@foxmail.com

构成

GNU build system == Autotools

  • Autoconf
  • Automake
  • Libtool

步骤

  1. autoscan 产生 configure.scan, 改名为 configure.ac
  2. 修改 configure.ac

    The use of some macros has changed between different versions of Autoconf: The package name and version was defined as arguments of AM_INIT_AUTOMAKE instead of AC_INIT. AC_OUTPUT was getting the list of generated files instead of using the additional macro AC_CONFIG_FILES.

  3. aclocal 产生 aclocal.m4
  4. autoconf 产生 configure
  5. 创建 Makefile.am
  6. automake –add-missing –foreign 产生 Makefile.in

    due to the switch --add-missing you get a few links to scripts necessary for building the project: depcomp, install.sh and missing. The other option --foreign tells to Automake that you don’t want to follow GNU standard and you don’t need mandatory documentation files: INSTALL, NEWS, README, AUTHORS, ChangeLog and COPYING. I have used it here to keep the number of created file to a minimum but else it is a good idea to provide these files, you can start with empty files.

  7. configure 产生 Makefile
  8. make 编译
  9. make install 安装

工具

  • autoreconf

    It is another tool part of the Autoconf package which is running all scripts in the right order. To start a new project, you can just run autoreconf –install and it will call all necessary commands.

    Run autoconf' (and autoheader’, aclocal', automake’, autopoint' (formerly gettextize’), and libtoolize' where appropriate) repeatedly to remake the GNU Build System files in specified DIRECTORIES and their subdirectories (defaulting to .’).

注意点

  • configure.in is the name used in older version (before 2001) of Autoconf.
  • automake的参数

逻辑图

TODO

Reference