Search code examples
autoconf

POSIX Shell Script throws syntax error with ./configure


I'm about done working out the dependencies for compiling a program on my linux box. I'm running Linux Mint 19 64bit. The last hurdle I can't seem to get over is a syntax error about a specific line in the configure shell script. Exact error is:

./configure: line 1804: syntax error near unexpected token [foreign]' ./configure: line 1804:AM_INIT_AUTOMAKE([foreign])'

The sister file configure.ac has a reference to AM_INIT_AUTOMAKE([foreign]), and if I remove the offending token of [foreign] many other errors come up. So the token in some way seems necessary.

The furthest I have been able to get is leaving the contents of the parentheses empty with a single whitespace character, so it would read: AM_INIT_AUTOMAKE( ). This satisfies the errors but moves the syntax error down a line to: ac_ext=c.

Here is the offending section of code.

AM_INIT_AUTOMAKE([foreign])
ac_ext=c

This is only two lines in a 2000+ line file.

The shell environment is #! /bin/sh

I've tried changing the environment to bash for the sake of being thorough, but it doesn't make a difference.

What am I doing wrong?


Solution

  • The d0_blind_id package (https://gitlab.com/xonotic/d0_blind_id) contains a script called autogen.sh. Run this script (which calls autoreconf -i) to create configure. Run configure and then make.

    The configure script should not contain AM_INIT_AUTOMAKE that is part of configure.ac which is used by autotools to generate the configure script.

    When I follow these steps I do not get any errors when running the configure script and it does not contain AM_INIT_AUTOMAKE.

    I do not know reason you are getting an error as I can not duplicate the issue.