diff --git a/generator/c.ml b/generator/c.ml
index 7446412c3..9643a9679 100644
--- a/generator/c.ml
+++ b/generator/c.ml
@@ -303,6 +303,12 @@ I.\n\n"
pr "This function takes a key or passphrase parameter which
could contain sensitive material. Read the section
L for more information.\n\n";
+ (match f.optional with
+ | None -> ()
+ | Some opt ->
+ pr "This function depends on the feature C<%s>. See also
+L.\n\n" opt
+ );
(match version_added f with
| Some version -> pr "(Added in %s)\n\n" version
| None -> assert false
diff --git a/generator/fish.ml b/generator/fish.ml
index 0cbc7815b..864f65d21 100644
--- a/generator/fish.ml
+++ b/generator/fish.ml
@@ -897,9 +897,17 @@ Guestfish will prompt for these separately.\n\n";
if f.protocol_limit_warning then
pr "%s\n\n" protocol_limit_warning;
- match deprecation_notice ~replace_underscores:true f with
+ (match deprecation_notice ~replace_underscores:true f with
| None -> ()
| Some txt -> pr "%s\n\n" txt
+ );
+
+ (match f.optional with
+ | None -> ()
+ | Some opt ->
+ pr "This command depends on the feature C<%s>. See also
+L.\n\n" opt
+ );
) fishdoc_functions_sorted
(* Generate documentation for guestfish-only commands. *)
diff --git a/generator/gobject.ml b/generator/gobject.ml
index 60c053ca2..b89463e30 100644
--- a/generator/gobject.ml
+++ b/generator/gobject.ml
@@ -1081,6 +1081,14 @@ guestfs_session_close (GuestfsSession *session, GError **err)
pr " *\n";
pr " * %s\n" doc;
+ (match f.optional with
+ | None -> ()
+ | Some opt ->
+ pr " * This function depends on the feature \"%s\".\n" opt;
+ pr " * See also guestfs_session_feature_available().\n";
+ pr " *\n";
+ );
+
pr " * Returns: ";
(match ret with
| RErr ->
diff --git a/generator/java.ml b/generator/java.ml
index f3030483d..4821b341d 100644
--- a/generator/java.ml
+++ b/generator/java.ml
@@ -274,6 +274,13 @@ public class GuestFS {
pr " * %s\n" f.shortdesc;
pr " *
\n";
pr " * %s\n" doc;
+ (match f.optional with
+ | None -> ()
+ | Some opt ->
+ pr " *
\n";
+ pr " * This function depends on the feature \"%s\". See also {@link #feature_available}.\n"
+ opt;
+ );
pr " *
\n";
(match version_added f with
| None -> ()
diff --git a/generator/ocaml.ml b/generator/ocaml.ml
index 288e91f0f..ef045400a 100644
--- a/generator/ocaml.ml
+++ b/generator/ocaml.ml
@@ -177,6 +177,13 @@ end
else
pr "%s(** alias for {!%s}" indent f.name;
+ (match f.optional with
+ | None -> ()
+ | Some opt ->
+ has_tags := true;
+ pr "\n\n This function depends on the feature \"%s\". See also {!feature_available}."
+ opt
+ );
(match f.deprecated_by with
| None -> ()
| Some replacement ->
diff --git a/generator/perl.ml b/generator/perl.ml
index f11477bf0..19cabb60d 100644
--- a/generator/perl.ml
+++ b/generator/perl.ml
@@ -895,6 +895,12 @@ errnos:
pr "%s\n\n" longdesc;
if f.protocol_limit_warning then
pr "%s\n\n" protocol_limit_warning;
+ (match f.optional with
+ | None -> ()
+ | Some opt ->
+ pr "This function depends on the feature C<%s>. See also
+C<$g-Efeature-available>.\n\n" opt
+ );
(match deprecation_notice f with
| None -> ()
| Some txt -> pr "%s\n\n" txt
diff --git a/generator/python.ml b/generator/python.ml
index c618bf0b9..9663fb492 100644
--- a/generator/python.ml
+++ b/generator/python.ml
@@ -817,6 +817,11 @@ class GuestFS(object):
match deprecation_notice f with
| None -> doc
| Some txt -> doc ^ "\n\n" ^ txt in
+ let doc =
+ match f.optional with
+ | None -> doc
+ | Some opt ->
+ doc ^ sprintf "\n\nThis function depends on the feature C<%s>. See also C." opt in
let doc = pod2text ~width:60 f.name doc in
let doc = List.map (fun line -> replace_str line "\\" "\\\\") doc in
let doc = String.concat "\n " doc in
diff --git a/generator/ruby.ml b/generator/ruby.ml
index 9567925b3..97ccfdc42 100644
--- a/generator/ruby.ml
+++ b/generator/ruby.ml
@@ -481,6 +481,11 @@ get_all_event_callbacks (guestfs_h *g, size_t *len_rtn)
| { deprecated_by = None } -> doc
| { deprecated_by = Some alt } ->
doc ^ (sprintf "\n *\n * [Deprecated] In new code, use rdoc-ref:%s instead." alt) in
+ let doc =
+ match f.optional with
+ | None -> doc
+ | Some opt ->
+ doc ^ sprintf "\n *\n * [Feature] This function depends on the feature +%s+. See also {#feature_available}[rdoc-ref:feature_available]." opt in
(* Because Ruby documentation appears as C comments, we must
* replace any instance of "/*".