當前位置:編程學習大全網 - 源碼下載 - 寫好makefile,am和configure,ac後執行automake為什麽生成的是autom4te,cache文件

寫好makefile,am和configure,ac後執行automake為什麽生成的是autom4te,cache文件

###***如果妳在m-net沒有Linux賬戶,可以輸入newuser建立壹個壹、編寫壹個hello.c的源代碼文檔:$ mkdir ~/abc$ cd ~/abc$ touch hello.c$ vi hello.c# include "stdio.h"int main(int argc, char** argv){printf("Hello, GNU! ");return 0;}二、 生成configure.scan並編輯為configure.in:$ autoscan → cp configure.scan configure.in→vi configure.in →###***原始的configure.in文檔:# -*- Autoconf -*-# Process this file with autoconf to produce a configure script.AC_PREREQ(2.61) ←AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS) ←AC_CONFIG_SRCDIR([hello.c])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 ←----------------------------------------------------------------------------------------------------------------------###***修改後的configure.in文檔:# -*- Autoconf -*-# Process this file with autoconf to produce a configure script.#AC_PREREQ(2.61) →###***使用aclocal19命令會報錯:###***configure.in:4: error: Autoconf version 2.61 or higher is required###***configure.in:4: the top level###***autom4te259: /usr/local/bin/gm4 failed with exit status: 63###***aclocal19: autom4te259 failed with exit status: 63###***將上面的代碼註釋掉即可排除錯誤AC_INIT(hello.c)AC_CONFIG_SRCDIR([hello.c])AC_CONFIG_HEADER([config.h])AC_CONFIG_FILES([Makefile]) AM_INIT_AUTOMAKE(hello, 1.0)# 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 (Makefile)三、 使用aclocal和autoconf生成aclocal.m4和configure文件:$ aclocal119 → autoconf →touch Makefile.am →# -*- Makefile.am -*-AUTOMAKE_OPTIONS= foreignbin_PROGRAMS= hellohello_SOURCES= hello.c 四、 使用autoheader$ autoheader →五、 使用automake生成Makefile.in文件:$ automake19 --add-missing六、 使用configure生成最終Makefile:$ ./configure --prefix=/home/XXX/hello →checking for gcc... gccchecking for C compiler default output file name... a.outchecking whether the C compiler works... yeschecking whether we are cross compiling... nochecking for suffix of executables...checking for suffix of object files... ochecking whether we are using the GNU C compiler... yeschecking whether gcc accepts -g... yeschecking for gcc option to accept ISO C89... none neededconfigure: creating ./config.statusconfig.status: creating config.h./configure: line 3448: Makefile: command not found ###***configure出現錯誤,按提示修改configure文件:$ vi ./configure →###*** 原始的configure文檔內容:###*** 3444 # Use , not &&, to avoid exiting from the if with $? = 1, which###*** 3445# would make configure fail if this is the last instruction.###*** 3446$ac_cs_success { (exit 1); exit 1; }###*** 3447fi###*** 3448(Makefile) ←--------------------------------------------------------------------------------------------------------------------------###***修改後的configure文檔內容:###*** 3448# (Makefile)###*** 將3448行的代碼註釋掉即可。七、 最終make前用ls檢查文件:$ ls →Makefile config.h configure.scanMakefile.am config.h.in depcompMakefile.in config.log hello.caclocal.m4 config.status install-shautom4te.cache configure missingautoscan-2.61.log configure.in stamp-h1八、 開始編譯並運行測試:$ Make$ Make install$ ~/hello/bin/helloHello, GNU! [XXXX@m-net ~/abc]$

  • 上一篇:小貓小學作文
  • 下一篇:我想在淘寶買5610,應該註意些什麽?請好心人幫壹下。。
  • copyright 2024編程學習大全網