Autoconf 学习笔记(1)
来源:互联网 发布:stm32编程语言 编辑:程序博客网 时间:2024/05/06 20:27
1. 建立源码目录
cd hello
mkdir src
2. 编辑源码
* hello.c
*
* 2008-01-14, mymtom
*/
#include <stdio.h>
int main(void)
...{
printf("Hello, Automake! ");
return 0;
}
3. 编写Makefile.am和src/Makefile.am
# Makefile.am
#
# 2008-01-14, mymtom
#
AUTOMAKE_OPTIONS = foreign
SUBDIRS = src
# src/Makefile.am
#
# 2008-01-14, mymtom
#
bin_PROGRAMS = hello
hello_SOURCES = hello.c
4. 运行用autoscan产生configure.scan
# 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([src/hello.c])
AC_CONFIG_HEADER([config.h])
# Checks for programs.
AC_PROG_CC
# Checks for libraries.
# Checks for header files.
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
AC_CONFIG_FILES([Makefile
src/Makefile])
AC_OUTPUT
5. 以configure.scan为基础, 编写configure.ac
# Process this file with autoconf to produce a configure script.
AC_INIT(hello, 1.0, mymtom@hotmail.com)
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([src/hello.c])
AC_CONFIG_HEADER([config.h])
# Checks for programs.
AC_PROG_CC
# Checks for libraries.
# Checks for header files.
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
AC_CONFIG_FILES([Makefile
src/Makefile])
AC_OUTPUT
6. 运行aclocal, autoheader, autoconf和automake
autoheader
autoconf
automake --add-missing
7. 运行./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... no
checking for mawk... no
checking for nawk... nawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating config.h
config.status: executing depfiles commands
8. 运行make
make all-recursive
Making all in src
if gcc -DHAVE_CONFIG_H -I. -I. -I.. -g -O2 -MT hello.o -MD -MP -MF ".deps/hello.Tpo" -c -o hello.o hello.c; then mv -f ".deps/hello.Tpo" ".deps/hello.Po"; else rm -f ".deps/hello.Tpo"; exit 1; fi
gcc -g -O2 -o hello hello.o
- Autoconf 学习笔记(1)
- autoconf 学习笔记
- Autoconf 学习笔记(2)
- automake autoconf 学习笔记
- autoconf/automake学习笔记
- automake autoconf学习笔记
- Autoconf学习笔记
- automake / autoconf 学习笔记
- Linux Autoconf/AutoMake学习笔记
- Linux Autoconf/AutoMake学习笔记
- autoconf和automake学习笔记
- GNU hello学习笔记(1)——autoconf和automake
- GNU hello学习笔记(1)——autoconf和automake
- autoconf/automake 使用笔记
- [编译]autoconf 工具学习
- autotools automake autoconf libtool 笔记
- autotools automake autoconf libtool 笔记
- automake和autoconf学习小结
- 上弦月,金桂飘香
- 友谊
- Delphi 中把文本文件装入资源文件中
- 了解Lucene
- 校内网-中国的Facebook
- Autoconf 学习笔记(1)
- RunAsDate 1.01
- 240多个jQuey插件
- jQuery发布1.1.3版,性能提高800%
- JavaScript 访问 JSF 组件的方法zz
- ubuntu7.10下使用QQ聊天-wine+QQ2007安装设置方法
- 操作符丢失 在查询表达式
- 新的家,新的生活
- 关于Hibernate中inverse=true的转载