[AGENT++] Single-threaded build under autoconf

Ralph Siemsen ralphs at netwinder.org
Wed Aug 27 22:42:20 CEST 2014


I'm trying to build snmp++-3.3.4 without thread support.

 ./configure --disable-threads

This results in a syntax error in the generated config_snmp_pp.h.

snmp++-3.3.4/include/snmp_pp/config_snmp_pp.h:79:5: error: #if with no expression

79:  #if 
80:  #define HAVE_PTHREAD 1
81:  #endif

It looks like the root cause is in configure.ac, when threads are disabled,
then WITH_THREADS=0 is set, but WITH_PTHREAD variable remains undefined,
which causes the generated header file to be invalid.

The following patch to configure.ac seems to fix it:

--- snmp++-3.3.4/configure.ac   2014-01-24 08:30:38.000000000 -0500
+++ snmp++-3.3.4.new/configure.ac       2014-08-27 10:14:55.914449056 -0400
@@ -186,7 +186,7 @@
         ],
         [])
     ])
-], [WITH_THREADS=0]) # endif : --enable-threads
+], [WITH_THREADS=0;WITH_PTHREAD=0]) # endif : --enable-threads
 
 dnl Checks for libraries.

You may of course prefer to format that a little more clearly, I just
packed it all on the same line to minimize the noise in the diff.

~~~~~

Also in the same configure.ac, the MacAddress / IpxAddress options look
suspiciously incorrect. Running configure --help shows:

  --enable-macaddress     enable support of class MacAddress (default: off)
  --disable-macaddress    disable support of class MacAddress
  --enable-macaddress     enable support of class IpxAddress (default: off)
  --disable-macaddress    disable support of class IpxAddress

The names of the options for IpxAddress seem to be duplicates? I do not use
these options, but noticed it while fixing the first problem.

~~~~~

Lastly, I am also trying to build single-threaded version of agent++-4.0.2.
There is no --disable-threads option in its configure script, but it does
check for pthread support on non-win32 systems. This causes the compile to
be done with gcc -pthread option, regardless of how snmp++ has been built.

I was able to get it working by ripping out the pthread section from the
configure.ac script, but that clearly is not a good solution. Would you
have a suggestion on how best to handle this?

Thanks,
-Ralph



More information about the AGENTPP mailing list