cygwin-autoconf环境搭建
博客专区 > jeffsui 的博客 > 博客详情
cygwin-autoconf环境搭建
jeffsui 发表于3年前
cygwin-autoconf环境搭建
  • 发表于 3年前
  • 阅读 106
  • 收藏 0
  • 点赞 0
  • 评论 0

腾讯云 技术升级10大核心产品年终让利>>>   

摘要: cygwin-autoconf环境搭建

#autoconf、automake简介 请参考之前的博文 Linux下autoconf和automake使用

#autoconf安装

选择autoconf

#遇到的问题 *Can't locate Autom4te/ChannelDefs.pm in @INC 解决方法:重装autoconf

*Can’t locate ExtUtils/MakeMaker.pm in @INC 解决方法:安装CPAN <code><pre> cd /root wget http://files.directadmin.com/services/9.0/ExtUtils-MakeMaker-6.31.tar.gz tar xvzf ExtUtils-MakeMaker-6.31.tar.gz cd ExtUtils-MakeMaker-6.31 perl Makefile.PL make make install </code></pre>

*-bash: make: 未找到命令 解决方法:默认cygwin未安装make,选择package的时候,下面可以看到Devel(开发)目录,展开,选择make那些即可

#autoconf、automake简单使用

1.建立一个工程目录结构 > devel |-- hello |-- hello.c

2.编写hello.c

<code><pre> #include <stdio.h> int main(int argc,char** argv) { printf("Hello,GNU!n"); return 0; } </code></pre> 3.建立完毕 <code><pre> Administrator@jeff-PC /cygdrive/d/code/bash_script/devel/hello $ ls autoscan-2.69.log configure.scan hello.c </code></pre>

4.执行autoscan命令、ls命令

autoconf ls 显示如下: <code><pre> Administrator@jeff-PC /cygdrive/d/code/bash_script/devel/hello $ ls autoscan-2.69.log configure.scan hello.c Makefile.am </code></pre>

5.重命名configure.scan为__configure.ac__

6.修改configure.in文件如下 <code><pre> # Process this file with autoconf to produce a configure script.

AC_PREREQ([2.69]) AC_INIT(hello.c) AM_INIT_AUTOMAKE(hello, 1.0, [pinghailinfeng79@gmail.com])

# 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(Makefile) </code></pre>

7.执行下面的命令 aclocal autoconf ls <code><pre> autom4te.cache configure configure.in~ Makefile.am autoscan-2.69.log configure.ac hello.c </code></pre> 8.执行autoheader ls <code><pre> autom4te.cache config.h.in configure.ac hello.c autoscan-2.69.log configure configure.in~ Makefile.am </code></pre> 9.建立Makefile.am <code><pre> AUTOMAKE_OPTIONS=foreign bin_PROGRAMS= hello hello_SOURCES= hello.c </code></pre>

10.执行下面的命令 automake --add-missing

命令行提示: <code><pre> configure.ac: error: no proper invocation of AM_INIT_AUTOMAKE was found. configure.ac: You should verify that configure.ac invokes AM_INIT_AUTOMAKE, configure.ac: that aclocal.m4 is present in the top-level directory, configure.ac: and that aclocal.m4 was recently regenerated (using aclocal) Makefile.am: installing './depcomp' /usr/share/automake-1.14/am/depend2.am: error: am__fastdepCC does not appear in AM_CONDITIONAL /usr/share/automake-1.14/am/depend2.am: The usual way to define 'am__fastdepCC' is to add 'AC_PROG_CC' /usr/share/automake-1.14/am/depend2.am: to 'configure.ac' and run 'aclocal' and 'autoconf' again /usr/share/automake-1.14/am/depend2.am: error: AMDEP does not appear in AM_CONDITIONAL /usr/share/automake-1.14/am/depend2.am: The usual way to define 'AMDEP' is to add one of the compiler tests /usr/share/automake-1.14/am/depend2.am: AC_PROG_CC, AC_PROG_CXX, AC_PROG_OBJC, AC_PROG_OBJCXX, /usr/share/automake-1.14/am/depend2.am: AM_PROG_AS, AM_PROG_GCJ, AM_PROG_UPC /usr/share/automake-1.14/am/depend2.am: to 'configure.ac' and run 'aclocal' and 'autoconf' again </code></pre>

11.执行./configure <code><pre> checking for gcc... gcc checking whether the C compiler works... yes checking for C compiler default output file name... a.exe checking for suffix of executables... .exe checking whether we are cross compiling... no 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 ISO C89... none needed configure: creating ./config.status config.status: creating Makefile config.status: creating config.h </code></pre>

12.执行make 最终出现hello字样,编译成功

13.执行./hello hello GNU!

这算是automake的入门教程,遇到的问题已经在前面说明了。顺便祝大家春节快乐!

标签: autoconf automake
共有 人打赏支持
粉丝 292
博文 262
码字总数 73809
×
jeffsui
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: