Hibernate and Suspend

I have a C++ program which ends up getting run on every conceivable distro. What I can't do in C++, I can do by shelling out to the O/S. I am trying to find a portable way to send the system into hibernate and suspend modes. For users who have pm-utils, of course, I can use that, but I am trying to figure out how to do the same things when that package isn't present.

I have found a lot of Web articles that tell me to do things like:

echo -n mem > /sys/power/state

but I find that some of the virtuals I create to test contain disk mode but not mem mode or the other way around, and none of these thousands upon thousands of articles even hints at how this works.

I am willing to have my software do different things in different places and am trying to understand the basic principles, but 99.9% of the articles I read on the Web just re-quote the same two or three quick tips.

Can anyone point me towards more understanding of acpi for Linux?

Have you looked at LessWatts.org?

Doesn't seem to have much to say about how to activate ACPI, which is what I am after. Most of what I try, e.g. pm-utils, is only present on the occasional system.

Humm. What do you mean by "activate ACPI"? If by activate, you mean enable, it depends on a number of factors. Does the hardware support ACPI? What ACPI states does the hardware support? Does the OS support ACPI? Was the OS booted with ACPI enabled?

My customers are running on every conceivable configuration. One way to hibernate would be to give the command:

pm-hibernate,

but it only works if pm-utils are installed. One way or another, I want to cover most users.