Fix build on Ubuntu Linux/amd64 13.04.

* patch is borrowed from Gentoo Linux.
Fix build with automake 1.4.
Fix return type.
Don't use false as pointer. Don't use default arguments in friend
definition.
Not MAKE_JOBS_SAFE.
Fix friend definition.
Add missing termios.h includes.
Install missing files as necessary.
Fix header guards.
Fix missing termios.h. Explicitly use pointer as guard value.
Update imapfilter to 2.5.5

Changes since 2.0.6:

IMAPFilter 2.5.5 - 8 Jun 2013
  - Work-around for some servers that send an unexpected APPEND response.
  - The serial number of the certificates is taken into account, because some
    servers send different certificates with the same subject and issuer.
  - Details of the stored certificates are written to the certificates file, in
    order to make it easier to distinguish each of them.
  - Support for TLS versions 1.1 and 1.2 for secure connections.

IMAPFilter 2.5.4 - 9 Apr 2013
  - Some server responses are now parsed less stricly.
  - More detailed information is now printed when there's an error.
  - Bug fix; various corrections in the recovery mechanism.

IMAPFilter 2.5.3 - 22 Jul 2012
  - New implementation for international mailbox names.
  - Bug fix; wrong variable name in one of the examples on extending.
  - Bug fix; an OpenSSL compilation warning.

IMAPFilter 2.5.2 - 29 Feb 2012
  - Persistent errors or connection failures are now ignored when running in
    daemon mode, and a reconnection is attempted during the next loop iteration.
  - Bug fix; problems with failure handling during login/logout.

IMAPFilter 2.5.1 - 27 Feb 2012
  - Support for recovery of a session after a BYE response is received.
  - Option to control in which cases a terminated session will be restored.
  - Bug fix; a BYE response could sometimes get incorrectly ignored.

IMAPFilter 2.5 - 23 Feb 2012
  - Support for recovery of a session when a network failure is encountered,
    and other robustness improvements.
  - Informational messages are printed also for the fetch and append methods.
  - Lua 5.2 compatibility, while the codebase can still be compiled with
    version 5.1.
  - The OpenSSL library is now a mandatory build requirement.
  - Bug fix; unrecoverable login failures did not result in aborting of the
    execution of the configuration.
  - Bug fix; when messages were appended to a mailbox that did not exist, it
    failed to create the mailbox and then retry the appending.
  - Bug fix; misleading errors were printed on some SSL failures.
  - Bug fix; protected call of the commands to execute in the daemon function
    could hide important failures.
  - Bug fix; the man page had an incorrect description of the -d option.
  * Support for the old deprecated 1.x configuration format has been removed,
    and the current 2.x format can only be executed from now on.

IMAPFilter 2.4.2 - 19 Jan 2012
  - Bug fix; some ASCII characters in mailbox names were incorrectly converted
    to UTF-7.

IMAPFilter 2.4.1 - 8 Dec 2011
  - Bug fix; become_daemon() failure.

IMAPFilter 2.4 - 6 Dec 2011
  - Support for non-ASCII mailbox names.
  - New environment variable to set the configuration directory.
  - Bug fix; parsing of some server responses was broken since the previous
    release.
  - Bug fix; the match_field() method matched on the whole header field,
    instead of only the header field body.
  - Bug fix; debug file check caused printing of a misleading error message.
  - Bug fix; typo error in a configuration man page example.

IMAPFilter 2.3 - 6 Aug 2011
  - Support for appending/uploading messages to mailboxes.
  - Debug file option now takes filename argument.
  - New simplified configuration and building procedure.
  - Bug fix; in some cases a mailbox was incorrectly assumed selected.
  - Bug fix; in some cases server capabilities needed update after login.
  - Bug fix; timeout problem with CRAM-MD5 authentication.
  - Bug fix; some servers send non-ASCII characters in their responses.

IMAPFilter 2.2.3 - 6 Mar 2011
  - Project moved to GitHub.
  - Changed file and directory structure.
  - The next UID is returned as an additional return value of check_status().
  - All processing methods now return a boolean based on their success.
  - Bug fix; a lost connection is now handled better by trying to reconnect.
  - Bug fix; in some cases in IDLE a message had arrived but was ignored.
  - Bug fix; in some servers the initial IDLE reply wasn't handled correctly.
  - Bug fix; typo errors in the documentation.

IMAPFilter 2.2.2 - 23 Jan 2010
  - Bug fix; a couple of errors in the extending examples file.

IMAPFilter 2.2.1 - 20 Jan 2010
  - A global option for the IDLE refreshing interval was added.
  - Bug fix; more detailed reporting when SSL socket errors occur.

IMAPFilter 2.2 - 30 Dec 2009
  - Support for combining searching methods in multiple mailboxes at the same
    or different accounts and processing of the results in bulk.
  - Support for meta-searching that allows searching on the previous searching
    results.
  - The processing and fetching methods were enhanced to reflect the new
    changes and the documentation was updated.
  - Global options for the message cache and the certificates were added.
  - Bug fix; questions for certificates are not asked while in daemon mode, but
    instead an error is printed.
  * A different format is used for the returned structures of the searching
    methods, due to the introduction of multiple mailbox searching and
    meta-searching, and thus any configuration files that rely on them should
    be updated. Consequently, the processing and fetching methods have been
    also enhanced and the relevant documentation updated, and while these
    changes are backwards compatible, an update of the configuration file is
    still recommended.

IMAPFilter 2.1.2 - 3 Dec 2009
  - Bug fix; cache for message parts didn't work correctly.
  - Bug fix; documentation error.

IMAPFilter 2.1.1 - 24 Nov 2009
  - Bug fix; global option timeout and enter_idle() didn't play well together.

IMAPFilter 2.1 - 23 Nov 2009
  - Support for the IMAP IDLE extension (RFC 2177) through the enter_idle()
    method.
  - Support for fetching of a message's body structure through the
    fetch_structure() method, and of a message's specific body part through the
    fetch_parts() method.
  - Addition of a global option that controls the character set used for all
    the searching methods.
  - Bug fix; fetching of non-existent messages.
  - Bug fix; no trailing end-of-line characters in the results of
    fetch_fields().

IMAPFilter 2.0.11 - 20 Sep 2009
  - Bug fix; fetching of messages with empty body.
  - Workaround for problematic IMAP server sending non-compliant mailbox status
    information.

IMAPFilter 2.0.10 - 16 Feb 2008
  - Bug fix; failed a great number (tens of thousands) of commands were
    exchanged with an IMAP server.
  - Bug fix; failed to fetch the body of some messages in some extremely rare
    occasions.
  - Bug fix; the description for the contain_header() method was clarified.

IMAPFilter 2.0.9 - 26 Dec 2007
  - Bug fix; the match_*() methods failed to match messages.
  - Bug fix; the match_*() methods failed with an error when no messages
    matched.
  - Bug fix; note added in the documentation about the need to use double
    backslashes inside of regular expression patterns.

IMAPFilter 2.0.8 - 23 Dec 2007
  - Bug fix; on some platforms it is necessary to link against the math library.

IMAPFilter 2.0.7 - 22 Dec 2007
  - Bug fix; the match_*() methods failed with an error message.
Updated mail/imapfilter to 2.55
Set OS_VARIANT for OmniOS.

* OmniOS (SunOS variant) is shipped with readline 6.2. OS_VARIANT=OmniOS
  will be used by devel/readline/buildlink3.mk.
Fix builtin detection conditionals.

* Correct detection of following cases.
  non-editline/readline, editline/non-readline, and editline/readline.
* If builtin editline has header files in include/editline, create
  include/readline/* symlinks.
* Fix PR pkg/48062 with above fixes. Confirmed on Ubuntu Linux/amd64 13.04.
Fix comment on patches/patch-lib_stdio.in.h.
Previous comment is irrelevant. Pointed out by wiz@. Thank you.