I have thought some more on config_version_require and ended up with the
conclusion that I need to use double parentheses since it takes a
variable number of arguments and ... is unsupported prior to C99.

Thus the attached patch is what I will go with.

/MF
Index: clean/configure.in
===================================================================
--- clean.orig/configure.in	2008-06-11 23:33:31.000000000 +0200
+++ clean/configure.in	2008-06-11 23:33:31.000000000 +0200
@@ -752,6 +752,11 @@
 AC_ARG_ENABLE(old-features,
 [  --enable-old-features                 Compile in old MIB modules and other deprecated features
                                     which were replaced in the default build of this major release.])
+
+AC_ARG_WITH(features-of,
+[  --with-features-of=version            Compile in MIB modules and other features
+                                    as if this was release [version].],,
+[with_features_of=$PACKAGE_VERSION])
    
 #
 AC_ARG_WITH(enterprise-oid,
@@ -2185,6 +2190,48 @@
         AC_MSG_MODULE_DBG(" $i required old features: $new_list")
 
         #---------------------
+      	# macro: config_version_require((base, version, version-modules, ...))
+      	#  - lists alternative modules used from different versions.
+        #
+        [new_list_alt3=`$MODULECPP module_tmp_header.h | \
+            $GREP config_version_require | \
+            $SED -e 's/  */ /g' \
+                 -e 's/.*config_version_require(( *\([^)]*\) *)).*/\1/' \
+                 -e 's/ *, */,/g' | \
+            awk '
+                BEGIN {
+                    if("'"$enable_new_features"'" == "yes")
+                        method="max";
+                    else if("'"$enable_old_features"'" == "yes")
+                        method="max-less";
+                    else
+                        method="max-less-equal";
+                    FS = ".";
+                    split("'"$with_features_of"'", a);
+                    version=sprintf("%03u%03u%03u", a[1], a[2], a[3]);
+                }
+                {
+                    FS = ",";
+                    n = split($0, a);
+                    FS = ".";
+                    actver = "000000000";
+                    actstr = a[1];
+                    for(i = 2; i < n; i += 2) {
+                        split(a[i], b);
+                        curver=sprintf("%03u%03u%03u", b[1], b[2], b[3]);
+                        if (curver > actver &&
+                            (method != "max-less" || curver < version) &&
+                            (method != "max-less-equal" || curver <= version)) {
+                            actver = curver;
+                            actstr = a[i + 1];
+                        }
+                    }
+                    printf(" %s", actstr);
+                }'`]
+        AC_MSG_MODULE_DBG(" $i required versioned features: $new_list_alt3")
+        new_list="${new_list}${new_list_alt3}"
+
+        #---------------------
       	# macro: config_require(modules)
       	#  - lists modules required for this module
         #
Index: clean/acconfig.h
===================================================================
--- clean.orig/acconfig.h	2008-06-11 22:39:23.000000000 +0200
+++ clean/acconfig.h	2008-06-11 23:33:31.000000000 +0200
@@ -82,6 +82,7 @@
 
 /* Not-to-be-compiled macros for use by configure only */
 #define config_require(x)
+#define config_version_require(x)
 #define config_exclude(x)
 #define config_arch_require(x,y)
 #define config_parse_dot_conf(w,x,y,z)
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to