免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 13525 | 回复: 2
打印 上一主题 下一主题

autotools的疑问:出现警告和不能产生aclocal.m4.已解决! [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-07-18 00:20 |只看该作者 |倒序浏览
今天试着使用automake来产生MAKEFILE文件,但是出现了一下问题,还望各位能指点一二,谢谢!
本人系统是FC4.

问题一:autoscan出现错误警告,不知为何,但是看网上很多相关教程都没有解释,但是照样能产生configure.scan,警告如下:
[yufei@localhost automake_test]$ autoscan
autom4te: configure.ac: no such file or directory
autoscan: /usr/bin/autom4te failed with exit status: 1

问题二:整个过程如下:
[yufei@localhost automake_test]$ ls -l
总用量 8
-rw-rw-r--  1 yufei yufei   0  7月 17 21:40 autoscan.log
-rw-rw-r--  1 yufei yufei 462  7月 17 21:40 configure.scan
-rw-rw-r--  1 yufei yufei 100  7月 17 21:39 helloworld.c
[yufei@localhost automake_test]$ mv configure.scan configure.in    //改名
[yufei@localhost automake_test]$ ls -l
总用量 8
-rw-rw-r--  1 yufei yufei   0  7月 18 00:13 autoscan.log
-rw-rw-r--  1 yufei yufei 462  7月 18 00:13 configure.in
-rwxrwxrwx  1 yufei yufei 100  7月 17 21:39 helloworld.c
[yufei@localhost automake_test]$ cat 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([helloworld.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
[yufei@localhost automake_test]$vi configure.in           //更改文件内容
[yufei@localhost automake_test]$ cat configure.in         //查看更改后的文件内容
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.59)
AC_INIT(helloworld,1.0,wwww@163.com)
AC_CONFIG_SRCDIR([helloworld.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(Makefile)
[yufei@localhost automake_test]$ aclocal                 //希望生成aclocal.m4和configure.in
/usr/share/aclocal/g-wrap.m4:7: warning: underquoted definition of AC_GWRAP_CHECK_GUILE
  run info '(automake)Extending aclocal'
  or see http://sources.redhat.com/automa ... l#Extending-aclocal
/usr/share/aclocal/g-wrap.m4:23: warning: underquoted definition of AM_PATH_GWRAP
/usr/share/aclocal/aqhbci.m4:5: warning: underquoted definition of AC_AQHBCI
/usr/share/aclocal/ao.m4:9: warning: underquoted definition of XIPH_PATH_AO
[yufei@localhost automake_test]$ ls -l
总用量 12
drwxr-xr-x  2 yufei yufei 4096  7月 18 00:17 autom4te.cache
-rw-rw-r--  1 yufei yufei    0  7月 18 00:13 autoscan.log
-rw-rw-r--  1 yufei yufei  453  7月 18 00:16 configure.in
-rwxrwxrwx  1 yufei yufei  100  7月 17 21:39 helloworld.c
[yufei@localhost automake_test]$                        //问题就出现在这里,没有出现aclocal.m4,并且在
aclocal的时候出来了很多警告,还望高手指点一下,再次感谢!

[ 本帖最后由 neobob 于 2006-7-19 00:44 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2006-07-18 13:07 |只看该作者

回复 1楼 neobob 的帖子

顶一下!
问题一也就罢了,我慢慢研究。
问题二大家帮我看看,我的根本不能出现预期结果,也就是产生aclocal.m4文件,高人帮忙指点下,我能参考的都参考了,还是没找到解决办法,难道是我软件的版本问题?不应该啊。再次感谢!

论坛徽章:
0
3 [报告]
发表于 2006-07-19 00:40 |只看该作者
已解决,但是还有问题期待高手能够解答!

aclocal.m4不能产生,根据实验发现是configure.in没有写好的缘故!!!
以下过程在FC4和FC5中测试通过,但是不知为何在FC4中施用aclocal时有警告出现,但最终没有影响结果.
FC4中使用autoscan和aclocal时都有警告信息出现.
FC5中使用autoscan有警告,aclocal无警告.  期待高手解答!!!
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
创建src和include目录:
[yufei@localhost str-0.0.1]$ cd include
[yufei@localhost include]$ dir
str.h
[yufei@localhost include]$ cat str.h
#include <stdio.h>
int str(char *string);
---------------------------------------------------------------------------
[yufei@localhost include]$ cd ../src
[yufei@localhost src]$ dir
str.c
[yufei@localhost src]$ cat 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 );
}
[yufei@localhost src]$
--------------------------------------------------------------------------------------->
[root@localhost str-0.0.1]# clear
[root@localhost str-0.0.1]# ls -l
总计 8
drwxrwxrwx 2 yufei yufei 4096 03-30 16:20 include
drwxrwxrwx 2 yufei yufei 4096 07-18 13:47 src
[root@localhost str-0.0.1]# autoscan
autom4te: configure.ac: no such file or directory
autoscan: /usr/bin/autom4te failed with exit status: 1
[root@localhost str-0.0.1]# ls -l
总计 12
-rw-r--r-- 1 root  root     0 07-18 22:42 autoscan.log
-rw-r--r-- 1 root  root   459 07-18 22:42 configure.scan
drwxrwxrwx 2 yufei yufei 4096 03-30 16:20 include
drwxrwxrwx 2 yufei yufei 4096 07-18 13:47 src
[root@localhost str-0.0.1]# mv configure.scan configure.in
[root@localhost str-0.0.1]# vi configure.in
[root@localhost str-0.0.1]# cat configure.in
#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.59)
AC_INIT(src,0.0.1,[test@stu.edu.cn])
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([src/str.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_CONFIG_FILES([Makefile])
AC_OUTPUT
[root@localhost str-0.0.1]# aclocal
[root@localhost str-0.0.1]# ls -l
总计 48
-rw-r--r-- 1 root  root  31120 07-18 22:44 aclocal.m4
drwxr-xr-x 2 root  root   4096 07-18 22:44 autom4te.cache
-rw-r--r-- 1 root  root      0 07-18 22:42 autoscan.log
-rw-r--r-- 1 root  root    485 07-18 22:44 configure.in
drwxrwxrwx 2 yufei yufei  4096 03-30 16:20 include
drwxrwxrwx 2 yufei yufei  4096 07-18 13:47 src
[root@localhost str-0.0.1]# autoconf
[root@localhost str-0.0.1]# ls -l
总计 180
-rw-r--r-- 1 root  root   31120 07-18 22:44 aclocal.m4
drwxr-xr-x 2 root  root    4096 07-18 22:45 autom4te.cache
-rw-r--r-- 1 root  root       0 07-18 22:42 autoscan.log
-rwxr-xr-x 1 root  root  129914 07-18 22:45 configure
-rw-r--r-- 1 root  root     485 07-18 22:44 configure.in
drwxrwxrwx 2 yufei yufei   4096 03-30 16:20 include
drwxrwxrwx 2 yufei yufei   4096 07-18 13:47 src
[root@localhost str-0.0.1]# vi Makefile.am

制作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/
产生config.h.in
[root@localhost str-0.0.1]# autoheader
[root@localhost str-0.0.1]# ls -l
总计 188
-rw-r--r-- 1 root  root   31120 07-18 22:44 aclocal.m4
drwxr-xr-x 2 root  root    4096 07-18 22:45 autom4te.cache
-rw-r--r-- 1 root  root       0 07-18 22:42 autoscan.log
-rw-r--r-- 1 root  root     557 07-18 22:45 config.h.in
-rwxr-xr-x 1 root  root  129914 07-18 22:45 configure
-rw-r--r-- 1 root  root     485 07-18 22:44 configure.in
drwxrwxrwx 2 yufei yufei   4096 03-30 16:20 include
-rw-r--r-- 1 root  root     107 07-18 22:45 Makefile.am
drwxrwxrwx 2 yufei yufei   4096 07-18 13:47 src

automake必须文件:
CODE:
    *  install-sh
    * missing
    * INSTALL
    * NEWS
    * README
    * AUTHORS
    * ChangeLog
    * COPYING
    * depcomp
其中
    * install-sh
    * missing
    * INSTALL
    * COPYING
    * depcomp
可以通过automake -a选项自动生成,所以这里只需要建立如下文件NEWS README AUTHORS ChangeLog

[root@localhost str-0.0.1]# automake -a
configure.in: installing `./install-sh'
configure.in: installing `./missing'
Makefile.am: installing `./INSTALL'
Makefile.am: required file `./NEWS' not found
Makefile.am: required file `./README' not found
Makefile.am: required file `./AUTHORS' not found
Makefile.am: required file `./ChangeLog' not found
Makefile.am: installing `./COPYING'
Makefile.am: installing `./compile'
Makefile.am: installing `./depcomp'
[root@localhost str-0.0.1]# ls -l
总计 188
-rw-r--r-- 1 root  root   31120 07-18 22:44 aclocal.m4
drwxr-xr-x 2 root  root    4096 07-18 22:46 autom4te.cache
-rw-r--r-- 1 root  root       0 07-18 22:42 autoscan.log
lrwxrwxrwx 1 root  root      31 07-18 22:46 compile -> /usr/share/automake-1.9/compile
-rw-r--r-- 1 root  root     557 07-18 22:45 config.h.in
-rwxr-xr-x 1 root  root  129914 07-18 22:45 configure
-rw-r--r-- 1 root  root     485 07-18 22:44 configure.in
lrwxrwxrwx 1 root  root      31 07-18 22:46 COPYING -> /usr/share/automake-1.9/COPYING
lrwxrwxrwx 1 root  root      31 07-18 22:46 depcomp -> /usr/share/automake-1.9/depcomp
drwxrwxrwx 2 yufei yufei   4096 03-30 16:20 include
lrwxrwxrwx 1 root  root      31 07-18 22:46 INSTALL -> /usr/share/automake-1.9/INSTALL
lrwxrwxrwx 1 root  root      34 07-18 22:46 install-sh -> /usr/share/automake-1.9/install-sh
-rw-r--r-- 1 root  root     107 07-18 22:45 Makefile.am
lrwxrwxrwx 1 root  root      31 07-18 22:46 missing -> /usr/share/automake-1.9/missing
drwxrwxrwx 2 yufei yufei   4096 07-18 13:47 src
[root@localhost str-0.0.1]# touch NEWS README AUTHORS ChangeLog
[root@localhost str-0.0.1]# automake -a
[root@localhost str-0.0.1]# ls -l
总计 208
-rw-r--r-- 1 root  root   31120 07-18 22:44 aclocal.m4
-rw-r--r-- 1 root  root       0 07-18 22:46 AUTHORS
drwxr-xr-x 2 root  root    4096 07-18 22:46 autom4te.cache
-rw-r--r-- 1 root  root       0 07-18 22:42 autoscan.log
-rw-r--r-- 1 root  root       0 07-18 22:46 ChangeLog
lrwxrwxrwx 1 root  root      31 07-18 22:46 compile -> /usr/share/automake-1.9/compile
-rw-r--r-- 1 root  root     557 07-18 22:45 config.h.in
-rwxr-xr-x 1 root  root  129914 07-18 22:45 configure
-rw-r--r-- 1 root  root     485 07-18 22:44 configure.in
lrwxrwxrwx 1 root  root      31 07-18 22:46 COPYING -> /usr/share/automake-1.9/COPYING
lrwxrwxrwx 1 root  root      31 07-18 22:46 depcomp -> /usr/share/automake-1.9/depcomp
drwxrwxrwx 2 yufei yufei   4096 03-30 16:20 include
lrwxrwxrwx 1 root  root      31 07-18 22:46 INSTALL -> /usr/share/automake-1.9/INSTALL
lrwxrwxrwx 1 root  root      34 07-18 22:46 install-sh -> /usr/share/automake-1.9/install-sh
-rw-r--r-- 1 root  root     107 07-18 22:45 Makefile.am
-rw-r--r-- 1 root  root   18798 07-18 22:46 Makefile.in
lrwxrwxrwx 1 root  root      31 07-18 22:46 missing -> /usr/share/automake-1.9/missing
-rw-r--r-- 1 root  root       0 07-18 22:46 NEWS
-rw-r--r-- 1 root  root       0 07-18 22:46 README
drwxrwxrwx 2 yufei yufei   4096 07-18 13:47 src
[root@localhost str-0.0.1]# ./configure
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: executing depfiles commands

下面make的时候如果出现提示说"Makefile:xxx:遗漏分割符",是Makefile.am的问题,查看其格式是否正确.
[root@localhost str-0.0.1]# make
make  all-am
make[1]: Entering directory `/home/yufei/str-0.0.1'
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 `/home/yufei/str-0.0.1'
[root@localhost str-0.0.1]# make install
make[1]: Entering directory `/home/yufei/str-0.0.1'
test -z "/usr/local/bin" || mkdir -p -- "/usr/local/bin"
  /usr/bin/install -c 'str' '/usr/local/bin/str'
make[1]: Nothing to be done for `install-data-am'.
make[1]: Leaving directory `/home/yufei/str-0.0.1'
查看安装后的程序,安装到了/usr/local/bin目录中:
[root@localhost str-0.0.1]# /usr/local/bin/str
Please INPUT something end by [ENTER]
dsfs

----PRINT STRING----
"dsfs"
#########################################################################################
参考于http://abc.sounos.org:81/Tools/doc/autotoolshowto.html.

[ 本帖最后由 neobob 于 2006-7-19 00:42 编辑 ]
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP