Question

I have a file cmdscan.c that contains just a function and a struct. My main program hsh.c uses the function and struct from cmdscan.c. I followed the instructions on my professor's pdf exactly but it will not work. Even if I edit something save and run make it says there is nothing to be done. And when I use make distcheck I get an error saying it can't find hsh.c.

This is what my directory contains:

Makefile.am:

    bin_PROGRAMS = hsh
    hsh_SOURCES = hsh.c cmdscan.c

configure.in:

    AC_INIT(hsh.c)
    AM_INIT_AUTOMAKE(hsh,1.0)
    AC_PROG_CC
    AC_PROG_INSTALL
    AC_OUTPUT(Makefile)

I made sure to use tabs. Then I run the commands:

aclocal
autoconf
touch README AUTHORS NEWS ChangeLog
automake -a
configure
make

Note: when I run "configure" it says command not found. But I can run ./configure so that's what I did.

When I do last command "make" I get:

make: Nothing to be done for `all'.

Even if I edit something and save it. So when I run

make distcheck

I get:

configure: error: cannot find sources (hsh.c) in ..
make: *** [distcheck] Error 1

If I run:

gcc cmdscan.c hsh.c -o hsh

It works.

Was it helpful?

Solution

You have some errors like:

AC_INIT(hsh.c), AM_INIT_AUTOMAKE(hsh,1.0) instead use for example:
AC_INIT([hsh],[1.0])
AM_INIT_AUTOMAKE([1.14])

where "1.14" is my automake version, you can see this: automake --version

If you need a quick tutorial see: http://embelinux.blogspot.de/2013/09/autotools1-hola-mundo-la-autotools.html If you need strong documentation run: apt-get install autoconf (see /usr/share/doc/autoconf-doc) and download http://www.gnu.org/software/automake/manual/automake.pdf

AC_INIT (package, version, [bug-report], [tarname], [url])

Process any command-line arguments and perform initialization and verification. Set the name of the package and its version. These are typically used in ‘--version’ support, including that of configure. The optional argument bug-report should be the email to which users should send bug reports. The package tarname differs from package: the latter designates the full package name (e.g., ‘GNU Autoconf’), while the former is meant for distribution tar ball names (e.g., ‘autoconf’). It defaults to package with ‘GNU ’ stripped, lower-cased, and all characters other than alphanumerics and underscores are changed to ‘-’. If provided, url should be the home page for the package. The arguments of AC_INIT must be static, i.e., there should not be any shell compu- tation, quotes, or newlines, but they can be computed by M4. This is because the package information strings are expanded at M4 time into several contexts, and must give the same text at shell time whether used in single-quoted strings, double-quoted strings, quoted here-documents, or unquoted here-documents. It is permissible to use m4_esyscmd or m4_esyscmd_s for computing a version string that changes with every commit to a version control system (in fact, Autoconf does just that, for all builds of the development tree made between releases).

AM_INIT_AUTOMAKE([OPTIONS])

Runs many macros required for proper operation of the generated Makefiles. Today, AM_INIT_AUTOMAKE is called with a single argument: a space-separated list of Automake options that should be applied to every Makefile.am in the tree. The effect is as if each option were listed in AUTOMAKE_OPTIONS (see Chapter 17 [Options], page 117). This macro can also be called in another, deprecated form: AM_INIT_ AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]). In this form, there are two required arguments: the package and the version number. This usage is mostly obsolete because the package and version can be obtained from Autoconf’s AC_INIT macro. However, differently from what happens for AC_INIT invocations, this AM_INIT_AUTOMAKE invocation supports shell variables’ expansions in the PACKAGE and VERSION arguments, and this can be still be useful in some selected situations. Our hope is that future Autoconf versions will improve their support for package versions defined dynamically at configure runtime; when (and if) this happens, support for the two-args AM_INIT_AUTOMAKE invocation will likely be removed from Automake.

OTHER TIPS

The issue ended up being that I had to change configure.in to configure.ac. Then I had to add another parameter to my open file statements, 0666. After that all seems to be well and it compiles and allows me to create a package. The pdf gave no such information -_-.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top