autoconf和automake的使用

3 篇文章 1 订阅

hasson@PC:~/Desktop/demo$ ls
main.c
hasson@PC:~/Desktop/demo$ cat main.c
#include <stdio.h>

int main(int argc, char** argv)

{

    printf("Hello World!\n");

    return 0;

}
hasson@PC:~/Desktop/demo$ autoscan
Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\${ <-- HERE [^\}]*}/ at /usr/bin/autoscan line 361.
hasson@PC:~/Desktop/demo$ mv configure.scan configure.ac
hasson@PC:~/Desktop/demo$ nano configure.ac
hasson@PC:~/Desktop/demo$ cat configure.ac
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.69)
AC_INIT(main, 1.0)
AC_CONFIG_SRCDIR([main.c])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE(main,1.0)
# 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_OUTPUT(Makefile)
hasson@PC:~/Desktop/demo$ aclocal
hasson@PC:~/Desktop/demo$ autoconf
hasson@PC:~/Desktop/demo$ autoheader
hasson@PC:~/Desktop/demo$ touch Makefile.am
hasson@PC:~/Desktop/demo$ ls
aclocal.m4      autoscan.log  configure     main.c
autom4te.cache  config.h.in   configure.ac  Makefile.am
hasson@PC:~/Desktop/demo$ nano Makefile.am
hasson@PC:~/Desktop/demo$ cat Makefile.am
AUTOMAKE_OPTIONS=foreign

bin_PROGRAMS=main

main_SOURCES=main.c
hasson@PC:~/Desktop/demo$ automake --add-missing
configure.ac:8: warning: AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated.  For more info, see:
configure.ac:8: http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation
configure.ac:10: installing './compile'
configure.ac:8: installing './install-sh'
configure.ac:8: installing './missing'
Makefile.am: installing './depcomp'
hasson@PC:~/Desktop/demo$ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
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 ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating config.h
config.status: executing depfiles commands
hasson@PC:~/Desktop/demo$ make
make  all-am
make[1]: Entering directory '/home/hasson/Desktop/demo'
gcc -DHAVE_CONFIG_H -I.     -g -O2 -MT main.o -MD -MP -MF .deps/main.Tpo -c -o main.o main.c
mv -f .deps/main.Tpo .deps/main.Po
gcc  -g -O2   -o main main.o  
make[1]: Leaving directory '/home/hasson/Desktop/demo'
hasson@PC:~/Desktop/demo$ ./main
Hello World!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值