configure failing on fresh Ubuntu install

Previously I’d been building SNMP++ applications in Visual Studio 2019, but I’m now trying to build under Ubuntu 22.04.

I’m getting errors when running configure.

NOTE: I’ve replaced some of the installed packages since I couldn’t find the ones mentioned in README.autoconf, but I don’t think that’s the issue.

  • openssl-devel → libssl-dev
  • libtomcrypt → libtomcrypt1

So I’ve been running the following commands on a fresh install of Ubuntu 22.04:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install autoconf libtool pkg-config libssl-dev libtomcrypt1
mkdir ~/Source
cd ~/Source
tar -xf snmp++-3.4.10.tar.gz
cd snmp++-3.4.10
autoreconf -i --force

This all seems to work fine until I get this error:

checking for unistd.h... yes
checking whether _AIX is declared... no
checking whether __linux is declared... yes
./configure: line 6660: syntax error near unexpected token `ac_fn_check_decl'
./configure: line 6660: `fi ac_fn_check_decl "$LINENO" "__sun" "ac_cv_have_decl___sun" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS"'

I googled the issue, and the same error was logged in libstatgrab. Reading the following report suggested that they fixed it by editing the file to move the comment:

However, I tried making that change in the SNMP++ source with no effect.

Any ideas what’s up and how to fix this?

It seems that I should have just taken the error message literally.

On line 6660 it didn’t like there being content after the ‘fi’ command, so by editing configure and simply adding a carriage return after the ‘fi’ fixed it for me.

ac_fn_check_decl "$LINENO" "__sun" "ac_cv_have_decl___sun" "$ac_includes_default" "$ac_c_undeclared_builtin_options" "CFLAGS"'

For me even the autoreconf -i is not working with Ubuntu 22.04. I will have to further investigate who this can be fixed…

I do get some warning messages when running the autoreconfig -i command, but the subsequent configure command still runs afterwards.

I’ve noticed that I didn’t actually need to include the --force parameter when calling autoreconfig either.