青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

isware

[轉]linux c 一個autotools的最簡單例子

  1、準備:
     

   需要工具autoscan aclocal autoheader automake autoconf make 等工具.


  2、測試程序編寫:
     


      建立目錄:mkdir include src
     
      編寫程序:include/str.h
      
#include <stdio.h>

int str(char *string);

      編寫程序:src/str.c
      
#include "str.h"
//print string
int str(char *string){
        printf(
"\n----PRINT STRING----\n\"%s\"\n",string);
        
return 0;
}


//interface of this program
int main(int argc , char **argv){
        
char str_read[1024];
        printf(
"Please INPUT something end by [ENTER]\n");
        scanf(
"%s",str_read);
        
return str(str_read );
}


3、生成configure.in
   

configure.in是automake的輸入文件,所以必須先生成該文件。
    執行命令:
[root@localhost str]# ls
include  src
[root
@localhost str]# autoscan
autom4te: configure.ac: no such file or directory
autoscan
: /usr/bin/autom4te failed with exit status: 1
[root
@localhost str]# ls
autoscan.log  configure.scan  include  src
[root
@localhost str]# cp configure.scan configure.in 

修改 configure.in
#                                               -*- Autoconf -*-
# 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([include
/str.h])
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_OUTPUT

修改
AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)

AC_INIT(str,0.0.1, [bug@sounos.org])

FULL-PACKAGE-NAME 為程序名稱,VERSION為當前版本, BUG-REPORT-ADDRESS為bug匯報地址
    添加AM_INIT_AUTOMAKE
    添加AC_CONFIG_FILES([Makefile])
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.


AC_PREREQ(
2.59)
#AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
AC_INIT(str, 0.0.1, [bug@sounos.org])
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([include
/str.h])
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])
AC_OUTPUT

4、執行aclocal

[root@localhost str]# aclocal
/usr/share/aclocal/libfame.m4:6: warning: underquoted definition of AM_PATH_LIBFAME
  run info 
'(automake)Extending aclocal'
  or see http
://sources.redhat.com/automake/automake.html#Extending-aclocal

5、制作Makefile.am


[root@localhost str]# cat Makefile.am
#Makefile.am

bin_PROGRAMS    = str
str_SOURCES     
= include/str.h src/str.c
str_CPPFLAGS    
= -I include/

6、autoheader

[root@localhost str]# autoheader

7、automake必須文件:


    *  install-sh
    
* missing
    
* INSTALL
    
* NEWS
    
* README
    
* AUTHORS
    
* ChangeLog
    
* COPYING
    
* depcomp 
其中
    * install-sh
    
* missing
    
* INSTALL
    
* COPYING
    
* depcomp 
可以通過automake -a選項自動生成,所以這里只需要建立如下文件
[root@localhost str]# touch NEWS README AUTHORS ChangeLog

8、執行automake


[root@localhost str]# automake -a
configure.ac: installing `./install-sh'
configure.ac: installing `./missing
'
Makefile
.am: installing `./INSTALL'
Makefile.am: installing `./COPYING
'
Makefile
.am: installing `./compile'
Makefile.am: installing `./depcomp
'

9、autoconf

[root@localhost str]# autoconf
[root@localhost str]# ls
aclocal.m4      autoscan.log  config.h.in   configure.scan  include     Makefile.am  NEWS
AUTHORS         ChangeLog     configure     COPYING         INSTALL     Makefile
.in  README
autom4te
.cache  compile       configure.ac  depcomp         install-sh  missing      src

10、執行測試:


      
執行./configure
[root@localhost str]# ./configure --prefix=/u
checking for a BSD-compatible install /usr/bin/install -c
checking whether build environment is sane
 yes
checking 
for gawk gawk
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 config.h
config
.status: config.h is unchanged
config
.status: executing depfiles commands
執行 make
[root@localhost str]# make
make  all-am
make[
1]: Entering directory `/data/devel/c/str'
if gcc -DHAVE_CONFIG_H -I. -I. -I.  -I include/   -g -O2 -MT str-str.o -MD -MP -MF ".deps/str-str.Tpo" -c -o str-str.o `test -f 
'src/str.c' || echo './'`src/str.c; \
then mv -f ".deps/str-str.Tpo" ".deps/str-str.Po"; else rm -f ".deps/str-str.Tpo"; exit 1; fi
gcc  -g -O2   -o str  str-str.o
make[1]: Leaving directory `/data/devel/c/str
'
執行 make install
[root@localhost str]# make install
make[1]: Entering directory `/data/devel/c/str'
test -z "/u/bin" || mkdir -p -- "/u/bin"
  /usr/bin/install -c 
'str' '/u/bin/str'
make[1]: Nothing to be done for `install-data-am
'.
make[
1]: Leaving directory `/data/devel/c/str'

11、測試程序:

[root@localhost str]# /u/bin/str
Please INPUT something end by [ENTER]
abcksdhfklsdklfdjlkfd

----PRINT STRING----
"abcksdhfklsdklfdjlkfd"

到此結束!!



--------------------

添加測試包:
[root@localhost str]# make dist-gzip
{ test ! -d str-0.0.1 || { find str-0.0.1 -type d ! -perm -200 -exec chmod u+w {} ';' && rm -fr str-0.0.1; }; }
mkdir str-0.0.1
find str
-0.0.1 -type d ! -perm -777 -exec chmod a+rwx {} \-\
  
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \-\
  
! -type d ! -perm -400 -exec chmod a+r {} \-\
  
! -type d ! -perm -444 -exec /bin/sh /data/devel/c/str/install-sh --m a+r {} {} \\
|| chmod -R a+r str-0.0.1
tardir
=str-0.0.1 && /bin/sh /data/devel/c/str/missing --run tar chof - "$tardir" | GZIP=--best gzip ->str-0.0.1.tar.gz
{ test 
! -d str-0.0.1 || { find str-0.0.1 -type d ! -perm -200 -exec chmod u+w {} ';' && rm -fr str-0.0.1; }; }

添加一個支持子目錄、靜態庫、自定義configure選項的包

支持子目錄Makefile.am 選項 SUBDIR =
#Automake interface 
SUBDIRS = src
支持靜態庫Makefile.am
EXTRA_DIST  用于添加除源碼外的文件到dist包
#Automake interface
bin_PROGRAMS = hello
hello_SOURCES 
= hello.c lib/sbase.h
hello_CPPFLAGS 
= -I lib
hello_LDFLAGS 
= -static lib/libsbase.a
EXTRA_DIST 
= lib/libsbase.a
configure.in
AC_PREREQ(2.59)
#AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
AC_INIT(hello, 0.0.1, [SounOS@gmail.com])
#AM 聲明
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.

AC_HEADER_STDC
AC_CHECK_HEADERS([stdint
.h stdlib.h sys/socket.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T

#用于自定義configure 選項,見acinclude.am
AC_CHECK_EXTRA_OPTIONS
# Checks for library functions.

AC_CONFIG_FILES([Makefile
                 src
/Makefile])
AC_OUTPUT

posted on 2011-05-31 11:42 艾斯維亞 閱讀(316) 評論(0)  編輯 收藏 引用

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            久久精品一区二区三区中文字幕| 久久久免费精品视频| 欧美日韩国产不卡在线看| 99re6这里只有精品视频在线观看| 亚洲第一在线视频| 一区二区三区日韩精品视频| 狠狠爱成人网| 国产欧美一级| 国产精品三级久久久久久电影| 欧美激情精品| 欧美电影资源| 免费美女久久99| 久久精品99国产精品日本| 亚洲网站在线| 亚洲视频免费在线| 亚洲午夜电影| 午夜欧美精品久久久久久久| 亚洲欧美日韩视频二区| 亚洲韩国青草视频| 欧美成人高清视频| 欧美jjzz| 亚洲福利在线视频| 亚洲性感激情| 亚洲美女诱惑| 亚洲国产综合在线看不卡| 黄色成人在线| 亚洲东热激情| 日韩视频精品| 亚洲欧美国产日韩天堂区| 亚洲破处大片| 亚洲视频二区| 久久久999精品免费| 久久只有精品| 亚洲黄网站黄| 亚洲午夜电影在线观看| 久久黄金**| 欧美成人免费在线观看| 欧美日韩久久精品| 国产日韩欧美在线看| 国产精品视频在线观看| 国产精品久久99| 国内精品视频一区| 亚洲精品免费网站| 日韩性生活视频| 欧美一级二级三级蜜桃| 巨乳诱惑日韩免费av| 亚洲国产一成人久久精品| 一区二区三区视频免费在线观看| 亚洲自拍偷拍色片视频| 久久免费午夜影院| 欧美肉体xxxx裸体137大胆| 国产日韩欧美亚洲一区| 日韩视频在线一区二区| 欧美亚洲在线| 亚洲国产精品嫩草影院| 亚洲永久在线观看| 蜜桃av久久久亚洲精品| 国产精品地址| 影视先锋久久| 午夜精彩视频在线观看不卡 | 欧美成人三级在线| 国产精品日韩在线观看| 亚洲黄色成人久久久| 欧美一区二区日韩| 亚洲三级电影全部在线观看高清| 欧美一级淫片aaaaaaa视频| 欧美精品aa| 永久免费毛片在线播放不卡| 午夜国产欧美理论在线播放| 欧美日韩精品欧美日韩精品| 欧美亚洲日本国产| 欧美高清视频一区二区| 国产在线乱码一区二区三区| 亚洲资源av| 亚洲精品一区久久久久久| 久久综合一区二区三区| 国产一区二区视频在线观看| 午夜精品久久久久久久久| 亚洲精品自在久久| 免费亚洲电影在线观看| 精品不卡视频| 久久久免费精品视频| 午夜精品美女久久久久av福利| 欧美日韩中文字幕精品| 99视频在线精品国自产拍免费观看| 欧美gay视频| 久久av资源网| 国产一区在线播放| 久久国产精品久久久久久电车| 在线亚洲观看| 国产精品久久久久久亚洲调教| 亚洲一二三区在线| 一区二区欧美在线| 国产精品久久久久久久久久尿 | 夜夜精品视频一区二区| 亚洲第一级黄色片| 免费一级欧美片在线播放| 亚洲国产天堂久久国产91| 亚洲成人资源网| 欧美日韩国产一区二区三区| 亚洲午夜精品久久| 亚洲伊人一本大道中文字幕| 国产区精品在线观看| 久久久久久9| 久久精品女人天堂| 亚洲精品综合| 一区二区三区产品免费精品久久75| 欧美午夜精品一区二区三区| 午夜精品一区二区三区在线视 | 国产精品99久久久久久宅男 | 欧美在线视频播放| 在线观看亚洲视频啊啊啊啊| 免费亚洲电影在线观看| 欧美不卡一卡二卡免费版| 中文在线一区| 久久国产精品久久w女人spa| 亚洲黄色成人| 亚洲专区欧美专区| 狠狠久久婷婷| 亚洲免费福利视频| 国产啪精品视频| 亚洲国产小视频| 国产拍揄自揄精品视频麻豆| 亚洲二区在线| 国产欧美日韩亚洲一区二区三区| 久久亚洲一区二区| 欧美日韩在线一区| 欧美三级小说| 欧美日韩三级电影在线| 日韩视频在线观看国产| 亚洲精品一区二区三区av| 欧美日韩国产一区二区三区| 亚洲欧美视频一区二区三区| 亚洲视频免费在线观看| 国产午夜精品一区理论片飘花 | 国产精品一级久久久| 欧美怡红院视频| 亚洲欧美在线免费| 国产一区二区三区精品欧美日韩一区二区三区 | 亚洲天堂免费观看| 久久精品国产一区二区三| 亚洲三级电影全部在线观看高清| 亚洲欧美成人| 亚洲美女在线一区| 久久久精彩视频| 亚洲国产精品一区二区www| 亚洲精品黄色| 亚洲高清在线播放| 亚洲精选国产| 亚洲国产欧美另类丝袜| 欧美永久精品| 欧美亚洲一区| 欧美性做爰毛片| 亚洲日本电影| 亚洲精品自在久久| 免费国产一区二区| 免费成人高清在线视频| 国产亚洲一区二区三区| 亚洲已满18点击进入久久| 亚洲深夜福利视频| 欧美精品自拍| 亚洲国产精品va在线看黑人动漫| 在线精品在线| 老司机精品视频网站| 欧美韩日一区| 91久久精品一区二区三区| 久久久综合视频| 欧美bbbxxxxx| 日韩一区二区高清| 欧美日韩亚洲综合一区| 日韩午夜精品| 亚洲综合色丁香婷婷六月图片| 国产精品国产三级国产a| 亚洲私人黄色宅男| 欧美在线视频日韩| 黄色成人在线网站| 久久综合一区二区| 久久大香伊蕉在人线观看热2| 麻豆国产va免费精品高清在线| 国语自产精品视频在线看一大j8 | 久久久久国产精品厨房| 亚洲欧美中文日韩v在线观看| 欧美视频精品一区| 亚洲午夜一区二区三区| 欧美在线观看视频在线| 国产精品高潮视频| 日韩视频二区| 这里只有精品在线播放| 国产精品国产三级国产aⅴ9色| 亚洲欧洲一区二区三区| 亚洲三级性片| 欧美freesex8一10精品| 亚洲电影在线| 亚洲免费av电影| 欧美精品自拍| 亚洲精品久久久久| 99热这里只有成人精品国产| 国产精品久久久一区二区| 亚洲欧美激情视频在线观看一区二区三区| 欧美亚一区二区|