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

isware

[轉(zhuǎn)]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)自動生成,所以這里只需要建立如下文件
[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 2011-05-31 11:42 艾斯維亞 閱讀(316) 評論(0)  編輯 收藏 引用


只有注冊用戶登錄后才能發(fā)表評論。
網(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>
            欧美电影打屁股sp| 在线中文字幕一区| 久久久精品一区| 久久动漫亚洲| 永久久久久久| 亚洲国产精品va在线看黑人| 欧美成人激情在线| 一区二区三区久久| 亚洲影视在线| 亚洲国产精品久久精品怡红院| 亚洲国产综合在线| 国产精品高精视频免费| 久久精选视频| 欧美理论电影在线观看| 午夜欧美不卡精品aaaaa| 欧美在线一二三区| 99re66热这里只有精品3直播| 亚洲性视频网站| 激情文学一区| 日韩一级视频免费观看在线| 国产欧美日韩在线观看| 欧美激情综合色| 国产精品啊啊啊| 欧美国产日韩一区| 国产精品综合不卡av| 欧美高清视频一区| 国产乱码精品一区二区三| 欧美国产精品va在线观看| 国产精品a级| 亚洲第一免费播放区| 欧美日韩一区三区| 欧美福利网址| 国产亚洲精品福利| 国产精品99久久99久久久二8| 在线免费观看成人网| 亚洲天堂网在线观看| 亚洲激情偷拍| 久久精品视频播放| 性做久久久久久久免费看| 欧美国产成人在线| 久久婷婷av| 国产视频不卡| 亚洲欧美激情在线视频| 一本色道久久加勒比精品| 久久看片网站| 久久久久国产精品午夜一区| 国产精品久久久久久超碰| 亚洲激情在线视频| 在线欧美亚洲| 久久免费精品视频| 久久久久久亚洲精品不卡4k岛国| 国产精品伦一区| avtt综合网| 一本久久青青| 欧美日本中文| 亚洲精品欧美日韩专区| 亚洲国内欧美| 欧美3dxxxxhd| 亚洲大片av| 亚洲免费成人av电影| 免费永久网站黄欧美| 欧美h视频在线| 亚洲成人在线| 欧美成人亚洲| 亚洲精品久久久一区二区三区| 91久久久在线| 欧美激情无毛| 日韩午夜在线视频| 亚洲永久在线| 国产一区二区三区不卡在线观看| 欧美一区二区三区免费视| 久久精品视频免费观看| 国内自拍一区| 美女视频黄免费的久久| 亚洲国产一区二区三区a毛片| 亚洲人成在线观看一区二区| 欧美激情视频网站| 99国内精品久久久久久久软件| 亚洲免费在线播放| 国产一区二区三区电影在线观看| 久久国产欧美精品| 亚洲第一区在线观看| 一本色道久久99精品综合| 国产精品美女一区二区在线观看| 亚洲综合色在线| 麻豆成人在线播放| 日韩天天综合| 国产欧美成人| 久久影音先锋| 宅男噜噜噜66一区二区66| 久久狠狠婷婷| 亚洲日本激情| 国产精品午夜国产小视频| 欧美在线观看你懂的| 最近看过的日韩成人| 欧美亚洲视频一区二区| 在线观看中文字幕亚洲| 欧美日韩一区在线播放| 久久精品日韩一区二区三区| 91久久精品美女| 久久久久久9| 在线亚洲精品福利网址导航| 国产亚洲一区二区三区在线观看 | 99精品视频免费观看视频| 欧美有码在线视频| 亚洲久久一区| 国内精品视频在线观看| 欧美日韩成人在线| 久久精品亚洲精品国产欧美kt∨| 99国产精品久久久久久久成人热| 久久久久久久综合日本| 亚洲视频1区| 亚洲高清在线观看| 国产中文一区二区| 国产精品超碰97尤物18| 欧美成人午夜激情| 久久久国产精品亚洲一区| 亚洲一区二区三区在线观看视频| 亚洲高清毛片| 蜜桃精品久久久久久久免费影院| 亚洲欧美日本另类| 夜夜爽99久久国产综合精品女不卡| 国产真实久久| 国产区日韩欧美| 国产精品久久久久一区| 欧美日本高清视频| 欧美成人亚洲成人日韩成人| 久久久久久久久一区二区| 亚洲女爱视频在线| 亚洲午夜免费视频| 一本色道久久88精品综合| 亚洲国产专区校园欧美| 欧美激情bt| 欧美二区在线观看| 麻豆精品91| 免费欧美日韩| 欧美+亚洲+精品+三区| 巨乳诱惑日韩免费av| 久久精品噜噜噜成人av农村| 欧美一区亚洲一区| 欧美在线免费播放| 欧美在线精品一区| 久久激情视频免费观看| 久久久久国产一区二区| 久久九九全国免费精品观看| 久久精品国产69国产精品亚洲| 欧美一区二区三区免费观看| 欧美一二三区精品| 久久精品国产免费观看| 久久久久欧美| 欧美v亚洲v综合ⅴ国产v| 欧美α欧美αv大片| 欧美激情第三页| 亚洲精品国产系列| 99精品久久久| 午夜久久久久久| 久久久精品日韩| 欧美风情在线观看| 欧美日韩午夜剧场| 国产乱子伦一区二区三区国色天香| 国产欧美日韩中文字幕在线| 激情文学一区| 99这里只有精品| 欧美一区二区三区在线看| 久久婷婷久久| 亚洲精品网站在线播放gif| 亚洲一区三区视频在线观看| 久久国产精品99国产精| 欧美风情在线观看| 国产精品自拍网站| 亚洲国产日韩在线一区模特| 一区二区三区免费网站| 久久国产精品久久久久久| 欧美国产综合| 正在播放亚洲一区| 久久亚洲电影| 国产精品久久久久三级| 亚洲第一精品久久忘忧草社区| 日韩视频一区二区在线观看| 欧美有码在线观看视频| 亚洲国产cao| 午夜视频久久久| 欧美看片网站| 尤物精品国产第一福利三区 | 91久久夜色精品国产九色| 亚洲无人区一区| 蜜桃av噜噜一区二区三区| 999在线观看精品免费不卡网站| 欧美一区二区大片| 欧美日韩中文字幕综合视频| 精品电影在线观看| 亚洲欧美日韩国产中文在线| 欧美夫妇交换俱乐部在线观看| 亚洲在线观看视频网站| 欧美伦理91i| 亚洲国产99精品国自产| 久久久精品日韩欧美| 正在播放亚洲一区| 欧美日韩a区| 亚洲精品一区在线观看|