+#if (SMI_VERSION_MAJOR == 0 && SMI_VERSION_MINOR >= 2) || (SMI_VERSION_MAJOR > 0)
+#define LIBSMI_API_V2
+#else
+#define LIBSMI_API_V1
+#endif
+
+#ifdef LIBSMI_API_V1
+/* Some of the API revisions introduced new calls that can be
+ * represented by macros.
+ */
+#define smiGetNodeType(n) smiGetType((n)->typemodule, (n)->typename)
+
+#else
+/* These calls in the V1 API were removed in V2. */
+#define smiFreeRange(r)
+#define smiFreeType(r)
+#define smiFreeNode(r)
+#endif
+