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

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>
            中文日韩在线视频| 国产一区视频观看| 亚洲麻豆国产自偷在线| 91久久精品美女| 欧美二区在线看| 亚洲视频精选| 欧美亚洲免费电影| 尤物精品在线| 亚洲精品欧美在线| 国产精品蜜臀在线观看| 久久一区中文字幕| 免费久久99精品国产自| 亚洲一区二区三区乱码aⅴ蜜桃女| 亚洲午夜激情免费视频| 国内综合精品午夜久久资源| 亚洲国产精品99久久久久久久久| 欧美日韩在线观看一区二区| 久久精品国产综合精品| 裸体女人亚洲精品一区| 亚洲网址在线| 久久久久久欧美| 这里只有精品在线播放| 久久国产免费| 亚洲一区美女视频在线观看免费| 久久精品国产v日韩v亚洲| 亚洲天堂黄色| 久久综合狠狠| 欧美一区二区三区免费观看视频| 欧美99在线视频观看| 性欧美videos另类喷潮| 欧美国产视频在线观看| 久久精品国产久精国产一老狼| 欧美精品久久久久久久| 久久日韩粉嫩一区二区三区| 欧美日韩在线一区二区三区| 免费观看国产成人| 国产日韩欧美一区二区三区在线观看| 亚洲激情偷拍| 亚洲第一在线综合在线| 欧美一区成人| 亚洲欧美色婷婷| 欧美日韩精品一区二区在线播放| 另类国产ts人妖高潮视频| 国产精品一区二区三区乱码| 亚洲精品日本| 亚洲精品一区二区三区在线观看| 久久狠狠亚洲综合| 欧美在线在线| 国产欧美视频一区二区| 在线一区二区日韩| 日韩亚洲一区在线播放| 欧美 日韩 国产 一区| 久久一区二区三区超碰国产精品| 国产日本欧美一区二区三区| 亚洲网址在线| 亚洲综合大片69999| 欧美日本一区二区高清播放视频| 欧美激情第8页| 亚洲国产精品一区制服丝袜| 久久亚洲综合网| 免费成人高清在线视频| 亚洲高清不卡av| 久久综合九色综合欧美就去吻| 久久久久国产精品一区| 国产亚洲综合在线| 久久国产精彩视频| 女人色偷偷aa久久天堂| 亚洲国产精品成人精品 | 亚洲欧美日韩直播| 国产精品免费观看在线| 中文精品视频一区二区在线观看| 亚洲一区欧美激情| 国产精品啊啊啊| 亚洲欧美国产日韩天堂区| 久久久精品网| 亚洲国产成人tv| 欧美极品欧美精品欧美视频| 亚洲精品免费在线播放| 亚洲一级黄色av| 国产亚洲精品高潮| 久久午夜影视| 亚洲美女av在线播放| 午夜精彩视频在线观看不卡| 国产亚洲一区在线| 欧美成人精品一区| 亚洲图片在线观看| 免费不卡在线观看av| 一区二区欧美日韩视频| 国产毛片一区| 免费久久99精品国产自在现线| 一本一本久久a久久精品综合妖精| 亚洲欧美在线一区二区| 激情欧美国产欧美| 欧美区高清在线| 午夜日韩激情| 亚洲人成网在线播放| 欧美影院在线播放| 91久久线看在观草草青青| 国产精品久久一区主播| 久久嫩草精品久久久精品| 9人人澡人人爽人人精品| 久久久青草青青国产亚洲免观| 日韩亚洲成人av在线| 国产一区二区三区奇米久涩| 欧美精品一区二区蜜臀亚洲| 午夜在线一区| 一区二区国产在线观看| 蜜桃久久av一区| 香蕉免费一区二区三区在线观看 | 亚洲日本成人| 国产日韩欧美不卡在线| 欧美日本在线| 免费不卡视频| 久久国产精品久久久久久久久久| 一区二区三区免费网站| 亚洲第一在线| 久热精品在线视频| 欧美在线一区二区| 中文高清一区| 日韩视频在线永久播放| 永久91嫩草亚洲精品人人| 国产欧美短视频| 国产精品www.| 欧美日韩亚洲一区二区三区在线观看 | 亚洲一区二区三区激情| 亚洲精品欧洲| 在线欧美日韩| 在线看片日韩| 亚洲第一精品电影| 国产亚洲福利社区一区| 国产精品丝袜久久久久久app| 欧美日韩亚洲网| 欧美日韩大片一区二区三区| 男男成人高潮片免费网站| 久久婷婷久久一区二区三区| 欧美一级免费视频| 欧美一区二区三区视频在线观看| 亚洲淫片在线视频| 在线视频亚洲| 亚洲主播在线播放| 亚洲欧美另类国产| 亚洲欧美变态国产另类| 午夜日韩在线观看| 午夜精彩国产免费不卡不顿大片| 亚洲中无吗在线| 久久xxxx精品视频| 久久久久久亚洲精品中文字幕| 久久成人18免费网站| 久久综合一区二区三区| 嫩草影视亚洲| 欧美日韩亚洲精品内裤| 国产精品每日更新| 国产性做久久久久久| 精久久久久久| 亚洲人久久久| 亚洲永久免费视频| 香蕉久久国产| 免费精品视频| 亚洲理论电影网| 亚洲欧美日韩精品综合在线观看| 欧美一区二区视频在线| 久久婷婷av| 欧美日韩中文| 国产一区视频在线观看免费| 亚洲黄色片网站| 中日韩视频在线观看| 久久gogo国模裸体人体| 欧美成年人网站| 亚洲视频大全| 久久久国产成人精品| 欧美精品一区二区三| 国产女人18毛片水18精品| 亚洲大片在线观看| 亚洲小少妇裸体bbw| 久久精品国产69国产精品亚洲| 欧美不卡高清| 一区二区三区国产| 久久久免费精品视频| 欧美日韩另类综合| 激情综合电影网| 亚洲永久在线观看| 欧美不卡视频| 亚洲欧美韩国| 欧美日韩国产精品自在自线| 国产一区二区三区网站| 中文日韩在线视频| 欧美激情亚洲| 欧美影院视频| 国产精品美女久久久浪潮软件| 91久久久久久久久| 久久精彩免费视频| 一本色道久久综合狠狠躁篇怎么玩 | 午夜精品久久久久久久久| 猫咪成人在线观看| 亚洲欧美日韩综合aⅴ视频| 欧美久久婷婷综合色| 亚洲成色www8888| 久久久精品999| 亚洲无限av看| 国产精品福利片|