`configure.ac`文件给出错误

时间:2014-03-07 10:02:45

标签: c linux ubuntu autotools automake

我正在创建一个学习autotools的玩具示例。我创建了以下文件。 configure.ac

AC_INIT([hello], [0.01])

# safety check -list a source file that wouldn't be in other directories :                                                          
AC_CONFIG_SRCDIR([hello.c])

# Put configuration results here so that we can easily #include them                                                                
AC_CONFIG_HEADERS([config.h])

# Put autotools aux files in a subdir . so they don't clutter top dir :                                                             
AC_CONFIG_AUX_DIR([build-aux])

# Enable "automake" to simplify creating makefiles :                                                                                
AM_INIT_AUTOMAKE([1.11 -Wall -Werror]
AC_CONFIG_FILES([Makefile])

#look for a C compiler :                                                                                                            
AC_PROG_CC

# Do final output                                                                                                                   
AC_OUTPUT

Makefile.am

bin_PROGRAMS = hello
hello_SOURCES = hello.c

hello.c

#include <stdio.h>
int main()
{ 
   printf("hello world!\n") ;
   return 0 ; 
}   

然后我在终端中做了autoreconf -i,但我得到以下内容:

configure.ac:1: error: m4_init: unbalanced m4_divert_push:
configure.ac:17: m4_divert_push: GROW
configure.ac:1: m4_divert: BODY
../../lib/autoconf/c.m4:448: AC_PROG_CC is expanded from...
configure.ac:1: the top level
autom4te: /usr/bin/m4 failed with exit status: 1
aclocal: autom4te failed with exit status: 1
autoreconf: aclocal failed with exit status: 1

这些错误是什么,我该如何解决?

1 个答案:

答案 0 :(得分:1)

AM_INIT_AUTOMAKE([1.11 -Wall -Werror]

缺少)。不确定这是typo