Coverity and build chain fixes from Nelson
* merges:
Coverity: Resource leak: CID 400015
Fix configure.ac
Fix configure
xstrncpy saga
xstrncpy saga
xstrncpy saga
Fix tty build broken in last configure.ac changes
Do not add tty objects when no tty is available
Coverity: CID 400005: Division or modulo by zero
Coverity: CID 400006: Division or modulo by zero
Coverity: Out of bounds write: CID 21140
Coverity: CID 400012 Overrun dynamic
Fix build for branches without tags
Coverity CID 400013 Printf arg type mismatch
Coverity: CID 400031: Tainted string
Coverity: CID 400829: Uninit
Use dup2 if available for -t. Also check for ttyname and isatty in configure.
Coverity: CID 400828 Resource leak
Use AS_IF instead of if some places - be more M4sh friendly
Update copyright, remove unused ent arguments