Fix compilation and runtime on QNX based systems

This is a resubmission of pull request #188.

This version should now disable SysV message queues on QNX while enabling them on all other supported operating systems. It also fixes some minor bugs on systems that do not have ncurses support.

The *nto* and *qnx* patterns were taken from auto generated paterns used in the `configure` script.

Specifically: line 6739 in the generated configure script contains the following snippet of a case statement:

```{sh}
*nto* | *qnx*)
  lt_cv_deplibs_check_method=pass_all
  ;;
```