I suppose the same script could also install a “gsed” link to “sed” where appropriate.
More generally this kind of thing, if it’s really necessary, is done with feature-specific tests. If it were a C application, autoconfig would generate an include file with features like
#define GNU_SED "gsed", and the code would compile with that macro. In Ocaml I guess it would be a Host module or something. When you haven’t yet had to maintain your application for more than a couple platforms, it might sound like extra trouble, but in the long run it makes more sense than trying to guess from the OS the way we used to do 30 years ago.