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

不會(huì)飛的鳥

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

linux c 一個(gè)autotools的最簡單例子

  1、準(zhǔn)備:
     

   需要工具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的輸入文件,所以必須先生成該文件。
    執(zhí)行命令:
[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為當(dāng)前版本, BUG-REPORT-ADDRESS為bug匯報(bào)地址
    添加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、執(zhí)行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選項(xiàng)自動(dòng)生成,所以這里只需要建立如下文件
[root@localhost str]# touch NEWS README AUTHORS ChangeLog

8、執(zhí)行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、執(zhí)行測試:


      
執(zhí)行./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
執(zhí)行 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
'
執(zhí)行 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"

到此結(jié)束!!



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

添加測試包:
[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; }; }

添加一個(gè)支持子目錄、靜態(tài)庫、自定義configure選項(xiàng)的包

支持子目錄Makefile.am 選項(xiàng) SUBDIR =
#Automake interface 
SUBDIRS = src
支持靜態(tài)庫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 選項(xiàng),見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 不會(huì)飛的鳥 閱讀(2040) 評(píng)論(1)  編輯 收藏 引用

評(píng)論

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

講解詳細(xì)到位,很有實(shí)用價(jià)值,能不能寫一篇關(guān)于Makefile.am內(nèi)容編寫的帖子,那就太感謝了  回復(fù)  更多評(píng)論   


只有注冊用戶登錄后才能發(fā)表評(píng)論。
網(wǎng)站導(dǎo)航: 博客園   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>
            亚洲精品久久久久久久久久久| 99热在线精品观看| 性欧美8khd高清极品| 黄色免费成人| 91久久精品国产91久久性色tv| 欧美午夜电影在线观看| 午夜精品久久久久影视| 久久综合给合| 久久激情五月丁香伊人| 蜜臀av国产精品久久久久| 欧美激情精品久久久久久| 久久伊人精品天天| 国产欧美日韩视频| 亚洲中字黄色| 亚洲小说欧美另类婷婷| 欧美日韩国产片| 亚洲精品国久久99热| 亚洲破处大片| 欧美激情一区二区三区| 美女国产精品| 国内精品视频在线观看| 亚洲欧美日韩精品久久亚洲区| 91久久精品国产91性色| 亚洲综合精品四区| 久久精品国产久精国产思思| 国产婷婷色一区二区三区| 久久精品91| 亚洲第一色中文字幕| 亚洲精品永久免费精品| 国产精品乱码人人做人人爱| 国产亚洲激情在线| 久久免费99精品久久久久久| 蜜桃av综合| 日韩视频一区二区三区| 欧美四级在线观看| 午夜精品久久久久久久久久久久 | 亚洲成人原创| 久久一日本道色综合久久| 久久裸体艺术| 一级日韩一区在线观看| 国产日韩欧美综合在线| 欧美精品v国产精品v日韩精品| 在线亚洲精品| 欧美福利在线| 欧美一区二区福利在线| 伊人久久噜噜噜躁狠狠躁| 久久综合色影院| 亚洲欧美日韩在线一区| 999在线观看精品免费不卡网站| 亚洲视频狠狠| 农村妇女精品| 午夜精品一区二区三区四区 | 99精品热视频只有精品10| 日韩一级在线观看| 久久国产精品99国产精| 欧美日韩精品是欧美日韩精品| 国产精品视频久久久| 一级日韩一区在线观看| 久久视频精品在线| 亚洲午夜精品在线| 欧美大片18| 亚洲电影欧美电影有声小说| 香蕉久久夜色精品| 亚洲最新合集| 欧美日韩伦理在线免费| 日韩五码在线| 亚洲国产精品视频| 美女网站久久| 99riav国产精品| 亚洲区一区二区三区| 欧美在线播放高清精品| 国产精品久在线观看| 亚洲经典三级| 午夜久久资源| 欧美影院在线播放| 国产精品香蕉在线观看| 欧美亚洲一区二区三区| 欧美一区二区三区的| 国内成+人亚洲| 久久免费视频这里只有精品| 一区二区三区国产| 国产精品美女主播在线观看纯欲| 国产精品v欧美精品v日韩 | 亚洲美女在线国产| 美日韩在线观看| 欧美国产日韩视频| 亚洲欧美另类综合偷拍| 久久久久国产精品一区| 免费观看在线综合| 韩国精品在线观看| 亚洲精品国产日韩| 国产九区一区在线| 久久久久国产精品厨房| 欧美日韩亚洲国产精品| 久久久综合香蕉尹人综合网| 欧美日韩国产片| 亚洲第一福利在线观看| 国内视频一区| 亚洲欧美激情诱惑| 99成人免费视频| 欧美成人一品| 亚洲国产成人av好男人在线观看| 国产精品欧美精品| 亚洲一区中文| 亚洲一级在线观看| 欧美成人嫩草网站| 欧美大片在线看免费观看| 极品少妇一区二区三区精品视频 | 欧美精品日韩三级| 久久综合影音| 亚洲福利视频网站| 久久国产精品99久久久久久老狼 | 亚洲国产精品va| 亚洲人在线视频| 久久琪琪电影院| 日韩视频欧美视频| 亚洲视频久久| 国产精品一区视频网站| 欧美一区=区| 欧美高潮视频| 亚洲午夜国产一区99re久久| 国产精品一区二区三区乱码| 欧美一区二区三区另类| 欧美黄色小视频| 亚洲免费精彩视频| 国产精品乱人伦一区二区| 久久国产精品久久久久久久久久 | 亚洲视屏一区| 国产一区二区高清不卡| 你懂的成人av| 午夜免费日韩视频| 最新成人av在线| 久久久国产精品一区二区三区| 亚洲成人在线视频播放| 欧美少妇一区二区| 久久先锋影音| 亚洲免费观看高清完整版在线观看熊 | av成人免费| 国产夜色精品一区二区av| 欧美大片在线观看| 久久国产欧美精品| 亚洲视频一区二区| 亚洲日本成人| 欧美福利视频一区| 亚洲女ⅴideoshd黑人| 亚洲九九九在线观看| 国产亚洲一区精品| 国产精品多人| 国产精品日韩电影| 国产精品久久久一区麻豆最新章节| 蜜桃av一区二区在线观看| 欧美一区二区三区四区在线观看地址 | 欧美在线播放高清精品| 99re6这里只有精品| 伊人激情综合| 久久九九免费| 久久综合精品一区| 亚洲欧美日韩天堂| 亚洲欧美日韩国产一区二区| 亚洲欧美清纯在线制服| 最新国产拍偷乱拍精品| 亚洲国产视频直播| 一本久久综合| 午夜综合激情| 久久精品一区二区三区中文字幕 | 亚洲专区国产精品| 一本久道久久综合狠狠爱| 一区二区三区你懂的| 先锋影音久久| 欧美激情女人20p| 另类图片国产| aa级大片欧美| 欧美一级久久久| 免播放器亚洲| 欧美日韩视频在线一区二区观看视频 | 亚洲国产精品尤物yw在线观看| 麻豆亚洲精品| 欧美与欧洲交xxxx免费观看 | 亚洲高清免费在线| 亚洲片在线观看| 亚洲欧美日韩电影| 亚洲欧洲日本mm| 久久久久国产一区二区三区四区 | 欧美日韩亚洲不卡| 国产亚洲a∨片在线观看| 亚洲欧洲精品一区二区三区不卡 | 欧美国产日韩亚洲一区| 国产毛片一区二区| 亚洲高清资源| 亚洲欧美视频在线观看| 亚洲第一中文字幕| 久久亚洲美女| 亚洲欧洲日产国码二区| 久久精品国产亚洲一区二区| 99精品国产99久久久久久福利| 国产精品一区二区久久| 久久噜噜噜精品国产亚洲综合 | 午夜欧美大片免费观看| 日韩亚洲一区二区| 国产精品久久久久7777婷婷|