2

I am following https://robots.thoughtbot.com/the-magic-behind-configure-make-make-install to learn how to use autoconf and automake to create the configure script and Makefile.

Below is the content of configure.ac file:

AC_INIT ([helloworld], [0.1], [someone@nowhere.com])
AM_INIT_AUTOMAKE
AC_PROG_CC
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

However, when I run aclocal command, I get the following error.

user $ aclocal
configure.ac:2: error: AC_INIT should be called with package and version arguments
/usr/share/aclocal-1.14/init.m4:29: AM_INIT_AUTOMAKE is expanded from...
configure.ac:2: the top level
autom4te: /usr/bin/m4 failed with exit status: 1
aclocal: error: echo failed with exit status: 1
user $ 

I did google search to see if line AC_INIT ([helloworld], [0.1], [someone@nowhere.com]) was incorrect. But it looks like it is correct way to use AC_INIT.

How do I fix this ?

Also, below is the content of Makefile.am file (if this is related to the error):

AUTOMAKE_OPTIONS = foreign
bin_PROGRAMS = helloworld
helloworld_SOURCES = hello.c
sps
  • 457

1 Answers1

3

It appears to be just a matter of whitespace: according to 3.1.2 The Autoconf Language from the Autoconf Manual:

When calling macros that take arguments, there must not be any white space between the macro name and the open parenthesis.

 AC_INIT ([oops], [1.0]) # incorrect
 AC_INIT([hello], [1.0]) # good

So you need to change

AC_INIT ([helloworld], [0.1], [someone@nowhere.com])

to

AC_INIT([helloworld], [0.1], [someone@nowhere.com])
steeldriver
  • 142,475