3
votes

I am trying to use Autotools for the first time. I have managed to compile my code with Hand written Makefile.in. and using autoconf (The ./configure make).

However Now, i decided to use Automake to generate a Makefile.in using Makefile.am

My Makefile.am:

bin_PROGRAMS=hello_portable
hello_portable_SOURCES=hello_portable.c

My configure.ac auto-generated by autoscan:

AC_PREREQ([2.69])
AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
AM_INIT_AUTOMAKE(summary, 1.0.0)
AC_CONFIG_SRCDIR([hello_portable.c])
AC_CONFIG_HEADERS([config.h])

# Checks for programs.
AC_PROG_CC

# Checks for libraries.

# Checks for header files.
AC_CHECK_HEADERS([sys/time.h])

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.
AC_CHECK_FUNCS([gettimeofday])

AC_OUTPUT

When I do automake in order to generate Makefile.in

# automake --add-missing

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: error: required file './NEWS' not found
Makefile.am: error: required file './README' not found
Makefile.am: error: required file './AUTHORS' not found
Makefile.am: error: required file './ChangeLog' not found
/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

What did I do wrong.

2
Just as a staring point: Makefile.am: error: required file './INSTALL' not found. Do you have all these files?KimKulling
No. What are they. SHould I just touch these files.?RootPhoenix
Use --add--missing commandline argument, which generates them. Second line in your Makefile.am should start hello_portable_SOURCESarved
Hi @arved See my edits. I changed files as you said. Some errors resolved, some still remaining.RootPhoenix
AM_INIT_AUTOMAKE([foreign]) relaxes the GNU (gnits) standards. i.e., you don't need the NEWS, README, AUTHORS, ChangeLog that are required files for an official 'GNU' package. Recommend using autoreconf -fvi to regenerate.Brett Hale

2 Answers

1
votes

You need add couple of lines to your configure.ac:

AC_PREREQ([2.69])
AC_INIT([FULL-PACKAGE-NAME], [VERSION], [BUG-REPORT-ADDRESS])
AM_INIT_AUTOMAKE(summary, 1.0.0)
AC_CONFIG_SRCDIR([hello_portable.c])
AC_CONFIG_HEADERS([config.h])
#LINE1!!!!!!!!!!
AM_INIT_AUTOMAKE([1.9])

# Checks for programs.
AC_PROG_CC

# Checks for libraries.

# Checks for header files.
AC_CHECK_HEADERS([sys/time.h])

# Checks for typedefs, structures, and compiler characteristics.

# Checks for library functions.
AC_CHECK_FUNCS([gettimeofday])
#LINE2!!!!!!!!!!!
AC_CONFIG_FILES([Makefile])

AC_OUTPUT

after such modification you can run:

touch NEWS README AUTHORS ChangeLog && autoreconfig -i && ./configure

By the way there GNU hello world, you can use it as example: https://www.gnu.org/software/hello/

1
votes

You have to fix it line by line. First, Creates all new files required by Makefile.am.(This step you can also run 'automake --add-missing' so as to add missing file automatically) $ touch NEWS README AUTHORS ChangeLog Second, You have to run aclocal prior to automake. $ aclocal Finally ,You can run automake. $ automake