Porting apcupsd seem to be quite easy at least at first glance. OS detection: it is done configure.in with the macro AM_CONDITIONAL and AC_DEFINE. The AM_CONDITIONAL is for Makefile generating HAVE_SUN_OS_TRUE=' ' or HAVE_SUN_OS_TRUE='#' for example if you have or not SUNOS. It expand these variables and they become comments or spaces. Now it is used for selecting the compiler switches. The AC_DEFINE define HAVE_SUN_OS in the config.h file so that the C preprocessor can know which OS we are compiling for. For adding a new OS: In configure.in add: if test $HAVE_UNAME=yes -a x`uname -s` = xSunOS then AM_CONDITIONAL(HAVE_NEW_OS, /bin/true) AC_DEFINE(HAVE_NEW_OS) else AM_CONDITIONAL(HAVE_NEW_OS, /bin/false) fi In acconfig.h add: #undef HAVE_NEW_OS then regenerate the configure script and config.h.in files with autoregen.sh. This thing is useful for compilers too. I have added checks for GCC so that the Makefile know if we are using GCC or not.