Merge commit 'origin/silc.1.1.branch' master
authorPekka Riikonen <priikone@silcnet.org>
Sun, 5 Oct 2008 14:45:59 +0000 (17:45 +0300)
committerPekka Riikonen <priikone@silcnet.org>
Sun, 5 Oct 2008 14:45:59 +0000 (17:45 +0300)
Conflicts:

CHANGES
TODO
apps/Makefile.ad
apps/autodist/CHANGES
apps/autodist/autodist.in
apps/autodist/doc/autodist.1.in
apps/autodist/doc/autodist.texi
apps/silcd/command.c
apps/silcd/server.c
apps/silcd/server_backup.c
apps/silcd/server_query.c
configure.ad
distdir/autodist
distdir/pre-dist-client
distdir/pre-dist-toolkit
includes/silc.h.in
includes/silcversion.h.in
lib/Makefile.ad
lib/configure.ad
lib/contrib/Makefile.ad
lib/silcasn1/silcasn1.c
lib/silcasn1/silcasn1_decode.c
lib/silcasn1/silcasn1_encode.c
lib/silcclient/client.h
lib/silcclient/client_entry.c
lib/silcclient/silcclient.h
lib/silccore/silcpacket.c
lib/silccrypt/Makefile.ad
lib/silccrypt/aes.c
lib/silccrypt/aes_x86.asm
lib/silccrypt/aes_x86_64.asm
lib/silccrypt/ciphers.h
lib/silccrypt/configure.ad
lib/silccrypt/rijndael_internal.h
lib/silccrypt/silccipher.c
lib/silccrypt/silcpk.c
lib/silccrypt/silcpkcs.c
lib/silccrypt/silcpkcs1.c
lib/silcmath/configure.ad
lib/silcsim/Makefile.ad
lib/silcske/silcconnauth.c
lib/silcske/silcske.c
lib/silcskr/silcskr.c
lib/silcutil/silcatomic.h
lib/silcutil/silcbuffer.h
lib/silcutil/silcbuffmt.c
lib/silcutil/silcconfig.c
lib/silcutil/silcdlist.h
lib/silcutil/silcfdstream.c
lib/silcutil/silcfsm.c
lib/silcutil/silclist.h
lib/silcutil/silclog.c
lib/silcutil/silcmime.c
lib/silcutil/silcmutex.h
lib/silcutil/silcnet.h
lib/silcutil/silcschedule.c
lib/silcutil/silcschedule.h
lib/silcutil/silcschedule_i.h
lib/silcutil/silcsocketstream.c
lib/silcutil/silcsocketstream_i.h
lib/silcutil/silcstack.c
lib/silcutil/silcstack.h
lib/silcutil/silcstringprep.c
lib/silcutil/silctime.c
lib/silcutil/silctypes.h
lib/silcutil/silcutil.c
lib/silcutil/stacktrace.c
lib/silcutil/tests/test_silcschedule.c
lib/silcutil/tests/test_silctime.c
lib/silcutil/unix/silcunixnet.c
lib/silcutil/unix/silcunixschedule.c
lib/silcutil/unix/silcunixsocketstream.c
lib/silcutil/unix/silcunixthread.c
lib/silcutil/win32/silcwin32schedule.c
win32/libsilc/libsilc.def

20 files changed:
1  2 
CHANGES
TODO
apps/silcd/server.c
config.guess
configure.ad
distdir/server
distdir/toolkit
lib/Makefile.ad
lib/silcapputil/silcidcache.c
lib/silcclient/client.c
lib/silcclient/client_channel.c
lib/silcclient/client_entry.c
lib/silcclient/client_internal.h
lib/silcclient/client_register.c
lib/silcclient/command.c
lib/silcclient/command_reply.c
lib/silccore/silccommand.h
lib/silccore/silcpacket.c
lib/silcske/silcconnauth.c
lib/silcske/silcske.c

diff --cc CHANGES
index c5f1ab5111d546ea09568ecaad423ac39a62ea4f,128c76fc0e4f0c678163c10a901c6b3d6d69f297..dfaf9cadbae55981ea2df9552cabef5e08e93242
+++ b/CHANGES
 -        Patch from Jérémy Bobbio.  Affected file is
+ Thu Mar 13 13:31:35 EET 2008  Pekka Riikonen <priikone@silcnet.org>
+       * Fixed silcd crash in NEW_CLIENT packet handling when nickname
+         is not present in the packet.  Affected files are
+         apps/silcd/packet_receive.c.
+ Fri Feb 22 16:12:27 EET 2008  Pekka Riikonen <priikone@silcnet.org>
+       * Fixed partial encryption in CTR mode in AES.  Change does not
+         affect interoperability in SILC due to the way CTR is used in
+         SILC.  But, fixed anyway.  Affected files are
+         lib/silccrypt/aes.c and rijndael_internal.h.
+ Tue Jan  8 09:41:57 EET 2008  Pekka Riikonen <priikone@silcnet.org>
+       * Fixed printable fingerprint bufferoverlfow, RedHat bug 372021.
+         Affected file is lib/silcutil/silcutil.c.
+ Sun Dec 30 14:00:46 EET 2007  Pekka Riikonen <priikone@silcnet.org>
+       * Fixed unix signal delivery in SILC scheduler.  Affected file
+         is lib/silcutil/unix/silcunixschedule.c.
+ Sun Nov 18 16:43:04 CET 2007  Jochen Eisinger <coffee@silcnet.org>
+       * Add -avoid-version and -rpath flags when compiling the plugin.
+         Affected file is apps/irssi/src/fe-common/silc/Makefile.in
+ Thu Nov 15 18:03:53 EET 2007  Pekka Riikonen <priikone@silcnet.org>
+       * Reprocess JOIN command synchronously after resolving channel
+         user list.  Affected file is lib/silcclient/command_reply.c.
+       * In JOIN command reply check if the channel key is already
+         saved.  If it is we have received new key from server while
+         resolving user and must not save the old key.  Affected file
+         is lib/silcclient/command_reply.c.
+       * Remove all channel keys and hmacs after giving LEAVE command.
+         Affected file is lib/silcclient/command_reply.c.
+ Tue Nov 13 18:24:56 EET 2007  Pekka Riikonen <priikone@silcnet.org>
+       * Added missing channel unreferencing in CMODE, CUMODE,
+         TOPIC, INVITE, BAN and KICK command replies.  Affected
+         file is lib/silcclient/command_reply.c.
+ Sun Nov 11 23:04:54 EET 2007 Pekka Riikonen <priikone@silcnet.org>
+       * Free stream data and abort ongoing protocols correctly
+         for primary router connections receiving end of stream.
+         Affected file is apps/silcd/server.c.
+ Sun Nov 11 16:02:12 EET 2007 Pekka Riikonen <priikone@silcnet.org>
+       * SILC Server 1.1 Beta4.
+ Sun Nov 11 14:15:48 EET 2007  Pekka Riikonen <priikone@silcnet.org>
+       * SILC Toolkit 1.1.5.
+       
+ Sun Nov 11 11:22:35 EET 2007  Pekka Riikonen <priikone@silcnet.org>
+       * Fixed connection authentication with public keys to use
+         correct public key as responder.  Affected file is
+         lib/silcske/silcconnauth.c.
+       * Fixed public key authentication in server.  Affected file is
+         apps/silcd/serverconfig.c.
+       * Fixed OPER and SILCOPER public key authentication.  Affected
+         file is apps/silcd/server.c.
+       * Fixed prefer_passphrase_auth flag in server.  Fixed
+         disconnection of unauthenticated connection.  Affected file is
+         apps/silcd/server.c.
+       * Fixed client resuming in server.  Affected file is
+         apps/silcd/packet_receive.c.
+       * Fixed IDENTIFY and WHOWAS command reply to correctly update
+         client entries (fixes a crash).  Affected file is
+         apps/silcd/command_reply.c.
+ Tue Nov  6 16:39:20 EET 2007  Pekka Riikonen <priikone@silcnet.org>
+       * SILC Client 1.1.3.
+ Mon Nov  5 23:07:58 EET 2007  Pekka Riikonen <priikone@silcnet.org>
+       * Zero tail of CTR mode IV in IV Included mode.  Change does
+         not cause compatibility issues.  Affected file is
+         lib/silcske/silcske.c.
+ Mon Nov  5 22:24:25 EET 2007  Pekka Riikonen <priikone@silcnet.org>
+       * SILC Toolkit 1.1.4.
+       * Fixed CTR mode rekey.  Affected file is lib/silcske/silcske.c.
+       * Rewrote the IV Included CTR mode encryption/decryption in
+         packet engine.  Affected file is lib/silccore/silcpacket.c.
+ Sun Nov  4 15:20:25 EET 2007  Pekka Riikonen <priikone@silcnet.org>
+       * Removed module_path and module options from the server
+         config file format.  Affected file is apps/silcd/serverconfig.c.
+       * Fixed non-IPv6 compilation error.  Affected file is
+         lib/silcutil/unix/silcunixnet.c.
+ Sat Nov  3 23:23:38 EET 2007  Pekka Riikonen <priikone@silcnet.org>
+       * Do not free packet engine before uninitializing scheduler.
+         Do not disconnct already disconnected streams.  Affected
+         files are in apps/silcd/.
+       * Fixed setting correct ID for re-encrypted channel messages
+         in router-to-router connections.  Affected file is
+         apps/silcd/packet_send.c.
+ Sun Sep 30 15:16:18 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+       * Fixed channel private key deleting when deleting the channel.
+         Affected file is lib/silcclient/client_channel.c.
+ Sun Sep  9 17:52:49 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+       * SILC Toolkit 1.1.3.
+       * Fixed possible buffer overflows from SILC Config code.
 -        from Jérémy Bobbio.
++        Patch from J�r�my Bobbio.  Affected file is
+         lib/silcutil/silcconfig.c.
+ Sun Aug 26 12:28:49 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+       * Fixed TIMEOUT handling in user info resolving during JOINing,
+         fixes crash.  Affected file is lib/silcclient/client_notify.c.
+       * Fixed mandatory UN and HN SILC public key identifier checking
+         (both must be present).  Affected file is
+         lib/silccrypt/silcpk.c.
+ Tue Aug  7 20:56:06 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+       * Fixed alignment issues with 64-bit CPUs.  Affected files
+         are lib/silcutil/silcschedule.c and unix/silcunixschedule.c.
+       * Added "There are now xx nick's" to "are xx nicks".  Affected
+         file is apps/irssi/src/fe-common/silc/module-formats.c.
+ Sat Aug 4 18:37:22 EEST 2007 Pekka Riikonen <priikone@silcnet.org>
+       * Fixed USERS command user mode handling (integer overflow).
+         Affected file is lib/silcclient/command_reply.c.
+ Thu Jul 19 21:08:49 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+       * Fixed big-endian issues from aes implementation.  Affected
+         files are lib/silccrypt/aes.c.
+       * Fixed lib/silcutil/silcatomic.h compilation on IA64.  Patch
++        from J�r�my Bobbio.
+       * Fixed public key identifier parsing to check lengths
+         correctly.  Affected file is lib/silccrypt/silcpk.c.
+ Wed Jul  4 08:06:38 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
+       * SILC Toolkit 1.1.2.
+       * SILC Client 1.1.2.
+ Mon Jul  2 17:28:47 CEST 2007  Pekka Riikonen <priikone@silcnet.org>
+       * In silc_client_free check that scheduler is allocated before
+         trying to free it.  Affected file is lib/silcclient/client.c.
+       * Fixed buffer overflow in NICK_CHANGE notify.  The destination
+         buffer for old nickname was too small.  Affected file is
+         lib/silclient/client_notify.c.
  Sun Jul  1 19:15:15 EEST 2007  Pekka Riikonen <priikone@silcnet.org>
  
        * SILC Server 1.1 Beta1.
@@@ -1353,7 -1535,7 +1535,7 @@@ Sun Apr  3 14:58:53 EEST 2005  Pekka Ri
          file silcd/packet_receive.c.
  
        * Added getrusage() to take noise in SILC RNG.  A patch by
--        Mika Boström.  Affected files are configure.in.pre,
++        Mika Bostrm.  Affected files are configure.in.pre,
          includes/silcincludes.h.in, lib/silccrypt/silcrng.c.
  
  Sat Apr  2 18:09:30 EEST 2005  Pekka Riikonen <priikone@silcnet.org>
@@@ -1523,7 -1705,7 +1705,7 @@@ Wed Nov 24 18:24:05 CET 2004  Pekka Rii
  Tue Nov 23 16:54:35 CET 2004  Pekka Riikonen <priikone@silcnet.org>
  
        * Fixed Win32 scheduler to not stuck anymore.  A patch from
--        Juha Räsänen.  Affected file is
++        Juha R�s�nen.  Affected file is
          lib/silcutil/win32/silcwin32schedule.c.
  
        * Fixed QoS parsing for connection blocks in server.  Affected
@@@ -1621,7 -1803,7 +1803,7 @@@ Sat Feb 28 16:25:09 EET 2004  Pekka Rii
          on the channel.  Affected file lib/silcclient/client_channel.c.
  
        * The channel private key used to decrypt message is now
--        delivered to the application in the 'channel_messageÃ' client
++        delivered to the application in the 'channel_message' client
          operation.  Affected files are lib/silcclient/silcclient.h
          and client_channel.c.
  
@@@ -2507,7 -2689,7 +2689,7 @@@ Tue Dec 17 10:05:00 CET 2002  Pekka Rii
          Aldous <Matthew@Aldous.com>.
  
        * Added better implementation using CriticalSection of
--        SilcMutex on WIN32.  A patch by Mikko Lähteenmäki
++        SilcMutex on WIN32.  A patch by Mikko L�hteenm�ki
          <mikko.lahteenmaki@pikabaana.net>.
  
        * Added some Winsock WIN32 compatiblity defines into
@@@ -2878,7 -3060,7 +3060,7 @@@ Sun Nov 24 18:26:42 EET 2002  Pekka Rii
          notifys in Irssi SILC Client.  Affected file is
          irssi/src/silc/core/client_ops.c.  Bug #82.
  
--      * Applied Ville Räsänen's manual page and --mandir bugfix
++      * Applied Ville R�s�nen's manual page and --mandir bugfix
          patch.  Affected files are configure.in.pre and Makefile.am.pre.
          Bug #88.
  
@@@ -3057,8 -3239,8 +3239,8 @@@ Thu Nov  7 10:05:28 CET 2002  Pekka Rii
  
  Wed Nov  6 17:18:13 EET 2002  Pekka Riikonen <priikone@silcnet.org>
  
--      * Fixed manual page installation patch by Ville Räsänen.
--        USERS help page fix patch by Ville Räsänen
++      * Fixed manual page installation patch by Ville R�s�nen.
++        USERS help page fix patch by Ville R�s�nen
  
        * Changed the silc_client_command_call interface to make
          the command call simpler for the application.  The library
@@@ -3104,7 -3286,7 +3286,7 @@@ Sun Nov  3 17:59:15 EET 2002  Pekka Rii
          was missing altogether.  Affected file silcd/command_reply.c.
          Bug #44.
  
--Sun Nov  3 00:42:05 EET 2002  Mika Boström <bostik@lut.fi>
++Sun Nov  3 00:42:05 EET 2002  Mika Bostrm <bostik@lut.fi>
  
        * Added man-pages for silc(1), silcd(8) and silcd.conf(5).
          Included yodl sources for each of these. Also modified
@@@ -3305,7 -3487,7 +3487,7 @@@ Sun Oct 20 14:12:24 CEST 2002  Pekka Ri
  Sat Oct 19 13:32:15 CEST 2002  Pekka Riikonen <priikone@silcnet.org>
  
        * ROBODoc documented lib/silcutil/silcbuffer.h and
--        lib/silcutil/silcdlist.h.  Patch by Ville Räsänen
++        lib/silcutil/silcdlist.h.  Patch by Ville R�s�nen
          <ville.rasanen@iki.fi>.
  
  Fri Oct 18 10:51:04 EEST 2002  Pekka Riikonen <priikone@silcnet.org>
@@@ -3557,7 -3739,7 +3739,7 @@@ Sun Sep 15 12:25:10 EEST 2002  Pekka Ri
          file lib/silcutil/silcutil.[ch].
  
        * Added STATS command to client library and Irssi SILC client.
--        Patch provided by Ville Räsänen <ville.rasanen@iki.fi>.
++        Patch provided by Ville R�s�nen <ville.rasanen@iki.fi>.
  
  Wed Sep 11 09:22:00 CEST 2002  Pekka Riikonen <priikone@silcnet.org>
  
@@@ -3779,7 -3961,7 +3961,7 @@@ Fri Jun 28 11:53:25 CEST 2002 Pekka Rii
  Thu Jun 27 20:07:27 EEST 2002 Pekka Riikonen <priikone@silcnet.org>
  
        * Buffer overflow with CUMODE command's mode->mode character
--        conversion.  Reported by Ville Räsänen.  Affected file
++        conversion.  Reported by Ville R�s�nen.  Affected file
          lib/silcutil/silcutil.c.
  
  Thu Jun 27 16:54:33 EEST 2002 Pekka Riikonen <priikone@silcnet.org>
@@@ -3867,7 -4049,7 +4049,7 @@@ Tue Jun 25 18:47:39 EEST 2002 Pekka Rii
  
        * Fixed a bug in version string parsing which could crash
          the program with specially formatted version string.
--        Bug reported and patch provided by Ville Räsänen.  Affected
++        Bug reported and patch provided by Ville R�s�nen.  Affected
          file lib/silcutil/silcutil.c.
  
        * Handle the disconnection immediately when DISCONNECT
@@@ -7679,7 -7861,7 +7861,7 @@@ Thu Sep  6 12:47:37 EEST 2001  Pekka Ri
          Added function silc_client_nickname_format to the file
          lib/silcclient/idlist.c.  It performs the nickname formatting.
  
--        Added new field `hostname´ to the SilcClientEntry context.
++        Added new field `hostname to the SilcClientEntry context.
          It holds the hostname of the client.  Affected file is
          lib/silcclient/idlist.h.
  
@@@ -11050,7 -11232,7 +11232,7 @@@ Wed Feb 21 14:17:04 EET 2001  Pekka Rii
        * Fixed buffer overflow from lib/silcclient/command.c in USERS
          command parsing.
  
--Wed Feb 21 12:44:00 EET 2001  Mika Boström <bostik@lut.fi>
++Wed Feb 21 12:44:00 EET 2001  Mika Bostrm <bostik@lut.fi>
  
        * Changed all SilcConfigServer* and silc_config_server* to
          SilcServerConfig* and silc_server_config*, respectively.
diff --cc TODO
index e24199cef0424d387bc01fcb2ffecafbb3aa1b0c,d89901f838d4d88b4a9e2383c80f75b620de1642..e6950f06db8f133972622b978e342ba7981d623d
--- 1/TODO
--- 2/TODO
+++ b/TODO
@@@ -5,191 -5,316 +5,203 @@@ NOTE: Any item that doesn't have (***DO
  (***TESTING NEEDED) means that the item has been done but not yet properly
  tested.
  
 +NOTE: A TODO entry does not mean that it is ever going to be done.  Some
 +of the entries may be just ideas, good, bad or ugly.  If you want to work
 +on some of the TODO entries simply let us know about it by dropping a note
 +to silc-devel mailing list or appear on 'silc' channel on SILCNet.
  
 -apps/silcd, The SILC Server   ****PARTLY DONE****
 -===========================
 -
 - o Fix/test GETKEY. (***DONE)
 -
 - o Fix/test MOTD. (***DONE)
 -
 - o Rewrite rehash, HUP.
 -
 - o Heartbeat-keepalive.
 -
 - o Port all code to use SILC Toolkit 1.1 APIs. (***DONE)
 -
 - o Remove protocol.[ch].  (***DONE)
 -
 - o Rewrite connecting accepting. (***DONE)
 -
 - o Rewrite async connecting. (***DONE)
 -
 - o Test backup router resuming protocol. (***DONE)
 -
 - o Check all packet receive routines that they call silc_packet_free. 
 -   (***DONE)
 -
 - o Add Web statistics module using lib/silchttp.  Give out server
 -   statistics. (***DONE)
 -
 -
 -SILC Client   ****DONE****
 -===========
 -
 - o Porting to new Toolkit API and new Client Library API (***DONE)
 -
 - o Improve help files, especially /cmode, /cumode and /key. (***DONE)
 -
 -
 -lib/silcclient, The Client Library    ***DONE****
 -==================================
 -
 - o silcclient.h clean up and API rewrites. (***DONE)
 -
 - o silcclient_entry.h finishing, all entry relates APIs to this header.
 -   (***DONE)
 -
 - o SilcChannelEntry, SilcServerEntry, SilcChannelUser, allocating,
 -   freeing, finding, etc. rewrite.  Also making them reference counted for
 -   multi threads use. (***DONE)
 -
 - o Rewrite client side WHOIS command (for whois -details). (***DONE)
 -
 - o Finish all the missing SILC packet processings, rewrites. (***DONE)
 -
 - o The client_notify.c rewrite. (***DONE)
 -
 - o Resuming to client_register.c (remove client_resume.c) (***DONE)
 -
 - o Rekey rewrite. (***DONE)
 -
 - o Remove protocol.[ch]. (***DONE)
 -
 - o File transfer rewrite. (***DONE)
 -
 - o File transfer API documentation. (***DONE)
 -
 - o Connection auth request. (***DONE)
 -
 - o Password auth test, public key auth test. (***DONE)
 -
 - o Starting key exchange directly, rewrite. (***DONE)
 -
 - o Channel messages, channel private keys, channel entires, channel
 -   search, etc. rewrite. (***DONE)
 -
 - o For many APIs leave the hash context allocations to the caller instead
 -   of using client->sha1hash and client->md5hash, or some kind of thread
 -   safe (no locking) concept. (***DONE)
 -
 - o Key agreement rewrite. (***DONE)
 -
 - o Connecting to remote client (***DONE)
 -
 - o Private message waiting API (in threads) (***TESTING NEEDED)
 -
 - o client_attrs.c, attributes rewrite. (***DONE)
 -
 - o No SilcBuffer lists back to application in command_reply operations.
 -   Convert them all to real lists and/or structures for easier use.
 -   (***DONE)
 -
 - o Nickname formatting rewrite. (***DONE)
  
 - o UDP connections. (***TESTING NEEDED)
 -
 -
 -lib/silcsftp                  ****DONE****
 +lib/silccore
  ============
  
 - o Porting to use the new util library. (***DONE)
 -
 -
 -lib/silccore/silcpacket.[ch]  ****DONE****
 -============================
 -
 - o SilcPacketEngine. (***DONE)
 -
 - o New SILC Packet API. (***DONE)
 -
 - o Implement silc_packet_engine_stop and silc_packet_stream_destroy. (***DONE)
 -
 - o IV Included flag support, UDP transport support (***TESTING NEEDED)
 -
 -
 -lib/silccore/silcid.[ch]      ****DONE****
 -========================
 -
 - o Add silc_id_str2id to accept the destination buffer as argument
 -   and thus not require any memory allocation.  Same will happen
 -   with silc_id_payload_* functions. (***DONE)
 -
 - o silc_id_str2id, silc_id2str to non-allocating routines. (***DONE)
 -
 -
 -lib/silcskr   ****DONE****
 -===========
 -
 - o Removing key from the repository is not possible currently.  It should
 -   be. (***DONE)
 -
 -
 -lib/silcske/silcske.[ch]      ***DONE****
 -========================
 -
 - o Responder rekey (***DONE)
 -
 - o IV Included flag support in SKE (***DONE)
 + o SILC_PACKET_FLAG_ACK support.  Implement ACK packet and packet payload
 +   to silcpacket.c.
  
 - o UDP transport changes; retransmission support by using exponential
 -   backoff algorithm. (***DONE)
 + o All payload encoding routines should take SilcStack as argument.
  
-  o Remove SilcCommandCb from silccommand.h.
 - o SilcConnAuth header file documentation. (***DONE)
++ o Remove SilcCommandCb from silccommand.h. (***DONE)
  
 + o All payload test routines into lib/silccore/tests/.
  
 -lib/silccrypt                 ****DONE****
 -=============
  
 - o Implement PKCS #1 sign/verify with hash OID. (***TESTING NEEDED)
 -
 - o Implement SILC Public Key Version 2 handling in sign/verify.  Implement
 -   Version (V) identifier (***DONE)
 -
 - o SILC PKCS (silcpkcs.h) reorganizing when other PK supports added.
 -   Move the SILC Public Key routines away from the crypto library into
 -   the core library (silccore).  silc_pkcs_public/private_key_* routines
 -   to silc_public/private_key_* routines.  The silc_public_key_* routines
 -   should also automatically handle SILC Public Keys, and other keys
 -   and certificates as well.  Add fe. silcpk.h into silccore.  It should
 -   also include the Public Key Payload encoding and decoding routines.
 -   (***DONE)
 -
 - o Assembler AES (***DONE)
 -
 -
 -lib/silcutil                  ****DONE****
 -============
 +lib/silcclient, The Client Library
 +==================================
  
 - o The regex code from lib/contrib might compile fine on all platforms.
 -   No need to make it silcutil/unix/ specific.  Add them to generic
 -   silcutil.c. (***DONE)
++ o LIST command should take server name as argument, a server name whose
++   channels to list.  This way it is possible to list channels from
++   any server in internet, eg.  /LIST example.com.
 - o Silc FD Stream to WIN32 (lib/silcutil/silcfdstream.h) (***TESTING NEEDED)
 + o UDP SILC connection support to SILC server
  
 - o bool -> SilcBool (***DONE)
 + o Giving WHOIS for nick that doesn't exist should remove any same
 +   named entries from the client cache.
  
 + o peer-to-peer private messages
  
 -lib/silcutil/silcbuffer.h     ****DONE****
 -=========================
 + o Private message key request notification to application.  See XXX in
 +   client_prvmsg.c.
  
 - o Remove the `truelen' field from SilcBuffer as it is entirely
 -   redundant since we can get the true length of the buffer by
 -   doing buffer->end - buffer->header.  Add silc_buffer_truelen
 -   macro instead.  Consider also removing `len' field too since
 -   it effectively is buffer->tail - buffer->data, and adding
 -   silc_buffer_len macro can do the same.  These would save
 -   totally 8 bytes of memory per buffer. (***DONE)
 + o in JOIN notify handle resolving that timedout.  Currently the user is
 +   never joined the channel if this happens.  What to do if message is
 +   received from user that hasn't been resolved/joined?
  
-  o Add the SilcStream (socket stream) from the SilcPacketStream and
-    SilcSocket from the socket stream to SilcClientConnection for easier
-    access to them for programmers.  Currently these have to be digged up
-    from the packet stream.
 + o Connection option that attemps to connect to remot host with various
 +   different mechanisms: UDP 706, TCP 706, TCP 80, TCP 443, UDP 7706 and
 +   TCP 7706.  This is the so called hole punching mechanism.
  
 -lib/silcutil/silcbuffmt.[ch]  ****DONE****
 -============================
 + o Message ACKing support.
  
 - o SilcStack aware silc_buffer_unformat (***DONE)
 + o in /cmode and /cumode with +r, maybe the public key and private key
 +   could be just some "string", which would then match to "string.pub" and
 +   "string.prv".
  
 - o SilcStack aware silc_buffer_format (***DONE)
 + o If the SILC Events (see below) are implemented, perhaps client library
 +   should provide events so that application developer has a choice of
 +   developing the SILC app with callbacks or with events.
  
 - o silc_buffer_format reallocates automatically (***DONE)
 + o Ability to recover from rekey errors, at least try to.
  
 - o SILC_STR_OFFSET (***DONE)
++ o Add the SilcStream (socket stream) from the SilcPacketStream and
++   SilcSocket from the socket stream to SilcClientConnection for easier
++   access to them for programmers.  Currently these have to be digged up
++   from the packet stream. (***DONE)
  
 -lib/silcutil/silcstack.[ch]   ****DONE****
 +SFTP Library, lib/silcsftp/
  ===========================
  
 - o Data stack implementation (***DONE)
 -
 -
 -lib/silcutil/silcstream.[ch]  ****DONE****
 -============================
 -
 - o Add abstract SilcStream. (***DONE)
 + o Read prefetch (read-ahead, reading ahead of time).  Maybe if this can
 +   be done easily.
  
  
 -lib/silcutil/silcsocketstream.[ch]    ****DONE****
 -==================================
 -
 - o Add SilcSocketStream (***DONE)
 -
 - o Add SilcSocketStream for WIN32 (***TESTING NEEDED)
 -
 - o Test QoS after the changes made to socket stream
 -
 +lib/silcske/silcske.[ch]
 +========================
  
 -lib/silcutil/silcschedule*.[ch]               ****DONE****
 -===============================
 + o Ratelimit to UDP/IP transport for incoming packets.
  
 - o Scheduler can be optimized for FD tasks by changing the fd_queue
 -   to SilcHashTable instead of using linked list.  We need to do
 -   one-to-one mapping of FD to task and hash table is more efficient
 -   for this usage.
  
 -   Also redefine the silc_select to perhaps return a separate
 -   structure of the events that actually occurred, instead of
 -   returning the events in the fd_list which is then traversed
 -   in the generic code to find the changed events.  This can be
 -   made faster by having own struct which includes only the
 -   changed events, thus the tarversing is faster since the whole
 -   fd_list is not traversed anymore (it is still traversed in the
 -   silc_select but at least it removes one extra tarversing later
 -   for the same list).
 +apps/silcd
 +==========
  
 -   Other task queues should be changed to use SilcList.  (***DONE)
 + o Deprecate the old server.  Write interface for the new lib/silcserver
 +   server library.  The interface should work on Unix/Linux systems.
  
 - o Add SILC scheduler's internal routines into a table of implementation
 -   function pointers, that the generic code then takes as extern from
 -   implementation.  These are the silc_schedule_internal_* routines.
 -   (***DONE)
 + o Consider deprecating also the old config file format and use XML
 +   istead.  This should require SILC XML API implementation first.
  
 - o Change SILC_TASK_CALLBACK to non-static, and remove the macro
 -   SILC_TASK_CALLBACK_GLOBAL. (***DONE)
 + o The configuration must support dynamic router and server connections.
 +   The silcd must work without specifying any servers or routers to
 +   connect to.
  
 - o SILC Schedule API changes to WIN32. (***DONE)
 + o The configuration must support specifying whether the server is
 +   SILC Server or SILC Router.  This should not be deduced from the
 +   configuration as it was in < 1.2.
  
 + o The configuration must support specifying the ciphers and hmacs and
 +   their order so that user can specify which algorithms take preference.
  
 -lib/silcutil/silcasync.[ch]   ****DONE****
 -===========================
  
 - o Add SilcAsyncOperation to utility library.  Any function that takes
 -   callback as an argument must/should return SilcAsyncOperation.
 -   (***DONE)
 +lib/silcserver
 +==============
  
 + o Rewrite the entire server.  Deprecate apps/silcd as the main server
 +   implementation and create lib/silcserver/.  It is a platform
 +   independent server library.  The apps/silcd will merely provide a
 +   a simple interface for the library.
  
 -lib/silcutil/silctime.[ch]    ****DONE****
 -===========================
 + o Write the SILC Server library extensively using SILC FSM.
  
 - o SilcTime. (***DONE)
 + o Server library must support multiple networks.  This means that one
 +   server must be able to create multiple connections that each reach
 +   different SILC network.  This means also that all cache's etc. must
 +   be either connection-specific or network-specific.
  
 - o system time, universal, generalized. (***DONE)
 + o Library must support dynamic router and server connections.  This means
 +   that connections are create only when they are needed, like when someone
 +   says JOIN foo@foo.bar.com or WHOIS foobar@silcnet.org.
  
 + o Library must support server-to-server connections even though protocol
 +   prohibits that.  The responder of the connection should automatically
 +   act as a router.  The two servers create an own, isolated, SILC network.
 +   To be used specifically with dynamic connections.
  
 -lib/silcutil/silcfsm.[ch]     ****DONE****
 -=========================
 + o Library must support multiple threads and must be entirely thread safe.
  
 - o SILC Finite State Machine API.  Replaces SILC Protocol API (***DONE)
 + o Library must have support for SERVICE command.
  
 + o Both UDP and TCP support for incoming connecetions.  Maintaining long
 +   term UDP sessions.
  
 -lib/silcutil/silcnet*, lib/silcutil/*/silc*net*               ****DONE****
 -===============================================
 + o The server must be able to run behind NAT device.  This means that
 +   Server ID must be based on public IP instead of private IP (See
 +   also NAT detection protocol in SILC protocol specification).
  
 - o Add UDP interface (***DONE)
 + o The following data must be in per-connection context: client id cache,
 +   server id cache, channel id cache, all statistics must be
 +   per-connection.
  
 - o Add UDP interface for WIN32 (***TESTING NEEDED)
 + o The following data must be in per-thread context: command context
 +   freelist/pool, pending commands, random number generator.
  
 - o New network interfaces (***DONE)
 + o Do inccoming packet processing in an own FSM thread in the
 +   server-threads FSM.  Same as in client library.
  
 + o Binding to other ports than 706 too.  To allow easier traversing
 +   through NATs and firewalls server should also bind to 80, 443 and 7706
 +   by default (at least try to bind).  Connections must work normally
 +   even if they were established to some other port other than 706.
  
 -lib/silcmath                  ****DONE****
 -============
 +   Connection option that attemps to connect to remot server with various
 +   different mechanisms: UDP 706, TCP 706, TCP 80, TCP 443, UDP 7706 and
 +   TCP 7706.  This is the so called hole punching mechanism.
  
 - o Test on x86_64. (***TESTING NEEDED)
 + o Ability to recover from rekey errors, at least try to.
  
 - o Change LTM and TFM function names when importing to SILC tree to avoid
 -   rare linking problems on system that has same named symbols already in
 -   the system. (***DONE)
 + o Reference count all Silc*Entry structures.
  
 -lib/silcutil/symbian/         ****DONE****
 -=====================
++ o All channel names in any command (where appropriate) must be allowed to
++   be in format channel@server so that the server can be connected to do
++   the command for the channel.  Change protocol if it doesn't allow it.
 -  o lib/silcutil/symbian routines missing or not completed.
 -    (****TESTING NEEDED)
++ o All nicknames in any command (where appropriate) must be allowed to be
++   in format nick@server so that the server can be connected to do the
++   command for the nickname.  Change protocol if it doesn't allow it.
 + Some issues that must be kept in mind from 1.0 and 1.1 silcd's:
  
 -  o Something needs to be thought to the logging globals as well,
 -    like silc_debug etc.  They won't work on EPOC.  Perhaps logging
 -    and debugging is to be disabled on EPOC.
 + o The server and router software MUST work out of the box.  After
 +   installation the server must not require any configuration to run the
 +   most basic working configuration.  No defining IP addresses, etc.
 +   The server must work just by running it.
  
 + o The SERVER_SIGNOFF notify handing is not optimal, because it'll
 +   cause sending of multiple SIGNOFF notify's instead of the one
 +   SERVER_SIGNOFF notify that the server received.  This should be
 +   optimized so that the only SERVER_SIGNOFF is sent and not
 +   SIGNOFF of notify at all (using SIGNOFF takes the idea about
 +   SERVER_SIGNOFF away entirely).
  
 -lib/silcasn1                  ****DONE****
 -============
 + o Another SERVER_SIGNOFF opt/bugfix:  Currently the signoff is
 +   sent to a client if it is on same channel as the client that
 +   signoffed.  However, the entire SERVER_SIGNOFF list is sent to
 +   the client, ie. it may receive clients that was not on the
 +   same channel.  This is actually against the specs.  It must be
 +   done per channel.  It shouldn't receive the whole list just
 +   because one client happened to be on same channel.
  
 - o ASN.1 library (***DONE)
 + o If client's public key is saved in the server (and doing public key
 +   authentication) then the hostname and the username information could
 +   be taken from the public key.  Should be a configuration option!
  
 - o Header documentation missing. (***DONE)
 + o Add a timeout to handling incoming JOIN commands.  It should be
 +   enforced that JOIN command is executed only once in a second or two
 +   seconds.  Now it is possible to accept n incoming JOIN commands
 +   and process them without any timeouts.  THis must be employed because
 +   each JOIN command will create and distribute the new channel key
 +   to everybody on the channel.
  
 - o Some string encodings missing (copy/paste matter). (***DONE)
 + o Related to above.  If multiple JOINs are received in sequence perhaps
 +   new key should be created only once, if the JOINs are handeled at the same
 +   time.  Now we create multiple keys and never end up using them because
 +   many JOINs are processed at the same time in sequence.  Only the last
 +   key ends up being used.
index 46fccfc085d68ca3bb47b682dd69c7026be39a14,c2df082c61118703639b85fca1f9ad34de233bfd..f03581bcd081bbe9135d07e59bf6ba2f103be4a4
@@@ -915,6 -929,13 +933,12 @@@ SilcBool silc_server_init(SilcServer se
      }
    }
  
 -
+   if (server->server_type != SILC_ROUTER) {
+     server->stat.servers = 1;
+     server->stat.cell_servers = 1;
+   } else {
+     server->stat.routers = 1;
+   }
    /* If we are normal server we'll retrieve network statisticial information
       once in a while from the router. */
    if (server->server_type != SILC_ROUTER)
@@@ -1246,9 -1269,6 +1272,8 @@@ SILC_TASK_CALLBACK(silc_server_purge_ex
  
    silc_dlist_start(server->expired_clients);
    while ((client = silc_dlist_get(server->expired_clients))) {
-     if (client->data.status & SILC_IDLIST_STATUS_REGISTERED)
 +      continue;
 +
      /* For unregistered clients the created timestamp is actually
         unregistered timestamp.  Make sure client remains in history
         at least 500 seconds. */
@@@ -1336,13 -1360,21 +1365,19 @@@ silc_server_ke_auth_compl(SilcConnAuth 
  
    if (success == FALSE) {
      /* Authentication failed */
-     /* XXX retry connecting */
  
-     silc_server_disconnect_remote(server, sconn->sock,
-                                 SILC_STATUS_ERR_AUTH_FAILED, NULL);
+     /* Try reconnecting if configuration wants it */
+     if (!sconn->no_reconnect) {
+       silc_schedule_task_add_timeout(server->schedule,
+                                    silc_server_connect_to_router_retry,
+                                    sconn, 1, 0);
+       silc_dlist_del(server->conns, sconn);
+       return;
+     }
      if (sconn->callback)
        (*sconn->callback)(server, NULL, sconn->callback_context);
-     silc_server_connection_free(sconn);
+     silc_server_free_sock_user_data(server, sconn->sock, NULL);
 -    silc_server_disconnect_remote(server, sconn->sock,
 -                                SILC_STATUS_ERR_AUTH_FAILED, NULL);
      return;
    }
  
                                      strdup(sconn->remote_host),
                                      SILC_SERVER, NULL, NULL, sconn->sock);
      if (!id_entry) {
 +      silc_server_disconnect_remote(server, sconn->sock,
 +                                  SILC_STATUS_ERR_RESOURCE_LIMIT, NULL);
        if (sconn->callback)
        (*sconn->callback)(server, NULL, sconn->callback_context);
-       silc_server_connection_free(sconn);
-       silc_free(entry);
+       silc_server_free_sock_user_data(server, sconn->sock, NULL);
 -      silc_server_disconnect_remote(server, sconn->sock,
 -                                  SILC_STATUS_ERR_RESOURCE_LIMIT, NULL);
        return;
      }
  
                             SILC_STR_DATA(server->server_name,
                                           strlen(server->server_name)),
                             SILC_STR_END)) {
 +      silc_server_disconnect_remote(server, sconn->sock,
 +                                  SILC_STATUS_ERR_RESOURCE_LIMIT, NULL);
        if (sconn->callback)
        (*sconn->callback)(server, NULL, sconn->callback_context);
-       silc_server_connection_free(sconn);
-       silc_free(entry);
+       silc_server_free_sock_user_data(server, sconn->sock, NULL);
 -      silc_server_disconnect_remote(server, sconn->sock,
 -                                  SILC_STATUS_ERR_RESOURCE_LIMIT, NULL);
        return;
      }
  
                                                  SILC_ID_SERVER),
                                      NULL, sconn->sock);
      if (!id_entry) {
-       silc_server_disconnect_remote(server, sconn->sock,
-                                   SILC_STATUS_ERR_RESOURCE_LIMIT, NULL);
+       /* Try reconnecting if configuration wants it */
+       if (!sconn->no_reconnect) {
+         silc_schedule_task_add_timeout(server->schedule,
+                                      silc_server_connect_to_router_retry,
+                                      sconn, 1, 0);
+         silc_dlist_del(server->conns, sconn);
+         return;
+       }
        if (sconn->callback)
        (*sconn->callback)(server, NULL, sconn->callback_context);
-       silc_server_connection_free(sconn);
-       silc_free(entry);
+       silc_server_free_sock_user_data(server, sconn->sock, NULL);
 -      silc_server_disconnect_remote(server, sconn->sock,
 -                                  SILC_STATUS_ERR_RESOURCE_LIMIT, NULL);
        return;
      }
  
        /* We already have primary router.  Disconnect this connection */
        SILC_LOG_DEBUG(("We already have primary router, disconnect"));
        silc_idlist_del_server(server->global_list, id_entry);
 +      silc_server_disconnect_remote(server, sconn->sock,
 +                                    SILC_STATUS_ERR_RESOURCE_LIMIT, NULL);
        if (sconn->callback)
          (*sconn->callback)(server, NULL, sconn->callback_context);
-       silc_server_connection_free(sconn);
-       silc_free(entry);
+       silc_server_free_sock_user_data(server, sconn->sock, NULL);
+       silc_server_disconnect_remote(server, sconn->sock,
+                                     SILC_STATUS_ERR_RESOURCE_LIMIT, NULL);
        return;
- #endif /* 0 */
        }
+ #endif /* 0 */
      } else {
        /* Add this server to be our backup router */
        id_entry->server_type = SILC_BACKUP_ROUTER;
      break;
  
    default:
 +    silc_server_disconnect_remote(server, sconn->sock,
 +                                SILC_STATUS_ERR_AUTH_FAILED, NULL);
      if (sconn->callback)
        (*sconn->callback)(server, NULL, sconn->callback_context);
-     silc_server_connection_free(sconn);
-     silc_free(entry);
+     silc_server_free_sock_user_data(server, sconn->sock, NULL);
 -    silc_server_disconnect_remote(server, sconn->sock,
 -                                SILC_STATUS_ERR_AUTH_FAILED, NULL);
      return;
    }
  
@@@ -1567,14 -1621,22 +1624,20 @@@ static void silc_server_ke_completed(Si
      /* SKE failed */
      SILC_LOG_ERROR(("Error (%s) during Key Exchange protocol with %s (%s)",
                    silc_ske_map_status(status), entry->hostname, entry->ip));
-     /* XXX retry connecting */
      silc_ske_free(ske);
-     silc_server_disconnect_remote(server, sconn->sock,
-                                 SILC_STATUS_ERR_KEY_EXCHANGE_FAILED, NULL);
+     /* Try reconnecting if configuration wants it */
+     if (!sconn->no_reconnect) {
+       silc_schedule_task_add_timeout(server->schedule,
+                                    silc_server_connect_to_router_retry,
+                                    sconn, 1, 0);
+       silc_dlist_del(server->conns, sconn);
+       return;
+     }
      if (sconn->callback)
        (*sconn->callback)(server, NULL, sconn->callback_context);
-     silc_server_connection_free(sconn);
+     silc_server_free_sock_user_data(server, sconn->sock, NULL);
 -    silc_server_disconnect_remote(server, sconn->sock,
 -                                SILC_STATUS_ERR_KEY_EXCHANGE_FAILED, NULL);
      return;
    }
  
    /* Set the keys into use.  The data will be encrypted after this. */
    if (!silc_ske_set_keys(ske, keymat, prop, &send_key, &receive_key,
                         &hmac_send, &hmac_receive, &hash)) {
+     silc_ske_free(ske);
  
-     /* XXX retry connecting */
+     /* Try reconnecting if configuration wants it */
+     if (!sconn->no_reconnect) {
+       silc_schedule_task_add_timeout(server->schedule,
+                                    silc_server_connect_to_router_retry,
+                                    sconn, 1, 0);
+       silc_dlist_del(server->conns, sconn);
+       return;
+     }
  
      /* Error setting keys */
-     silc_ske_free(ske);
 +    silc_server_disconnect_remote(server, sconn->sock,
 +                                SILC_STATUS_ERR_KEY_EXCHANGE_FAILED, NULL);
      if (sconn->callback)
        (*sconn->callback)(server, NULL, sconn->callback_context);
-     silc_server_connection_free(sconn);
+     silc_server_free_sock_user_data(server, sconn->sock, NULL);
 -    silc_server_disconnect_remote(server, sconn->sock,
 -                                SILC_STATUS_ERR_KEY_EXCHANGE_FAILED, NULL);
      return;
    }
    silc_packet_set_keys(sconn->sock, send_key, receive_key, hmac_send,
    connauth = silc_connauth_alloc(server->schedule, ske,
                                 server->config->conn_auth_timeout);
    if (!connauth) {
-     /* XXX retry connecting */
+     silc_ske_free(ske);
+     /* Try reconnecting if configuration wants it */
+     if (!sconn->no_reconnect) {
+       silc_schedule_task_add_timeout(server->schedule,
+                                    silc_server_connect_to_router_retry,
+                                    sconn, 1, 0);
+       silc_dlist_del(server->conns, sconn);
+       return;
+     }
  
      /** Error allocating auth protocol */
-     silc_ske_free(ske);
 +    silc_server_disconnect_remote(server, sconn->sock,
 +                                SILC_STATUS_ERR_RESOURCE_LIMIT, NULL);
      if (sconn->callback)
        (*sconn->callback)(server, NULL, sconn->callback_context);
-     silc_server_connection_free(sconn);
+     silc_server_free_sock_user_data(server, sconn->sock, NULL);
 -    silc_server_disconnect_remote(server, sconn->sock,
 -                                SILC_STATUS_ERR_RESOURCE_LIMIT, NULL);
      return;
    }
  
@@@ -1970,9 -2105,10 +2106,9 @@@ SILC_TASK_CALLBACK(silc_server_connect_
        sconn->backup_replace_ip = strdup(ptr->backup_replace_ip);
        sconn->backup_replace_port = ptr->backup_replace_port;
      }
+     sconn->no_reconnect = param->reconnect_keep_trying == FALSE;
  
      SILC_LOG_DEBUG(("Created connection %p", sconn));
--
      if (!server->router_conn && !sconn->backup)
        server->router_conn = sconn;
  
@@@ -2801,6 -3015,9 +3015,7 @@@ void silc_server_close_connection(SilcS
    const char *hostname;
    SilcUInt16 port;
  
 -    return;
 -
+   if (!silc_packet_stream_is_valid(sock))
    memset(tmp, 0, sizeof(tmp));
    //  silc_socket_get_error(sock, tmp, sizeof(tmp));
    silc_socket_stream_get_info(silc_packet_stream_get_stream(sock),
diff --cc config.guess
index 951383e35544d8c861019b06e0ec4a58f1657a5f,e3ef63f6cb4c2670b7723cdc44eb290ec8693b1a..0000000000000000000000000000000000000000
deleted file mode 100755,100755
+++ /dev/null
@@@ -1,1516 -1,1471 +1,0 @@@
--#! /bin/sh
--# Attempt to guess a canonical system name.
--#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- #   2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation,
- #   Inc.
 -#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
--
- timestamp='2007-05-17'
 -timestamp='2005-12-13'
--
--# This file is free software; you can redistribute it and/or modify it
--# under the terms of the GNU General Public License as published by
--# the Free Software Foundation; either version 2 of the License, or
--# (at your option) any later version.
--#
--# This program is distributed in the hope that it will be useful, but
--# WITHOUT ANY WARRANTY; without even the implied warranty of
--# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
--# General Public License for more details.
--#
--# You should have received a copy of the GNU General Public License
--# along with this program; if not, write to the Free Software
--# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
--# 02110-1301, USA.
--#
--# As a special exception to the GNU General Public License, if you
--# distribute this file as part of a program that contains a
--# configuration script generated by Autoconf, you may include it under
--# the same distribution terms that you use for the rest of that program.
--
--
--# Originally written by Per Bothner <per@bothner.com>.
--# Please send patches to <config-patches@gnu.org>.  Submit a context
--# diff and a properly formatted ChangeLog entry.
--#
--# This script attempts to guess a canonical system name similar to
--# config.sub.  If it succeeds, it prints the system name on stdout, and
--# exits with 0.  Otherwise, it exits with 1.
--#
--# The plan is that this can be called by configure scripts if you
--# don't specify an explicit build system type.
--
--me=`echo "$0" | sed -e 's,.*/,,'`
--
--usage="\
--Usage: $0 [OPTION]
--
--Output the configuration name of the system \`$me' is run on.
--
--Operation modes:
--  -h, --help         print this help, then exit
--  -t, --time-stamp   print date of last modification, then exit
--  -v, --version      print version number, then exit
--
--Report bugs and patches to <config-patches@gnu.org>."
--
--version="\
--GNU config.guess ($timestamp)
--
--Originally written by Per Bothner.
--Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
--Free Software Foundation, Inc.
--
--This is free software; see the source for copying conditions.  There is NO
--warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
--
--help="
--Try \`$me --help' for more information."
--
--# Parse command line
--while test $# -gt 0 ; do
--  case $1 in
--    --time-stamp | --time* | -t )
--       echo "$timestamp" ; exit ;;
--    --version | -v )
--       echo "$version" ; exit ;;
--    --help | --h* | -h )
--       echo "$usage"; exit ;;
--    -- )     # Stop option processing
--       shift; break ;;
--    - )       # Use stdin as input.
--       break ;;
--    -* )
--       echo "$me: invalid option $1$help" >&2
--       exit 1 ;;
--    * )
--       break ;;
--  esac
--done
--
--if test $# != 0; then
--  echo "$me: too many arguments$help" >&2
--  exit 1
--fi
--
--trap 'exit 1' 1 2 15
--
--# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
--# compiler to aid in system detection is discouraged as it requires
--# temporary files to be created and, as you can see below, it is a
--# headache to deal with in a portable fashion.
--
--# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
--# use `HOST_CC' if defined, but it is deprecated.
--
--# Portable tmp directory creation inspired by the Autoconf team.
--
--set_cc_for_build='
--trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
--trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
--: ${TMPDIR=/tmp} ;
-  { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
 - { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
-- { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
-- { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
-- { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
--dummy=$tmp/dummy ;
--tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
--case $CC_FOR_BUILD,$HOST_CC,$CC in
-- ,,)    echo "int x;" > $dummy.c ;
--      for c in cc gcc c89 c99 ; do
--        if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
--           CC_FOR_BUILD="$c"; break ;
--        fi ;
--      done ;
--      if test x"$CC_FOR_BUILD" = x ; then
--        CC_FOR_BUILD=no_compiler_found ;
--      fi
--      ;;
-- ,,*)   CC_FOR_BUILD=$CC ;;
-- ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
--esac ; set_cc_for_build= ;'
--
--# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
--# (ghazi@noc.rutgers.edu 1994-08-24)
--if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
--      PATH=$PATH:/.attbin ; export PATH
--fi
--
--UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
--UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
--UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
--UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
--
--# Note: order is significant - the case branches are not exclusive.
--
--case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
--    *:NetBSD:*:*)
--      # NetBSD (nbsd) targets should (where applicable) match one or
--      # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
--      # *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
--      # switched to ELF, *-*-netbsd* would select the old
--      # object file format.  This provides both forward
--      # compatibility and a consistent mechanism for selecting the
--      # object file format.
--      #
--      # Note: NetBSD doesn't particularly care about the vendor
--      # portion of the name.  We always set it to "unknown".
--      sysctl="sysctl -n hw.machine_arch"
--      UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
--          /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
--      case "${UNAME_MACHINE_ARCH}" in
--          armeb) machine=armeb-unknown ;;
--          arm*) machine=arm-unknown ;;
--          sh3el) machine=shl-unknown ;;
--          sh3eb) machine=sh-unknown ;;
-           sh5el) machine=sh5le-unknown ;;
--          *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
--      esac
--      # The Operating System including object format, if it has switched
--      # to ELF recently, or will in the future.
--      case "${UNAME_MACHINE_ARCH}" in
--          arm*|i386|m68k|ns32k|sh3*|sparc|vax)
--              eval $set_cc_for_build
--              if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
--                      | grep __ELF__ >/dev/null
--              then
--                  # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
--                  # Return netbsd for either.  FIX?
--                  os=netbsd
--              else
--                  os=netbsdelf
--              fi
--              ;;
--          *)
--              os=netbsd
--              ;;
--      esac
--      # The OS release
--      # Debian GNU/NetBSD machines have a different userland, and
--      # thus, need a distinct triplet. However, they do not need
--      # kernel version information, so it can be replaced with a
--      # suitable tag, in the style of linux-gnu.
--      case "${UNAME_VERSION}" in
--          Debian*)
--              release='-gnu'
--              ;;
--          *)
--              release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
--              ;;
--      esac
--      # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
--      # contains redundant information, the shorter form:
--      # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
--      echo "${machine}-${os}${release}"
--      exit ;;
--    *:OpenBSD:*:*)
--      UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
--      echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
--      exit ;;
--    *:ekkoBSD:*:*)
--      echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
-       exit ;;
-     *:SolidBSD:*:*)
-       echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
--      exit ;;
--    macppc:MirBSD:*:*)
-       echo powerpc-unknown-mirbsd${UNAME_RELEASE}
 -      echo powerppc-unknown-mirbsd${UNAME_RELEASE}
--      exit ;;
--    *:MirBSD:*:*)
--      echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
--      exit ;;
--    alpha:OSF1:*:*)
--      case $UNAME_RELEASE in
--      *4.0)
--              UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
--              ;;
--      *5.*)
--              UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
--              ;;
--      esac
--      # According to Compaq, /usr/sbin/psrinfo has been available on
--      # OSF/1 and Tru64 systems produced since 1995.  I hope that
--      # covers most systems running today.  This code pipes the CPU
--      # types through head -n 1, so we only detect the type of CPU 0.
--      ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
--      case "$ALPHA_CPU_TYPE" in
--          "EV4 (21064)")
--              UNAME_MACHINE="alpha" ;;
--          "EV4.5 (21064)")
--              UNAME_MACHINE="alpha" ;;
--          "LCA4 (21066/21068)")
--              UNAME_MACHINE="alpha" ;;
--          "EV5 (21164)")
--              UNAME_MACHINE="alphaev5" ;;
--          "EV5.6 (21164A)")
--              UNAME_MACHINE="alphaev56" ;;
--          "EV5.6 (21164PC)")
--              UNAME_MACHINE="alphapca56" ;;
--          "EV5.7 (21164PC)")
--              UNAME_MACHINE="alphapca57" ;;
--          "EV6 (21264)")
--              UNAME_MACHINE="alphaev6" ;;
--          "EV6.7 (21264A)")
--              UNAME_MACHINE="alphaev67" ;;
--          "EV6.8CB (21264C)")
--              UNAME_MACHINE="alphaev68" ;;
--          "EV6.8AL (21264B)")
--              UNAME_MACHINE="alphaev68" ;;
--          "EV6.8CX (21264D)")
--              UNAME_MACHINE="alphaev68" ;;
--          "EV6.9A (21264/EV69A)")
--              UNAME_MACHINE="alphaev69" ;;
--          "EV7 (21364)")
--              UNAME_MACHINE="alphaev7" ;;
--          "EV7.9 (21364A)")
--              UNAME_MACHINE="alphaev79" ;;
--      esac
--      # A Pn.n version is a patched version.
--      # A Vn.n version is a released version.
--      # A Tn.n version is a released field test version.
--      # A Xn.n version is an unreleased experimental baselevel.
--      # 1.2 uses "1.2" for uname -r.
--      echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
--      exit ;;
--    Alpha\ *:Windows_NT*:*)
--      # How do we know it's Interix rather than the generic POSIX subsystem?
--      # Should we change UNAME_MACHINE based on the output of uname instead
--      # of the specific Alpha model?
--      echo alpha-pc-interix
--      exit ;;
--    21064:Windows_NT:50:3)
--      echo alpha-dec-winnt3.5
--      exit ;;
--    Amiga*:UNIX_System_V:4.0:*)
--      echo m68k-unknown-sysv4
--      exit ;;
--    *:[Aa]miga[Oo][Ss]:*:*)
--      echo ${UNAME_MACHINE}-unknown-amigaos
--      exit ;;
--    *:[Mm]orph[Oo][Ss]:*:*)
--      echo ${UNAME_MACHINE}-unknown-morphos
--      exit ;;
--    *:OS/390:*:*)
--      echo i370-ibm-openedition
--      exit ;;
--    *:z/VM:*:*)
--      echo s390-ibm-zvmoe
--      exit ;;
--    *:OS400:*:*)
--        echo powerpc-ibm-os400
--      exit ;;
--    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
--      echo arm-acorn-riscix${UNAME_RELEASE}
--      exit ;;
--    arm:riscos:*:*|arm:RISCOS:*:*)
--      echo arm-unknown-riscos
--      exit ;;
--    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
--      echo hppa1.1-hitachi-hiuxmpp
--      exit ;;
--    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
--      # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
--      if test "`(/bin/universe) 2>/dev/null`" = att ; then
--              echo pyramid-pyramid-sysv3
--      else
--              echo pyramid-pyramid-bsd
--      fi
--      exit ;;
--    NILE*:*:*:dcosx)
--      echo pyramid-pyramid-svr4
--      exit ;;
--    DRS?6000:unix:4.0:6*)
--      echo sparc-icl-nx6
--      exit ;;
--    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
--      case `/usr/bin/uname -p` in
--          sparc) echo sparc-icl-nx7; exit ;;
--      esac ;;
--    sun4H:SunOS:5.*:*)
--      echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
--      exit ;;
--    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
--      echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
--      exit ;;
-     i86pc:SunOS:5.*:* | ix86xen:SunOS:5.*:*)
 -    i86pc:SunOS:5.*:*)
--      echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
--      exit ;;
--    sun4*:SunOS:6*:*)
--      # According to config.sub, this is the proper way to canonicalize
--      # SunOS6.  Hard to guess exactly what SunOS6 will be like, but
--      # it's likely to be more like Solaris than SunOS4.
--      echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
--      exit ;;
--    sun4*:SunOS:*:*)
--      case "`/usr/bin/arch -k`" in
--          Series*|S4*)
--              UNAME_RELEASE=`uname -v`
--              ;;
--      esac
--      # Japanese Language versions have a version number like `4.1.3-JL'.
--      echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
--      exit ;;
--    sun3*:SunOS:*:*)
--      echo m68k-sun-sunos${UNAME_RELEASE}
--      exit ;;
--    sun*:*:4.2BSD:*)
--      UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
--      test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
--      case "`/bin/arch`" in
--          sun3)
--              echo m68k-sun-sunos${UNAME_RELEASE}
--              ;;
--          sun4)
--              echo sparc-sun-sunos${UNAME_RELEASE}
--              ;;
--      esac
--      exit ;;
--    aushp:SunOS:*:*)
--      echo sparc-auspex-sunos${UNAME_RELEASE}
--      exit ;;
--    # The situation for MiNT is a little confusing.  The machine name
--    # can be virtually everything (everything which is not
--    # "atarist" or "atariste" at least should have a processor
--    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
--    # to the lowercase version "mint" (or "freemint").  Finally
--    # the system name "TOS" denotes a system which is actually not
--    # MiNT.  But MiNT is downward compatible to TOS, so this should
--    # be no problem.
--    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
--        echo m68k-atari-mint${UNAME_RELEASE}
--      exit ;;
--    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
--      echo m68k-atari-mint${UNAME_RELEASE}
--        exit ;;
--    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
--        echo m68k-atari-mint${UNAME_RELEASE}
--      exit ;;
--    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
--        echo m68k-milan-mint${UNAME_RELEASE}
--        exit ;;
--    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
--        echo m68k-hades-mint${UNAME_RELEASE}
--        exit ;;
--    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
--        echo m68k-unknown-mint${UNAME_RELEASE}
--        exit ;;
--    m68k:machten:*:*)
--      echo m68k-apple-machten${UNAME_RELEASE}
--      exit ;;
--    powerpc:machten:*:*)
--      echo powerpc-apple-machten${UNAME_RELEASE}
--      exit ;;
--    RISC*:Mach:*:*)
--      echo mips-dec-mach_bsd4.3
--      exit ;;
--    RISC*:ULTRIX:*:*)
--      echo mips-dec-ultrix${UNAME_RELEASE}
--      exit ;;
--    VAX*:ULTRIX*:*:*)
--      echo vax-dec-ultrix${UNAME_RELEASE}
--      exit ;;
--    2020:CLIX:*:* | 2430:CLIX:*:*)
--      echo clipper-intergraph-clix${UNAME_RELEASE}
--      exit ;;
--    mips:*:*:UMIPS | mips:*:*:RISCos)
--      eval $set_cc_for_build
--      sed 's/^        //' << EOF >$dummy.c
--#ifdef __cplusplus
--#include <stdio.h>  /* for printf() prototype */
--      int main (int argc, char *argv[]) {
--#else
--      int main (argc, argv) int argc; char *argv[]; {
--#endif
--      #if defined (host_mips) && defined (MIPSEB)
--      #if defined (SYSTYPE_SYSV)
--        printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
--      #endif
--      #if defined (SYSTYPE_SVR4)
--        printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
--      #endif
--      #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
--        printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
--      #endif
--      #endif
--        exit (-1);
--      }
--EOF
--      $CC_FOR_BUILD -o $dummy $dummy.c &&
--        dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
--        SYSTEM_NAME=`$dummy $dummyarg` &&
--          { echo "$SYSTEM_NAME"; exit; }
--      echo mips-mips-riscos${UNAME_RELEASE}
--      exit ;;
--    Motorola:PowerMAX_OS:*:*)
--      echo powerpc-motorola-powermax
--      exit ;;
--    Motorola:*:4.3:PL8-*)
--      echo powerpc-harris-powermax
--      exit ;;
--    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
--      echo powerpc-harris-powermax
--      exit ;;
--    Night_Hawk:Power_UNIX:*:*)
--      echo powerpc-harris-powerunix
--      exit ;;
--    m88k:CX/UX:7*:*)
--      echo m88k-harris-cxux7
--      exit ;;
--    m88k:*:4*:R4*)
--      echo m88k-motorola-sysv4
--      exit ;;
--    m88k:*:3*:R3*)
--      echo m88k-motorola-sysv3
--      exit ;;
--    AViiON:dgux:*:*)
--        # DG/UX returns AViiON for all architectures
--        UNAME_PROCESSOR=`/usr/bin/uname -p`
--      if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
--      then
--          if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
--             [ ${TARGET_BINARY_INTERFACE}x = x ]
--          then
--              echo m88k-dg-dgux${UNAME_RELEASE}
--          else
--              echo m88k-dg-dguxbcs${UNAME_RELEASE}
--          fi
--      else
--          echo i586-dg-dgux${UNAME_RELEASE}
--      fi
--      exit ;;
--    M88*:DolphinOS:*:*)       # DolphinOS (SVR3)
--      echo m88k-dolphin-sysv3
--      exit ;;
--    M88*:*:R3*:*)
--      # Delta 88k system running SVR3
--      echo m88k-motorola-sysv3
--      exit ;;
--    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
--      echo m88k-tektronix-sysv3
--      exit ;;
--    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
--      echo m68k-tektronix-bsd
--      exit ;;
--    *:IRIX*:*:*)
--      echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
--      exit ;;
--    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
--      echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
--      exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
--    i*86:AIX:*:*)
--      echo i386-ibm-aix
--      exit ;;
--    ia64:AIX:*:*)
--      if [ -x /usr/bin/oslevel ] ; then
--              IBM_REV=`/usr/bin/oslevel`
--      else
--              IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
--      fi
--      echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
--      exit ;;
--    *:AIX:2:3)
--      if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
--              eval $set_cc_for_build
--              sed 's/^                //' << EOF >$dummy.c
--              #include <sys/systemcfg.h>
--
--              main()
--                      {
--                      if (!__power_pc())
--                              exit(1);
--                      puts("powerpc-ibm-aix3.2.5");
--                      exit(0);
--                      }
--EOF
--              if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
--              then
--                      echo "$SYSTEM_NAME"
--              else
--                      echo rs6000-ibm-aix3.2.5
--              fi
--      elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
--              echo rs6000-ibm-aix3.2.4
--      else
--              echo rs6000-ibm-aix3.2
--      fi
--      exit ;;
--    *:AIX:*:[45])
--      IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
--      if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
--              IBM_ARCH=rs6000
--      else
--              IBM_ARCH=powerpc
--      fi
--      if [ -x /usr/bin/oslevel ] ; then
--              IBM_REV=`/usr/bin/oslevel`
--      else
--              IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
--      fi
--      echo ${IBM_ARCH}-ibm-aix${IBM_REV}
--      exit ;;
--    *:AIX:*:*)
--      echo rs6000-ibm-aix
--      exit ;;
--    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
--      echo romp-ibm-bsd4.4
--      exit ;;
--    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
--      echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
--      exit ;;                             # report: romp-ibm BSD 4.3
--    *:BOSX:*:*)
--      echo rs6000-bull-bosx
--      exit ;;
--    DPX/2?00:B.O.S.:*:*)
--      echo m68k-bull-sysv3
--      exit ;;
--    9000/[34]??:4.3bsd:1.*:*)
--      echo m68k-hp-bsd
--      exit ;;
--    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
--      echo m68k-hp-bsd4.4
--      exit ;;
--    9000/[34678]??:HP-UX:*:*)
--      HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
--      case "${UNAME_MACHINE}" in
--          9000/31? )            HP_ARCH=m68000 ;;
--          9000/[34]?? )         HP_ARCH=m68k ;;
--          9000/[678][0-9][0-9])
--              if [ -x /usr/bin/getconf ]; then
--                  sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
--                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
--                    case "${sc_cpu_version}" in
--                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
--                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
--                      532)                      # CPU_PA_RISC2_0
--                        case "${sc_kernel_bits}" in
--                          32) HP_ARCH="hppa2.0n" ;;
--                          64) HP_ARCH="hppa2.0w" ;;
--                        '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
--                        esac ;;
--                    esac
--              fi
--              if [ "${HP_ARCH}" = "" ]; then
--                  eval $set_cc_for_build
--                  sed 's/^              //' << EOF >$dummy.c
--
--              #define _HPUX_SOURCE
--              #include <stdlib.h>
--              #include <unistd.h>
--
--              int main ()
--              {
--              #if defined(_SC_KERNEL_BITS)
--                  long bits = sysconf(_SC_KERNEL_BITS);
--              #endif
--                  long cpu  = sysconf (_SC_CPU_VERSION);
--
--                  switch (cpu)
--                      {
--                      case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
--                      case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
--                      case CPU_PA_RISC2_0:
--              #if defined(_SC_KERNEL_BITS)
--                          switch (bits)
--                              {
--                              case 64: puts ("hppa2.0w"); break;
--                              case 32: puts ("hppa2.0n"); break;
--                              default: puts ("hppa2.0"); break;
--                              } break;
--              #else  /* !defined(_SC_KERNEL_BITS) */
--                          puts ("hppa2.0"); break;
--              #endif
--                      default: puts ("hppa1.0"); break;
--                      }
--                  exit (0);
--              }
--EOF
--                  (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
--                  test -z "$HP_ARCH" && HP_ARCH=hppa
--              fi ;;
--      esac
--      if [ ${HP_ARCH} = "hppa2.0w" ]
--      then
--          eval $set_cc_for_build
--
--          # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
--          # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
--          # generating 64-bit code.  GNU and HP use different nomenclature:
--          #
--          # $ CC_FOR_BUILD=cc ./config.guess
--          # => hppa2.0w-hp-hpux11.23
--          # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
--          # => hppa64-hp-hpux11.23
--
--          if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
--              grep __LP64__ >/dev/null
--          then
--              HP_ARCH="hppa2.0w"
--          else
--              HP_ARCH="hppa64"
--          fi
--      fi
--      echo ${HP_ARCH}-hp-hpux${HPUX_REV}
--      exit ;;
--    ia64:HP-UX:*:*)
--      HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
--      echo ia64-hp-hpux${HPUX_REV}
--      exit ;;
--    3050*:HI-UX:*:*)
--      eval $set_cc_for_build
--      sed 's/^        //' << EOF >$dummy.c
--      #include <unistd.h>
--      int
--      main ()
--      {
--        long cpu = sysconf (_SC_CPU_VERSION);
--        /* The order matters, because CPU_IS_HP_MC68K erroneously returns
--           true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
--           results, however.  */
--        if (CPU_IS_PA_RISC (cpu))
--          {
--            switch (cpu)
--              {
--                case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
--                case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
--                case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
--                default: puts ("hppa-hitachi-hiuxwe2"); break;
--              }
--          }
--        else if (CPU_IS_HP_MC68K (cpu))
--          puts ("m68k-hitachi-hiuxwe2");
--        else puts ("unknown-hitachi-hiuxwe2");
--        exit (0);
--      }
--EOF
--      $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
--              { echo "$SYSTEM_NAME"; exit; }
--      echo unknown-hitachi-hiuxwe2
--      exit ;;
--    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
--      echo hppa1.1-hp-bsd
--      exit ;;
--    9000/8??:4.3bsd:*:*)
--      echo hppa1.0-hp-bsd
--      exit ;;
--    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
--      echo hppa1.0-hp-mpeix
--      exit ;;
--    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
--      echo hppa1.1-hp-osf
--      exit ;;
--    hp8??:OSF1:*:*)
--      echo hppa1.0-hp-osf
--      exit ;;
--    i*86:OSF1:*:*)
--      if [ -x /usr/sbin/sysversion ] ; then
--          echo ${UNAME_MACHINE}-unknown-osf1mk
--      else
--          echo ${UNAME_MACHINE}-unknown-osf1
--      fi
--      exit ;;
--    parisc*:Lites*:*:*)
--      echo hppa1.1-hp-lites
--      exit ;;
--    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
--      echo c1-convex-bsd
--        exit ;;
--    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
--      if getsysinfo -f scalar_acc
--      then echo c32-convex-bsd
--      else echo c2-convex-bsd
--      fi
--        exit ;;
--    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
--      echo c34-convex-bsd
--        exit ;;
--    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
--      echo c38-convex-bsd
--        exit ;;
--    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
--      echo c4-convex-bsd
--        exit ;;
--    CRAY*Y-MP:*:*:*)
--      echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
--      exit ;;
--    CRAY*[A-Z]90:*:*:*)
--      echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
--      | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
--            -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
--            -e 's/\.[^.]*$/.X/'
--      exit ;;
--    CRAY*TS:*:*:*)
--      echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
--      exit ;;
--    CRAY*T3E:*:*:*)
--      echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
--      exit ;;
--    CRAY*SV1:*:*:*)
--      echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
--      exit ;;
--    *:UNICOS/mp:*:*)
--      echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
--      exit ;;
--    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
--      FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
--        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
--        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
--        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
--        exit ;;
--    5000:UNIX_System_V:4.*:*)
--        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
--        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
--        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
--      exit ;;
--    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
--      echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
--      exit ;;
--    sparc*:BSD/OS:*:*)
--      echo sparc-unknown-bsdi${UNAME_RELEASE}
--      exit ;;
--    *:BSD/OS:*:*)
--      echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
--      exit ;;
--    *:FreeBSD:*:*)
-       case ${UNAME_MACHINE} in
-           pc98)
-               echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
-           amd64)
-               echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
-           *)
-               echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
-       esac
 -      echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
--      exit ;;
--    i*:CYGWIN*:*)
--      echo ${UNAME_MACHINE}-pc-cygwin
--      exit ;;
-     *:MINGW*:*)
 -    i*:MINGW*:*)
--      echo ${UNAME_MACHINE}-pc-mingw32
--      exit ;;
--    i*:windows32*:*)
--      # uname -m includes "-pc" on this system.
--      echo ${UNAME_MACHINE}-mingw32
--      exit ;;
--    i*:PW*:*)
--      echo ${UNAME_MACHINE}-pc-pw32
--      exit ;;
-     *:Interix*:[3456]*)
-       case ${UNAME_MACHINE} in
-           x86) 
-               echo i586-pc-interix${UNAME_RELEASE}
-               exit ;;
-           EM64T | authenticamd)
-               echo x86_64-unknown-interix${UNAME_RELEASE}
-               exit ;;
-       esac ;;
 -    x86:Interix*:[345]*)
 -      echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
 -      exit ;;
--    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
--      echo i${UNAME_MACHINE}-pc-mks
--      exit ;;
--    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
--      # How do we know it's Interix rather than the generic POSIX subsystem?
--      # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
--      # UNAME_MACHINE based on the output of uname instead of i386?
--      echo i586-pc-interix
--      exit ;;
--    i*:UWIN*:*)
--      echo ${UNAME_MACHINE}-pc-uwin
--      exit ;;
--    amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
--      echo x86_64-unknown-cygwin
--      exit ;;
--    p*:CYGWIN*:*)
--      echo powerpcle-unknown-cygwin
--      exit ;;
--    prep*:SunOS:5.*:*)
--      echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
--      exit ;;
--    *:GNU:*:*)
--      # the GNU system
--      echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
--      exit ;;
--    *:GNU/*:*:*)
--      # other systems with GNU libc and userland
--      echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
--      exit ;;
--    i*86:Minix:*:*)
--      echo ${UNAME_MACHINE}-pc-minix
--      exit ;;
--    arm*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit ;;
-     avr32*:Linux:*:*)
--      echo ${UNAME_MACHINE}-unknown-linux-gnu
--      exit ;;
--    cris:Linux:*:*)
--      echo cris-axis-linux-gnu
--      exit ;;
--    crisv32:Linux:*:*)
--      echo crisv32-axis-linux-gnu
--      exit ;;
--    frv:Linux:*:*)
--      echo frv-unknown-linux-gnu
--      exit ;;
--    ia64:Linux:*:*)
--      echo ${UNAME_MACHINE}-unknown-linux-gnu
--      exit ;;
--    m32r*:Linux:*:*)
--      echo ${UNAME_MACHINE}-unknown-linux-gnu
--      exit ;;
--    m68*:Linux:*:*)
--      echo ${UNAME_MACHINE}-unknown-linux-gnu
--      exit ;;
--    mips:Linux:*:*)
--      eval $set_cc_for_build
--      sed 's/^        //' << EOF >$dummy.c
--      #undef CPU
--      #undef mips
--      #undef mipsel
--      #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
--      CPU=mipsel
--      #else
--      #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
--      CPU=mips
--      #else
--      CPU=
--      #endif
--      #endif
--EOF
-       eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
-           /^CPU/{
-               s: ::g
-               p
-           }'`"
 -      eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^CPU/{s: ::g;p;}'`"
--      test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
--      ;;
--    mips64:Linux:*:*)
--      eval $set_cc_for_build
--      sed 's/^        //' << EOF >$dummy.c
--      #undef CPU
--      #undef mips64
--      #undef mips64el
--      #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
--      CPU=mips64el
--      #else
--      #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
--      CPU=mips64
--      #else
--      CPU=
--      #endif
--      #endif
--EOF
-       eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
-           /^CPU/{
-               s: ::g
-               p
-           }'`"
 -      eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^CPU/{s: ::g;p;}'`"
--      test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
--      ;;
--    or32:Linux:*:*)
--      echo or32-unknown-linux-gnu
--      exit ;;
--    ppc:Linux:*:*)
--      echo powerpc-unknown-linux-gnu
--      exit ;;
--    ppc64:Linux:*:*)
--      echo powerpc64-unknown-linux-gnu
--      exit ;;
--    alpha:Linux:*:*)
--      case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
--        EV5)   UNAME_MACHINE=alphaev5 ;;
--        EV56)  UNAME_MACHINE=alphaev56 ;;
--        PCA56) UNAME_MACHINE=alphapca56 ;;
--        PCA57) UNAME_MACHINE=alphapca56 ;;
--        EV6)   UNAME_MACHINE=alphaev6 ;;
--        EV67)  UNAME_MACHINE=alphaev67 ;;
--        EV68*) UNAME_MACHINE=alphaev68 ;;
--        esac
--      objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
--      if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
--      echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
--      exit ;;
--    parisc:Linux:*:* | hppa:Linux:*:*)
--      # Look for CPU level
--      case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
--        PA7*) echo hppa1.1-unknown-linux-gnu ;;
--        PA8*) echo hppa2.0-unknown-linux-gnu ;;
--        *)    echo hppa-unknown-linux-gnu ;;
--      esac
--      exit ;;
--    parisc64:Linux:*:* | hppa64:Linux:*:*)
--      echo hppa64-unknown-linux-gnu
--      exit ;;
--    s390:Linux:*:* | s390x:Linux:*:*)
--      echo ${UNAME_MACHINE}-ibm-linux
--      exit ;;
--    sh64*:Linux:*:*)
--      echo ${UNAME_MACHINE}-unknown-linux-gnu
--      exit ;;
--    sh*:Linux:*:*)
--      echo ${UNAME_MACHINE}-unknown-linux-gnu
--      exit ;;
--    sparc:Linux:*:* | sparc64:Linux:*:*)
--      echo ${UNAME_MACHINE}-unknown-linux-gnu
--      exit ;;
--    vax:Linux:*:*)
--      echo ${UNAME_MACHINE}-dec-linux-gnu
--      exit ;;
--    x86_64:Linux:*:*)
--      echo x86_64-unknown-linux-gnu
-       exit ;;
-     xtensa:Linux:*:*)
-       echo xtensa-unknown-linux-gnu
--      exit ;;
--    i*86:Linux:*:*)
--      # The BFD linker knows what the default object file format is, so
--      # first see if it will tell us. cd to the root directory to prevent
--      # problems with other programs or directories called `ld' in the path.
--      # Set LC_ALL=C to ensure ld outputs messages in English.
--      ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
--                       | sed -ne '/supported targets:/!d
--                                  s/[         ][      ]*/ /g
--                                  s/.*supported targets: *//
--                                  s/ .*//
--                                  p'`
--        case "$ld_supported_targets" in
--        elf32-i386)
--              TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
--              ;;
--        a.out-i386-linux)
--              echo "${UNAME_MACHINE}-pc-linux-gnuaout"
--              exit ;;
--        coff-i386)
--              echo "${UNAME_MACHINE}-pc-linux-gnucoff"
--              exit ;;
--        "")
--              # Either a pre-BFD a.out linker (linux-gnuoldld) or
--              # one that does not give us useful --help.
--              echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
--              exit ;;
--      esac
--      # Determine whether the default compiler is a.out or elf
--      eval $set_cc_for_build
--      sed 's/^        //' << EOF >$dummy.c
--      #include <features.h>
--      #ifdef __ELF__
--      # ifdef __GLIBC__
--      #  if __GLIBC__ >= 2
--      LIBC=gnu
--      #  else
--      LIBC=gnulibc1
--      #  endif
--      # else
--      LIBC=gnulibc1
--      # endif
--      #else
-       #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
 -      #if defined(__INTEL_COMPILER) || defined(__PGI)
--      LIBC=gnu
--      #else
--      LIBC=gnuaout
--      #endif
--      #endif
--      #ifdef __dietlibc__
--      LIBC=dietlibc
--      #endif
--EOF
-       eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
-           /^LIBC/{
-               s: ::g
-               p
-           }'`"
 -      eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '/^LIBC/{s: ::g;p;}'`"
--      test x"${LIBC}" != x && {
--              echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
--              exit
--      }
--      test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
--      ;;
--    i*86:DYNIX/ptx:4*:*)
--      # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
--      # earlier versions are messed up and put the nodename in both
--      # sysname and nodename.
--      echo i386-sequent-sysv4
--      exit ;;
--    i*86:UNIX_SV:4.2MP:2.*)
--        # Unixware is an offshoot of SVR4, but it has its own version
--        # number series starting with 2...
--        # I am not positive that other SVR4 systems won't match this,
--      # I just have to hope.  -- rms.
--        # Use sysv4.2uw... so that sysv4* matches it.
--      echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
--      exit ;;
--    i*86:OS/2:*:*)
--      # If we were able to find `uname', then EMX Unix compatibility
--      # is probably installed.
--      echo ${UNAME_MACHINE}-pc-os2-emx
--      exit ;;
--    i*86:XTS-300:*:STOP)
--      echo ${UNAME_MACHINE}-unknown-stop
--      exit ;;
--    i*86:atheos:*:*)
--      echo ${UNAME_MACHINE}-unknown-atheos
--      exit ;;
--    i*86:syllable:*:*)
--      echo ${UNAME_MACHINE}-pc-syllable
--      exit ;;
--    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
--      echo i386-unknown-lynxos${UNAME_RELEASE}
--      exit ;;
--    i*86:*DOS:*:*)
--      echo ${UNAME_MACHINE}-pc-msdosdjgpp
--      exit ;;
--    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
--      UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
--      if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
--              echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
--      else
--              echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
--      fi
--      exit ;;
--    i*86:*:5:[678]*)
--      # UnixWare 7.x, OpenUNIX and OpenServer 6.
--      case `/bin/uname -X | grep "^Machine"` in
--          *486*)           UNAME_MACHINE=i486 ;;
--          *Pentium)        UNAME_MACHINE=i586 ;;
--          *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
--      esac
--      echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
--      exit ;;
--    i*86:*:3.2:*)
--      if test -f /usr/options/cb.name; then
--              UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
--              echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
--      elif /bin/uname -X 2>/dev/null >/dev/null ; then
--              UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
--              (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
--              (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
--                      && UNAME_MACHINE=i586
--              (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
--                      && UNAME_MACHINE=i686
--              (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
--                      && UNAME_MACHINE=i686
--              echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
--      else
--              echo ${UNAME_MACHINE}-pc-sysv32
--      fi
--      exit ;;
--    pc:*:*:*)
--      # Left here for compatibility:
--        # uname -m prints for DJGPP always 'pc', but it prints nothing about
--        # the processor, so we play safe by assuming i386.
--      echo i386-pc-msdosdjgpp
--        exit ;;
--    Intel:Mach:3*:*)
--      echo i386-pc-mach3
--      exit ;;
--    paragon:*:*:*)
--      echo i860-intel-osf1
--      exit ;;
--    i860:*:4.*:*) # i860-SVR4
--      if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
--        echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
--      else # Add other i860-SVR4 vendors below as they are discovered.
--        echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
--      fi
--      exit ;;
--    mini*:CTIX:SYS*5:*)
--      # "miniframe"
--      echo m68010-convergent-sysv
--      exit ;;
--    mc68k:UNIX:SYSTEM5:3.51m)
--      echo m68k-convergent-sysv
--      exit ;;
--    M680?0:D-NIX:5.3:*)
--      echo m68k-diab-dnix
--      exit ;;
--    M68*:*:R3V[5678]*:*)
--      test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
--    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
--      OS_REL=''
--      test -r /etc/.relid \
--      && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
--      /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
--        && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
--      /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
--        && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
--    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
--        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
--          && { echo i486-ncr-sysv4; exit; } ;;
--    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
--      echo m68k-unknown-lynxos${UNAME_RELEASE}
--      exit ;;
--    mc68030:UNIX_System_V:4.*:*)
--      echo m68k-atari-sysv4
--      exit ;;
--    TSUNAMI:LynxOS:2.*:*)
--      echo sparc-unknown-lynxos${UNAME_RELEASE}
--      exit ;;
--    rs6000:LynxOS:2.*:*)
--      echo rs6000-unknown-lynxos${UNAME_RELEASE}
--      exit ;;
--    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
--      echo powerpc-unknown-lynxos${UNAME_RELEASE}
--      exit ;;
--    SM[BE]S:UNIX_SV:*:*)
--      echo mips-dde-sysv${UNAME_RELEASE}
--      exit ;;
--    RM*:ReliantUNIX-*:*:*)
--      echo mips-sni-sysv4
--      exit ;;
--    RM*:SINIX-*:*:*)
--      echo mips-sni-sysv4
--      exit ;;
--    *:SINIX-*:*:*)
--      if uname -p 2>/dev/null >/dev/null ; then
--              UNAME_MACHINE=`(uname -p) 2>/dev/null`
--              echo ${UNAME_MACHINE}-sni-sysv4
--      else
--              echo ns32k-sni-sysv
--      fi
--      exit ;;
--    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
--                      # says <Richard.M.Bartel@ccMail.Census.GOV>
--        echo i586-unisys-sysv4
--        exit ;;
--    *:UNIX_System_V:4*:FTX*)
--      # From Gerald Hewes <hewes@openmarket.com>.
--      # How about differentiating between stratus architectures? -djm
--      echo hppa1.1-stratus-sysv4
--      exit ;;
--    *:*:*:FTX*)
--      # From seanf@swdc.stratus.com.
--      echo i860-stratus-sysv4
--      exit ;;
--    i*86:VOS:*:*)
--      # From Paul.Green@stratus.com.
--      echo ${UNAME_MACHINE}-stratus-vos
--      exit ;;
--    *:VOS:*:*)
--      # From Paul.Green@stratus.com.
--      echo hppa1.1-stratus-vos
--      exit ;;
--    mc68*:A/UX:*:*)
--      echo m68k-apple-aux${UNAME_RELEASE}
--      exit ;;
--    news*:NEWS-OS:6*:*)
--      echo mips-sony-newsos6
--      exit ;;
--    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
--      if [ -d /usr/nec ]; then
--              echo mips-nec-sysv${UNAME_RELEASE}
--      else
--              echo mips-unknown-sysv${UNAME_RELEASE}
--      fi
--        exit ;;
--    BeBox:BeOS:*:*)   # BeOS running on hardware made by Be, PPC only.
--      echo powerpc-be-beos
--      exit ;;
--    BeMac:BeOS:*:*)   # BeOS running on Mac or Mac clone, PPC only.
--      echo powerpc-apple-beos
--      exit ;;
--    BePC:BeOS:*:*)    # BeOS running on Intel PC compatible.
--      echo i586-pc-beos
--      exit ;;
--    SX-4:SUPER-UX:*:*)
--      echo sx4-nec-superux${UNAME_RELEASE}
--      exit ;;
--    SX-5:SUPER-UX:*:*)
--      echo sx5-nec-superux${UNAME_RELEASE}
--      exit ;;
--    SX-6:SUPER-UX:*:*)
--      echo sx6-nec-superux${UNAME_RELEASE}
-       exit ;;
-     SX-7:SUPER-UX:*:*)
-       echo sx7-nec-superux${UNAME_RELEASE}
-       exit ;;
-     SX-8:SUPER-UX:*:*)
-       echo sx8-nec-superux${UNAME_RELEASE}
-       exit ;;
-     SX-8R:SUPER-UX:*:*)
-       echo sx8r-nec-superux${UNAME_RELEASE}
--      exit ;;
--    Power*:Rhapsody:*:*)
--      echo powerpc-apple-rhapsody${UNAME_RELEASE}
--      exit ;;
--    *:Rhapsody:*:*)
--      echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
--      exit ;;
--    *:Darwin:*:*)
--      UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
--      case $UNAME_PROCESSOR in
--          unknown) UNAME_PROCESSOR=powerpc ;;
--      esac
--      echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
--      exit ;;
--    *:procnto*:*:* | *:QNX:[0123456789]*:*)
--      UNAME_PROCESSOR=`uname -p`
--      if test "$UNAME_PROCESSOR" = "x86"; then
--              UNAME_PROCESSOR=i386
--              UNAME_MACHINE=pc
--      fi
--      echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
--      exit ;;
--    *:QNX:*:4*)
--      echo i386-pc-qnx
--      exit ;;
--    NSE-?:NONSTOP_KERNEL:*:*)
--      echo nse-tandem-nsk${UNAME_RELEASE}
--      exit ;;
--    NSR-?:NONSTOP_KERNEL:*:*)
--      echo nsr-tandem-nsk${UNAME_RELEASE}
--      exit ;;
--    *:NonStop-UX:*:*)
--      echo mips-compaq-nonstopux
--      exit ;;
--    BS2000:POSIX*:*:*)
--      echo bs2000-siemens-sysv
--      exit ;;
--    DS/*:UNIX_System_V:*:*)
--      echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
--      exit ;;
--    *:Plan9:*:*)
--      # "uname -m" is not consistent, so use $cputype instead. 386
--      # is converted to i386 for consistency with other x86
--      # operating systems.
--      if test "$cputype" = "386"; then
--          UNAME_MACHINE=i386
--      else
--          UNAME_MACHINE="$cputype"
--      fi
--      echo ${UNAME_MACHINE}-unknown-plan9
--      exit ;;
--    *:TOPS-10:*:*)
--      echo pdp10-unknown-tops10
--      exit ;;
--    *:TENEX:*:*)
--      echo pdp10-unknown-tenex
--      exit ;;
--    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
--      echo pdp10-dec-tops20
--      exit ;;
--    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
--      echo pdp10-xkl-tops20
--      exit ;;
--    *:TOPS-20:*:*)
--      echo pdp10-unknown-tops20
--      exit ;;
--    *:ITS:*:*)
--      echo pdp10-unknown-its
--      exit ;;
--    SEI:*:*:SEIUX)
--        echo mips-sei-seiux${UNAME_RELEASE}
--      exit ;;
--    *:DragonFly:*:*)
--      echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
--      exit ;;
--    *:*VMS:*:*)
--      UNAME_MACHINE=`(uname -p) 2>/dev/null`
--      case "${UNAME_MACHINE}" in
--          A*) echo alpha-dec-vms ; exit ;;
--          I*) echo ia64-dec-vms ; exit ;;
--          V*) echo vax-dec-vms ; exit ;;
--      esac ;;
--    *:XENIX:*:SysV)
--      echo i386-pc-xenix
--      exit ;;
--    i*86:skyos:*:*)
--      echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
--      exit ;;
--    i*86:rdos:*:*)
--      echo ${UNAME_MACHINE}-pc-rdos
--      exit ;;
--esac
--
--#echo '(No uname command or uname output not recognized.)' 1>&2
--#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
--
--eval $set_cc_for_build
--cat >$dummy.c <<EOF
--#ifdef _SEQUENT_
--# include <sys/types.h>
--# include <sys/utsname.h>
--#endif
--main ()
--{
--#if defined (sony)
--#if defined (MIPSEB)
--  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
--     I don't know....  */
--  printf ("mips-sony-bsd\n"); exit (0);
--#else
--#include <sys/param.h>
--  printf ("m68k-sony-newsos%s\n",
--#ifdef NEWSOS4
--          "4"
--#else
--        ""
--#endif
--         ); exit (0);
--#endif
--#endif
--
--#if defined (__arm) && defined (__acorn) && defined (__unix)
--  printf ("arm-acorn-riscix\n"); exit (0);
--#endif
--
--#if defined (hp300) && !defined (hpux)
--  printf ("m68k-hp-bsd\n"); exit (0);
--#endif
--
--#if defined (NeXT)
--#if !defined (__ARCHITECTURE__)
--#define __ARCHITECTURE__ "m68k"
--#endif
--  int version;
--  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
--  if (version < 4)
--    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
--  else
--    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
--  exit (0);
--#endif
--
--#if defined (MULTIMAX) || defined (n16)
--#if defined (UMAXV)
--  printf ("ns32k-encore-sysv\n"); exit (0);
--#else
--#if defined (CMU)
--  printf ("ns32k-encore-mach\n"); exit (0);
--#else
--  printf ("ns32k-encore-bsd\n"); exit (0);
--#endif
--#endif
--#endif
--
--#if defined (__386BSD__)
--  printf ("i386-pc-bsd\n"); exit (0);
--#endif
--
--#if defined (sequent)
--#if defined (i386)
--  printf ("i386-sequent-dynix\n"); exit (0);
--#endif
--#if defined (ns32000)
--  printf ("ns32k-sequent-dynix\n"); exit (0);
--#endif
--#endif
--
--#if defined (_SEQUENT_)
--    struct utsname un;
--
--    uname(&un);
--
--    if (strncmp(un.version, "V2", 2) == 0) {
--      printf ("i386-sequent-ptx2\n"); exit (0);
--    }
--    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
--      printf ("i386-sequent-ptx1\n"); exit (0);
--    }
--    printf ("i386-sequent-ptx\n"); exit (0);
--
--#endif
--
--#if defined (vax)
--# if !defined (ultrix)
--#  include <sys/param.h>
--#  if defined (BSD)
--#   if BSD == 43
--      printf ("vax-dec-bsd4.3\n"); exit (0);
--#   else
--#    if BSD == 199006
--      printf ("vax-dec-bsd4.3reno\n"); exit (0);
--#    else
--      printf ("vax-dec-bsd\n"); exit (0);
--#    endif
--#   endif
--#  else
--    printf ("vax-dec-bsd\n"); exit (0);
--#  endif
--# else
--    printf ("vax-dec-ultrix\n"); exit (0);
--# endif
--#endif
--
--#if defined (alliant) && defined (i860)
--  printf ("i860-alliant-bsd\n"); exit (0);
--#endif
--
--  exit (1);
--}
--EOF
--
--$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
--      { echo "$SYSTEM_NAME"; exit; }
--
--# Apollos put the system type in the environment.
--
--test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
--
--# Convex versions that predate uname can use getsysinfo(1)
--
--if [ -x /usr/convex/getsysinfo ]
--then
--    case `getsysinfo -f cpu_type` in
--    c1*)
--      echo c1-convex-bsd
--      exit ;;
--    c2*)
--      if getsysinfo -f scalar_acc
--      then echo c32-convex-bsd
--      else echo c2-convex-bsd
--      fi
--      exit ;;
--    c34*)
--      echo c34-convex-bsd
--      exit ;;
--    c38*)
--      echo c38-convex-bsd
--      exit ;;
--    c4*)
--      echo c4-convex-bsd
--      exit ;;
--    esac
--fi
--
--cat >&2 <<EOF
--$0: unable to guess system type
--
--This script, last modified $timestamp, has failed to recognize
--the operating system you are using. It is advised that you
--download the most up to date version of the config scripts from
--
--  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
--and
--  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
--
--If the version you run ($0) is already up to date, please
--send the following data and any information you think might be
--pertinent to <config-patches@gnu.org> in order to provide the needed
--information to handle your system.
--
--config.guess timestamp = $timestamp
--
--uname -m = `(uname -m) 2>/dev/null || echo unknown`
--uname -r = `(uname -r) 2>/dev/null || echo unknown`
--uname -s = `(uname -s) 2>/dev/null || echo unknown`
--uname -v = `(uname -v) 2>/dev/null || echo unknown`
--
--/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
--/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
--
--hostinfo               = `(hostinfo) 2>/dev/null`
--/bin/universe          = `(/bin/universe) 2>/dev/null`
--/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
--/bin/arch              = `(/bin/arch) 2>/dev/null`
--/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
--/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
--
--UNAME_MACHINE = ${UNAME_MACHINE}
--UNAME_RELEASE = ${UNAME_RELEASE}
--UNAME_SYSTEM  = ${UNAME_SYSTEM}
--UNAME_VERSION = ${UNAME_VERSION}
--EOF
--
--exit 1
--
--# Local variables:
--# eval: (add-hook 'write-file-hooks 'time-stamp)
--# time-stamp-start: "timestamp='"
--# time-stamp-format: "%:y-%02m-%02d"
--# time-stamp-end: "'"
--# End:
diff --cc configure.ad
index c85bab2a6e316ef520da6880b9b1052f2f7a5977,c99faef62d772ccaec7564652532ca580826285b..08bc39156879b5354683f5334c3277ba694aa99a
@@@ -133,19 -121,232 +133,88 @@@ don
  __SILC_PACKAGE_VERSION="#define __SILC_TOOLKIT_VERSION SILC_VERSION($maj,$min,$bld)"
  #endif SILC_DIST_TOOLKIT
  
 -AC_PROG_RANLIB
 -#ifndef SILC_DIST_TOOLKIT
 -AC_DISABLE_SHARED
 -#endif SILC_DIST_TOOLKIT
 -#ifdef SILC_DIST_INPLACE
 -AC_DISABLE_SHARED
 -#endif SILC_DIST_INPLACE
 -AC_PROG_LIBTOOL
  
 -# Header checking
 -#
 -AC_HEADER_STDC
 -AC_HEADER_TIME
 -AC_HEADER_STAT
++##
++## Required dependencies
++##
 -# More header checking
 -#
 -AC_CHECK_HEADERS(unistd.h string.h getopt.h errno.h fcntl.h assert.h)
 -AC_CHECK_HEADERS(sys/types.h sys/stat.h sys/time.h stddef.h)
 -AC_CHECK_HEADERS(netinet/in.h netinet/tcp.h xti.h netdb.h sys/resource.h)
 -AC_CHECK_HEADERS(pwd.h grp.h termcap.h paths.h)
 -AC_CHECK_HEADERS(ncurses.h signal.h ctype.h utime.h)
 -AC_CHECK_HEADERS(arpa/inet.h sys/mman.h limits.h termios.h locale.h langinfo.h)
 -
 -# Data type checking
 -#
 -AC_TYPE_SIGNAL
 -AC_TYPE_SIZE_T
 -AC_TYPE_MODE_T
 -AC_TYPE_UID_T
 -AC_TYPE_PID_T
 -
 -AC_CHECK_SIZEOF(long long, 0)
 -AC_SUBST(SILC_SIZEOF_LONG_LONG, $ac_cv_sizeof_long_long)
 -AC_CHECK_SIZEOF(long, 0)
 -AC_SUBST(SILC_SIZEOF_LONG, $ac_cv_sizeof_long)
 -AC_CHECK_SIZEOF(int, 0)
 -AC_SUBST(SILC_SIZEOF_INT, $ac_cv_sizeof_int)
 -AC_CHECK_SIZEOF(short, 0)
 -AC_SUBST(SILC_SIZEOF_SHORT, $ac_cv_sizeof_short)
 -AC_CHECK_SIZEOF(char, 0)
 -AC_SUBST(SILC_SIZEOF_CHAR, $ac_cv_sizeof_char)
 -AC_CHECK_SIZEOF(void *, 0)
 -AC_SUBST(SILC_SIZEOF_VOID_P, $ac_cv_sizeof_void_p)
 -AC_CHECK_TYPES(long long)
 -AC_CHECK_TYPES(long double)
 -
 -# Function to check if compiler flag works
 -# Usage: SILC_ADD_CFLAGS(FLAGS, [ACTION-IF-FAILED])
 -AC_DEFUN([SILC_ADD_CFLAGS],
 -[ tmp_CFLAGS="$CFLAGS"
 -  CFLAGS="$CFLAGS $1"
 -  AC_MSG_CHECKING(whether $CC accepts $1 flag)
 -  AC_TRY_LINK([], [], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
 -                                     CFLAGS="$tmp_CFLAGS"
 -                                     $2])
 -  unset tmp_CFLAGS
 -])
 -
 -# Function to check if compiler flag works, destination specifiable
 -# Usage: SILC_ADD_CC_FLAGS(VAR, FLAGS, [ACTION-IF-FAILED])
 -AC_DEFUN([SILC_ADD_CC_FLAGS],
 -[ tmp_CFLAGS="$1_CFLAGS"
 -  $1_CFLAGS="${$1_CFLAGS} $2"
 -  AC_MSG_CHECKING(whether $CC accepts $2 flag)
 -  AC_TRY_LINK([], [], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
 -                                     $1_CFLAGS="$tmp_CFLAGS"
 -                                     $3])
 -  unset tmp_CFLAGS
 -])
 -
 -# Function and library checking
 -#
 -AC_CHECK_FUNC(gethostbyname, [],
 -  [
 -    AC_CHECK_LIB(nsl, gethostbyname, LIBS="$LIBS -lnsl")
 -    AC_CHECK_FUNC(res_gethostbyname, [],
 -       AC_CHECK_LIB(resolv, res_gethostbyname, LIBS="$LIBS -lresolv")
 -    )
 -  ])
 -AC_CHECK_FUNC(socket, [],
 -  AC_CHECK_LIB(socket, socket, LIBS="$LIBS -lsocket")
 -)
 -AC_CHECK_FUNCS(gethostname gethostbyaddr getservbyname getservbyport)
 -AC_CHECK_FUNCS(poll select listen bind shutdown close connect setsockopt)
 -AC_CHECK_FUNCS(setrlimit time ctime utime gettimeofday getrusage)
 -AC_CHECK_FUNCS(chmod fcntl stat fstat getenv putenv strerror)
 -AC_CHECK_FUNCS(getpid getgid getsid getpgid getpgrp getuid sched_yield)
 -AC_CHECK_FUNCS(setgroups initgroups nl_langinfo nanosleep)
 -AC_CHECK_FUNCS(strchr snprintf strstr strcpy strncpy memcpy memset memmove)
 -
 -# lib/contrib conditionals
 -#
 -AC_CHECK_HEADER(regex.h,
 -  [
 -    AC_DEFINE([HAVE_REGEX_H], [], [HAVE_REGEX_H])
 -    have_regex=1
 -  ], have_regex=0
 -)
 -AM_CONDITIONAL(HAVE_REGEX, test x$have_regex = x1)
++compile_libs=true
++LIBSUBDIR=lib
++LDFLAGS="-L\$(silc_top_srcdir)/lib $LDFLAGS"
 -AC_CHECK_FUNC(getopt_long,
 -  [
 -    AC_DEFINE([HAVE_GETOPT_LONG], [], [HAVE_GETOPT_LONG])
 -    have_getopt_long=1
 -  ], have_getopt_long=0
 -)
++# SILC Runtime Toolkit checking
++AC_ARG_WITH(srt-includes,
++  [  --with-srt-includes=DIR  SILC Runtime Toolkit includes [search in DIR]],
++  [ac_srt_includes="$withval"], [ac_srt_includes="no"])
++AC_ARG_WITH(srt-libs,
++  [  --with-srt-libs=DIR      SILC Runtime Toolkit libraries [search in DIR]],
++  [ac_srt_libs="$withval"], [ac_srt_libs="no"])
 -AC_CHECK_FUNC(getopt,
 -  [
 -    AC_DEFINE([HAVE_GETOPT], [], [HAVE_GETOPT])
 -    have_getopt=1
 -  ], have_getopt=0
 -)
++if test -n "$with_srt_includes" || test -n "$with_srt_libs"; then
++  # Manually provided libs
++  if test "$ac_srt_includes" != "no"; then
++    SILC_LIB_INCLUDES="-I$ac_srt_includes"
++  fi
++  if test "$ac_srt_libs" != "no"; then
++    LDFLAGS="-L$ac_srt_libs $LDFLAGS"
++  fi
 -##
 -##  Enable/disable checking
 -##
++  # Check libs to link against
++  f=`$EGREP __SILC_HAVE_PTHREAD $ac_srt_includes/silc.h`
++  if test -n "$f"; then
++    LIBS="$LIBS -lpthread"
++    has_threads=true
++  fi
++else
++  # pkg-config check
++  PKG_CHECK_MODULES(SRT, [srt >= 1.2])
++  LIBS="$SRT_LIBS $LIBS"
++  CFLAGS="$CFLAGS $SRT_CFLAGS"
++fi
 -# IPv6 support
 -#
 -AC_MSG_CHECKING(whether to enable IPv6 support)
 -AC_ARG_ENABLE(ipv6,
 -  [  --enable-ipv6           enable IPv6 support],
 -  [
 -    case "${enableval}" in
 -      yes)
 -        want_ipv6=true
 -        check_ipv6=false
 -      summary_ipv6="yes"
 -        AC_DEFINE([HAVE_IPV6], [], [HAVE_IPV6])
 -        AC_MSG_RESULT(yes)
 -        ;;
 -      *)
 -        want_ipv6=false
 -        check_ipv6=false
 -      summary_ipv6="no"
 -        AC_MSG_RESULT(no)
 -        ;;
 -    esac
 -  ],
 -    check_ipv6=true
 -  )
++# SILC Crypto Toolkit checking
++AC_ARG_WITH(sct-includes,
++  [  --with-sct-includes=DIR  SILC Crypto Toolkit includes [search in DIR]],
++  [ac_sct_includes="$withval"], [ac_sct_includes="no"])
++AC_ARG_WITH(sct-libs,
++  [  --with-sct-libs=DIR      SILC Crypto Toolkit libraries [search in DIR]],
++  [ac_sct_libs="$withval"], [ac_sct_libs="no"])
 -if test x$check_ipv6 = xtrue; then
 -  summary_ipv6="no"
 -  AC_TRY_COMPILE(
 -    [
 -      #ifdef HAVE_SYS_TYPES_H
 -      #include <sys/types.h>
 -      #endif
 -      #ifdef HAVE_NETINET_TCP_H
 -      #include <netinet/tcp.h>
 -      #endif
 -      #ifdef HAVE_NETDB_H
 -      #include <netdb.h>
 -      #endif
 -      #include <sys/socket.h>
 -      #ifdef HAVE_NETINET_IN_H
 -      #include <netinet/in.h>
 -      #endif
 -    ],
 -    [
 -      struct sockaddr_in6 sin6;
 -      int family = AF_INET6;
 -    ],
 -    [
 -      AC_DEFINE([HAVE_IPV6], [], [HAVE_IPV6])
 -      AC_MSG_RESULT(yes)
 -      summary_ipv6="yes"
 -    ],
 -      AC_MSG_RESULT(no)
 -    )
++if test -n "$with_sct_includes" || test -n "$with_sct_libs"; then
++  # Manually provided libs
++  if test "$ac_sct_includes" != "no"; then
++    SILC_LIB_INCLUDES="-I$ac_sct_includes"
++  fi
++  if test "$ac_sct_libs" != "no"; then
++    LDFLAGS="-L$ac_sct_libs $LDFLAGS"
++  fi
++
++  # Check libs to link against
++  f=`$EGREP __SILC_HAVE_PTHREAD $ac_sct_includes/silc.h`
++  if test -n "$f"; then
++    LIBS="$LIBS -lpthread"
++    has_threads=true
++  fi
++else
++  # pkg-config check
++  PKG_CHECK_MODULES(SCT, [sct >= 1.2])
++  LIBS="$SCT_LIBS $LIBS"
++  CFLAGS="$CFLAGS $SCT_CFLAGS"
+ fi
 -# Debug checking
 -#
 -AC_MSG_CHECKING(whether to enable debugging)
 -summary_debug="no"
 -__SILC_ENABLE_DEBUG=""
 -AC_ARG_ENABLE(debug,
 -  [  --enable-debug          enable debugging],
 -  [
 -    case "${enableval}" in
 -      yes)
 -        AC_MSG_RESULT(yes)
 -        AC_DEFINE([SILC_DEBUG], [], [enable-debug])
 -      summary_debug="yes"
 -        __SILC_ENABLE_DEBUG="#define __SILC_ENABLE_DEBUG 1"
 -        ;;
 -      *)
 -        AC_MSG_RESULT(no)
 -        ;;
 -    esac
 -  ],
 -  [
 -    AC_MSG_RESULT(no)
 -  ])
 -# Disable all compiler optimizations
 -#
 -AC_MSG_CHECKING(whether to enable compiler optimizations)
 -want_cc_optimizations=true
 -AC_ARG_ENABLE(optimizations,
 -  [  --disable-optimizations do not use any compiler optimizations],
 -  [
 -    AC_MSG_RESULT(no)
 -    AC_DEFINE([SILC_NO_CC_OPTIMIZATIONS], [], [SILC_NO_CC_OPTIMIZATIONS])
 -    want_cc_optimizations=false
 -  ],
 -  [
 -    AC_MSG_RESULT(yes)
 -    want_cc_optimizations=true
 -  ])
 -AM_CONDITIONAL(SILC_NO_CC_OPTIMIZATIONS, test x$want_cc_optimizations = xfalse)
 +##
 +## Detect CPU
 +##
  
 -# Disable all assembler optimizations
 -#
 -AC_MSG_CHECKING(whether to enable assembler optimizations)
 -want_asm=true
 -AC_ARG_ENABLE(asm,
 -  [  --disable-asm           do not use assembler optimizations],
 +# Disable all CPU feature optimizations
 +AC_MSG_CHECKING(whether to enable CPU feature optimizations)
 +AC_ARG_ENABLE(cpu-optimizations,
 +  [  --disable-cpu-optimizations  do not use any CPU feature optimizations],
    [
      AC_MSG_RESULT(no)
 -    AC_DEFINE([SILC_NO_ASM], [], [SILC_NO_ASM])
 -    want_asm=false
 +    AC_DEFINE([SILC_NO_CPU_OPTIMIZATIONS], [], [SILC_NO_CPU_OPTIMIZATIONS])
 +    want_cpu_optimizations=false
    ],
    [
      AC_MSG_RESULT(yes)
@@@ -461,72 -595,12 +530,8 @@@ AM_CONDITIONAL(SILC_NO_ASM, test x$want
  ##  With/without checkings
  ##
  
 -#
 -# SILC library checking
--compile_libs=true
--LIBSUBDIR=lib
- LDFLAGS="-L\$(silc_top_srcdir)/lib $LDFLAGS"
- # SILC Runtime Toolkit checking
- AC_ARG_WITH(srt-includes,
-   [  --with-srt-includes=DIR  SILC Runtime Toolkit includes [search in DIR]],
-   [ac_srt_includes="$withval"], [ac_srt_includes="no"])
- AC_ARG_WITH(srt-libs,
-   [  --with-srt-libs=DIR      SILC Runtime Toolkit libraries [search in DIR]],
-   [ac_srt_libs="$withval"], [ac_srt_libs="no"])
- if test -n "$with_srt_includes" || test -n "$with_srt_libs"; then
-   # Manually provided libs
-   if test "$ac_srt_includes" != "no"; then
-     SILC_LIB_INCLUDES="-I$ac_srt_includes"
-   fi
-   if test "$ac_srt_libs" != "no"; then
-     LDFLAGS="-L$ac_srt_libs $LDFLAGS"
-   fi
-   # Check libs to link against
-   f=`$EGREP __SILC_HAVE_PTHREAD $ac_srt_includes/silc.h`
-   if test -n "$f"; then
-     LIBS="$LIBS -lpthread"
-     has_threads=true
-   fi
- else
-   # pkg-config check
-   PKG_CHECK_MODULES(SRT, [srt >= 1.2])
-   LIBS="$SRT_LIBS $LIBS"
-   CFLAGS="$CFLAGS $SRT_CFLAGS"
- fi
- # SILC Crypto Toolkit checking
- AC_ARG_WITH(sct-includes,
-   [  --with-sct-includes=DIR  SILC Crypto Toolkit includes [search in DIR]],
-   [ac_sct_includes="$withval"], [ac_sct_includes="no"])
- AC_ARG_WITH(sct-libs,
-   [  --with-sct-libs=DIR      SILC Crypto Toolkit libraries [search in DIR]],
-   [ac_sct_libs="$withval"], [ac_sct_libs="no"])
- if test -n "$with_sct_includes" || test -n "$with_sct_libs"; then
-   # Manually provided libs
-   if test "$ac_sct_includes" != "no"; then
-     SILC_LIB_INCLUDES="-I$ac_sct_includes"
-   fi
-   if test "$ac_sct_libs" != "no"; then
-     LDFLAGS="-L$ac_sct_libs $LDFLAGS"
-   fi
-   # Check libs to link against
-   f=`$EGREP __SILC_HAVE_PTHREAD $ac_sct_includes/silc.h`
-   if test -n "$f"; then
-     LIBS="$LIBS -lpthread"
-     has_threads=true
-   fi
- else
-   # pkg-config check
-   PKG_CHECK_MODULES(SCT, [sct >= 1.2])
-   LIBS="$SCT_LIBS $LIBS"
-   CFLAGS="$CFLAGS $SCT_CFLAGS"
- fi
--
  #ifndef SILC_DIST_TOOLKIT
 +# SILC Protocol Toolkit checking
  AC_ARG_WITH(silc-includes,
    [  --with-silc-includes=DIR SILC Toolkit includes [search in DIR]],
    [ac_silc_includes="$withval"], [ac_silc_includes="no"])
@@@ -582,32 -658,50 +587,29 @@@ els
      LIBS="$LIBS $SILCSERVER_LIBS"
      CFLAGS="$CFLAGS $SILCSERVER_CFLAGS"
  #endif SILC_DIST_SERVERLIB
 -  else
 -    LDFLAGS="-L\$(silc_top_srcdir)/lib $LDFLAGS"
    fi
  fi
 -#else SILC_DIST_TOOLKIT
 -LDFLAGS="-L\$(silc_top_srcdir)/lib $LDFLAGS"
  #endif SILC_DIST_TOOLKIT
  
 -#ifdef SILC_DIST_SIM
 -# SIM support checking
 -# XXX These needs to be changed as more supported platforms appear.
 -# XXX This probably needs to be made platform dependant check.
 -#
 -sim_support=false
 -AC_MSG_CHECKING(for SIM support)
 -AC_MSG_RESULT()
 -AC_CHECK_HEADERS(dlfcn.h,
 -  [
 -    AC_CHECK_LIB(dl, dlopen,
 -      [
 -        AC_DEFINE([SILC_SIM], [], [HAVE_SIM])
 -        sim_support=true
 -        LIBS="$LIBS -ldl"
 -      ],
 -      [
 -        AC_CHECK_LIB(c, dlopen,
 -          [
 -            AC_DEFINE([SILC_SIM], [], [HAVE_SIM])
 -            sim_support=true
 -          ])
 -      ])
 -   ])
 -
 -AM_CONDITIONAL(SILC_SIM, test x$sim_support = xtrue)
 -if test x$sim_support = xtrue; then
 -  AC_MSG_RESULT(Enabled SIM support.)
 -  __SILC_HAVE_SIM="#define __SILC_HAVE_SIM 1"
 -else
 -  AC_MSG_RESULT(No SIM support found.)
 +if test x$compile_libs = xtrue; then
 +SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silccore"
 +SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcapputil"
 +SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcske"
 +#ifdef SILC_DIST_SFTP
 +SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcsftp"
 +#endif SILC_DIST_SFTP
 +#ifdef SILC_DIST_CLIENTLIB
 +SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcclient"
 +#endif SILC_DIST_CLIENTLIB
 +#ifdef SILC_DIST_SERVERLIB
 +SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcserver"
 +#endif SILC_DIST_SERVERLIB
- #ifdef SILC_DIST_HTTP
- SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silchttp"
- #endif SILC_DIST_HTTP
 +#ifdef SILC_DIST_VCARD
 +SILC_LIB_INCLUDES="$SILC_LIB_INCLUDES -I$SILC_TOP_SRCDIR/lib/silcvcard"
 +#endif SILC_DIST_VCARD
  fi
 -#endif SILC_DIST_SIM
  
  # SOCKS4 support checking
 -#
  SAVE_LIBS="$LIBS"
  SAVE_CFLAGS="$CFLAGS"
  SAVE_LDFLAGS="$LDFLAGS"
@@@ -824,60 -1402,9 +826,51 @@@ tutorial/Makefile.defines_in
  )
  #endif SILC_DIST_TOOLKIT
  
- #ifdef SILC_DIST_HTTP
- AC_CONFIG_FILES(
- lib/silchttp/Makefile
- #ifdef SILC_DIST_INPLACE
- lib/silchttp/tests/Makefile
- #endif SILC_DIST_INPLACE
- )
- #endif SILC_DIST_HTTP
 +if test x$compile_libs = xtrue; then
 +
 +AC_CONFIG_FILES(
 +lib/Makefile
 +lib/silccore/Makefile
 +lib/silcske/Makefile
 +lib/silcapputil/Makefile
 +#ifdef SILC_DIST_SFTP
 +lib/silcsftp/Makefile
 +lib/silcsftp/tests/Makefile
 +#endif SILC_DIST_SFTP
 +)
 +
 +#ifdef SILC_DIST_TOOLKIT
 +AC_CONFIG_FILES(
 +lib/silc.pc
 +lib/silcclient.pc
 +lib/silcserver.pc
 +)
 +#endif SILC_DIST_TOOLKIT
 +
 +#ifdef SILC_DIST_CLIENTLIB
 +AC_CONFIG_FILES(
 +lib/silcclient/Makefile
 +lib/silcclient/tests/Makefile
 +)
 +#endif SILC_DIST_CLIENTLIB
 +
 +#ifdef SILC_DIST_SERVERLIB
 +AC_CONFIG_FILES(
 +lib/silcserver/Makefile
 +lib/silcserver/tests/Makefile
 +)
 +#endif SILC_DIST_SERVERLIB
 +
 +#ifdef SILC_DIST_VCARD
 +AC_CONFIG_FILES(
 +lib/silcvcard/Makefile
 +)
 +#endif SILC_DIST_VCARD
 +
 +fi    # compile_libs
 +
  AC_OUTPUT
  
 -#ifdef SILC_DIST_COMPILER
  s_bindir=`eval echo $bindir`;s_bindir=`eval echo $s_bindir`
  s_sbindir=`eval echo $sbindir`;s_sbindir=`eval echo $s_sbindir`
  s_mandir=`eval echo $mandir`;s_mandir=`eval echo $s_mandir`
diff --cc distdir/server
index 4734b305562c8373c48a1d6c33f2b2b8f4389b5f,793321e18a9c564a64d85e1dfd7a7b6abc064119..a35f758731bfc16ebf9c565da11763c0756d7f47
@@@ -4,8 -4,7 +4,6 @@@ bug-report silc-devel@lists.silcnet.or
  
  inherit common
  define SILC_DIST_SERVER
- #define SILC_DIST_SERVERLIB
--define SILC_DIST_HTTP
  undef SILC_DIST_SFTP
  undef SILC_DIST_VCARD
  
diff --cc distdir/toolkit
index ddbb2732082757d3af3dc39ba7775fbe31dccc19,9d32fc2980d9d1108b7cfa6f7fee4ceb34acd9ec..cb054865e255032ba03d8fd1ad4074f30a9a72dc
@@@ -15,7 -15,8 +15,6 @@@ license-header distdir/GPL-header distd
  # Distdefs
  define SILC_DIST_TOOLKIT
  define SILC_DIST_CLIENTLIB
--define SILC_DIST_HTTP
 -define SILC_DIST_SIM
  
  # Includes
  include README.CVS
diff --cc lib/Makefile.ad
index df5d76eb991692d00c531fe35bae40d7f6d1fafd,df6fa0a530dfe4d68d04638383dbf5a42ccfc012..9312320c993b48e7c9f6d1c037212257b45f269f
@@@ -19,12 -19,29 +19,9 @@@ AUTOMAKE_OPTIONS = 1.0 no-dependencies 
  
  # SILC Library dirs
  SILCLIB_DIRS =                \
 -      contrib         \
        silccore        \
 -      silcutil        \
        silcapputil     \
 -#ifdef SILC_DIST_CRYPTO
 -      silccrypt       \
 -#endif SILC_DIST_CRYPTO
 -#ifdef SILC_DIST_SKR
 -      silcskr         \
 -#endif SILC_DIST_SKR
 -#ifdef SILC_DIST_MATH
 -      silcmath        \
 -#endif SILC_DIST_MATH
 -#ifdef SILC_DIST_SIM
 -      silcsim         \
 -#endif SILC_DIST_SIM
 -#ifdef SILC_DIST_ASN1
 -      silcasn1        \
 -#endif SILC_DIST_ASN1
        silcske         \
--#ifdef SILC_DIST_HTTP
--      silchttp        \
--#endif SILC_DIST_HTTP
  #ifdef SILC_DIST_SFTP
        silcsftp        \
  #endif SILC_DIST_SFTP
index d189e9321ee8568cab41ec777d86d324de3946f9,831970d5dd940e3b298795f8863e2fbbe91b396a..f549b770b4a3a007efb24e3a02a1af4c090eb6e5
@@@ -4,7 -4,7 +4,7 @@@
  
    Author: Pekka Riikonen <priikone@silcnet.org>
  
--  Copyright (C) 2000 - 2007 Pekka Riikonen
++  Copyright (C) 2000 - 2008 Pekka Riikonen
  
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
index fa139d2e31461155f6507c5e2982ed61de42a4f6,3ab7ba17b4aa96fc872496dce38c17ae078227d7..449fc375ce152b33bca4e0c3bbd06ce53870766d
@@@ -959,13 -953,20 +960,16 @@@ void silc_client_free(SilcClient client
    if (client->rng)
      silc_rng_free(client->rng);
  
 -  if (!client->internal->params->dont_register_crypto_library) {
 -    silc_cipher_unregister_all();
 -    silc_pkcs_unregister_all();
 -    silc_hash_unregister_all();
 -    silc_hmac_unregister_all();
 -  }
 +  if (!client->internal->params->dont_register_crypto_library)
 +    silc_crypto_uninit();
  
-   silc_packet_engine_stop(client->internal->packet_engine);
-   silc_dlist_uninit(client->internal->ftp_sessions);
-   silc_atomic_uninit16(&client->internal->conns);
-   silc_mutex_free(client->internal->lock);
+   if (client->internal->packet_engine)
+     silc_packet_engine_stop(client->internal->packet_engine);
+   if (client->internal->ftp_sessions)
+     silc_dlist_uninit(client->internal->ftp_sessions);
+   if (client->internal->lock)
+     silc_mutex_free(client->internal->lock);
+   silc_atomic_uninit32(&client->internal->conns);
    silc_free(client->username);
    silc_free(client->hostname);
    silc_free(client->realname);
Simple merge
index 32f272ec189b8fdff80cd6593cd9e72c3675b58c,4664dbaa75f770446b457b8b7d830b67cab2d524..017f8f8a7aebed168f14779bff0149df5d0b944b
@@@ -1687,67 -1706,18 +1700,21 @@@ SilcChannelEntry silc_client_add_channe
  SilcBool silc_client_del_channel(SilcClient client, SilcClientConnection conn,
                                 SilcChannelEntry channel)
  {
-   SilcIDCacheEntry id_cache;
-   SilcBool ret = TRUE;
-   SilcCipher key;
-   SilcHmac hmac;
-   char *namec;
 +
    if (!channel)
      return FALSE;
  
-   if (silc_atomic_sub_int16(&channel->internal.refcnt, 1) > 0)
-     return FALSE;
-   SILC_LOG_DEBUG(("Deleting channel %p", channel));
+   SILC_LOG_DEBUG(("Marking channel entry %p deleted"));
  
-   silc_mutex_lock(conn->internal->lock);
-   if (silc_idcache_find_by_context(conn->internal->channel_cache, channel,
-                                  &id_cache)) {
-     namec = id_cache->name;
-     ret = silc_idcache_del_by_context(conn->internal->channel_cache,
-                                     channel, NULL);
-     silc_free(namec);
-   }
-   silc_mutex_unlock(conn->internal->lock);
 +
-   if (!ret)
+   if (silc_atomic_sub_int32(&channel->internal.deleted, 1) != 0) {
+     SILC_LOG_DEBUG(("Channel entry %p already marked deleted"));
      return FALSE;
-   silc_client_empty_channel(client, conn, channel);
 +  silc_client_del_channel_private_keys(client, conn, channel);
-   silc_hash_table_free(channel->user_list);
-   silc_free(channel->channel_name);
-   silc_free(channel->topic);
-   if (channel->founder_key)
-     silc_pkcs_public_key_free(channel->founder_key);
-   if (channel->internal.send_key)
-     silc_cipher_free(channel->internal.send_key);
-   if (channel->internal.receive_key)
-     silc_cipher_free(channel->internal.receive_key);
-   if (channel->internal.hmac)
-     silc_hmac_free(channel->internal.hmac);
-   if (channel->internal.old_channel_keys) {
-     silc_dlist_start(channel->internal.old_channel_keys);
-     while ((key = silc_dlist_get(channel->internal.old_channel_keys)))
-       silc_cipher_free(key);
-     silc_dlist_uninit(channel->internal.old_channel_keys);
    }
-   if (channel->internal.old_hmacs) {
-     silc_dlist_start(channel->internal.old_hmacs);
-     while ((hmac = silc_dlist_get(channel->internal.old_hmacs)))
-       silc_hmac_free(hmac);
-     silc_dlist_uninit(channel->internal.old_hmacs);
-   }
-   if (channel->channel_pubkeys)
-     silc_argument_list_free(channel->channel_pubkeys,
-                           SILC_ARGUMENT_PUBLIC_KEY);
-   silc_atomic_uninit16(&channel->internal.refcnt);
-   silc_rwlock_free(channel->internal.lock);
-   silc_schedule_task_del_by_context(conn->client->schedule, channel);
-   silc_free(channel);
  
-   return ret;
+   silc_client_unref_channel(client, conn, channel);
+   return TRUE;
  }
  
  /* Replaces the channel ID of the `channel' to `new_id'. Returns FALSE
Simple merge
Simple merge
Simple merge
Simple merge
index eb0d176efce4540e4abd95160149d390be4d24b6,eb0d176efce4540e4abd95160149d390be4d24b6..059797e5bc5d03c95beb5dc299490f94d19b6b66
@@@ -4,7 -4,7 +4,7 @@@
  
    Author: Pekka Riikonen <priikone@silcnet.org>
  
--  Copyright (C) 1997 - 2006 Pekka Riikonen
++  Copyright (C) 1997 - 2008 Pekka Riikonen
  
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
  #ifndef SILCCOMMAND_H
  #define SILCCOMMAND_H
  
--/****f* silccore/SilcCommandAPI/SilcCommandCb
-- *
-- * SYNOPSIS
-- *
-- *    typedef void (*SilcCommandCb)(void *context, void *context2);
-- *
-- * DESCRIPTION
-- *
-- *    Command function callback. The actual command function pointer.
-- *    This is generic command callback that the application may choose to
-- *    use with its command routines.  However, none of the generic
-- *    routines depend on this callback so application may freely define
-- *    their own command callback if desired.
-- *
-- ***/
--typedef void (*SilcCommandCb)(void *context, void *context2);
--
  /****s* silccore/SilcCommandAPI/SilcCommandPayload
   *
   * NAME
Simple merge
index 06161b3344f861a978db95727f1534547897d110,3e92d0ed86a50ca24b08748836f17651d1b3255e..d44e9faf35d7354fdb4632267f405ddd16cd2d4b
@@@ -696,14 -639,25 +696,16 @@@ SILC_FSM_STATE(silc_connauth_st_respond
    SILC_LOG_DEBUG(("Found %d public keys",
                  silc_dlist_count(connauth->public_keys)));
  
 -  /* Verify signature */
 +  /** Verify signature */
    key = silc_dlist_get(connauth->public_keys);
 -  if (!silc_connauth_verify_signature(connauth, key->key,
 -                                    connauth->auth_data,
 -                                    connauth->auth_data_len)) {
 -    /** Invalid signature */
 -    SILC_LOG_DEBUG(("Invalid signature"));
 -    silc_free(connauth->auth_data);
 -    silc_fsm_next(fsm, silc_connauth_st_responder_failure);
 -    return SILC_FSM_CONTINUE;
 -  }
 -
 -  silc_free(connauth->auth_data);
 +  silc_fsm_next(fsm, silc_connauth_st_responder_success);
 +  SILC_FSM_CALL(connauth->key_op =
 +              silc_connauth_verify_signature(connauth, key->key,
 +                                             connauth->auth_data,
 +                                             connauth->auth_data_len));
 +  /* NOT REACHED */
+   SILC_LOG_DEBUG(("Signature is Ok"));
 -
 -  /** Authentication successful */
 -  silc_fsm_next(fsm, silc_connauth_st_responder_success);
 -  return SILC_FSM_CONTINUE;
  }
  
  SILC_FSM_STATE(silc_connauth_st_responder_success)
index 7331e23513c5c61d82c250bd35ab6bcb475b587d,caf2579628bf9a1a426057a5179f2949dfa5d07e..fece34b67a8ee872a0e4cf792f6153a0f7311afe
@@@ -1714,51 -1626,17 +1714,48 @@@ SILC_FSM_STATE(silc_ske_st_initiator_ph
      SILC_LOG_DEBUG(("Verifying signature (HASH)"));
  
      /* Verify signature */
 -    if (!silc_pkcs_verify(ske->prop->public_key, payload->sign_data,
 -                        payload->sign_len, hash, hash_len, NULL)) {
 -      SILC_LOG_ERROR(("Signature verification failed, incorrect signature"));
 -      status = SILC_SKE_STATUS_INCORRECT_SIGNATURE;
 -      goto err;
 -    }
 +    SILC_FSM_CALL(ske->key_op =
 +                silc_pkcs_verify_async(ske->prop->public_key,
 +                                       payload->sign_data,
 +                                       payload->sign_len, hash,
 +                                       hash_len, FALSE, NULL,
 +                                       silc_ske_verify_cb, ske));
 +    /* NOT REACHED */
 +  }
-   return SILC_FSM_CONTINUE;
 + err:
 +  memset(hash, 'F', sizeof(hash));
 +  silc_ske_payload_ke_free(payload);
 +  ske->ke2_payload = NULL;
 +
 +  silc_mp_uninit(ske->KEY);
 +  silc_free(ske->KEY);
 +  ske->KEY = NULL;
  
 -    SILC_LOG_DEBUG(("Signature is Ok"));
 -    memset(hash, 'F', hash_len);
 +  if (ske->hash) {
 +    memset(ske->hash, 'F', hash_len);
 +    silc_free(ske->hash);
 +    ske->hash = NULL;
    }
  
 +  if (status == SILC_SKE_STATUS_OK)
 +    status = SILC_SKE_STATUS_ERROR;
 +
 +  /** Error */
 +  ske->status = status;
 +  silc_fsm_next(fsm, silc_ske_st_initiator_error);
 +  return SILC_FSM_CONTINUE;
 +}
 +
 +/* Process key material */
 +
 +SILC_FSM_STATE(silc_ske_st_initiator_phase5)
 +{
 +  SilcSKE ske = fsm_context;
 +  SilcSKEStatus status;
 +  unsigned char tmp[4];
 +  SilcUInt32 hash_len;
 +  int key_len, block_len;
 +
    ske->status = SILC_SKE_STATUS_OK;
  
    /* In case we are doing rekey move to finish it.  */