Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple "hello world" configure.ac fails to run

I'm following the documentation with an up to date automake (v1.12) but building still fails.

Here's my configure.ac:

AC_PREREQ([2.69])
AC_INIT([helloworld], [0.1], [[email protected]])
AC_INIT_AUTOMAKE([1.12 foreign no-define])
AC_CONFIG_SRCDIR([src/hello.c])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile])

# Checks for programs.
AC_PROG_CC([gcc cc])

# Checks for libraries.

# Checks for header files.

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.

AC_OUTPUT(src/Makefile)

Execution:

$ autoreconf
configure.ac:3: error: possibly undefined macro: AC_INIT_AUTOMAKE
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
autoreconf: /usr/bin/autoconf failed with exit status: 1

$ automake
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)
configure.ac:5: error: required file 'config.h.in' not found
/usr/share/automake-1.12/am/depend2.am: error: am__fastdepCC does not appear in AM_CONDITIONAL
/usr/share/automake-1.12/am/depend2.am:   The usual way to define 'am__fastdepCC' is to add 'AC_PROG_CC'
/usr/share/automake-1.12/am/depend2.am:   to 'configure.ac' and run 'aclocal' and 'autoconf' again
/usr/share/automake-1.12/am/depend2.am: error: AMDEP does not appear in AM_CONDITIONAL
/usr/share/automake-1.12/am/depend2.am:   The usual way to define 'AMDEP' is to add one of the compiler tests
/usr/share/automake-1.12/am/depend2.am:     AC_PROG_CC, AC_PROG_CXX, AC_PROG_OBJC, AC_PROG_OBJCXX,
/usr/share/automake-1.12/am/depend2.am:     AM_PROG_AS, AM_PROG_GCJ, AM_PROG_UPC
/usr/share/automake-1.12/am/depend2.am:   to 'configure.ac' and run 'aclocal' and 'autoconf' again
like image 608
wting Avatar asked Jul 02 '12 01:07

wting


People also ask

What is a configure AC file?

The configure.ac file is used to create the ./configure script. It consists of a series of macros which are processed and expanded by autoconf . These macros can check for packages and libraries, handle --enable and --with switches, and generate various files.

How does Automake work?

Automake is the component you'll use to create the Makefile, a template that can then be populated with autoconf . Automake does so using variables and primaries. An example of such a primary is bin_PROGRAMS = helloworld , where the primary is the _PROGRAMS suffix.

What does autoconf do?

Autoconf is an extensible package of M4 macros that produce shell scripts to automatically configure software source code packages. These scripts can adapt the packages to many kinds of UNIX-like systems without manual user intervention.

What is Distcheck?

distcheck-hook Generally this hook is used to check for potential distribution errors not caught by the standard mechanism.


1 Answers

Line 3 should read

AM_INIT_AUTOMAKE([1.12 foreign no-define])

note that it starts with AM_ not AC_.

In general all the automake macros start with AM_.

like image 109
Geoff Reedy Avatar answered Oct 13 '22 00:10

Geoff Reedy