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

不會飛的鳥

2010年12月10日 ... 不鳥他們!!! 我要用自己開發的分布式文件系統、分布式調度系統、分布式檢索系統, 做自己的搜索引擎!!!大魚有大志!!! ---楊書童

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 2009-05-14 17:31 不會飛的鳥 閱讀(2040) 評論(1)  編輯 收藏 引用

評論

# re: linux c 一個autotools的最簡單例子 2010-01-20 09:32 微凌秋白

講解詳細到位,很有實用價值,能不能寫一篇關于Makefile.am內容編寫的帖子,那就太感謝了  回復  更多評論   


只有注冊用戶登錄后才能發表評論。
網站導航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <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>
            亚洲午夜视频在线观看| 欧美成人精品在线| 欧美成人免费一级人片100| 香蕉久久夜色精品| 国产精品萝li| 亚洲视频在线二区| 一区二区国产日产| 国产精品欧美一区喷水| 久久国产精品亚洲77777| 欧美在线观看日本一区| 一色屋精品视频在线看| 亚洲国产精品久久久久秋霞不卡| 亚洲欧美在线看| 国产亚洲精品久久飘花| 激情欧美丁香| 欧美国产另类| 欧美成人一品| 亚洲欧美国产毛片在线| 午夜精品美女久久久久av福利| 国产一区清纯| 亚洲国产精品第一区二区三区| 欧美精品一线| 欧美一区在线看| 久久夜色精品亚洲噜噜国产mv| 亚洲精品视频在线看| 一本大道久久a久久精二百| 国产欧美日韩视频一区二区三区| 男人天堂欧美日韩| 欧美色道久久88综合亚洲精品| 午夜在线一区| 蜜桃伊人久久| 欧美在线视频一区二区三区| 中文网丁香综合网| 精品成人一区二区三区| 一本色道久久综合狠狠躁篇的优点 | 欧美日韩另类综合| 欧美一区二区精品在线| 久久全国免费视频| 亚洲精品乱码久久久久久| 亚洲欧美美女| 日韩亚洲在线| 久久久www成人免费毛片麻豆| 一区二区三区精品视频| 一本色道久久综合亚洲精品不| 狠狠入ady亚洲精品经典电影| 91久久亚洲| 亚洲成在人线av| 先锋亚洲精品| 亚洲综合国产精品| 欧美激情bt| 男人的天堂成人在线| 国产精品一香蕉国产线看观看 | 欧美精品首页| 麻豆久久精品| 国产日韩精品综合网站| 亚洲狼人综合| 91久久精品久久国产性色也91| 午夜视频一区二区| 亚洲伊人一本大道中文字幕| 欧美激情视频给我| 欧美成熟视频| 国产精品久久久久久久久免费| 亚洲国产精品高清久久久| 国内精品伊人久久久久av影院 | 欧美aⅴ99久久黑人专区| 久久久亚洲一区| 国产精自产拍久久久久久| 一本大道久久a久久综合婷婷 | 精品动漫av| 亚洲男女自偷自拍图片另类| 亚洲一二三四区| 蜜臀久久久99精品久久久久久| 鲁大师成人一区二区三区| 国产午夜精品全部视频在线播放| 亚洲先锋成人| 午夜精品一区二区三区四区 | 国内偷自视频区视频综合| 亚洲综合三区| 欧美一站二站| 国产一区二区三区黄| 一本一道久久综合狠狠老精东影业| 一区二区国产在线观看| 欧美日韩精品久久| 亚洲伊人观看| 久久精品国产一区二区三| 国内成人精品一区| 久久男女视频| 亚洲激情社区| 在线观看国产精品淫| 欧美不卡视频一区发布| 日韩午夜激情av| 欧美一区二区三区的| 国产主播一区二区| 欧美一级在线视频| 国产精品v欧美精品v日韩| 免费成人你懂的| 亚洲视频日本| 在线观看的日韩av| 欧美亚洲第一区| 美女黄网久久| 性欧美8khd高清极品| 亚洲日本欧美| 免费看精品久久片| 久久动漫亚洲| 亚洲一二三区视频在线观看| 久久国产精品黑丝| 亚洲精品在线二区| 国产免费亚洲高清| 亚洲素人在线| 亚洲电影免费观看高清完整版在线观看 | 99热精品在线观看| 很黄很黄激情成人| 欧美午夜国产| 欧美国产在线电影| 久久精品在线播放| 亚洲在线免费| 99天天综合性| 最新高清无码专区| 噜噜噜91成人网| 久久精品国产欧美激情| 亚洲一二三四区| 99国产精品视频免费观看一公开| 尤物九九久久国产精品的特点| 国产精品毛片va一区二区三区 | 欧美国产欧美亚洲国产日韩mv天天看完整| 国产欧美日韩在线视频| 欧美精品1区2区| 免费成人高清在线视频| 久久精品91| 欧美影院在线| 亚洲欧美成人| 在线视频欧美日韩精品| 日韩天堂av| 夜夜嗨网站十八久久| 99精品国产热久久91蜜凸| 亚洲精品免费一区二区三区| 亚洲精品国精品久久99热一| 亚洲国产精品一区二区三区| 亚洲电影毛片| 亚洲人成毛片在线播放女女| 亚洲福利一区| 日韩视频免费在线观看| 99精品视频网| 在线视频亚洲| 亚洲一区二区三区激情| 亚洲欧美日韩在线播放| 小辣椒精品导航| 久久精品国产77777蜜臀| 久久久国产亚洲精品| 男女激情久久| 欧美精品久久久久久久久久| 欧美日韩国产丝袜另类| 国产精品成人一区二区网站软件 | 亚洲欧洲在线观看| 日韩视频在线一区| 亚洲图片欧美一区| 欧美一区二区精品| 久久视频在线免费观看| 欧美电影免费观看高清| 欧美日本韩国在线| 国产精品午夜电影| 伊人夜夜躁av伊人久久| 亚洲美女在线观看| 午夜精品久久久久久久白皮肤| 久久久久国产精品一区| 欧美成人一区二区| 亚洲免费观看高清完整版在线观看熊 | 欧美日韩一区二| 欧美日韩亚洲在线| 国产精品天天看| 尤物在线精品| 一区二区三区成人| 性欧美办公室18xxxxhd| 美女视频黄 久久| 亚洲美女色禁图| 伊人久久亚洲美女图片| 国产亚洲精品久| 亚洲国产欧美一区二区三区丁香婷| 亚洲人成网站在线播| 亚洲欧美日韩综合aⅴ视频| 久久成人精品电影| 亚洲国产第一| 欧美人妖另类| 国产精品日本| 最新成人av在线| 欧美一区二区精品久久911| 欧美成人按摩| 亚洲永久精品国产| 免费成人小视频| 国产日本欧洲亚洲| 亚洲另类在线一区| 久久精品99无色码中文字幕 | 国产精品久久九九| 激情成人综合网| 亚洲视频综合在线| 亚洲激情欧美| 久久精品天堂| 一区二区三区久久网| 欧美成人激情视频| 欧美电影电视剧在线观看|