gun build system官網位址:
Software- GNU Project - Free Software Foundation
Autoconf
簡介:Autoconf is a tool for producing shell scripts that automatically configure software source code packages to adapt to many kinds of Posix-like systems
automake
Libtool
一般流程如下
1. autoscan (autoconf):掃描源代碼以搜尋普通的可移植性問題,比如檢查編譯器,庫,頭檔案等,生成檔案configure.scan,它是configure.ac的一個雛形
your source files --> [autoscan*] --> [configure.scan] --> configure.ac
源檔案:
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stddef.h>
#include <assert.h>
#include <ctype.h>
#include <math.h>
#include <errno.h>
#include <limits.h>
#include <stdint.h>
int main()
{
return 0;
}
執行autoscan, 生成configure.scan和autoscan.log, 将 configure.scan 重命名為 configure.ac
root@ubuntu2004:/media/tmp/test_autoconf# autoscan
root@ubuntu2004:/media/tmp/test_autoconf# ls -al
total 16
drwxr-xr-x 2 root root 4096 Apr 11 17:20 .
drwxr-xr-x 3 root root 4096 Apr 11 17:01 ..
-rw-r--r-- 1 root root 0 Apr 11 17:21 autoscan.log
-rw-r--r-- 1 root root 540 Apr 11 17:21 configure.scan
-rw-r--r-- 1 root root 249 Apr 11 17:18 test.c
#configure.ac
#
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.69])
AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
AC_CONFIG_SRCDIR([test.c])
AC_CONFIG_HEADERS([config.h])
# Checks for programs.
AC_PROG_CC
# Checks for libraries.
# Checks for header files.
AC_CHECK_HEADERS([limits.h stddef.h stdint.h stdlib.h string.h unistd.h])
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
AC_OUTPUT