]> jfr.im git - irc/unrealircd/unrealircd.git/commitdiff
3.2-beta11
authorstskeeps <redacted>
Wed, 7 Aug 2002 21:30:49 +0000 (21:30 +0000)
committerstskeeps <redacted>
Wed, 7 Aug 2002 21:30:49 +0000 (21:30 +0000)
120 files changed:
.CHANGES.NEW
.RELEASE.NOTES
.SICI
Changes
INSTALL
READMENOW.Win32.txt [deleted file]
Setup
Unreal.nfo
autoconf/aclocal.m4
autoconf/configure.in
configure
doc/Etiquette [deleted file]
doc/conf.doc
doc/example.conf
doc/features.txt [deleted file]
doc/unrealircd.conf.txt [deleted file]
extras/channeldumper.c [new file with mode: 0644]
extras/extras.txt
extras/malloc.c [new file with mode: 0644]
extras/pthreads.tar.gz
help.conf
include/auth.h
include/common.h
include/config.h
include/h.h
include/numeric.h
include/relinfo.h [deleted file]
include/setup.h.in
include/ssl.h
include/stamp.h [deleted file]
include/struct.h
include/sys.h
include/version.h
makeconf
makefile.win32
networks/action-irc.network [deleted file]
networks/bitchx.network [deleted file]
networks/blind-irc.network [deleted file]
networks/cc2.network [deleted file]
networks/coolchat.network [deleted file]
networks/cynicnet.network [deleted file]
networks/dark-core.network [deleted file]
networks/darkfyre.network [deleted file]
networks/darkwar.network [deleted file]
networks/fireirc.network [deleted file]
networks/flort.network [deleted file]
networks/friendlyirc.network [deleted file]
networks/geridnet.network [deleted file]
networks/globo.network [deleted file]
networks/irc4ever.network [deleted file]
networks/irclatino.network [deleted file]
networks/israelnet.network [deleted file]
networks/lostchat.network [deleted file]
networks/maxatnet.network [deleted file]
networks/phatnet.network [deleted file]
networks/pheernet.network [deleted file]
networks/roxnet.network [deleted file]
networks/shallomchat.network [deleted file]
networks/solargalaxy.network [deleted file]
networks/spamnet.network [deleted file]
networks/spin.network [deleted file]
networks/starequinox.network [deleted file]
networks/tspre.network [deleted file]
networks/united-irc.network [deleted file]
networks/unitedirc.network [deleted file]
networks/uzaynet.network [deleted file]
src/Makefile
src/auth.c
src/buildm4 [deleted file]
src/channel.c
src/chkconf.c [deleted file]
src/cloak.c
src/conftool.c [deleted file]
src/events.c
src/hash.c
src/ircd.c
src/list.c
src/modules.c
src/modules/m_akill.c
src/modules/m_oper.c
src/modules/m_quit.c
src/modules/m_rakill.c
src/modules/m_svsmode.c
src/modules/m_svso.c
src/modules/m_who.c
src/modules/scan.c
src/modules/scan_http.c
src/modules/scan_socks.c
src/mutex.c [deleted file]
src/packet.c
src/res.c
src/s_auth.c
src/s_bsd.c
src/s_conf.c
src/s_debug.c
src/s_err.c
src/s_misc.c
src/s_serv.c
src/s_svs.c
src/s_user.c
src/send.c
src/socket.c
src/ssl.c
src/ssl.rnd
src/support.c
src/version.c.SH
src/win32/Win32GUI.c
src/win32/Win32GUI.rc
src/win32/debug.c [new file with mode: 0644]
src/win32/debug/StackTrace.dll [deleted file]
src/win32/debug/StackTrace.exp [deleted file]
src/win32/debug/StackTrace.lib [deleted file]
src/win32/gpl.rtf [new file with mode: 0644]
src/win32/service.c [new file with mode: 0644]
src/win32/unreal.c [new file with mode: 0644]
src/win32/unreal.rc [new file with mode: 0644]
src/win32/unrealinst.iss [new file with mode: 0644]
src/win32/unrealinstssl.iss [new file with mode: 0644]
update
win32 [deleted file]

index e7009650c96ab9201cc76de819cd3a5e47a036a0..b26eda9c53f7a3b9d4f2c868d6f9a527ac3e813a 100644 (file)
@@ -7,7 +7,7 @@
  \___/|_| |_|_|  \___|\__,_|_|\___/\_| \_| \____/\__,_|
 
                                Configuration Program
-                             for Unreal3.2-Selene(beta2)
+                             for Unreal3.2-Selene(beta11)
                                     
 This program will help you to compile your IRC server, and ask you
 questions regarding the compile-time settings of it during the process. 
index 6b5cacd4f560fb51759e36a4dc2c211ec475414c..3c1e904881b1f621f52e809e26003a8d14fa570a 100644 (file)
@@ -1,5 +1,5 @@
 
-Unreal3.2-Selene (BETA10) RELEASE NOTES
+Unreal3.2-Selene (BETA11) RELEASE NOTES
 ======================================
     
      I M P O R T A N T   R E A D I N G
@@ -12,6 +12,8 @@ Unreal3.2-Selene (BETA10) RELEASE NOTES
   unrealircd.conf (what the ircd.conf is called now). See doc/ for more
   information on the configuration format
 
+* THIS IS A BETA VERSION, REPORT BUGS ON http://bugs.unrealircd.org
+
 * We have introduced a new cloaking algoritm (+x), which makes it
   incompatible with Unreal3.1.1 - these can however still link, but the
   hostname will look different. This is made of three big numbers,
@@ -118,10 +120,52 @@ Unreal3.2-Selene (BETA10) RELEASE NOTES
 
 * set::socks has been replaced by set::scan (read doc/conf.doc for more info)
 
+* If you experince problems with the scanners, perhaps check out BOPM
+  (http://www.blitzed.org/bopm)
+
 * log {} syslog support added (read doc/conf.doc for more info)
 
+* Added ripemd-160 password encryption support
+
+* Enabled sha1 and md5 password encryption on Win32 regardless of whether SSL is used.
+
+* Added WinNT/2k/XP service support (experimental)
+  To use this you use the unreal.exe utility:
+    unreal install -installs the service
+    unreal uninstall -uninstalls the service
+    unreal start -starts the service
+    unreal stop -stops the service
+    unreal restart -restarts the service
+    unreal rehash -rehashes the config file
+  Config errors and crashes are now logged to service.log when in service mode.
+
+* Implimented a new win32 debugger to make fixing bugs much easier.
+
+* Added a win32 installer to simplify installing under Windows.
+
+* AKILL/RAKILL is depricated. Server command still works but will be removed eventually
+  (aliases to TKL G). For normal opers it notices that the commands are depricated.
+
+* Made the config parser smarter when it comes to time values and size values. Entries are
+  no longer limited to 1d2h1m. You can now enter "1day 2 hours 1 minute" for example. See
+  doc/conf.doc for more information.
+
+* The operoverride code has been rewritten to be less intrusive. You can now no longer
+  automatically join a channel for which you must override a mode. You must /invite
+  yourself to the channel. The idea behind this is it prevents the accidental "rejoin on
+  kick" ban override and joining a +s channel without realizing it is +s and therefore you
+  shouldn't know it exists.
+
+* If you use the SSL features of Unreal, you should use OpenSSL 0.9.6e or later. This is
+  important as the older versions may make the program exploitable. See 
+  http://www.openssl.org for more information
+
+* We have made a lot of changes to deal with SSL, and if you find any flaws or problems,
+  please contact the coder team. We however think that the changes will make SSL
+  more transparent and make it work more efficiently.
+
+* Added technical documentation in doc/technical. This directory will contain information
+  about the protocol used by Unreal.
+
 * MAKE SURE YOU RERUN ./Config AND RUN make clean BEFORE USING THIS VERSION!!!
 
-* THIS IS A BETA VERSION. THINGS MAY NOT WORK. REPORT ANY BUGS TO THESE 
-  ADDRESSES:
-   * coders@lists.unrealircd.org and bugs@lists.unrealircd.org
diff --git a/.SICI b/.SICI
index 1605509fba757217bf91fba09400533a0c56cb4c..5c25224a03eb3df2aa45770df6222ca4715335c2 100644 (file)
--- a/.SICI
+++ b/.SICI
@@ -4,17 +4,14 @@
 | some kind of Certification Authority (CA), so your users can check that |
 | they are really connected to the real server, so they feel secure?      |
 |                                                                         |
-| A initiative have been started, to help this problem, as more and more  |
+| An initiative has been started, to help this problem, as more and more  |
 | SSL-enabled IRC servers will be started in the future, and people will  |
 | have trouble authenticating that they are really at the right server.   |
-| This initiative is called SICI (Secure IRC Certification Initiative. We |
-| sign your certificates for free, using the simple way of authenticating |
-| you by going to your IRC server and testing if it's really you.         |
-|                                                                         |
-| You can send in your "server.req.pem" file to us at our email           |
-| certs@sici.ircsystems.net, with contact info on you (IRC network, nick, |
-| status). We will then contact you, and check if you have provided true  |
-| information. If you need more information about SICI, visit our website |
-| http://sici.ircsystems.net, where you can download our root certificate,|
-| and read even more about this project.        | Press enter to continue |
+| This initiative is called OpenIRC CA - They offer you to sign           |
+| SSL certificates for use with your IRCd for free,                       |
+| so your users can be sure that they can trust you and your server.      |     
+| To get a signed certificate from them please visit the website         |
+| http://www.openirc-ca.eu.org                                           |
+|                                              | Press enter to continue |
 ---------------------------------------------------------------------------
+
diff --git a/Changes b/Changes
index 0bb7c9a5cf6f82dada40358fe9ca33a606d8e62c..456a349b76934c92dc1fba4d324f11be9e61ed0d 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,4 +1,4 @@
-/*                              
+/*
  * UnrealIRCd Changes File - (C) Carsten Munk 1999-2002 &
  *                               The UnrealIRCd Team
  *                              
@@ -1297,3 +1297,159 @@ seen. gmtime warning still there
 - Changed version to beta10 and updated documentation
 - Removed obsolete network files
 - Added some new network files (hopefully I'll be able to get all the submissions added soon)
+*** beta10 released ***
+- Added a config check to see which (if any) gethostbyname_r exists (based on a macro by Caolan McNamara)
+- Removed some SOCKS scanner debug code that was forgotten
+- Finally REALLY fixed the scanner (note to Stskeeps: bcmp returns 0 when there IS a match)
+- Added OpenIRC-CA in .SICI
+- Fixed a openssl+ipv6 bug, pointed out by Aragon .. This probably breaks some other crap, but what
+  the heck..
+- Made ident checking work on IPv6 as well
+- Fixed a /stats L/l bug reported by dimplesx [#0000190]
+- Fixed some typos in validate_configuration, fixed a hostilename problem when ident
+  checking is off
+- Fixed a hostilename problem reported by Xuefer [#0000158]
+- Fixed some stuff to deal with #136 - Please note that we do NOT compress our addies
+  - reason for this is because for example ::ffff:192.168.1.5 would really fuck up stuff
+  in the IRC protocol
+- Fixed a typo in doc/example.conf that I believe is causing ident not to work
+- Fixed a /stats Z bug where it didn't correctly report local clients
+- Made /stats Z once again report the # of classes and memory used by classes
+- Added an allow::options this fixes some problems with allow, ident is now used
+  unless allow::options::noident is set, also if the user matches an allow by IP rather
+  than by host the hostname is still used for the u@h, unless allow::options::useip is set
+  (idea inspired by danielek)
+- Fixed a bug in the new allow system reported by danielek
+- Fixed a maxperip and a maxunknownconnectionsperip bug in IPv6 reported by danielek
+- Fixed another scanner bug causing the scanner to never timeout
+- Fixed a module bug when there is an include between a module-config-directive and the loadmodule
+- Made it so if a module fails to load it is non-fatal, reported by Adiga007 (#0000194)
+- Made hosts converted to lowercase before run through hidehost() this way ABC.com is the
+  same as abc.com, reported by Magnet (#0000065)
+- Converted the status window in the win32 GUI to a modeless dialog
+- Fixed a win32 bug where the tray config menu didn't contain anything, reported by Jens (#0000127)
+- Fixed a /who bug where + wasn't shown for voices, reported by Wcc (#0000202)
+- Included larne's /who patch, adding a multitude of symbols? :P
+- Split 005 and 105 up in order to conform to the RFC1459 limit of 15 parameters per
+  command
+- Failsafe check (to be removed again) in s_bsd.c
+- [nighthawk 2002-06-16] Added myself to s_serv.c:m_info().
+- Fixed a doc/conf.doc typo reported by SciFi
+- Documented the new allow::options in doc/conf.doc
+- [nighthawk 2002-06-17] Rewrote m_who.c from scratch.  It's slightly different,
+                         help.conf explains exactly how.
+- [nighthawk 2002-06-17] Changed m_quit.c slightly, removed a redundant strlen,
+                         made prefix-quit of "no" not use one at all, since this
+                         is in example.conf and is sensicle..
+- Couple of updates to INSTALL.
+- Updated INSTALL to no longer say 'make install is not needed' reported by wolfy
+- Fixed a oper count bug caused by +H (reported by dwd) [#0000203]
+- Fixed another oper count bug caused by +H and SVSMODE/SVS2MODE [#0000203]
+- Fixed yet another oper count bug caused by SVSO and +H and +O (local oper)
+- Fixed a modes-on-oper bug that could cause a negative invisible and/or oper count if +i
+  or +H was specified in modes-on-oper.
+- Fix a minor stupid in m_quit.c.
+- Added /who +R which shows real host to opers.
+- Added set::scan::bind-ip, set::scan::message, on request of RaYmAn, documented
+  in example.conf
+- Fixed minor problem with former patch
+- Fixed the set::scan::bind-ip patch to work with win32
+- Added 005 token AWAYLEN= from ircu
+- Heavily updated INSTALL
+- Removed Win32 and READMENOW.Win32.txt (obsolete)
+- Started WinXP IPv6 support (added headers)
+- More WinXP IPv6, finished headers, replaced calls to inet_ntoa with Inet_ia2p
+- Added support for the RIPEMD-160 encryption algorithm for encrypted passwords (supposed to be slightly 
+  stronger than SHA1 and much stronger than MD5)
+- Added MD5 and SHA1 password encryption support to the win32 version whether SSL is
+  installed or not using the CryptoAPI library included in Windows.
+- Added extras/channeldumper.c
+- Fixed an alias {} bug reported by Keeper (prefix was :nick not :nick!user@host which screwed up some bots)
+- Fixed a +sp bug reported by Zerwas (#0000160) fixed by JK and Luke
+- Fixed a bug where locops did not receive a hidden host reported by breathingman (#0000221)
+- Fixed a bug where makeconf would not work after a make install
+- Fixed m_sjoin bug with banlist propagation
+- Fixed compile problem with non-glob/win32 systems (sunos 4.1) found by rshurr
+- Fixed secure channel only (+z) sending ERR_BANNEDFROMCHAN
+- WinNT/2k/XP service support added
+  This should currently be considered EXPERIMENTAL
+  To use this you use the unreal.exe utility:
+    unreal install -installs the service
+    unreal uninstall -uninstalls the service
+    unreal start -starts the service
+    unreal stop -stops the service
+    unreal restart -restarts the service
+    unreal rehash -rehashes the config file
+  Config errors are now logged to service.log when in service mode.
+- Added a win32 installer script (for Inno Setup with ISX)
+- Removed a reference to TechAdmins in makeconf, reported by Zerwas (#0000234)
+- Added a new debugger for win32 this version is NT Service compatible, logs to service.log
+  when a crash occurs while running in service mode. The new debugger requires dbghelp.dll
+  version 5.0 or newer. Included natively on Win2k/XP and available as redistributable for
+  other versions. Also removes StackTrace
+- Added src/win32/gpl.rtf (used for installer) made installer download dbghelp.dll if needed
+- Added an installer script to generate the Win32 SSL version
+- Made the win32 uninstaller remove dbghelp.dll if it was added when uninstalling
+- Added a #ifdef _WIN32 for extern BOOL IsService; in ircd.c that made compile break
+  on non WIN32 systems
+- Depricated AKILL/RAKILL and made them alias to TKL G +/- - for normal users they
+  just reply that the commands are depricated. Server compatiblity is maintained. 
+  Eventually it will just be removed. Thank god for modules.
+- Fixed a silly bug with regards to matching against compressed IPs in link {} checking
+- Added some release notes with regards to scanners
+- Removed s_segv handler
+- Changed ./update to use update.unrealircd.com
+- Made ./configure check if it has parameters, and error if it don't.
+- Made ./configure remove uscore.c and uscore binary after test
+- Removed mutex.c
+- Credits changes, various tweaks mzp ftq Gzdqmx qhqdk dqxqmeq oapq otmxxqzsq. Tmbbk tgzfuzs.
+- Fixed some ./configure errors
+- Added ircd/safe_SSL_read/write from bahamut+inet6/azzuranet. This can be done much nicer
+  when newio is done.
+- Updated the config parser to be smarter when dealing with times and sizes
+- Updated doc/conf.doc for any new config changes
+- Made the win32 installer remove the . from the begining of . files and append .txt to
+  most text files, ie .RELEASE.NOTES becomes RELEASE.NOTES.txt
+- Updated .RELEASE.NOTES
+- Fixed a bug where /who always reported 0 hops reported by Alzirr (#0000242)
+- More SSL horror and fixed a missing , in m_who
+- Fixed !SSL compile error
+- Made the win32 installer have the option of installing as a service under NT and fixed a
+  shortcut bug
+- Fixed sptr->user->realhost becoming lowercase upon a +x
+- Fixed +bbbbb lots of crap desynch bug
+- Fixed OperOverride snotice bugs with halfop
+- Standardized OperOverride notices
+- Implemented new operoverride system
+- Fixed some compile errors found by Zerwas and fixed some implementation problems of 
+  the not able to set +z when there's non +z users (ULines not counted) in channel
+- Fixed some SSL errors. read() returns -1 on error, so ircd_SSL_write and
+  ircd_SSL_read must emulate the same. codemastr: could you check what the
+  win32 equiviant of EIO is? I don't think my WSAEIO or whatever I called it
+  in sys.h is correct.
+- Seemingily we can't do SSLv3 only for ctx_server?
+- Fixed some SJ3 bugs that could cause desync in rare cases
+- Added some technical documentation in doc/technical. Docs include: 005.txt, base64.txt,
+  token.txt, protoctl.txt, and vl.txt
+- Send +f and +L in correct part of 005.
+- Fixed SSL linking, again..
+- SSL compile error fix in s_bsd.c
+- Added some OpenSSL version showing
+- Win32 SSL compile fixes
+- Made /trace show correct for SSL handshake(s)
+- RELEASENOTES stuff
+- Win32 installer fixes (changed version to beta11)
+- Changed version to beta11
+- updated .RELEASE.NOTES to explain operinvite
+- Fixed SSL compile error wrt to /trace
+- Removed doc/features.txt, doc/unrealircd.conf.txt, include/relinfo.h,
+  include/stamp.h, src/buildm4, src/chkconf.c, src/conftool.c
+- Removed doc/Etiquette
+- Compile error fix regarding version.h
+- Made +x send out a SETHOST to VHP servers, requested by PreZ@DarkerNet
+- Removed support for SSLv2 (SSLv2 is obsolete and insecure)
+- .RELEASE.NOTES change
+- Cleaned out Credits (i'll fix the web part of it later), made doug lea malloc default
+  on Linux FSU Pthread installs. (When we got a better way, we will have full doug lea malloc..)
+- Made OPEROVERRIDE_VERIFY default undeffed
+- SSL fixes to deal with not allowing SSLv2
diff --git a/INSTALL b/INSTALL
index 0b3db25bc06ac4c240915714503fd1ff96a0d683..3d4585ee8f5fd6b75987af363bb1c1966994e2f4 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -1,16 +1,16 @@
 ###############################################################################
 ####               Unreal IRC Unix Daemon Installation Guide               ####
-####                         UnrealIRCD ver 3.1.1                          ####
-####                    unreal-dev@lists.sourceforge.com                   ####
+####                         UnrealIRCD ver 3.2                            ####
+####                     coders@lists.unrealircd.org                       ####
 ####                      http://www.unrealircd.com/                       ####
 ###############################################################################
 ####                       Unpackaging the IRCD                            ####
 ####                                                                       ####
-####   1) gzip -d Unreal3.1.1.tar.gz                                       ####
+####   1) gzip -d Unreal3.<version>.tar.gz                                 ####
 ####                                                                       ####
-####   2) tar xvf Unreal3.1.1.tar                                          ####
+####   2) tar xvf Unreal3.<version>.tar                                    ####
 ####                                                                       ####
-####   3) cd Unreal3.1.1/                                                  ####
+####   3) cd Unreal3.<version>/                                            ####
 ###############################################################################
 ####                        Compiling the IRCD                             ####
 ####                                                                       ####
@@ -19,7 +19,7 @@
 ####   OS and Version     Compiler and Version           Comments          ####
 ####   --------------- ------------------------ ------------------------   ####
 ####   NetBSD 1.2B       gcc 2.7.2                                         ####
-####   FreeBSD 2.1.0     gcc 2.6.3                Don't use crypt at all   ####
+####   FreeBSD 4.5-R     gcc 2.95.3                                        ####
 ####   SunOS 4.1.4       gcc 2.7-96q1 (Cygnus)                             ####
 ####   Solaris 2.4       gcc 2.7-96q1 (Cygnus)    (SunOS 5.4)              ####
 ####   Solaris 2.5       SunWorks Pro C           (SunOS 5.5.1)            ####
 ####                                                                       ####
 ####      ./Config                                                         ####
 ####                                                                       ####
-####   2a) Windows users: please read WIN32                                ####
 ####                                                                       ####
 ####   3) When in ./Config put in the best answers to your knowledge.      ####
-####      This is all pretty self explanatory. We suggest, to advoid       ####
+####      This is all pretty self explanatory. We suggest, to avoid        ####
 ####      problems later on, put the DPATH and SPATH as the default.       ####
 ####      (When it asks where the config files and binarys will be).       ####
 ####      Also, when it asks for max file connections, the default is      ####
 ####       will be able to help you. Another suggestion is going on IRC    ####
 ####       /server irc.ircsystems.net #Unreal-support                      ####
 ####                                                                       ####
-####   4b) make install  - IS NOT NEEDED                                   ####
+####   4b) make install                                                    ####
 ####                                                                       ####
 ###############################################################################
 ####                     Configuring the Server                            ####
 ####                                                                       ####
 ####   1) ./makeconf                                                       ####
-####      This executable has been created to help with your ircd.conf     ####
-####      creation process. It walks you through the steps and makes the   ####
-####      file for you. Note: If you want to edit your ircd.conf you       ####
-####      should only need to: edit ircd.conf. If you ./makeconf again     ####
-####      it will delete the old ircd.conf and re-write a new one.         ####
+####      This will help you create an unrealircd.conf file for your ircd. ####
+####      It walks you through the steps and makes the file for you. Note: ####
+####      If you want to edit your unrealircd.conf you should only need    ####
+####      to: edit unrealircd.conf. If you ./makeconf again it will delete ####
+####      the old unrealircd.conf and re-write a new one.                  ####
+####                                                                       ####
+####   2) ./networks/makenet                                               ####
+####      This will guide you through the process of creating a network    ####
+####      file for use with your ircd. It will also give you the option of ####
+####      submitting your network file so it will be automatically         ####
+####      included in future releases. Please only submit the file once    ####
+####      per network.                                                     ####
+####                                                                       ####
+####   3) Review doc/example.conf and doc/conf.doc on other configuration  ####
+####      options you may want to set. Also review the others docs in this ####
+####      folder as they may help you get your IRCd going.                 ####
 ####                                                                       ####
 ###############################################################################
 ####                        Starting the Server                            ####
 ####                                                                       ####
-####   1) Make sure you're in the top level Unreal3.1.1 directory..        ####
+####   1) Make sure you're in the top level Unreal3.2 directory..          ####
 ####                                                                       ####
-####   2) ./ircd                                                           ####
+####   2) ./unreal start                                                   ####
 ####                                                                       ####
 ####   3) If you get the error screen, please go through and check each    ####
 ####      point presented, if you have no luck, go on IRC                  ####
-####      /server irc.ircsystems.net  #UnrealIRCD                          ####
+####      /server irc.ircsystems.net #Unreal-support                       ####
 ####                                                                       ####
 ####   4) /server yourserverip or domainname                               ####
 ####                                                                       ####
 ####      to upgrade to.                                                   ####
 ####                                                                       ####
 ###############################################################################
-
-
-
diff --git a/READMENOW.Win32.txt b/READMENOW.Win32.txt
deleted file mode 100644 (file)
index 43437ae..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-Unreal IRCD Win32 Version
--=-=-=-=-=-=-=-=-=-=-=-=-
-
-Ok, in order to save time, and my nerves i am writing this short readme, and eventually an FAQ (after people ask questions) =)
-
-This is information on how to run the win32 version, it does not say, and WILL not say how to use an ircd, as that is sufficiently docuimented in the docs !!!!
-
-you will NEED to modify/create an ircd.conf, follow the documentation for that.
-
-
-Right, thats almost it( that i can think of), but what happens if the server Crashes ???
-----------------------------------------------------------------------------------------
-ok i Have now coded the first bit of usefull (for me) code that dumps the stack to a dialog box, WHAT EVER YOU DO you must do the following:
-               1. Copy and paste EVERYTHING in that dialog box, and send it to me in an e-mail
-               2. Include in that e-mail EVERYTHING that happened in the lead up to the crash
-
-i hope thats SIMPLE to follow, but it will help me soo much !!!!!
-
-
-DrBin (Dave)
-drbin@tspre.org
-
-
diff --git a/Setup b/Setup
index dbb23eb239070f2573aefbd9ca3172bf8d13db29..7b3733a55e15f3fd9ca2be8f0bab854753ba939b 100755 (executable)
--- a/Setup
+++ b/Setup
@@ -32,4 +32,4 @@ if [ "$cc" == "no" ] ; then
        ./makenet
 fi
 echo "Now just edit your unrealircd.conf and you should be ready to run"
-echo "UnrealIRCd with ./ircd"
+echo "UnrealIRCd with ./unreal start"
index 167c895b76f8d45d75d70c46bdb62c456ce5127b..33d4d28013691c4553683e8b5c21c060b65e60d3 100644 (file)
@@ -1,5 +1,5 @@
 ===============================================
-=            UnrealIRCd v3.2-Selene (beta1  =
+=            UnrealIRCd v3.2-Selene (beta11)  =
 ===============================================
  Was brought to you by:
 
@@ -7,11 +7,13 @@
   ==============
   * Stskeeps  <stskeeps@tspre.org>
   * codemastr <codemastr@unrealircd.com>
+  * Griever   <griever@unrealircd.com>
+  * Luke      <luke@unrealircd.com>
+  * nighthawk <nighthawk@unrealircd.com>
 
   Coders team:
   ============
   * McSkaf    <mcskaf@unrealircd.org>
-  * Griever   <griever@unrealircd.org>
   * Zogg      <zogg@unrealircd.org>
   * NiQuiL    <niquil@unrealircd.org>
   * assyrian  <assyrian@unrealircd.org>
@@ -35,6 +37,9 @@ and to get latest stable:
 latest beta:
 "cvs -d :pserver:anonymous@cvs.ircsystems.net:/home/cmunk/ircsystems/cvsroot checkout -r beta -d Unreal-beta unreal"
 
+latest devel:
+"cvs -d :pserver:anonymous@cvs.ircsystems.net:/home/cmunk/ircsystems/cvsroot checkout -r devel -d Unreal-devel unreal"
+
   * To get support
   ================
     * IRC: /server irc.ircsystems.net 6667 - /join #unreal-support
@@ -45,33 +50,14 @@ latest beta:
              like you, and we got to have peace at times as well.]
     * Mailing list: supporters@lists.unrealircd.org (for support)
     * READ doc/faq BEFORE ASKING QUESTIONS!
+    * READ http://support.unrealircd.org
 
   * Want to discuss, chat, etc?
   =============================
    * IRC: /server irc.ircsystems.net 6667 - /join #UnrealIRCd
  
-  * Got a bug to report? 
-  ====================== 
-    * If the server crashes and dumps core do this:
-       * Go into the Unreal directory and type this:
-           gdb src/ircd core.filename
-         where core.filename is the filename in the dumping core message
-         if it loads gdb, (not saying "command not found" etc), type "bt" in
-         the program (type "quit" to get out again)
-        
-         The output coming out there please mail it to 
-         coders@lists.unrealircd.org , along with OS type,
-         what "uname -a" says, any clues what it is, if you did anything etc
-         etc. Please keep the core dump files if we ask you to mail us them 
-         if needed
-
-    * If you experince any wierdnesses (that doesnt crash the server)
-      please mail coders@lists.unrealircd.org with any clues on what
-      you did, what you experinced etc.
-
-  * Got a suggestion?
-  ===================
-    * Mail it to coders@lists.unrealircd.org :) or catch one from
-      the Unreal team online on IRC:)
+  * UnrealIRCd Bugtracker (Where to report bugs or make suggestions)
+  ==============================================
+      http://bugs.unrealircd.org
 
\ No newline at end of file
+y
\ No newline at end of file
index 9f8739ca848c6f10d78efe19faab98ccd5a67388..f4ebe388062f42d41d31a324bc9294c54da3360c 100644 (file)
@@ -320,7 +320,7 @@ PTHREAD_CFLAGS="-I=../extras/threads/include $ac_cv_pthreadspecial"
 else
 PTHREAD_CFLAGS="-I=../extras/threads/include"
 fi
-PTHREAD_LIBS="../extras/threads/lib/libgthreads.a ../extras/threads/lib/libmalloc.a"
+PTHREAD_LIBS="../extras/threads/lib/libgthreads.a ../extras/malloc.c"
 fi
 fi
 fi
@@ -339,4 +339,46 @@ fi
 
 ])dnl ACX_PTHREAD
 
+dnl Written by Caolan McNamara <caolan@skynet.ie>, modified slightly by codemastr
+AC_DEFUN(AC_caolan_FUNC_WHICH_GETHOSTBYNAME_R,[
+AC_CHECK_FUNC(gethostbyname_r)
+if test "$ac_cv_func_gethostbyname_r" = "yes"; then
+AC_CACHE_CHECK(how many parameters gethostbyname_r takes, ac_cv_func_which_gethostname_r, [
+  AC_TRY_COMPILE([#include <netdb.h>], [
+        char *name;
+        struct hostent *he;
+        struct hostent_data data;
+        (void) gethostbyname_r(name, he, &data);
+  ],ac_cv_func_which_gethostname_r=three, [
+  AC_TRY_COMPILE([#include <netdb.h>], [
+        char *name;
+        struct hostent *he, *res;
+        char buffer[2048];
+        int buflen = 2048;
+        int h_errnop;
+        (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
+  ],ac_cv_func_which_gethostname_r=six, [
+  AC_TRY_COMPILE([#include <netdb.h>], [
+                        char *name;
+                        struct hostent *he;
+                        char buffer[2048];
+                        int buflen = 2048;
+                        int h_errnop;
+                        (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
+  ],ac_cv_func_which_gethostname_r=five,ac_cv_func_which_gethostname_r=no)
+
+  ])
+
+   ])],ac_cv_func_which_gethostname_r=no)]
+
+if test "$ac_cv_func_which_gethostname_r" = "six"; then
+  AC_DEFINE(HAVE_GETHOSTBYNAME_R_6)
+elif test "$ac_cv_func_which_gethostname_r" = "five"; then
+  AC_DEFINE(HAVE_GETHOSTBYNAME_R_5)
+elif test "$ac_cv_func_which_gethostname_r" = "three"; then
+  AC_DEFINE(HAVE_GETHOSTBYNAME_R_3)
+fi
+fi
+)])
+
 
index 49f5a9e908c64e3bd40e6c881fa307ecb6a809ce..f0aa3a9e317077198fe3cdf018abce953ddeb03b 100644 (file)
@@ -1,5 +1,10 @@
 dnl Process this file with autoconf to produce a configure script.
 AC_INIT(src/ircd.c)
+if test $# = 0; then
+       echo "You might want to run ./Config or provide some parameters to this script."
+       echo "./configure --help for information about this script"
+       exit 0
+fi
 AC_CONFIG_HEADER(include/setup.h)
 AC_PROG_CC
 if test "$ac_cv_prog_gcc" = "yes"; then
@@ -67,7 +72,12 @@ fi
 dnl module checking based on Hyb7's module checking code
 AC_DEFUN(AC_ENABLE_DYN,
 [
-AC_CHECK_FUNC(dlopen,, AC_CHECK_LIB(dl, dlopen,IRCDLIBS="$IRCDLIBS-ldl",AC_MSG_WARN(Dynamic linking is not enabled because dlopen was not found) AC_DEFINE(STATIC_LINKING)))
+AC_CHECK_FUNC(dlopen,, AC_CHECK_LIB(dl, dlopen,IRCDLIBS="$IRCDLIBS-ldl",
+[
+AC_MSG_WARN(Dynamic linking is not enabled because dlopen was not found) 
+AC_DEFINE(STATIC_LINKING)
+]))
+
 hold_cflags=$CFLAGS
 CFLAGS="$CFLAGS -export-dynamic"
 AC_CACHE_CHECK(if we need the -export-dynamic flag, ac_cv_export_dynamic, [
@@ -99,6 +109,7 @@ ac_cv_underscore=no
 else
 ac_cv_underscore=yes
 fi
+rm -f uscore uscore.c
 ])
 if test "$ac_cv_underscore" = "yes"; then
 AC_DEFINE(UNDERSCORE)
@@ -350,6 +361,7 @@ ACX_PTHREAD
 CC="$PTHREAD_CC"
 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
 IRCDLIBS="$IRCDLIBS $PTHREAD_LIBS"
+AC_caolan_FUNC_WHICH_GETHOSTBYNAME_R
 AC_MSG_CHECKING(if FD_SETSIZE is large enough to allow $ac_fd file descriptors)
 AC_TRY_RUN([
 #include <sys/types.h>
index 93b19c2569dd9cbbf118630babf69024fb61e58a..9d0edd66c138985a1375327f96a6fb40d237c95f 100755 (executable)
--- a/configure
+++ b/configure
 #! /bin/sh
-
 # Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.13 
-# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+# Generated by GNU Autoconf 2.53.
 #
+# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
+# Free Software Foundation, Inc.
 # This configure script is free software; the Free Software Foundation
 # gives unlimited permission to copy, distribute and modify it.
 
-# Defaults:
-ac_help=
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+
+# NLS nuisances.
+# Support unset when possible.
+if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+(set +x; test -n "`(LANG=C; export LANG) 2>&1`") &&
+    { $as_unset LANG || test "${LANG+set}" != set; } ||
+      { LANG=C; export LANG; }
+(set +x; test -n "`(LC_ALL=C; export LC_ALL) 2>&1`") &&
+    { $as_unset LC_ALL || test "${LC_ALL+set}" != set; } ||
+      { LC_ALL=C; export LC_ALL; }
+(set +x; test -n "`(LC_TIME=C; export LC_TIME) 2>&1`") &&
+    { $as_unset LC_TIME || test "${LC_TIME+set}" != set; } ||
+      { LC_TIME=C; export LC_TIME; }
+(set +x; test -n "`(LC_CTYPE=C; export LC_CTYPE) 2>&1`") &&
+    { $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set; } ||
+      { LC_CTYPE=C; export LC_CTYPE; }
+(set +x; test -n "`(LANGUAGE=C; export LANGUAGE) 2>&1`") &&
+    { $as_unset LANGUAGE || test "${LANGUAGE+set}" != set; } ||
+      { LANGUAGE=C; export LANGUAGE; }
+(set +x; test -n "`(LC_COLLATE=C; export LC_COLLATE) 2>&1`") &&
+    { $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set; } ||
+      { LC_COLLATE=C; export LC_COLLATE; }
+(set +x; test -n "`(LC_NUMERIC=C; export LC_NUMERIC) 2>&1`") &&
+    { $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set; } ||
+      { LC_NUMERIC=C; export LC_NUMERIC; }
+(set +x; test -n "`(LC_MESSAGES=C; export LC_MESSAGES) 2>&1`") &&
+    { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } ||
+      { LC_MESSAGES=C; export LC_MESSAGES; }
+
+
+# Name of the executable.
+as_me=`(basename "$0") 2>/dev/null ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)$' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+         /^X\/\(\/\/\)$/{ s//\1/; q; }
+         /^X\/\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conftest.sh
+  echo  "exit 0"   >>conftest.sh
+  chmod +x conftest.sh
+  if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conftest.sh
+fi
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
+  # Find who we are.  Look in the path if we contain no path at all
+  # relative or not.
+  case $0 in
+    *[\\/]* ) as_myself=$0 ;;
+    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+       ;;
+  esac
+  # We did not find ourselves, most probably we were run as `sh COMMAND'
+  # in which case we are not to be found in the path.
+  if test "x$as_myself" = x; then
+    as_myself=$0
+  fi
+  if test ! -f "$as_myself"; then
+    { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
+   { (exit 1); exit 1; }; }
+  fi
+  case $CONFIG_SHELL in
+  '')
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for as_base in sh bash ksh sh5; do
+        case $as_dir in
+        /*)
+          if ("$as_dir/$as_base" -c '
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
+            CONFIG_SHELL=$as_dir/$as_base
+            export CONFIG_SHELL
+            exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+          fi;;
+        esac
+       done
+done
+;;
+  esac
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line before each line; the second 'sed' does the real
+  # work.  The second script uses 'N' to pair each line-number line
+  # with the numbered line, and appends trailing '-' during
+  # substitution so that $LINENO is not a special case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
+  sed '=' <$as_myself |
+    sed '
+      N
+      s,$,-,
+      : loop
+      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      t loop
+      s,-$,,
+      s,^['$as_cr_digits']*\n,,
+    ' >$as_me.lineno &&
+  chmod +x $as_me.lineno ||
+    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensible to this).
+  . ./$as_me.lineno
+  # Exit status is that of the last command.
+  exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+  *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T='     ' ;;
+  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  # We could just check for DJGPP; but this test a) works b) is more generic
+  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+  if test -f conf$$.exe; then
+    # Don't use ln at all; we don't have any links
+    as_ln_s='cp -p'
+  else
+    as_ln_s='ln -s'
+  fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS="  $as_nl"
+
+# CDPATH.
+$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; }
+
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+exec 6>&1
+
+#
+# Initializations.
+#
 ac_default_prefix=/usr/local
-# Any additions from configure.in:
-ac_help="$ac_help
- --with-listen=backlog     Specify the listen backlog value"
-ac_help="$ac_help
- --with-nick-history=length     Specify the length of the nickname history"
-ac_help="$ac_help
- --with-sendq=maxsendq     Specify the max sendq for the server"
-ac_help="$ac_help
- --with-bufferpool=size     Specify the size of the buffer pool"
-ac_help="$ac_help
- --with-hostname=host     Specify the local hostname of the server"
-ac_help="$ac_help
- --with-permissions=permissions     Specify the default permissions for
-configuration files"
-ac_help="$ac_help
- --with-dpath=path     Specify the path where configuration files are stored"
-ac_help="$ac_help
- --with-fd-setsize=size     Specify the max file descriptors to use"
-ac_help="$ac_help
- --with-spath     Specify the location of the executable"
-ac_help="$ac_help
- --enable-nospoof     Enable spoofing protection"
-ac_help="$ac_help
- --enable-hub     Compile as a hub server"
-ac_help="$ac_help
- --enable-ssl     Enable client and server SSL connections "
-ac_help="$ac_help
- --enable-dynamic-linking     Make the IRCd dynamically link shared objects rather than statically "
-ac_help="$ac_help
- --enable-inet6     Make the IRCd support IPv6 "
-ac_help="$ac_help
- --enable-standardthreads     Use standard threads "
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Maximum number of lines to put in a shell here document.
+# This variable seems obsolete.  It should probably be removed, and
+# only ac_max_sed_lines should be used.
+: ${ac_max_here_lines=38}
+
+# Identity of this package.
+PACKAGE_NAME=
+PACKAGE_TARNAME=
+PACKAGE_VERSION=
+PACKAGE_STRING=
+PACKAGE_BUGREPORT=
+
+ac_unique_file="src/ircd.c"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+#  include <memory.h>
+# endif
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
 
 # Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
 # The variables have the same names as the options, with
 # dashes changed to underlines.
-build=NONE
-cache_file=./config.cache
+cache_file=/dev/null
 exec_prefix=NONE
-host=NONE
 no_create=
-nonopt=NONE
 no_recursion=
 prefix=NONE
 program_prefix=NONE
@@ -60,10 +313,15 @@ program_transform_name=s,x,x,
 silent=
 site=
 srcdir=
-target=NONE
 verbose=
 x_includes=NONE
 x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
 bindir='${exec_prefix}/bin'
 sbindir='${exec_prefix}/sbin'
 libexecdir='${exec_prefix}/libexec'
@@ -77,17 +335,9 @@ oldincludedir='/usr/include'
 infodir='${prefix}/info'
 mandir='${prefix}/man'
 
-# Initialize some other variables.
-subdirs=
-MFLAGS= MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-# Maximum number of lines to put in a shell here document.
-ac_max_here_lines=12
-
 ac_prev=
 for ac_option
 do
-
   # If the previous option needs an argument, assign it.
   if test -n "$ac_prev"; then
     eval "$ac_prev=\$ac_option"
@@ -95,59 +345,59 @@ do
     continue
   fi
 
-  case "$ac_option" in
-  -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
-  *) ac_optarg= ;;
-  esac
+  ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
 
   # Accept the important Cygnus configure options, so we can diagnose typos.
 
-  case "$ac_option" in
+  case $ac_option in
 
   -bindir | --bindir | --bindi | --bind | --bin | --bi)
     ac_prev=bindir ;;
   -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
-    bindir="$ac_optarg" ;;
+    bindir=$ac_optarg ;;
 
   -build | --build | --buil | --bui | --bu)
-    ac_prev=build ;;
+    ac_prev=build_alias ;;
   -build=* | --build=* | --buil=* | --bui=* | --bu=*)
-    build="$ac_optarg" ;;
+    build_alias=$ac_optarg ;;
 
   -cache-file | --cache-file | --cache-fil | --cache-fi \
   | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
     ac_prev=cache_file ;;
   -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
   | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
-    cache_file="$ac_optarg" ;;
+    cache_file=$ac_optarg ;;
+
+  --config-cache | -C)
+    cache_file=config.cache ;;
 
   -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
     ac_prev=datadir ;;
   -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
   | --da=*)
-    datadir="$ac_optarg" ;;
+    datadir=$ac_optarg ;;
 
   -disable-* | --disable-*)
-    ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+    ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
     # Reject names that are not valid shell variable names.
-    if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
-      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
-    fi
-    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
-    eval "enable_${ac_feature}=no" ;;
+    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+    eval "enable_$ac_feature=no" ;;
 
   -enable-* | --enable-*)
-    ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+    ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
-    if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
-      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
-    fi
-    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
-    case "$ac_option" in
-      *=*) ;;
+    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+    case $ac_option in
+      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
       *) ac_optarg=yes ;;
     esac
-    eval "enable_${ac_feature}='$ac_optarg'" ;;
+    eval "enable_$ac_feature='$ac_optarg'" ;;
 
   -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
   | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
@@ -156,95 +406,47 @@ do
   -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
   | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
   | --exec=* | --exe=* | --ex=*)
-    exec_prefix="$ac_optarg" ;;
+    exec_prefix=$ac_optarg ;;
 
   -gas | --gas | --ga | --g)
     # Obsolete; use --with-gas.
     with_gas=yes ;;
 
-  -help | --help | --hel | --he)
-    # Omit some internal or obsolete options to make the list less imposing.
-    # This message is too long to be a string in the A/UX 3.1 sh.
-    cat << EOF
-Usage: configure [options] [host]
-Options: [defaults in brackets after descriptions]
-Configuration:
-  --cache-file=FILE       cache test results in FILE
-  --help                  print this message
-  --no-create             do not create output files
-  --quiet, --silent       do not print \`checking...' messages
-  --version               print the version of autoconf that created configure
-Directory and file names:
-  --prefix=PREFIX         install architecture-independent files in PREFIX
-                          [$ac_default_prefix]
-  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
-                          [same as prefix]
-  --bindir=DIR            user executables in DIR [EPREFIX/bin]
-  --sbindir=DIR           system admin executables in DIR [EPREFIX/sbin]
-  --libexecdir=DIR        program executables in DIR [EPREFIX/libexec]
-  --datadir=DIR           read-only architecture-independent data in DIR
-                          [PREFIX/share]
-  --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]
-  --sharedstatedir=DIR    modifiable architecture-independent data in DIR
-                          [PREFIX/com]
-  --localstatedir=DIR     modifiable single-machine data in DIR [PREFIX/var]
-  --libdir=DIR            object code libraries in DIR [EPREFIX/lib]
-  --includedir=DIR        C header files in DIR [PREFIX/include]
-  --oldincludedir=DIR     C header files for non-gcc in DIR [/usr/include]
-  --infodir=DIR           info documentation in DIR [PREFIX/info]
-  --mandir=DIR            man documentation in DIR [PREFIX/man]
-  --srcdir=DIR            find the sources in DIR [configure dir or ..]
-  --program-prefix=PREFIX prepend PREFIX to installed program names
-  --program-suffix=SUFFIX append SUFFIX to installed program names
-  --program-transform-name=PROGRAM
-                          run sed PROGRAM on installed program names
-EOF
-    cat << EOF
-Host type:
-  --build=BUILD           configure for building on BUILD [BUILD=HOST]
-  --host=HOST             configure for HOST [guessed]
-  --target=TARGET         configure for TARGET [TARGET=HOST]
-Features and packages:
-  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
-  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
-  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
-  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
-  --x-includes=DIR        X include files are in DIR
-  --x-libraries=DIR       X library files are in DIR
-EOF
-    if test -n "$ac_help"; then
-      echo "--enable and --with options recognized:$ac_help"
-    fi
-    exit 0 ;;
+  -help | --help | --hel | --he | -h)
+    ac_init_help=long ;;
+  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+    ac_init_help=recursive ;;
+  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+    ac_init_help=short ;;
 
   -host | --host | --hos | --ho)
-    ac_prev=host ;;
+    ac_prev=host_alias ;;
   -host=* | --host=* | --hos=* | --ho=*)
-    host="$ac_optarg" ;;
+    host_alias=$ac_optarg ;;
 
   -includedir | --includedir | --includedi | --included | --include \
   | --includ | --inclu | --incl | --inc)
     ac_prev=includedir ;;
   -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
   | --includ=* | --inclu=* | --incl=* | --inc=*)
-    includedir="$ac_optarg" ;;
+    includedir=$ac_optarg ;;
 
   -infodir | --infodir | --infodi | --infod | --info | --inf)
     ac_prev=infodir ;;
   -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
-    infodir="$ac_optarg" ;;
+    infodir=$ac_optarg ;;
 
   -libdir | --libdir | --libdi | --libd)
     ac_prev=libdir ;;
   -libdir=* | --libdir=* | --libdi=* | --libd=*)
-    libdir="$ac_optarg" ;;
+    libdir=$ac_optarg ;;
 
   -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
   | --libexe | --libex | --libe)
     ac_prev=libexecdir ;;
   -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
   | --libexe=* | --libex=* | --libe=*)
-    libexecdir="$ac_optarg" ;;
+    libexecdir=$ac_optarg ;;
 
   -localstatedir | --localstatedir | --localstatedi | --localstated \
   | --localstate | --localstat | --localsta | --localst \
@@ -253,19 +455,19 @@ EOF
   -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
   | --localstate=* | --localstat=* | --localsta=* | --localst=* \
   | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
-    localstatedir="$ac_optarg" ;;
+    localstatedir=$ac_optarg ;;
 
   -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
     ac_prev=mandir ;;
   -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
-    mandir="$ac_optarg" ;;
+    mandir=$ac_optarg ;;
 
   -nfp | --nfp | --nf)
     # Obsolete; use --without-fp.
     with_fp=no ;;
 
   -no-create | --no-create | --no-creat | --no-crea | --no-cre \
-  | --no-cr | --no-c)
+  | --no-cr | --no-c | -n)
     no_create=yes ;;
 
   -no-recursion | --no-recursion | --no-recursio | --no-recursi \
@@ -279,26 +481,26 @@ EOF
   -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
   | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
   | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
-    oldincludedir="$ac_optarg" ;;
+    oldincludedir=$ac_optarg ;;
 
   -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
     ac_prev=prefix ;;
   -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
-    prefix="$ac_optarg" ;;
+    prefix=$ac_optarg ;;
 
   -program-prefix | --program-prefix | --program-prefi | --program-pref \
   | --program-pre | --program-pr | --program-p)
     ac_prev=program_prefix ;;
   -program-prefix=* | --program-prefix=* | --program-prefi=* \
   | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
-    program_prefix="$ac_optarg" ;;
+    program_prefix=$ac_optarg ;;
 
   -program-suffix | --program-suffix | --program-suffi | --program-suff \
   | --program-suf | --program-su | --program-s)
     ac_prev=program_suffix ;;
   -program-suffix=* | --program-suffix=* | --program-suffi=* \
   | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
-    program_suffix="$ac_optarg" ;;
+    program_suffix=$ac_optarg ;;
 
   -program-transform-name | --program-transform-name \
   | --program-transform-nam | --program-transform-na \
@@ -315,7 +517,7 @@ EOF
   | --program-transfo=* | --program-transf=* \
   | --program-trans=* | --program-tran=* \
   | --progr-tra=* | --program-tr=* | --program-t=*)
-    program_transform_name="$ac_optarg" ;;
+    program_transform_name=$ac_optarg ;;
 
   -q | -quiet | --quiet | --quie | --qui | --qu | --q \
   | -silent | --silent | --silen | --sile | --sil)
@@ -325,7 +527,7 @@ EOF
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
   | --sbi=* | --sb=*)
-    sbindir="$ac_optarg" ;;
+    sbindir=$ac_optarg ;;
 
   -sharedstatedir | --sharedstatedir | --sharedstatedi \
   | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
@@ -336,58 +538,57 @@ EOF
   | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
   | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
   | --sha=* | --sh=*)
-    sharedstatedir="$ac_optarg" ;;
+    sharedstatedir=$ac_optarg ;;
 
   -site | --site | --sit)
     ac_prev=site ;;
   -site=* | --site=* | --sit=*)
-    site="$ac_optarg" ;;
+    site=$ac_optarg ;;
 
   -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
     ac_prev=srcdir ;;
   -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
-    srcdir="$ac_optarg" ;;
+    srcdir=$ac_optarg ;;
 
   -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
   | --syscon | --sysco | --sysc | --sys | --sy)
     ac_prev=sysconfdir ;;
   -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
   | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
-    sysconfdir="$ac_optarg" ;;
+    sysconfdir=$ac_optarg ;;
 
   -target | --target | --targe | --targ | --tar | --ta | --t)
-    ac_prev=target ;;
+    ac_prev=target_alias ;;
   -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
-    target="$ac_optarg" ;;
+    target_alias=$ac_optarg ;;
 
   -v | -verbose | --verbose | --verbos | --verbo | --verb)
     verbose=yes ;;
 
-  -version | --version | --versio | --versi | --vers)
-    echo "configure generated by autoconf version 2.13"
-    exit 0 ;;
+  -version | --version | --versio | --versi | --vers | -V)
+    ac_init_version=: ;;
 
   -with-* | --with-*)
-    ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+    ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
-    if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
-      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
-    fi
+    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
     ac_package=`echo $ac_package| sed 's/-/_/g'`
-    case "$ac_option" in
-      *=*) ;;
+    case $ac_option in
+      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
       *) ac_optarg=yes ;;
     esac
-    eval "with_${ac_package}='$ac_optarg'" ;;
+    eval "with_$ac_package='$ac_optarg'" ;;
 
   -without-* | --without-*)
-    ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+    ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
     # Reject names that are not valid shell variable names.
-    if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
-      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
-    fi
-    ac_package=`echo $ac_package| sed 's/-/_/g'`
-    eval "with_${ac_package}=no" ;;
+    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package | sed 's/-/_/g'`
+    eval "with_$ac_package=no" ;;
 
   --x)
     # Obsolete; use --with-x.
@@ -398,99 +599,110 @@ EOF
     ac_prev=x_includes ;;
   -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
   | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
-    x_includes="$ac_optarg" ;;
+    x_includes=$ac_optarg ;;
 
   -x-libraries | --x-libraries | --x-librarie | --x-librari \
   | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
     ac_prev=x_libraries ;;
   -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
   | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
-    x_libraries="$ac_optarg" ;;
+    x_libraries=$ac_optarg ;;
 
-  -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+  -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; }
     ;;
 
+  *=*)
+    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+   { (exit 1); exit 1; }; }
+    ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+    eval "$ac_envvar='$ac_optarg'"
+    export $ac_envvar ;;
+
   *)
-    if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
-      echo "configure: warning: $ac_option: invalid host type" 1>&2
-    fi
-    if test "x$nonopt" != xNONE; then
-      { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
-    fi
-    nonopt="$ac_option"
+    # FIXME: should be removed in autoconf 3.0.
+    echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
     ;;
 
   esac
 done
 
 if test -n "$ac_prev"; then
-  { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
-fi
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-# File descriptor usage:
-# 0 standard input
-# 1 file creation
-# 2 errors and warnings
-# 3 some systems may open it to /dev/tty
-# 4 used on the Kubota Titan
-# 6 checking for... messages and results
-# 5 compiler messages saved in config.log
-if test "$silent" = yes; then
-  exec 6>/dev/null
-else
-  exec 6>&1
+  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+  { echo "$as_me: error: missing argument to $ac_option" >&2
+   { (exit 1); exit 1; }; }
 fi
-exec 5>./config.log
 
-echo "\
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-" 1>&5
+# Be sure to have absolute paths.
+for ac_var in exec_prefix prefix
+do
+  eval ac_val=$`echo $ac_var`
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
+    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; };;
+  esac
+done
 
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Also quote any args containing shell metacharacters.
-ac_configure_args=
-for ac_arg
+# Be sure to have absolute paths.
+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+              localstatedir libdir includedir oldincludedir infodir mandir
 do
-  case "$ac_arg" in
-  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
-  | --no-cr | --no-c) ;;
-  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
-  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
-  *" "*|*"     "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
-  ac_configure_args="$ac_configure_args '$ac_arg'" ;;
-  *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+  eval ac_val=$`echo $ac_var`
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* ) ;;
+    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; };;
   esac
 done
 
-# NLS nuisances.
-# Only set these to C if already set.  These must not be set unconditionally
-# because not all systems understand e.g. LANG=C (notably SCO).
-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
-# Non-C LC_CTYPE values break the ctype check.
-if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
-if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+  if test "x$build_alias" = x; then
+    cross_compiling=maybe
+    echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+    If a cross compiler is detected then cross compile mode will be used." >&2
+  elif test "x$build_alias" != "x$host_alias"; then
+    cross_compiling=yes
+  fi
+fi
 
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo > confdefs.h
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
 
-# A filename unique to this package, relative to the directory that
-# configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=src/ircd.c
 
 # Find the source files, if location was not specified.
 if test -z "$srcdir"; then
   ac_srcdir_defaulted=yes
   # Try the directory containing this script, then its parent.
-  ac_prog=$0
-  ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
-  test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+  ac_confdir=`(dirname "$0") 2>/dev/null ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+         X"$0" : 'X\(//\)[^/]' \| \
+         X"$0" : 'X\(//\)$' \| \
+         X"$0" : 'X\(/\)' \| \
+         .     : '\(.\)' 2>/dev/null ||
+echo X"$0" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
   srcdir=$ac_confdir
   if test ! -r $srcdir/$ac_unique_file; then
     srcdir=..
@@ -500,13 +712,390 @@ else
 fi
 if test ! -r $srcdir/$ac_unique_file; then
   if test "$ac_srcdir_defaulted" = yes; then
-    { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
+   { (exit 1); exit 1; }; }
   else
-    { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+   { (exit 1); exit 1; }; }
   fi
 fi
-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
+ac_env_build_alias_set=${build_alias+set}
+ac_env_build_alias_value=$build_alias
+ac_cv_env_build_alias_set=${build_alias+set}
+ac_cv_env_build_alias_value=$build_alias
+ac_env_host_alias_set=${host_alias+set}
+ac_env_host_alias_value=$host_alias
+ac_cv_env_host_alias_set=${host_alias+set}
+ac_cv_env_host_alias_value=$host_alias
+ac_env_target_alias_set=${target_alias+set}
+ac_env_target_alias_value=$target_alias
+ac_cv_env_target_alias_set=${target_alias+set}
+ac_cv_env_target_alias_value=$target_alias
+ac_env_CC_set=${CC+set}
+ac_env_CC_value=$CC
+ac_cv_env_CC_set=${CC+set}
+ac_cv_env_CC_value=$CC
+ac_env_CFLAGS_set=${CFLAGS+set}
+ac_env_CFLAGS_value=$CFLAGS
+ac_cv_env_CFLAGS_set=${CFLAGS+set}
+ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_LDFLAGS_set=${LDFLAGS+set}
+ac_env_LDFLAGS_value=$LDFLAGS
+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
+ac_cv_env_LDFLAGS_value=$LDFLAGS
+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_env_CPPFLAGS_value=$CPPFLAGS
+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+ac_env_CPP_set=${CPP+set}
+ac_env_CPP_value=$CPP
+ac_cv_env_CPP_set=${CPP+set}
+ac_cv_env_CPP_value=$CPP
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+  # Omit some internal or obsolete options to make the list less imposing.
+  # This message is too long to be a string in the A/UX 3.1 sh.
+  cat <<_ACEOF
+\`configure' configures this package to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE.  See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+  -h, --help              display this help and exit
+      --help=short        display options specific to this package
+      --help=recursive    display the short help of all the included packages
+  -V, --version           display version information and exit
+  -q, --quiet, --silent   do not print \`checking...' messages
+      --cache-file=FILE   cache test results in FILE [disabled]
+  -C, --config-cache      alias for \`--cache-file=config.cache'
+  -n, --no-create         do not create output files
+      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
+
+_ACEOF
+
+  cat <<_ACEOF
+Installation directories:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                          [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                          [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+  --bindir=DIR           user executables [EPREFIX/bin]
+  --sbindir=DIR          system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR       program executables [EPREFIX/libexec]
+  --datadir=DIR          read-only architecture-independent data [PREFIX/share]
+  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
+  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
+  --libdir=DIR           object code libraries [EPREFIX/lib]
+  --includedir=DIR       C header files [PREFIX/include]
+  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
+  --infodir=DIR          info documentation [PREFIX/info]
+  --mandir=DIR           man documentation [PREFIX/man]
+_ACEOF
+
+  cat <<\_ACEOF
+
+System types:
+  --build=BUILD     configure for building on BUILD [guessed]
+  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+
+  cat <<\_ACEOF
+
+Optional Features:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+ --enable-nospoof     Enable spoofing protection
+ --enable-hub     Compile as a hub server
+ --enable-ssl     Enable client and server SSL connections
+ --enable-dynamic-linking     Make the IRCd dynamically link shared objects rather than statically
+ --enable-inet6     Make the IRCd support IPv6
+ --enable-standardthreads     Use standard threads
+
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-listen=backlog     Specify the listen backlog value
+ --with-nick-history=length     Specify the length of the nickname history
+ --with-sendq=maxsendq     Specify the max sendq for the server
+ --with-bufferpool=size     Specify the size of the buffer pool
+ --with-hostname=host     Specify the local hostname of the server
+ --with-permissions=permissions     Specify the default permissions for
+configuration files
+ --with-dpath=path     Specify the path where configuration files are stored
+ --with-fd-setsize=size     Specify the max file descriptors to use
+ --with-spath     Specify the location of the executable
+
+Some influential environment variables:
+  CC          C compiler command
+  CFLAGS      C compiler flags
+  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+              nonstandard directory <lib dir>
+  CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
+              headers in a nonstandard directory <include dir>
+  CPP         C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+_ACEOF
+fi
+
+if test "$ac_init_help" = "recursive"; then
+  # If there are subdirs, report their specific --help.
+  ac_popdir=`pwd`
+  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+    test -d $ac_dir || continue
+    ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
+# absolute.
+ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
+ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd`
+ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
+ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
+
+    cd $ac_dir
+    # Check for guested configure; otherwise get Cygnus style configure.
+    if test -f $ac_srcdir/configure.gnu; then
+      echo
+      $SHELL $ac_srcdir/configure.gnu  --help=recursive
+    elif test -f $ac_srcdir/configure; then
+      echo
+      $SHELL $ac_srcdir/configure  --help=recursive
+    elif test -f $ac_srcdir/configure.ac ||
+           test -f $ac_srcdir/configure.in; then
+      echo
+      $ac_configure --help
+    else
+      echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+    fi
+    cd $ac_popdir
+  done
+fi
+
+test -n "$ac_init_help" && exit 0
+if $ac_init_version; then
+  cat <<\_ACEOF
+
+Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
+Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+  exit 0
+fi
+exec 5>config.log
+cat >&5 <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by $as_me, which was
+generated by GNU Autoconf 2.53.  Invocation command line was
+
+  $ $0 $@
+
+_ACEOF
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+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 || echo unknown`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
+
+/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+hostinfo               = `(hostinfo) 2>/dev/null               || echo unknown`
+/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
+/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  echo "PATH: $as_dir"
+done
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell meta-characters.
+ac_configure_args=
+ac_sep=
+for ac_arg
+do
+  case $ac_arg in
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c | -n ) continue ;;
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    continue ;;
+  *" "*|*"     "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+    ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+  esac
+  case " $ac_configure_args " in
+    *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+    *) ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+       ac_sep=" " ;;
+  esac
+  # Get rid of the leading space.
+done
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log.  We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Be sure not to use single quotes in there, as some shells,
+# such as our DU 5.0 friend, will then `close' the trap.
+trap 'exit_status=$?
+  # Save into config.log some information that might help in debugging.
+  {
+    echo
+    cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+    echo
+    # The following way of writing the cache mishandles newlines in values,
+{
+  (set) 2>&1 |
+    case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
+    *ac_space=\ *)
+      sed -n \
+        "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+      ;;
+    *)
+      sed -n \
+        "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      ;;
+    esac;
+}
+    echo
+    if test -s confdefs.h; then
+      cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+      echo
+      sed "/^$/d" confdefs.h
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      echo "$as_me: caught signal $ac_signal"
+    echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core core.* *.core &&
+  rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+    exit $exit_status
+     ' 0
+for ac_signal in 1 2 13 15; do
+  trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo >confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
 
+
+# Let the site file select an alternate cache file if it wants to.
 # Prefer explicitly selected file to automatically selected ones.
 if test -z "$CONFIG_SITE"; then
   if test "x$prefix" != xNONE; then
@@ -517,250 +1106,733 @@ if test -z "$CONFIG_SITE"; then
 fi
 for ac_site_file in $CONFIG_SITE; do
   if test -r "$ac_site_file"; then
-    echo "loading site script $ac_site_file"
+    { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+    sed 's/^/| /' "$ac_site_file" >&5
     . "$ac_site_file"
   fi
 done
 
 if test -r "$cache_file"; then
-  echo "loading cache $cache_file"
-  . $cache_file
+  # Some versions of bash will fail to source /dev/null (special
+  # files actually), so we avoid doing that.
+  if test -f "$cache_file"; then
+    { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . $cache_file;;
+      *)                      . ./$cache_file;;
+    esac
+  fi
 else
-  echo "creating cache $cache_file"
-  > $cache_file
+  { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+  >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in `(set) 2>&1 |
+               sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+  eval ac_old_set=\$ac_cv_env_${ac_var}_set
+  eval ac_new_set=\$ac_env_${ac_var}_set
+  eval ac_old_val="\$ac_cv_env_${ac_var}_value"
+  eval ac_new_val="\$ac_env_${ac_var}_value"
+  case $ac_old_set,$ac_new_set in
+    set,)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,);;
+    *)
+      if test "x$ac_old_val" != "x$ac_new_val"; then
+        { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+        { echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
+echo "$as_me:   former value:  $ac_old_val" >&2;}
+        { echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
+echo "$as_me:   current value: $ac_new_val" >&2;}
+        ac_cache_corrupted=:
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *" "*|*"   "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+      ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *) ac_arg=$ac_var=$ac_new_val ;;
+    esac
+    case " $ac_configure_args " in
+      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+    esac
+  fi
+done
+if $ac_cache_corrupted; then
+  { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+   { (exit 1); exit 1; }; }
 fi
 
 ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
 ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-ac_exeext=
-ac_objext=o
-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
-  # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
-  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
-    ac_n= ac_c='
-' ac_t='       '
-  else
-    ac_n=-n ac_c= ac_t=
-  fi
-else
-  ac_n= ac_c='\c' ac_t=
-fi
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
-# Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:560: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test $# = 0; then
+       echo "You might want to run ./Config or provide some parameters to this script."
+       echo "./configure --help for information about this script"
+       exit 0
+fi
+ac_config_headers="$ac_config_headers include/setup.h"
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_CC="gcc"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
 fi
 fi
-CC="$ac_cv_prog_CC"
+CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  echo "$ac_t""$CC" 1>&6
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
 else
-  echo "$ac_t""no" 1>&6
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
-if test -z "$CC"; then
-  # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:590: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
 else
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
-  ac_prog_rejected=no
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
-        ac_prog_rejected=yes
-       continue
-      fi
-      ac_cv_prog_CC="cc"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
-if test $ac_prog_rejected = yes; then
-  # We found a bogon in the path, so make sure we never use it.
-  set dummy $ac_cv_prog_CC
-  shift
-  if test $# -gt 0; then
-    # We chose a different compiler from the bogus one.
-    # However, it has the same basename, so the bogon will be chosen
-    # first if we set CC to just the basename; use the full file name.
-    shift
-    set dummy "$ac_dir/$ac_word" "$@"
-    shift
-    ac_cv_prog_CC="$@"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
   fi
+done
+done
+
 fi
 fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
-  echo "$ac_t""$CC" 1>&6
+
+  CC=$ac_ct_CC
 else
-  echo "$ac_t""no" 1>&6
+  CC="$ac_cv_prog_CC"
 fi
 
-  if test -z "$CC"; then
-    case "`uname -s`" in
-    *win32* | *WIN32*)
-      # Extract the first word of "cl", so it can be a program name with args.
-set dummy cl; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:641: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_CC="cl"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
 fi
 fi
-CC="$ac_cv_prog_CC"
+CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  echo "$ac_t""$CC" 1>&6
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
 else
-  echo "$ac_t""no" 1>&6
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
- ;;
-    esac
-  fi
-  test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+
 fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
 
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:673: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
 
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
+  CC=$ac_ct_CC
+else
+  CC="$ac_cv_prog_CC"
+fi
 
-cat > conftest.$ac_ext << EOF
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
 
-#line 684 "configure"
-#include "confdefs.h"
+if test $ac_prog_rejected = yes; then
+  # We found a bogon in the path, so make sure we never use it.
+  set dummy $ac_cv_prog_CC
+  shift
+  if test $# != 0; then
+    # We chose a different compiler from the bogus one.
+    # However, it has the same basename, so the bogon will be chosen
+    # first if we set CC to just the basename; use the full file name.
+    shift
+    set dummy "$as_dir/$ac_word" ${1+"$@"}
+    shift
+    ac_cv_prog_CC="$@"
+  fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
 
-main(){return(0);}
-EOF
-if { (eval echo configure:689: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  ac_cv_prog_cc_works=yes
-  # If we can't run a trivial program, we are probably using a cross compiler.
-  if (./conftest; exit) 2>/dev/null; then
-    ac_cv_prog_cc_cross=no
-  else
-    ac_cv_prog_cc_cross=yes
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
   fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  ac_cv_prog_cc_works=no
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
-rm -fr conftest*
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
 
-echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
-if test $ac_cv_prog_cc_works = no; then
-  { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
+    test -n "$CC" && break
+  done
 fi
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:715: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
-echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
-cross_compiling=$ac_cv_prog_cc_cross
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
 
-echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:720: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
 else
-  cat > conftest.c <<EOF
-#ifdef __GNUC__
-  yes;
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$ac_ct_CC" && break
+done
+
+  CC=$ac_ct_CC
+fi
+
+fi
+
+
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH" >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH" >&2;}
+   { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+     "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+  (eval $ac_compiler --version </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+  (eval $ac_compiler -v </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+  (eval $ac_compiler -V </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
 #endif
-EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:729: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
-  ac_cv_prog_gcc=yes
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+echo "$as_me:$LINENO: checking for C compiler default output" >&5
+echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
+  (eval $ac_link_default) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # Find the output, starting from the most likely.  This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+
+# Be careful to initialize this variable, since it used to be cached.
+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
+ac_cv_exeext=
+for ac_file in `ls a_out.exe a.exe conftest.exe 2>/dev/null;
+                ls a.out conftest 2>/dev/null;
+                ls a.* conftest.* 2>/dev/null`; do
+  case $ac_file in
+    *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb | *.xSYM ) ;;
+    a.out ) # We found the default executable, but exeext='' is most
+            # certainly right.
+            break;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+          # FIXME: I believe we export ac_cv_exeext for Libtool --akim.
+          export ac_cv_exeext
+          break;;
+    * ) break;;
+  esac
+done
 else
-  ac_cv_prog_gcc=no
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables" >&5
+echo "$as_me: error: C compiler cannot create executables" >&2;}
+   { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
+
+# Check the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+  if { ac_try='./$ac_file'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+       cross_compiling=yes
+    else
+       { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'." >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+  fi
 fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+rm -f a.out a.exe conftest$ac_cv_exeext
+ac_clean_files=$ac_clean_files_save
+# Check the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do
+  case $ac_file in
+    *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+          export ac_cv_exeext
+          break;;
+    * ) break;;
+  esac
+done
+else
+  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link" >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link" >&2;}
+   { (exit 1); exit 1; }; }
 fi
 
-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
+rm -f conftest$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+if test "${ac_cv_objext+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 
-if test $ac_cv_prog_gcc = yes; then
-  GCC=yes
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;;
+    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+       break;;
+  esac
+done
 else
-  GCC=
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile" >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile" >&2;}
+   { (exit 1); exit 1; }; }
 fi
 
-ac_test_CFLAGS="${CFLAGS+set}"
-ac_save_CFLAGS="$CFLAGS"
-CFLAGS=
-echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:748: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_compiler_gnu=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_prog_cc_g=yes
 else
-  ac_cv_prog_cc_g=no
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_prog_cc_g=no
 fi
-rm -f conftest*
-
+rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-
-echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
 if test "$ac_test_CFLAGS" = set; then
-  CFLAGS="$ac_save_CFLAGS"
+  CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
     CFLAGS="-g -O2"
@@ -774,14 +1846,136 @@ else
     CFLAGS=
   fi
 fi
+# Some people use a C++ compiler to compile C.  Since we use `exit',
+# in C++ we need to declare it.  In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+  choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  for ac_declaration in \
+   ''\
+   '#include <stdlib.h>' \
+   'extern "C" void std::exit (int) throw (); using std::exit;' \
+   'extern "C" void std::exit (int); using std::exit;' \
+   'extern "C" void exit (int) throw ();' \
+   'extern "C" void exit (int);' \
+   'void exit (int);'
+do
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+$ac_declaration
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+continue
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_declaration
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  break
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+  echo '#ifdef __cplusplus' >>confdefs.h
+  echo $ac_declaration      >>confdefs.h
+  echo '#endif'             >>confdefs.h
+fi
+
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-if test "$ac_cv_prog_gcc" = "yes"; then
-echo $ac_n "checking if you have gcc 3.0 or higher""... $ac_c" 1>&6
-echo "configure:781: checking if you have gcc 3.0 or higher" >&5
-if eval "test \"`echo '$''{'ac_cv_gcc3'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+if test "$ac_cv_c_compiler_gnu" = "yes"; then
+echo "$as_me:$LINENO: checking if you have gcc 3.0 or higher" >&5
+echo $ECHO_N "checking if you have gcc 3.0 or higher... $ECHO_C" >&6
+if test "${ac_cv_gcc3+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  
+
 if test -z "`gcc -v 2>&1 |grep 'gcc version 3.'`"; then
 ac_cv_gcc3="no"
 else
@@ -789,42 +1983,62 @@ ac_cv_gcc3="yes"
 fi
 
 fi
-
-echo "$ac_t""$ac_cv_gcc3" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_gcc3" >&5
+echo "${ECHO_T}$ac_cv_gcc3" >&6
 if test "$ac_cv_gcc3" = "yes"; then
 CFLAGS="$CFLAGS -Wnone"
 fi
-echo $ac_n "checking if gcc has a working -pipe""... $ac_c" 1>&6
-echo "configure:799: checking if gcc has a working -pipe" >&5
-if eval "test \"`echo '$''{'ac_cv_pipe'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking if gcc has a working -pipe" >&5
+echo $ECHO_N "checking if gcc has a working -pipe... $ECHO_C" >&6
+if test "${ac_cv_pipe+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  
+
        save_cflags="$CFLAGS"
        CFLAGS="$CFLAGS -pipe"
-       cat > conftest.$ac_ext <<EOF
-#line 807 "configure"
+
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 
-int main() {
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 
-; return 0; }
-EOF
-if { (eval echo configure:814: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_pipe="yes"
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  ac_cv_pipe="no"
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_pipe="no"
 fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
        CFLAGS="$save_cflags"
 
 fi
-
-echo "$ac_t""$ac_cv_pipe" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_pipe" >&5
+echo "${ECHO_T}$ac_cv_pipe" >&6
 if test "$ac_cv_pipe" = "yes"; then
 CFLAGS="-pipe $CFLAGS"
 fi
 
 # Extract the first word of "rm", so it can be a program name with args.
 set dummy rm; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:837: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_RM'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_RM+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  case "$RM" in
-  /*)
+  case $RM in
+  [\\/]* | ?:[\\/]*)
   ac_cv_path_RM="$RM" # Let the user override the test with a path.
   ;;
-  ?:/*)                         
-  ac_cv_path_RM="$RM" # Let the user override the test with a dos path.
-  ;;
   *)
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do 
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_path_RM="$ac_dir/$ac_word"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_RM="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
   ;;
 esac
 fi
-RM="$ac_cv_path_RM"
+RM=$ac_cv_path_RM
+
 if test -n "$RM"; then
-  echo "$ac_t""$RM" 1>&6
+  echo "$as_me:$LINENO: result: $RM" >&5
+echo "${ECHO_T}$RM" >&6
 else
-  echo "$ac_t""no" 1>&6
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
 # Extract the first word of "cp", so it can be a program name with args.
 set dummy cp; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:872: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_CP'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_CP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  case "$CP" in
-  /*)
+  case $CP in
+  [\\/]* | ?:[\\/]*)
   ac_cv_path_CP="$CP" # Let the user override the test with a path.
   ;;
-  ?:/*)                         
-  ac_cv_path_CP="$CP" # Let the user override the test with a dos path.
-  ;;
   *)
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do 
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_path_CP="$ac_dir/$ac_word"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_CP="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
   ;;
 esac
 fi
-CP="$ac_cv_path_CP"
+CP=$ac_cv_path_CP
+
 if test -n "$CP"; then
-  echo "$ac_t""$CP" 1>&6
+  echo "$as_me:$LINENO: result: $CP" >&5
+echo "${ECHO_T}$CP" >&6
 else
-  echo "$ac_t""no" 1>&6
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
 # Extract the first word of "touch", so it can be a program name with args.
 set dummy touch; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:907: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_TOUCH'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_TOUCH+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  case "$TOUCH" in
-  /*)
+  case $TOUCH in
+  [\\/]* | ?:[\\/]*)
   ac_cv_path_TOUCH="$TOUCH" # Let the user override the test with a path.
   ;;
-  ?:/*)                         
-  ac_cv_path_TOUCH="$TOUCH" # Let the user override the test with a dos path.
-  ;;
   *)
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do 
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_path_TOUCH="$ac_dir/$ac_word"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_TOUCH="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
   ;;
 esac
 fi
-TOUCH="$ac_cv_path_TOUCH"
+TOUCH=$ac_cv_path_TOUCH
+
 if test -n "$TOUCH"; then
-  echo "$ac_t""$TOUCH" 1>&6
+  echo "$as_me:$LINENO: result: $TOUCH" >&5
+echo "${ECHO_T}$TOUCH" >&6
 else
-  echo "$ac_t""no" 1>&6
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
 # Extract the first word of "openssl", so it can be a program name with args.
 set dummy openssl; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:942: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_OPENSSLPATH'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_OPENSSLPATH+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  case "$OPENSSLPATH" in
-  /*)
+  case $OPENSSLPATH in
+  [\\/]* | ?:[\\/]*)
   ac_cv_path_OPENSSLPATH="$OPENSSLPATH" # Let the user override the test with a path.
   ;;
-  ?:/*)                         
-  ac_cv_path_OPENSSLPATH="$OPENSSLPATH" # Let the user override the test with a dos path.
-  ;;
   *)
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do 
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_path_OPENSSLPATH="$ac_dir/$ac_word"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_OPENSSLPATH="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
   ;;
 esac
 fi
-OPENSSLPATH="$ac_cv_path_OPENSSLPATH"
+OPENSSLPATH=$ac_cv_path_OPENSSLPATH
+
 if test -n "$OPENSSLPATH"; then
-  echo "$ac_t""$OPENSSLPATH" 1>&6
+  echo "$as_me:$LINENO: result: $OPENSSLPATH" >&5
+echo "${ECHO_T}$OPENSSLPATH" >&6
 else
-  echo "$ac_t""no" 1>&6
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
 # Extract the first word of "install", so it can be a program name with args.
 set dummy install; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:977: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_path_INSTALL'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_path_INSTALL+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  case "$INSTALL" in
-  /*)
+  case $INSTALL in
+  [\\/]* | ?:[\\/]*)
   ac_cv_path_INSTALL="$INSTALL" # Let the user override the test with a path.
   ;;
-  ?:/*)                         
-  ac_cv_path_INSTALL="$INSTALL" # Let the user override the test with a dos path.
-  ;;
   *)
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do 
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_path_INSTALL="$ac_dir/$ac_word"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_path_INSTALL="$as_dir/$ac_word$ac_exec_ext"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
   ;;
 esac
 fi
-INSTALL="$ac_cv_path_INSTALL"
+INSTALL=$ac_cv_path_INSTALL
+
 if test -n "$INSTALL"; then
-  echo "$ac_t""$INSTALL" 1>&6
+  echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6
 else
-  echo "$ac_t""no" 1>&6
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
-echo $ac_n "checking for crypt in -ldescrypt""... $ac_c" 1>&6
-echo "configure:1010: checking for crypt in -ldescrypt" >&5
-ac_lib_var=`echo descrypt'_'crypt | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for crypt in -ldescrypt" >&5
+echo $ECHO_N "checking for crypt in -ldescrypt... $ECHO_C" >&6
+if test "${ac_cv_lib_descrypt_crypt+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_save_LIBS="$LIBS"
+  ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldescrypt  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1018 "configure"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
+
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char crypt();
-
-int main() {
-crypt()
-; return 0; }
-EOF
-if { (eval echo configure:1029: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  cat >> confdefs.h <<\EOF
+   builtin and then its argument prototype would still apply.  */
+char crypt ();
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+crypt ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_descrypt_crypt=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_descrypt_crypt=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_descrypt_crypt" >&5
+echo "${ECHO_T}$ac_cv_lib_descrypt_crypt" >&6
+if test $ac_cv_lib_descrypt_crypt = yes; then
+  cat >>confdefs.h <<\_ACEOF
 #define HAVE_CRYPT 1
-EOF
+_ACEOF
  IRCDLIBS="$IRCDLIBS-ldescrypt " MKPASSWDLIBS="-ldescrypt"
 else
-  echo "$ac_t""no" 1>&6
-echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6
-echo "configure:1051: checking for crypt in -lcrypt" >&5
-ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+  echo "$as_me:$LINENO: checking for crypt in -lcrypt" >&5
+echo $ECHO_N "checking for crypt in -lcrypt... $ECHO_C" >&6
+if test "${ac_cv_lib_crypt_crypt+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_save_LIBS="$LIBS"
+  ac_check_lib_save_LIBS=$LIBS
 LIBS="-lcrypt  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1059 "configure"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
+
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char crypt();
-
-int main() {
-crypt()
-; return 0; }
-EOF
-if { (eval echo configure:1070: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-   cat >> confdefs.h <<\EOF
+   builtin and then its argument prototype would still apply.  */
+char crypt ();
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+crypt ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_crypt_crypt=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_crypt_crypt=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_crypt_crypt" >&5
+echo "${ECHO_T}$ac_cv_lib_crypt_crypt" >&6
+if test $ac_cv_lib_crypt_crypt = yes; then
+   cat >>confdefs.h <<\_ACEOF
 #define HAVE_CRYPT 1
-EOF
+_ACEOF
  IRCDLIBS="$IRCDLIBS-lcrypt " MKPASSWDLIBS="-lcrypt"
-else
-  echo "$ac_t""no" 1>&6
 fi
 
 fi
 
-echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
-echo "configure:1096: checking for socket in -lsocket" >&5
-ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for socket in -lsocket" >&5
+echo $ECHO_N "checking for socket in -lsocket... $ECHO_C" >&6
+if test "${ac_cv_lib_socket_socket+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_save_LIBS="$LIBS"
+  ac_check_lib_save_LIBS=$LIBS
 LIBS="-lsocket  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1104 "configure"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
+
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char socket();
-
-int main() {
-socket()
-; return 0; }
-EOF
-if { (eval echo configure:1115: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
+   builtin and then its argument prototype would still apply.  */
+char socket ();
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+socket ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_socket_socket=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_socket_socket=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_socket_socket" >&5
+echo "${ECHO_T}$ac_cv_lib_socket_socket" >&6
+if test $ac_cv_lib_socket_socket = yes; then
   IRCDLIBS="$IRCDLIBS-lsocket "
-else
-  echo "$ac_t""no" 1>&6
 fi
 
-echo $ac_n "checking for inet_ntoa in -lnsl""... $ac_c" 1>&6
-echo "configure:1136: checking for inet_ntoa in -lnsl" >&5
-ac_lib_var=`echo nsl'_'inet_ntoa | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for inet_ntoa in -lnsl" >&5
+echo $ECHO_N "checking for inet_ntoa in -lnsl... $ECHO_C" >&6
+if test "${ac_cv_lib_nsl_inet_ntoa+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_save_LIBS="$LIBS"
+  ac_check_lib_save_LIBS=$LIBS
 LIBS="-lnsl  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1144 "configure"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
+
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char inet_ntoa();
-
-int main() {
-inet_ntoa()
-; return 0; }
-EOF
-if { (eval echo configure:1155: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
+   builtin and then its argument prototype would still apply.  */
+char inet_ntoa ();
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+inet_ntoa ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_nsl_inet_ntoa=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_nsl_inet_ntoa=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_inet_ntoa" >&5
+echo "${ECHO_T}$ac_cv_lib_nsl_inet_ntoa" >&6
+if test $ac_cv_lib_nsl_inet_ntoa = yes; then
   IRCDLIBS="$IRCDLIBS-lnsl "
-else
-  echo "$ac_t""no" 1>&6
 fi
 
 
@@ -1180,374 +2491,1277 @@ openssl=no
 
 
 
-echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1185: checking how to run the C preprocessor" >&5
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
 fi
 if test -z "$CPP"; then
-if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-    # This must be in double quotes, not single quotes, because CPP may get
-  # substituted into the Makefile and "${CC-cc}" will confuse make.
-  CPP="${CC-cc} -E"
+  if test "${ac_cv_prog_CPP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+      # Double quotes because CPP needs to be expanded
+    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
   # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp.
-  cat > conftest.$ac_ext <<EOF
-#line 1200 "configure"
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1206: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
+                     Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  egrep -v '^ *\+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
   :
 else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
+  echo "$as_me: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether non-existent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  egrep -v '^ *\+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
   cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  CPP="${CC-cc} -E -traditional-cpp"
-  cat > conftest.$ac_ext <<EOF
-#line 1217 "configure"
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  break
+fi
+
+    done
+    ac_cv_prog_CPP=$CPP
+
+fi
+  CPP=$ac_cv_prog_CPP
+else
+  ac_cv_prog_CPP=$CPP
+fi
+echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1223: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
+                     Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  egrep -v '^ *\+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
   :
 else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
+  echo "$as_me: failed program was:" >&5
   cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  CPP="${CC-cc} -nologo -E"
-  cat > conftest.$ac_ext <<EOF
-#line 1234 "configure"
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether non-existent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1240: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  egrep -v '^ *\+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
   :
 else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
+  { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check" >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  egrep -v '^ *\+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_cv_header_stdc=yes
+else
+  echo "$as_me: failed program was:" >&5
   cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  CPP=/lib/cpp
+  ac_cv_header_stdc=no
 fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "memchr" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
 fi
 rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  egrep "free" >/dev/null 2>&1; then
+  :
+else
+  ac_cv_header_stdc=no
 fi
 rm -f conftest*
-  ac_cv_prog_CPP="$CPP"
+
 fi
-  CPP="$ac_cv_prog_CPP"
+
+if test $ac_cv_header_stdc = yes; then
+  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+  if test "$cross_compiling" = yes; then
+  :
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \
+                     || ('j' <= (c) && (c) <= 'r') \
+                     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+        || toupper (i) != TOUPPER (i))
+      exit(2);
+  exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
 else
-  ac_cv_prog_CPP="$CPP"
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+                  inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_Header=yes"
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
 fi
-echo "$ac_t""$CPP" 1>&6
 
-ac_safe=`echo "sys/param.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for sys/param.h""... $ac_c" 1>&6
-echo "configure:1266: checking for sys/param.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+done
+
+
+if test "${ac_cv_header_sys_param_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for sys/param.h" >&5
+echo $ECHO_N "checking for sys/param.h... $ECHO_C" >&6
+if test "${ac_cv_header_sys_param_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_sys_param_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_param_h" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 1271 "configure"
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking sys/param.h usability" >&5
+echo $ECHO_N "checking sys/param.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+#include <sys/param.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking sys/param.h presence" >&5
+echo $ECHO_N "checking sys/param.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <sys/param.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1276: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  egrep -v '^ *\+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
   cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+  yes:no )
+    { echo "$as_me:$LINENO: WARNING: sys/param.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: sys/param.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sys/param.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: sys/param.h: proceeding with the preprocessor's result" >&2;};;
+  no:yes )
+    { echo "$as_me:$LINENO: WARNING: sys/param.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: sys/param.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sys/param.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: sys/param.h: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sys/param.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: sys/param.h: proceeding with the preprocessor's result" >&2;};;
+esac
+echo "$as_me:$LINENO: checking for sys/param.h" >&5
+echo $ECHO_N "checking for sys/param.h... $ECHO_C" >&6
+if test "${ac_cv_header_sys_param_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_sys_param_h=$ac_header_preproc
 fi
-rm -f conftest*
+echo "$as_me:$LINENO: result: $ac_cv_header_sys_param_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_param_h" >&6
+
 fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  cat >> confdefs.h <<\EOF
+if test $ac_cv_header_sys_param_h = yes; then
+  cat >>confdefs.h <<\_ACEOF
 #define PARAMH 1
-EOF
+_ACEOF
 
-else
-  echo "$ac_t""no" 1>&6
 fi
 
-ac_safe=`echo "stdlib.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for stdlib.h""... $ac_c" 1>&6
-echo "configure:1302: checking for stdlib.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+
+if test "${ac_cv_header_stdlib_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for stdlib.h" >&5
+echo $ECHO_N "checking for stdlib.h... $ECHO_C" >&6
+if test "${ac_cv_header_stdlib_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_stdlib_h" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 1307 "configure"
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking stdlib.h usability" >&5
+echo $ECHO_N "checking stdlib.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+#include <stdlib.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking stdlib.h presence" >&5
+echo $ECHO_N "checking stdlib.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <stdlib.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1312: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  egrep -v '^ *\+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
   cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+  yes:no )
+    { echo "$as_me:$LINENO: WARNING: stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: stdlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: stdlib.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: stdlib.h: proceeding with the preprocessor's result" >&2;};;
+  no:yes )
+    { echo "$as_me:$LINENO: WARNING: stdlib.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: stdlib.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: stdlib.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: stdlib.h: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: stdlib.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: stdlib.h: proceeding with the preprocessor's result" >&2;};;
+esac
+echo "$as_me:$LINENO: checking for stdlib.h" >&5
+echo $ECHO_N "checking for stdlib.h... $ECHO_C" >&6
+if test "${ac_cv_header_stdlib_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_stdlib_h=$ac_header_preproc
 fi
-rm -f conftest*
+echo "$as_me:$LINENO: result: $ac_cv_header_stdlib_h" >&5
+echo "${ECHO_T}$ac_cv_header_stdlib_h" >&6
+
 fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  cat >> confdefs.h <<\EOF
+if test $ac_cv_header_stdlib_h = yes; then
+  cat >>confdefs.h <<\_ACEOF
 #define STDLIBH 1
-EOF
+_ACEOF
 
-else
-  echo "$ac_t""no" 1>&6
 fi
 
-ac_safe=`echo "stddef.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for stddef.h""... $ac_c" 1>&6
-echo "configure:1338: checking for stddef.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+
+if test "${ac_cv_header_stddef_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for stddef.h" >&5
+echo $ECHO_N "checking for stddef.h... $ECHO_C" >&6
+if test "${ac_cv_header_stddef_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stddef_h" >&5
+echo "${ECHO_T}$ac_cv_header_stddef_h" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 1343 "configure"
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking stddef.h usability" >&5
+echo $ECHO_N "checking stddef.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+#include <stddef.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking stddef.h presence" >&5
+echo $ECHO_N "checking stddef.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <stddef.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1348: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  egrep -v '^ *\+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
   cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+  yes:no )
+    { echo "$as_me:$LINENO: WARNING: stddef.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: stddef.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: stddef.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: stddef.h: proceeding with the preprocessor's result" >&2;};;
+  no:yes )
+    { echo "$as_me:$LINENO: WARNING: stddef.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: stddef.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: stddef.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: stddef.h: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: stddef.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: stddef.h: proceeding with the preprocessor's result" >&2;};;
+esac
+echo "$as_me:$LINENO: checking for stddef.h" >&5
+echo $ECHO_N "checking for stddef.h... $ECHO_C" >&6
+if test "${ac_cv_header_stddef_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_stddef_h=$ac_header_preproc
 fi
-rm -f conftest*
+echo "$as_me:$LINENO: result: $ac_cv_header_stddef_h" >&5
+echo "${ECHO_T}$ac_cv_header_stddef_h" >&6
+
 fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  cat >> confdefs.h <<\EOF
+if test $ac_cv_header_stddef_h = yes; then
+  cat >>confdefs.h <<\_ACEOF
 #define STDDEFH 1
-EOF
+_ACEOF
 
-else
-  echo "$ac_t""no" 1>&6
 fi
 
-ac_safe=`echo "sys/syslog.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for sys/syslog.h""... $ac_c" 1>&6
-echo "configure:1374: checking for sys/syslog.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+
+if test "${ac_cv_header_sys_syslog_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for sys/syslog.h" >&5
+echo $ECHO_N "checking for sys/syslog.h... $ECHO_C" >&6
+if test "${ac_cv_header_sys_syslog_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_sys_syslog_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_syslog_h" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 1379 "configure"
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking sys/syslog.h usability" >&5
+echo $ECHO_N "checking sys/syslog.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+#include <sys/syslog.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking sys/syslog.h presence" >&5
+echo $ECHO_N "checking sys/syslog.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <sys/syslog.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1384: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  egrep -v '^ *\+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
   cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+  yes:no )
+    { echo "$as_me:$LINENO: WARNING: sys/syslog.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: sys/syslog.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sys/syslog.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: sys/syslog.h: proceeding with the preprocessor's result" >&2;};;
+  no:yes )
+    { echo "$as_me:$LINENO: WARNING: sys/syslog.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: sys/syslog.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sys/syslog.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: sys/syslog.h: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sys/syslog.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: sys/syslog.h: proceeding with the preprocessor's result" >&2;};;
+esac
+echo "$as_me:$LINENO: checking for sys/syslog.h" >&5
+echo $ECHO_N "checking for sys/syslog.h... $ECHO_C" >&6
+if test "${ac_cv_header_sys_syslog_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_sys_syslog_h=$ac_header_preproc
 fi
-rm -f conftest*
+echo "$as_me:$LINENO: result: $ac_cv_header_sys_syslog_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_syslog_h" >&6
+
 fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  cat >> confdefs.h <<\EOF
+if test $ac_cv_header_sys_syslog_h = yes; then
+  cat >>confdefs.h <<\_ACEOF
 #define SYSSYSLOGH 1
-EOF
+_ACEOF
 
-else
-  echo "$ac_t""no" 1>&6
 fi
 
-ac_safe=`echo "unistd.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for unistd.h""... $ac_c" 1>&6
-echo "configure:1410: checking for unistd.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+
+if test "${ac_cv_header_unistd_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for unistd.h" >&5
+echo $ECHO_N "checking for unistd.h... $ECHO_C" >&6
+if test "${ac_cv_header_unistd_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_unistd_h" >&5
+echo "${ECHO_T}$ac_cv_header_unistd_h" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 1415 "configure"
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking unistd.h usability" >&5
+echo $ECHO_N "checking unistd.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+#include <unistd.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking unistd.h presence" >&5
+echo $ECHO_N "checking unistd.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <unistd.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1420: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  egrep -v '^ *\+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
   cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+  yes:no )
+    { echo "$as_me:$LINENO: WARNING: unistd.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: unistd.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: unistd.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: unistd.h: proceeding with the preprocessor's result" >&2;};;
+  no:yes )
+    { echo "$as_me:$LINENO: WARNING: unistd.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: unistd.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: unistd.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: unistd.h: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: unistd.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: unistd.h: proceeding with the preprocessor's result" >&2;};;
+esac
+echo "$as_me:$LINENO: checking for unistd.h" >&5
+echo $ECHO_N "checking for unistd.h... $ECHO_C" >&6
+if test "${ac_cv_header_unistd_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_unistd_h=$ac_header_preproc
 fi
-rm -f conftest*
+echo "$as_me:$LINENO: result: $ac_cv_header_unistd_h" >&5
+echo "${ECHO_T}$ac_cv_header_unistd_h" >&6
+
 fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  cat >> confdefs.h <<\EOF
+if test $ac_cv_header_unistd_h = yes; then
+  cat >>confdefs.h <<\_ACEOF
 #define UNISTDH 1
-EOF
+_ACEOF
 
-else
-  echo "$ac_t""no" 1>&6
 fi
 
-ac_safe=`echo "string.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for string.h""... $ac_c" 1>&6
-echo "configure:1446: checking for string.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+
+if test "${ac_cv_header_string_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for string.h" >&5
+echo $ECHO_N "checking for string.h... $ECHO_C" >&6
+if test "${ac_cv_header_string_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_string_h" >&5
+echo "${ECHO_T}$ac_cv_header_string_h" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 1451 "configure"
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking string.h usability" >&5
+echo $ECHO_N "checking string.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+#include <string.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking string.h presence" >&5
+echo $ECHO_N "checking string.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <string.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1456: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  egrep -v '^ *\+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
   cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+  yes:no )
+    { echo "$as_me:$LINENO: WARNING: string.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: string.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: string.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: string.h: proceeding with the preprocessor's result" >&2;};;
+  no:yes )
+    { echo "$as_me:$LINENO: WARNING: string.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: string.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: string.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: string.h: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: string.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: string.h: proceeding with the preprocessor's result" >&2;};;
+esac
+echo "$as_me:$LINENO: checking for string.h" >&5
+echo $ECHO_N "checking for string.h... $ECHO_C" >&6
+if test "${ac_cv_header_string_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_string_h=$ac_header_preproc
 fi
-rm -f conftest*
+echo "$as_me:$LINENO: result: $ac_cv_header_string_h" >&5
+echo "${ECHO_T}$ac_cv_header_string_h" >&6
+
 fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  cat >> confdefs.h <<\EOF
+if test $ac_cv_header_string_h = yes; then
+  cat >>confdefs.h <<\_ACEOF
 #define STRINGH 1
-EOF
+_ACEOF
 
-else
-  echo "$ac_t""no" 1>&6
 fi
 
-ac_safe=`echo "strings.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for strings.h""... $ac_c" 1>&6
-echo "configure:1482: checking for strings.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+
+if test "${ac_cv_header_strings_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for strings.h" >&5
+echo $ECHO_N "checking for strings.h... $ECHO_C" >&6
+if test "${ac_cv_header_strings_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_strings_h" >&5
+echo "${ECHO_T}$ac_cv_header_strings_h" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 1487 "configure"
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking strings.h usability" >&5
+echo $ECHO_N "checking strings.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+#include <strings.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking strings.h presence" >&5
+echo $ECHO_N "checking strings.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <strings.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1492: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  egrep -v '^ *\+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
   cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+  yes:no )
+    { echo "$as_me:$LINENO: WARNING: strings.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: strings.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: strings.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: strings.h: proceeding with the preprocessor's result" >&2;};;
+  no:yes )
+    { echo "$as_me:$LINENO: WARNING: strings.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: strings.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: strings.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: strings.h: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: strings.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: strings.h: proceeding with the preprocessor's result" >&2;};;
+esac
+echo "$as_me:$LINENO: checking for strings.h" >&5
+echo $ECHO_N "checking for strings.h... $ECHO_C" >&6
+if test "${ac_cv_header_strings_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_strings_h=$ac_header_preproc
 fi
-rm -f conftest*
+echo "$as_me:$LINENO: result: $ac_cv_header_strings_h" >&5
+echo "${ECHO_T}$ac_cv_header_strings_h" >&6
+
 fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  cat >> confdefs.h <<\EOF
+if test $ac_cv_header_strings_h = yes; then
+  cat >>confdefs.h <<\_ACEOF
 #define STRINGSH 1
-EOF
+_ACEOF
 
-else
-  echo "$ac_t""no" 1>&6
 fi
 
-ac_safe=`echo "regex.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for regex.h""... $ac_c" 1>&6
-echo "configure:1518: checking for regex.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+
+if test "${ac_cv_header_regex_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for regex.h" >&5
+echo $ECHO_N "checking for regex.h... $ECHO_C" >&6
+if test "${ac_cv_header_regex_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_regex_h" >&5
+echo "${ECHO_T}$ac_cv_header_regex_h" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 1523 "configure"
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking regex.h usability" >&5
+echo $ECHO_N "checking regex.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+#include <regex.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking regex.h presence" >&5
+echo $ECHO_N "checking regex.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <regex.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1528: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  egrep -v '^ *\+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
   cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+  yes:no )
+    { echo "$as_me:$LINENO: WARNING: regex.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: regex.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: regex.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: regex.h: proceeding with the preprocessor's result" >&2;};;
+  no:yes )
+    { echo "$as_me:$LINENO: WARNING: regex.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: regex.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: regex.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: regex.h: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: regex.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: regex.h: proceeding with the preprocessor's result" >&2;};;
+esac
+echo "$as_me:$LINENO: checking for regex.h" >&5
+echo $ECHO_N "checking for regex.h... $ECHO_C" >&6
+if test "${ac_cv_header_regex_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_regex_h=$ac_header_preproc
 fi
-rm -f conftest*
+echo "$as_me:$LINENO: result: $ac_cv_header_regex_h" >&5
+echo "${ECHO_T}$ac_cv_header_regex_h" >&6
+
 fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  cat >> confdefs.h <<\EOF
+if test $ac_cv_header_regex_h = yes; then
+  cat >>confdefs.h <<\_ACEOF
 #define HAVE_REGEX 1
-EOF
+_ACEOF
 
 else
-  echo "$ac_t""no" 1>&6
 
-echo "$ac_t""Ok we'll install regex" 1>&6
+echo "$as_me:$LINENO: result: Ok we'll install regex" >&5
+echo "${ECHO_T}Ok we'll install regex" >&6
 cd extras/regex
 ./configure
 make
@@ -1556,972 +3770,2588 @@ REGEX="../extras/regex/regex.o"
 
 fi
 
-ac_safe=`echo "openssl/ssl.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for openssl/ssl.h""... $ac_c" 1>&6
-echo "configure:1562: checking for openssl/ssl.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+
+if test "${ac_cv_header_openssl_ssl_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for openssl/ssl.h" >&5
+echo $ECHO_N "checking for openssl/ssl.h... $ECHO_C" >&6
+if test "${ac_cv_header_openssl_ssl_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_openssl_ssl_h" >&5
+echo "${ECHO_T}$ac_cv_header_openssl_ssl_h" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 1567 "configure"
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking openssl/ssl.h usability" >&5
+echo $ECHO_N "checking openssl/ssl.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
+$ac_includes_default
 #include <openssl/ssl.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1572: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking openssl/ssl.h presence" >&5
+echo $ECHO_N "checking openssl/ssl.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <openssl/ssl.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  egrep -v '^ *\+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
 fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  openssl=yes
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+  yes:no )
+    { echo "$as_me:$LINENO: WARNING: openssl/ssl.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: openssl/ssl.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: openssl/ssl.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: openssl/ssl.h: proceeding with the preprocessor's result" >&2;};;
+  no:yes )
+    { echo "$as_me:$LINENO: WARNING: openssl/ssl.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: openssl/ssl.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: openssl/ssl.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: openssl/ssl.h: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: openssl/ssl.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: openssl/ssl.h: proceeding with the preprocessor's result" >&2;};;
+esac
+echo "$as_me:$LINENO: checking for openssl/ssl.h" >&5
+echo $ECHO_N "checking for openssl/ssl.h... $ECHO_C" >&6
+if test "${ac_cv_header_openssl_ssl_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  echo "$ac_t""no" 1>&6
+  ac_cv_header_openssl_ssl_h=$ac_header_preproc
 fi
+echo "$as_me:$LINENO: result: $ac_cv_header_openssl_ssl_h" >&5
+echo "${ECHO_T}$ac_cv_header_openssl_ssl_h" >&6
 
-ac_safe=`echo "malloc.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for malloc.h""... $ac_c" 1>&6
-echo "configure:1595: checking for malloc.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+fi
+if test $ac_cv_header_openssl_ssl_h = yes; then
+  openssl=yes
+fi
+
+
+if test "${ac_cv_header_malloc_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for malloc.h" >&5
+echo $ECHO_N "checking for malloc.h... $ECHO_C" >&6
+if test "${ac_cv_header_malloc_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_malloc_h" >&5
+echo "${ECHO_T}$ac_cv_header_malloc_h" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 1600 "configure"
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking malloc.h usability" >&5
+echo $ECHO_N "checking malloc.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+#include <malloc.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking malloc.h presence" >&5
+echo $ECHO_N "checking malloc.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <malloc.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1605: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  egrep -v '^ *\+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
   cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+  yes:no )
+    { echo "$as_me:$LINENO: WARNING: malloc.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: malloc.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: malloc.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: malloc.h: proceeding with the preprocessor's result" >&2;};;
+  no:yes )
+    { echo "$as_me:$LINENO: WARNING: malloc.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: malloc.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: malloc.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: malloc.h: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: malloc.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: malloc.h: proceeding with the preprocessor's result" >&2;};;
+esac
+echo "$as_me:$LINENO: checking for malloc.h" >&5
+echo $ECHO_N "checking for malloc.h... $ECHO_C" >&6
+if test "${ac_cv_header_malloc_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_malloc_h=$ac_header_preproc
 fi
-rm -f conftest*
+echo "$as_me:$LINENO: result: $ac_cv_header_malloc_h" >&5
+echo "${ECHO_T}$ac_cv_header_malloc_h" >&6
+
 fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  cat >> confdefs.h <<\EOF
+if test $ac_cv_header_malloc_h = yes; then
+  cat >>confdefs.h <<\_ACEOF
 #define MALLOCH <malloc.h>
-EOF
+_ACEOF
 
-else
-  echo "$ac_t""no" 1>&6
 fi
 
-ac_safe=`echo "sys/rusage.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for sys/rusage.h""... $ac_c" 1>&6
-echo "configure:1631: checking for sys/rusage.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+
+if test "${ac_cv_header_sys_rusage_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for sys/rusage.h" >&5
+echo $ECHO_N "checking for sys/rusage.h... $ECHO_C" >&6
+if test "${ac_cv_header_sys_rusage_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_sys_rusage_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_rusage_h" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 1636 "configure"
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking sys/rusage.h usability" >&5
+echo $ECHO_N "checking sys/rusage.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
+$ac_includes_default
 #include <sys/rusage.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1641: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking sys/rusage.h presence" >&5
+echo $ECHO_N "checking sys/rusage.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <sys/rusage.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  egrep -v '^ *\+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
   cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+  yes:no )
+    { echo "$as_me:$LINENO: WARNING: sys/rusage.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: sys/rusage.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sys/rusage.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: sys/rusage.h: proceeding with the preprocessor's result" >&2;};;
+  no:yes )
+    { echo "$as_me:$LINENO: WARNING: sys/rusage.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: sys/rusage.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sys/rusage.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: sys/rusage.h: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: sys/rusage.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: sys/rusage.h: proceeding with the preprocessor's result" >&2;};;
+esac
+echo "$as_me:$LINENO: checking for sys/rusage.h" >&5
+echo $ECHO_N "checking for sys/rusage.h... $ECHO_C" >&6
+if test "${ac_cv_header_sys_rusage_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_sys_rusage_h=$ac_header_preproc
 fi
-rm -f conftest*
+echo "$as_me:$LINENO: result: $ac_cv_header_sys_rusage_h" >&5
+echo "${ECHO_T}$ac_cv_header_sys_rusage_h" >&6
+
 fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  cat >> confdefs.h <<\EOF
+if test $ac_cv_header_sys_rusage_h = yes; then
+  cat >>confdefs.h <<\_ACEOF
 #define RUSAGEH 1
-EOF
+_ACEOF
 
-else
-  echo "$ac_t""no" 1>&6
 fi
 
-ac_safe=`echo "glob.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for glob.h""... $ac_c" 1>&6
-echo "configure:1667: checking for glob.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+
+if test "${ac_cv_header_glob_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for glob.h" >&5
+echo $ECHO_N "checking for glob.h... $ECHO_C" >&6
+if test "${ac_cv_header_glob_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_glob_h" >&5
+echo "${ECHO_T}$ac_cv_header_glob_h" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 1672 "configure"
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking glob.h usability" >&5
+echo $ECHO_N "checking glob.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
+$ac_includes_default
 #include <glob.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1677: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking glob.h presence" >&5
+echo $ECHO_N "checking glob.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <glob.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  egrep -v '^ *\+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
   cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+  yes:no )
+    { echo "$as_me:$LINENO: WARNING: glob.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: glob.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: glob.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: glob.h: proceeding with the preprocessor's result" >&2;};;
+  no:yes )
+    { echo "$as_me:$LINENO: WARNING: glob.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: glob.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: glob.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: glob.h: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: glob.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: glob.h: proceeding with the preprocessor's result" >&2;};;
+esac
+echo "$as_me:$LINENO: checking for glob.h" >&5
+echo $ECHO_N "checking for glob.h... $ECHO_C" >&6
+if test "${ac_cv_header_glob_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_glob_h=$ac_header_preproc
 fi
-rm -f conftest*
+echo "$as_me:$LINENO: result: $ac_cv_header_glob_h" >&5
+echo "${ECHO_T}$ac_cv_header_glob_h" >&6
+
 fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  cat >> confdefs.h <<\EOF
+if test $ac_cv_header_glob_h = yes; then
+  cat >>confdefs.h <<\_ACEOF
 #define GLOBH 1
-EOF
+_ACEOF
 
-else
-  echo "$ac_t""no" 1>&6
 fi
 
-echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:1702: checking for working const" >&5
-if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 1707 "configure"
+  ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
-
-int main() {
-
-/* Ultrix mips cc rejects this.  */
-typedef int charset[2]; const charset x;
-/* SunOS 4.1.1 cc rejects this.  */
-char const *const *ccp;
-char **p;
-/* NEC SVR4.0.2 mips cc rejects this.  */
-struct point {int x, y;};
-static struct point const zero = {0,0};
-/* AIX XL C 1.02.0.0 rejects this.
-   It does not let you subtract one const X* pointer from another in an arm
-   of an if-expression whose if-part is not a constant expression */
-const char *g = "string";
-ccp = &g + (g ? g-g : 0);
-/* HPUX 7.0 cc rejects these. */
-++ccp;
-p = (char**) ccp;
-ccp = (char const *const *) p;
-{ /* SCO 3.2v4 cc rejects this.  */
-  char *t;
-  char const *s = 0 ? (char *) 0 : (char const *) 0;
-
-  *t++ = 0;
-}
-{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
-  int x[] = {25, 17};
-  const int *foo = &x[0];
-  ++foo;
-}
-{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
-  typedef const int *iptr;
-  iptr p = 0;
-  ++p;
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
 }
-{ /* AIX XL C 1.02.0.0 rejects this saying
-     "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
-  struct s { int j; const int *ap[3]; };
-  struct s *b; b->j = 5;
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
 }
-{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
-  const int foo = 10;
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
 }
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX                  -qlanglvl=ansi
+# Ultrix and OSF/1     -std1
+# HP-UX 10.20 and later        -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4                 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+  x|xno)
+    echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+  *)
+    echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+    CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
+echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
+if test "${ac_cv_c_const+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+/* FIXME: Include the comments suggested by Paul. */
+#ifndef __cplusplus
+  /* Ultrix mips cc rejects this.  */
+  typedef int charset[2];
+  const charset x;
+  /* SunOS 4.1.1 cc rejects this.  */
+  char const *const *ccp;
+  char **p;
+  /* NEC SVR4.0.2 mips cc rejects this.  */
+  struct point {int x, y;};
+  static struct point const zero = {0,0};
+  /* AIX XL C 1.02.0.0 rejects this.
+     It does not let you subtract one const X* pointer from another in
+     an arm of an if-expression whose if-part is not a constant
+     expression */
+  const char *g = "string";
+  ccp = &g + (g ? g-g : 0);
+  /* HPUX 7.0 cc rejects these. */
+  ++ccp;
+  p = (char**) ccp;
+  ccp = (char const *const *) p;
+  { /* SCO 3.2v4 cc rejects this.  */
+    char *t;
+    char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+    *t++ = 0;
+  }
+  { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
+    int x[] = {25, 17};
+    const int *foo = &x[0];
+    ++foo;
+  }
+  { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+    typedef const int *iptr;
+    iptr p = 0;
+    ++p;
+  }
+  { /* AIX XL C 1.02.0.0 rejects this saying
+       "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+    struct s { int j; const int *ap[3]; };
+    struct s *b; b->j = 5;
+  }
+  { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+    const int foo = 10;
+  }
+#endif
 
-; return 0; }
-EOF
-if { (eval echo configure:1756: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_c_const=yes
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  ac_cv_c_const=no
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_c_const=no
 fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-
-echo "$ac_t""$ac_cv_c_const" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
+echo "${ECHO_T}$ac_cv_c_const" >&6
 if test $ac_cv_c_const = no; then
-  cat >> confdefs.h <<\EOF
-#define const 
-EOF
+
+cat >>confdefs.h <<\_ACEOF
+#define const
+_ACEOF
 
 fi
 
-echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:1777: checking for inline" >&5
-if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for inline" >&5
+echo $ECHO_N "checking for inline... $ECHO_C" >&6
+if test "${ac_cv_c_inline+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_cv_c_inline=no
 for ac_kw in inline __inline__ __inline; do
-  cat > conftest.$ac_ext <<EOF
-#line 1784 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
+#ifndef __cplusplus
+static $ac_kw int static_foo () {return 0; }
+$ac_kw int foo () {return 0; }
+#endif
 
-int main() {
-} $ac_kw foo() {
-; return 0; }
-EOF
-if { (eval echo configure:1791: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_c_inline=$ac_kw; break
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
 fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
 done
 
 fi
-
-echo "$ac_t""$ac_cv_c_inline" 1>&6
-case "$ac_cv_c_inline" in
+echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
+echo "${ECHO_T}$ac_cv_c_inline" >&6
+case $ac_cv_c_inline in
   inline | yes) ;;
-  no) cat >> confdefs.h <<\EOF
-#define inline 
-EOF
+  no)
+cat >>confdefs.h <<\_ACEOF
+#define inline
+_ACEOF
  ;;
-  *)  cat >> confdefs.h <<EOF
+  *)  cat >>confdefs.h <<_ACEOF
 #define inline $ac_cv_c_inline
-EOF
+_ACEOF
  ;;
 esac
 
-echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1817: checking for ANSI C header files" >&5
-if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for size_t" >&5
+echo $ECHO_N "checking for size_t... $ECHO_C" >&6
+if test "${ac_cv_type_size_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 1822 "configure"
-#include "confdefs.h"
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1830: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  rm -rf conftest*
-  ac_cv_header_stdc=yes
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-if test $ac_cv_header_stdc = yes; then
-  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-cat > conftest.$ac_ext <<EOF
-#line 1847 "configure"
-#include "confdefs.h"
-#include <string.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "memchr" >/dev/null 2>&1; then
-  :
-else
-  rm -rf conftest*
-  ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
-  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-cat > conftest.$ac_ext <<EOF
-#line 1865 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
-#include <stdlib.h>
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "free" >/dev/null 2>&1; then
-  :
+$ac_includes_default
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+if ((size_t *) 0)
+  return 0;
+if (sizeof (size_t))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_type_size_t=yes
 else
-  rm -rf conftest*
-  ac_cv_header_stdc=no
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_type_size_t=no
 fi
-rm -f conftest*
-
+rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-
-if test $ac_cv_header_stdc = yes; then
-  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-if test "$cross_compiling" = yes; then
+echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
+echo "${ECHO_T}$ac_cv_type_size_t" >&6
+if test $ac_cv_type_size_t = yes; then
   :
 else
-  cat > conftest.$ac_ext <<EOF
-#line 1886 "configure"
-#include "confdefs.h"
-#include <ctype.h>
-#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int main () { int i; for (i = 0; i < 256; i++)
-if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
-exit (0); }
-
-EOF
-if { (eval echo configure:1897: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
-  :
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -fr conftest*
-  ac_cv_header_stdc=no
-fi
-rm -fr conftest*
-fi
-
-fi
-fi
-
-echo "$ac_t""$ac_cv_header_stdc" 1>&6
-if test $ac_cv_header_stdc = yes; then
-  cat >> confdefs.h <<\EOF
-#define STDC_HEADERS 1
-EOF
-
-fi
-
-echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:1921: checking for size_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 1926 "configure"
-#include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
-#endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
-  rm -rf conftest*
-  ac_cv_type_size_t=yes
-else
-  rm -rf conftest*
-  ac_cv_type_size_t=no
-fi
-rm -f conftest*
 
-fi
-echo "$ac_t""$ac_cv_type_size_t" 1>&6
-if test $ac_cv_type_size_t = no; then
-  cat >> confdefs.h <<\EOF
+cat >>confdefs.h <<_ACEOF
 #define size_t unsigned
-EOF
+_ACEOF
 
 fi
 
-echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:1954: checking whether time.h and sys/time.h may both be included" >&5
-if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
+echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6
+if test "${ac_cv_header_time+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 1959 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
 #include <time.h>
-int main() {
-struct tm *tp;
-; return 0; }
-EOF
-if { (eval echo configure:1968: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+if ((struct tm *) 0)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_header_time=yes
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  ac_cv_header_time=no
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_header_time=no
 fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-
-echo "$ac_t""$ac_cv_header_time" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
+echo "${ECHO_T}$ac_cv_header_time" >&6
 if test $ac_cv_header_time = yes; then
-  cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
 #define TIME_WITH_SYS_TIME 1
-EOF
+_ACEOF
 
 fi
 
-echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
-echo "configure:1989: checking whether struct tm is in sys/time.h or time.h" >&5
-if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5
+echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6
+if test "${ac_cv_struct_tm+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 1994 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <time.h>
-int main() {
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 struct tm *tp; tp->tm_sec;
-; return 0; }
-EOF
-if { (eval echo configure:2002: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_struct_tm=time.h
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  ac_cv_struct_tm=sys/time.h
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_struct_tm=sys/time.h
 fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-
-echo "$ac_t""$ac_cv_struct_tm" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5
+echo "${ECHO_T}$ac_cv_struct_tm" >&6
 if test $ac_cv_struct_tm = sys/time.h; then
-  cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
 #define TM_IN_SYS_TIME 1
-EOF
+_ACEOF
 
 fi
 
-echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:2023: checking for uid_t in sys/types.h" >&5
-if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for uid_t in sys/types.h" >&5
+echo $ECHO_N "checking for uid_t in sys/types.h... $ECHO_C" >&6
+if test "${ac_cv_type_uid_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 2028 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <sys/types.h>
-EOF
+
+_ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
   egrep "uid_t" >/dev/null 2>&1; then
-  rm -rf conftest*
   ac_cv_type_uid_t=yes
 else
-  rm -rf conftest*
   ac_cv_type_uid_t=no
 fi
 rm -f conftest*
 
 fi
-
-echo "$ac_t""$ac_cv_type_uid_t" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_type_uid_t" >&5
+echo "${ECHO_T}$ac_cv_type_uid_t" >&6
 if test $ac_cv_type_uid_t = no; then
-  cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
 #define uid_t int
-EOF
+_ACEOF
 
-  cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
 #define gid_t int
-EOF
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for short" >&5
+echo $ECHO_N "checking for short... $ECHO_C" >&6
+if test "${ac_cv_type_short+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+if ((short *) 0)
+  return 0;
+if (sizeof (short))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_type_short=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_type_short=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_short" >&5
+echo "${ECHO_T}$ac_cv_type_short" >&6
+
+echo "$as_me:$LINENO: checking size of short" >&5
+echo $ECHO_N "checking size of short... $ECHO_C" >&6
+if test "${ac_cv_sizeof_short+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$ac_cv_type_short" = yes; then
+  # The cast to unsigned long works around a bug in the HP C Compiler
+  # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+  # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+  # This bug is HP SR number 8606223364.
+  if test "$cross_compiling" = yes; then
+  # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (short))) >= 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (short))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_hi=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_lo=`expr $ac_mid + 1`
+                    if test $ac_lo -le $ac_mid; then
+                      ac_lo= ac_hi=
+                      break
+                    fi
+                    ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (short))) < 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (short))) >= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_lo=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_hi=`expr '(' $ac_mid ')' - 1`
+                       if test $ac_mid -le $ac_hi; then
+                         ac_lo= ac_hi=
+                         break
+                       fi
+                       ac_mid=`expr 2 '*' $ac_mid`
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_lo= ac_hi=
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (short))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_hi=$ac_mid
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_short=$ac_lo;;
+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (short), 77" >&5
+echo "$as_me: error: cannot compute sizeof (short), 77" >&2;}
+   { (exit 1); exit 1; }; } ;;
+esac
+else
+  if test "$cross_compiling" = yes; then
+  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5
+echo "$as_me: error: cannot run test program while cross compiling" >&2;}
+   { (exit 1); exit 1; }; }
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+long longval () { return (long) (sizeof (short)); }
+unsigned long ulongval () { return (long) (sizeof (short)); }
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    exit (1);
+  if (((long) (sizeof (short))) < 0)
+    {
+      long i = longval ();
+      if (i != ((long) (sizeof (short))))
+       exit (1);
+      fprintf (f, "%ld\n", i);
+    }
+  else
+    {
+      unsigned long i = ulongval ();
+      if (i != ((long) (sizeof (short))))
+       exit (1);
+      fprintf (f, "%lu\n", i);
+    }
+  exit (ferror (f) || fclose (f) != 0);
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_sizeof_short=`cat conftest.val`
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (short), 77" >&5
+echo "$as_me: error: cannot compute sizeof (short), 77" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+rm -f conftest.val
+else
+  ac_cv_sizeof_short=0
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sizeof_short" >&5
+echo "${ECHO_T}$ac_cv_sizeof_short" >&6
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_SHORT $ac_cv_sizeof_short
+_ACEOF
+
+
+echo "$as_me:$LINENO: checking for int" >&5
+echo $ECHO_N "checking for int... $ECHO_C" >&6
+if test "${ac_cv_type_int+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+if ((int *) 0)
+  return 0;
+if (sizeof (int))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_type_int=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_type_int=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5
+echo "${ECHO_T}$ac_cv_type_int" >&6
+
+echo "$as_me:$LINENO: checking size of int" >&5
+echo $ECHO_N "checking size of int... $ECHO_C" >&6
+if test "${ac_cv_sizeof_int+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$ac_cv_type_int" = yes; then
+  # The cast to unsigned long works around a bug in the HP C Compiler
+  # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+  # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+  # This bug is HP SR number 8606223364.
+  if test "$cross_compiling" = yes; then
+  # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (int))) >= 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_hi=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_lo=`expr $ac_mid + 1`
+                    if test $ac_lo -le $ac_mid; then
+                      ac_lo= ac_hi=
+                      break
+                    fi
+                    ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (int))) < 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (int))) >= $ac_mid)];
+test_array [0] = 0
 
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_lo=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_hi=`expr '(' $ac_mid ')' - 1`
+                       if test $ac_mid -le $ac_hi; then
+                         ac_lo= ac_hi=
+                         break
+                       fi
+                       ac_mid=`expr 2 '*' $ac_mid`
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+  done
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_lo= ac_hi=
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
 fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)];
+test_array [0] = 0
 
-echo $ac_n "checking size of short""... $ac_c" 1>&6
-echo "configure:2057: checking size of short" >&5
-if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_hi=$ac_mid
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_int=$ac_lo;;
+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77" >&5
+echo "$as_me: error: cannot compute sizeof (int), 77" >&2;}
+   { (exit 1); exit 1; }; } ;;
+esac
 else
   if test "$cross_compiling" = yes; then
-    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5
+echo "$as_me: error: cannot run test program while cross compiling" >&2;}
+   { (exit 1); exit 1; }; }
 else
-  cat > conftest.$ac_ext <<EOF
-#line 2065 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
+$ac_includes_default
+long longval () { return (long) (sizeof (int)); }
+unsigned long ulongval () { return (long) (sizeof (int)); }
 #include <stdio.h>
-main()
+#include <stdlib.h>
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    exit (1);
+  if (((long) (sizeof (int))) < 0)
+    {
+      long i = longval ();
+      if (i != ((long) (sizeof (int))))
+       exit (1);
+      fprintf (f, "%ld\n", i);
+    }
+  else
+    {
+      unsigned long i = ulongval ();
+      if (i != ((long) (sizeof (int))))
+       exit (1);
+      fprintf (f, "%lu\n", i);
+    }
+  exit (ferror (f) || fclose (f) != 0);
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_sizeof_int=`cat conftest.val`
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77" >&5
+echo "$as_me: error: cannot compute sizeof (int), 77" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+rm -f conftest.val
+else
+  ac_cv_sizeof_int=0
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5
+echo "${ECHO_T}$ac_cv_sizeof_int" >&6
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_INT $ac_cv_sizeof_int
+_ACEOF
+
+
+echo "$as_me:$LINENO: checking for long" >&5
+echo $ECHO_N "checking for long... $ECHO_C" >&6
+if test "${ac_cv_type_long+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+if ((long *) 0)
+  return 0;
+if (sizeof (long))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_type_long=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_type_long=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5
+echo "${ECHO_T}$ac_cv_type_long" >&6
+
+echo "$as_me:$LINENO: checking size of long" >&5
+echo $ECHO_N "checking size of long... $ECHO_C" >&6
+if test "${ac_cv_sizeof_long+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$ac_cv_type_long" = yes; then
+  # The cast to unsigned long works around a bug in the HP C Compiler
+  # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+  # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+  # This bug is HP SR number 8606223364.
+  if test "$cross_compiling" = yes; then
+  # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long))) >= 0)];
+test_array [0] = 0
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_lo=0 ac_mid=0
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
 {
-  FILE *f=fopen("conftestval", "w");
-  if (!f) exit(1);
-  fprintf(f, "%d\n", sizeof(short));
-  exit(0);
+static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
 }
-EOF
-if { (eval echo configure:2076: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
-  ac_cv_sizeof_short=`cat conftestval`
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_hi=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_lo=`expr $ac_mid + 1`
+                    if test $ac_lo -le $ac_mid; then
+                      ac_lo= ac_hi=
+                      break
+                    fi
+                    ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+  done
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -fr conftest*
-  ac_cv_sizeof_short=0
-fi
-rm -fr conftest*
-fi
-
-fi
-echo "$ac_t""$ac_cv_sizeof_short" 1>&6
-cat >> confdefs.h <<EOF
-#define SIZEOF_SHORT $ac_cv_sizeof_short
-EOF
-
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long))) < 0)];
+test_array [0] = 0
 
-echo $ac_n "checking size of int""... $ac_c" 1>&6
-echo "configure:2096: checking size of int" >&5
-if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  if test "$cross_compiling" = yes; then
-    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
-else
-  cat > conftest.$ac_ext <<EOF
-#line 2104 "configure"
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_hi=-1 ac_mid=-1
+  while :; do
+    cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
-#include <stdio.h>
-main()
+$ac_includes_default
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
 {
-  FILE *f=fopen("conftestval", "w");
-  if (!f) exit(1);
-  fprintf(f, "%d\n", sizeof(int));
-  exit(0);
+static int test_array [1 - 2 * !(((long) (sizeof (long))) >= $ac_mid)];
+test_array [0] = 0
+
+  ;
+  return 0;
 }
-EOF
-if { (eval echo configure:2115: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
-  ac_cv_sizeof_int=`cat conftestval`
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_lo=$ac_mid; break
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_hi=`expr '(' $ac_mid ')' - 1`
+                       if test $ac_mid -le $ac_hi; then
+                         ac_lo= ac_hi=
+                         break
+                       fi
+                       ac_mid=`expr 2 '*' $ac_mid`
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+  done
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -fr conftest*
-  ac_cv_sizeof_int=0
-fi
-rm -fr conftest*
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_lo= ac_hi=
 fi
-
+rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$ac_t""$ac_cv_sizeof_int" 1>&6
-cat >> confdefs.h <<EOF
-#define SIZEOF_INT $ac_cv_sizeof_int
-EOF
-
+rm -f conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+  ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)];
+test_array [0] = 0
 
-echo $ac_n "checking size of long""... $ac_c" 1>&6
-echo "configure:2135: checking size of long" >&5
-if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_hi=$ac_mid
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_long=$ac_lo;;
+'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77" >&5
+echo "$as_me: error: cannot compute sizeof (long), 77" >&2;}
+   { (exit 1); exit 1; }; } ;;
+esac
 else
   if test "$cross_compiling" = yes; then
-    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5
+echo "$as_me: error: cannot run test program while cross compiling" >&2;}
+   { (exit 1); exit 1; }; }
 else
-  cat > conftest.$ac_ext <<EOF
-#line 2143 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
+$ac_includes_default
+long longval () { return (long) (sizeof (long)); }
+unsigned long ulongval () { return (long) (sizeof (long)); }
 #include <stdio.h>
-main()
+#include <stdlib.h>
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
 {
-  FILE *f=fopen("conftestval", "w");
-  if (!f) exit(1);
-  fprintf(f, "%d\n", sizeof(long));
-  exit(0);
+
+  FILE *f = fopen ("conftest.val", "w");
+  if (! f)
+    exit (1);
+  if (((long) (sizeof (long))) < 0)
+    {
+      long i = longval ();
+      if (i != ((long) (sizeof (long))))
+       exit (1);
+      fprintf (f, "%ld\n", i);
+    }
+  else
+    {
+      unsigned long i = ulongval ();
+      if (i != ((long) (sizeof (long))))
+       exit (1);
+      fprintf (f, "%lu\n", i);
+    }
+  exit (ferror (f) || fclose (f) != 0);
+
+  ;
+  return 0;
 }
-EOF
-if { (eval echo configure:2154: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
-  ac_cv_sizeof_long=`cat conftestval`
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_sizeof_long=`cat conftest.val`
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+( exit $ac_status )
+{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77" >&5
+echo "$as_me: error: cannot compute sizeof (long), 77" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+rm -f conftest.val
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -fr conftest*
   ac_cv_sizeof_long=0
 fi
-rm -fr conftest*
-fi
-
 fi
-echo "$ac_t""$ac_cv_sizeof_long" 1>&6
-cat >> confdefs.h <<EOF
+echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5
+echo "${ECHO_T}$ac_cv_sizeof_long" >&6
+cat >>confdefs.h <<_ACEOF
 #define SIZEOF_LONG $ac_cv_sizeof_long
-EOF
+_ACEOF
 
 
 if test "$ac_cv_sizeof_int" = 2 ; then
-  echo $ac_n "checking for int16_t""... $ac_c" 1>&6
-echo "configure:2175: checking for int16_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_int16_t'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+  echo "$as_me:$LINENO: checking for int16_t" >&5
+echo $ECHO_N "checking for int16_t... $ECHO_C" >&6
+if test "${ac_cv_type_int16_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 2180 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
+$ac_includes_default
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
 #endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "(^|[^a-zA-Z_0-9])int16_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
-  rm -rf conftest*
+int
+main ()
+{
+if ((int16_t *) 0)
+  return 0;
+if (sizeof (int16_t))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_type_int16_t=yes
 else
-  rm -rf conftest*
-  ac_cv_type_int16_t=no
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_type_int16_t=no
 fi
-rm -f conftest*
-
+rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$ac_t""$ac_cv_type_int16_t" 1>&6
-if test $ac_cv_type_int16_t = no; then
-  cat >> confdefs.h <<\EOF
+echo "$as_me:$LINENO: result: $ac_cv_type_int16_t" >&5
+echo "${ECHO_T}$ac_cv_type_int16_t" >&6
+if test $ac_cv_type_int16_t = yes; then
+  :
+else
+
+cat >>confdefs.h <<_ACEOF
 #define int16_t int
-EOF
+_ACEOF
 
 fi
 
-  echo $ac_n "checking for u_int16_t""... $ac_c" 1>&6
-echo "configure:2208: checking for u_int16_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_u_int16_t'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+  echo "$as_me:$LINENO: checking for u_int16_t" >&5
+echo $ECHO_N "checking for u_int16_t... $ECHO_C" >&6
+if test "${ac_cv_type_u_int16_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 2213 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
+$ac_includes_default
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
 #endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "(^|[^a-zA-Z_0-9])u_int16_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
-  rm -rf conftest*
+int
+main ()
+{
+if ((u_int16_t *) 0)
+  return 0;
+if (sizeof (u_int16_t))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_type_u_int16_t=yes
 else
-  rm -rf conftest*
-  ac_cv_type_u_int16_t=no
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_type_u_int16_t=no
 fi
-rm -f conftest*
-
+rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$ac_t""$ac_cv_type_u_int16_t" 1>&6
-if test $ac_cv_type_u_int16_t = no; then
-  cat >> confdefs.h <<\EOF
+echo "$as_me:$LINENO: result: $ac_cv_type_u_int16_t" >&5
+echo "${ECHO_T}$ac_cv_type_u_int16_t" >&6
+if test $ac_cv_type_u_int16_t = yes; then
+  :
+else
+
+cat >>confdefs.h <<_ACEOF
 #define u_int16_t unsigned int
-EOF
+_ACEOF
 
 fi
 
 elif test "$ac_cv_sizeof_short" = 2 ; then
-  echo $ac_n "checking for int16_t""... $ac_c" 1>&6
-echo "configure:2242: checking for int16_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_int16_t'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+  echo "$as_me:$LINENO: checking for int16_t" >&5
+echo $ECHO_N "checking for int16_t... $ECHO_C" >&6
+if test "${ac_cv_type_int16_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 2247 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
+$ac_includes_default
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
 #endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "(^|[^a-zA-Z_0-9])int16_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
-  rm -rf conftest*
+int
+main ()
+{
+if ((int16_t *) 0)
+  return 0;
+if (sizeof (int16_t))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_type_int16_t=yes
 else
-  rm -rf conftest*
-  ac_cv_type_int16_t=no
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_type_int16_t=no
 fi
-rm -f conftest*
-
+rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$ac_t""$ac_cv_type_int16_t" 1>&6
-if test $ac_cv_type_int16_t = no; then
-  cat >> confdefs.h <<\EOF
+echo "$as_me:$LINENO: result: $ac_cv_type_int16_t" >&5
+echo "${ECHO_T}$ac_cv_type_int16_t" >&6
+if test $ac_cv_type_int16_t = yes; then
+  :
+else
+
+cat >>confdefs.h <<_ACEOF
 #define int16_t short
-EOF
+_ACEOF
 
 fi
 
-  echo $ac_n "checking for u_int16_t""... $ac_c" 1>&6
-echo "configure:2275: checking for u_int16_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_u_int16_t'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+  echo "$as_me:$LINENO: checking for u_int16_t" >&5
+echo $ECHO_N "checking for u_int16_t... $ECHO_C" >&6
+if test "${ac_cv_type_u_int16_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 2280 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
+$ac_includes_default
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
 #endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "(^|[^a-zA-Z_0-9])u_int16_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
-  rm -rf conftest*
+int
+main ()
+{
+if ((u_int16_t *) 0)
+  return 0;
+if (sizeof (u_int16_t))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_type_u_int16_t=yes
 else
-  rm -rf conftest*
-  ac_cv_type_u_int16_t=no
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_type_u_int16_t=no
 fi
-rm -f conftest*
-
+rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$ac_t""$ac_cv_type_u_int16_t" 1>&6
-if test $ac_cv_type_u_int16_t = no; then
-  cat >> confdefs.h <<\EOF
+echo "$as_me:$LINENO: result: $ac_cv_type_u_int16_t" >&5
+echo "${ECHO_T}$ac_cv_type_u_int16_t" >&6
+if test $ac_cv_type_u_int16_t = yes; then
+  :
+else
+
+cat >>confdefs.h <<_ACEOF
 #define u_int16_t unsigned short
-EOF
+_ACEOF
 
 fi
 
 else
-  { echo "configure: error: Cannot find a type with size of 16 bits" 1>&2; exit 1; }
+  { { echo "$as_me:$LINENO: error: Cannot find a type with size of 16 bits" >&5
+echo "$as_me: error: Cannot find a type with size of 16 bits" >&2;}
+   { (exit 1); exit 1; }; }
 fi
 if test "$ac_cv_sizeof_int" = 4 ; then
-  echo $ac_n "checking for int32_t""... $ac_c" 1>&6
-echo "configure:2312: checking for int32_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_int32_t'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+  echo "$as_me:$LINENO: checking for int32_t" >&5
+echo $ECHO_N "checking for int32_t... $ECHO_C" >&6
+if test "${ac_cv_type_int32_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 2317 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
+$ac_includes_default
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
 #endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "(^|[^a-zA-Z_0-9])int32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
-  rm -rf conftest*
+int
+main ()
+{
+if ((int32_t *) 0)
+  return 0;
+if (sizeof (int32_t))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_type_int32_t=yes
 else
-  rm -rf conftest*
-  ac_cv_type_int32_t=no
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_type_int32_t=no
 fi
-rm -f conftest*
-
+rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$ac_t""$ac_cv_type_int32_t" 1>&6
-if test $ac_cv_type_int32_t = no; then
-  cat >> confdefs.h <<\EOF
+echo "$as_me:$LINENO: result: $ac_cv_type_int32_t" >&5
+echo "${ECHO_T}$ac_cv_type_int32_t" >&6
+if test $ac_cv_type_int32_t = yes; then
+  :
+else
+
+cat >>confdefs.h <<_ACEOF
 #define int32_t int
-EOF
+_ACEOF
 
 fi
 
-  echo $ac_n "checking for u_int32_t""... $ac_c" 1>&6
-echo "configure:2345: checking for u_int32_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_u_int32_t'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+  echo "$as_me:$LINENO: checking for u_int32_t" >&5
+echo $ECHO_N "checking for u_int32_t... $ECHO_C" >&6
+if test "${ac_cv_type_u_int32_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 2350 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
+$ac_includes_default
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
 #endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "(^|[^a-zA-Z_0-9])u_int32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
-  rm -rf conftest*
+int
+main ()
+{
+if ((u_int32_t *) 0)
+  return 0;
+if (sizeof (u_int32_t))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_type_u_int32_t=yes
 else
-  rm -rf conftest*
-  ac_cv_type_u_int32_t=no
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_type_u_int32_t=no
 fi
-rm -f conftest*
-
+rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$ac_t""$ac_cv_type_u_int32_t" 1>&6
-if test $ac_cv_type_u_int32_t = no; then
-  cat >> confdefs.h <<\EOF
+echo "$as_me:$LINENO: result: $ac_cv_type_u_int32_t" >&5
+echo "${ECHO_T}$ac_cv_type_u_int32_t" >&6
+if test $ac_cv_type_u_int32_t = yes; then
+  :
+else
+
+cat >>confdefs.h <<_ACEOF
 #define u_int32_t unsigned int
-EOF
+_ACEOF
 
 fi
 
 elif test "$ac_cv_sizeof_short" = 4 ; then
-  echo $ac_n "checking for int32_t""... $ac_c" 1>&6
-echo "configure:2379: checking for int32_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_int32_t'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+  echo "$as_me:$LINENO: checking for int32_t" >&5
+echo $ECHO_N "checking for int32_t... $ECHO_C" >&6
+if test "${ac_cv_type_int32_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 2384 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
+$ac_includes_default
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
 #endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "(^|[^a-zA-Z_0-9])int32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
-  rm -rf conftest*
+int
+main ()
+{
+if ((int32_t *) 0)
+  return 0;
+if (sizeof (int32_t))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_type_int32_t=yes
 else
-  rm -rf conftest*
-  ac_cv_type_int32_t=no
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_type_int32_t=no
 fi
-rm -f conftest*
-
+rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$ac_t""$ac_cv_type_int32_t" 1>&6
-if test $ac_cv_type_int32_t = no; then
-  cat >> confdefs.h <<\EOF
+echo "$as_me:$LINENO: result: $ac_cv_type_int32_t" >&5
+echo "${ECHO_T}$ac_cv_type_int32_t" >&6
+if test $ac_cv_type_int32_t = yes; then
+  :
+else
+
+cat >>confdefs.h <<_ACEOF
 #define int32_t short
-EOF
+_ACEOF
 
 fi
 
-  echo $ac_n "checking for u_int32_t""... $ac_c" 1>&6
-echo "configure:2412: checking for u_int32_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_u_int32_t'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+  echo "$as_me:$LINENO: checking for u_int32_t" >&5
+echo $ECHO_N "checking for u_int32_t... $ECHO_C" >&6
+if test "${ac_cv_type_u_int32_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 2417 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
+$ac_includes_default
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
 #endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "(^|[^a-zA-Z_0-9])u_int32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
-  rm -rf conftest*
+int
+main ()
+{
+if ((u_int32_t *) 0)
+  return 0;
+if (sizeof (u_int32_t))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_type_u_int32_t=yes
 else
-  rm -rf conftest*
-  ac_cv_type_u_int32_t=no
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_type_u_int32_t=no
 fi
-rm -f conftest*
-
+rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$ac_t""$ac_cv_type_u_int32_t" 1>&6
-if test $ac_cv_type_u_int32_t = no; then
-  cat >> confdefs.h <<\EOF
+echo "$as_me:$LINENO: result: $ac_cv_type_u_int32_t" >&5
+echo "${ECHO_T}$ac_cv_type_u_int32_t" >&6
+if test $ac_cv_type_u_int32_t = yes; then
+  :
+else
+
+cat >>confdefs.h <<_ACEOF
 #define u_int32_t unsigned short
-EOF
+_ACEOF
 
 fi
 
 elif test "$ac_cv_sizeof_long" = 4 ; then
-  echo $ac_n "checking for int32_t""... $ac_c" 1>&6
-echo "configure:2446: checking for int32_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_int32_t'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+  echo "$as_me:$LINENO: checking for int32_t" >&5
+echo $ECHO_N "checking for int32_t... $ECHO_C" >&6
+if test "${ac_cv_type_int32_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 2451 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
+$ac_includes_default
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
 #endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "(^|[^a-zA-Z_0-9])int32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
-  rm -rf conftest*
+int
+main ()
+{
+if ((int32_t *) 0)
+  return 0;
+if (sizeof (int32_t))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_type_int32_t=yes
 else
-  rm -rf conftest*
-  ac_cv_type_int32_t=no
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_type_int32_t=no
 fi
-rm -f conftest*
-
+rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$ac_t""$ac_cv_type_int32_t" 1>&6
-if test $ac_cv_type_int32_t = no; then
-  cat >> confdefs.h <<\EOF
+echo "$as_me:$LINENO: result: $ac_cv_type_int32_t" >&5
+echo "${ECHO_T}$ac_cv_type_int32_t" >&6
+if test $ac_cv_type_int32_t = yes; then
+  :
+else
+
+cat >>confdefs.h <<_ACEOF
 #define int32_t long
-EOF
+_ACEOF
 
 fi
 
-  echo $ac_n "checking for u_int32_t""... $ac_c" 1>&6
-echo "configure:2479: checking for u_int32_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_u_int32_t'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+  echo "$as_me:$LINENO: checking for u_int32_t" >&5
+echo $ECHO_N "checking for u_int32_t... $ECHO_C" >&6
+if test "${ac_cv_type_u_int32_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 2484 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
-#include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
+$ac_includes_default
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
 #endif
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "(^|[^a-zA-Z_0-9])u_int32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
-  rm -rf conftest*
+int
+main ()
+{
+if ((u_int32_t *) 0)
+  return 0;
+if (sizeof (u_int32_t))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_type_u_int32_t=yes
 else
-  rm -rf conftest*
-  ac_cv_type_u_int32_t=no
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_type_u_int32_t=no
 fi
-rm -f conftest*
-
+rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-echo "$ac_t""$ac_cv_type_u_int32_t" 1>&6
-if test $ac_cv_type_u_int32_t = no; then
-  cat >> confdefs.h <<\EOF
+echo "$as_me:$LINENO: result: $ac_cv_type_u_int32_t" >&5
+echo "${ECHO_T}$ac_cv_type_u_int32_t" >&6
+if test $ac_cv_type_u_int32_t = yes; then
+  :
+else
+
+cat >>confdefs.h <<_ACEOF
 #define u_int32_t unsigned long
-EOF
+_ACEOF
 
 fi
 
 else
-  { echo "configure: error: Cannot find a type with size of 32 bits" 1>&2; exit 1; }
+  { { echo "$as_me:$LINENO: error: Cannot find a type with size of 32 bits" >&5
+echo "$as_me: error: Cannot find a type with size of 32 bits" >&2;}
+   { (exit 1); exit 1; }; }
 fi
 
-echo $ac_n "checking what kind of nonblocking sockets you have""... $ac_c" 1>&6
-echo "configure:2516: checking what kind of nonblocking sockets you have" >&5
-if eval "test \"`echo '$''{'ac_cv_nonblocking'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking what kind of nonblocking sockets you have" >&5
+echo $ECHO_N "checking what kind of nonblocking sockets you have... $ECHO_C" >&6
+if test "${ac_cv_nonblocking+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  
+
 if test "$cross_compiling" = yes; then
-    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5
+echo "$as_me: error: cannot run test program while cross compiling" >&2;}
+   { (exit 1); exit 1; }; }
 else
-  cat > conftest.$ac_ext <<EOF
-#line 2525 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -2549,20 +6379,32 @@ exit(0);
 exit(1);
 }
 
-EOF
-if { (eval echo configure:2554: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_nonblocking=O_NONBLOCK
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -fr conftest*
-  
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+( exit $ac_status )
+
 if test "$cross_compiling" = yes; then
-    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5
+echo "$as_me: error: cannot run test program while cross compiling" >&2;}
+   { (exit 1); exit 1; }; }
 else
-  cat > conftest.$ac_ext <<EOF
-#line 2566 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -2589,20 +6431,32 @@ exit(0);
 #endif
 exit(1);
 }
-EOF
-if { (eval echo configure:2594: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_nonblocking=O_NDELAY
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -fr conftest*
-  
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+( exit $ac_status )
+
 if test "$cross_compiling" = yes; then
-    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5
+echo "$as_me: error: cannot run test program while cross compiling" >&2;}
+   { (exit 1); exit 1; }; }
 else
-  cat > conftest.$ac_ext <<EOF
-#line 2606 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -2629,159 +6483,181 @@ exit(0);
 #endif
 exit(1);
 
-EOF
-if { (eval echo configure:2634: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_nonblocking=FIONBIO
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -fr conftest*
-  ac_cv_nonblocking=none
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+( exit $ac_status )
+ac_cv_nonblocking=none
 fi
-rm -fr conftest*
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
-
 fi
-rm -fr conftest*
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
-
 fi
-rm -fr conftest*
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
-
 fi
-
-echo "$ac_t""$ac_cv_nonblocking" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_nonblocking" >&5
+echo "${ECHO_T}$ac_cv_nonblocking" >&6
 if test "$ac_cv_nonblocking" = "O_NONBLOCK"; then
-cat >> confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
 #define NBLOCK_POSIX 1
-EOF
+_ACEOF
 
 elif test "$ac_cv_nonblocking" = "O_NDELAY"; then
-cat >> confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
 #define NBLOCK_BSD 1
-EOF
+_ACEOF
 
 elif test "$ac_cv_nonblocking" = "FIONBIO"; then
-cat >> confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
 #define NBLOCK_SYSV 1
-EOF
+_ACEOF
 
 fi
-if test $ac_cv_prog_gcc = yes; then
-    echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:2675: checking whether ${CC-cc} needs -traditional" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+if test $ac_cv_c_compiler_gnu = yes; then
+    echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5
+echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6
+if test "${ac_cv_prog_gcc_traditional+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
     ac_pattern="Autoconf.*'x'"
-  cat > conftest.$ac_ext <<EOF
-#line 2681 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <sgtty.h>
 Autoconf TIOCGETP
-EOF
+_ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
   egrep "$ac_pattern" >/dev/null 2>&1; then
-  rm -rf conftest*
   ac_cv_prog_gcc_traditional=yes
 else
-  rm -rf conftest*
   ac_cv_prog_gcc_traditional=no
 fi
 rm -f conftest*
 
 
   if test $ac_cv_prog_gcc_traditional = no; then
-    cat > conftest.$ac_ext <<EOF
-#line 2699 "configure"
+    cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <termio.h>
 Autoconf TCGETA
-EOF
+_ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
   egrep "$ac_pattern" >/dev/null 2>&1; then
-  rm -rf conftest*
   ac_cv_prog_gcc_traditional=yes
 fi
 rm -f conftest*
 
   fi
 fi
-
-echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5
+echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6
   if test $ac_cv_prog_gcc_traditional = yes; then
     CC="$CC -traditional"
   fi
 fi
 
-echo $ac_n "checking whether setpgrp takes no argument""... $ac_c" 1>&6
-echo "configure:2721: checking whether setpgrp takes no argument" >&5
-if eval "test \"`echo '$''{'ac_cv_func_setpgrp_void'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking whether setpgrp takes no argument" >&5
+echo $ECHO_N "checking whether setpgrp takes no argument... $ECHO_C" >&6
+if test "${ac_cv_func_setpgrp_void+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   if test "$cross_compiling" = yes; then
-  { echo "configure: error: cannot check setpgrp if cross compiling" 1>&2; exit 1; }
+  { { echo "$as_me:$LINENO: error: cannot check setpgrp when cross compiling" >&5
+echo "$as_me: error: cannot check setpgrp when cross compiling" >&2;}
+   { (exit 1); exit 1; }; }
 else
-  cat > conftest.$ac_ext <<EOF
-#line 2729 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
-
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
+#if HAVE_UNISTD_H
+# include <unistd.h>
 #endif
 
-/*
- * If this system has a BSD-style setpgrp, which takes arguments, exit
- * successfully.
- */
-main()
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
 {
-    if (setpgrp(1,1) == -1)
-       exit(0);
-    else
-       exit(1);
+/* If this system has a BSD-style setpgrp which takes arguments,
+  setpgrp(1, 1) will fail with ESRCH and return -1, in that case
+  exit successfully. */
+  exit (setpgrp (1,1) == -1 ? 0 : 1);
+  ;
+  return 0;
 }
-
-EOF
-if { (eval echo configure:2749: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_func_setpgrp_void=no
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -fr conftest*
-  ac_cv_func_setpgrp_void=yes
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+( exit $ac_status )
+ac_cv_func_setpgrp_void=yes
 fi
-rm -fr conftest*
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
-
-
 fi
-
-echo "$ac_t""$ac_cv_func_setpgrp_void" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_func_setpgrp_void" >&5
+echo "${ECHO_T}$ac_cv_func_setpgrp_void" >&6
 if test $ac_cv_func_setpgrp_void = yes; then
-  cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
 #define SETPGRP_VOID 1
-EOF
+_ACEOF
 
 fi
 
-echo $ac_n "checking whether setvbuf arguments are reversed""... $ac_c" 1>&6
-echo "configure:2773: checking whether setvbuf arguments are reversed" >&5
-if eval "test \"`echo '$''{'ac_cv_func_setvbuf_reversed'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking whether setvbuf arguments are reversed" >&5
+echo $ECHO_N "checking whether setvbuf arguments are reversed... $ECHO_C" >&6
+if test "${ac_cv_func_setvbuf_reversed+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   if test "$cross_compiling" = yes; then
-    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5
+echo "$as_me: error: cannot run test program while cross compiling" >&2;}
+   { (exit 1); exit 1; }; }
 else
-  cat > conftest.$ac_ext <<EOF
-#line 2781 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <stdio.h>
 /* If setvbuf has the reversed format, exit 0. */
-main () {
+int
+main ()
+{
   /* This call has the arguments reversed.
      A reversed system may check and see that the address of main
      is not _IOLBF, _IONBF, or _IOFBF, and return nonzero.  */
@@ -2790,332 +6666,449 @@ main () {
   putc('\r', stdout);
   exit(0);                     /* Non-reversed systems segv here.  */
 }
-EOF
-if { (eval echo configure:2795: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_func_setvbuf_reversed=yes
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -fr conftest*
-  ac_cv_func_setvbuf_reversed=no
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+( exit $ac_status )
+ac_cv_func_setvbuf_reversed=no
 fi
-rm -fr conftest*
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
-
 rm -f core core.* *.core
 fi
-
-echo "$ac_t""$ac_cv_func_setvbuf_reversed" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_func_setvbuf_reversed" >&5
+echo "${ECHO_T}$ac_cv_func_setvbuf_reversed" >&6
 if test $ac_cv_func_setvbuf_reversed = yes; then
-  cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
 #define SETVBUF_REVERSED 1
-EOF
+_ACEOF
 
 fi
 
+
 for ac_func in snprintf
 do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2821: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 2826 "configure"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
+    which can conflict with char $ac_func (); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char $ac_func();
-
-int main() {
-
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+char (*f) ();
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
-; return 0; }
-EOF
-if { (eval echo configure:2849: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
- cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+ cat >>confdefs.h <<\_ACEOF
 #define HAVE_SNPRINTF 1
-EOF
+_ACEOF
 
-else
-  echo "$ac_t""no" 1>&6
 fi
 done
 
+
 for ac_func in vsnprintf
 do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2879: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 2884 "configure"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
+    which can conflict with char $ac_func (); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char $ac_func();
-
-int main() {
-
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+char (*f) ();
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
-; return 0; }
-EOF
-if { (eval echo configure:2907: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
- cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+ cat >>confdefs.h <<\_ACEOF
 #define HAVE_VSNPRINTF 1
-EOF
+_ACEOF
 
-else
-  echo "$ac_t""no" 1>&6
 fi
 done
 
+
 for ac_func in strlcpy
 do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2937: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 2942 "configure"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
+    which can conflict with char $ac_func (); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char $ac_func();
-
-int main() {
-
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+char (*f) ();
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
-; return 0; }
-EOF
-if { (eval echo configure:2965: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
- cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+ cat >>confdefs.h <<\_ACEOF
 #define HAVE_STRLCPY 1
-EOF
+_ACEOF
 
-else
-  echo "$ac_t""no" 1>&6
 fi
 done
 
+
 for ac_func in strlcat
 do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2995: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 3000 "configure"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
+    which can conflict with char $ac_func (); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char $ac_func();
-
-int main() {
-
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+char (*f) ();
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
-; return 0; }
-EOF
-if { (eval echo configure:3023: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
- cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+ cat >>confdefs.h <<\_ACEOF
 #define HAVE_STRLCAT 1
-EOF
+_ACEOF
 
-else
-  echo "$ac_t""no" 1>&6
 fi
 done
 
+
 for ac_func in strlncat
 do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3053: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 3058 "configure"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
+    which can conflict with char $ac_func (); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char $ac_func();
-
-int main() {
-
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+char (*f) ();
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
-; return 0; }
-EOF
-if { (eval echo configure:3081: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
- cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+ cat >>confdefs.h <<\_ACEOF
 #define HAVE_STRLNCAT 1
-EOF
+_ACEOF
 
-else
-  echo "$ac_t""no" 1>&6
 fi
 done
 
 
-echo $ac_n "checking if we can set the core size to unlimited""... $ac_c" 1>&6
-echo "configure:3110: checking if we can set the core size to unlimited" >&5
-if eval "test \"`echo '$''{'ac_cv_force_core'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking if we can set the core size to unlimited" >&5
+echo $ECHO_N "checking if we can set the core size to unlimited... $ECHO_C" >&6
+if test "${ac_cv_force_core+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  
+
 if test "$cross_compiling" = yes; then
-    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5
+echo "$as_me: error: cannot run test program while cross compiling" >&2;}
+   { (exit 1); exit 1; }; }
 else
-  cat > conftest.$ac_ext <<EOF
-#line 3119 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 
 #include <sys/time.h>
@@ -3129,533 +7122,735 @@ exit(1);
 exit(0);
 }
 
-EOF
-if { (eval echo configure:3134: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_force_core=yes
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -fr conftest*
-  ac_cv_force_core=no
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+( exit $ac_status )
+ac_cv_force_core=no
 fi
-rm -fr conftest*
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 
-
 fi
-
-echo "$ac_t""$ac_cv_force_core" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_force_core" >&5
+echo "${ECHO_T}$ac_cv_force_core" >&6
 if test "$ac_cv_force_core" = "yes"; then
-cat >> confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
 #define FORCE_CORE 1
-EOF
+_ACEOF
 
 fi
-echo $ac_n "checking for vprintf""... $ac_c" 1>&6
-echo "configure:3157: checking for vprintf" >&5
-if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 3162 "configure"
+
+for ac_func in vprintf
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char vprintf(); below.  */
+    which can conflict with char $ac_func (); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char vprintf();
-
-int main() {
-
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+char (*f) ();
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
-#if defined (__stub_vprintf) || defined (__stub___vprintf)
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-vprintf();
+f = $ac_func;
 #endif
 
-; return 0; }
-EOF
-if { (eval echo configure:3185: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_vprintf=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_vprintf=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'vprintf`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  cat >> confdefs.h <<\EOF
-#define HAVE_VPRINTF 1
-EOF
-
-else
-  echo "$ac_t""no" 1>&6
-fi
-
-if test "$ac_cv_func_vprintf" != yes; then
-echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
-echo "configure:3209: checking for _doprnt" >&5
-if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 3214 "configure"
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+echo "$as_me:$LINENO: checking for _doprnt" >&5
+echo $ECHO_N "checking for _doprnt... $ECHO_C" >&6
+if test "${ac_cv_func__doprnt+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char _doprnt(); below.  */
+    which can conflict with char _doprnt (); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char _doprnt();
-
-int main() {
-
+   builtin and then its argument prototype would still apply.  */
+char _doprnt ();
+char (*f) ();
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub__doprnt) || defined (__stub____doprnt)
 choke me
 #else
-_doprnt();
+f = _doprnt;
 #endif
 
-; return 0; }
-EOF
-if { (eval echo configure:3237: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func__doprnt=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func__doprnt=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'_doprnt`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func__doprnt=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_func__doprnt=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5
+echo "${ECHO_T}$ac_cv_func__doprnt" >&6
+if test $ac_cv_func__doprnt = yes; then
+
+cat >>confdefs.h <<\_ACEOF
 #define HAVE_DOPRNT 1
-EOF
+_ACEOF
 
-else
-  echo "$ac_t""no" 1>&6
 fi
 
 fi
+done
+
+
 
 for ac_func in gettimeofday
 do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3264: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 3269 "configure"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
+    which can conflict with char $ac_func (); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char $ac_func();
-
-int main() {
-
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+char (*f) ();
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
-; return 0; }
-EOF
-if { (eval echo configure:3292: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
- cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+ cat >>confdefs.h <<\_ACEOF
 #define GETTIMEOFDAY 1
-EOF
+_ACEOF
 
 else
-  echo "$ac_t""no" 1>&6
+
 for ac_func in lrand48
 do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3319: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 3324 "configure"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
+    which can conflict with char $ac_func (); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char $ac_func();
-
-int main() {
-
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+char (*f) ();
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
-; return 0; }
-EOF
-if { (eval echo configure:3347: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
- cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+ cat >>confdefs.h <<\_ACEOF
 #define LRADN48 1
-EOF
+_ACEOF
 
-else
-  echo "$ac_t""no" 1>&6
 fi
 done
 
 fi
 done
 
+
 for ac_func in getrusage
 do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3380: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 3385 "configure"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
+    which can conflict with char $ac_func (); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char $ac_func();
-
-int main() {
-
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+char (*f) ();
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
-; return 0; }
-EOF
-if { (eval echo configure:3408: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
- cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+ cat >>confdefs.h <<\_ACEOF
 #define GETRUSAGE_2 1
-EOF
+_ACEOF
 
 else
-  echo "$ac_t""no" 1>&6
+
 for ac_func in times
 do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3435: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 3440 "configure"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
+    which can conflict with char $ac_func (); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char $ac_func();
-
-int main() {
-
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+char (*f) ();
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
-; return 0; }
-EOF
-if { (eval echo configure:3463: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
- cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+ cat >>confdefs.h <<\_ACEOF
 #define TIMES_2 1
-EOF
+_ACEOF
 
-else
-  echo "$ac_t""no" 1>&6
 fi
 done
 
 fi
 done
 
+
 for ac_func in setproctitle
 do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3496: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 3501 "configure"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
+    which can conflict with char $ac_func (); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char $ac_func();
-
-int main() {
-
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+char (*f) ();
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
-; return 0; }
-EOF
-if { (eval echo configure:3524: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
- cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+ cat >>confdefs.h <<\_ACEOF
 #define HAVE_SETPROCTITLE 1
-EOF
+_ACEOF
 
 else
-  echo "$ac_t""no" 1>&6
-echo $ac_n "checking for setproctitle in -lutil""... $ac_c" 1>&6
-echo "configure:3549: checking for setproctitle in -lutil" >&5
-ac_lib_var=`echo util'_'setproctitle | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+
+echo "$as_me:$LINENO: checking for setproctitle in -lutil" >&5
+echo $ECHO_N "checking for setproctitle in -lutil... $ECHO_C" >&6
+if test "${ac_cv_lib_util_setproctitle+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_save_LIBS="$LIBS"
+  ac_check_lib_save_LIBS=$LIBS
 LIBS="-lutil  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 3557 "configure"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
+
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char setproctitle();
-
-int main() {
-setproctitle()
-; return 0; }
-EOF
-if { (eval echo configure:3568: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  cat >> confdefs.h <<\EOF
+   builtin and then its argument prototype would still apply.  */
+char setproctitle ();
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+setproctitle ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_util_setproctitle=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_util_setproctitle=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_util_setproctitle" >&5
+echo "${ECHO_T}$ac_cv_lib_util_setproctitle" >&6
+if test $ac_cv_lib_util_setproctitle = yes; then
+  cat >>confdefs.h <<\_ACEOF
 #define HAVE_SETPROCTITLE 1
-EOF
+_ACEOF
  IRCDLIBS="$IRCDLIBS-lutil"
 else
-  echo "$ac_t""no" 1>&6
 
-cat > conftest.$ac_ext <<EOF
-#line 3591 "configure"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <sys/exec.h>
-EOF
+
+_ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
   egrep "#define.*PS_STRINGS.*" >/dev/null 2>&1; then
-  rm -rf conftest*
-  cat >> confdefs.h <<\EOF
+  cat >>confdefs.h <<\_ACEOF
 #define HAVE_PSSTRINGS 1
-EOF
+_ACEOF
 
 else
-  rm -rf conftest*
-  
+
+
 for ac_func in pstat
 do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3608: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 3613 "configure"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
+    which can conflict with char $ac_func (); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char $ac_func();
-
-int main() {
-
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+char (*f) ();
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
-; return 0; }
-EOF
-if { (eval echo configure:3636: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
- cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+ cat >>confdefs.h <<\_ACEOF
 #define HAVE_PSTAT 1
-EOF
+_ACEOF
 
-else
-  echo "$ac_t""no" 1>&6
 fi
 done
 
@@ -3670,17 +7865,19 @@ fi
 fi
 done
 
-echo $ac_n "checking what type of signals you have""... $ac_c" 1>&6
-echo "configure:3675: checking what type of signals you have" >&5
-if eval "test \"`echo '$''{'ac_cv_sigtype'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking what type of signals you have" >&5
+echo $ECHO_N "checking what type of signals you have... $ECHO_C" >&6
+if test "${ac_cv_sigtype+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  
+
 if test "$cross_compiling" = yes; then
-    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5
+echo "$as_me: error: cannot run test program while cross compiling" >&2;}
+   { (exit 1); exit 1; }; }
 else
-  cat > conftest.$ac_ext <<EOF
-#line 3684 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 
 #include <signal.h>
@@ -3688,20 +7885,32 @@ int main() {
 sigaction(SIGTERM, (struct sigaction *)0L, (struct sigaction *)0L);
 }
 
-EOF
-if { (eval echo configure:3693: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_sigtype=POSIX
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -fr conftest*
-  
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+( exit $ac_status )
+
 if test "$cross_compiling" = yes; then
-    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5
+echo "$as_me: error: cannot run test program while cross compiling" >&2;}
+   { (exit 1); exit 1; }; }
 else
-  cat > conftest.$ac_ext <<EOF
-#line 3705 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 
 #include <signal.h>
@@ -3721,860 +7930,1173 @@ kill(getpid(), SIGTERM);
 exit(0);
 }
 
-EOF
-if { (eval echo configure:3726: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_sigtype=BSD
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -fr conftest*
-  ac_cv_sigtype=SYSV
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+( exit $ac_status )
+ac_cv_sigtype=SYSV
 fi
-rm -fr conftest*
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
-
 fi
-rm -fr conftest*
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
-
 fi
-
-echo "$ac_t""$ac_cv_sigtype" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_sigtype" >&5
+echo "${ECHO_T}$ac_cv_sigtype" >&6
 
 if test "$ac_cv_sigtype" = "POSIX"; then
-cat >> confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
 #define POSIX_SIGNALS 1
-EOF
+_ACEOF
 
 elif test "$ac_cv_sigtype" = "BSD"; then
-cat >> confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
 #define BSD_RELIABLE_SIGNALS 1
-EOF
+_ACEOF
 
 else
-cat >> confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
 #define SYSV_UNRELIABLE_SIGNALS 1
-EOF
+_ACEOF
+
+fi
 
-fi 
 for ac_func in strtoken
 do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3765: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 3770 "configure"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
+    which can conflict with char $ac_func (); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char $ac_func();
-
-int main() {
-
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+char (*f) ();
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
-; return 0; }
-EOF
-if { (eval echo configure:3793: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-else
-  echo "$ac_t""no" 1>&6
-cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  cat >>confdefs.h <<\_ACEOF
 #define NEED_STRTOKEN 1
-EOF
+_ACEOF
 
 fi
 done
 
+
 for ac_func in strtok
 do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3824: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 3829 "configure"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
+    which can conflict with char $ac_func (); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char $ac_func();
-
-int main() {
-
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+char (*f) ();
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
-; return 0; }
-EOF
-if { (eval echo configure:3852: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-else
-  echo "$ac_t""no" 1>&6
-cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  cat >>confdefs.h <<\_ACEOF
 #define NEED_STRTOK 1
-EOF
+_ACEOF
 
 fi
 done
 
+
 for ac_func in strerror
 do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3883: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 3888 "configure"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
+    which can conflict with char $ac_func (); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char $ac_func();
-
-int main() {
-
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+char (*f) ();
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
-; return 0; }
-EOF
-if { (eval echo configure:3911: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-else
-  echo "$ac_t""no" 1>&6
-cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  cat >>confdefs.h <<\_ACEOF
 #define NEED_STRERROR 1
-EOF
+_ACEOF
 
 fi
 done
 
+
 for ac_func in index
 do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3942: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 3947 "configure"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
+    which can conflict with char $ac_func (); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char $ac_func();
-
-int main() {
-
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+char (*f) ();
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
-; return 0; }
-EOF
-if { (eval echo configure:3970: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-else
-  echo "$ac_t""no" 1>&6
-cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  cat >>confdefs.h <<\_ACEOF
 #define NOINDEX 1
-EOF
+_ACEOF
 
 fi
 done
 
+
 for ac_func in strtoul
 do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4001: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 4006 "configure"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
+    which can conflict with char $ac_func (); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char $ac_func();
-
-int main() {
-
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+char (*f) ();
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
-; return 0; }
-EOF
-if { (eval echo configure:4029: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-else
-  echo "$ac_t""no" 1>&6
-STRTOUL="strtoul.o"
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  STRTOUL="strtoul.o"
 fi
 done
 
+
 for ac_func in bcopy
 do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4057: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 4062 "configure"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
+    which can conflict with char $ac_func (); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char $ac_func();
-
-int main() {
-
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+char (*f) ();
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
-; return 0; }
-EOF
-if { (eval echo configure:4085: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-else
-  echo "$ac_t""no" 1>&6
-cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  cat >>confdefs.h <<\_ACEOF
 #define NEED_BCOPY 1
-EOF
+_ACEOF
 
 fi
 done
 
+
 for ac_func in bcmp
 do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4116: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 4121 "configure"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
+    which can conflict with char $ac_func (); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char $ac_func();
-
-int main() {
-
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+char (*f) ();
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
-; return 0; }
-EOF
-if { (eval echo configure:4144: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-else
-  echo "$ac_t""no" 1>&6
-cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  cat >>confdefs.h <<\_ACEOF
 #define NEED_BCMP 1
-EOF
+_ACEOF
 
 fi
 done
 
+
 for ac_func in bzero
 do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4175: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 4180 "configure"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
+    which can conflict with char $ac_func (); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char $ac_func();
-
-int main() {
-
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+char (*f) ();
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
-; return 0; }
-EOF
-if { (eval echo configure:4203: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-else
-  echo "$ac_t""no" 1>&6
-cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  cat >>confdefs.h <<\_ACEOF
 #define NEED_BZERO 1
-EOF
+_ACEOF
 
 fi
 done
 
+
 for ac_func in strcasecmp
 do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4234: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 4239 "configure"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
+    which can conflict with char $ac_func (); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char $ac_func();
-
-int main() {
-
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+char (*f) ();
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
-; return 0; }
-EOF
-if { (eval echo configure:4262: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
- cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+ cat >>confdefs.h <<\_ACEOF
 #define GOT_STRCASECMP 1
-EOF
+_ACEOF
 
-else
-  echo "$ac_t""no" 1>&6
 fi
 done
 
+
 for ac_func in inet_addr
 do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4292: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 4297 "configure"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
+    which can conflict with char $ac_func (); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char $ac_func();
-
-int main() {
-
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+char (*f) ();
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
-; return 0; }
-EOF
-if { (eval echo configure:4320: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-else
-  echo "$ac_t""no" 1>&6
-cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  cat >>confdefs.h <<\_ACEOF
 #define NEED_INET_ADDR 1
-EOF
+_ACEOF
 
 fi
 done
 
+
 for ac_func in inet_ntoa
 do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4351: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 4356 "configure"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
+    which can conflict with char $ac_func (); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char $ac_func();
-
-int main() {
-
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+char (*f) ();
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
-; return 0; }
-EOF
-if { (eval echo configure:4379: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-else
-  echo "$ac_t""no" 1>&6
-cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  cat >>confdefs.h <<\_ACEOF
 #define NEED_INET_NTOA 1
-EOF
+_ACEOF
 
 fi
 done
 
+
 for ac_func in inet_netof
 do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4410: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 4415 "configure"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
+    which can conflict with char $ac_func (); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char $ac_func();
-
-int main() {
-
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+char (*f) ();
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
-; return 0; }
-EOF
-if { (eval echo configure:4438: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
-else
-  echo "$ac_t""no" 1>&6
-cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+else
+  cat >>confdefs.h <<\_ACEOF
 #define NEED_INET_NETOF 1
-EOF
+_ACEOF
 
 fi
 done
 
+
 for ac_func in syslog
 do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4469: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 4474 "configure"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
+    which can conflict with char $ac_func (); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char $ac_func();
-
-int main() {
-
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+char (*f) ();
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
-; return 0; }
-EOF
-if { (eval echo configure:4497: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
- cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+ cat >>confdefs.h <<\_ACEOF
 #define HAVE_SYSLOG 1
-EOF
+_ACEOF
 
-else
-  echo "$ac_t""no" 1>&6
 fi
 done
 
+
 for ac_func in vsyslog
 do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:4527: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 4532 "configure"
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
+    which can conflict with char $ac_func (); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char $ac_func();
-
-int main() {
-
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+char (*f) ();
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
-; return 0; }
-EOF
-if { (eval echo configure:4555: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
- cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+ cat >>confdefs.h <<\_ACEOF
 #define HAVE_VSYSLOG 1
-EOF
+_ACEOF
 
-else
-  echo "$ac_t""no" 1>&6
 fi
 done
 
@@ -4582,108 +9104,109 @@ done
 
 
 
+
 # Check whether --with-listen or --without-listen was given.
 if test "${with_listen+set}" = set; then
   withval="$with_listen"
-  cat >> confdefs.h <<EOF
+  cat >>confdefs.h <<_ACEOF
 #define LISTEN_SIZE $withval
-EOF
+_ACEOF
 
 else
-  cat >> confdefs.h <<\EOF
+  cat >>confdefs.h <<\_ACEOF
 #define LISTEN_SIZE 5
-EOF
+_ACEOF
 
-fi
+fi;
 
 # Check whether --with-nick-history or --without-nick-history was given.
 if test "${with_nick_history+set}" = set; then
   withval="$with_nick_history"
-  cat >> confdefs.h <<EOF
+  cat >>confdefs.h <<_ACEOF
 #define NICKNAMEHISTORYLENGTH $withval
-EOF
+_ACEOF
 
 else
-  cat >> confdefs.h <<\EOF
+  cat >>confdefs.h <<\_ACEOF
 #define NICKNAMEHISTORYLENGTH 2000
-EOF
+_ACEOF
 
-fi
+fi;
 
 # Check whether --with-sendq or --without-sendq was given.
 if test "${with_sendq+set}" = set; then
   withval="$with_sendq"
-  cat >> confdefs.h <<EOF
+  cat >>confdefs.h <<_ACEOF
 #define MAXSENDQLENGTH $withval
-EOF
+_ACEOF
 
 else
-  cat >> confdefs.h <<\EOF
+  cat >>confdefs.h <<\_ACEOF
 #define MAXSENDQLENGTH 3000000
-EOF
+_ACEOF
 
-fi
+fi;
 
 # Check whether --with-bufferpool or --without-bufferpool was given.
 if test "${with_bufferpool+set}" = set; then
   withval="$with_bufferpool"
-  cat >> confdefs.h <<EOF
+  cat >>confdefs.h <<_ACEOF
 #define BUFFERPOOL ($withval * MAXSENDQLENGTH)
-EOF
+_ACEOF
 
 else
-  cat >> confdefs.h <<\EOF
+  cat >>confdefs.h <<\_ACEOF
 #define BUFFERPOOL (9 * MAXSENDQLENGTH)
-EOF
+_ACEOF
 
-fi
+fi;
 
 
 # Check whether --with-hostname or --without-hostname was given.
 if test "${with_hostname+set}" = set; then
   withval="$with_hostname"
-  cat >> confdefs.h <<EOF
+  cat >>confdefs.h <<_ACEOF
 #define DOMAINNAME "$withval"
-EOF
+_ACEOF
 
 else
-  cat >> confdefs.h <<EOF
+  cat >>confdefs.h <<_ACEOF
 #define DOMAINNAME "`hostname`"
-EOF
-
-fi
+_ACEOF
 
-cat >> confdefs.h <<EOF
+fi;
+cat >>confdefs.h <<_ACEOF
 #define MYOSNAME "`uname -a`"
-EOF
+_ACEOF
+
 
 # Check whether --with-permissions or --without-permissions was given.
 if test "${with_permissions+set}" = set; then
   withval="$with_permissions"
-  cat >> confdefs.h <<EOF
+  cat >>confdefs.h <<_ACEOF
 #define DEFAULT_PERMISSIONS $withval
-EOF
+_ACEOF
 
 else
-  cat >> confdefs.h <<\EOF
+  cat >>confdefs.h <<\_ACEOF
 #define DEFAULT_PERMISSIONS 0600
-EOF
+_ACEOF
+
+fi;
 
-fi
 # Check whether --with-dpath or --without-dpath was given.
 if test "${with_dpath+set}" = set; then
   withval="$with_dpath"
-  cat >> confdefs.h <<EOF
+  cat >>confdefs.h <<_ACEOF
 #define DPATH "$withval"
-EOF
+_ACEOF
  IRCDDIR="$withval"
 else
-  cat >> confdefs.h <<EOF
+  cat >>confdefs.h <<_ACEOF
 #define DPATH "`pwd`"
-EOF
+_ACEOF
  IRCDDIR="`pwd`"
-fi
+fi;
 
 # Check whether --with-fd-setsize or --without-fd-setsize was given.
 if test "${with_fd_setsize+set}" = set; then
@@ -4691,228 +9214,310 @@ if test "${with_fd_setsize+set}" = set; then
   ac_fd=$withval
 else
   ac_fd=1024
-fi
-
-cat >> confdefs.h <<EOF
+fi;
+cat >>confdefs.h <<_ACEOF
 #define MAXCONNECTIONS $ac_fd
-EOF
+_ACEOF
+
 
 # Check whether --with-spath or --without-spath was given.
 if test "${with_spath+set}" = set; then
   withval="$with_spath"
-  cat >> confdefs.h <<EOF
+  cat >>confdefs.h <<_ACEOF
 #define SPATH "$withval"
-EOF
+_ACEOF
  BINDIR="$withval"
 else
-  cat >> confdefs.h <<EOF
+  cat >>confdefs.h <<_ACEOF
 #define SPATH "`pwd`/src/ircd"
-EOF
+_ACEOF
  BINDIR="`pwd`/src/ircd"
-fi
-
+fi;
 # Check whether --enable-nospoof or --disable-nospoof was given.
 if test "${enable_nospoof+set}" = set; then
   enableval="$enable_nospoof"
-  cat >> confdefs.h <<\EOF
+  cat >>confdefs.h <<\_ACEOF
 #define NOSPOOF 1
-EOF
-
-fi
+_ACEOF
 
+fi;
 # Check whether --enable-hub or --disable-hub was given.
 if test "${enable_hub+set}" = set; then
   enableval="$enable_hub"
-  cat >> confdefs.h <<\EOF
+  cat >>confdefs.h <<\_ACEOF
 #define HUB 1
-EOF
-
-fi
+_ACEOF
 
+fi;
 # Check whether --enable-ssl or --disable-ssl was given.
 if test "${enable_ssl+set}" = set; then
   enableval="$enable_ssl"
-  
+
 if test "$openssl" = "yes"; then
-cat >> confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
 #define USE_SSL 1
-EOF
+_ACEOF
 
-echo $ac_n "checking what order we should supply the SSL libraries in""... $ac_c" 1>&6
-echo "configure:4743: checking what order we should supply the SSL libraries in" >&5
-if eval "test \"`echo '$''{'ac_cv_ssl_libs'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking what order we should supply the SSL libraries in" >&5
+echo $ECHO_N "checking what order we should supply the SSL libraries in... $ECHO_C" >&6
+if test "${ac_cv_ssl_libs+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  
+
 save_libs="$LIBS"
 LIBS="$LIBS -lssl -lcrypto -lssl"
-cat > conftest.$ac_ext <<EOF
-#line 4751 "configure"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <openssl/ssl.h>
-int main() {
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 
 SSL_write(NULL, NULL, NULL);
 
-; return 0; }
-EOF
-if { (eval echo configure:4760: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_ssl_libs="-lssl -lcrypto -lssl" LIBS="$save_libs"
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  ac_cv_ssl_libs="-lssl -lcrypto -lssl" LIBS="$save_libs"
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_ssl_libs="-lssl -lcrypto -lssl" LIBS="$save_libs"
 fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-
-echo "$ac_t""$ac_cv_ssl_libs" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_ssl_libs" >&5
+echo "${ECHO_T}$ac_cv_ssl_libs" >&6
 CRYPTOLIB="$ac_cv_ssl_libs"
 CFLAGS="$CFLAGS -I/usr/local/include -I/usr/local/ssl/include -L/usr/local/lib -L/usr/local/ssl/lib"
 else
-echo "configure: warning: SSL support could not be enabled because openssl/ssl.h could not be found" 1>&2
-fi
-
+{ echo "$as_me:$LINENO: WARNING: SSL support could not be enabled because openssl/ssl.h could not be found" >&5
+echo "$as_me: WARNING: SSL support could not be enabled because openssl/ssl.h could not be found" >&2;}
 fi
 
+fi;
 # Check whether --enable-dynamic-linking or --disable-dynamic-linking was given.
 if test "${enable_dynamic_linking+set}" = set; then
   enableval="$enable_dynamic_linking"
-  
-echo $ac_n "checking for dlopen""... $ac_c" 1>&6
-echo "configure:4786: checking for dlopen" >&5
-if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+
+echo "$as_me:$LINENO: checking for dlopen" >&5
+echo $ECHO_N "checking for dlopen... $ECHO_C" >&6
+if test "${ac_cv_func_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 4791 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char dlopen(); below.  */
+/* System header to define __stub macros and hopefully few prototypes
+else
+  which can conflict with char dlopen (); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char dlopen();
-
-int main() {
-
+   builtin and then its argument prototype would still apply.  */
+char dlopen ();
+char (*f) ();
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_dlopen) || defined (__stub___dlopen)
 choke me
 #else
-dlopen();
+f = dlopen;
 #endif
 
-; return 0; }
-EOF
-if { (eval echo configure:4814: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_dlopen=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_dlopen=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_func_dlopen=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
+echo "${ECHO_T}$ac_cv_func_dlopen" >&6
+if test $ac_cv_func_dlopen = yes; then
   :
 else
-  echo "$ac_t""no" 1>&6
-echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:4832: checking for dlopen in -ldl" >&5
-ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+  echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_save_LIBS="$LIBS"
+  ac_check_lib_save_LIBS=$LIBS
 LIBS="-ldl  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 4840 "configure"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
+
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char dlopen();
-
-int main() {
-dlopen()
-; return 0; }
-EOF
-if { (eval echo configure:4851: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
+   builtin and then its argument prototype would still apply.  */
+char dlopen ();
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+dlopen ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_dl_dlopen=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_dl_dlopen=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6
+if test $ac_cv_lib_dl_dlopen = yes; then
   IRCDLIBS="$IRCDLIBS-ldl"
 else
-  echo "$ac_t""no" 1>&6
-echo "configure: warning: Dynamic linking is not enabled because dlopen was not found" 1>&2 cat >> confdefs.h <<\EOF
+
+{ echo "$as_me:$LINENO: WARNING: Dynamic linking is not enabled because dlopen was not found" >&5
+echo "$as_me: WARNING: Dynamic linking is not enabled because dlopen was not found" >&2;}
+cat >>confdefs.h <<\_ACEOF
 #define STATIC_LINKING 1
-EOF
+_ACEOF
+
 
 fi
 
 fi
 
+
 hold_cflags=$CFLAGS
 CFLAGS="$CFLAGS -export-dynamic"
-echo $ac_n "checking if we need the -export-dynamic flag""... $ac_c" 1>&6
-echo "configure:4880: checking if we need the -export-dynamic flag" >&5
-if eval "test \"`echo '$''{'ac_cv_export_dynamic'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking if we need the -export-dynamic flag" >&5
+echo $ECHO_N "checking if we need the -export-dynamic flag... $ECHO_C" >&6
+if test "${ac_cv_export_dynamic+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  
-cat > conftest.$ac_ext <<EOF
-#line 4886 "configure"
+
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 
-int main() {
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 int i;
-; return 0; }
-EOF
-if { (eval echo configure:4893: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_export_dynamic=yes
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  ac_cv_export_dynamic=no
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_export_dynamic=no
 fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
-
-echo "$ac_t""$ac_cv_export_dynamic" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_export_dynamic" >&5
+echo "${ECHO_T}$ac_cv_export_dynamic" >&6
 if test "$ac_cv_export_dynamic" = "no"; then
 CFLAGS=$hold_cflags
 fi
 
-echo $ac_n "checking for compiler option to produce PIC""... $ac_c" 1>&6
-echo "configure:4911: checking for compiler option to produce PIC" >&5
-if eval "test \"`echo '$''{'ac_cv_pic'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for compiler option to produce PIC" >&5
+echo $ECHO_N "checking for compiler option to produce PIC... $ECHO_C" >&6
+if test "${ac_cv_pic+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  
-if test "$ac_cv_prog_gcc" = "yes"; then
+
+if test "$ac_cv_c_compiler_gnu" = "yes"; then
        ac_cv_pic="-fPIC -DPIC -shared"
 else
 case `uname -s` in
@@ -4923,14 +9528,14 @@ esac
 fi
 
 fi
-
-echo "$ac_t""$ac_cv_pic" 1>&6
-echo $ac_n "checking if your system prepends an underscore on symbols""... $ac_c" 1>&6
-echo "configure:4930: checking if your system prepends an underscore on symbols" >&5
-if eval "test \"`echo '$''{'ac_cv_underscore'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_pic" >&5
+echo "${ECHO_T}$ac_cv_pic" >&6
+echo "$as_me:$LINENO: checking if your system prepends an underscore on symbols" >&5
+echo $ECHO_N "checking if your system prepends an underscore on symbols... $ECHO_C" >&6
+if test "${ac_cv_underscore+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  
+
 cat >uscore.c << __EOF__
 int main() {
        return 0;
@@ -4942,45 +9547,42 @@ ac_cv_underscore=no
 else
 ac_cv_underscore=yes
 fi
+rm -f uscore uscore.c
 
 fi
-
-echo "$ac_t""$ac_cv_underscore" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_underscore" >&5
+echo "${ECHO_T}$ac_cv_underscore" >&6
 if test "$ac_cv_underscore" = "yes"; then
-cat >> confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
 #define UNDERSCORE 1
-EOF
+_ACEOF
 
 fi
 
 MODULEFLAGS=$ac_cv_pic
-cat >> confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
 #define DYNAMIC_LINKING 1
-EOF
-
+_ACEOF
 
-else
-  cat >> confdefs.h <<\EOF
-#define STATIC_LINKING 1
-EOF
-
-fi
 
+fi;
 # Check whether --enable-inet6 or --disable-inet6 was given.
 if test "${enable_inet6+set}" = set; then
   enableval="$enable_inet6"
-  
-echo $ac_n "checking if your system has IPv6 support""... $ac_c" 1>&6
-echo "configure:4975: checking if your system has IPv6 support" >&5
-if eval "test \"`echo '$''{'ac_cv_ip6'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+
+echo "$as_me:$LINENO: checking if your system has IPv6 support" >&5
+echo $ECHO_N "checking if your system has IPv6 support... $ECHO_C" >&6
+if test "${ac_cv_ip6+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  
+
 if test "$cross_compiling" = yes; then
-    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5
+echo "$as_me: error: cannot run test program while cross compiling" >&2;}
+   { (exit 1); exit 1; }; }
 else
-  cat > conftest.$ac_ext <<EOF
-#line 4984 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -4991,40 +9593,48 @@ exit(1);
 exit(0);
 }
 
-EOF
-if { (eval echo configure:4996: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_ip6=yes
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -fr conftest*
-  ac_cv_ip6=no
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+( exit $ac_status )
+ac_cv_ip6=no
 fi
-rm -fr conftest*
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 
-
 fi
-
-echo "$ac_t""$ac_cv_ip6" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_ip6" >&5
+echo "${ECHO_T}$ac_cv_ip6" >&6
 if test "$ac_cv_ip6" = "no"; then
-echo "configure: warning: Your system does not support IPv6 so it will not be enabled" 1>&2
+{ echo "$as_me:$LINENO: WARNING: Your system does not support IPv6 so it will not be enabled" >&5
+echo "$as_me: WARNING: Your system does not support IPv6 so it will not be enabled" >&2;}
 else
-cat >> confdefs.h <<\EOF
+cat >>confdefs.h <<\_ACEOF
 #define INET6 1
-EOF
-
-fi
+_ACEOF
 
 fi
 
+fi;
 # Check whether --enable-standardthreads or --disable-standardthreads was given.
 if test "${enable_standardthreads+set}" = set; then
   enableval="$enable_standardthreads"
   USESTDTHREAD="1"
-fi
-
+fi;
 
 
 ac_aux_dir=
@@ -5037,82 +9647,189 @@ for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
     ac_aux_dir=$ac_dir
     ac_install_sh="$ac_aux_dir/install.sh -c"
     break
+  elif test -f $ac_dir/shtool; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
   fi
 done
 if test -z "$ac_aux_dir"; then
-  { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
+  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
+echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
+   { (exit 1); exit 1; }; }
 fi
-ac_config_guess=$ac_aux_dir/config.guess
-ac_config_sub=$ac_aux_dir/config.sub
-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
-
-
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
+ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
 
 # Make sure we can run config.sub.
-if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
-else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking host system type""... $ac_c" 1>&6
-echo "configure:5058: checking host system type" >&5
-
-host_alias=$host
-case "$host_alias" in
-NONE)
-  case $nonopt in
-  NONE)
-    if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
-    else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
-    fi ;;
-  *) host_alias=$nonopt ;;
-  esac ;;
-esac
+$ac_config_sub sun4 >/dev/null 2>&1 ||
+  { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5
+echo "$as_me: error: cannot run $ac_config_sub" >&2;}
+   { (exit 1); exit 1; }; }
+
+echo "$as_me:$LINENO: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6
+if test "${ac_cv_build+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_build_alias=$build_alias
+test -z "$ac_cv_build_alias" &&
+  ac_cv_build_alias=`$ac_config_guess`
+test -z "$ac_cv_build_alias" &&
+  { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+   { (exit 1); exit 1; }; }
+ac_cv_build=`$ac_config_sub $ac_cv_build_alias` ||
+  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6
+build=$ac_cv_build
+build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
+
+
+
+echo "$as_me:$LINENO: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6
+if test "${ac_cv_host+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_host_alias=$host_alias
+test -z "$ac_cv_host_alias" &&
+  ac_cv_host_alias=$ac_cv_build_alias
+ac_cv_host=`$ac_config_sub $ac_cv_host_alias` ||
+  { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5
+echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;}
+   { (exit 1); exit 1; }; }
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6
+host=$ac_cv_host
+host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
+host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
+host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
 
-host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
-host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-echo "$ac_t""$host" 1>&6
 
 acx_pthread_ok=no
 
 # First, check if the POSIX threads header, pthread.h, is available.
 # If it isn't, don't bother looking for the threads libraries.
-ac_safe=`echo "pthread.h" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for pthread.h""... $ac_c" 1>&6
-echo "configure:5084: checking for pthread.h" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 5089 "configure"
+if test "${ac_cv_header_pthread_h+set}" = set; then
+  echo "$as_me:$LINENO: checking for pthread.h" >&5
+echo $ECHO_N "checking for pthread.h... $ECHO_C" >&6
+if test "${ac_cv_header_pthread_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_pthread_h" >&5
+echo "${ECHO_T}$ac_cv_header_pthread_h" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking pthread.h usability" >&5
+echo $ECHO_N "checking pthread.h usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+#include <pthread.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking pthread.h presence" >&5
+echo $ECHO_N "checking pthread.h presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <pthread.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5094: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  egrep -v '^ *\+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
   cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+  yes:no )
+    { echo "$as_me:$LINENO: WARNING: pthread.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: pthread.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: pthread.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: pthread.h: proceeding with the preprocessor's result" >&2;};;
+  no:yes )
+    { echo "$as_me:$LINENO: WARNING: pthread.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: pthread.h: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: pthread.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: pthread.h: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: pthread.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: pthread.h: proceeding with the preprocessor's result" >&2;};;
+esac
+echo "$as_me:$LINENO: checking for pthread.h" >&5
+echo $ECHO_N "checking for pthread.h... $ECHO_C" >&6
+if test "${ac_cv_header_pthread_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_header_pthread_h=$ac_header_preproc
 fi
-rm -f conftest*
+echo "$as_me:$LINENO: result: $ac_cv_header_pthread_h" >&5
+echo "${ECHO_T}$ac_cv_header_pthread_h" >&6
+
 fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
+if test $ac_cv_header_pthread_h = yes; then
   :
 else
-  echo "$ac_t""no" 1>&6
-acx_pthread_ok=noheader
+  acx_pthread_ok=noheader
 fi
 
 
+
 # We must check for the threads library under a number of different
 # names; the ordering is very important because some systems
 # (e.g. DEC) have both -lpthread and -lpthreads, where one of the
@@ -5158,12 +9875,12 @@ case "${host_cpu}-${host_os}" in
 esac
 result=none
 if test "$acx_pthread_ok" = "no"; then
-echo $ac_n "checking what flags pthreads needs""... $ac_c" 1>&6
-echo "configure:5163: checking what flags pthreads needs" >&5
-if eval "test \"`echo '$''{'ac_cv_pthreadflag'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking what flags pthreads needs" >&5
+echo $ECHO_N "checking what flags pthreads needs... $ECHO_C" >&6
+if test "${ac_cv_pthreadflag+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  
+
 for flag in $acx_pthread_flags; do
 
         case $flag in
@@ -5196,24 +9913,44 @@ for flag in $acx_pthread_flags; do
         # pthread_cleanup_push because it is one of the few pthread
         # functions on Solaris that doesn't have a non-functional libc stub.
         # We try pthread_create on general principles.
-        cat > conftest.$ac_ext <<EOF
-#line 5201 "configure"
+        cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <pthread.h>
-int main() {
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 pthread_t th; pthread_join(th, 0);
                      pthread_attr_init(0); pthread_cleanup_push(0, 0);
-                     pthread_create(0,0,0,0); pthread_cleanup_pop(0); 
-; return 0; }
-EOF
-if { (eval echo configure:5210: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
+                     pthread_create(0,0,0,0); pthread_cleanup_pop(0);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   acx_pthread_ok=yes
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
 fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 
         LIBS="$save_LIBS"
         CFLAGS="$save_CFLAGS"
@@ -5229,8 +9966,8 @@ done
 fi
 
 fi
-
-echo "$ac_t""$ac_cv_pthreadflag" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_pthreadflag" >&5
+echo "${ECHO_T}$ac_cv_pthreadflag" >&6
 
 case $ac_cv_pthreadflag in
        none)
@@ -5251,79 +9988,119 @@ esac
 
         # Detect AIX lossage: threads are created detached by default
         # and the JOINABLE attribute has a nonstandard name (UNDETACHED).
-        echo $ac_n "checking for joinable pthread attribute""... $ac_c" 1>&6
-echo "configure:5256: checking for joinable pthread attribute" >&5
-if eval "test \"`echo '$''{'ac_cv_pthreadjoin'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+        echo "$as_me:$LINENO: checking for joinable pthread attribute" >&5
+echo $ECHO_N "checking for joinable pthread attribute... $ECHO_C" >&6
+if test "${ac_cv_pthreadjoin+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  
-        cat > conftest.$ac_ext <<EOF
-#line 5262 "configure"
+
+        cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <pthread.h>
-int main() {
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 int attr=PTHREAD_CREATE_JOINABLE;
-; return 0; }
-EOF
-if { (eval echo configure:5269: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_pthreadjoin=PTHREAD_CREATE_JOINABLE
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  ac_cv_pthreadjoin=unknown
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_pthreadjoin=unknown
 fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
         if test "$ac_cv_pthreadjoin" = "unknown"; then
-                cat > conftest.$ac_ext <<EOF
-#line 5281 "configure"
+                cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <pthread.h>
-int main() {
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
 int attr=PTHREAD_CREATE_UNDETACHED;
-; return 0; }
-EOF
-if { (eval echo configure:5288: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_pthreadjoin=PTHREAD_CREATE_UNDETACHED
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  ac_cv_pthreadjoin=unknown
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_pthreadjoin=unknown
 fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
         fi
-       
-fi
 
-echo "$ac_t""$ac_cv_pthreadjoin" 1>&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_pthreadjoin" >&5
+echo "${ECHO_T}$ac_cv_pthreadjoin" >&6
         if test "$ac_cv_pthreadjoin" != "PTHREAD_CREATE_JOINABLE"; then
-                cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
 #define PTHREAD_CREATE_JOINABLE $ac_cv_pthreadjoin
-EOF
+_ACEOF
 
         fi
         if test "$ac_cv_pthreadjoin" = "unknown"; then
-                echo "configure: warning: we do not know how to create joinable pthreads" 1>&2
+                { echo "$as_me:$LINENO: WARNING: we do not know how to create joinable pthreads" >&5
+echo "$as_me: WARNING: we do not know how to create joinable pthreads" >&2;}
         fi
 
-        echo $ac_n "checking if more special flags are required for pthreads""... $ac_c" 1>&6
-echo "configure:5314: checking if more special flags are required for pthreads" >&5
-if eval "test \"`echo '$''{'ac_cv_pthreadspecial'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+        echo "$as_me:$LINENO: checking if more special flags are required for pthreads" >&5
+echo $ECHO_N "checking if more special flags are required for pthreads... $ECHO_C" >&6
+if test "${ac_cv_pthreadspecial+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  
+
         ac_cv_pthreadspecial=no
         case "${host_cpu}-${host_os}" in
                 *-aix* | *-freebsd*)     ac_cv_pthreadspecial="-D_THREAD_SAFE";;
                 *solaris* | alpha*-osf*) ac_cv_pthreadspecial="-D_REENTRANT";;
         esac
-       
-fi
 
-echo "$ac_t""$ac_cv_pthreadspecial" 1>&6
+fi
+echo "$as_me:$LINENO: result: $ac_cv_pthreadspecial" >&5
+echo "${ECHO_T}$ac_cv_pthreadspecial" >&6
         if test "$ac_cv_pthreadspecial" != "no"; then
                 PTHREAD_CFLAGS="$ac_cv_pthreadspecial $PTHREAD_CFLAGS"
         fi
@@ -5334,53 +10111,61 @@ echo "$ac_t""$ac_cv_pthreadspecial" 1>&6
         # More AIX lossage: must compile with cc_r
         # Extract the first word of "cc_r", so it can be a program name with args.
 set dummy cc_r; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:5339: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_PTHREAD_CC'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_PTHREAD_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   if test -n "$PTHREAD_CC"; then
   ac_cv_prog_PTHREAD_CC="$PTHREAD_CC" # Let the user override the test.
 else
-  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_PTHREAD_CC="cc_r"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_PTHREAD_CC="cc_r"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
   test -z "$ac_cv_prog_PTHREAD_CC" && ac_cv_prog_PTHREAD_CC="${CC}"
 fi
 fi
-PTHREAD_CC="$ac_cv_prog_PTHREAD_CC"
+PTHREAD_CC=$ac_cv_prog_PTHREAD_CC
 if test -n "$PTHREAD_CC"; then
-  echo "$ac_t""$PTHREAD_CC" 1>&6
+  echo "$as_me:$LINENO: result: $PTHREAD_CC" >&5
+echo "${ECHO_T}$PTHREAD_CC" >&6
 else
-  echo "$ac_t""no" 1>&6
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
 else
         PTHREAD_CC="$CC"
 fi
 if test "x$ac_cv_pthreadflag"!=x; then
-echo $ac_n "checking if pthreads uses one thread per process""... $ac_c" 1>&6
-echo "configure:5371: checking if pthreads uses one thread per process" >&5
-if eval "test \"`echo '$''{'ac_cv_thread_multi'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking if pthreads uses one thread per process" >&5
+echo $ECHO_N "checking if pthreads uses one thread per process... $ECHO_C" >&6
+if test "${ac_cv_thread_multi+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  
+
 save_LIBS="$LIBS"
 LIBS="$PTHREAD_LIBS $LIBS"
 save_CFLAGS="$CFLAGS"
 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
 if test "$cross_compiling" = yes; then
-    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5
+echo "$as_me: error: cannot run test program while cross compiling" >&2;}
+   { (exit 1); exit 1; }; }
 else
-  cat > conftest.$ac_ext <<EOF
-#line 5384 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 
 #include <pthread.h>
@@ -5413,30 +10198,40 @@ int main() {
                exit(1);
 }
 
-EOF
-if { (eval echo configure:5418: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_thread_multi=no
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -fr conftest*
-  ac_cv_thread_multi=yes
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+( exit $ac_status )
+ac_cv_thread_multi=yes
 fi
-rm -fr conftest*
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
-
 LIBS="$save_LIBS"
 CFLAGS="$save_CFLAGS"
 
 fi
-
-echo "$ac_t""$ac_cv_thread_multi" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_thread_multi" >&5
+echo "${ECHO_T}$ac_cv_thread_multi" >&6
 if test "$USESTDTHREAD" != "1"; then
 if test "$ac_cv_thread_multi" = "yes"; then
-echo "$ac_t""Ok we'll install FSU Pthreads" 1>&6
+echo "$as_me:$LINENO: result: Ok we'll install FSU Pthreads" >&5
+echo "${ECHO_T}Ok we'll install FSU Pthreads" >&6
 cd extras
-if [ -f "pthreads.tar.gz" ] ; then 
+if [ -f "pthreads.tar.gz" ] ; then
        gunzip -fd pthreads.tar.gz
 fi
 tar xf pthreads.tar
@@ -5465,7 +10260,7 @@ PTHREAD_CFLAGS="-I=../extras/threads/include $ac_cv_pthreadspecial"
 else
 PTHREAD_CFLAGS="-I=../extras/threads/include"
 fi
-PTHREAD_LIBS="../extras/threads/lib/libgthreads.a ../extras/threads/lib/libmalloc.a"
+PTHREAD_LIBS="../extras/threads/lib/libgthreads.a ../extras/malloc.c"
 fi
 fi
 fi
 
 # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
 if test x"$acx_pthread_ok" = xyes; then
-        cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
 #define HAVE_PTHREAD 1
-EOF
+_ACEOF
 
         :
 else
         acx_pthread_ok=no
-        
+
 fi
 
 
 CC="$PTHREAD_CC"
 CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
 IRCDLIBS="$IRCDLIBS $PTHREAD_LIBS"
-echo $ac_n "checking if FD_SETSIZE is large enough to allow $ac_fd file descriptors""... $ac_c" 1>&6
-echo "configure:5494: checking if FD_SETSIZE is large enough to allow $ac_fd file descriptors" >&5
+
+echo "$as_me:$LINENO: checking for gethostbyname_r" >&5
+echo $ECHO_N "checking for gethostbyname_r... $ECHO_C" >&6
+if test "${ac_cv_func_gethostbyname_r+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char gethostbyname_r (); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char gethostbyname_r ();
+char (*f) ();
+
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_gethostbyname_r) || defined (__stub___gethostbyname_r)
+choke me
+#else
+f = gethostbyname_r;
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_gethostbyname_r=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_func_gethostbyname_r=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname_r" >&5
+echo "${ECHO_T}$ac_cv_func_gethostbyname_r" >&6
+
+if test "$ac_cv_func_gethostbyname_r" = "yes"; then
+echo "$as_me:$LINENO: checking how many parameters gethostbyname_r takes" >&5
+echo $ECHO_N "checking how many parameters gethostbyname_r takes... $ECHO_C" >&6
+if test "${ac_cv_func_which_gethostname_r+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <netdb.h>
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+
+        char *name;
+        struct hostent *he;
+        struct hostent_data data;
+        (void) gethostbyname_r(name, he, &data);
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_which_gethostname_r=three
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <netdb.h>
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+
+        char *name;
+        struct hostent *he, *res;
+        char buffer[2048];
+        int buflen = 2048;
+        int h_errnop;
+        (void) gethostbyname_r(name, he, buffer, buflen, &res, &h_errnop)
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_which_gethostname_r=six
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <netdb.h>
+#ifdef F77_DUMMY_MAIN
+#  ifdef __cplusplus
+     extern "C"
+#  endif
+   int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+
+                        char *name;
+                        struct hostent *he;
+                        char buffer[2048];
+                        int buflen = 2048;
+                        int h_errnop;
+                        (void) gethostbyname_r(name, he, buffer, buflen, &h_errnop)
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_which_gethostname_r=five
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_func_which_gethostname_r=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+
+
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+
+
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_which_gethostname_r" >&5
+echo "${ECHO_T}$ac_cv_func_which_gethostname_r" >&6
+
+if test "$ac_cv_func_which_gethostname_r" = "six"; then
+  cat >>confdefs.h <<\_ACEOF
+#define HAVE_GETHOSTBYNAME_R_6 1
+_ACEOF
+
+elif test "$ac_cv_func_which_gethostname_r" = "five"; then
+  cat >>confdefs.h <<\_ACEOF
+#define HAVE_GETHOSTBYNAME_R_5 1
+_ACEOF
+
+elif test "$ac_cv_func_which_gethostname_r" = "three"; then
+  cat >>confdefs.h <<\_ACEOF
+#define HAVE_GETHOSTBYNAME_R_3 1
+_ACEOF
+
+fi
+fi
+
+echo "$as_me:$LINENO: checking if FD_SETSIZE is large enough to allow $ac_fd file descriptors" >&5
+echo $ECHO_N "checking if FD_SETSIZE is large enough to allow $ac_fd file descriptors... $ECHO_C" >&6
 if test "$cross_compiling" = yes; then
-    { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
+  { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5
+echo "$as_me: error: cannot run test program while cross compiling" >&2;}
+   { (exit 1); exit 1; }; }
 else
-  cat > conftest.$ac_ext <<EOF
-#line 5499 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -5506,20 +10533,31 @@ exit(0);
 exit(1);
 }
 
-EOF
-if { (eval echo configure:5511: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
-  echo "$ac_t""yes" 1>&6
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -fr conftest*
-  FD_SETSIZE="-DFD_SETSIZE=$ac_fd" echo "$ac_t""no" 1>&6
-fi
-rm -fr conftest*
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+( exit $ac_status )
+FD_SETSIZE="-DFD_SETSIZE=$ac_fd" echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
 
-
 case "${host_cpu}-${host_os}" in
 SunOS*5.*)
 CFLAGS="$CFLAGS -DSOL20"
@@ -5541,374 +10579,1032 @@ CFLAGS="$CFLAGS -D_AMIGA -m68040"
 CFLAGS="$CFLAGS -D_AMIGA -m68060"
 ;;
 esac
-trap '' 1 2 15
-cat > confcache <<\EOF
+ac_config_files="$ac_config_files Makefile src/modules/Makefile unreal"
+cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
 # tests run on this system so they can be shared between configure
-# scripts and configure runs.  It is not useful on other systems.
-# If it contains results you don't want to keep, you may remove or edit it.
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems.  If it contains results you don't
+# want to keep, you may remove or edit it.
 #
-# By default, configure uses ./config.cache as the cache file,
-# creating it if it does not exist already.  You can give configure
-# the --cache-file=FILE option to use a different cache file; that is
-# what configure does when it calls configure scripts in
-# subdirectories, so they share the cache.
-# Giving --cache-file=/dev/null disables caching, for debugging configure.
-# config.status only pays attention to the cache file if you give it the
-# --recheck option to rerun configure.
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
 #
-EOF
+# `ac_cv_env_foo' variables (set or unset) will be overriden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
 # The following way of writing the cache mishandles newlines in values,
 # but we know of no workaround that is simple, portable, and efficient.
 # So, don't put newlines in cache variables' values.
 # Ultrix sh set writes to stderr and can't be redirected directly,
 # and sets the high bit in the cache file unless we assign to the vars.
-(set) 2>&1 |
-  case `(ac_space=' '; set | grep ac_space) 2>&1` in
-  *ac_space=\ *)
-    # `set' does not quote correctly, so add quotes (double-quote substitution
-    # turns \\\\ into \\, and sed turns \\ into \).
-    sed -n \
-      -e "s/'/'\\\\''/g" \
-      -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
-    ;;
-  *)
-    # `set' quotes correctly as required by POSIX, so do not add quotes.
-    sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
-    ;;
-  esac >> confcache
-if cmp -s $cache_file confcache; then
-  :
-else
+{
+  (set) 2>&1 |
+    case `(ac_space=' '; set | grep ac_space) 2>&1` in
+    *ac_space=\ *)
+      # `set' does not quote correctly, so add quotes (double-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \).
+      sed -n \
+        "s/'/'\\\\''/g;
+         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+      ;;
+    *)
+      # `set' quotes correctly as required by POSIX, so do not add quotes.
+      sed -n \
+        "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      ;;
+    esac;
+} |
+  sed '
+     t clear
+     : clear
+     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+     t end
+     /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+     : end' >>confcache
+if cmp -s $cache_file confcache; then :; else
   if test -w $cache_file; then
-    echo "updating cache $cache_file"
-    cat confcache > $cache_file
+    test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+    cat confcache >$cache_file
   else
     echo "not updating unwritable cache $cache_file"
   fi
 fi
 rm -f confcache
 
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
 test "x$prefix" = xNONE && prefix=$ac_default_prefix
 # Let make expand exec_prefix.
 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
 
-# Any assignment to VPATH causes Sun make to only execute
-# the first set of double-colon rules, so remove it if not needed.
-# If there is a colon in the path, we need to keep it.
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
 if test "x$srcdir" = x.; then
-  ac_vpsub='/^[        ]*VPATH[        ]*=[^:]*$/d'
+  ac_vpsub='/^[        ]*VPATH[        ]*=/{
+s/:*\$(srcdir):*/:/;
+s/:*\${srcdir}:*/:/;
+s/:*@srcdir@:*/:/;
+s/^\([^=]*=[   ]*\):*/\1/;
+s/:*$//;
+s/^[^=]*=[     ]*$//;
+}'
 fi
 
-trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
-
 DEFS=-DHAVE_CONFIG_H
 
-# Without the "./", some shells look in PATH for config.status.
-: ${CONFIG_STATUS=./config.status}
 
-echo creating $CONFIG_STATUS
-rm -f $CONFIG_STATUS
-cat > $CONFIG_STATUS <<EOF
-#! /bin/sh
-# Generated automatically by configure.
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
 # Run this file to recreate the current configuration.
-# This directory was configured as follows,
-# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-#
-# $0 $ac_configure_args
-#
 # Compiler output produced by configure, useful for debugging
-# configure, is in ./config.log if it exists.
+# configure, is in config.log if it exists.
 
-ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
-for ac_option
+debug=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+
+# NLS nuisances.
+# Support unset when possible.
+if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+(set +x; test -n "`(LANG=C; export LANG) 2>&1`") &&
+    { $as_unset LANG || test "${LANG+set}" != set; } ||
+      { LANG=C; export LANG; }
+(set +x; test -n "`(LC_ALL=C; export LC_ALL) 2>&1`") &&
+    { $as_unset LC_ALL || test "${LC_ALL+set}" != set; } ||
+      { LC_ALL=C; export LC_ALL; }
+(set +x; test -n "`(LC_TIME=C; export LC_TIME) 2>&1`") &&
+    { $as_unset LC_TIME || test "${LC_TIME+set}" != set; } ||
+      { LC_TIME=C; export LC_TIME; }
+(set +x; test -n "`(LC_CTYPE=C; export LC_CTYPE) 2>&1`") &&
+    { $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set; } ||
+      { LC_CTYPE=C; export LC_CTYPE; }
+(set +x; test -n "`(LANGUAGE=C; export LANGUAGE) 2>&1`") &&
+    { $as_unset LANGUAGE || test "${LANGUAGE+set}" != set; } ||
+      { LANGUAGE=C; export LANGUAGE; }
+(set +x; test -n "`(LC_COLLATE=C; export LC_COLLATE) 2>&1`") &&
+    { $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set; } ||
+      { LC_COLLATE=C; export LC_COLLATE; }
+(set +x; test -n "`(LC_NUMERIC=C; export LC_NUMERIC) 2>&1`") &&
+    { $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set; } ||
+      { LC_NUMERIC=C; export LC_NUMERIC; }
+(set +x; test -n "`(LC_MESSAGES=C; export LC_MESSAGES) 2>&1`") &&
+    { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } ||
+      { LC_MESSAGES=C; export LC_MESSAGES; }
+
+
+# Name of the executable.
+as_me=`(basename "$0") 2>/dev/null ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+        X"$0" : 'X\(//\)$' \| \
+        X"$0" : 'X\(/\)$' \| \
+        .     : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+         /^X\/\(\/\/\)$/{ s//\1/; q; }
+         /^X\/\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conftest.sh
+  echo  "exit 0"   >>conftest.sh
+  chmod +x conftest.sh
+  if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conftest.sh
+fi
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
+  # Find who we are.  Look in the path if we contain no path at all
+  # relative or not.
+  case $0 in
+    *[\\/]* ) as_myself=$0 ;;
+    *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
 do
-  case "\$ac_option" in
-  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
-    echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
-    exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
-  -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
-    echo "$CONFIG_STATUS generated by autoconf version 2.13"
-    exit 0 ;;
-  -help | --help | --hel | --he | --h)
-    echo "\$ac_cs_usage"; exit 0 ;;
-  *) echo "\$ac_cs_usage"; exit 1 ;;
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+       ;;
   esac
+  # We did not find ourselves, most probably we were run as `sh COMMAND'
+  # in which case we are not to be found in the path.
+  if test "x$as_myself" = x; then
+    as_myself=$0
+  fi
+  if test ! -f "$as_myself"; then
+    { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+  case $CONFIG_SHELL in
+  '')
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for as_base in sh bash ksh sh5; do
+        case $as_dir in
+        /*)
+          if ("$as_dir/$as_base" -c '
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
+            CONFIG_SHELL=$as_dir/$as_base
+            export CONFIG_SHELL
+            exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+          fi;;
+        esac
+       done
 done
+;;
+  esac
 
-ac_given_srcdir=$srcdir
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line before each line; the second 'sed' does the real
+  # work.  The second script uses 'N' to pair each line-number line
+  # with the numbered line, and appends trailing '-' during
+  # substitution so that $LINENO is not a special case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
+  sed '=' <$as_myself |
+    sed '
+      N
+      s,$,-,
+      : loop
+      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      t loop
+      s,-$,,
+      s,^['$as_cr_digits']*\n,,
+    ' >$as_me.lineno &&
+  chmod +x $as_me.lineno ||
+    { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
+echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensible to this).
+  . ./$as_me.lineno
+  # Exit status is that of the last command.
+  exit
+}
 
-trap 'rm -fr `echo "Makefile src/modules/Makefile unreal include/setup.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
-EOF
-cat >> $CONFIG_STATUS <<EOF
 
-# Protect against being on the right side of a sed subst in config.status.
-sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
- s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
-$ac_vpsub
-$extrasub
-s%@SHELL@%$SHELL%g
-s%@CFLAGS@%$CFLAGS%g
-s%@CPPFLAGS@%$CPPFLAGS%g
-s%@CXXFLAGS@%$CXXFLAGS%g
-s%@FFLAGS@%$FFLAGS%g
-s%@DEFS@%$DEFS%g
-s%@LDFLAGS@%$LDFLAGS%g
-s%@LIBS@%$LIBS%g
-s%@exec_prefix@%$exec_prefix%g
-s%@prefix@%$prefix%g
-s%@program_transform_name@%$program_transform_name%g
-s%@bindir@%$bindir%g
-s%@sbindir@%$sbindir%g
-s%@libexecdir@%$libexecdir%g
-s%@datadir@%$datadir%g
-s%@sysconfdir@%$sysconfdir%g
-s%@sharedstatedir@%$sharedstatedir%g
-s%@localstatedir@%$localstatedir%g
-s%@libdir@%$libdir%g
-s%@includedir@%$includedir%g
-s%@oldincludedir@%$oldincludedir%g
-s%@infodir@%$infodir%g
-s%@mandir@%$mandir%g
-s%@CC@%$CC%g
-s%@RM@%$RM%g
-s%@CP@%$CP%g
-s%@TOUCH@%$TOUCH%g
-s%@OPENSSLPATH@%$OPENSSLPATH%g
-s%@INSTALL@%$INSTALL%g
-s%@IRCDLIBS@%$IRCDLIBS%g
-s%@MKPASSWDLIBS@%$MKPASSWDLIBS%g
-s%@CPP@%$CPP%g
-s%@REGEX@%$REGEX%g
-s%@STRTOUL@%$STRTOUL%g
-s%@CRYPTOLIB@%$CRYPTOLIB%g
-s%@MODULEFLAGS@%$MODULEFLAGS%g
-s%@IRCDDIR@%$IRCDDIR%g
-s%@BINDIR@%$BINDIR%g
-s%@host@%$host%g
-s%@host_alias@%$host_alias%g
-s%@host_cpu@%$host_cpu%g
-s%@host_vendor@%$host_vendor%g
-s%@host_os@%$host_os%g
-s%@PTHREAD_CC@%$PTHREAD_CC%g
-s%@PTHREAD_LIBS@%$PTHREAD_LIBS%g
-s%@PTHREAD_CFLAGS@%$PTHREAD_CFLAGS%g
-s%@FD_SETSIZE@%$FD_SETSIZE%g
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+  *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T='     ' ;;
+  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
 
-CEOF
-EOF
-
-cat >> $CONFIG_STATUS <<\EOF
-
-# Split the substitutions into bite-sized pieces for seds with
-# small command number limits, like on Digital OSF/1 and HP-UX.
-ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
-ac_file=1 # Number of current file.
-ac_beg=1 # First line for current file.
-ac_end=$ac_max_sed_cmds # Line after last line for current file.
-ac_more_lines=:
-ac_sed_cmds=""
-while $ac_more_lines; do
-  if test $ac_beg -gt 1; then
-    sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
-  else
-    sed "${ac_end}q" conftest.subs > conftest.s$ac_file
-  fi
-  if test ! -s conftest.s$ac_file; then
-    ac_more_lines=false
-    rm -f conftest.s$ac_file
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  # We could just check for DJGPP; but this test a) works b) is more generic
+  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+  if test -f conf$$.exe; then
+    # Don't use ln at all; we don't have any links
+    as_ln_s='cp -p'
   else
-    if test -z "$ac_sed_cmds"; then
-      ac_sed_cmds="sed -f conftest.s$ac_file"
-    else
-      ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
-    fi
-    ac_file=`expr $ac_file + 1`
-    ac_beg=$ac_end
-    ac_end=`expr $ac_end + $ac_max_sed_cmds`
+    as_ln_s='ln -s'
   fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS="  $as_nl"
+
+# CDPATH.
+$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; }
+
+exec 6>&1
+
+# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.  Logging --version etc. is OK.
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+} >&5
+cat >&5 <<_CSEOF
+
+This file was extended by $as_me, which was
+generated by GNU Autoconf 2.53.  Invocation command line was
+
+  CONFIG_FILES    = $CONFIG_FILES
+  CONFIG_HEADERS  = $CONFIG_HEADERS
+  CONFIG_LINKS    = $CONFIG_LINKS
+  CONFIG_COMMANDS = $CONFIG_COMMANDS
+  $ $0 $@
+
+_CSEOF
+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
+echo >&5
+_ACEOF
+
+# Files that config.status was made for.
+if test -n "$ac_config_files"; then
+  echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_headers"; then
+  echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+  echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+  echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+  -h, --help       print this help, then exit
+  -V, --version    print version number, then exit
+  -d, --debug      don't remove temporary files
+      --recheck    update $as_me by reconfiguring in the same conditions
+  --file=FILE[:TEMPLATE]
+                   instantiate the configuration file FILE
+  --header=FILE[:TEMPLATE]
+                   instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Report bugs to <bug-autoconf@gnu.org>."
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+config.status
+configured by $0, generated by GNU Autoconf 2.53,
+  with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+srcdir=$srcdir
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value.  By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
+do
+  case $1 in
+  --*=*)
+    ac_option=`expr "x$1" : 'x\([^=]*\)='`
+    ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+    shift
+    set dummy "$ac_option" "$ac_optarg" ${1+"$@"}
+    shift
+    ;;
+  -*);;
+  *) # This is not an option, so the user has probably given explicit
+     # arguments.
+     ac_need_defaults=false;;
+  esac
+
+  case $1 in
+  # Handling of the options.
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    echo "running $SHELL $0 " $ac_configure_args " --no-create --no-recursion"
+    exec $SHELL $0 $ac_configure_args --no-create --no-recursion ;;
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+  --version | --vers* | -V )
+    echo "$ac_cs_version"; exit 0 ;;
+  --he | --h)
+    # Conflict between --help and --header
+    { { echo "$as_me:$LINENO: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2;}
+   { (exit 1); exit 1; }; };;
+  --help | --hel | -h )
+    echo "$ac_cs_usage"; exit 0 ;;
+  --debug | --d* | -d )
+    debug=: ;;
+  --file | --fil | --fi | --f )
+    shift
+    CONFIG_FILES="$CONFIG_FILES $1"
+    ac_need_defaults=false;;
+  --header | --heade | --head | --hea )
+    shift
+    CONFIG_HEADERS="$CONFIG_HEADERS $1"
+    ac_need_defaults=false;;
+
+  # This is an error.
+  -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2;}
+   { (exit 1); exit 1; }; } ;;
+
+  *) ac_config_targets="$ac_config_targets $1" ;;
+
+  esac
+  shift
+done
+
+_ACEOF
+
+
+
+
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_config_target in $ac_config_targets
+do
+  case "$ac_config_target" in
+  # Handling of arguments.
+  "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+  "src/modules/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/modules/Makefile" ;;
+  "unreal" ) CONFIG_FILES="$CONFIG_FILES unreal" ;;
+  "include/setup.h" ) CONFIG_HEADERS="$CONFIG_HEADERS include/setup.h" ;;
+  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+   { (exit 1); exit 1; }; };;
+  esac
 done
-if test -z "$ac_sed_cmds"; then
-  ac_sed_cmds=cat
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used.  Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+  test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
 fi
-EOF
 
-cat >> $CONFIG_STATUS <<EOF
+# Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+  trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+  trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+: ${TMPDIR=/tmp}
+{
+  tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=$TMPDIR/cs$$-$RANDOM
+  (umask 077 && mkdir $tmp)
+} ||
+{
+   echo "$me: cannot create a temporary directory in $TMPDIR" >&2
+   { (exit 1); exit 1; }
+}
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+
+#
+# CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "\$CONFIG_FILES"; then
+  # Protect against being on the right side of a sed subst in config.status.
+  sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
+   s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
+s,@SHELL@,$SHELL,;t t
+s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s,@exec_prefix@,$exec_prefix,;t t
+s,@prefix@,$prefix,;t t
+s,@program_transform_name@,$program_transform_name,;t t
+s,@bindir@,$bindir,;t t
+s,@sbindir@,$sbindir,;t t
+s,@libexecdir@,$libexecdir,;t t
+s,@datadir@,$datadir,;t t
+s,@sysconfdir@,$sysconfdir,;t t
+s,@sharedstatedir@,$sharedstatedir,;t t
+s,@localstatedir@,$localstatedir,;t t
+s,@libdir@,$libdir,;t t
+s,@includedir@,$includedir,;t t
+s,@oldincludedir@,$oldincludedir,;t t
+s,@infodir@,$infodir,;t t
+s,@mandir@,$mandir,;t t
+s,@build_alias@,$build_alias,;t t
+s,@host_alias@,$host_alias,;t t
+s,@target_alias@,$target_alias,;t t
+s,@DEFS@,$DEFS,;t t
+s,@ECHO_C@,$ECHO_C,;t t
+s,@ECHO_N@,$ECHO_N,;t t
+s,@ECHO_T@,$ECHO_T,;t t
+s,@LIBS@,$LIBS,;t t
+s,@CC@,$CC,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@LDFLAGS@,$LDFLAGS,;t t
+s,@CPPFLAGS@,$CPPFLAGS,;t t
+s,@ac_ct_CC@,$ac_ct_CC,;t t
+s,@EXEEXT@,$EXEEXT,;t t
+s,@OBJEXT@,$OBJEXT,;t t
+s,@RM@,$RM,;t t
+s,@CP@,$CP,;t t
+s,@TOUCH@,$TOUCH,;t t
+s,@OPENSSLPATH@,$OPENSSLPATH,;t t
+s,@INSTALL@,$INSTALL,;t t
+s,@IRCDLIBS@,$IRCDLIBS,;t t
+s,@MKPASSWDLIBS@,$MKPASSWDLIBS,;t t
+s,@CPP@,$CPP,;t t
+s,@REGEX@,$REGEX,;t t
+s,@STRTOUL@,$STRTOUL,;t t
+s,@CRYPTOLIB@,$CRYPTOLIB,;t t
+s,@MODULEFLAGS@,$MODULEFLAGS,;t t
+s,@IRCDDIR@,$IRCDDIR,;t t
+s,@BINDIR@,$BINDIR,;t t
+s,@build@,$build,;t t
+s,@build_cpu@,$build_cpu,;t t
+s,@build_vendor@,$build_vendor,;t t
+s,@build_os@,$build_os,;t t
+s,@host@,$host,;t t
+s,@host_cpu@,$host_cpu,;t t
+s,@host_vendor@,$host_vendor,;t t
+s,@host_os@,$host_os,;t t
+s,@PTHREAD_CC@,$PTHREAD_CC,;t t
+s,@PTHREAD_LIBS@,$PTHREAD_LIBS,;t t
+s,@PTHREAD_CFLAGS@,$PTHREAD_CFLAGS,;t t
+s,@FD_SETSIZE@,$FD_SETSIZE,;t t
+CEOF
+
+_ACEOF
+
+  cat >>$CONFIG_STATUS <<\_ACEOF
+  # Split the substitutions into bite-sized pieces for seds with
+  # small command number limits, like on Digital OSF/1 and HP-UX.
+  ac_max_sed_lines=48
+  ac_sed_frag=1 # Number of current file.
+  ac_beg=1 # First line for current file.
+  ac_end=$ac_max_sed_lines # Line after last line for current file.
+  ac_more_lines=:
+  ac_sed_cmds=
+  while $ac_more_lines; do
+    if test $ac_beg -gt 1; then
+      sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+    else
+      sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+    fi
+    if test ! -s $tmp/subs.frag; then
+      ac_more_lines=false
+    else
+      # The purpose of the label and of the branching condition is to
+      # speed up the sed processing (if there are no `@' at all, there
+      # is no need to browse any of the substitutions).
+      # These are the two extra sed commands mentioned above.
+      (echo ':t
+  /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
+      if test -z "$ac_sed_cmds"; then
+       ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+      else
+       ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+      fi
+      ac_sed_frag=`expr $ac_sed_frag + 1`
+      ac_beg=$ac_end
+      ac_end=`expr $ac_end + $ac_max_sed_lines`
+    fi
+  done
+  if test -z "$ac_sed_cmds"; then
+    ac_sed_cmds=cat
+  fi
+fi # test -n "$CONFIG_FILES"
 
-CONFIG_FILES=\${CONFIG_FILES-"Makefile src/modules/Makefile unreal"}
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
   # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
-  case "$ac_file" in
-  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
-       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
-  *) ac_file_in="${ac_file}.in" ;;
+  case $ac_file in
+  - | *:- | *:-:* ) # input from stdin
+        cat >$tmp/stdin
+        ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+        ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+        ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  * )   ac_file_in=$ac_file.in ;;
+  esac
+
+  # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
+  ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+         X"$ac_file" : 'X\(//\)[^/]' \| \
+         X"$ac_file" : 'X\(//\)$' \| \
+         X"$ac_file" : 'X\(/\)' \| \
+         .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+  { case "$ac_dir" in
+  [\\/]* | ?:[\\/]* ) as_incr_dir=;;
+  *)                      as_incr_dir=.;;
+esac
+as_dummy="$ac_dir"
+for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do
+  case $as_mkdir_dir in
+    # Skip DOS drivespec
+    ?:) as_incr_dir=$as_mkdir_dir ;;
+    *)
+      as_incr_dir=$as_incr_dir/$as_mkdir_dir
+      test -d "$as_incr_dir" ||
+        mkdir "$as_incr_dir" ||
+       { { echo "$as_me:$LINENO: error: cannot create \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }
+    ;;
   esac
+done; }
 
-  # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
+  ac_builddir=.
 
-  # Remove last slash and all that follows it.  Not all systems have dirname.
-  ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
-  if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
-    # The file is in a subdirectory.
-    test ! -d "$ac_dir" && mkdir "$ac_dir"
-    ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
-    # A "../" for each directory in $ac_dir_suffix.
-    ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
-  else
-    ac_dir_suffix= ac_dots=
-  fi
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
 
-  case "$ac_given_srcdir" in
-  .)  srcdir=.
-      if test -z "$ac_dots"; then top_srcdir=.
-      else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
-  /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
   *) # Relative path.
-    srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
-    top_srcdir="$ac_dots$ac_given_srcdir" ;;
-  esac
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
+# absolute.
+ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
+ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd`
+ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
+ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
 
 
-  echo creating "$ac_file"
-  rm -f "$ac_file"
-  configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
-  case "$ac_file" in
-  *Makefile*) ac_comsub="1i\\
-# $configure_input" ;;
-  *) ac_comsub= ;;
-  esac
 
-  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
-  sed -e "$ac_comsub
-s%@configure_input@%$configure_input%g
-s%@srcdir@%$srcdir%g
-s%@top_srcdir@%$top_srcdir%g
-" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
-fi; done
-rm -f conftest.s*
+  if test x"$ac_file" != x-; then
+    { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+    rm -f "$ac_file"
+  fi
+  # Let's still pretend it is `configure' which instantiates (i.e., don't
+  # use $as_me), people would be surprised to read:
+  #    /* config.h.  Generated by config.status.  */
+  if test x"$ac_file" = x-; then
+    configure_input=
+  else
+    configure_input="$ac_file.  "
+  fi
+  configure_input=$configure_input"Generated from `echo $ac_file_in |
+                                     sed 's,.*/,,'` by configure."
+
+  # First look for the input files in the build tree, otherwise in the
+  # src tree.
+  ac_file_inputs=`IFS=:
+    for f in $ac_file_in; do
+      case $f in
+      -) echo $tmp/stdin ;;
+      [\\/$]*)
+         # Absolute (can't be DOS-style, as IFS=:)
+         test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+         echo $f;;
+      *) # Relative
+         if test -f "$f"; then
+           # Build tree
+           echo $f
+         elif test -f "$srcdir/$f"; then
+           # Source tree
+           echo $srcdir/$f
+         else
+           # /dev/null tree
+           { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+         fi;;
+      esac
+    done` || { (exit 1); exit 1; }
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+  sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s,@configure_input@,$configure_input,;t t
+s,@srcdir@,$ac_srcdir,;t t
+s,@abs_srcdir@,$ac_abs_srcdir,;t t
+s,@top_srcdir@,$ac_top_srcdir,;t t
+s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
+s,@builddir@,$ac_builddir,;t t
+s,@abs_builddir@,$ac_abs_builddir,;t t
+s,@top_builddir@,$ac_top_builddir,;t t
+s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
+  rm -f $tmp/stdin
+  if test x"$ac_file" != x-; then
+    mv $tmp/out $ac_file
+  else
+    cat $tmp/out
+    rm -f $tmp/out
+  fi
+
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+#
+# CONFIG_HEADER section.
+#
 
 # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
 # NAME is the cpp macro being defined and VALUE is the value it is being given.
 #
 # ac_d sets the value in "#define NAME VALUE" lines.
-ac_dA='s%^\([  ]*\)#\([        ]*define[       ][      ]*\)'
-ac_dB='\([     ][      ]*\)[^  ]*%\1#\2'
-ac_dC='\3'
-ac_dD='%g'
-# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
-ac_uA='s%^\([  ]*\)#\([        ]*\)undef\([    ][      ]*\)'
-ac_uB='\([     ]\)%\1#\2define\3'
+ac_dA='s,^\([  ]*\)#\([        ]*define[       ][      ]*\)'
+ac_dB='[       ].*$,\1#\2'
+ac_dC=' '
+ac_dD=',;t'
+# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_uA='s,^\([  ]*\)#\([        ]*\)undef\([    ][      ]*\)'
+ac_uB='$,\1#\2define\3'
 ac_uC=' '
-ac_uD='\4%g'
-# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
-ac_eA='s%^\([  ]*\)#\([        ]*\)undef\([    ][      ]*\)'
-ac_eB='$%\1#\2define\3'
-ac_eC=' '
-ac_eD='%g'
-
-if test "${CONFIG_HEADERS+set}" != set; then
-EOF
-cat >> $CONFIG_STATUS <<EOF
-  CONFIG_HEADERS="include/setup.h"
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-fi
-for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
+ac_uD=',;t'
+
+for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
   # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
-  case "$ac_file" in
-  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
-       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
-  *) ac_file_in="${ac_file}.in" ;;
+  case $ac_file in
+  - | *:- | *:-:* ) # input from stdin
+        cat >$tmp/stdin
+        ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+        ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+        ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  * )   ac_file_in=$ac_file.in ;;
   esac
 
-  echo creating $ac_file
-
-  rm -f conftest.frag conftest.in conftest.out
-  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
-  cat $ac_file_inputs > conftest.in
-
-EOF
-
-# Transform confdefs.h into a sed script conftest.vals that substitutes
-# the proper values into config.h.in to produce config.h.  And first:
-# Protect against being on the right side of a sed subst in config.status.
-# Protect against being in an unquoted here document in config.status.
-rm -f conftest.vals
-cat > conftest.hdr <<\EOF
-s/[\\&%]/\\&/g
-s%[\\$`]%\\&%g
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
-s%ac_d%ac_u%gp
-s%ac_u%ac_e%gp
-EOF
-sed -n -f conftest.hdr confdefs.h > conftest.vals
-rm -f conftest.hdr
+  test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+
+  # First look for the input files in the build tree, otherwise in the
+  # src tree.
+  ac_file_inputs=`IFS=:
+    for f in $ac_file_in; do
+      case $f in
+      -) echo $tmp/stdin ;;
+      [\\/$]*)
+         # Absolute (can't be DOS-style, as IFS=:)
+         test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+         echo $f;;
+      *) # Relative
+         if test -f "$f"; then
+           # Build tree
+           echo $f
+         elif test -f "$srcdir/$f"; then
+           # Source tree
+           echo $srcdir/$f
+         else
+           # /dev/null tree
+           { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+         fi;;
+      esac
+    done` || { (exit 1); exit 1; }
+  # Remove the trailing spaces.
+  sed 's/[     ]*$//' $ac_file_inputs >$tmp/in
+
+_ACEOF
+
+# Transform confdefs.h into two sed scripts, `conftest.defines' and
+# `conftest.undefs', that substitutes the proper values into
+# config.h.in to produce config.h.  The first handles `#define'
+# templates, and the second `#undef' templates.
+# And first: Protect against being on the right side of a sed subst in
+# config.status.  Protect against being in an unquoted here document
+# in config.status.
+rm -f conftest.defines conftest.undefs
+# Using a here document instead of a string reduces the quoting nightmare.
+# Putting comments in sed scripts is not portable.
+#
+# `end' is used to avoid that the second main sed command (meant for
+# 0-ary CPP macros) applies to n-ary macro definitions.
+# See the Autoconf documentation for `clear'.
+cat >confdef2sed.sed <<\_ACEOF
+s/[\\&,]/\\&/g
+s,[\\$`],\\&,g
+t clear
+: clear
+s,^[   ]*#[    ]*define[       ][      ]*\([^  (][^    (]*\)\(([^)]*)\)[       ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
+t end
+s,^[   ]*#[    ]*define[       ][      ]*\([^  ][^     ]*\)[   ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
+: end
+_ACEOF
+# If some macros were called several times there might be several times
+# the same #defines, which is useless.  Nevertheless, we may not want to
+# sort them, since we want the *last* AC-DEFINE to be honored.
+uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
+sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
+rm -f confdef2sed.sed
 
 # This sed command replaces #undef with comments.  This is necessary, for
 # example, in the case of _POSIX_SOURCE, which is predefined and required
 # on some systems where configure will not decide to define it.
-cat >> conftest.vals <<\EOF
-s%^[   ]*#[    ]*undef[        ][      ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
-EOF
-
-# Break up conftest.vals because some shells have a limit on
-# the size of here documents, and old seds have small limits too.
+cat >>conftest.undefs <<\_ACEOF
+s,^[   ]*#[    ]*undef[        ][      ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
+_ACEOF
+
+# Break up conftest.defines because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo '  # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
+echo '  if egrep "^[   ]*#[    ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
+echo '  # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
+echo '  :' >>$CONFIG_STATUS
+rm -f conftest.tail
+while grep . conftest.defines >/dev/null
+do
+  # Write a limited-size here document to $tmp/defines.sed.
+  echo '  cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
+  # Speed up: don't consider the non `#define' lines.
+  echo '/^[    ]*#[    ]*define/!b' >>$CONFIG_STATUS
+  # Work around the forget-to-reset-the-flag bug.
+  echo 't clr' >>$CONFIG_STATUS
+  echo ': clr' >>$CONFIG_STATUS
+  sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
+  echo 'CEOF
+  sed -f $tmp/defines.sed $tmp/in >$tmp/out
+  rm -f $tmp/in
+  mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+  sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
+  rm -f conftest.defines
+  mv conftest.tail conftest.defines
+done
+rm -f conftest.defines
+echo '  fi # egrep' >>$CONFIG_STATUS
+echo >>$CONFIG_STATUS
 
+# Break up conftest.undefs because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo '  # Handle all the #undef templates' >>$CONFIG_STATUS
 rm -f conftest.tail
-while :
+while grep . conftest.undefs >/dev/null
 do
-  ac_lines=`grep -c . conftest.vals`
-  # grep -c gives empty output for an empty file on some AIX systems.
-  if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
-  # Write a limited-size here document to conftest.frag.
-  echo '  cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
-  sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
+  # Write a limited-size here document to $tmp/undefs.sed.
+  echo '  cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
+  # Speed up: don't consider the non `#undef'
+  echo '/^[    ]*#[    ]*undef/!b' >>$CONFIG_STATUS
+  # Work around the forget-to-reset-the-flag bug.
+  echo 't clr' >>$CONFIG_STATUS
+  echo ': clr' >>$CONFIG_STATUS
+  sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
   echo 'CEOF
-  sed -f conftest.frag conftest.in > conftest.out
-  rm -f conftest.in
-  mv conftest.out conftest.in
-' >> $CONFIG_STATUS
-  sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
-  rm -f conftest.vals
-  mv conftest.tail conftest.vals
+  sed -f $tmp/undefs.sed $tmp/in >$tmp/out
+  rm -f $tmp/in
+  mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+  sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
+  rm -f conftest.undefs
+  mv conftest.tail conftest.undefs
 done
-rm -f conftest.vals
-
-cat >> $CONFIG_STATUS <<\EOF
-  rm -f conftest.frag conftest.h
-  echo "/* $ac_file.  Generated automatically by configure.  */" > conftest.h
-  cat conftest.in >> conftest.h
-  rm -f conftest.in
-  if cmp -s $ac_file conftest.h 2>/dev/null; then
-    echo "$ac_file is unchanged"
-    rm -f conftest.h
+rm -f conftest.undefs
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+  # Let's still pretend it is `configure' which instantiates (i.e., don't
+  # use $as_me), people would be surprised to read:
+  #    /* config.h.  Generated by config.status.  */
+  if test x"$ac_file" = x-; then
+    echo "/* Generated by configure.  */" >$tmp/config.h
   else
-    # Remove last slash and all that follows it.  Not all systems have dirname.
-      ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
-      if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
-      # The file is in a subdirectory.
-      test ! -d "$ac_dir" && mkdir "$ac_dir"
-    fi
-    rm -f $ac_file
-    mv conftest.h $ac_file
+    echo "/* $ac_file.  Generated by configure.  */" >$tmp/config.h
   fi
-fi; done
+  cat $tmp/in >>$tmp/config.h
+  rm -f $tmp/in
+  if test x"$ac_file" != x-; then
+    if cmp -s $ac_file $tmp/config.h 2>/dev/null; then
+      { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+echo "$as_me: $ac_file is unchanged" >&6;}
+    else
+      ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+         X"$ac_file" : 'X\(//\)[^/]' \| \
+         X"$ac_file" : 'X\(//\)$' \| \
+         X"$ac_file" : 'X\(/\)' \| \
+         .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+         /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+         /^X\(\/\/\)$/{ s//\1/; q; }
+         /^X\(\/\).*/{ s//\1/; q; }
+         s/.*/./; q'`
+      { case "$ac_dir" in
+  [\\/]* | ?:[\\/]* ) as_incr_dir=;;
+  *)                      as_incr_dir=.;;
+esac
+as_dummy="$ac_dir"
+for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do
+  case $as_mkdir_dir in
+    # Skip DOS drivespec
+    ?:) as_incr_dir=$as_mkdir_dir ;;
+    *)
+      as_incr_dir=$as_incr_dir/$as_mkdir_dir
+      test -d "$as_incr_dir" ||
+        mkdir "$as_incr_dir" ||
+       { { echo "$as_me:$LINENO: error: cannot create \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }
+    ;;
+  esac
+done; }
 
-EOF
-cat >> $CONFIG_STATUS <<EOF
+      rm -f $ac_file
+      mv $tmp/config.h $ac_file
+    fi
+  else
+    cat $tmp/config.h
+    rm -f $tmp/config.h
+  fi
+done
+_ACEOF
 
-EOF
-cat >> $CONFIG_STATUS <<\EOF
+cat >>$CONFIG_STATUS <<\_ACEOF
 
-exit 0
-EOF
+{ (exit 0); exit 0; }
+_ACEOF
 chmod +x $CONFIG_STATUS
-rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded.  So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status.  When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+  ac_cs_success=:
+  exec 5>/dev/null
+  $SHELL $CONFIG_STATUS || ac_cs_success=false
+  exec 5>>config.log
+  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+  # would make configure fail if this is the last instruction.
+  $ac_cs_success || { (exit 1); exit 1; }
+fi
 
 chmod 0700 unreal
diff --git a/doc/Etiquette b/doc/Etiquette
deleted file mode 100644 (file)
index 0376a17..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-/************************************************************************
- *   IRC - Internet Relay Chat, doc/etiquette
- *   Copyright (C) 1990, Lea Viljanen and Ari Husa
- *
- *   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
- *   the Free Software Foundation; either version 1, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * $Id$
- */
-
-HOW TO BEHAVE ON IRC
-
-Authors:      Lea Viljanen (LadyBug)  viljanen@kreeta.helsinki.fi
-              Ari Husa     (luru)     so-luru@tolsun.oulu.fi 
-
-
-1) Language
-
-   The most widely understood and spoken language on IRC is English. 
-However! As IRC is used in many different countries, English is by
-no means the only language. If you want to speak some other language
-than English (for example with your friends), go to a separate channel
-and set the topic (with /topic) to indicate that. For example
-   /topic Finnish only!
-would mean that this channel would be reserved for Finnish discussion.
-On the other hand, you should check the topic (with /list command) 
-before you move to a channel to see if there are any restrictions about 
-language.
-   On a channel not restricted by /topic, please speak a language
-everybody can understand. If you want to do otherwise, change channels
-and set the topic accordingly.
-
-
-2) Hello/Goodbye
-
-   It's not necessary to greet everybody on a channel personally.
-Usually one "Hello" or equivalent is enough. And don't expect everybody
-to greet you back. On a channel with 20 people that would mean one
-screenful of hellos. It's sensible not to greet, in order not to be rude
-to the rest of the channel. If you must say hello, do it with a private /msg.
-The same applies to goodbyes.
-
-
-3) Discussion
-
-   When you come to a new channel it's advised you to listen
-for a while to get an impression of what's discussed. Please feel free
-to join in, but do not try to force your topic into the discussion
-if that doesn't come naturally.
-
-
-4) {}|[]\
-
-   IRC has quite a lot of people from Scandinavian countries,
-the above characters are letters in their alphabet. This 
-has been explained on IRC about a thousand and one times, so
-read the following, do not ask it on IRC:
-
-   {     is an A with 2 dots over it
-   }     is an A with a small circle above it
-   |     is either an O with 2 dots over it or an O with a dash (/) through it
-   [, ], and \ are the preceding three letters in upper case.
-
-   There are a lot of people from Japan as well, who use Kanji characters
-which may look quite exotic as well. As I don't know Kanji I don't
-even try to explain any of the characters.
-
-5) ATTENTION!
-
-   Remember, people on IRC form their opinions about you only by 
-your actions, writings and comments on IRC. So think before you type.
-Do not "dump" to a channel or user (send large amounts of unwanted
-information). This is likely to get you /kicked off the channel or
-/killed off from irc. Dumping causes network 'burbs', connections going
-down because servers cannot handle the large amount of traffic any more.
index df782e4d7dfc5a61de7c7b2db8527d62072322ad..0ef4c8599dd3ccf4ed78760ef0bf592930a2fb59 100644 (file)
@@ -75,6 +75,29 @@ appear anywhere in a line and comment anything until the end of the line. For mu
 comments, a C style comment is supported. To start the comment you enter /* and anything from 
 there until the */ is commented.
 
+Time values (listed as <timevalue> in the samples) are entries that specify periods of
+time. The config format supports a very lenient method of entry. You can use the old
+fashioned method of specifying the time in seconds, or you can specify them in a much
+easier sense, for example 86400 is equivilent to writing 1day. You can use the constants
+second, minute, hour, day, and week. You may pluralize the constants as necessary but
+internally it makes no difference. The constants can be abbreviated to their first
+letter as well, for example day and d are the same thing. Constants are case
+insensitive. Spaces can also be used for easy readability but if you use spaces be sure to 
+enclose the value in double quotes.
+
+Size values (listed as <sizevalue> in the samples) are very similar to time values except
+they define a size rather than time. The size referred to is storage size. You can you the
+traditional method of entering the number of bytes in the size, or you can use the new
+method of using constants to make it more easily readable and easier to enter. For example
+instead of writing 1024, you can simply write 1kilobyte. The included constants are byte,
+kilobyte, megabyte, and gigabyte. You can abbreviate them to either their first letter or
+you can for example enter kb to mean kilobyte. Just like time values, size value constants
+are case insensitive. Spaces can also be used in the size value to seperate and add
+readability, but if you use spaces be sure to enclose the value in double quotes.
+
+Negative and affirmative values are used to either enable or disable an option. Negative
+values include no, off, false, 0. Affirmative values include yes, on, true, 1.
+
 2.0 Me block (M:line)
 
 Syntax:
@@ -152,6 +175,12 @@ allow {
        maxperip <max-connections-per-ip>;
        redirect-server <server-to-forward-to>;
        redirect-port <port-to-forward-to>;
+       options {
+               <option>;
+               <option>;
+               ...
+       };
+               
 };
 
 Example:
@@ -169,9 +198,18 @@ user@ip hostmask for a user to match to connect and allow::hostname specifies a
 match to connect, allow::class is the name of a preexisting (appears before this block in the 
 config) class block that will be used for this class. The rest of the directives are optional, 
 allow::password specifies a password that users must enter to connect. The allow::password:: 
-allows you to specify an authentication method. Currently supported methods are crypt, md3, and
-sha1. If you are using plain-text you can just leave this sub-block out. This directive also 
-allows you to configure close killing, allow::maxperip lets you specify the maximum number of clients that may connect from a single IP. Lastly, the allow block supports redirection when the server is full, allow::redirect-server specifies the address of a server to forward to, and allow::redirect-port specifies the port, if no port is specified, 6667 is assumed. Note: for auto-redirection to occur the client must have support for the redirection numeric, at this time not many clients do.
+allows you to specify an authentication method. Currently supported methods are crypt, md3,
+sha1 and ripemd-160. If you are using plain-text you can just leave this sub-block
+out. This directive also allows you to configure close killing, allow::maxperip lets you 
+specify the maximum number of clients that may connect from a single IP. Lastly, the allow 
+block supports redirection when the server is full, allow::redirect-server specifies the 
+address of a server to forward to, and allow::redirect-port specifies the port, if no port
+is specified, 6667 is assumed. Note: for auto-redirection to occur the client must have
+support for the redirection numeric, at this time not many clients do. The allow::options
+defines two option flags, the noident option instructs the IRCd to use the username
+supplied by the client rather than using what is returned by an ident response. The useip
+flag tells the IRCd to use the IP of the client as the host even if it is possible to
+resolve the IP to a hostname.
 
 6.0 Listen block (P:line)
 
@@ -240,17 +278,17 @@ The oper block allows you to assign IRC Operators for your server. The oper:: sp
 login name for the /oper. The oper::from::userhost is a user@host mask that the user must 
 match, you can specify more than one hostmask by creating more than one oper::from::userhost. 
 The oper::password is the password the user must specify, oper::password:: allows you to 
-specify an authentication method for this password, valid auth-types are crypt, md5, and sha1. 
-If you want to use a plain-text password leave this sub-block out. The oper::class directive 
-specifies the name of a preexisting (appears before this in the config file) class name that 
-the oper block will use. The oper::snomask directive lets you specify the default snomask
-the \oper will receive, this overrides the standard snomask that is normally set. The 
-oper::swhois directive allows you to specify an swhois line that will be set when the user 
-/oper's. Note: This directive will be overridden if you use an IRC Services program that also 
-sets swhois. The oper::flags directive has two formats. If you wish to use the old style
-oper flags i.e., OAa, you use the flags <flags> method, if you want to use the new style, i.e.,
-services-admin, then you use the flags { <flag>; } method. Below is a list of all the flags 
-(in both formats) and what they do.
+specify an authentication method for this password, valid auth-types are crypt, md5, sha1, 
+and ripemd-160. If you want to use a plain-text password leave this sub-block out. The
+oper::class directive specifies the name of a preexisting (appears before this in the
+config file) class name that the oper block will use. The oper::snomask directive lets you
+specify the default snomask the oper will receive, this overrides the standard snomask
+that is normally set. The oper::swhois directive allows you to specify an swhois line that
+will be set when the user /oper's. Note: This directive will be overridden if you use an
+IRC Services program that also sets swhois. The oper::flags directive has two formats. If
+you wish to use the old style oper flags i.e., OAa, you use the flags <flags> method, if
+you want to use the new style, i.e., services-admin, then you use the flags { <flag>; }
+method. Below is a list of all the flags (in both formats) and what they do.
 
 o      local                   Makes you a local operator (contains rhgwlckbBn)
 O      global                  Makes you a global operator (contains oLKG)
@@ -296,7 +334,7 @@ drpass {
 This block sets the /restart and /die passwords with drpass::restart and drpass::die 
 respectively. The drpass::restart:: and drpass::die:: allow you to specify the type of 
 authentication used by this item. The currently supported authentication types are crypt, md5, 
-and sha1.
+sha1, and ripemd-160.
 
 9.0 Include directive (N/A)
 
@@ -327,7 +365,7 @@ to easily load multiple modules at once.
 
 Syntax:
 log <file-name> {
-       maxsize <max-file-size>;
+       maxsize <sizevalue>;
        flags {
                <flag>;
                <flag>;
@@ -366,7 +404,7 @@ tld {
        mask *@*.es;
        motd motd.spanish;
        rules rules.spanish;
-       channel #help-spanish;
+       channel "#help-spanish";
 };
 
 The tld block allows you to specify a motd, rules, and channel for a user based on their host. 
@@ -666,7 +704,7 @@ user@host that the user must match to be eligable for the vhost. You may specify
 hostmask. The vhost::login in the login name the user must enter and vhost::password is the 
 password that must be entered. Lastly vhost::password:: allows you to specify the type of 
 authentication used by this item. The currently supported authentication types are crypt, md5, 
-and sha1.
+sha1, and ripemd-160.
 
 18.0 Badword block (badwords.*.conf)
 
@@ -747,24 +785,24 @@ you want to link to an IPv4 server, specify the hostname in the format ::ffff:<i
 ::ffff:203.123.67.1. The link::bind-ip specifies an IP that the server will bind to in order to 
 make this connection and link::port specifies the port it will establish the connection on. The 
 link::password-connect must be a plain-text password since it will be sent to the other server, 
-but link::password-receive may be encrypted using a method specified in 
-link::password-receive:: valid methods are crypt, md5, and sha1. You can leave the auth-type 
-parameter out to have it remain plain-text. The link::hub and link::leaf directives may not be 
-used together, either a server is a hub or a leaf. If link::hub is specified, the value is a 
-mask of what servers this hub may connect. If link::leaf is specified the value specifies the 
-mask that this server will act like a leaf towards. The link::leafdepth directive should only 
-be specified if link::leaf exists and is also optional. This value specifies the depth (number 
-of hops) this server may have beneath it. The link::class is the name of a preexisting (appear
-before this in the config) class block that will be used for the server connecting with the 
-link block. The link::options is a list of one or more options you wish this server to use, 
-valid options are ssl (the server will connect using SSL encryption), autoconnect (the server 
-will be autoconnected based on the value in the specified link::class), quarantine (opers on 
-this server will maintain locop status). If the server is set to link via SSL, the
-link::ciphers directive may be used. This allows you to specify the ciphers that will be
-used for this link. The ciphers are specified as a : seperated list in the order of preference. 
-Different systems support different ciphers, so the best way to get a list of available ciphers
-for your system is to execute the openssl ciphers command. This will return a : seperated list
-of the available ciphers.
+but link::password-receive may be encrypted using a method specified in link::password-receive::
+valid methods are crypt, md5, sha1, and ripemd-160. You can leave the auth-type parameter out
+to have it remain plain-text. The link::hub and link::leaf directives may not be used together,
+either a server is a hub or a leaf. If link::hub is specified, the value is a mask of what 
+servers this hub may connect. If link::leaf is specified the value specifies the mask that this
+server will act like a leaf towards. The link::leafdepth directive should only be specified if
+link::leaf exists and is also optional. This value specifies the depth (number of hops) this 
+server may have beneath it. The link::class is the name of a preexisting (appears before thi
+in the config) class block that will be used for the server connecting with the link block. The
+link::options is a list of one or more options you wish this server to use, valid options are 
+ssl (the server will connect using SSL encryption), autoconnect (the server will be 
+autoconnected based on the value in the specified link::class), quarantine (opers on this 
+server will maintain locop status). If the server is set to link via SSL, the link::ciphers
+directive may be used. This allows you to specify the ciphers that will be used for this link.
+The ciphers are specified as a : seperated list in the order of preference. Different systems 
+support different ciphers, so the best way to get a list of available ciphers for your system
+is to execute the openssl ciphers command. This will return a : seperated list of the available
+ciphers.
 
 21.0 Alias block (N/A)
 
@@ -878,9 +916,7 @@ use a comma seperated list.
 
 set::anti-spam-quit-message-time <timevalue>;
 A time value specifying the length of time a user must be connected for before a /quit message 
-will be displayed. Used to prevent spam. A time value is a numeric string with d meaning days, 
-h meaning hours, m meaning minutes, and s meaning seconds, for example 1d2h3m means 1 day, 2 
-hours, 3 minutes.
+will be displayed. Used to prevent spam. 
 
 set::oper-only-stats <stats-list>;
 Specifies a list of stats flags with no seperators that defines stats flags only opers can use. 
@@ -908,9 +944,7 @@ set::options::show-connect-info;
 If present notices showing "ident request", "hostname lookup", etc. will be displayed when a user connects.
 
 set::dns::timeout <timevalue>;
-A time value specifying the length of time a DNS server has to respond before a timeout. A time 
-value is a numeric string with d meaning days, h meaning hours, m meaning minutes, and s meaning
-seconds, for example 1d2h3m means 1 day, 2 hours, 3 minutes.
+A time value specifying the length of time a DNS server has to respond before a timeout. 
 
 set::dns::retries <number-of-retries>;
 A numeric value specifying the number of times the DNS lookup will be retried if failure occurs.
@@ -937,8 +971,8 @@ set::help-channel <network-help-channel>;
 Sets the name of the help channel for this network.
 
 set::prefix-quit <text-to-prefix-quit>;
-Sets the text that will be used to prefix a quit message. If this value is set to 0 then the 
-standard "Quit:" is used.
+Sets the text that will be used to prefix a quit message. If this value is set to either
+no or 0 then the standard "Quit:" is used.
 
 set::cloak-keys { <value>; <value>; <value>; };
 Sets the keys to be used to generate a +x host. This value must be the same on all servers or 
@@ -968,8 +1002,9 @@ set::hosts::netadmin <netadmin-host-name>;
 Sets the hostname that will be given to netadmins when they set +x.
 
 set::hosts::host-on-oper-up <yes/no>;
-If set to yes, the H/get_host flag will be honored and +x will be automatically set at /oper. 
-If set to no, the user must set +x manually to receive the oper host.
+If set to an affirmative value, the H/get_host flag will be honored and +x will be
+automatically set at /oper. If set to a negative value, the user must set +x manually to 
+receive the oper host.
 
 set::scan::endpoint <ip:port>;
 Specifies the IP and port that the server will tell an incomming open proxy to connect to.
@@ -979,14 +1014,19 @@ and a port you know is open.
 
 set::scan::bantime <timevalue>;
 A time value that defines the length of time that a user caught by the scanner will be
-banned for. A time value is a numeric string with d meaning days, h meaning hours, m
-meaning minutes, and s meaning seconds, for example 1d2h3m means 1 day, 2 hours, 3 minutes.
+banned for. 
 
 set::scan::timeout <timevalue>;
 A time value specifying the amount of time that is spent waiting for a proxy to respond to
-the scanner's request.  A time value is a numeric string with d meaning days, h meaning
-hours, m meaning minutes, and s meaning seconds, for example 1d2h3m means 1 day, 2 hours, 
-3 minutes.
+the scanner's request. 
+
+set::scan::bind-ip <ip>;
+Specifies the IP that the scanner will bind to before attempting to connect to the proxy
+servers.
+
+set::scan::message <message>;
+Specifies a notice that will be sent to the user when scanning begins alerting them to the
+fact that it is a routine scan and not a hacking attempt.
 
 24.0 Conclusion
 Well hopefully that cleared up some of the issues you had with the new config file format. 
index 8e485a17c5caa0c85aa0d88600178ceff8ca858c..d1449e6f7e1359109ce0f67aa1584375766fae64 100644 (file)
@@ -101,8 +101,8 @@ class           servers
  */
 
 allow {
-       ip             *;
-       hostname       *;
+       ip             *@*;
+       hostname       *@*;
        class           clients;
        maxperip 5;
 };
@@ -704,6 +704,18 @@ set {
        scan {
                ban-message "Insecure SOCKS server";
                quit-message "Insecure SOCKS server";
+               /* Choose this to be some IP and some port that's always open and
+                 * reachable by the proxies 
+                 */
+               endpoint [ip]:port;
+               /*
+                 * What IP should the scanners bind to before connecting
+                */
+               bind-ip "ip";
+               /*
+                 * What message should we NOTICE to the users when we scan them
+               */
+               message "<insert scan notice here> (admin didn't edit config correctly)";
                ban-time "4d";
        };
        maxchannelsperuser 10;
diff --git a/doc/features.txt b/doc/features.txt
deleted file mode 100644 (file)
index e195a5c..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-
-RPL_PROTOCTL (RPL_ISUPPORT):
- version: 2.1+ (new version: 3.1+)
-  
- This sends a numeric during client signon that lists various features that
- Unreal supports.  This allows client and script writers to know what features
- they can use, and various parameters about the irc server.  The numeric
- used is '005' to try and maintain some semblance of compatibility with
- DALnet which has a similar feature.  The 005 numeric may be split across
- multiple lines if the length exceeds 512 characters.
-
- The format is:
-  :servername 005 target feature1 feature2... :are supported by this server.
-  :servername 005 target feature200... :are supported by this server.
-
- features are either a word describing the feature eg: 'SILENCE', or a word
- describing the feature and an equals and a list of parameters.  
- eg: SILENCE=15 (says that we support silence, and we support up to 15 of
- them per user), or FOO=12,3 (says we support FOO with parameters 12 and 3)
- for example ircu2.10.08 lists:
-
- :test.undernet.org 005 test SILENCE=15 WHOX WALLCHOPS USERIP CPRIVMSG 
-   CNOTICE MODES=6 MAXCHANNELS=10 MAXBANS=30 NICKLEN=9 TOPICLEN=160
-   KICKLEN=160
--------------------------------------------------------------------------
-UnrealIRCd Supports:
-
-:unreal.server 005 nick MAP KNOCK SAFELIST HCN WATCH=%i SILENCE=%i MODES=%i
-                        MAXCHANNELS=%i MAXBANS=%i NICKLEN=%i TOPICLEN=%i
-                        KICKLEN=%i CHANTYPES=# PREFIX=%s :are supported by this server
-
-Feature "MAP"
--------------
-
- /map shows the servers as the server percieves them, who's connected
- to who in a pretty display, with number of users attached to each server
-
-Numerics used:
-
-RPL_MAP (006)
-RPL_MAPEND (007)
-
-Feature "KNOCK"
----------------
-
-Command: /KNOCK #Channel :<Reason>
-
-This command will only work if you are not a member of the channel and the
-+K (No knocks) mode is not on, and the channel is not +i (and you are not
-banned). This will send a notice to ops in the channel, about that the user
-"knocked".
-
-Feature "SAFELIST"
-------------------
-
-
-This note means that the user will not get disconnected when doing a /list,
-as some IRC networks do
-
-Feature "HCN"
--------------
-
-This is a special feature that you activate using /protoctl +HCN,
-that will cause +c notices when being oper, being in the Hybrid IRCd style
-
-Feature "WATCH"
----------------
-
-Parameters: How many watch entries are possible
-
-This will ensure the server is able to do the DALnet WATCH command
-
-
-Feature "SILENCE"
------------------
- Parameters: How many silence entries you can have
- Version: unknown, ircu2.9.32 at least.
-
- Silence is a server side ignore.  You can /silence +hostmask or
- /silence +nick, to add someone to your silence list, or use /silence
- -hostmask to remove it.  /silence will list your 'silence list'.
- you can /silence nick, to see someone elses silence list (useful for
- helping someone).  Silence is preferably used as a last resort as it
- tends to use server CPU time.
-
- Syntax:
-  SILENCE +hostmask
-  SILENCE +nick
-  SILENCE -hostmask
-  SILENCE -nick
-  SILENCE nick
-
- reply:
-  RPL_SILELIST      217
-  RPL_ENDOFSILELIST 218
-
-
-Feature/Modifier "MODES"
-------------------------
-Parameters: How many modes with parameters you can use in one /mode buffer
-
-
-Feature/Modifier "MAXCHANNELS"
-------------------------------
-Parameters: How many channels a normal user can join (opers may have
-            unlimited)
-
-Feature/Modifier "MAXBANS"
diff --git a/doc/unrealircd.conf.txt b/doc/unrealircd.conf.txt
deleted file mode 100644 (file)
index a482949..0000000
+++ /dev/null
@@ -1,441 +0,0 @@
-              * * * * * * * * * * * * * * * * * * *
-              *    Unrealircd.conf Documentation  *
-              *     http://www.unrealircd.com     *
-              *    Made for Version 3.2+ Daemon   *
-              *            by devdev              *
-              * * * * * * * * * * * * * * * * * * *
-
-
-       * * * * T a b l e  o f  C o n t e n t s * * * *
-
-               Section 1.0  :  Introduction
-               Section 2.0  :  me{} line
-                       2.1  :     Syntax
-                       2.2  :     Variables
-               Section 3.0  :  admin{} line
-                       3.1  :     Syntax
-                       3.2  :     Variables
-               Section 4.0  :  class{} line
-                       4.1  :     Syntax
-                       4.2  :     Variables
-               Section 5.0  :  allow{} line
-                       5.1  :     Syntax
-                       5.2  :     Variables
-               Section 6.0  :  drpass{} line
-                       6.1  :     Syntax
-                       6.2  :     Variables
-               Section 7.0  :  oper{} line
-                       7.1  :     Syntax
-                       7.2  :     Variables
-                       7.3  :     Oper Flags
-                       7.4  :     Flag Usage
-               Section 8.0  :  listen{} line
-                       8.1  :     Syntax
-                       8.2  :     Variables
-                       8.3  :     Port Options
-                       9.0  :  link{} line
-                       9.1  :     Syntax
-                       9.2  :     Variables
-                       9.3  :     Link Options
-              Section 10.0  :  ulines{} line
-                      10.1  :     Syntax
-                      10.2  :     Variables
-              Section 11.0  :  tld{} line
-                      11.1  :     Syntax
-                      11.2  :     Variables
-              Section 12.0  :  ban{} line
-                      12.1  :     ban nick{}
-                      12.2  :     ban ip{}
-                      12.3  :     ban server{}
-                      12.4  :     ban realname{}
-                      12.5  :     ban user{}
-              Section 13.0  :  except{} line
-                      13.1  :     except ban{}
-                      13.2  :     except socks{}
-              Section 14.0  :  vhost{} line
-                      14.1  :     Syntax
-                      14.2  :     Variables
-
-       * * * * * * * * * * * * * * * * * * * * * * * *
-
-1.0) Introduction:
-
-       As you may have noticed, in this version of Unreal, the ircd.conf
-       has changed dramatically and has a new name... unrealircd.conf.
-
-       This will be a fully explanatory guide to the new unrealircd.conf
-       Every aspect of the new config file is explained below.
-
-2.0) me{} (Server Information Line):
-
-       This is the same idea as the old M:line. Gives the server name,
-       description, and numeric. This, however, does not include the ip
-       of the server.
-
-2.1) Syntax:
-       me {
-               name <server>;
-               info "<description>";
-               numeric <numeric>;
-       };
-
-2.2) Variables:
-                                               
-       <server>        Server name             (irc.network.com)
-       <description>   Server description      (Network Hub)
-       <numeric>       Connection Numeric      (Number 1-254)
-
-3.0) admin{} (Administrator Line):
-
-       This is the same as the A:line. This line gives information about
-       the server owner/administrator including Name, nickname, and email.
-       This is not restricted to a number of lines. Shown at /admin
-
-3.1) Syntax:
-       admin {
-               "<line>";
-       };
-
-3.2) Variables:
-       <line>  Text shown at /admin            (Admin Name)
-
-       The "<line>"; can be repeated as many times as you wish. We suggest
-       placing the admins nickname and an email to reach them at.
-
-4.0) class{} (Connection Classes Line):
-
-       These connection classes are used to define the ping freqency, maximum
-       amount of clients, and sendq limit for a certain class.
-
-4.1) Syntax:
-       class <class name> {
-               connfreq <connfreq>; /*server only*/    
-               ping freq <pingfrq>;
-               maxclients <maxclients>;
-               sendq <sendqlimit>;
-       };
-
-4.2) Variables:
-       <class type>    Name of connection class                (client, server, oper)
-       <connfreq>      Seconds between connection attempts     (seconds)
-       <pingfrq>       Ping Frequency (every x seconds)        (seconds)
-       <maxclients>    Number of maximum connections           (number)
-       <sendqlimit>    Limit for sends                         (number)
-
-5.0) allow{} (Allowed Connections):
-
-       This line specifies from which hostnames/ips users can connect from and their
-       restrictions.
-
-5.1) Syntax:
-       allow {
-               ip "<ip>";
-               hostname "<host>";
-               class <classname>;
-               password "<password>";
-               maxperip <max>;
-               redirect-server <server>;
-               redirect-port <port>;
-       };
-
-5.2) Variables:
-       <ip>            IP to allow connections from            (1.2.3.4)
-       <host>          Hostname to allow connections from      (ident@host)
-       <classname>     Class name to use defined above         (name)
-       <password>      Password required for connection        (password)
-       <max>           Maximum per ip address                  (number)
-       <server>        server to redirect to                   (hostname/ip)
-       <port>          port on server to redirect              (port)
-
-6.0) drpass{} (Die/Restart Password):
-
-       This line will defy the passwords required to restart or shutdown the irc server.
-
-6.1) Syntax:
-       drpass {
-               die "<diepass>";
-               restart "<restartpass>";
-       };
-
-6.2) Variables:
-       <diepass>       Password to shutdown the server         (password)
-       <restartpass>   Password to restart the server          (password)
-
-7.0) oper{} (IRC Operator Line):
-
-       This line will define who (after suppling a login and password) will be allowed to have certain permissions
-       granted. Such as global kills compared to local kills, and being able to restart the server.
-
-7.1) Syntax:
-       oper <login> {
-               class <classname>;
-               from {
-                       userhost <host>;
-                       userhost <host>
-               };
-               password "<password>";
-               flags {
-                       <flag>;
-                       <flag>;
-               }
-               swhois <whois stuff>;
-               snomask <snomask>;
-       };
-
-7.2) Variables
-       <login>         Login user name                         (opername)
-       <classname>     Class the oper will connect from        (class)
-       <host>          Host the oper is allowed to op from     (ident@host)
-       <password>      Password to accompany login-name        (password)
-       <flag>          Flags to define permissions             (see 7.3)
-       <snomask>       Snomask on oper                         (SNOMASK)
-       <whois stuff>   Extra info in /whois                    (string)
-
-7.3) Oper Flags (old and new)
-
-       Old     | New             |Description
-       ------- |---------------- |------------------------------
-       N       | netadmin        | Network Admnistrator
-       T       | techadmin       | Technical Administrator
-       A       | admin           | Server Administrator
-       a       | sadmin          | Services Operator
-       C       | coadmin         | Co Administrator
-       o       | local           | Local IRC Operator
-       O       | global          | Global IRC Operator
-       r       | can_rehash      | Is able to rehash the server
-       D       | can_die         | Can shutdown the server (with password)
-       R       | can_restart     | Can restart the server (with password)
-       h       | helpop          | ..is available for help. Can see /helpops
-       g       | can_globops     | Can use /globops
-       w       | can_wallops     | Can use /wallops
-       l       | locop           | can send /locops
-       c       | can_localroute  | Can locally /connect and /squit servers
-       L       | can_globalroute | Can globally /connect and /squit servers
-       k       | can_localkill   | Can do local /kills
-       K       | can_globalkill  | Can do global /kills
-       b       | can_kline       | Can set a /kline
-       B       | can_unkline     | Can unset a /kline
-       n       | can_localnotice | Can send local notices
-       G       | can_globalnotice| Can send global notices
-       z       | can_zline       | Can set /zlines
-       t       | can_gkline      | can use /gline and /shun
-       Z       | can_gzline      | can use /gzline
-       ^       | can_stealth     | Can set +I
-
-
-7.4) Oper Flag Usage:
-
-       Usage:
-               flags oldflags;
-       [or]
-               flags { new flag; new flag; };
-
-       Example:
-               flags oN;
-       [or]
-               flags { netadmin; helpop; };
-
-
-       Local operators are defined by having no additional flags in the oper line or if the IRCD finsd an error in 
-       the flags, locop will be set (default).
-
-8.0) listen{} (Available Ports):
-
-       These line(s) define which ports the IRCd will be using. Ports that servers and clients can connect to.
-
-8.1) Syntax:
-       listen <ip>:<port>;
-       {
-        options
-        {
-            <option>;
-            <option>;
-         };
-       };
-
-8.2) Variables:
-       <ip>            IP Address to bind to                   (1.2.3.4)       
-       <port>          Port to listen on                       (port)
-       <option>        Option for the port to use              (see 8.3)
-
-8.3) Port Options
-
-       standard        Normally listens on the port
-       ssl             Port is available to accept SSL connections.
-       serveronly      Port can only have servers connect to it (not clients)
-       clientsonly     Port can only have clients connect to it
-
-9.0) link{} (Connecting Servers):
-
-       This line will define what server can connect to yours.
-
-9.1) Syntax:
-
-       link <servername>;
-       {
-               username        <usermask>;
-               hostname        <hostname>;
-               bind-ip         <bindip>;
-               port            <port>;
-               hub *;                     /* for connecting a hub */
-               leaf *;                    /* for connecting a leaf */
-               leaf-depth <leaf-depth>;   /* for connecting a leaf */
-               password-connect "<cpassword>";
-               password-receive "<rpassword>";
-               class <class>;
-               rsa-auth "<keypath>";
-               options {
-                       <option>;
-                       <option>;
-               };
-       };
-
-9.2) Variables
-       <servername>    Server name to connect to               (server.network.com)
-       <username>      Username for authenticating connection  (username)
-       <hostname>      Hostname for authenticating connection  (hostname)
-       <bindip>        IP your server will bind to to connect  (ip)
-       hub or leaf     Place hub *; or leaf *; depending on
-                       what type of server you're linking to
-       <leaf-depth>    Number of servers below yours           (number)
-       <cpassword>     Password to send to the server          (password)
-       <rpassword>     Password you expect to receive          (password)
-       <class>         Class for servers                       (classname)
-       <keypath>       Path use for rsa-authentication         (keypath)
-       <option>        Option used for connecting              (see 9.3)
-
-9.3) Link Options
-
-       autoconnect     Automaticlly tries to connect to the server
-       ssl             Defines you are connecting to a SSL server
-       zip             Will make them compressed later
-
-10.0) ulines{} (Ulined Servers):
-
-       This line will define servers that can have more control over the network. Services
-       require this line in order to modify channels without being irc-operators.
-
-10.1) Syntax:
-
-       ulines {
-               <server>;
-               <server>;
-       };
-
-10.2) Variables:
-       <server>        Server to be u:lined, can be infinate   (servername)
-
-11.0) tld{} (MOTD and Rules by Domains):
-
-       This line defines which hosts will read which set of MOTDs/Rules. For instance, if you have
-       a bilingual network, connections from .fr can show a french MOTD and Rule file instead
-       of the default ircd.motd and ircd.rules
-
-11.1) Syntax:
-
-       tld {
-               mask <mask>;
-               motd "<motd>";
-               rules "<rules>";
-       };      
-
-11.2) Variables:
-       <mask>          Mask that will define the new set       (ident@host)
-       <motd>          Filename of the motd file               (filename)
-       <rules>         Filename of the rules file              (filename)
-
-12.0) ban{} (Bans):
-
-       This line has many parts to it and can ban different things. See the sections below
-       on more information on banning.
-
-12.1) ban nick{}
-
-       This line is used for restricting the use of certain nicknames
-
-       Syntax:
-               ban nick { 
-                    mask "<nickname>";
-                   reason "<reason>";
-               };
-
-12.2) ban ip{}
-
-       Used for removing a entire ip from connecting.
-
-       Syntax:
-               ban ip { mask <ipaddress>; reason "<reason>"; };
-
-12.3) ban server{}
-
-       Used for restrictring a server from connecting to you.
-
-       Syntax:
-               ban server {
-                       mask <servername>;
-                       reason "<reason>";
-               };
-
-12.4) ban realname{}
-
-       Used to keep select individuals with certain realnames off the server.
-
-       Syntax:
-               ban realname {
-                       mask "<real name>";
-                       reason "<reason>";
-               };
-
-12.5) ban user{}
-
-       This line is the same as the old K:Lines. It bans a host mask from connecting.
-
-       Syntax:
-               ban user { mask <ident@host>; reason "<reason>"; };
-
-13.0) except{} (Cannot Be Banned):
-
-       Used to make sure your own IRCops dont ban you, or so you dont accidently ban an entire
-       nation's worth of addresses, etc.
-
-13.1) except ban{}
-
-       This is so a realname and user cannot be banned.
-
-       Syntax:
-               except ban {
-                       mask <ident@host>;
-               };
-
-13.2) except socks{}
-
-       This line is used so the socks server does not ban a client.
-
-       Syntax:
-               except socks {
-                       mask 216.73.27.177;     
-               };
-
-14.0) vhost{} (Vanity Hosts):
-
-       The vhost{} line is used so a user can change their hostname from blah.dialup.com to
-       a more fun hostname such as tends.to.write.some.really.evildocs.net
-               /vhost <login> <password>
-
-14.1) Syntax:
-
-       vhost {
-               vhost           <vhost>;
-               from {
-                       userhost        <mask>;
-               };
-               login           <login>;
-               password        <password>;
-       };
-
-14.2) Variables:
-       <vhost>         Name of the vhost to use                (vhost)
-       <mask>          Allowed masks to use the vhost          (ident@host)
-       <login>         A login name to use                     (login)
-       <password>      Password to supply with login           (password)
-
diff --git a/extras/channeldumper.c b/extras/channeldumper.c
new file mode 100644 (file)
index 0000000..343d27e
--- /dev/null
@@ -0,0 +1,128 @@
+/*
+ *   IRC - Internet Relay Chat, src/modules/channeldumper.c
+ *   (C) 2002 Carsten V. Munk <stskeeps@tspre.org>
+ *
+ *
+ *   See file AUTHORS in IRC package for additional names of
+ *   the programmers.
+ *
+ *   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
+ *   the Free Software Foundation; either version 1, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+#include "config.h"
+#include "struct.h"
+#include "common.h"
+#include "sys.h"
+#include "numeric.h"
+#include "msg.h"
+#include "channel.h"
+#include <time.h>
+#include <sys/stat.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef _WIN32
+#include <io.h>
+#endif
+#include <fcntl.h>
+#include "h.h"
+#include "proto.h"
+#ifdef STRIPBADWORDS
+#include "badwords.h"
+#endif
+#ifdef _WIN32
+#include "version.h"
+#endif
+
+#ifndef DYNAMIC_LINKING
+ModuleHeader channeldumper_Header
+#else
+#define channeldumper_Header Mod_Header
+ModuleHeader Mod_Header
+#endif
+  = {
+       "channeldumper",
+       "$Id$",
+       "Channel dump to text timed", 
+       "3.2-b8-1",
+       NULL 
+    };
+
+static ModuleInfo      ChannelDumperModInfo;
+
+#ifdef DYNAMIC_LINKING
+DLLFUNC int    Mod_Init(ModuleInfo *modinfo)
+#else
+int    channeldumper_Init(ModuleInfo *modinfo)
+#endif
+{
+       tainted++;
+       bcopy(modinfo,&ChannelDumperModInfo, modinfo->size);
+       return MOD_SUCCESS;
+}
+
+EVENT(e_channeldump);
+static Event *ChannelDumpEvent = NULL;
+#ifdef DYNAMIC_LINKING
+DLLFUNC int    Mod_Load(int module_load)
+#else
+int    channeldumper_Load(int module_load)
+#endif
+{
+       LockEventSystem();
+       ChannelDumpEvent = EventAddEx(ChannelDumperModInfo.handle, "e_channeldump", 5, 0, e_channeldump, NULL);
+       UnlockEventSystem();
+       return MOD_SUCCESS;
+}
+
+#ifdef DYNAMIC_LINKING
+DLLFUNC int    Mod_Unload(int module_unload)
+#else
+int    channeldumper_Unload(int module_unload)
+#endif
+{
+       tainted--;
+       LockEventSystem();
+       EventDel(ChannelDumpEvent);
+       UnlockEventSystem();
+       return MOD_SUCCESS;
+}
+
+EVENT(e_channeldump)
+{
+       aChannel *chptr;
+       unsigned int hashnum;
+       Member  *m;
+       FILE    *f;
+       
+       f = fopen("ircd.channeldump", "w");
+       if (!f)
+               return;
+       for (hashnum = 0; hashnum < CH_MAX; hashnum++)
+       {
+               for (chptr = (aChannel *)hash_get_chan_bucket(hashnum); chptr; chptr
+                       = chptr->hnextch)
+               {
+                       if (SecretChannel(chptr))
+                               continue;
+                       fprintf(f, "C %s %s\r\n", 
+                               chptr->chname, chptr->topic ? chptr->topic : "");
+                       for (m = chptr->members; m; m = m->next)
+                               fprintf(f, "M %s\r\n",
+                                       m->cptr->name);                         
+               }
+       }
+       fclose(f);
+       return;
+}
\ No newline at end of file
index a6a1de95895fcba550e46c553876406acd7453a8..7fe4be1331ecae64c3a8738990a2285338708c2a 100644 (file)
@@ -31,3 +31,18 @@ anywhere it pleases.
 
 :uline.server RAWTO towho :what to send
 
+=========================
+
+Name: channeldumper.c
+Is a 3rd party module
+Description:
+
+Dumps a list of non secret channels to ircd.channels or something every 5 seconds,
+
+C #channel topic
+M member1
+M member2
+C #channel2 topic
+M member3
+
+You can't rely on topic being there
diff --git a/extras/malloc.c b/extras/malloc.c
new file mode 100644 (file)
index 0000000..f3582d7
--- /dev/null
@@ -0,0 +1,5563 @@
+/*
+  This is a version (aka dlmalloc) of malloc/free/realloc written by
+  Doug Lea and released to the public domain.  Use, modify, and
+  redistribute this code without permission or acknowledgement in any
+  way you wish.  Send questions, comments, complaints, performance
+  data, etc to dl@cs.oswego.edu
+
+* VERSION 2.7.1 Thu Jul 25 10:58:03 2002  Doug Lea  (dl at gee)
+
+   Note: There may be an updated version of this malloc obtainable at
+           ftp://gee.cs.oswego.edu/pub/misc/malloc.c
+         Check before installing!
+
+* Quickstart
+
+  This library is all in one file to simplify the most common usage:
+  ftp it, compile it (-O), and link it into another program. All
+  of the compile-time options default to reasonable values for use on
+  most unix platforms. Compile -DWIN32 for reasonable defaults on windows.
+  You might later want to step through various compile-time and dynamic
+  tuning options.
+
+  For convenience, an include file for code using this malloc is at:
+     ftp://gee.cs.oswego.edu/pub/misc/malloc-2.7.1.h
+  You don't really need this .h file unless you call functions not
+  defined in your system include files.  The .h file contains only the
+  excerpts from this file needed for using this malloc on ANSI C/C++
+  systems, so long as you haven't changed compile-time options about
+  naming and tuning parameters.  If you do, then you can create your
+  own malloc.h that does include all settings by cutting at the point
+  indicated below.
+
+* Why use this malloc?
+
+  This is not the fastest, most space-conserving, most portable, or
+  most tunable malloc ever written. However it is among the fastest
+  while also being among the most space-conserving, portable and tunable.
+  Consistent balance across these factors results in a good general-purpose
+  allocator for malloc-intensive programs.
+
+  The main properties of the algorithms are:
+  * For large (>= 512 bytes) requests, it is a pure best-fit allocator,
+    with ties normally decided via FIFO (i.e. least recently used).
+  * For small (<= 64 bytes by default) requests, it is a caching
+    allocator, that maintains pools of quickly recycled chunks.
+  * In between, and for combinations of large and small requests, it does
+    the best it can trying to meet both goals at once.
+  * For very large requests (>= 128KB by default), it relies on system
+    memory mapping facilities, if supported.
+
+  For a longer but slightly out of date high-level description, see
+     http://gee.cs.oswego.edu/dl/html/malloc.html
+
+  You may already by default be using a C library containing a malloc
+  that is  based on some version of this malloc (for example in
+  linux). You might still want to use the one in this file in order to
+  customize settings or to avoid overheads associated with library
+  versions.
+
+* Contents, described in more detail in "description of public routines" below.
+
+  Standard (ANSI/SVID/...)  functions:
+    malloc(size_t n);
+    calloc(size_t n_elements, size_t element_size);
+    free(Void_t* p);
+    realloc(Void_t* p, size_t n);
+    memalign(size_t alignment, size_t n);
+    valloc(size_t n);
+    mallinfo()
+    mallopt(int parameter_number, int parameter_value)
+
+  Additional functions:
+    independent_calloc(size_t n_elements, size_t size, Void_t* chunks[]);
+    independent_comalloc(size_t n_elements, size_t sizes[], Void_t* chunks[]);
+    pvalloc(size_t n);
+    cfree(Void_t* p);
+    malloc_trim(size_t pad);
+    malloc_usable_size(Void_t* p);
+    malloc_stats();
+
+* Vital statistics:
+
+  Supported pointer representation:       4 or 8 bytes
+  Supported size_t  representation:       4 or 8 bytes 
+       Note that size_t is allowed to be 4 bytes even if pointers are 8.
+       You can adjust this by defining INTERNAL_SIZE_T
+
+  Alignment:                              2 * sizeof(size_t) (default)
+       (i.e., 8 byte alignment with 4byte size_t). This suffices for
+       nearly all current machines and C compilers. However, you can
+       define MALLOC_ALIGNMENT to be wider than this if necessary.
+
+  Minimum overhead per allocated chunk:   4 or 8 bytes
+       Each malloced chunk has a hidden word of overhead holding size
+       and status information.
+
+  Minimum allocated size: 4-byte ptrs:  16 bytes    (including 4 overhead)
+                          8-byte ptrs:  24/32 bytes (including, 4/8 overhead)
+
+       When a chunk is freed, 12 (for 4byte ptrs) or 20 (for 8 byte
+       ptrs but 4 byte size) or 24 (for 8/8) additional bytes are
+       needed; 4 (8) for a trailing size field and 8 (16) bytes for
+       free list pointers. Thus, the minimum allocatable size is
+       16/24/32 bytes.
+
+       Even a request for zero bytes (i.e., malloc(0)) returns a
+       pointer to something of the minimum allocatable size.
+
+       The maximum overhead wastage (i.e., number of extra bytes
+       allocated than were requested in malloc) is less than or equal
+       to the minimum size, except for requests >= mmap_threshold that
+       are serviced via mmap(), where the worst case wastage is 2 *
+       sizeof(size_t) bytes plus the remainder from a system page (the
+       minimal mmap unit); typically 4096 or 8192 bytes.
+
+  Maximum allocated size:  4-byte size_t: 2^32 minus about two pages 
+                           8-byte size_t: 2^64 minus about two pages
+
+       It is assumed that (possibly signed) size_t values suffice to
+       represent chunk sizes. `Possibly signed' is due to the fact
+       that `size_t' may be defined on a system as either a signed or
+       an unsigned type. The ISO C standard says that it must be
+       unsigned, but a few systems are known not to adhere to this.
+       Additionally, even when size_t is unsigned, sbrk (which is by
+       default used to obtain memory from system) accepts signed
+       arguments, and may not be able to handle size_t-wide arguments
+       with negative sign bit.  Generally, values that would
+       appear as negative after accounting for overhead and alignment
+       are supported only via mmap(), which does not have this
+       limitation.
+
+       Requests for sizes outside the allowed range will perform an optional
+       failure action and then return null. (Requests may also
+       also fail because a system is out of memory.)
+
+  Thread-safety: NOT thread-safe unless USE_MALLOC_LOCK defined
+
+       When USE_MALLOC_LOCK is defined, wrappers are created to
+       surround every public call with either a pthread mutex or
+       a win32 spinlock (depending on WIN32). This is not
+       especially fast, and can be a major bottleneck.
+       It is designed only to provide minimal protection
+       in concurrent environments, and to provide a basis for
+       extensions.  If you are using malloc in a concurrent program,
+       you would be far better off obtaining ptmalloc, which is
+       derived from a version of this malloc, and is well-tuned for
+       concurrent programs. (See http://www.malloc.de) Note that
+       even when USE_MALLOC_LOCK is defined, you can can guarantee
+       full thread-safety only if no threads acquire memory through 
+       direct calls to MORECORE or other system-level allocators.
+
+  Compliance: I believe it is compliant with the 1997 Single Unix Specification
+       (See http://www.opennc.org). Also SVID/XPG, ANSI C, and probably 
+       others as well.
+
+* Synopsis of compile-time options:
+
+    People have reported using previous versions of this malloc on all
+    versions of Unix, sometimes by tweaking some of the defines
+    below. It has been tested most extensively on Solaris and
+    Linux. It is also reported to work on WIN32 platforms.
+    People also report using it in stand-alone embedded systems.
+
+    The implementation is in straight, hand-tuned ANSI C.  It is not
+    at all modular. (Sorry!)  It uses a lot of macros.  To be at all
+    usable, this code should be compiled using an optimizing compiler
+    (for example gcc -O3) that can simplify expressions and control
+    paths. (FAQ: some macros import variables as arguments rather than
+    declare locals because people reported that some debuggers
+    otherwise get confused.)
+
+    OPTION                     DEFAULT VALUE
+
+    Compilation Environment options:
+
+    __STD_C                    derived from C compiler defines
+    WIN32                      NOT defined
+    HAVE_MEMCPY                defined
+    USE_MEMCPY                 1 if HAVE_MEMCPY is defined
+    HAVE_MMAP                  defined as 1 
+    MMAP_CLEARS                1
+    HAVE_MREMAP                0 unless linux defined
+    malloc_getpagesize         derived from system #includes, or 4096 if not
+    HAVE_USR_INCLUDE_MALLOC_H  NOT defined
+    LACKS_UNISTD_H             NOT defined unless WIN32
+    LACKS_SYS_PARAM_H          NOT defined unless WIN32
+    LACKS_SYS_MMAN_H           NOT defined unless WIN32
+    LACKS_FCNTL_H              NOT defined
+
+    Changing default word sizes:
+
+    INTERNAL_SIZE_T            size_t
+    MALLOC_ALIGNMENT           2 * sizeof(INTERNAL_SIZE_T)
+    PTR_UINT                   unsigned long
+    CHUNK_SIZE_T               unsigned long
+
+    Configuration and functionality options:
+
+    USE_DL_PREFIX              NOT defined
+    USE_PUBLIC_MALLOC_WRAPPERS NOT defined
+    USE_MALLOC_LOCK            NOT defined
+    DEBUG                      NOT defined
+    REALLOC_ZERO_BYTES_FREES   NOT defined
+    MALLOC_FAILURE_ACTION      errno = ENOMEM, if __STD_C defined, else no-op
+    TRIM_FASTBINS              0
+    FIRST_SORTED_BIN_SIZE      512
+
+    Options for customizing MORECORE:
+
+    MORECORE                   sbrk
+    MORECORE_CONTIGUOUS        1 
+    MORECORE_CANNOT_TRIM       NOT defined
+    MMAP_AS_MORECORE_SIZE      (1024 * 1024) 
+
+    Tuning options that are also dynamically changeable via mallopt:
+
+    DEFAULT_MXFAST             64
+    DEFAULT_TRIM_THRESHOLD     256 * 1024
+    DEFAULT_TOP_PAD            0
+    DEFAULT_MMAP_THRESHOLD     256 * 1024
+    DEFAULT_MMAP_MAX           65536
+
+    There are several other #defined constants and macros that you
+    probably don't want to touch unless you are extending or adapting malloc.
+*/
+
+/*
+  WIN32 sets up defaults for MS environment and compilers.
+  Otherwise defaults are for unix.
+*/
+
+/* #define WIN32 */
+
+#ifdef WIN32
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+/* Win32 doesn't supply or need the following headers */
+#define LACKS_UNISTD_H
+#define LACKS_SYS_PARAM_H
+#define LACKS_SYS_MMAN_H
+
+/* Use the supplied emulation of sbrk */
+#define MORECORE sbrk
+#define MORECORE_CONTIGUOUS 1
+#define MORECORE_FAILURE    ((void*)(-1))
+
+/* Use the supplied emulation of mmap and munmap */
+#define HAVE_MMAP 1
+#define MUNMAP_FAILURE  (-1)
+#define MMAP_CLEARS 1
+
+/* These values don't really matter in windows mmap emulation */
+#define MAP_PRIVATE 1
+#define MAP_ANONYMOUS 2
+#define PROT_READ 1
+#define PROT_WRITE 2
+
+/* Emulation functions defined at the end of this file */
+
+/* If USE_MALLOC_LOCK, use supplied critical-section-based lock functions */
+#ifdef USE_MALLOC_LOCK
+static int slwait(int *sl);
+static int slrelease(int *sl);
+#endif
+
+static long getpagesize(void);
+static long getregionsize(void);
+static void *sbrk(long size);
+static void *mmap(void *ptr, long size, long prot, long type, long handle, long arg);
+static long munmap(void *ptr, long size);
+
+static void vminfo (unsigned long*free, unsigned long*reserved, unsigned long*committed);
+static int cpuinfo (int whole, unsigned long*kernel, unsigned long*user);
+
+#endif
+
+/*
+  __STD_C should be nonzero if using ANSI-standard C compiler, a C++
+  compiler, or a C compiler sufficiently close to ANSI to get away
+  with it.
+*/
+
+#ifndef __STD_C
+#if defined(__STDC__) || defined(_cplusplus)
+#define __STD_C     1
+#else
+#define __STD_C     0
+#endif 
+#endif /*__STD_C*/
+
+
+/*
+  Void_t* is the pointer type that malloc should say it returns
+*/
+
+#ifndef Void_t
+#if (__STD_C || defined(WIN32))
+#define Void_t      void
+#else
+#define Void_t      char
+#endif
+#endif /*Void_t*/
+
+#if __STD_C
+#include <stddef.h>   /* for size_t */
+#else
+#include <sys/types.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* define LACKS_UNISTD_H if your system does not have a <unistd.h>. */
+
+/* #define  LACKS_UNISTD_H */
+
+#ifndef LACKS_UNISTD_H
+#include <unistd.h>
+#endif
+
+/* define LACKS_SYS_PARAM_H if your system does not have a <sys/param.h>. */
+
+/* #define  LACKS_SYS_PARAM_H */
+
+
+#include <stdio.h>    /* needed for malloc_stats */
+#include <errno.h>    /* needed for optional MALLOC_FAILURE_ACTION */
+
+
+/*
+  Debugging:
+
+  Because freed chunks may be overwritten with bookkeeping fields, this
+  malloc will often die when freed memory is overwritten by user
+  programs.  This can be very effective (albeit in an annoying way)
+  in helping track down dangling pointers.
+
+  If you compile with -DDEBUG, a number of assertion checks are
+  enabled that will catch more memory errors. You probably won't be
+  able to make much sense of the actual assertion errors, but they
+  should help you locate incorrectly overwritten memory.  The
+  checking is fairly extensive, and will slow down execution
+  noticeably. Calling malloc_stats or mallinfo with DEBUG set will
+  attempt to check every non-mmapped allocated and free chunk in the
+  course of computing the summmaries. (By nature, mmapped regions
+  cannot be checked very much automatically.)
+
+  Setting DEBUG may also be helpful if you are trying to modify
+  this code. The assertions in the check routines spell out in more
+  detail the assumptions and invariants underlying the algorithms.
+
+  Setting DEBUG does NOT provide an automated mechanism for checking
+  that all accesses to malloced memory stay within their
+  bounds. However, there are several add-ons and adaptations of this
+  or other mallocs available that do this.
+*/
+
+#if DEBUG
+#include <assert.h>
+#else
+#define assert(x) ((void)0)
+#endif
+
+/*
+  The unsigned integer type used for comparing any two chunk sizes.
+  This should be at least as wide as size_t, but should not be signed.
+*/
+
+#ifndef CHUNK_SIZE_T
+#define CHUNK_SIZE_T unsigned long
+#endif
+
+/* 
+  The unsigned integer type used to hold addresses when they are are
+  manipulated as integers. Except that it is not defined on all
+  systems, intptr_t would suffice.
+*/
+#ifndef PTR_UINT
+#define PTR_UINT unsigned long
+#endif
+
+
+/*
+  INTERNAL_SIZE_T is the word-size used for internal bookkeeping
+  of chunk sizes.
+
+  The default version is the same as size_t.
+
+  While not strictly necessary, it is best to define this as an
+  unsigned type, even if size_t is a signed type. This may avoid some
+  artificial size limitations on some systems.
+
+  On a 64-bit machine, you may be able to reduce malloc overhead by
+  defining INTERNAL_SIZE_T to be a 32 bit `unsigned int' at the
+  expense of not being able to handle more than 2^32 of malloced
+  space. If this limitation is acceptable, you are encouraged to set
+  this unless you are on a platform requiring 16byte alignments. In
+  this case the alignment requirements turn out to negate any
+  potential advantages of decreasing size_t word size.
+
+  Implementors: Beware of the possible combinations of:
+     - INTERNAL_SIZE_T might be signed or unsigned, might be 32 or 64 bits,
+       and might be the same width as int or as long
+     - size_t might have different width and signedness as INTERNAL_SIZE_T
+     - int and long might be 32 or 64 bits, and might be the same width
+  To deal with this, most comparisons and difference computations
+  among INTERNAL_SIZE_Ts should cast them to CHUNK_SIZE_T, being
+  aware of the fact that casting an unsigned int to a wider long does
+  not sign-extend. (This also makes checking for negative numbers
+  awkward.) Some of these casts result in harmless compiler warnings
+  on some systems.
+*/
+
+#ifndef INTERNAL_SIZE_T
+#define INTERNAL_SIZE_T size_t
+#endif
+
+/* The corresponding word size */
+#define SIZE_SZ                (sizeof(INTERNAL_SIZE_T))
+
+
+
+/*
+  MALLOC_ALIGNMENT is the minimum alignment for malloc'ed chunks.
+  It must be a power of two at least 2 * SIZE_SZ, even on machines
+  for which smaller alignments would suffice. It may be defined as
+  larger than this though. Note however that code and data structures
+  are optimized for the case of 8-byte alignment.
+*/
+
+
+#ifndef MALLOC_ALIGNMENT
+#define MALLOC_ALIGNMENT       (2 * SIZE_SZ)
+#endif
+
+/* The corresponding bit mask value */
+#define MALLOC_ALIGN_MASK      (MALLOC_ALIGNMENT - 1)
+
+
+
+/*
+  REALLOC_ZERO_BYTES_FREES should be set if a call to
+  realloc with zero bytes should be the same as a call to free.
+  Some people think it should. Otherwise, since this malloc
+  returns a unique pointer for malloc(0), so does realloc(p, 0).
+*/
+
+/*   #define REALLOC_ZERO_BYTES_FREES */
+
+/*
+  TRIM_FASTBINS controls whether free() of a very small chunk can
+  immediately lead to trimming. Setting to true (1) can reduce memory
+  footprint, but will almost always slow down programs that use a lot
+  of small chunks.
+
+  Define this only if you are willing to give up some speed to more
+  aggressively reduce system-level memory footprint when releasing
+  memory in programs that use many small chunks.  You can get
+  essentially the same effect by setting MXFAST to 0, but this can
+  lead to even greater slowdowns in programs using many small chunks.
+  TRIM_FASTBINS is an in-between compile-time option, that disables
+  only those chunks bordering topmost memory from being placed in
+  fastbins.
+*/
+
+#ifndef TRIM_FASTBINS
+#define TRIM_FASTBINS  0
+#endif
+
+
+/*
+  USE_DL_PREFIX will prefix all public routines with the string 'dl'.
+  This is necessary when you only want to use this malloc in one part 
+  of a program, using your regular system malloc elsewhere.
+*/
+ #define USE_DL_PREFIX
+
+
+/*
+  USE_MALLOC_LOCK causes wrapper functions to surround each
+  callable routine with pthread mutex lock/unlock.
+
+  USE_MALLOC_LOCK forces USE_PUBLIC_MALLOC_WRAPPERS to be defined
+*/
+
+
+/* #define USE_MALLOC_LOCK */
+
+
+/*
+  If USE_PUBLIC_MALLOC_WRAPPERS is defined, every public routine is
+  actually a wrapper function that first calls MALLOC_PREACTION, then
+  calls the internal routine, and follows it with
+  MALLOC_POSTACTION. This is needed for locking, but you can also use
+  this, without USE_MALLOC_LOCK, for purposes of interception,
+  instrumentation, etc. It is a sad fact that using wrappers often
+  noticeably degrades performance of malloc-intensive programs.
+*/
+
+#ifdef USE_MALLOC_LOCK
+#define USE_PUBLIC_MALLOC_WRAPPERS
+#else
+/* #define USE_PUBLIC_MALLOC_WRAPPERS */
+#endif
+
+
+/* 
+   Two-phase name translation.
+   All of the actual routines are given mangled names.
+   When wrappers are used, they become the public callable versions.
+   When DL_PREFIX is used, the callable names are prefixed.
+*/
+
+#ifndef USE_PUBLIC_MALLOC_WRAPPERS
+#define cALLOc      public_cALLOc
+#define fREe        public_fREe
+#define cFREe       public_cFREe
+#define mALLOc      public_mALLOc
+#define mEMALIGn    public_mEMALIGn
+#define rEALLOc     public_rEALLOc
+#define vALLOc      public_vALLOc
+#define pVALLOc     public_pVALLOc
+#define mALLINFo    public_mALLINFo
+#define mALLOPt     public_mALLOPt
+#define mTRIm       public_mTRIm
+#define mSTATs      public_mSTATs
+#define mUSABLe     public_mUSABLe
+#define iCALLOc     public_iCALLOc
+#define iCOMALLOc   public_iCOMALLOc
+#endif
+
+#ifdef USE_DL_PREFIX
+#define public_cALLOc    pthread_calloc
+#define public_fREe      pthread_free
+#define public_cFREe     pthread_cfree
+#define public_mALLOc    pthread_malloc
+#define public_mEMALIGn  pthread_memalign
+#define public_rEALLOc   pthread_realloc
+#define public_vALLOc    pthread_valloc
+#define public_pVALLOc   pthread_pvalloc
+#define public_mALLINFo  pthread_mallinfo
+#define public_mALLOPt   pthread_mallopt
+#define public_mTRIm     pthread_malloc_trim
+#define public_mSTATs    pthread_malloc_stats
+#define public_mUSABLe   pthread_malloc_usable_size
+#define public_iCALLOc   pthread_independent_calloc
+#define public_iCOMALLOc pthread_independent_comalloc
+#else /* USE_DL_PREFIX */
+#define public_cALLOc    calloc
+#define public_fREe      free
+#define public_cFREe     cfree
+#define public_mALLOc    malloc
+#define public_mEMALIGn  memalign
+#define public_rEALLOc   realloc
+#define public_vALLOc    valloc
+#define public_pVALLOc   pvalloc
+#define public_mALLINFo  mallinfo
+#define public_mALLOPt   mallopt
+#define public_mTRIm     malloc_trim
+#define public_mSTATs    malloc_stats
+#define public_mUSABLe   malloc_usable_size
+#define public_iCALLOc   independent_calloc
+#define public_iCOMALLOc independent_comalloc
+#endif /* USE_DL_PREFIX */
+
+
+/*
+  HAVE_MEMCPY should be defined if you are not otherwise using
+  ANSI STD C, but still have memcpy and memset in your C library
+  and want to use them in calloc and realloc. Otherwise simple
+  macro versions are defined below.
+
+  USE_MEMCPY should be defined as 1 if you actually want to
+  have memset and memcpy called. People report that the macro
+  versions are faster than libc versions on some systems.
+  
+  Even if USE_MEMCPY is set to 1, loops to copy/clear small chunks
+  (of <= 36 bytes) are manually unrolled in realloc and calloc.
+*/
+
+#define HAVE_MEMCPY
+
+#ifndef USE_MEMCPY
+#ifdef HAVE_MEMCPY
+#define USE_MEMCPY 1
+#else
+#define USE_MEMCPY 0
+#endif
+#endif
+
+
+#if (__STD_C || defined(HAVE_MEMCPY))
+
+#ifdef WIN32
+/* On Win32 memset and memcpy are already declared in windows.h */
+#else
+#if __STD_C
+void* memset(void*, int, size_t);
+void* memcpy(void*, const void*, size_t);
+#else
+Void_t* memset();
+Void_t* memcpy();
+#endif
+#endif
+#endif
+
+/*
+  MALLOC_FAILURE_ACTION is the action to take before "return 0" when
+  malloc fails to be able to return memory, either because memory is
+  exhausted or because of illegal arguments.
+  
+  By default, sets errno if running on STD_C platform, else does nothing.  
+*/
+
+#ifndef MALLOC_FAILURE_ACTION
+#if __STD_C
+#define MALLOC_FAILURE_ACTION \
+   errno = ENOMEM;
+
+#else
+#define MALLOC_FAILURE_ACTION
+#endif
+#endif
+
+/*
+  MORECORE-related declarations. By default, rely on sbrk
+*/
+
+
+#ifdef LACKS_UNISTD_H
+#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__)
+#if __STD_C
+extern Void_t*     sbrk(ptrdiff_t);
+#else
+extern Void_t*     sbrk();
+#endif
+#endif
+#endif
+
+/*
+  MORECORE is the name of the routine to call to obtain more memory
+  from the system.  See below for general guidance on writing
+  alternative MORECORE functions, as well as a version for WIN32 and a
+  sample version for pre-OSX macos.
+*/
+
+#ifndef MORECORE
+#define MORECORE sbrk
+#endif
+
+/*
+  MORECORE_FAILURE is the value returned upon failure of MORECORE
+  as well as mmap. Since it cannot be an otherwise valid memory address,
+  and must reflect values of standard sys calls, you probably ought not
+  try to redefine it.
+*/
+
+#ifndef MORECORE_FAILURE
+#define MORECORE_FAILURE (-1)
+#endif
+
+/*
+  If MORECORE_CONTIGUOUS is true, take advantage of fact that
+  consecutive calls to MORECORE with positive arguments always return
+  contiguous increasing addresses.  This is true of unix sbrk.  Even
+  if not defined, when regions happen to be contiguous, malloc will
+  permit allocations spanning regions obtained from different
+  calls. But defining this when applicable enables some stronger
+  consistency checks and space efficiencies. 
+*/
+
+#ifndef MORECORE_CONTIGUOUS
+#define MORECORE_CONTIGUOUS 1
+#endif
+
+/*
+  Define MORECORE_CANNOT_TRIM if your version of MORECORE
+  cannot release space back to the system when given negative
+  arguments. This is generally necessary only if you are using
+  a hand-crafted MORECORE function that cannot handle negative arguments.
+*/
+
+/* #define MORECORE_CANNOT_TRIM */
+
+
+/*
+  Define HAVE_MMAP as true to optionally make malloc() use mmap() to
+  allocate very large blocks.  These will be returned to the
+  operating system immediately after a free(). Also, if mmap
+  is available, it is used as a backup strategy in cases where
+  MORECORE fails to provide space from system.
+
+  This malloc is best tuned to work with mmap for large requests.
+  If you do not have mmap, operations involving very large chunks (1MB
+  or so) may be slower than you'd like.
+*/
+
+#ifndef HAVE_MMAP
+#define HAVE_MMAP 1
+#endif
+
+#if HAVE_MMAP
+/* 
+   Standard unix mmap using /dev/zero clears memory so calloc doesn't
+   need to.
+*/
+
+#ifndef MMAP_CLEARS
+#define MMAP_CLEARS 1
+#endif
+
+#else /* no mmap */
+#ifndef MMAP_CLEARS
+#define MMAP_CLEARS 0
+#endif
+#endif
+
+
+/* 
+   MMAP_AS_MORECORE_SIZE is the minimum mmap size argument to use if
+   sbrk fails, and mmap is used as a backup (which is done only if
+   HAVE_MMAP).  The value must be a multiple of page size.  This
+   backup strategy generally applies only when systems have "holes" in
+   address space, so sbrk cannot perform contiguous expansion, but
+   there is still space available on system.  On systems for which
+   this is known to be useful (i.e. most linux kernels), this occurs
+   only when programs allocate huge amounts of memory.  Between this,
+   and the fact that mmap regions tend to be limited, the size should
+   be large, to avoid too many mmap calls and thus avoid running out
+   of kernel resources.
+*/
+
+#ifndef MMAP_AS_MORECORE_SIZE
+#define MMAP_AS_MORECORE_SIZE (1024 * 1024)
+#endif
+
+/*
+  Define HAVE_MREMAP to make realloc() use mremap() to re-allocate
+  large blocks.  This is currently only possible on Linux with
+  kernel versions newer than 1.3.77.
+*/
+
+#ifndef HAVE_MREMAP
+#ifdef linux
+#define HAVE_MREMAP 1
+#else
+#define HAVE_MREMAP 0
+#endif
+
+#endif /* HAVE_MMAP */
+
+
+/*
+  The system page size. To the extent possible, this malloc manages
+  memory from the system in page-size units.  Note that this value is
+  cached during initialization into a field of malloc_state. So even
+  if malloc_getpagesize is a function, it is only called once.
+
+  The following mechanics for getpagesize were adapted from bsd/gnu
+  getpagesize.h. If none of the system-probes here apply, a value of
+  4096 is used, which should be OK: If they don't apply, then using
+  the actual value probably doesn't impact performance.
+*/
+
+
+#ifndef malloc_getpagesize
+
+#ifndef LACKS_UNISTD_H
+#  include <unistd.h>
+#endif
+
+#  ifdef _SC_PAGESIZE         /* some SVR4 systems omit an underscore */
+#    ifndef _SC_PAGE_SIZE
+#      define _SC_PAGE_SIZE _SC_PAGESIZE
+#    endif
+#  endif
+
+#  ifdef _SC_PAGE_SIZE
+#    define malloc_getpagesize sysconf(_SC_PAGE_SIZE)
+#  else
+#    if defined(BSD) || defined(DGUX) || defined(HAVE_GETPAGESIZE)
+       extern size_t getpagesize();
+#      define malloc_getpagesize getpagesize()
+#    else
+#      ifdef WIN32 /* use supplied emulation of getpagesize */
+#        define malloc_getpagesize getpagesize() 
+#      else
+#        ifndef LACKS_SYS_PARAM_H
+#          include <sys/param.h>
+#        endif
+#        ifdef EXEC_PAGESIZE
+#          define malloc_getpagesize EXEC_PAGESIZE
+#        else
+#          ifdef NBPG
+#            ifndef CLSIZE
+#              define malloc_getpagesize NBPG
+#            else
+#              define malloc_getpagesize (NBPG * CLSIZE)
+#            endif
+#          else
+#            ifdef NBPC
+#              define malloc_getpagesize NBPC
+#            else
+#              ifdef PAGESIZE
+#                define malloc_getpagesize PAGESIZE
+#              else /* just guess */
+#                define malloc_getpagesize (4096) 
+#              endif
+#            endif
+#          endif
+#        endif
+#      endif
+#    endif
+#  endif
+#endif
+
+/*
+  This version of malloc supports the standard SVID/XPG mallinfo
+  routine that returns a struct containing usage properties and
+  statistics. It should work on any SVID/XPG compliant system that has
+  a /usr/include/malloc.h defining struct mallinfo. (If you'd like to
+  install such a thing yourself, cut out the preliminary declarations
+  as described above and below and save them in a malloc.h file. But
+  there's no compelling reason to bother to do this.)
+
+  The main declaration needed is the mallinfo struct that is returned
+  (by-copy) by mallinfo().  The SVID/XPG malloinfo struct contains a
+  bunch of fields that are not even meaningful in this version of
+  malloc.  These fields are are instead filled by mallinfo() with
+  other numbers that might be of interest.
+
+  HAVE_USR_INCLUDE_MALLOC_H should be set if you have a
+  /usr/include/malloc.h file that includes a declaration of struct
+  mallinfo.  If so, it is included; else an SVID2/XPG2 compliant
+  version is declared below.  These must be precisely the same for
+  mallinfo() to work.  The original SVID version of this struct,
+  defined on most systems with mallinfo, declares all fields as
+  ints. But some others define as unsigned long. If your system
+  defines the fields using a type of different width than listed here,
+  you must #include your system version and #define
+  HAVE_USR_INCLUDE_MALLOC_H.
+*/
+
+/* #define HAVE_USR_INCLUDE_MALLOC_H */
+
+#ifdef HAVE_USR_INCLUDE_MALLOC_H
+#include "/usr/include/malloc.h"
+#else
+
+/* SVID2/XPG mallinfo structure */
+
+struct mallinfo {
+  int arena;    /* non-mmapped space allocated from system */
+  int ordblks;  /* number of free chunks */
+  int smblks;   /* number of fastbin blocks */
+  int hblks;    /* number of mmapped regions */
+  int hblkhd;   /* space in mmapped regions */
+  int usmblks;  /* maximum total allocated space */
+  int fsmblks;  /* space available in freed fastbin blocks */
+  int uordblks; /* total allocated space */
+  int fordblks; /* total free space */
+  int keepcost; /* top-most, releasable (via malloc_trim) space */
+};
+
+/*
+  SVID/XPG defines four standard parameter numbers for mallopt,
+  normally defined in malloc.h.  Only one of these (M_MXFAST) is used
+  in this malloc. The others (M_NLBLKS, M_GRAIN, M_KEEP) don't apply,
+  so setting them has no effect. But this malloc also supports other
+  options in mallopt described below.
+*/
+#endif
+
+
+/* ---------- description of public routines ------------ */
+
+/*
+  malloc(size_t n)
+  Returns a pointer to a newly allocated chunk of at least n bytes, or null
+  if no space is available. Additionally, on failure, errno is
+  set to ENOMEM on ANSI C systems.
+
+  If n is zero, malloc returns a minumum-sized chunk. (The minimum
+  size is 16 bytes on most 32bit systems, and 24 or 32 bytes on 64bit
+  systems.)  On most systems, size_t is an unsigned type, so calls
+  with negative arguments are interpreted as requests for huge amounts
+  of space, which will often fail. The maximum supported value of n
+  differs across systems, but is in all cases less than the maximum
+  representable value of a size_t.
+*/
+#if __STD_C
+Void_t*  public_mALLOc(size_t);
+#else
+Void_t*  public_mALLOc();
+#endif
+
+/*
+  free(Void_t* p)
+  Releases the chunk of memory pointed to by p, that had been previously
+  allocated using malloc or a related routine such as realloc.
+  It has no effect if p is null. It can have arbitrary (i.e., bad!)
+  effects if p has already been freed.
+
+  Unless disabled (using mallopt), freeing very large spaces will
+  when possible, automatically trigger operations that give
+  back unused memory to the system, thus reducing program footprint.
+*/
+#if __STD_C
+void     public_fREe(Void_t*);
+#else
+void     public_fREe();
+#endif
+
+/*
+  calloc(size_t n_elements, size_t element_size);
+  Returns a pointer to n_elements * element_size bytes, with all locations
+  set to zero.
+*/
+#if __STD_C
+Void_t*  public_cALLOc(size_t, size_t);
+#else
+Void_t*  public_cALLOc();
+#endif
+
+/*
+  realloc(Void_t* p, size_t n)
+  Returns a pointer to a chunk of size n that contains the same data
+  as does chunk p up to the minimum of (n, p's size) bytes, or null
+  if no space is available. 
+
+  The returned pointer may or may not be the same as p. The algorithm
+  prefers extending p when possible, otherwise it employs the
+  equivalent of a malloc-copy-free sequence.
+
+  If p is null, realloc is equivalent to malloc.  
+
+  If space is not available, realloc returns null, errno is set (if on
+  ANSI) and p is NOT freed.
+
+  if n is for fewer bytes than already held by p, the newly unused
+  space is lopped off and freed if possible.  Unless the #define
+  REALLOC_ZERO_BYTES_FREES is set, realloc with a size argument of
+  zero (re)allocates a minimum-sized chunk.
+
+  Large chunks that were internally obtained via mmap will always
+  be reallocated using malloc-copy-free sequences unless
+  the system supports MREMAP (currently only linux).
+
+  The old unix realloc convention of allowing the last-free'd chunk
+  to be used as an argument to realloc is not supported.
+*/
+#if __STD_C
+Void_t*  public_rEALLOc(Void_t*, size_t);
+#else
+Void_t*  public_rEALLOc();
+#endif
+
+/*
+  memalign(size_t alignment, size_t n);
+  Returns a pointer to a newly allocated chunk of n bytes, aligned
+  in accord with the alignment argument.
+
+  The alignment argument should be a power of two. If the argument is
+  not a power of two, the nearest greater power is used.
+  8-byte alignment is guaranteed by normal malloc calls, so don't
+  bother calling memalign with an argument of 8 or less.
+
+  Overreliance on memalign is a sure way to fragment space.
+*/
+#if __STD_C
+Void_t*  public_mEMALIGn(size_t, size_t);
+#else
+Void_t*  public_mEMALIGn();
+#endif
+
+/*
+  valloc(size_t n);
+  Equivalent to memalign(pagesize, n), where pagesize is the page
+  size of the system. If the pagesize is unknown, 4096 is used.
+*/
+#if __STD_C
+Void_t*  public_vALLOc(size_t);
+#else
+Void_t*  public_vALLOc();
+#endif
+
+
+
+/*
+  mallopt(int parameter_number, int parameter_value)
+  Sets tunable parameters The format is to provide a
+  (parameter-number, parameter-value) pair.  mallopt then sets the
+  corresponding parameter to the argument value if it can (i.e., so
+  long as the value is meaningful), and returns 1 if successful else
+  0.  SVID/XPG/ANSI defines four standard param numbers for mallopt,
+  normally defined in malloc.h.  Only one of these (M_MXFAST) is used
+  in this malloc. The others (M_NLBLKS, M_GRAIN, M_KEEP) don't apply,
+  so setting them has no effect. But this malloc also supports four
+  other options in mallopt. See below for details.  Briefly, supported
+  parameters are as follows (listed defaults are for "typical"
+  configurations).
+
+  Symbol            param #   default    allowed param values
+  M_MXFAST          1         64         0-80  (0 disables fastbins)
+  M_TRIM_THRESHOLD -1         256*1024   any   (-1U disables trimming)
+  M_TOP_PAD        -2         0          any  
+  M_MMAP_THRESHOLD -3         256*1024   any   (or 0 if no MMAP support)
+  M_MMAP_MAX       -4         65536      any   (0 disables use of mmap)
+*/
+#if __STD_C
+int      public_mALLOPt(int, int);
+#else
+int      public_mALLOPt();
+#endif
+
+
+/*
+  mallinfo()
+  Returns (by copy) a struct containing various summary statistics:
+
+  arena:     current total non-mmapped bytes allocated from system 
+  ordblks:   the number of free chunks 
+  smblks:    the number of fastbin blocks (i.e., small chunks that
+               have been freed but not use resused or consolidated)
+  hblks:     current number of mmapped regions 
+  hblkhd:    total bytes held in mmapped regions 
+  usmblks:   the maximum total allocated space. This will be greater
+                than current total if trimming has occurred.
+  fsmblks:   total bytes held in fastbin blocks 
+  uordblks:  current total allocated space (normal or mmapped)
+  fordblks:  total free space 
+  keepcost:  the maximum number of bytes that could ideally be released
+               back to system via malloc_trim. ("ideally" means that
+               it ignores page restrictions etc.)
+
+  Because these fields are ints, but internal bookkeeping may
+  be kept as longs, the reported values may wrap around zero and 
+  thus be inaccurate.
+*/
+#if __STD_C
+struct mallinfo public_mALLINFo(void);
+#else
+struct mallinfo public_mALLINFo();
+#endif
+
+/*
+  independent_calloc(size_t n_elements, size_t element_size, Void_t* chunks[]);
+
+  independent_calloc is similar to calloc, but instead of returning a
+  single cleared space, it returns an array of pointers to n_elements
+  independent elements that can hold contents of size elem_size, each
+  of which starts out cleared, and can be independently freed,
+  realloc'ed etc. The elements are guaranteed to be adjacently
+  allocated (this is not guaranteed to occur with multiple callocs or
+  mallocs), which may also improve cache locality in some
+  applications.
+
+  The "chunks" argument is optional (i.e., may be null, which is
+  probably the most typical usage). If it is null, the returned array
+  is itself dynamically allocated and should also be freed when it is
+  no longer needed. Otherwise, the chunks array must be of at least
+  n_elements in length. It is filled in with the pointers to the
+  chunks.
+
+  In either case, independent_calloc returns this pointer array, or
+  null if the allocation failed.  If n_elements is zero and "chunks"
+  is null, it returns a chunk representing an array with zero elements
+  (which should be freed if not wanted).
+
+  Each element must be individually freed when it is no longer
+  needed. If you'd like to instead be able to free all at once, you
+  should instead use regular calloc and assign pointers into this
+  space to represent elements.  (In this case though, you cannot
+  independently free elements.)
+  
+  independent_calloc simplifies and speeds up implementations of many
+  kinds of pools.  It may also be useful when constructing large data
+  structures that initially have a fixed number of fixed-sized nodes,
+  but the number is not known at compile time, and some of the nodes
+  may later need to be freed. For example:
+
+  struct Node { int item; struct Node* next; };
+  
+  struct Node* build_list() {
+    struct Node** pool;
+    int n = read_number_of_nodes_needed();
+    if (n <= 0) return 0;
+    pool = (struct Node**)(independent_calloc(n, sizeof(struct Node), 0);
+    if (pool == 0) die(); 
+    // organize into a linked list... 
+    struct Node* first = pool[0];
+    for (i = 0; i < n-1; ++i) 
+      pool[i]->next = pool[i+1];
+    free(pool);     // Can now free the array (or not, if it is needed later)
+    return first;
+  }
+*/
+#if __STD_C
+Void_t** public_iCALLOc(size_t, size_t, Void_t**);
+#else
+Void_t** public_iCALLOc();
+#endif
+
+/*
+  independent_comalloc(size_t n_elements, size_t sizes[], Void_t* chunks[]);
+
+  independent_comalloc allocates, all at once, a set of n_elements
+  chunks with sizes indicated in the "sizes" array.    It returns
+  an array of pointers to these elements, each of which can be
+  independently freed, realloc'ed etc. The elements are guaranteed to
+  be adjacently allocated (this is not guaranteed to occur with
+  multiple callocs or mallocs), which may also improve cache locality
+  in some applications.
+
+  The "chunks" argument is optional (i.e., may be null). If it is null
+  the returned array is itself dynamically allocated and should also
+  be freed when it is no longer needed. Otherwise, the chunks array
+  must be of at least n_elements in length. It is filled in with the
+  pointers to the chunks.
+
+  In either case, independent_comalloc returns this pointer array, or
+  null if the allocation failed.  If n_elements is zero and chunks is
+  null, it returns a chunk representing an array with zero elements
+  (which should be freed if not wanted).
+  
+  Each element must be individually freed when it is no longer
+  needed. If you'd like to instead be able to free all at once, you
+  should instead use a single regular malloc, and assign pointers at
+  particular offsets in the aggregate space. (In this case though, you 
+  cannot independently free elements.)
+
+  independent_comallac differs from independent_calloc in that each
+  element may have a different size, and also that it does not
+  automatically clear elements.
+
+  independent_comalloc can be used to speed up allocation in cases
+  where several structs or objects must always be allocated at the
+  same time.  For example:
+
+  struct Head { ... }
+  struct Foot { ... }
+
+  void send_message(char* msg) {
+    int msglen = strlen(msg);
+    size_t sizes[3] = { sizeof(struct Head), msglen, sizeof(struct Foot) };
+    void* chunks[3];
+    if (independent_comalloc(3, sizes, chunks) == 0)
+      die();
+    struct Head* head = (struct Head*)(chunks[0]);
+    char*        body = (char*)(chunks[1]);
+    struct Foot* foot = (struct Foot*)(chunks[2]);
+    // ...
+  }
+
+  In general though, independent_comalloc is worth using only for
+  larger values of n_elements. For small values, you probably won't
+  detect enough difference from series of malloc calls to bother.
+
+  Overuse of independent_comalloc can increase overall memory usage,
+  since it cannot reuse existing noncontiguous small chunks that
+  might be available for some of the elements.
+*/
+#if __STD_C
+Void_t** public_iCOMALLOc(size_t, size_t*, Void_t**);
+#else
+Void_t** public_iCOMALLOc();
+#endif
+
+
+/*
+  pvalloc(size_t n);
+  Equivalent to valloc(minimum-page-that-holds(n)), that is,
+  round up n to nearest pagesize.
+ */
+#if __STD_C
+Void_t*  public_pVALLOc(size_t);
+#else
+Void_t*  public_pVALLOc();
+#endif
+
+/*
+  cfree(Void_t* p);
+  Equivalent to free(p).
+
+  cfree is needed/defined on some systems that pair it with calloc,
+  for odd historical reasons (such as: cfree is used in example 
+  code in the first edition of K&R).
+*/
+#if __STD_C
+void     public_cFREe(Void_t*);
+#else
+void     public_cFREe();
+#endif
+
+/*
+  malloc_trim(size_t pad);
+
+  If possible, gives memory back to the system (via negative
+  arguments to sbrk) if there is unused memory at the `high' end of
+  the malloc pool. You can call this after freeing large blocks of
+  memory to potentially reduce the system-level memory requirements
+  of a program. However, it cannot guarantee to reduce memory. Under
+  some allocation patterns, some large free blocks of memory will be
+  locked between two used chunks, so they cannot be given back to
+  the system.
+  
+  The `pad' argument to malloc_trim represents the amount of free
+  trailing space to leave untrimmed. If this argument is zero,
+  only the minimum amount of memory to maintain internal data
+  structures will be left (one page or less). Non-zero arguments
+  can be supplied to maintain enough trailing space to service
+  future expected allocations without having to re-obtain memory
+  from the system.
+  
+  Malloc_trim returns 1 if it actually released any memory, else 0.
+  On systems that do not support "negative sbrks", it will always
+  rreturn 0.
+*/
+#if __STD_C
+int      public_mTRIm(size_t);
+#else
+int      public_mTRIm();
+#endif
+
+/*
+  malloc_usable_size(Void_t* p);
+
+  Returns the number of bytes you can actually use in
+  an allocated chunk, which may be more than you requested (although
+  often not) due to alignment and minimum size constraints.
+  You can use this many bytes without worrying about
+  overwriting other allocated objects. This is not a particularly great
+  programming practice. malloc_usable_size can be more useful in
+  debugging and assertions, for example:
+
+  p = malloc(n);
+  assert(malloc_usable_size(p) >= 256);
+
+*/
+#if __STD_C
+size_t   public_mUSABLe(Void_t*);
+#else
+size_t   public_mUSABLe();
+#endif
+
+/*
+  malloc_stats();
+  Prints on stderr the amount of space obtained from the system (both
+  via sbrk and mmap), the maximum amount (which may be more than
+  current if malloc_trim and/or munmap got called), and the current
+  number of bytes allocated via malloc (or realloc, etc) but not yet
+  freed. Note that this is the number of bytes allocated, not the
+  number requested. It will be larger than the number requested
+  because of alignment and bookkeeping overhead. Because it includes
+  alignment wastage as being in use, this figure may be greater than
+  zero even when no user-level chunks are allocated.
+
+  The reported current and maximum system memory can be inaccurate if
+  a program makes other calls to system memory allocation functions
+  (normally sbrk) outside of malloc.
+
+  malloc_stats prints only the most commonly interesting statistics.
+  More information can be obtained by calling mallinfo.
+
+*/
+#if __STD_C
+void     public_mSTATs();
+#else
+void     public_mSTATs();
+#endif
+
+/* mallopt tuning options */
+
+/*
+  M_MXFAST is the maximum request size used for "fastbins", special bins
+  that hold returned chunks without consolidating their spaces. This
+  enables future requests for chunks of the same size to be handled
+  very quickly, but can increase fragmentation, and thus increase the
+  overall memory footprint of a program.
+
+  This malloc manages fastbins very conservatively yet still
+  efficiently, so fragmentation is rarely a problem for values less
+  than or equal to the default.  The maximum supported value of MXFAST
+  is 80. You wouldn't want it any higher than this anyway.  Fastbins
+  are designed especially for use with many small structs, objects or
+  strings -- the default handles structs/objects/arrays with sizes up
+  to 16 4byte fields, or small strings representing words, tokens,
+  etc. Using fastbins for larger objects normally worsens
+  fragmentation without improving speed.
+
+  M_MXFAST is set in REQUEST size units. It is internally used in
+  chunksize units, which adds padding and alignment.  You can reduce
+  M_MXFAST to 0 to disable all use of fastbins.  This causes the malloc
+  algorithm to be a closer approximation of fifo-best-fit in all cases,
+  not just for larger requests, but will generally cause it to be
+  slower.
+*/
+
+
+/* M_MXFAST is a standard SVID/XPG tuning option, usually listed in malloc.h */
+#ifndef M_MXFAST
+#define M_MXFAST            1    
+#endif
+
+#ifndef DEFAULT_MXFAST
+#define DEFAULT_MXFAST     64
+#endif
+
+
+/*
+  M_TRIM_THRESHOLD is the maximum amount of unused top-most memory
+  to keep before releasing via malloc_trim in free().
+
+  Automatic trimming is mainly useful in long-lived programs.
+  Because trimming via sbrk can be slow on some systems, and can
+  sometimes be wasteful (in cases where programs immediately
+  afterward allocate more large chunks) the value should be high
+  enough so that your overall system performance would improve by
+  releasing this much memory.
+
+  The trim threshold and the mmap control parameters (see below)
+  can be traded off with one another. Trimming and mmapping are
+  two different ways of releasing unused memory back to the
+  system. Between these two, it is often possible to keep
+  system-level demands of a long-lived program down to a bare
+  minimum. For example, in one test suite of sessions measuring
+  the XF86 X server on Linux, using a trim threshold of 128K and a
+  mmap threshold of 192K led to near-minimal long term resource
+  consumption.
+
+  If you are using this malloc in a long-lived program, it should
+  pay to experiment with these values.  As a rough guide, you
+  might set to a value close to the average size of a process
+  (program) running on your system.  Releasing this much memory
+  would allow such a process to run in memory.  Generally, it's
+  worth it to tune for trimming rather tham memory mapping when a
+  program undergoes phases where several large chunks are
+  allocated and released in ways that can reuse each other's
+  storage, perhaps mixed with phases where there are no such
+  chunks at all.  And in well-behaved long-lived programs,
+  controlling release of large blocks via trimming versus mapping
+  is usually faster.
+
+  However, in most programs, these parameters serve mainly as
+  protection against the system-level effects of carrying around
+  massive amounts of unneeded memory. Since frequent calls to
+  sbrk, mmap, and munmap otherwise degrade performance, the default
+  parameters are set to relatively high values that serve only as
+  safeguards.
+
+  The trim value must be greater than page size to have any useful
+  effect.  To disable trimming completely, you can set to 
+  (unsigned long)(-1)
+
+  Trim settings interact with fastbin (MXFAST) settings: Unless
+  TRIM_FASTBINS is defined, automatic trimming never takes place upon
+  freeing a chunk with size less than or equal to MXFAST. Trimming is
+  instead delayed until subsequent freeing of larger chunks. However,
+  you can still force an attempted trim by calling malloc_trim.
+
+  Also, trimming is not generally possible in cases where
+  the main arena is obtained via mmap.
+
+  Note that the trick some people use of mallocing a huge space and
+  then freeing it at program startup, in an attempt to reserve system
+  memory, doesn't have the intended effect under automatic trimming,
+  since that memory will immediately be returned to the system.
+*/
+
+#define M_TRIM_THRESHOLD       -1
+
+#ifndef DEFAULT_TRIM_THRESHOLD
+#define DEFAULT_TRIM_THRESHOLD (256 * 1024)
+#endif
+
+/*
+  M_TOP_PAD is the amount of extra `padding' space to allocate or
+  retain whenever sbrk is called. It is used in two ways internally:
+
+  * When sbrk is called to extend the top of the arena to satisfy
+  a new malloc request, this much padding is added to the sbrk
+  request.
+
+  * When malloc_trim is called automatically from free(),
+  it is used as the `pad' argument.
+
+  In both cases, the actual amount of padding is rounded
+  so that the end of the arena is always a system page boundary.
+
+  The main reason for using padding is to avoid calling sbrk so
+  often. Having even a small pad greatly reduces the likelihood
+  that nearly every malloc request during program start-up (or
+  after trimming) will invoke sbrk, which needlessly wastes
+  time.
+
+  Automatic rounding-up to page-size units is normally sufficient
+  to avoid measurable overhead, so the default is 0.  However, in
+  systems where sbrk is relatively slow, it can pay to increase
+  this value, at the expense of carrying around more memory than
+  the program needs.
+*/
+
+#define M_TOP_PAD              -2
+
+#ifndef DEFAULT_TOP_PAD
+#define DEFAULT_TOP_PAD        (0)
+#endif
+
+/*
+  M_MMAP_THRESHOLD is the request size threshold for using mmap()
+  to service a request. Requests of at least this size that cannot
+  be allocated using already-existing space will be serviced via mmap.
+  (If enough normal freed space already exists it is used instead.)
+
+  Using mmap segregates relatively large chunks of memory so that
+  they can be individually obtained and released from the host
+  system. A request serviced through mmap is never reused by any
+  other request (at least not directly; the system may just so
+  happen to remap successive requests to the same locations).
+
+  Segregating space in this way has the benefits that:
+
+   1. Mmapped space can ALWAYS be individually released back 
+      to the system, which helps keep the system level memory 
+      demands of a long-lived program low. 
+   2. Mapped memory can never become `locked' between
+      other chunks, as can happen with normally allocated chunks, which
+      means that even trimming via malloc_trim would not release them.
+   3. On some systems with "holes" in address spaces, mmap can obtain
+      memory that sbrk cannot.
+
+  However, it has the disadvantages that:
+
+   1. The space cannot be reclaimed, consolidated, and then
+      used to service later requests, as happens with normal chunks.
+   2. It can lead to more wastage because of mmap page alignment
+      requirements
+   3. It causes malloc performance to be more dependent on host
+      system memory management support routines which may vary in
+      implementation quality and may impose arbitrary
+      limitations. Generally, servicing a request via normal
+      malloc steps is faster than going through a system's mmap.
+
+  The advantages of mmap nearly always outweigh disadvantages for
+  "large" chunks, but the value of "large" varies across systems.  The
+  default is an empirically derived value that works well in most
+  systems.
+*/
+
+#define M_MMAP_THRESHOLD      -3
+
+#ifndef DEFAULT_MMAP_THRESHOLD
+#define DEFAULT_MMAP_THRESHOLD (256 * 1024)
+#endif
+
+/*
+  M_MMAP_MAX is the maximum number of requests to simultaneously
+  service using mmap. This parameter exists because
+. Some systems have a limited number of internal tables for
+  use by mmap, and using more than a few of them may degrade
+  performance.
+
+  The default is set to a value that serves only as a safeguard.
+  Setting to 0 disables use of mmap for servicing large requests.  If
+  HAVE_MMAP is not set, the default value is 0, and attempts to set it
+  to non-zero values in mallopt will fail.
+*/
+
+#define M_MMAP_MAX             -4
+
+#ifndef DEFAULT_MMAP_MAX
+#if HAVE_MMAP
+#define DEFAULT_MMAP_MAX       (65536)
+#else
+#define DEFAULT_MMAP_MAX       (0)
+#endif
+#endif
+
+#ifdef __cplusplus
+};  /* end of extern "C" */
+#endif
+
+/* 
+  ========================================================================
+  To make a fully customizable malloc.h header file, cut everything
+  above this line, put into file malloc.h, edit to suit, and #include it 
+  on the next line, as well as in programs that use this malloc.
+  ========================================================================
+*/
+
+/* #include "malloc.h" */
+
+/* --------------------- public wrappers ---------------------- */
+
+#ifdef USE_PUBLIC_MALLOC_WRAPPERS
+
+/* Declare all routines as internal */
+#if __STD_C
+static Void_t*  mALLOc(size_t);
+static void     fREe(Void_t*);
+static Void_t*  rEALLOc(Void_t*, size_t);
+static Void_t*  mEMALIGn(size_t, size_t);
+static Void_t*  vALLOc(size_t);
+static Void_t*  pVALLOc(size_t);
+static Void_t*  cALLOc(size_t, size_t);
+static Void_t** iCALLOc(size_t, size_t, Void_t**);
+static Void_t** iCOMALLOc(size_t, size_t*, Void_t**);
+static void     cFREe(Void_t*);
+static int      mTRIm(size_t);
+static size_t   mUSABLe(Void_t*);
+static void     mSTATs();
+static int      mALLOPt(int, int);
+static struct mallinfo mALLINFo(void);
+#else
+static Void_t*  mALLOc();
+static void     fREe();
+static Void_t*  rEALLOc();
+static Void_t*  mEMALIGn();
+static Void_t*  vALLOc();
+static Void_t*  pVALLOc();
+static Void_t*  cALLOc();
+static Void_t** iCALLOc();
+static Void_t** iCOMALLOc();
+static void     cFREe();
+static int      mTRIm();
+static size_t   mUSABLe();
+static void     mSTATs();
+static int      mALLOPt();
+static struct mallinfo mALLINFo();
+#endif
+
+/*
+  MALLOC_PREACTION and MALLOC_POSTACTION should be
+  defined to return 0 on success, and nonzero on failure.
+  The return value of MALLOC_POSTACTION is currently ignored
+  in wrapper functions since there is no reasonable default
+  action to take on failure.
+*/
+
+
+#ifdef USE_MALLOC_LOCK
+
+#ifdef WIN32
+
+static int mALLOC_MUTEx;
+#define MALLOC_PREACTION   slwait(&mALLOC_MUTEx)
+#define MALLOC_POSTACTION  slrelease(&mALLOC_MUTEx)
+
+#else
+
+#include <pthread.h>
+
+static pthread_mutex_t mALLOC_MUTEx = PTHREAD_MUTEX_INITIALIZER;
+
+#define MALLOC_PREACTION   pthread_mutex_lock(&mALLOC_MUTEx)
+#define MALLOC_POSTACTION  pthread_mutex_unlock(&mALLOC_MUTEx)
+
+#endif /* USE_MALLOC_LOCK */
+
+#else
+
+/* Substitute anything you like for these */
+
+#define MALLOC_PREACTION   (0)
+#define MALLOC_POSTACTION  (0)
+
+#endif
+
+Void_t* public_mALLOc(size_t bytes) {
+  Void_t* m;
+  if (MALLOC_PREACTION != 0) {
+    return 0;
+  }
+  m = mALLOc(bytes);
+  if (MALLOC_POSTACTION != 0) {
+  }
+  return m;
+}
+
+void public_fREe(Void_t* m) {
+  if (MALLOC_PREACTION != 0) {
+    return;
+  }
+  fREe(m);
+  if (MALLOC_POSTACTION != 0) {
+  }
+}
+
+Void_t* public_rEALLOc(Void_t* m, size_t bytes) {
+  if (MALLOC_PREACTION != 0) {
+    return 0;
+  }
+  m = rEALLOc(m, bytes);
+  if (MALLOC_POSTACTION != 0) {
+  }
+  return m;
+}
+
+Void_t* public_mEMALIGn(size_t alignment, size_t bytes) {
+  Void_t* m;
+  if (MALLOC_PREACTION != 0) {
+    return 0;
+  }
+  m = mEMALIGn(alignment, bytes);
+  if (MALLOC_POSTACTION != 0) {
+  }
+  return m;
+}
+
+Void_t* public_vALLOc(size_t bytes) {
+  Void_t* m;
+  if (MALLOC_PREACTION != 0) {
+    return 0;
+  }
+  m = vALLOc(bytes);
+  if (MALLOC_POSTACTION != 0) {
+  }
+  return m;
+}
+
+Void_t* public_pVALLOc(size_t bytes) {
+  Void_t* m;
+  if (MALLOC_PREACTION != 0) {
+    return 0;
+  }
+  m = pVALLOc(bytes);
+  if (MALLOC_POSTACTION != 0) {
+  }
+  return m;
+}
+
+Void_t* public_cALLOc(size_t n, size_t elem_size) {
+  Void_t* m;
+  if (MALLOC_PREACTION != 0) {
+    return 0;
+  }
+  m = cALLOc(n, elem_size);
+  if (MALLOC_POSTACTION != 0) {
+  }
+  return m;
+}
+
+
+Void_t** public_iCALLOc(size_t n, size_t elem_size, Void_t** chunks) {
+  Void_t** m;
+  if (MALLOC_PREACTION != 0) {
+    return 0;
+  }
+  m = iCALLOc(n, elem_size, chunks);
+  if (MALLOC_POSTACTION != 0) {
+  }
+  return m;
+}
+
+Void_t** public_iCOMALLOc(size_t n, size_t sizes[], Void_t** chunks) {
+  Void_t** m;
+  if (MALLOC_PREACTION != 0) {
+    return 0;
+  }
+  m = iCOMALLOc(n, sizes, chunks);
+  if (MALLOC_POSTACTION != 0) {
+  }
+  return m;
+}
+
+void public_cFREe(Void_t* m) {
+  if (MALLOC_PREACTION != 0) {
+    return;
+  }
+  cFREe(m);
+  if (MALLOC_POSTACTION != 0) {
+  }
+}
+
+int public_mTRIm(size_t s) {
+  int result;
+  if (MALLOC_PREACTION != 0) {
+    return 0;
+  }
+  result = mTRIm(s);
+  if (MALLOC_POSTACTION != 0) {
+  }
+  return result;
+}
+
+size_t public_mUSABLe(Void_t* m) {
+  size_t result;
+  if (MALLOC_PREACTION != 0) {
+    return 0;
+  }
+  result = mUSABLe(m);
+  if (MALLOC_POSTACTION != 0) {
+  }
+  return result;
+}
+
+void public_mSTATs() {
+  if (MALLOC_PREACTION != 0) {
+    return;
+  }
+  mSTATs();
+  if (MALLOC_POSTACTION != 0) {
+  }
+}
+
+struct mallinfo public_mALLINFo() {
+  struct mallinfo m;
+  if (MALLOC_PREACTION != 0) {
+    struct mallinfo nm = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+    return nm;
+  }
+  m = mALLINFo();
+  if (MALLOC_POSTACTION != 0) {
+  }
+  return m;
+}
+
+int public_mALLOPt(int p, int v) {
+  int result;
+  if (MALLOC_PREACTION != 0) {
+    return 0;
+  }
+  result = mALLOPt(p, v);
+  if (MALLOC_POSTACTION != 0) {
+  }
+  return result;
+}
+
+#endif
+
+
+
+/* ------------- Optional versions of memcopy ---------------- */
+
+
+#if USE_MEMCPY
+
+/* 
+  Note: memcpy is ONLY invoked with non-overlapping regions,
+  so the (usually slower) memmove is not needed.
+*/
+
+#define MALLOC_COPY(dest, src, nbytes)  memcpy(dest, src, nbytes)
+#define MALLOC_ZERO(dest, nbytes)       memset(dest, 0,   nbytes)
+
+#else /* !USE_MEMCPY */
+
+/* Use Duff's device for good zeroing/copying performance. */
+
+#define MALLOC_ZERO(charp, nbytes)                                            \
+do {                                                                          \
+  INTERNAL_SIZE_T* mzp = (INTERNAL_SIZE_T*)(charp);                           \
+  CHUNK_SIZE_T  mctmp = (nbytes)/sizeof(INTERNAL_SIZE_T);                     \
+  long mcn;                                                                   \
+  if (mctmp < 8) mcn = 0; else { mcn = (mctmp-1)/8; mctmp %= 8; }             \
+  switch (mctmp) {                                                            \
+    case 0: for(;;) { *mzp++ = 0;                                             \
+    case 7:           *mzp++ = 0;                                             \
+    case 6:           *mzp++ = 0;                                             \
+    case 5:           *mzp++ = 0;                                             \
+    case 4:           *mzp++ = 0;                                             \
+    case 3:           *mzp++ = 0;                                             \
+    case 2:           *mzp++ = 0;                                             \
+    case 1:           *mzp++ = 0; if(mcn <= 0) break; mcn--; }                \
+  }                                                                           \
+} while(0)
+
+#define MALLOC_COPY(dest,src,nbytes)                                          \
+do {                                                                          \
+  INTERNAL_SIZE_T* mcsrc = (INTERNAL_SIZE_T*) src;                            \
+  INTERNAL_SIZE_T* mcdst = (INTERNAL_SIZE_T*) dest;                           \
+  CHUNK_SIZE_T  mctmp = (nbytes)/sizeof(INTERNAL_SIZE_T);                     \
+  long mcn;                                                                   \
+  if (mctmp < 8) mcn = 0; else { mcn = (mctmp-1)/8; mctmp %= 8; }             \
+  switch (mctmp) {                                                            \
+    case 0: for(;;) { *mcdst++ = *mcsrc++;                                    \
+    case 7:           *mcdst++ = *mcsrc++;                                    \
+    case 6:           *mcdst++ = *mcsrc++;                                    \
+    case 5:           *mcdst++ = *mcsrc++;                                    \
+    case 4:           *mcdst++ = *mcsrc++;                                    \
+    case 3:           *mcdst++ = *mcsrc++;                                    \
+    case 2:           *mcdst++ = *mcsrc++;                                    \
+    case 1:           *mcdst++ = *mcsrc++; if(mcn <= 0) break; mcn--; }       \
+  }                                                                           \
+} while(0)
+
+#endif
+
+/* ------------------ MMAP support ------------------  */
+
+
+#if HAVE_MMAP
+
+#ifndef LACKS_FCNTL_H
+#include <fcntl.h>
+#endif
+
+#ifndef LACKS_SYS_MMAN_H
+#include <sys/mman.h>
+#endif
+
+#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)
+#define MAP_ANONYMOUS MAP_ANON
+#endif
+
+/* 
+   Nearly all versions of mmap support MAP_ANONYMOUS, 
+   so the following is unlikely to be needed, but is
+   supplied just in case.
+*/
+
+#ifndef MAP_ANONYMOUS
+
+static int dev_zero_fd = -1; /* Cached file descriptor for /dev/zero. */
+
+#define MMAP(addr, size, prot, flags) ((dev_zero_fd < 0) ? \
+ (dev_zero_fd = open("/dev/zero", O_RDWR), \
+  mmap((addr), (size), (prot), (flags), dev_zero_fd, 0)) : \
+   mmap((addr), (size), (prot), (flags), dev_zero_fd, 0))
+
+#else
+
+#define MMAP(addr, size, prot, flags) \
+ (mmap((addr), (size), (prot), (flags)|MAP_ANONYMOUS, -1, 0))
+
+#endif
+
+
+#endif /* HAVE_MMAP */
+
+
+/*
+  -----------------------  Chunk representations -----------------------
+*/
+
+
+/*
+  This struct declaration is misleading (but accurate and necessary).
+  It declares a "view" into memory allowing access to necessary
+  fields at known offsets from a given base. See explanation below.
+*/
+
+struct malloc_chunk {
+
+  INTERNAL_SIZE_T      prev_size;  /* Size of previous chunk (if free).  */
+  INTERNAL_SIZE_T      size;       /* Size in bytes, including overhead. */
+
+  struct malloc_chunk* fd;         /* double links -- used only if free. */
+  struct malloc_chunk* bk;
+};
+
+
+typedef struct malloc_chunk* mchunkptr;
+
+/*
+   malloc_chunk details:
+
+    (The following includes lightly edited explanations by Colin Plumb.)
+
+    Chunks of memory are maintained using a `boundary tag' method as
+    described in e.g., Knuth or Standish.  (See the paper by Paul
+    Wilson ftp://ftp.cs.utexas.edu/pub/garbage/allocsrv.ps for a
+    survey of such techniques.)  Sizes of free chunks are stored both
+    in the front of each chunk and at the end.  This makes
+    consolidating fragmented chunks into bigger chunks very fast.  The
+    size fields also hold bits representing whether chunks are free or
+    in use.
+
+    An allocated chunk looks like this:
+
+
+    chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+            |             Size of previous chunk, if allocated            | |
+            +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+            |             Size of chunk, in bytes                         |P|
+      mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+            |             User data starts here...                          .
+            .                                                               .
+            .             (malloc_usable_space() bytes)                     .
+            .                                                               |
+nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+            |             Size of chunk                                     |
+            +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+
+    Where "chunk" is the front of the chunk for the purpose of most of
+    the malloc code, but "mem" is the pointer that is returned to the
+    user.  "Nextchunk" is the beginning of the next contiguous chunk.
+
+    Chunks always begin on even word boundries, so the mem portion
+    (which is returned to the user) is also on an even word boundary, and
+    thus at least double-word aligned.
+
+    Free chunks are stored in circular doubly-linked lists, and look like this:
+
+    chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+            |             Size of previous chunk                            |
+            +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+    `head:' |             Size of chunk, in bytes                         |P|
+      mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+            |             Forward pointer to next chunk in list             |
+            +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+            |             Back pointer to previous chunk in list            |
+            +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+            |             Unused space (may be 0 bytes long)                .
+            .                                                               .
+            .                                                               |
+nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+    `foot:' |             Size of chunk, in bytes                           |
+            +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+
+    The P (PREV_INUSE) bit, stored in the unused low-order bit of the
+    chunk size (which is always a multiple of two words), is an in-use
+    bit for the *previous* chunk.  If that bit is *clear*, then the
+    word before the current chunk size contains the previous chunk
+    size, and can be used to find the front of the previous chunk.
+    The very first chunk allocated always has this bit set,
+    preventing access to non-existent (or non-owned) memory. If
+    prev_inuse is set for any given chunk, then you CANNOT determine
+    the size of the previous chunk, and might even get a memory
+    addressing fault when trying to do so.
+
+    Note that the `foot' of the current chunk is actually represented
+    as the prev_size of the NEXT chunk. This makes it easier to
+    deal with alignments etc but can be very confusing when trying
+    to extend or adapt this code.
+
+    The two exceptions to all this are
+
+     1. The special chunk `top' doesn't bother using the
+        trailing size field since there is no next contiguous chunk
+        that would have to index off it. After initialization, `top'
+        is forced to always exist.  If it would become less than
+        MINSIZE bytes long, it is replenished.
+
+     2. Chunks allocated via mmap, which have the second-lowest-order
+        bit (IS_MMAPPED) set in their size fields.  Because they are
+        allocated one-by-one, each must contain its own trailing size field.
+
+*/
+
+/*
+  ---------- Size and alignment checks and conversions ----------
+*/
+
+/* conversion from malloc headers to user pointers, and back */
+
+#define chunk2mem(p)   ((Void_t*)((char*)(p) + 2*SIZE_SZ))
+#define mem2chunk(mem) ((mchunkptr)((char*)(mem) - 2*SIZE_SZ))
+
+/* The smallest possible chunk */
+#define MIN_CHUNK_SIZE        (sizeof(struct malloc_chunk))
+
+/* The smallest size we can malloc is an aligned minimal chunk */
+
+#define MINSIZE  \
+  (CHUNK_SIZE_T)(((MIN_CHUNK_SIZE+MALLOC_ALIGN_MASK) & ~MALLOC_ALIGN_MASK))
+
+/* Check if m has acceptable alignment */
+
+#define aligned_OK(m)  (((PTR_UINT)((m)) & (MALLOC_ALIGN_MASK)) == 0)
+
+
+/* 
+   Check if a request is so large that it would wrap around zero when
+   padded and aligned. To simplify some other code, the bound is made
+   low enough so that adding MINSIZE will also not wrap around sero.
+*/
+
+#define REQUEST_OUT_OF_RANGE(req)                                 \
+  ((CHUNK_SIZE_T)(req) >=                                        \
+   (CHUNK_SIZE_T)(INTERNAL_SIZE_T)(-2 * MINSIZE))    
+
+/* pad request bytes into a usable size -- internal version */
+
+#define request2size(req)                                         \
+  (((req) + SIZE_SZ + MALLOC_ALIGN_MASK < MINSIZE)  ?             \
+   MINSIZE :                                                      \
+   ((req) + SIZE_SZ + MALLOC_ALIGN_MASK) & ~MALLOC_ALIGN_MASK)
+
+/*  Same, except also perform argument check */
+
+#define checked_request2size(req, sz)                             \
+  if (REQUEST_OUT_OF_RANGE(req)) {                                \
+    MALLOC_FAILURE_ACTION;                                        \
+    return 0;                                                     \
+  }                                                               \
+  (sz) = request2size(req);                                              
+
+/*
+  --------------- Physical chunk operations ---------------
+*/
+
+
+/* size field is or'ed with PREV_INUSE when previous adjacent chunk in use */
+#define PREV_INUSE 0x1
+
+/* extract inuse bit of previous chunk */
+#define prev_inuse(p)       ((p)->size & PREV_INUSE)
+
+
+/* size field is or'ed with IS_MMAPPED if the chunk was obtained with mmap() */
+#define IS_MMAPPED 0x2
+
+/* check for mmap()'ed chunk */
+#define chunk_is_mmapped(p) ((p)->size & IS_MMAPPED)
+
+/* 
+  Bits to mask off when extracting size 
+
+  Note: IS_MMAPPED is intentionally not masked off from size field in
+  macros for which mmapped chunks should never be seen. This should
+  cause helpful core dumps to occur if it is tried by accident by
+  people extending or adapting this malloc.
+*/
+#define SIZE_BITS (PREV_INUSE|IS_MMAPPED)
+
+/* Get size, ignoring use bits */
+#define chunksize(p)         ((p)->size & ~(SIZE_BITS))
+
+
+/* Ptr to next physical malloc_chunk. */
+#define next_chunk(p) ((mchunkptr)( ((char*)(p)) + ((p)->size & ~PREV_INUSE) ))
+
+/* Ptr to previous physical malloc_chunk */
+#define prev_chunk(p) ((mchunkptr)( ((char*)(p)) - ((p)->prev_size) ))
+
+/* Treat space at ptr + offset as a chunk */
+#define chunk_at_offset(p, s)  ((mchunkptr)(((char*)(p)) + (s)))
+
+/* extract p's inuse bit */
+#define inuse(p)\
+((((mchunkptr)(((char*)(p))+((p)->size & ~PREV_INUSE)))->size) & PREV_INUSE)
+
+/* set/clear chunk as being inuse without otherwise disturbing */
+#define set_inuse(p)\
+((mchunkptr)(((char*)(p)) + ((p)->size & ~PREV_INUSE)))->size |= PREV_INUSE
+
+#define clear_inuse(p)\
+((mchunkptr)(((char*)(p)) + ((p)->size & ~PREV_INUSE)))->size &= ~(PREV_INUSE)
+
+
+/* check/set/clear inuse bits in known places */
+#define inuse_bit_at_offset(p, s)\
+ (((mchunkptr)(((char*)(p)) + (s)))->size & PREV_INUSE)
+
+#define set_inuse_bit_at_offset(p, s)\
+ (((mchunkptr)(((char*)(p)) + (s)))->size |= PREV_INUSE)
+
+#define clear_inuse_bit_at_offset(p, s)\
+ (((mchunkptr)(((char*)(p)) + (s)))->size &= ~(PREV_INUSE))
+
+
+/* Set size at head, without disturbing its use bit */
+#define set_head_size(p, s)  ((p)->size = (((p)->size & PREV_INUSE) | (s)))
+
+/* Set size/use field */
+#define set_head(p, s)       ((p)->size = (s))
+
+/* Set size at footer (only when chunk is not in use) */
+#define set_foot(p, s)       (((mchunkptr)((char*)(p) + (s)))->prev_size = (s))
+
+
+/*
+  -------------------- Internal data structures --------------------
+
+   All internal state is held in an instance of malloc_state defined
+   below. There are no other static variables, except in two optional
+   cases: 
+   * If USE_MALLOC_LOCK is defined, the mALLOC_MUTEx declared above. 
+   * If HAVE_MMAP is true, but mmap doesn't support
+     MAP_ANONYMOUS, a dummy file descriptor for mmap.
+
+   Beware of lots of tricks that minimize the total bookkeeping space
+   requirements. The result is a little over 1K bytes (for 4byte
+   pointers and size_t.)
+*/
+
+/*
+  Bins
+
+    An array of bin headers for free chunks. Each bin is doubly
+    linked.  The bins are approximately proportionally (log) spaced.
+    There are a lot of these bins (128). This may look excessive, but
+    works very well in practice.  Most bins hold sizes that are
+    unusual as malloc request sizes, but are more usual for fragments
+    and consolidated sets of chunks, which is what these bins hold, so
+    they can be found quickly.  All procedures maintain the invariant
+    that no consolidated chunk physically borders another one, so each
+    chunk in a list is known to be preceeded and followed by either
+    inuse chunks or the ends of memory.
+
+    Chunks in bins are kept in size order, with ties going to the
+    approximately least recently used chunk. Ordering isn't needed
+    for the small bins, which all contain the same-sized chunks, but
+    facilitates best-fit allocation for larger chunks. These lists
+    are just sequential. Keeping them in order almost never requires
+    enough traversal to warrant using fancier ordered data
+    structures.  
+
+    Chunks of the same size are linked with the most
+    recently freed at the front, and allocations are taken from the
+    back.  This results in LRU (FIFO) allocation order, which tends
+    to give each chunk an equal opportunity to be consolidated with
+    adjacent freed chunks, resulting in larger free chunks and less
+    fragmentation.
+
+    To simplify use in double-linked lists, each bin header acts
+    as a malloc_chunk. This avoids special-casing for headers.
+    But to conserve space and improve locality, we allocate
+    only the fd/bk pointers of bins, and then use repositioning tricks
+    to treat these as the fields of a malloc_chunk*.  
+*/
+
+typedef struct malloc_chunk* mbinptr;
+
+/* addressing -- note that bin_at(0) does not exist */
+#define bin_at(m, i) ((mbinptr)((char*)&((m)->bins[(i)<<1]) - (SIZE_SZ<<1)))
+
+/* analog of ++bin */
+#define next_bin(b)  ((mbinptr)((char*)(b) + (sizeof(mchunkptr)<<1)))
+
+/* Reminders about list directionality within bins */
+#define first(b)     ((b)->fd)
+#define last(b)      ((b)->bk)
+
+/* Take a chunk off a bin list */
+#define unlink(P, BK, FD) {                                            \
+  FD = P->fd;                                                          \
+  BK = P->bk;                                                          \
+  FD->bk = BK;                                                         \
+  BK->fd = FD;                                                         \
+}
+
+/*
+  Indexing
+
+    Bins for sizes < 512 bytes contain chunks of all the same size, spaced
+    8 bytes apart. Larger bins are approximately logarithmically spaced:
+
+    64 bins of size       8
+    32 bins of size      64
+    16 bins of size     512
+     8 bins of size    4096
+     4 bins of size   32768
+     2 bins of size  262144
+     1 bin  of size what's left
+
+    The bins top out around 1MB because we expect to service large
+    requests via mmap.
+*/
+
+#define NBINS              96
+#define NSMALLBINS         32
+#define SMALLBIN_WIDTH      8
+#define MIN_LARGE_SIZE    256
+
+#define in_smallbin_range(sz)  \
+  ((CHUNK_SIZE_T)(sz) < (CHUNK_SIZE_T)MIN_LARGE_SIZE)
+
+#define smallbin_index(sz)     (((unsigned)(sz)) >> 3)
+
+/*
+  Compute index for size. We expect this to be inlined when
+  compiled with optimization, else not, which works out well.
+*/
+static int largebin_index(unsigned int sz) {
+  unsigned int  x = sz >> SMALLBIN_WIDTH; 
+  unsigned int m;            /* bit position of highest set bit of m */
+
+  if (x >= 0x10000) return NBINS-1;
+
+  /* On intel, use BSRL instruction to find highest bit */
+#if defined(__GNUC__) && defined(i386)
+
+  __asm__("bsrl %1,%0\n\t"
+          : "=r" (m) 
+          : "g"  (x));
+
+#else
+  {
+    /*
+      Based on branch-free nlz algorithm in chapter 5 of Henry
+      S. Warren Jr's book "Hacker's Delight".
+    */
+
+    unsigned int n = ((x - 0x100) >> 16) & 8;
+    x <<= n; 
+    m = ((x - 0x1000) >> 16) & 4;
+    n += m; 
+    x <<= m; 
+    m = ((x - 0x4000) >> 16) & 2;
+    n += m; 
+    x = (x << m) >> 14;
+    m = 13 - n + (x & ~(x>>1));
+  }
+#endif
+
+  /* Use next 2 bits to create finer-granularity bins */
+  return NSMALLBINS + (m << 2) + ((sz >> (m + 6)) & 3);
+}
+
+#define bin_index(sz) \
+ ((in_smallbin_range(sz)) ? smallbin_index(sz) : largebin_index(sz))
+
+/*
+  FIRST_SORTED_BIN_SIZE is the chunk size corresponding to the
+  first bin that is maintained in sorted order. This must
+  be the smallest size corresponding to a given bin.
+
+  Normally, this should be MIN_LARGE_SIZE. But you can weaken
+  best fit guarantees to sometimes speed up malloc by increasing value.
+  Doing this means that malloc may choose a chunk that is 
+  non-best-fitting by up to the width of the bin.
+
+  Some useful cutoff values:
+      512 - all bins sorted
+     2560 - leaves bins <=     64 bytes wide unsorted  
+    12288 - leaves bins <=    512 bytes wide unsorted
+    65536 - leaves bins <=   4096 bytes wide unsorted
+   262144 - leaves bins <=  32768 bytes wide unsorted
+       -1 - no bins sorted (not recommended!)
+*/
+
+#define FIRST_SORTED_BIN_SIZE MIN_LARGE_SIZE 
+/* #define FIRST_SORTED_BIN_SIZE 65536 */
+
+/*
+  Unsorted chunks
+
+    All remainders from chunk splits, as well as all returned chunks,
+    are first placed in the "unsorted" bin. They are then placed
+    in regular bins after malloc gives them ONE chance to be used before
+    binning. So, basically, the unsorted_chunks list acts as a queue,
+    with chunks being placed on it in free (and malloc_consolidate),
+    and taken off (to be either used or placed in bins) in malloc.
+*/
+
+/* The otherwise unindexable 1-bin is used to hold unsorted chunks. */
+#define unsorted_chunks(M)          (bin_at(M, 1))
+
+/*
+  Top
+
+    The top-most available chunk (i.e., the one bordering the end of
+    available memory) is treated specially. It is never included in
+    any bin, is used only if no other chunk is available, and is
+    released back to the system if it is very large (see
+    M_TRIM_THRESHOLD).  Because top initially
+    points to its own bin with initial zero size, thus forcing
+    extension on the first malloc request, we avoid having any special
+    code in malloc to check whether it even exists yet. But we still
+    need to do so when getting memory from system, so we make
+    initial_top treat the bin as a legal but unusable chunk during the
+    interval between initialization and the first call to
+    sYSMALLOc. (This is somewhat delicate, since it relies on
+    the 2 preceding words to be zero during this interval as well.)
+*/
+
+/* Conveniently, the unsorted bin can be used as dummy top on first call */
+#define initial_top(M)              (unsorted_chunks(M))
+
+/*
+  Binmap
+
+    To help compensate for the large number of bins, a one-level index
+    structure is used for bin-by-bin searching.  `binmap' is a
+    bitvector recording whether bins are definitely empty so they can
+    be skipped over during during traversals.  The bits are NOT always
+    cleared as soon as bins are empty, but instead only
+    when they are noticed to be empty during traversal in malloc.
+*/
+
+/* Conservatively use 32 bits per map word, even if on 64bit system */
+#define BINMAPSHIFT      5
+#define BITSPERMAP       (1U << BINMAPSHIFT)
+#define BINMAPSIZE       (NBINS / BITSPERMAP)
+
+#define idx2block(i)     ((i) >> BINMAPSHIFT)
+#define idx2bit(i)       ((1U << ((i) & ((1U << BINMAPSHIFT)-1))))
+
+#define mark_bin(m,i)    ((m)->binmap[idx2block(i)] |=  idx2bit(i))
+#define unmark_bin(m,i)  ((m)->binmap[idx2block(i)] &= ~(idx2bit(i)))
+#define get_binmap(m,i)  ((m)->binmap[idx2block(i)] &   idx2bit(i))
+
+/*
+  Fastbins
+
+    An array of lists holding recently freed small chunks.  Fastbins
+    are not doubly linked.  It is faster to single-link them, and
+    since chunks are never removed from the middles of these lists,
+    double linking is not necessary. Also, unlike regular bins, they
+    are not even processed in FIFO order (they use faster LIFO) since
+    ordering doesn't much matter in the transient contexts in which
+    fastbins are normally used.
+
+    Chunks in fastbins keep their inuse bit set, so they cannot
+    be consolidated with other free chunks. malloc_consolidate
+    releases all chunks in fastbins and consolidates them with
+    other free chunks. 
+*/
+
+typedef struct malloc_chunk* mfastbinptr;
+
+/* offset 2 to use otherwise unindexable first 2 bins */
+#define fastbin_index(sz)        ((((unsigned int)(sz)) >> 3) - 2)
+
+/* The maximum fastbin request size we support */
+#define MAX_FAST_SIZE     80
+
+#define NFASTBINS  (fastbin_index(request2size(MAX_FAST_SIZE))+1)
+
+/*
+  FASTBIN_CONSOLIDATION_THRESHOLD is the size of a chunk in free()
+  that triggers automatic consolidation of possibly-surrounding
+  fastbin chunks. This is a heuristic, so the exact value should not
+  matter too much. It is defined at half the default trim threshold as a
+  compromise heuristic to only attempt consolidation if it is likely
+  to lead to trimming. However, it is not dynamically tunable, since
+  consolidation reduces fragmentation surrounding loarge chunks even 
+  if trimming is not used.
+*/
+
+#define FASTBIN_CONSOLIDATION_THRESHOLD  \
+  ((unsigned long)(DEFAULT_TRIM_THRESHOLD) >> 1)
+
+/*
+  Since the lowest 2 bits in max_fast don't matter in size comparisons, 
+  they are used as flags.
+*/
+
+/*
+  ANYCHUNKS_BIT held in max_fast indicates that there may be any
+  freed chunks at all. It is set true when entering a chunk into any
+  bin.
+*/
+
+#define ANYCHUNKS_BIT        (1U)
+
+#define have_anychunks(M)     (((M)->max_fast &  ANYCHUNKS_BIT))
+#define set_anychunks(M)      ((M)->max_fast |=  ANYCHUNKS_BIT)
+#define clear_anychunks(M)    ((M)->max_fast &= ~ANYCHUNKS_BIT)
+
+/*
+  FASTCHUNKS_BIT held in max_fast indicates that there are probably
+  some fastbin chunks. It is set true on entering a chunk into any
+  fastbin, and cleared only in malloc_consolidate.
+*/
+
+#define FASTCHUNKS_BIT        (2U)
+
+#define have_fastchunks(M)   (((M)->max_fast &  FASTCHUNKS_BIT))
+#define set_fastchunks(M)    ((M)->max_fast |=  (FASTCHUNKS_BIT|ANYCHUNKS_BIT))
+#define clear_fastchunks(M)  ((M)->max_fast &= ~(FASTCHUNKS_BIT))
+
+/* 
+   Set value of max_fast. 
+   Use impossibly small value if 0.
+*/
+
+#define set_max_fast(M, s) \
+  (M)->max_fast = (((s) == 0)? SMALLBIN_WIDTH: request2size(s)) | \
+  ((M)->max_fast &  (FASTCHUNKS_BIT|ANYCHUNKS_BIT))
+
+#define get_max_fast(M) \
+  ((M)->max_fast & ~(FASTCHUNKS_BIT | ANYCHUNKS_BIT))
+
+
+/*
+  morecore_properties is a status word holding dynamically discovered
+  or controlled properties of the morecore function
+*/
+
+#define MORECORE_CONTIGUOUS_BIT  (1U)
+
+#define contiguous(M) \
+        (((M)->morecore_properties &  MORECORE_CONTIGUOUS_BIT))
+#define noncontiguous(M) \
+        (((M)->morecore_properties &  MORECORE_CONTIGUOUS_BIT) == 0)
+#define set_contiguous(M) \
+        ((M)->morecore_properties |=  MORECORE_CONTIGUOUS_BIT)
+#define set_noncontiguous(M) \
+        ((M)->morecore_properties &= ~MORECORE_CONTIGUOUS_BIT)
+
+
+/*
+   ----------- Internal state representation and initialization -----------
+*/
+
+struct malloc_state {
+
+  /* The maximum chunk size to be eligible for fastbin */
+  INTERNAL_SIZE_T  max_fast;   /* low 2 bits used as flags */
+
+  /* Fastbins */
+  mfastbinptr      fastbins[NFASTBINS];
+
+  /* Base of the topmost chunk -- not otherwise kept in a bin */
+  mchunkptr        top;
+
+  /* The remainder from the most recent split of a small request */
+  mchunkptr        last_remainder;
+
+  /* Normal bins packed as described above */
+  mchunkptr        bins[NBINS * 2];
+
+  /* Bitmap of bins */
+  unsigned int     binmap[BINMAPSIZE];
+
+  /* Tunable parameters */
+  CHUNK_SIZE_T     trim_threshold;
+  INTERNAL_SIZE_T  top_pad;
+  INTERNAL_SIZE_T  mmap_threshold;
+
+  /* Memory map support */
+  int              n_mmaps;
+  int              n_mmaps_max;
+  int              max_n_mmaps;
+
+  /* Cache malloc_getpagesize */
+  unsigned int     pagesize;    
+
+  /* Track properties of MORECORE */
+  unsigned int     morecore_properties;
+
+  /* Statistics */
+  INTERNAL_SIZE_T  mmapped_mem;
+  INTERNAL_SIZE_T  sbrked_mem;
+  INTERNAL_SIZE_T  max_sbrked_mem;
+  INTERNAL_SIZE_T  max_mmapped_mem;
+  INTERNAL_SIZE_T  max_total_mem;
+};
+
+typedef struct malloc_state *mstate;
+
+/* 
+   There is exactly one instance of this struct in this malloc.
+   If you are adapting this malloc in a way that does NOT use a static
+   malloc_state, you MUST explicitly zero-fill it before using. This
+   malloc relies on the property that malloc_state is initialized to
+   all zeroes (as is true of C statics).
+*/
+
+static struct malloc_state av_;  /* never directly referenced */
+
+/*
+   All uses of av_ are via get_malloc_state().
+   At most one "call" to get_malloc_state is made per invocation of
+   the public versions of malloc and free, but other routines
+   that in turn invoke malloc and/or free may call more then once. 
+   Also, it is called in check* routines if DEBUG is set.
+*/
+
+#define get_malloc_state() (&(av_))
+
+/*
+  Initialize a malloc_state struct.
+
+  This is called only from within malloc_consolidate, which needs
+  be called in the same contexts anyway.  It is never called directly
+  outside of malloc_consolidate because some optimizing compilers try
+  to inline it at all call points, which turns out not to be an
+  optimization at all. (Inlining it in malloc_consolidate is fine though.)
+*/
+
+#if __STD_C
+static void malloc_init_state(mstate av)
+#else
+static void malloc_init_state(av) mstate av;
+#endif
+{
+  int     i;
+  mbinptr bin;
+  
+  /* Establish circular links for normal bins */
+  for (i = 1; i < NBINS; ++i) { 
+    bin = bin_at(av,i);
+    bin->fd = bin->bk = bin;
+  }
+
+  av->top_pad        = DEFAULT_TOP_PAD;
+  av->n_mmaps_max    = DEFAULT_MMAP_MAX;
+  av->mmap_threshold = DEFAULT_MMAP_THRESHOLD;
+  av->trim_threshold = DEFAULT_TRIM_THRESHOLD;
+
+#if MORECORE_CONTIGUOUS
+  set_contiguous(av);
+#else
+  set_noncontiguous(av);
+#endif
+
+
+  set_max_fast(av, DEFAULT_MXFAST);
+
+  av->top            = initial_top(av);
+  av->pagesize       = malloc_getpagesize;
+}
+
+/* 
+   Other internal utilities operating on mstates
+*/
+
+#if __STD_C
+static Void_t*  sYSMALLOc(INTERNAL_SIZE_T, mstate);
+static int      sYSTRIm(size_t, mstate);
+static void     malloc_consolidate(mstate);
+static Void_t** iALLOc(size_t, size_t*, int, Void_t**);
+#else
+static Void_t*  sYSMALLOc();
+static int      sYSTRIm();
+static void     malloc_consolidate();
+static Void_t** iALLOc();
+#endif
+
+/*
+  Debugging support
+
+  These routines make a number of assertions about the states
+  of data structures that should be true at all times. If any
+  are not true, it's very likely that a user program has somehow
+  trashed memory. (It's also possible that there is a coding error
+  in malloc. In which case, please report it!)
+*/
+
+#if ! DEBUG
+
+#define check_chunk(P)
+#define check_free_chunk(P)
+#define check_inuse_chunk(P)
+#define check_remalloced_chunk(P,N)
+#define check_malloced_chunk(P,N)
+#define check_malloc_state()
+
+#else
+#define check_chunk(P)              do_check_chunk(P)
+#define check_free_chunk(P)         do_check_free_chunk(P)
+#define check_inuse_chunk(P)        do_check_inuse_chunk(P)
+#define check_remalloced_chunk(P,N) do_check_remalloced_chunk(P,N)
+#define check_malloced_chunk(P,N)   do_check_malloced_chunk(P,N)
+#define check_malloc_state()        do_check_malloc_state()
+
+/*
+  Properties of all chunks
+*/
+
+#if __STD_C
+static void do_check_chunk(mchunkptr p)
+#else
+static void do_check_chunk(p) mchunkptr p;
+#endif
+{
+  mstate av = get_malloc_state();
+  CHUNK_SIZE_T  sz = chunksize(p);
+  /* min and max possible addresses assuming contiguous allocation */
+  char* max_address = (char*)(av->top) + chunksize(av->top);
+  char* min_address = max_address - av->sbrked_mem;
+
+  if (!chunk_is_mmapped(p)) {
+    
+    /* Has legal address ... */
+    if (p != av->top) {
+      if (contiguous(av)) {
+        assert(((char*)p) >= min_address);
+        assert(((char*)p + sz) <= ((char*)(av->top)));
+      }
+    }
+    else {
+      /* top size is always at least MINSIZE */
+      assert((CHUNK_SIZE_T)(sz) >= MINSIZE);
+      /* top predecessor always marked inuse */
+      assert(prev_inuse(p));
+    }
+      
+  }
+  else {
+#if HAVE_MMAP
+    /* address is outside main heap  */
+    if (contiguous(av) && av->top != initial_top(av)) {
+      assert(((char*)p) < min_address || ((char*)p) > max_address);
+    }
+    /* chunk is page-aligned */
+    assert(((p->prev_size + sz) & (av->pagesize-1)) == 0);
+    /* mem is aligned */
+    assert(aligned_OK(chunk2mem(p)));
+#else
+    /* force an appropriate assert violation if debug set */
+    assert(!chunk_is_mmapped(p));
+#endif
+  }
+}
+
+/*
+  Properties of free chunks
+*/
+
+#if __STD_C
+static void do_check_free_chunk(mchunkptr p)
+#else
+static void do_check_free_chunk(p) mchunkptr p;
+#endif
+{
+  mstate av = get_malloc_state();
+
+  INTERNAL_SIZE_T sz = p->size & ~PREV_INUSE;
+  mchunkptr next = chunk_at_offset(p, sz);
+
+  do_check_chunk(p);
+
+  /* Chunk must claim to be free ... */
+  assert(!inuse(p));
+  assert (!chunk_is_mmapped(p));
+
+  /* Unless a special marker, must have OK fields */
+  if ((CHUNK_SIZE_T)(sz) >= MINSIZE)
+  {
+    assert((sz & MALLOC_ALIGN_MASK) == 0);
+    assert(aligned_OK(chunk2mem(p)));
+    /* ... matching footer field */
+    assert(next->prev_size == sz);
+    /* ... and is fully consolidated */
+    assert(prev_inuse(p));
+    assert (next == av->top || inuse(next));
+
+    /* ... and has minimally sane links */
+    assert(p->fd->bk == p);
+    assert(p->bk->fd == p);
+  }
+  else /* markers are always of size SIZE_SZ */
+    assert(sz == SIZE_SZ);
+}
+
+/*
+  Properties of inuse chunks
+*/
+
+#if __STD_C
+static void do_check_inuse_chunk(mchunkptr p)
+#else
+static void do_check_inuse_chunk(p) mchunkptr p;
+#endif
+{
+  mstate av = get_malloc_state();
+  mchunkptr next;
+  do_check_chunk(p);
+
+  if (chunk_is_mmapped(p))
+    return; /* mmapped chunks have no next/prev */
+
+  /* Check whether it claims to be in use ... */
+  assert(inuse(p));
+
+  next = next_chunk(p);
+
+  /* ... and is surrounded by OK chunks.
+    Since more things can be checked with free chunks than inuse ones,
+    if an inuse chunk borders them and debug is on, it's worth doing them.
+  */
+  if (!prev_inuse(p))  {
+    /* Note that we cannot even look at prev unless it is not inuse */
+    mchunkptr prv = prev_chunk(p);
+    assert(next_chunk(prv) == p);
+    do_check_free_chunk(prv);
+  }
+
+  if (next == av->top) {
+    assert(prev_inuse(next));
+    assert(chunksize(next) >= MINSIZE);
+  }
+  else if (!inuse(next))
+    do_check_free_chunk(next);
+}
+
+/*
+  Properties of chunks recycled from fastbins
+*/
+
+#if __STD_C
+static void do_check_remalloced_chunk(mchunkptr p, INTERNAL_SIZE_T s)
+#else
+static void do_check_remalloced_chunk(p, s) mchunkptr p; INTERNAL_SIZE_T s;
+#endif
+{
+  INTERNAL_SIZE_T sz = p->size & ~PREV_INUSE;
+
+  do_check_inuse_chunk(p);
+
+  /* Legal size ... */
+  assert((sz & MALLOC_ALIGN_MASK) == 0);
+  assert((CHUNK_SIZE_T)(sz) >= MINSIZE);
+  /* ... and alignment */
+  assert(aligned_OK(chunk2mem(p)));
+  /* chunk is less than MINSIZE more than request */
+  assert((long)(sz) - (long)(s) >= 0);
+  assert((long)(sz) - (long)(s + MINSIZE) < 0);
+}
+
+/*
+  Properties of nonrecycled chunks at the point they are malloced
+*/
+
+#if __STD_C
+static void do_check_malloced_chunk(mchunkptr p, INTERNAL_SIZE_T s)
+#else
+static void do_check_malloced_chunk(p, s) mchunkptr p; INTERNAL_SIZE_T s;
+#endif
+{
+  /* same as recycled case ... */
+  do_check_remalloced_chunk(p, s);
+
+  /*
+    ... plus,  must obey implementation invariant that prev_inuse is
+    always true of any allocated chunk; i.e., that each allocated
+    chunk borders either a previously allocated and still in-use
+    chunk, or the base of its memory arena. This is ensured
+    by making all allocations from the the `lowest' part of any found
+    chunk.  This does not necessarily hold however for chunks
+    recycled via fastbins.
+  */
+
+  assert(prev_inuse(p));
+}
+
+
+/*
+  Properties of malloc_state.
+
+  This may be useful for debugging malloc, as well as detecting user
+  programmer errors that somehow write into malloc_state.
+
+  If you are extending or experimenting with this malloc, you can
+  probably figure out how to hack this routine to print out or
+  display chunk addresses, sizes, bins, and other instrumentation.
+*/
+
+static void do_check_malloc_state()
+{
+  mstate av = get_malloc_state();
+  int i;
+  mchunkptr p;
+  mchunkptr q;
+  mbinptr b;
+  unsigned int binbit;
+  int empty;
+  unsigned int idx;
+  INTERNAL_SIZE_T size;
+  CHUNK_SIZE_T  total = 0;
+  int max_fast_bin;
+
+  /* internal size_t must be no wider than pointer type */
+  assert(sizeof(INTERNAL_SIZE_T) <= sizeof(char*));
+
+  /* alignment is a power of 2 */
+  assert((MALLOC_ALIGNMENT & (MALLOC_ALIGNMENT-1)) == 0);
+
+  /* cannot run remaining checks until fully initialized */
+  if (av->top == 0 || av->top == initial_top(av))
+    return;
+
+  /* pagesize is a power of 2 */
+  assert((av->pagesize & (av->pagesize-1)) == 0);
+
+  /* properties of fastbins */
+
+  /* max_fast is in allowed range */
+  assert(get_max_fast(av) <= request2size(MAX_FAST_SIZE));
+
+  max_fast_bin = fastbin_index(av->max_fast);
+
+  for (i = 0; i < NFASTBINS; ++i) {
+    p = av->fastbins[i];
+
+    /* all bins past max_fast are empty */
+    if (i > max_fast_bin)
+      assert(p == 0);
+
+    while (p != 0) {
+      /* each chunk claims to be inuse */
+      do_check_inuse_chunk(p);
+      total += chunksize(p);
+      /* chunk belongs in this bin */
+      assert(fastbin_index(chunksize(p)) == i);
+      p = p->fd;
+    }
+  }
+
+  if (total != 0)
+    assert(have_fastchunks(av));
+  else if (!have_fastchunks(av))
+    assert(total == 0);
+
+  /* check normal bins */
+  for (i = 1; i < NBINS; ++i) {
+    b = bin_at(av,i);
+
+    /* binmap is accurate (except for bin 1 == unsorted_chunks) */
+    if (i >= 2) {
+      binbit = get_binmap(av,i);
+      empty = last(b) == b;
+      if (!binbit)
+        assert(empty);
+      else if (!empty)
+        assert(binbit);
+    }
+
+    for (p = last(b); p != b; p = p->bk) {
+      /* each chunk claims to be free */
+      do_check_free_chunk(p);
+      size = chunksize(p);
+      total += size;
+      if (i >= 2) {
+        /* chunk belongs in bin */
+        idx = bin_index(size);
+        assert(idx == i);
+        /* lists are sorted */
+        if ((CHUNK_SIZE_T) size >= (CHUNK_SIZE_T)(FIRST_SORTED_BIN_SIZE)) {
+          assert(p->bk == b || 
+                 (CHUNK_SIZE_T)chunksize(p->bk) >= 
+                 (CHUNK_SIZE_T)chunksize(p));
+        }
+      }
+      /* chunk is followed by a legal chain of inuse chunks */
+      for (q = next_chunk(p);
+           (q != av->top && inuse(q) && 
+             (CHUNK_SIZE_T)(chunksize(q)) >= MINSIZE);
+           q = next_chunk(q))
+        do_check_inuse_chunk(q);
+    }
+  }
+
+  /* top chunk is OK */
+  check_chunk(av->top);
+
+  /* sanity checks for statistics */
+
+  assert(total <= (CHUNK_SIZE_T)(av->max_total_mem));
+  assert(av->n_mmaps >= 0);
+  assert(av->n_mmaps <= av->max_n_mmaps);
+
+  assert((CHUNK_SIZE_T)(av->sbrked_mem) <=
+         (CHUNK_SIZE_T)(av->max_sbrked_mem));
+
+  assert((CHUNK_SIZE_T)(av->mmapped_mem) <=
+         (CHUNK_SIZE_T)(av->max_mmapped_mem));
+
+  assert((CHUNK_SIZE_T)(av->max_total_mem) >=
+         (CHUNK_SIZE_T)(av->mmapped_mem) + (CHUNK_SIZE_T)(av->sbrked_mem));
+}
+#endif
+
+
+/* ----------- Routines dealing with system allocation -------------- */
+
+/*
+  sysmalloc handles malloc cases requiring more memory from the system.
+  On entry, it is assumed that av->top does not have enough
+  space to service request for nb bytes, thus requiring that av->top
+  be extended or replaced.
+*/
+
+#if __STD_C
+static Void_t* sYSMALLOc(INTERNAL_SIZE_T nb, mstate av)
+#else
+static Void_t* sYSMALLOc(nb, av) INTERNAL_SIZE_T nb; mstate av;
+#endif
+{
+  mchunkptr       old_top;        /* incoming value of av->top */
+  INTERNAL_SIZE_T old_size;       /* its size */
+  char*           old_end;        /* its end address */
+
+  long            size;           /* arg to first MORECORE or mmap call */
+  char*           brk;            /* return value from MORECORE */
+
+  long            correction;     /* arg to 2nd MORECORE call */
+  char*           snd_brk;        /* 2nd return val */
+
+  INTERNAL_SIZE_T front_misalign; /* unusable bytes at front of new space */
+  INTERNAL_SIZE_T end_misalign;   /* partial page left at end of new space */
+  char*           aligned_brk;    /* aligned offset into brk */
+
+  mchunkptr       p;              /* the allocated/returned chunk */
+  mchunkptr       remainder;      /* remainder from allocation */
+  CHUNK_SIZE_T    remainder_size; /* its size */
+
+  CHUNK_SIZE_T    sum;            /* for updating stats */
+
+  size_t          pagemask  = av->pagesize - 1;
+
+  /*
+    If there is space available in fastbins, consolidate and retry
+    malloc from scratch rather than getting memory from system.  This
+    can occur only if nb is in smallbin range so we didn't consolidate
+    upon entry to malloc. It is much easier to handle this case here
+    than in malloc proper.
+  */
+
+  if (have_fastchunks(av)) {
+    assert(in_smallbin_range(nb));
+    malloc_consolidate(av);
+    return mALLOc(nb - MALLOC_ALIGN_MASK);
+  }
+
+
+#if HAVE_MMAP
+
+  /*
+    If have mmap, and the request size meets the mmap threshold, and
+    the system supports mmap, and there are few enough currently
+    allocated mmapped regions, try to directly map this request
+    rather than expanding top.
+  */
+
+  if ((CHUNK_SIZE_T)(nb) >= (CHUNK_SIZE_T)(av->mmap_threshold) &&
+      (av->n_mmaps < av->n_mmaps_max)) {
+
+    char* mm;             /* return value from mmap call*/
+
+    /*
+      Round up size to nearest page.  For mmapped chunks, the overhead
+      is one SIZE_SZ unit larger than for normal chunks, because there
+      is no following chunk whose prev_size field could be used.
+    */
+    size = (nb + SIZE_SZ + MALLOC_ALIGN_MASK + pagemask) & ~pagemask;
+
+    /* Don't try if size wraps around 0 */
+    if ((CHUNK_SIZE_T)(size) > (CHUNK_SIZE_T)(nb)) {
+
+      mm = (char*)(MMAP(0, size, PROT_READ|PROT_WRITE, MAP_PRIVATE));
+      
+      if (mm != (char*)(MORECORE_FAILURE)) {
+        
+        /*
+          The offset to the start of the mmapped region is stored
+          in the prev_size field of the chunk. This allows us to adjust
+          returned start address to meet alignment requirements here 
+          and in memalign(), and still be able to compute proper
+          address argument for later munmap in free() and realloc().
+        */
+        
+        front_misalign = (INTERNAL_SIZE_T)chunk2mem(mm) & MALLOC_ALIGN_MASK;
+        if (front_misalign > 0) {
+          correction = MALLOC_ALIGNMENT - front_misalign;
+          p = (mchunkptr)(mm + correction);
+          p->prev_size = correction;
+          set_head(p, (size - correction) |IS_MMAPPED);
+        }
+        else {
+          p = (mchunkptr)mm;
+          p->prev_size = 0;
+          set_head(p, size|IS_MMAPPED);
+        }
+        
+        /* update statistics */
+        
+        if (++av->n_mmaps > av->max_n_mmaps) 
+          av->max_n_mmaps = av->n_mmaps;
+        
+        sum = av->mmapped_mem += size;
+        if (sum > (CHUNK_SIZE_T)(av->max_mmapped_mem)) 
+          av->max_mmapped_mem = sum;
+        sum += av->sbrked_mem;
+        if (sum > (CHUNK_SIZE_T)(av->max_total_mem)) 
+          av->max_total_mem = sum;
+
+        check_chunk(p);
+        
+        return chunk2mem(p);
+      }
+    }
+  }
+#endif
+
+  /* Record incoming configuration of top */
+
+  old_top  = av->top;
+  old_size = chunksize(old_top);
+  old_end  = (char*)(chunk_at_offset(old_top, old_size));
+
+  brk = snd_brk = (char*)(MORECORE_FAILURE); 
+
+  /* 
+     If not the first time through, we require old_size to be
+     at least MINSIZE and to have prev_inuse set.
+  */
+
+  assert((old_top == initial_top(av) && old_size == 0) || 
+         ((CHUNK_SIZE_T) (old_size) >= MINSIZE &&
+          prev_inuse(old_top)));
+
+  /* Precondition: not enough current space to satisfy nb request */
+  assert((CHUNK_SIZE_T)(old_size) < (CHUNK_SIZE_T)(nb + MINSIZE));
+
+  /* Precondition: all fastbins are consolidated */
+  assert(!have_fastchunks(av));
+
+
+  /* Request enough space for nb + pad + overhead */
+
+  size = nb + av->top_pad + MINSIZE;
+
+  /*
+    If contiguous, we can subtract out existing space that we hope to
+    combine with new space. We add it back later only if
+    we don't actually get contiguous space.
+  */
+
+  if (contiguous(av))
+    size -= old_size;
+
+  /*
+    Round to a multiple of page size.
+    If MORECORE is not contiguous, this ensures that we only call it
+    with whole-page arguments.  And if MORECORE is contiguous and
+    this is not first time through, this preserves page-alignment of
+    previous calls. Otherwise, we correct to page-align below.
+  */
+
+  size = (size + pagemask) & ~pagemask;
+
+  /*
+    Don't try to call MORECORE if argument is so big as to appear
+    negative. Note that since mmap takes size_t arg, it may succeed
+    below even if we cannot call MORECORE.
+  */
+
+  if (size > 0) 
+    brk = (char*)(MORECORE(size));
+
+  /*
+    If have mmap, try using it as a backup when MORECORE fails or
+    cannot be used. This is worth doing on systems that have "holes" in
+    address space, so sbrk cannot extend to give contiguous space, but
+    space is available elsewhere.  Note that we ignore mmap max count
+    and threshold limits, since the space will not be used as a
+    segregated mmap region.
+  */
+
+#if HAVE_MMAP
+  if (brk == (char*)(MORECORE_FAILURE)) {
+
+    /* Cannot merge with old top, so add its size back in */
+    if (contiguous(av))
+      size = (size + old_size + pagemask) & ~pagemask;
+
+    /* If we are relying on mmap as backup, then use larger units */
+    if ((CHUNK_SIZE_T)(size) < (CHUNK_SIZE_T)(MMAP_AS_MORECORE_SIZE))
+      size = MMAP_AS_MORECORE_SIZE;
+
+    /* Don't try if size wraps around 0 */
+    if ((CHUNK_SIZE_T)(size) > (CHUNK_SIZE_T)(nb)) {
+
+      brk = (char*)(MMAP(0, size, PROT_READ|PROT_WRITE, MAP_PRIVATE));
+      
+      if (brk != (char*)(MORECORE_FAILURE)) {
+        
+        /* We do not need, and cannot use, another sbrk call to find end */
+        snd_brk = brk + size;
+        
+        /* 
+           Record that we no longer have a contiguous sbrk region. 
+           After the first time mmap is used as backup, we do not
+           ever rely on contiguous space since this could incorrectly
+           bridge regions.
+        */
+        set_noncontiguous(av);
+      }
+    }
+  }
+#endif
+
+  if (brk != (char*)(MORECORE_FAILURE)) {
+    av->sbrked_mem += size;
+
+    /*
+      If MORECORE extends previous space, we can likewise extend top size.
+    */
+    
+    if (brk == old_end && snd_brk == (char*)(MORECORE_FAILURE)) {
+      set_head(old_top, (size + old_size) | PREV_INUSE);
+    }
+
+    /*
+      Otherwise, make adjustments:
+      
+      * If the first time through or noncontiguous, we need to call sbrk
+        just to find out where the end of memory lies.
+
+      * We need to ensure that all returned chunks from malloc will meet
+        MALLOC_ALIGNMENT
+
+      * If there was an intervening foreign sbrk, we need to adjust sbrk
+        request size to account for fact that we will not be able to
+        combine new space with existing space in old_top.
+
+      * Almost all systems internally allocate whole pages at a time, in
+        which case we might as well use the whole last page of request.
+        So we allocate enough more memory to hit a page boundary now,
+        which in turn causes future contiguous calls to page-align.
+    */
+    
+    else {
+      front_misalign = 0;
+      end_misalign = 0;
+      correction = 0;
+      aligned_brk = brk;
+
+      /*
+        If MORECORE returns an address lower than we have seen before,
+        we know it isn't really contiguous.  This and some subsequent
+        checks help cope with non-conforming MORECORE functions and
+        the presence of "foreign" calls to MORECORE from outside of
+        malloc or by other threads.  We cannot guarantee to detect
+        these in all cases, but cope with the ones we do detect.
+      */
+      if (contiguous(av) && old_size != 0 && brk < old_end) {
+        set_noncontiguous(av);
+      }
+      
+      /* handle contiguous cases */
+      if (contiguous(av)) { 
+
+        /* 
+           We can tolerate forward non-contiguities here (usually due
+           to foreign calls) but treat them as part of our space for
+           stats reporting.
+        */
+        if (old_size != 0) 
+          av->sbrked_mem += brk - old_end;
+        
+        /* Guarantee alignment of first new chunk made from this space */
+
+        front_misalign = (INTERNAL_SIZE_T)chunk2mem(brk) & MALLOC_ALIGN_MASK;
+        if (front_misalign > 0) {
+
+          /*
+            Skip over some bytes to arrive at an aligned position.
+            We don't need to specially mark these wasted front bytes.
+            They will never be accessed anyway because
+            prev_inuse of av->top (and any chunk created from its start)
+            is always true after initialization.
+          */
+
+          correction = MALLOC_ALIGNMENT - front_misalign;
+          aligned_brk += correction;
+        }
+        
+        /*
+          If this isn't adjacent to existing space, then we will not
+          be able to merge with old_top space, so must add to 2nd request.
+        */
+        
+        correction += old_size;
+        
+        /* Extend the end address to hit a page boundary */
+        end_misalign = (INTERNAL_SIZE_T)(brk + size + correction);
+        correction += ((end_misalign + pagemask) & ~pagemask) - end_misalign;
+        
+        assert(correction >= 0);
+        snd_brk = (char*)(MORECORE(correction));
+        
+        if (snd_brk == (char*)(MORECORE_FAILURE)) {
+          /*
+            If can't allocate correction, try to at least find out current
+            brk.  It might be enough to proceed without failing.
+          */
+          correction = 0;
+          snd_brk = (char*)(MORECORE(0));
+        }
+        else if (snd_brk < brk) {
+          /*
+            If the second call gives noncontiguous space even though
+            it says it won't, the only course of action is to ignore
+            results of second call, and conservatively estimate where
+            the first call left us. Also set noncontiguous, so this
+            won't happen again, leaving at most one hole.
+            
+            Note that this check is intrinsically incomplete.  Because
+            MORECORE is allowed to give more space than we ask for,
+            there is no reliable way to detect a noncontiguity
+            producing a forward gap for the second call.
+          */
+          snd_brk = brk + size;
+          correction = 0;
+          set_noncontiguous(av);
+        }
+
+      }
+      
+      /* handle non-contiguous cases */
+      else { 
+        /* MORECORE/mmap must correctly align */
+        assert(aligned_OK(chunk2mem(brk)));
+        
+        /* Find out current end of memory */
+        if (snd_brk == (char*)(MORECORE_FAILURE)) {
+          snd_brk = (char*)(MORECORE(0));
+          av->sbrked_mem += snd_brk - brk - size;
+        }
+      }
+      
+      /* Adjust top based on results of second sbrk */
+      if (snd_brk != (char*)(MORECORE_FAILURE)) {
+        av->top = (mchunkptr)aligned_brk;
+        set_head(av->top, (snd_brk - aligned_brk + correction) | PREV_INUSE);
+        av->sbrked_mem += correction;
+     
+        /*
+          If not the first time through, we either have a
+          gap due to foreign sbrk or a non-contiguous region.  Insert a
+          double fencepost at old_top to prevent consolidation with space
+          we don't own. These fenceposts are artificial chunks that are
+          marked as inuse and are in any case too small to use.  We need
+          two to make sizes and alignments work out.
+        */
+   
+        if (old_size != 0) {
+          /* 
+             Shrink old_top to insert fenceposts, keeping size a
+             multiple of MALLOC_ALIGNMENT. We know there is at least
+             enough space in old_top to do this.
+          */
+          old_size = (old_size - 3*SIZE_SZ) & ~MALLOC_ALIGN_MASK;
+          set_head(old_top, old_size | PREV_INUSE);
+          
+          /*
+            Note that the following assignments completely overwrite
+            old_top when old_size was previously MINSIZE.  This is
+            intentional. We need the fencepost, even if old_top otherwise gets
+            lost.
+          */
+          chunk_at_offset(old_top, old_size          )->size =
+            SIZE_SZ|PREV_INUSE;
+
+          chunk_at_offset(old_top, old_size + SIZE_SZ)->size =
+            SIZE_SZ|PREV_INUSE;
+
+          /* 
+             If possible, release the rest, suppressing trimming.
+          */
+          if (old_size >= MINSIZE) {
+            INTERNAL_SIZE_T tt = av->trim_threshold;
+            av->trim_threshold = (INTERNAL_SIZE_T)(-1);
+            fREe(chunk2mem(old_top));
+            av->trim_threshold = tt;
+          }
+        }
+      }
+    }
+    
+    /* Update statistics */
+    sum = av->sbrked_mem;
+    if (sum > (CHUNK_SIZE_T)(av->max_sbrked_mem))
+      av->max_sbrked_mem = sum;
+    
+    sum += av->mmapped_mem;
+    if (sum > (CHUNK_SIZE_T)(av->max_total_mem))
+      av->max_total_mem = sum;
+
+    check_malloc_state();
+    
+    /* finally, do the allocation */
+
+    p = av->top;
+    size = chunksize(p);
+    
+    /* check that one of the above allocation paths succeeded */
+    if ((CHUNK_SIZE_T)(size) >= (CHUNK_SIZE_T)(nb + MINSIZE)) {
+      remainder_size = size - nb;
+      remainder = chunk_at_offset(p, nb);
+      av->top = remainder;
+      set_head(p, nb | PREV_INUSE);
+      set_head(remainder, remainder_size | PREV_INUSE);
+      check_malloced_chunk(p, nb);
+      return chunk2mem(p);
+    }
+
+  }
+
+  /* catch all failure paths */
+  MALLOC_FAILURE_ACTION;
+  return 0;
+}
+
+
+
+
+/*
+  sYSTRIm is an inverse of sorts to sYSMALLOc.  It gives memory back
+  to the system (via negative arguments to sbrk) if there is unused
+  memory at the `high' end of the malloc pool. It is called
+  automatically by free() when top space exceeds the trim
+  threshold. It is also called by the public malloc_trim routine.  It
+  returns 1 if it actually released any memory, else 0.
+*/
+
+#if __STD_C
+static int sYSTRIm(size_t pad, mstate av)
+#else
+static int sYSTRIm(pad, av) size_t pad; mstate av;
+#endif
+{
+  long  top_size;        /* Amount of top-most memory */
+  long  extra;           /* Amount to release */
+  long  released;        /* Amount actually released */
+  char* current_brk;     /* address returned by pre-check sbrk call */
+  char* new_brk;         /* address returned by post-check sbrk call */
+  size_t pagesz;
+
+  pagesz = av->pagesize;
+  top_size = chunksize(av->top);
+  
+  /* Release in pagesize units, keeping at least one page */
+  extra = ((top_size - pad - MINSIZE + (pagesz-1)) / pagesz - 1) * pagesz;
+  
+  if (extra > 0) {
+    
+    /*
+      Only proceed if end of memory is where we last set it.
+      This avoids problems if there were foreign sbrk calls.
+    */
+    current_brk = (char*)(MORECORE(0));
+    if (current_brk == (char*)(av->top) + top_size) {
+      
+      /*
+        Attempt to release memory. We ignore MORECORE return value,
+        and instead call again to find out where new end of memory is.
+        This avoids problems if first call releases less than we asked,
+        of if failure somehow altered brk value. (We could still
+        encounter problems if it altered brk in some very bad way,
+        but the only thing we can do is adjust anyway, which will cause
+        some downstream failure.)
+      */
+      
+      MORECORE(-extra);
+      new_brk = (char*)(MORECORE(0));
+      
+      if (new_brk != (char*)MORECORE_FAILURE) {
+        released = (long)(current_brk - new_brk);
+        
+        if (released != 0) {
+          /* Success. Adjust top. */
+          av->sbrked_mem -= released;
+          set_head(av->top, (top_size - released) | PREV_INUSE);
+          check_malloc_state();
+          return 1;
+        }
+      }
+    }
+  }
+  return 0;
+}
+
+/*
+  ------------------------------ malloc ------------------------------
+*/
+
+
+#if __STD_C
+Void_t* mALLOc(size_t bytes)
+#else
+  Void_t* mALLOc(bytes) size_t bytes;
+#endif
+{
+  mstate av = get_malloc_state();
+
+  INTERNAL_SIZE_T nb;               /* normalized request size */
+  unsigned int    idx;              /* associated bin index */
+  mbinptr         bin;              /* associated bin */
+  mfastbinptr*    fb;               /* associated fastbin */
+
+  mchunkptr       victim;           /* inspected/selected chunk */
+  INTERNAL_SIZE_T size;             /* its size */
+  int             victim_index;     /* its bin index */
+
+  mchunkptr       remainder;        /* remainder from a split */
+  CHUNK_SIZE_T    remainder_size;   /* its size */
+
+  unsigned int    block;            /* bit map traverser */
+  unsigned int    bit;              /* bit map traverser */
+  unsigned int    map;              /* current word of binmap */
+
+  mchunkptr       fwd;              /* misc temp for linking */
+  mchunkptr       bck;              /* misc temp for linking */
+
+  /*
+    Convert request size to internal form by adding SIZE_SZ bytes
+    overhead plus possibly more to obtain necessary alignment and/or
+    to obtain a size of at least MINSIZE, the smallest allocatable
+    size. Also, checked_request2size traps (returning 0) request sizes
+    that are so large that they wrap around zero when padded and
+    aligned.
+  */
+
+  checked_request2size(bytes, nb);
+
+  /*
+    Bypass search if no frees yet
+   */
+  if (!have_anychunks(av)) {
+    if (av->max_fast == 0) /* initialization check */
+      malloc_consolidate(av);
+    goto use_top;
+  }
+
+  /*
+    If the size qualifies as a fastbin, first check corresponding bin.
+  */
+
+  if ((CHUNK_SIZE_T)(nb) <= (CHUNK_SIZE_T)(av->max_fast)) { 
+    fb = &(av->fastbins[(fastbin_index(nb))]);
+    if ( (victim = *fb) != 0) {
+      *fb = victim->fd;
+      check_remalloced_chunk(victim, nb);
+      return chunk2mem(victim);
+    }
+  }
+
+  /*
+    If a small request, check regular bin.  Since these "smallbins"
+    hold one size each, no searching within bins is necessary.
+    (For a large request, we need to wait until unsorted chunks are
+    processed to find best fit. But for small ones, fits are exact
+    anyway, so we can check now, which is faster.)
+  */
+
+  if (in_smallbin_range(nb)) {
+    idx = smallbin_index(nb);
+    bin = bin_at(av,idx);
+
+    if ( (victim = last(bin)) != bin) {
+      bck = victim->bk;
+      set_inuse_bit_at_offset(victim, nb);
+      bin->bk = bck;
+      bck->fd = bin;
+      
+      check_malloced_chunk(victim, nb);
+      return chunk2mem(victim);
+    }
+  }
+
+  /* 
+     If this is a large request, consolidate fastbins before continuing.
+     While it might look excessive to kill all fastbins before
+     even seeing if there is space available, this avoids
+     fragmentation problems normally associated with fastbins.
+     Also, in practice, programs tend to have runs of either small or
+     large requests, but less often mixtures, so consolidation is not 
+     invoked all that often in most programs. And the programs that
+     it is called frequently in otherwise tend to fragment.
+  */
+
+  else {
+    idx = largebin_index(nb);
+    if (have_fastchunks(av)) 
+      malloc_consolidate(av);
+  }
+
+  /*
+    Process recently freed or remaindered chunks, taking one only if
+    it is exact fit, or, if this a small request, the chunk is remainder from
+    the most recent non-exact fit.  Place other traversed chunks in
+    bins.  Note that this step is the only place in any routine where
+    chunks are placed in bins.
+  */
+    
+  while ( (victim = unsorted_chunks(av)->bk) != unsorted_chunks(av)) {
+    bck = victim->bk;
+    size = chunksize(victim);
+    
+    /* 
+       If a small request, try to use last remainder if it is the
+       only chunk in unsorted bin.  This helps promote locality for
+       runs of consecutive small requests. This is the only
+       exception to best-fit, and applies only when there is
+       no exact fit for a small chunk.
+    */
+    
+    if (in_smallbin_range(nb) && 
+        bck == unsorted_chunks(av) &&
+        victim == av->last_remainder &&
+        (CHUNK_SIZE_T)(size) > (CHUNK_SIZE_T)(nb + MINSIZE)) {
+      
+      /* split and reattach remainder */
+      remainder_size = size - nb;
+      remainder = chunk_at_offset(victim, nb);
+      unsorted_chunks(av)->bk = unsorted_chunks(av)->fd = remainder;
+      av->last_remainder = remainder; 
+      remainder->bk = remainder->fd = unsorted_chunks(av);
+      
+      set_head(victim, nb | PREV_INUSE);
+      set_head(remainder, remainder_size | PREV_INUSE);
+      set_foot(remainder, remainder_size);
+      
+      check_malloced_chunk(victim, nb);
+      return chunk2mem(victim);
+    }
+    
+    /* remove from unsorted list */
+    unsorted_chunks(av)->bk = bck;
+    bck->fd = unsorted_chunks(av);
+    
+    /* Take now instead of binning if exact fit */
+    
+    if (size == nb) {
+      set_inuse_bit_at_offset(victim, size);
+      check_malloced_chunk(victim, nb);
+      return chunk2mem(victim);
+    }
+    
+    /* place chunk in bin */
+    
+    if (in_smallbin_range(size)) {
+      victim_index = smallbin_index(size);
+      bck = bin_at(av, victim_index);
+      fwd = bck->fd;
+    }
+    else {
+      victim_index = largebin_index(size);
+      bck = bin_at(av, victim_index);
+      fwd = bck->fd;
+      
+      if (fwd != bck) {
+        /* if smaller than smallest, place first */
+        if ((CHUNK_SIZE_T)(size) < (CHUNK_SIZE_T)(bck->bk->size)) {
+          fwd = bck;
+          bck = bck->bk;
+        }
+        else if ((CHUNK_SIZE_T)(size) >= 
+                 (CHUNK_SIZE_T)(FIRST_SORTED_BIN_SIZE)) {
+          
+          /* maintain large bins in sorted order */
+          size |= PREV_INUSE; /* Or with inuse bit to speed comparisons */
+          while ((CHUNK_SIZE_T)(size) < (CHUNK_SIZE_T)(fwd->size)) 
+            fwd = fwd->fd;
+          bck = fwd->bk;
+        }
+      }
+    }
+      
+    mark_bin(av, victim_index);
+    victim->bk = bck;
+    victim->fd = fwd;
+    fwd->bk = victim;
+    bck->fd = victim;
+  }
+  
+  /*
+    If a large request, scan through the chunks of current bin to
+    find one that fits.  (This will be the smallest that fits unless
+    FIRST_SORTED_BIN_SIZE has been changed from default.)  This is
+    the only step where an unbounded number of chunks might be
+    scanned without doing anything useful with them. However the
+    lists tend to be short.
+  */
+  
+  if (!in_smallbin_range(nb)) {
+    bin = bin_at(av, idx);
+    
+    for (victim = last(bin); victim != bin; victim = victim->bk) {
+      size = chunksize(victim);
+      
+      if ((CHUNK_SIZE_T)(size) >= (CHUNK_SIZE_T)(nb)) {
+        remainder_size = size - nb;
+        unlink(victim, bck, fwd);
+        
+        /* Exhaust */
+        if (remainder_size < MINSIZE)  {
+          set_inuse_bit_at_offset(victim, size);
+          check_malloced_chunk(victim, nb);
+          return chunk2mem(victim);
+        }
+        /* Split */
+        else {
+          remainder = chunk_at_offset(victim, nb);
+          unsorted_chunks(av)->bk = unsorted_chunks(av)->fd = remainder;
+          remainder->bk = remainder->fd = unsorted_chunks(av);
+          set_head(victim, nb | PREV_INUSE);
+          set_head(remainder, remainder_size | PREV_INUSE);
+          set_foot(remainder, remainder_size);
+          check_malloced_chunk(victim, nb);
+          return chunk2mem(victim);
+        } 
+      }
+    }    
+  }
+
+  /*
+    Search for a chunk by scanning bins, starting with next largest
+    bin. This search is strictly by best-fit; i.e., the smallest
+    (with ties going to approximately the least recently used) chunk
+    that fits is selected.
+    
+    The bitmap avoids needing to check that most blocks are nonempty.
+  */
+    
+  ++idx;
+  bin = bin_at(av,idx);
+  block = idx2block(idx);
+  map = av->binmap[block];
+  bit = idx2bit(idx);
+  
+  for (;;) {
+    
+    /* Skip rest of block if there are no more set bits in this block.  */
+    if (bit > map || bit == 0) {
+      do {
+        if (++block >= BINMAPSIZE)  /* out of bins */
+          goto use_top;
+      } while ( (map = av->binmap[block]) == 0);
+      
+      bin = bin_at(av, (block << BINMAPSHIFT));
+      bit = 1;
+    }
+    
+    /* Advance to bin with set bit. There must be one. */
+    while ((bit & map) == 0) {
+      bin = next_bin(bin);
+      bit <<= 1;
+      assert(bit != 0);
+    }
+    
+    /* Inspect the bin. It is likely to be non-empty */
+    victim = last(bin);
+    
+    /*  If a false alarm (empty bin), clear the bit. */
+    if (victim == bin) {
+      av->binmap[block] = map &= ~bit; /* Write through */
+      bin = next_bin(bin);
+      bit <<= 1;
+    }
+    
+    else {
+      size = chunksize(victim);
+      
+      /*  We know the first chunk in this bin is big enough to use. */
+      assert((CHUNK_SIZE_T)(size) >= (CHUNK_SIZE_T)(nb));
+      
+      remainder_size = size - nb;
+      
+      /* unlink */
+      bck = victim->bk;
+      bin->bk = bck;
+      bck->fd = bin;
+      
+      /* Exhaust */
+      if (remainder_size < MINSIZE) {
+        set_inuse_bit_at_offset(victim, size);
+        check_malloced_chunk(victim, nb);
+        return chunk2mem(victim);
+      }
+      
+      /* Split */
+      else {
+        remainder = chunk_at_offset(victim, nb);
+        
+        unsorted_chunks(av)->bk = unsorted_chunks(av)->fd = remainder;
+        remainder->bk = remainder->fd = unsorted_chunks(av);
+        /* advertise as last remainder */
+        if (in_smallbin_range(nb)) 
+          av->last_remainder = remainder; 
+        
+        set_head(victim, nb | PREV_INUSE);
+        set_head(remainder, remainder_size | PREV_INUSE);
+        set_foot(remainder, remainder_size);
+        check_malloced_chunk(victim, nb);
+        return chunk2mem(victim);
+      }
+    }
+  }
+
+  use_top:    
+  /*
+    If large enough, split off the chunk bordering the end of memory
+    (held in av->top). Note that this is in accord with the best-fit
+    search rule.  In effect, av->top is treated as larger (and thus
+    less well fitting) than any other available chunk since it can
+    be extended to be as large as necessary (up to system
+    limitations).
+    
+    We require that av->top always exists (i.e., has size >=
+    MINSIZE) after initialization, so if it would otherwise be
+    exhuasted by current request, it is replenished. (The main
+    reason for ensuring it exists is that we may need MINSIZE space
+    to put in fenceposts in sysmalloc.)
+  */
+  
+  victim = av->top;
+  size = chunksize(victim);
+  
+  if ((CHUNK_SIZE_T)(size) >= (CHUNK_SIZE_T)(nb + MINSIZE)) {
+    remainder_size = size - nb;
+    remainder = chunk_at_offset(victim, nb);
+    av->top = remainder;
+    set_head(victim, nb | PREV_INUSE);
+    set_head(remainder, remainder_size | PREV_INUSE);
+    
+    check_malloced_chunk(victim, nb);
+    return chunk2mem(victim);
+  }
+  
+  /* 
+     If no space in top, relay to handle system-dependent cases 
+  */
+  return sYSMALLOc(nb, av);    
+}
+
+/*
+  ------------------------------ free ------------------------------
+*/
+
+#if __STD_C
+void fREe(Void_t* mem)
+#else
+void fREe(mem) Void_t* mem;
+#endif
+{
+  mstate av = get_malloc_state();
+
+  mchunkptr       p;           /* chunk corresponding to mem */
+  INTERNAL_SIZE_T size;        /* its size */
+  mfastbinptr*    fb;          /* associated fastbin */
+  mchunkptr       nextchunk;   /* next contiguous chunk */
+  INTERNAL_SIZE_T nextsize;    /* its size */
+  int             nextinuse;   /* true if nextchunk is used */
+  INTERNAL_SIZE_T prevsize;    /* size of previous contiguous chunk */
+  mchunkptr       bck;         /* misc temp for linking */
+  mchunkptr       fwd;         /* misc temp for linking */
+
+  /* free(0) has no effect */
+  if (mem != 0) {
+    p = mem2chunk(mem);
+    size = chunksize(p);
+
+    check_inuse_chunk(p);
+
+    /*
+      If eligible, place chunk on a fastbin so it can be found
+      and used quickly in malloc.
+    */
+
+    if ((CHUNK_SIZE_T)(size) <= (CHUNK_SIZE_T)(av->max_fast)
+
+#if TRIM_FASTBINS
+        /* 
+           If TRIM_FASTBINS set, don't place chunks
+           bordering top into fastbins
+        */
+        && (chunk_at_offset(p, size) != av->top)
+#endif
+        ) {
+
+      set_fastchunks(av);
+      fb = &(av->fastbins[fastbin_index(size)]);
+      p->fd = *fb;
+      *fb = p;
+    }
+
+    /*
+       Consolidate other non-mmapped chunks as they arrive.
+    */
+
+    else if (!chunk_is_mmapped(p)) {
+      set_anychunks(av);
+
+      nextchunk = chunk_at_offset(p, size);
+      nextsize = chunksize(nextchunk);
+
+      /* consolidate backward */
+      if (!prev_inuse(p)) {
+        prevsize = p->prev_size;
+        size += prevsize;
+        p = chunk_at_offset(p, -((long) prevsize));
+        unlink(p, bck, fwd);
+      }
+
+      if (nextchunk != av->top) {
+        /* get and clear inuse bit */
+        nextinuse = inuse_bit_at_offset(nextchunk, nextsize);
+        set_head(nextchunk, nextsize);
+
+        /* consolidate forward */
+        if (!nextinuse) {
+          unlink(nextchunk, bck, fwd);
+          size += nextsize;
+        }
+
+        /*
+          Place the chunk in unsorted chunk list. Chunks are
+          not placed into regular bins until after they have
+          been given one chance to be used in malloc.
+        */
+
+        bck = unsorted_chunks(av);
+        fwd = bck->fd;
+        p->bk = bck;
+        p->fd = fwd;
+        bck->fd = p;
+        fwd->bk = p;
+
+        set_head(p, size | PREV_INUSE);
+        set_foot(p, size);
+        
+        check_free_chunk(p);
+      }
+
+      /*
+         If the chunk borders the current high end of memory,
+         consolidate into top
+      */
+
+      else {
+        size += nextsize;
+        set_head(p, size | PREV_INUSE);
+        av->top = p;
+        check_chunk(p);
+      }
+
+      /*
+        If freeing a large space, consolidate possibly-surrounding
+        chunks. Then, if the total unused topmost memory exceeds trim
+        threshold, ask malloc_trim to reduce top.
+
+        Unless max_fast is 0, we don't know if there are fastbins
+        bordering top, so we cannot tell for sure whether threshold
+        has been reached unless fastbins are consolidated.  But we
+        don't want to consolidate on each free.  As a compromise,
+        consolidation is performed if FASTBIN_CONSOLIDATION_THRESHOLD
+        is reached.
+      */
+
+      if ((CHUNK_SIZE_T)(size) >= FASTBIN_CONSOLIDATION_THRESHOLD) { 
+        if (have_fastchunks(av)) 
+          malloc_consolidate(av);
+
+#ifndef MORECORE_CANNOT_TRIM        
+        if ((CHUNK_SIZE_T)(chunksize(av->top)) >= 
+            (CHUNK_SIZE_T)(av->trim_threshold))
+          sYSTRIm(av->top_pad, av);
+#endif
+      }
+
+    }
+    /*
+      If the chunk was allocated via mmap, release via munmap()
+      Note that if HAVE_MMAP is false but chunk_is_mmapped is
+      true, then user must have overwritten memory. There's nothing
+      we can do to catch this error unless DEBUG is set, in which case
+      check_inuse_chunk (above) will have triggered error.
+    */
+
+    else {
+#if HAVE_MMAP
+      int ret;
+      INTERNAL_SIZE_T offset = p->prev_size;
+      av->n_mmaps--;
+      av->mmapped_mem -= (size + offset);
+      ret = munmap((char*)p - offset, size + offset);
+      /* munmap returns non-zero on failure */
+      assert(ret == 0);
+#endif
+    }
+  }
+}
+
+/*
+  ------------------------- malloc_consolidate -------------------------
+
+  malloc_consolidate is a specialized version of free() that tears
+  down chunks held in fastbins.  Free itself cannot be used for this
+  purpose since, among other things, it might place chunks back onto
+  fastbins.  So, instead, we need to use a minor variant of the same
+  code.
+  
+  Also, because this routine needs to be called the first time through
+  malloc anyway, it turns out to be the perfect place to trigger
+  initialization code.
+*/
+
+#if __STD_C
+static void malloc_consolidate(mstate av)
+#else
+static void malloc_consolidate(av) mstate av;
+#endif
+{
+  mfastbinptr*    fb;                 /* current fastbin being consolidated */
+  mfastbinptr*    maxfb;              /* last fastbin (for loop control) */
+  mchunkptr       p;                  /* current chunk being consolidated */
+  mchunkptr       nextp;              /* next chunk to consolidate */
+  mchunkptr       unsorted_bin;       /* bin header */
+  mchunkptr       first_unsorted;     /* chunk to link to */
+
+  /* These have same use as in free() */
+  mchunkptr       nextchunk;
+  INTERNAL_SIZE_T size;
+  INTERNAL_SIZE_T nextsize;
+  INTERNAL_SIZE_T prevsize;
+  int             nextinuse;
+  mchunkptr       bck;
+  mchunkptr       fwd;
+
+  /*
+    If max_fast is 0, we know that av hasn't
+    yet been initialized, in which case do so below
+  */
+
+  if (av->max_fast != 0) {
+    clear_fastchunks(av);
+
+    unsorted_bin = unsorted_chunks(av);
+
+    /*
+      Remove each chunk from fast bin and consolidate it, placing it
+      then in unsorted bin. Among other reasons for doing this,
+      placing in unsorted bin avoids needing to calculate actual bins
+      until malloc is sure that chunks aren't immediately going to be
+      reused anyway.
+    */
+    
+    maxfb = &(av->fastbins[fastbin_index(av->max_fast)]);
+    fb = &(av->fastbins[0]);
+    do {
+      if ( (p = *fb) != 0) {
+        *fb = 0;
+        
+        do {
+          check_inuse_chunk(p);
+          nextp = p->fd;
+          
+          /* Slightly streamlined version of consolidation code in free() */
+          size = p->size & ~PREV_INUSE;
+          nextchunk = chunk_at_offset(p, size);
+          nextsize = chunksize(nextchunk);
+          
+          if (!prev_inuse(p)) {
+            prevsize = p->prev_size;
+            size += prevsize;
+            p = chunk_at_offset(p, -((long) prevsize));
+            unlink(p, bck, fwd);
+          }
+          
+          if (nextchunk != av->top) {
+            nextinuse = inuse_bit_at_offset(nextchunk, nextsize);
+            set_head(nextchunk, nextsize);
+            
+            if (!nextinuse) {
+              size += nextsize;
+              unlink(nextchunk, bck, fwd);
+            }
+            
+            first_unsorted = unsorted_bin->fd;
+            unsorted_bin->fd = p;
+            first_unsorted->bk = p;
+            
+            set_head(p, size | PREV_INUSE);
+            p->bk = unsorted_bin;
+            p->fd = first_unsorted;
+            set_foot(p, size);
+          }
+          
+          else {
+            size += nextsize;
+            set_head(p, size | PREV_INUSE);
+            av->top = p;
+          }
+          
+        } while ( (p = nextp) != 0);
+        
+      }
+    } while (fb++ != maxfb);
+  }
+  else {
+    malloc_init_state(av);
+    check_malloc_state();
+  }
+}
+
+/*
+  ------------------------------ realloc ------------------------------
+*/
+
+
+#if __STD_C
+Void_t* rEALLOc(Void_t* oldmem, size_t bytes)
+#else
+Void_t* rEALLOc(oldmem, bytes) Void_t* oldmem; size_t bytes;
+#endif
+{
+  mstate av = get_malloc_state();
+
+  INTERNAL_SIZE_T  nb;              /* padded request size */
+
+  mchunkptr        oldp;            /* chunk corresponding to oldmem */
+  INTERNAL_SIZE_T  oldsize;         /* its size */
+
+  mchunkptr        newp;            /* chunk to return */
+  INTERNAL_SIZE_T  newsize;         /* its size */
+  Void_t*          newmem;          /* corresponding user mem */
+
+  mchunkptr        next;            /* next contiguous chunk after oldp */
+
+  mchunkptr        remainder;       /* extra space at end of newp */
+  CHUNK_SIZE_T     remainder_size;  /* its size */
+
+  mchunkptr        bck;             /* misc temp for linking */
+  mchunkptr        fwd;             /* misc temp for linking */
+
+  CHUNK_SIZE_T     copysize;        /* bytes to copy */
+  unsigned int     ncopies;         /* INTERNAL_SIZE_T words to copy */
+  INTERNAL_SIZE_T* s;               /* copy source */ 
+  INTERNAL_SIZE_T* d;               /* copy destination */
+
+
+#ifdef REALLOC_ZERO_BYTES_FREES
+  if (bytes == 0) {
+    fREe(oldmem);
+    return 0;
+  }
+#endif
+
+  /* realloc of null is supposed to be same as malloc */
+  if (oldmem == 0) return mALLOc(bytes);
+
+  checked_request2size(bytes, nb);
+
+  oldp    = mem2chunk(oldmem);
+  oldsize = chunksize(oldp);
+
+  check_inuse_chunk(oldp);
+
+  if (!chunk_is_mmapped(oldp)) {
+
+    if ((CHUNK_SIZE_T)(oldsize) >= (CHUNK_SIZE_T)(nb)) {
+      /* already big enough; split below */
+      newp = oldp;
+      newsize = oldsize;
+    }
+
+    else {
+      next = chunk_at_offset(oldp, oldsize);
+
+      /* Try to expand forward into top */
+      if (next == av->top &&
+          (CHUNK_SIZE_T)(newsize = oldsize + chunksize(next)) >=
+          (CHUNK_SIZE_T)(nb + MINSIZE)) {
+        set_head_size(oldp, nb);
+        av->top = chunk_at_offset(oldp, nb);
+        set_head(av->top, (newsize - nb) | PREV_INUSE);
+        return chunk2mem(oldp);
+      }
+      
+      /* Try to expand forward into next chunk;  split off remainder below */
+      else if (next != av->top && 
+               !inuse(next) &&
+               (CHUNK_SIZE_T)(newsize = oldsize + chunksize(next)) >=
+               (CHUNK_SIZE_T)(nb)) {
+        newp = oldp;
+        unlink(next, bck, fwd);
+      }
+
+      /* allocate, copy, free */
+      else {
+        newmem = mALLOc(nb - MALLOC_ALIGN_MASK);
+        if (newmem == 0)
+          return 0; /* propagate failure */
+      
+        newp = mem2chunk(newmem);
+        newsize = chunksize(newp);
+        
+        /*
+          Avoid copy if newp is next chunk after oldp.
+        */
+        if (newp == next) {
+          newsize += oldsize;
+          newp = oldp;
+        }
+        else {
+          /*
+            Unroll copy of <= 36 bytes (72 if 8byte sizes)
+            We know that contents have an odd number of
+            INTERNAL_SIZE_T-sized words; minimally 3.
+          */
+          
+          copysize = oldsize - SIZE_SZ;
+          s = (INTERNAL_SIZE_T*)(oldmem);
+          d = (INTERNAL_SIZE_T*)(newmem);
+          ncopies = copysize / sizeof(INTERNAL_SIZE_T);
+          assert(ncopies >= 3);
+          
+          if (ncopies > 9)
+            MALLOC_COPY(d, s, copysize);
+          
+          else {
+            *(d+0) = *(s+0);
+            *(d+1) = *(s+1);
+            *(d+2) = *(s+2);
+            if (ncopies > 4) {
+              *(d+3) = *(s+3);
+              *(d+4) = *(s+4);
+              if (ncopies > 6) {
+                *(d+5) = *(s+5);
+                *(d+6) = *(s+6);
+                if (ncopies > 8) {
+                  *(d+7) = *(s+7);
+                  *(d+8) = *(s+8);
+                }
+              }
+            }
+          }
+          
+          fREe(oldmem);
+          check_inuse_chunk(newp);
+          return chunk2mem(newp);
+        }
+      }
+    }
+
+    /* If possible, free extra space in old or extended chunk */
+
+    assert((CHUNK_SIZE_T)(newsize) >= (CHUNK_SIZE_T)(nb));
+
+    remainder_size = newsize - nb;
+
+    if (remainder_size < MINSIZE) { /* not enough extra to split off */
+      set_head_size(newp, newsize);
+      set_inuse_bit_at_offset(newp, newsize);
+    }
+    else { /* split remainder */
+      remainder = chunk_at_offset(newp, nb);
+      set_head_size(newp, nb);
+      set_head(remainder, remainder_size | PREV_INUSE);
+      /* Mark remainder as inuse so free() won't complain */
+      set_inuse_bit_at_offset(remainder, remainder_size);
+      fREe(chunk2mem(remainder)); 
+    }
+
+    check_inuse_chunk(newp);
+    return chunk2mem(newp);
+  }
+
+  /*
+    Handle mmap cases
+  */
+
+  else {
+#if HAVE_MMAP
+
+#if HAVE_MREMAP
+    INTERNAL_SIZE_T offset = oldp->prev_size;
+    size_t pagemask = av->pagesize - 1;
+    char *cp;
+    CHUNK_SIZE_T  sum;
+    
+    /* Note the extra SIZE_SZ overhead */
+    newsize = (nb + offset + SIZE_SZ + pagemask) & ~pagemask;
+
+    /* don't need to remap if still within same page */
+    if (oldsize == newsize - offset) 
+      return oldmem;
+
+    cp = (char*)mremap((char*)oldp - offset, oldsize + offset, newsize, 1);
+    
+    if (cp != (char*)MORECORE_FAILURE) {
+
+      newp = (mchunkptr)(cp + offset);
+      set_head(newp, (newsize - offset)|IS_MMAPPED);
+      
+      assert(aligned_OK(chunk2mem(newp)));
+      assert((newp->prev_size == offset));
+      
+      /* update statistics */
+      sum = av->mmapped_mem += newsize - oldsize;
+      if (sum > (CHUNK_SIZE_T)(av->max_mmapped_mem)) 
+        av->max_mmapped_mem = sum;
+      sum += av->sbrked_mem;
+      if (sum > (CHUNK_SIZE_T)(av->max_total_mem)) 
+        av->max_total_mem = sum;
+      
+      return chunk2mem(newp);
+    }
+#endif
+
+    /* Note the extra SIZE_SZ overhead. */
+    if ((CHUNK_SIZE_T)(oldsize) >= (CHUNK_SIZE_T)(nb + SIZE_SZ)) 
+      newmem = oldmem; /* do nothing */
+    else {
+      /* Must alloc, copy, free. */
+      newmem = mALLOc(nb - MALLOC_ALIGN_MASK);
+      if (newmem != 0) {
+        MALLOC_COPY(newmem, oldmem, oldsize - 2*SIZE_SZ);
+        fREe(oldmem);
+      }
+    }
+    return newmem;
+
+#else 
+    /* If !HAVE_MMAP, but chunk_is_mmapped, user must have overwritten mem */
+    check_malloc_state();
+    MALLOC_FAILURE_ACTION;
+    return 0;
+#endif
+  }
+}
+
+/*
+  ------------------------------ memalign ------------------------------
+*/
+
+#if __STD_C
+Void_t* mEMALIGn(size_t alignment, size_t bytes)
+#else
+Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes;
+#endif
+{
+  INTERNAL_SIZE_T nb;             /* padded  request size */
+  char*           m;              /* memory returned by malloc call */
+  mchunkptr       p;              /* corresponding chunk */
+  char*           brk;            /* alignment point within p */
+  mchunkptr       newp;           /* chunk to return */
+  INTERNAL_SIZE_T newsize;        /* its size */
+  INTERNAL_SIZE_T leadsize;       /* leading space before alignment point */
+  mchunkptr       remainder;      /* spare room at end to split off */
+  CHUNK_SIZE_T    remainder_size; /* its size */
+  INTERNAL_SIZE_T size;
+
+  /* If need less alignment than we give anyway, just relay to malloc */
+
+  if (alignment <= MALLOC_ALIGNMENT) return mALLOc(bytes);
+
+  /* Otherwise, ensure that it is at least a minimum chunk size */
+
+  if (alignment <  MINSIZE) alignment = MINSIZE;
+
+  /* Make sure alignment is power of 2 (in case MINSIZE is not).  */
+  if ((alignment & (alignment - 1)) != 0) {
+    size_t a = MALLOC_ALIGNMENT * 2;
+    while ((CHUNK_SIZE_T)a < (CHUNK_SIZE_T)alignment) a <<= 1;
+    alignment = a;
+  }
+
+  checked_request2size(bytes, nb);
+
+  /*
+    Strategy: find a spot within that chunk that meets the alignment
+    request, and then possibly free the leading and trailing space.
+  */
+
+
+  /* Call malloc with worst case padding to hit alignment. */
+
+  m  = (char*)(mALLOc(nb + alignment + MINSIZE));
+
+  if (m == 0) return 0; /* propagate failure */
+
+  p = mem2chunk(m);
+
+  if ((((PTR_UINT)(m)) % alignment) != 0) { /* misaligned */
+
+    /*
+      Find an aligned spot inside chunk.  Since we need to give back
+      leading space in a chunk of at least MINSIZE, if the first
+      calculation places us at a spot with less than MINSIZE leader,
+      we can move to the next aligned spot -- we've allocated enough
+      total room so that this is always possible.
+    */
+
+    brk = (char*)mem2chunk((PTR_UINT)(((PTR_UINT)(m + alignment - 1)) &
+                           -((signed long) alignment)));
+    if ((CHUNK_SIZE_T)(brk - (char*)(p)) < MINSIZE)
+      brk += alignment;
+
+    newp = (mchunkptr)brk;
+    leadsize = brk - (char*)(p);
+    newsize = chunksize(p) - leadsize;
+
+    /* For mmapped chunks, just adjust offset */
+    if (chunk_is_mmapped(p)) {
+      newp->prev_size = p->prev_size + leadsize;
+      set_head(newp, newsize|IS_MMAPPED);
+      return chunk2mem(newp);
+    }
+
+    /* Otherwise, give back leader, use the rest */
+    set_head(newp, newsize | PREV_INUSE);
+    set_inuse_bit_at_offset(newp, newsize);
+    set_head_size(p, leadsize);
+    fREe(chunk2mem(p));
+    p = newp;
+
+    assert (newsize >= nb &&
+            (((PTR_UINT)(chunk2mem(p))) % alignment) == 0);
+  }
+
+  /* Also give back spare room at the end */
+  if (!chunk_is_mmapped(p)) {
+    size = chunksize(p);
+    if ((CHUNK_SIZE_T)(size) > (CHUNK_SIZE_T)(nb + MINSIZE)) {
+      remainder_size = size - nb;
+      remainder = chunk_at_offset(p, nb);
+      set_head(remainder, remainder_size | PREV_INUSE);
+      set_head_size(p, nb);
+      fREe(chunk2mem(remainder));
+    }
+  }
+
+  check_inuse_chunk(p);
+  return chunk2mem(p);
+}
+
+/*
+  ------------------------------ calloc ------------------------------
+*/
+
+#if __STD_C
+Void_t* cALLOc(size_t n_elements, size_t elem_size)
+#else
+Void_t* cALLOc(n_elements, elem_size) size_t n_elements; size_t elem_size;
+#endif
+{
+  mchunkptr p;
+  CHUNK_SIZE_T  clearsize;
+  CHUNK_SIZE_T  nclears;
+  INTERNAL_SIZE_T* d;
+
+  Void_t* mem = mALLOc(n_elements * elem_size);
+
+  if (mem != 0) {
+    p = mem2chunk(mem);
+
+    if (!chunk_is_mmapped(p))
+    {  
+      /*
+        Unroll clear of <= 36 bytes (72 if 8byte sizes)
+        We know that contents have an odd number of
+        INTERNAL_SIZE_T-sized words; minimally 3.
+      */
+
+      d = (INTERNAL_SIZE_T*)mem;
+      clearsize = chunksize(p) - SIZE_SZ;
+      nclears = clearsize / sizeof(INTERNAL_SIZE_T);
+      assert(nclears >= 3);
+
+      if (nclears > 9)
+        MALLOC_ZERO(d, clearsize);
+
+      else {
+        *(d+0) = 0;
+        *(d+1) = 0;
+        *(d+2) = 0;
+        if (nclears > 4) {
+          *(d+3) = 0;
+          *(d+4) = 0;
+          if (nclears > 6) {
+            *(d+5) = 0;
+            *(d+6) = 0;
+            if (nclears > 8) {
+              *(d+7) = 0;
+              *(d+8) = 0;
+            }
+          }
+        }
+      }
+    }
+#if ! MMAP_CLEARS
+    else
+    {
+      d = (INTERNAL_SIZE_T*)mem;
+      /*
+        Note the additional SIZE_SZ
+      */
+      clearsize = chunksize(p) - 2*SIZE_SZ;
+      MALLOC_ZERO(d, clearsize);
+    }
+#endif
+  }
+  return mem;
+}
+
+/*
+  ------------------------------ cfree ------------------------------
+*/
+
+#if __STD_C
+void cFREe(Void_t *mem)
+#else
+void cFREe(mem) Void_t *mem;
+#endif
+{
+  fREe(mem);
+}
+
+/*
+  ------------------------- independent_calloc -------------------------
+*/
+
+#if __STD_C
+Void_t** iCALLOc(size_t n_elements, size_t elem_size, Void_t* chunks[])
+#else
+Void_t** iCALLOc(n_elements, elem_size, chunks) size_t n_elements; size_t elem_size; Void_t* chunks[];
+#endif
+{
+  size_t sz = elem_size; /* serves as 1-element array */
+  /* opts arg of 3 means all elements are same size, and should be cleared */
+  return iALLOc(n_elements, &sz, 3, chunks);
+}
+
+/*
+  ------------------------- independent_comalloc -------------------------
+*/
+
+#if __STD_C
+Void_t** iCOMALLOc(size_t n_elements, size_t sizes[], Void_t* chunks[])
+#else
+Void_t** iCOMALLOc(n_elements, sizes, chunks) size_t n_elements; size_t sizes[]; Void_t* chunks[];
+#endif
+{
+  return iALLOc(n_elements, sizes, 0, chunks);
+}
+
+
+/*
+  ------------------------------ ialloc ------------------------------
+  ialloc provides common support for independent_X routines, handling all of
+  the combinations that can result.
+
+  The opts arg has:
+    bit 0 set if all elements are same size (using sizes[0])
+    bit 1 set if elements should be zeroed
+*/
+
+
+#if __STD_C
+static Void_t** iALLOc(size_t n_elements, 
+                       size_t* sizes,  
+                       int opts,
+                       Void_t* chunks[])
+#else
+static Void_t** iALLOc(n_elements, sizes, opts, chunks) size_t n_elements; size_t* sizes; int opts; Void_t* chunks[];
+#endif
+{
+  mstate av = get_malloc_state();
+  INTERNAL_SIZE_T element_size;   /* chunksize of each element, if all same */
+  INTERNAL_SIZE_T contents_size;  /* total size of elements */
+  INTERNAL_SIZE_T array_size;     /* request size of pointer array */
+  Void_t*         mem;            /* malloced aggregate space */
+  mchunkptr       p;              /* corresponding chunk */
+  INTERNAL_SIZE_T remainder_size; /* remaining bytes while splitting */
+  Void_t**        marray;         /* either "chunks" or malloced ptr array */
+  mchunkptr       array_chunk;    /* chunk for malloced ptr array */
+  int             mmx;            /* to disable mmap */
+  INTERNAL_SIZE_T size;           
+  size_t          i;
+
+  /* Ensure initialization */
+  if (av->max_fast == 0) malloc_consolidate(av);
+
+  /* compute array length, if needed */
+  if (chunks != 0) {
+    if (n_elements == 0)
+      return chunks; /* nothing to do */
+    marray = chunks;
+    array_size = 0;
+  }
+  else {
+    /* if empty req, must still return chunk representing empty array */
+    if (n_elements == 0) 
+      return (Void_t**) mALLOc(0);
+    marray = 0;
+    array_size = request2size(n_elements * (sizeof(Void_t*)));
+  }
+
+  /* compute total element size */
+  if (opts & 0x1) { /* all-same-size */
+    element_size = request2size(*sizes);
+    contents_size = n_elements * element_size;
+  }
+  else { /* add up all the sizes */
+    element_size = 0;
+    contents_size = 0;
+    for (i = 0; i != n_elements; ++i) 
+      contents_size += request2size(sizes[i]);     
+  }
+
+  /* subtract out alignment bytes from total to minimize overallocation */
+  size = contents_size + array_size - MALLOC_ALIGN_MASK;
+  
+  /* 
+     Allocate the aggregate chunk.
+     But first disable mmap so malloc won't use it, since
+     we would not be able to later free/realloc space internal
+     to a segregated mmap region.
+ */
+  mmx = av->n_mmaps_max;   /* disable mmap */
+  av->n_mmaps_max = 0;
+  mem = mALLOc(size);
+  av->n_mmaps_max = mmx;   /* reset mmap */
+  if (mem == 0) 
+    return 0;
+
+  p = mem2chunk(mem);
+  assert(!chunk_is_mmapped(p)); 
+  remainder_size = chunksize(p);
+
+  if (opts & 0x2) {       /* optionally clear the elements */
+    MALLOC_ZERO(mem, remainder_size - SIZE_SZ - array_size);
+  }
+
+  /* If not provided, allocate the pointer array as final part of chunk */
+  if (marray == 0) {
+    array_chunk = chunk_at_offset(p, contents_size);
+    marray = (Void_t**) (chunk2mem(array_chunk));
+    set_head(array_chunk, (remainder_size - contents_size) | PREV_INUSE);
+    remainder_size = contents_size;
+  }
+
+  /* split out elements */
+  for (i = 0; ; ++i) {
+    marray[i] = chunk2mem(p);
+    if (i != n_elements-1) {
+      if (element_size != 0) 
+        size = element_size;
+      else
+        size = request2size(sizes[i]);          
+      remainder_size -= size;
+      set_head(p, size | PREV_INUSE);
+      p = chunk_at_offset(p, size);
+    }
+    else { /* the final element absorbs any overallocation slop */
+      set_head(p, remainder_size | PREV_INUSE);
+      break;
+    }
+  }
+
+#if DEBUG
+  if (marray != chunks) {
+    /* final element must have exactly exhausted chunk */
+    if (element_size != 0) 
+      assert(remainder_size == element_size);
+    else
+      assert(remainder_size == request2size(sizes[i]));
+    check_inuse_chunk(mem2chunk(marray));
+  }
+
+  for (i = 0; i != n_elements; ++i)
+    check_inuse_chunk(mem2chunk(marray[i]));
+#endif
+
+  return marray;
+}
+
+
+/*
+  ------------------------------ valloc ------------------------------
+*/
+
+#if __STD_C
+Void_t* vALLOc(size_t bytes)
+#else
+Void_t* vALLOc(bytes) size_t bytes;
+#endif
+{
+  /* Ensure initialization */
+  mstate av = get_malloc_state();
+  if (av->max_fast == 0) malloc_consolidate(av);
+  return mEMALIGn(av->pagesize, bytes);
+}
+
+/*
+  ------------------------------ pvalloc ------------------------------
+*/
+
+
+#if __STD_C
+Void_t* pVALLOc(size_t bytes)
+#else
+Void_t* pVALLOc(bytes) size_t bytes;
+#endif
+{
+  mstate av = get_malloc_state();
+  size_t pagesz;
+
+  /* Ensure initialization */
+  if (av->max_fast == 0) malloc_consolidate(av);
+  pagesz = av->pagesize;
+  return mEMALIGn(pagesz, (bytes + pagesz - 1) & ~(pagesz - 1));
+}
+   
+
+/*
+  ------------------------------ malloc_trim ------------------------------
+*/
+
+#if __STD_C
+int mTRIm(size_t pad)
+#else
+int mTRIm(pad) size_t pad;
+#endif
+{
+  mstate av = get_malloc_state();
+  /* Ensure initialization/consolidation */
+  malloc_consolidate(av);
+
+#ifndef MORECORE_CANNOT_TRIM        
+  return sYSTRIm(pad, av);
+#else
+  return 0;
+#endif
+}
+
+
+/*
+  ------------------------- malloc_usable_size -------------------------
+*/
+
+#if __STD_C
+size_t mUSABLe(Void_t* mem)
+#else
+size_t mUSABLe(mem) Void_t* mem;
+#endif
+{
+  mchunkptr p;
+  if (mem != 0) {
+    p = mem2chunk(mem);
+    if (chunk_is_mmapped(p))
+      return chunksize(p) - 2*SIZE_SZ;
+    else if (inuse(p))
+      return chunksize(p) - SIZE_SZ;
+  }
+  return 0;
+}
+
+/*
+  ------------------------------ mallinfo ------------------------------
+*/
+
+struct mallinfo mALLINFo()
+{
+  mstate av = get_malloc_state();
+  struct mallinfo mi;
+  int i;
+  mbinptr b;
+  mchunkptr p;
+  INTERNAL_SIZE_T avail;
+  INTERNAL_SIZE_T fastavail;
+  int nblocks;
+  int nfastblocks;
+
+  /* Ensure initialization */
+  if (av->top == 0)  malloc_consolidate(av);
+
+  check_malloc_state();
+
+  /* Account for top */
+  avail = chunksize(av->top);
+  nblocks = 1;  /* top always exists */
+
+  /* traverse fastbins */
+  nfastblocks = 0;
+  fastavail = 0;
+
+  for (i = 0; i < NFASTBINS; ++i) {
+    for (p = av->fastbins[i]; p != 0; p = p->fd) {
+      ++nfastblocks;
+      fastavail += chunksize(p);
+    }
+  }
+
+  avail += fastavail;
+
+  /* traverse regular bins */
+  for (i = 1; i < NBINS; ++i) {
+    b = bin_at(av, i);
+    for (p = last(b); p != b; p = p->bk) {
+      ++nblocks;
+      avail += chunksize(p);
+    }
+  }
+
+  mi.smblks = nfastblocks;
+  mi.ordblks = nblocks;
+  mi.fordblks = avail;
+  mi.uordblks = av->sbrked_mem - avail;
+  mi.arena = av->sbrked_mem;
+  mi.hblks = av->n_mmaps;
+  mi.hblkhd = av->mmapped_mem;
+  mi.fsmblks = fastavail;
+  mi.keepcost = chunksize(av->top);
+  mi.usmblks = av->max_total_mem;
+  return mi;
+}
+
+/*
+  ------------------------------ malloc_stats ------------------------------
+*/
+
+void mSTATs()
+{
+  struct mallinfo mi = mALLINFo();
+
+#ifdef WIN32
+  {
+    CHUNK_SIZE_T  free, reserved, committed;
+    vminfo (&free, &reserved, &committed);
+    fprintf(stderr, "free bytes       = %10lu\n", 
+            free);
+    fprintf(stderr, "reserved bytes   = %10lu\n", 
+            reserved);
+    fprintf(stderr, "committed bytes  = %10lu\n", 
+            committed);
+  }
+#endif
+
+
+  fprintf(stderr, "max system bytes = %10lu\n",
+          (CHUNK_SIZE_T)(mi.usmblks));
+  fprintf(stderr, "system bytes     = %10lu\n",
+          (CHUNK_SIZE_T)(mi.arena + mi.hblkhd));
+  fprintf(stderr, "in use bytes     = %10lu\n",
+          (CHUNK_SIZE_T)(mi.uordblks + mi.hblkhd));
+
+#ifdef WIN32 
+  {
+    CHUNK_SIZE_T  kernel, user;
+    if (cpuinfo (TRUE, &kernel, &user)) {
+      fprintf(stderr, "kernel ms        = %10lu\n", 
+              kernel);
+      fprintf(stderr, "user ms          = %10lu\n", 
+              user);
+    }
+  }
+#endif
+}
+
+
+/*
+  ------------------------------ mallopt ------------------------------
+*/
+
+#if __STD_C
+int mALLOPt(int param_number, int value)
+#else
+int mALLOPt(param_number, value) int param_number; int value;
+#endif
+{
+  mstate av = get_malloc_state();
+  /* Ensure initialization/consolidation */
+  malloc_consolidate(av);
+
+  switch(param_number) {
+  case M_MXFAST:
+    if (value >= 0 && value <= MAX_FAST_SIZE) {
+      set_max_fast(av, value);
+      return 1;
+    }
+    else
+      return 0;
+
+  case M_TRIM_THRESHOLD:
+    av->trim_threshold = value;
+    return 1;
+
+  case M_TOP_PAD:
+    av->top_pad = value;
+    return 1;
+
+  case M_MMAP_THRESHOLD:
+    av->mmap_threshold = value;
+    return 1;
+
+  case M_MMAP_MAX:
+#if !HAVE_MMAP
+    if (value != 0)
+      return 0;
+#endif
+    av->n_mmaps_max = value;
+    return 1;
+
+  default:
+    return 0;
+  }
+}
+
+
+/* 
+  -------------------- Alternative MORECORE functions --------------------
+*/
+
+
+/*
+  General Requirements for MORECORE.
+
+  The MORECORE function must have the following properties:
+
+  If MORECORE_CONTIGUOUS is false:
+
+    * MORECORE must allocate in multiples of pagesize. It will
+      only be called with arguments that are multiples of pagesize.
+
+    * MORECORE(0) must return an address that is at least 
+      MALLOC_ALIGNMENT aligned. (Page-aligning always suffices.)
+
+  else (i.e. If MORECORE_CONTIGUOUS is true):
+
+    * Consecutive calls to MORECORE with positive arguments
+      return increasing addresses, indicating that space has been
+      contiguously extended. 
+
+    * MORECORE need not allocate in multiples of pagesize.
+      Calls to MORECORE need not have args of multiples of pagesize.
+
+    * MORECORE need not page-align.
+
+  In either case:
+
+    * MORECORE may allocate more memory than requested. (Or even less,
+      but this will generally result in a malloc failure.)
+
+    * MORECORE must not allocate memory when given argument zero, but
+      instead return one past the end address of memory from previous
+      nonzero call. This malloc does NOT call MORECORE(0)
+      until at least one call with positive arguments is made, so
+      the initial value returned is not important.
+
+    * Even though consecutive calls to MORECORE need not return contiguous
+      addresses, it must be OK for malloc'ed chunks to span multiple
+      regions in those cases where they do happen to be contiguous.
+
+    * MORECORE need not handle negative arguments -- it may instead
+      just return MORECORE_FAILURE when given negative arguments.
+      Negative arguments are always multiples of pagesize. MORECORE
+      must not misinterpret negative args as large positive unsigned
+      args. You can suppress all such calls from even occurring by defining
+      MORECORE_CANNOT_TRIM,
+
+  There is some variation across systems about the type of the
+  argument to sbrk/MORECORE. If size_t is unsigned, then it cannot
+  actually be size_t, because sbrk supports negative args, so it is
+  normally the signed type of the same width as size_t (sometimes
+  declared as "intptr_t", and sometimes "ptrdiff_t").  It doesn't much
+  matter though. Internally, we use "long" as arguments, which should
+  work across all reasonable possibilities.
+
+  Additionally, if MORECORE ever returns failure for a positive
+  request, and HAVE_MMAP is true, then mmap is used as a noncontiguous
+  system allocator. This is a useful backup strategy for systems with
+  holes in address spaces -- in this case sbrk cannot contiguously
+  expand the heap, but mmap may be able to map noncontiguous space.
+
+  If you'd like mmap to ALWAYS be used, you can define MORECORE to be
+  a function that always returns MORECORE_FAILURE.
+
+  Malloc only has limited ability to detect failures of MORECORE
+  to supply contiguous space when it says it can. In particular,
+  multithreaded programs that do not use locks may result in
+  rece conditions across calls to MORECORE that result in gaps
+  that cannot be detected as such, and subsequent corruption.
+
+  If you are using this malloc with something other than sbrk (or its
+  emulation) to supply memory regions, you probably want to set
+  MORECORE_CONTIGUOUS as false.  As an example, here is a custom
+  allocator kindly contributed for pre-OSX macOS.  It uses virtually
+  but not necessarily physically contiguous non-paged memory (locked
+  in, present and won't get swapped out).  You can use it by
+  uncommenting this section, adding some #includes, and setting up the
+  appropriate defines above:
+
+      #define MORECORE osMoreCore
+      #define MORECORE_CONTIGUOUS 0
+
+  There is also a shutdown routine that should somehow be called for
+  cleanup upon program exit.
+
+  #define MAX_POOL_ENTRIES 100
+  #define MINIMUM_MORECORE_SIZE  (64 * 1024)
+  static int next_os_pool;
+  void *our_os_pools[MAX_POOL_ENTRIES];
+
+  void *osMoreCore(int size)
+  {
+    void *ptr = 0;
+    static void *sbrk_top = 0;
+
+    if (size > 0)
+    {
+      if (size < MINIMUM_MORECORE_SIZE)
+         size = MINIMUM_MORECORE_SIZE;
+      if (CurrentExecutionLevel() == kTaskLevel)
+         ptr = PoolAllocateResident(size + RM_PAGE_SIZE, 0);
+      if (ptr == 0)
+      {
+        return (void *) MORECORE_FAILURE;
+      }
+      // save ptrs so they can be freed during cleanup
+      our_os_pools[next_os_pool] = ptr;
+      next_os_pool++;
+      ptr = (void *) ((((CHUNK_SIZE_T) ptr) + RM_PAGE_MASK) & ~RM_PAGE_MASK);
+      sbrk_top = (char *) ptr + size;
+      return ptr;
+    }
+    else if (size < 0)
+    {
+      // we don't currently support shrink behavior
+      return (void *) MORECORE_FAILURE;
+    }
+    else
+    {
+      return sbrk_top;
+    }
+  }
+
+  // cleanup any allocated memory pools
+  // called as last thing before shutting down driver
+
+  void osCleanupMem(void)
+  {
+    void **ptr;
+
+    for (ptr = our_os_pools; ptr < &our_os_pools[MAX_POOL_ENTRIES]; ptr++)
+      if (*ptr)
+      {
+         PoolDeallocate(*ptr);
+         *ptr = 0;
+      }
+  }
+
+*/
+
+
+/* 
+  -------------------------------------------------------------- 
+
+  Emulation of sbrk for win32. 
+  Donated by J. Walter <Walter@GeNeSys-e.de>.
+  For additional information about this code, and malloc on Win32, see 
+     http://www.genesys-e.de/jwalter/
+*/
+
+
+#ifdef WIN32
+
+#ifdef _DEBUG
+/* #define TRACE */
+#endif
+
+/* Support for USE_MALLOC_LOCK */
+#ifdef USE_MALLOC_LOCK
+
+/* Wait for spin lock */
+static int slwait (int *sl) {
+    while (InterlockedCompareExchange ((void **) sl, (void *) 1, (void *) 0) != 0) 
+           Sleep (0);
+    return 0;
+}
+
+/* Release spin lock */
+static int slrelease (int *sl) {
+    InterlockedExchange (sl, 0);
+    return 0;
+}
+
+#ifdef NEEDED
+/* Spin lock for emulation code */
+static int g_sl;
+#endif
+
+#endif /* USE_MALLOC_LOCK */
+
+/* getpagesize for windows */
+static long getpagesize (void) {
+    static long g_pagesize = 0;
+    if (! g_pagesize) {
+        SYSTEM_INFO system_info;
+        GetSystemInfo (&system_info);
+        g_pagesize = system_info.dwPageSize;
+    }
+    return g_pagesize;
+}
+static long getregionsize (void) {
+    static long g_regionsize = 0;
+    if (! g_regionsize) {
+        SYSTEM_INFO system_info;
+        GetSystemInfo (&system_info);
+        g_regionsize = system_info.dwAllocationGranularity;
+    }
+    return g_regionsize;
+}
+
+/* A region list entry */
+typedef struct _region_list_entry {
+    void *top_allocated;
+    void *top_committed;
+    void *top_reserved;
+    long reserve_size;
+    struct _region_list_entry *previous;
+} region_list_entry;
+
+/* Allocate and link a region entry in the region list */
+static int region_list_append (region_list_entry **last, void *base_reserved, long reserve_size) {
+    region_list_entry *next = HeapAlloc (GetProcessHeap (), 0, sizeof (region_list_entry));
+    if (! next)
+        return FALSE;
+    next->top_allocated = (char *) base_reserved;
+    next->top_committed = (char *) base_reserved;
+    next->top_reserved = (char *) base_reserved + reserve_size;
+    next->reserve_size = reserve_size;
+    next->previous = *last;
+    *last = next;
+    return TRUE;
+}
+/* Free and unlink the last region entry from the region list */
+static int region_list_remove (region_list_entry **last) {
+    region_list_entry *previous = (*last)->previous;
+    if (! HeapFree (GetProcessHeap (), sizeof (region_list_entry), *last))
+        return FALSE;
+    *last = previous;
+    return TRUE;
+}
+
+#define CEIL(size,to)  (((size)+(to)-1)&~((to)-1))
+#define FLOOR(size,to) ((size)&~((to)-1))
+
+#define SBRK_SCALE  0
+/* #define SBRK_SCALE  1 */
+/* #define SBRK_SCALE  2 */
+/* #define SBRK_SCALE  4  */
+
+/* sbrk for windows */
+static void *sbrk (long size) {
+    static long g_pagesize, g_my_pagesize;
+    static long g_regionsize, g_my_regionsize;
+    static region_list_entry *g_last;
+    void *result = (void *) MORECORE_FAILURE;
+#ifdef TRACE
+    printf ("sbrk %d\n", size);
+#endif
+#if defined (USE_MALLOC_LOCK) && defined (NEEDED)
+    /* Wait for spin lock */
+    slwait (&g_sl);
+#endif
+    /* First time initialization */
+    if (! g_pagesize) {
+        g_pagesize = getpagesize ();
+        g_my_pagesize = g_pagesize << SBRK_SCALE;
+    }
+    if (! g_regionsize) {
+        g_regionsize = getregionsize ();
+        g_my_regionsize = g_regionsize << SBRK_SCALE;
+    }
+    if (! g_last) {
+        if (! region_list_append (&g_last, 0, 0)) 
+           goto sbrk_exit;
+    }
+    /* Assert invariants */
+    assert (g_last);
+    assert ((char *) g_last->top_reserved - g_last->reserve_size <= (char *) g_last->top_allocated &&
+            g_last->top_allocated <= g_last->top_committed);
+    assert ((char *) g_last->top_reserved - g_last->reserve_size <= (char *) g_last->top_committed &&
+            g_last->top_committed <= g_last->top_reserved &&
+            (unsigned) g_last->top_committed % g_pagesize == 0);
+    assert ((unsigned) g_last->top_reserved % g_regionsize == 0);
+    assert ((unsigned) g_last->reserve_size % g_regionsize == 0);
+    /* Allocation requested? */
+    if (size >= 0) {
+        /* Allocation size is the requested size */
+        long allocate_size = size;
+        /* Compute the size to commit */
+        long to_commit = (char *) g_last->top_allocated + allocate_size - (char *) g_last->top_committed;
+        /* Do we reach the commit limit? */
+        if (to_commit > 0) {
+            /* Round size to commit */
+            long commit_size = CEIL (to_commit, g_my_pagesize);
+            /* Compute the size to reserve */
+            long to_reserve = (char *) g_last->top_committed + commit_size - (char *) g_last->top_reserved;
+            /* Do we reach the reserve limit? */
+            if (to_reserve > 0) {
+                /* Compute the remaining size to commit in the current region */
+                long remaining_commit_size = (char *) g_last->top_reserved - (char *) g_last->top_committed;
+                if (remaining_commit_size > 0) {
+                    /* Assert preconditions */
+                    assert ((unsigned) g_last->top_committed % g_pagesize == 0);
+                    assert (0 < remaining_commit_size && remaining_commit_size % g_pagesize == 0); {
+                        /* Commit this */
+                        void *base_committed = VirtualAlloc (g_last->top_committed, remaining_commit_size,
+                                                                                        MEM_COMMIT, PAGE_READWRITE);
+                        /* Check returned pointer for consistency */
+                        if (base_committed != g_last->top_committed)
+                            goto sbrk_exit;
+                        /* Assert postconditions */
+                        assert ((unsigned) base_committed % g_pagesize == 0);
+#ifdef TRACE
+                        printf ("Commit %p %d\n", base_committed, remaining_commit_size);
+#endif
+                        /* Adjust the regions commit top */
+                        g_last->top_committed = (char *) base_committed + remaining_commit_size;
+                    }
+                } {
+                    /* Now we are going to search and reserve. */
+                    int contiguous = -1;
+                    int found = FALSE;
+                    MEMORY_BASIC_INFORMATION memory_info;
+                    void *base_reserved;
+                    long reserve_size;
+                    do {
+                        /* Assume contiguous memory */
+                        contiguous = TRUE;
+                        /* Round size to reserve */
+                        reserve_size = CEIL (to_reserve, g_my_regionsize);
+                        /* Start with the current region's top */
+                        memory_info.BaseAddress = g_last->top_reserved;
+                        /* Assert preconditions */
+                        assert ((unsigned) memory_info.BaseAddress % g_pagesize == 0);
+                        assert (0 < reserve_size && reserve_size % g_regionsize == 0);
+                        while (VirtualQuery (memory_info.BaseAddress, &memory_info, sizeof (memory_info))) {
+                            /* Assert postconditions */
+                            assert ((unsigned) memory_info.BaseAddress % g_pagesize == 0);
+#ifdef TRACE
+                            printf ("Query %p %d %s\n", memory_info.BaseAddress, memory_info.RegionSize, 
+                                    memory_info.State == MEM_FREE ? "FREE": 
+                                    (memory_info.State == MEM_RESERVE ? "RESERVED":
+                                     (memory_info.State == MEM_COMMIT ? "COMMITTED": "?")));
+#endif
+                            /* Region is free, well aligned and big enough: we are done */
+                            if (memory_info.State == MEM_FREE &&
+                                (unsigned) memory_info.BaseAddress % g_regionsize == 0 &&
+                                memory_info.RegionSize >= (unsigned) reserve_size) {
+                                found = TRUE;
+                                break;
+                            }
+                            /* From now on we can't get contiguous memory! */
+                            contiguous = FALSE;
+                            /* Recompute size to reserve */
+                            reserve_size = CEIL (allocate_size, g_my_regionsize);
+                            memory_info.BaseAddress = (char *) memory_info.BaseAddress + memory_info.RegionSize;
+                            /* Assert preconditions */
+                            assert ((unsigned) memory_info.BaseAddress % g_pagesize == 0);
+                            assert (0 < reserve_size && reserve_size % g_regionsize == 0);
+                        }
+                        /* Search failed? */
+                        if (! found) 
+                            goto sbrk_exit;
+                        /* Assert preconditions */
+                        assert ((unsigned) memory_info.BaseAddress % g_regionsize == 0);
+                        assert (0 < reserve_size && reserve_size % g_regionsize == 0);
+                        /* Try to reserve this */
+                        base_reserved = VirtualAlloc (memory_info.BaseAddress, reserve_size, 
+                                                                         MEM_RESERVE, PAGE_NOACCESS);
+                        if (! base_reserved) {
+                            int rc = GetLastError ();
+                            if (rc != ERROR_INVALID_ADDRESS) 
+                                goto sbrk_exit;
+                        }
+                        /* A null pointer signals (hopefully) a race condition with another thread. */
+                        /* In this case, we try again. */
+                    } while (! base_reserved);
+                    /* Check returned pointer for consistency */
+                    if (memory_info.BaseAddress && base_reserved != memory_info.BaseAddress)
+                        goto sbrk_exit;
+                    /* Assert postconditions */
+                    assert ((unsigned) base_reserved % g_regionsize == 0);
+#ifdef TRACE
+                    printf ("Reserve %p %d\n", base_reserved, reserve_size);
+#endif
+                    /* Did we get contiguous memory? */
+                    if (contiguous) {
+                        long start_size = (char *) g_last->top_committed - (char *) g_last->top_allocated;
+                        /* Adjust allocation size */
+                        allocate_size -= start_size;
+                        /* Adjust the regions allocation top */
+                        g_last->top_allocated = g_last->top_committed;
+                        /* Recompute the size to commit */
+                        to_commit = (char *) g_last->top_allocated + allocate_size - (char *) g_last->top_committed;
+                        /* Round size to commit */
+                        commit_size = CEIL (to_commit, g_my_pagesize);
+                    } 
+                    /* Append the new region to the list */
+                    if (! region_list_append (&g_last, base_reserved, reserve_size))
+                        goto sbrk_exit;
+                    /* Didn't we get contiguous memory? */
+                    if (! contiguous) {
+                        /* Recompute the size to commit */
+                        to_commit = (char *) g_last->top_allocated + allocate_size - (char *) g_last->top_committed;
+                        /* Round size to commit */
+                        commit_size = CEIL (to_commit, g_my_pagesize);
+                    }
+                }
+            } 
+            /* Assert preconditions */
+            assert ((unsigned) g_last->top_committed % g_pagesize == 0);
+            assert (0 < commit_size && commit_size % g_pagesize == 0); {
+                /* Commit this */
+                void *base_committed = VirtualAlloc (g_last->top_committed, commit_size, 
+                                                                            MEM_COMMIT, PAGE_READWRITE);
+                /* Check returned pointer for consistency */
+                if (base_committed != g_last->top_committed)
+                    goto sbrk_exit;
+                /* Assert postconditions */
+                assert ((unsigned) base_committed % g_pagesize == 0);
+#ifdef TRACE
+                printf ("Commit %p %d\n", base_committed, commit_size);
+#endif
+                /* Adjust the regions commit top */
+                g_last->top_committed = (char *) base_committed + commit_size;
+            }
+        } 
+        /* Adjust the regions allocation top */
+        g_last->top_allocated = (char *) g_last->top_allocated + allocate_size;
+        result = (char *) g_last->top_allocated - size;
+    /* Deallocation requested? */
+    } else if (size < 0) {
+        long deallocate_size = - size;
+        /* As long as we have a region to release */
+        while ((char *) g_last->top_allocated - deallocate_size < (char *) g_last->top_reserved - g_last->reserve_size) {
+            /* Get the size to release */
+            long release_size = g_last->reserve_size;
+            /* Get the base address */
+            void *base_reserved = (char *) g_last->top_reserved - release_size;
+            /* Assert preconditions */
+            assert ((unsigned) base_reserved % g_regionsize == 0); 
+            assert (0 < release_size && release_size % g_regionsize == 0); {
+                /* Release this */
+                int rc = VirtualFree (base_reserved, 0, 
+                                      MEM_RELEASE);
+                /* Check returned code for consistency */
+                if (! rc)
+                    goto sbrk_exit;
+#ifdef TRACE
+                printf ("Release %p %d\n", base_reserved, release_size);
+#endif
+            }
+            /* Adjust deallocation size */
+            deallocate_size -= (char *) g_last->top_allocated - (char *) base_reserved;
+            /* Remove the old region from the list */
+            if (! region_list_remove (&g_last))
+                goto sbrk_exit;
+        } {
+            /* Compute the size to decommit */
+            long to_decommit = (char *) g_last->top_committed - ((char *) g_last->top_allocated - deallocate_size);
+            if (to_decommit >= g_my_pagesize) {
+                /* Compute the size to decommit */
+                long decommit_size = FLOOR (to_decommit, g_my_pagesize);
+                /*  Compute the base address */
+                void *base_committed = (char *) g_last->top_committed - decommit_size;
+                /* Assert preconditions */
+                assert ((unsigned) base_committed % g_pagesize == 0);
+                assert (0 < decommit_size && decommit_size % g_pagesize == 0); {
+                    /* Decommit this */
+                    int rc = VirtualFree ((char *) base_committed, decommit_size, 
+                                          MEM_DECOMMIT);
+                    /* Check returned code for consistency */
+                    if (! rc)
+                        goto sbrk_exit;
+#ifdef TRACE
+                    printf ("Decommit %p %d\n", base_committed, decommit_size);
+#endif
+                }
+                /* Adjust deallocation size and regions commit and allocate top */
+                deallocate_size -= (char *) g_last->top_allocated - (char *) base_committed;
+                g_last->top_committed = base_committed;
+                g_last->top_allocated = base_committed;
+            }
+        }
+        /* Adjust regions allocate top */
+        g_last->top_allocated = (char *) g_last->top_allocated - deallocate_size;
+        /* Check for underflow */
+        if ((char *) g_last->top_reserved - g_last->reserve_size > (char *) g_last->top_allocated ||
+            g_last->top_allocated > g_last->top_committed) {
+            /* Adjust regions allocate top */
+            g_last->top_allocated = (char *) g_last->top_reserved - g_last->reserve_size;
+            goto sbrk_exit;
+        }
+        result = g_last->top_allocated;
+    }
+    /* Assert invariants */
+    assert (g_last);
+    assert ((char *) g_last->top_reserved - g_last->reserve_size <= (char *) g_last->top_allocated &&
+            g_last->top_allocated <= g_last->top_committed);
+    assert ((char *) g_last->top_reserved - g_last->reserve_size <= (char *) g_last->top_committed &&
+            g_last->top_committed <= g_last->top_reserved &&
+            (unsigned) g_last->top_committed % g_pagesize == 0);
+    assert ((unsigned) g_last->top_reserved % g_regionsize == 0);
+    assert ((unsigned) g_last->reserve_size % g_regionsize == 0);
+
+sbrk_exit:
+#if defined (USE_MALLOC_LOCK) && defined (NEEDED)
+    /* Release spin lock */
+    slrelease (&g_sl);
+#endif
+    return result;
+}
+
+/* mmap for windows */
+static void *mmap (void *ptr, long size, long prot, long type, long handle, long arg) {
+    static long g_pagesize;
+    static long g_regionsize;
+#ifdef TRACE
+    printf ("mmap %d\n", size);
+#endif
+#if defined (USE_MALLOC_LOCK) && defined (NEEDED)
+    /* Wait for spin lock */
+    slwait (&g_sl);
+#endif
+    /* First time initialization */
+    if (! g_pagesize) 
+        g_pagesize = getpagesize ();
+    if (! g_regionsize) 
+        g_regionsize = getregionsize ();
+    /* Assert preconditions */
+    assert ((unsigned) ptr % g_regionsize == 0);
+    assert (size % g_pagesize == 0);
+    /* Allocate this */
+    ptr = VirtualAlloc (ptr, size,
+                                           MEM_RESERVE | MEM_COMMIT | MEM_TOP_DOWN, PAGE_READWRITE);
+    if (! ptr) {
+        ptr = (void *) MORECORE_FAILURE;
+        goto mmap_exit;
+    }
+    /* Assert postconditions */
+    assert ((unsigned) ptr % g_regionsize == 0);
+#ifdef TRACE
+    printf ("Commit %p %d\n", ptr, size);
+#endif
+mmap_exit:
+#if defined (USE_MALLOC_LOCK) && defined (NEEDED)
+    /* Release spin lock */
+    slrelease (&g_sl);
+#endif
+    return ptr;
+}
+
+/* munmap for windows */
+static long munmap (void *ptr, long size) {
+    static long g_pagesize;
+    static long g_regionsize;
+    int rc = MUNMAP_FAILURE;
+#ifdef TRACE
+    printf ("munmap %p %d\n", ptr, size);
+#endif
+#if defined (USE_MALLOC_LOCK) && defined (NEEDED)
+    /* Wait for spin lock */
+    slwait (&g_sl);
+#endif
+    /* First time initialization */
+    if (! g_pagesize) 
+        g_pagesize = getpagesize ();
+    if (! g_regionsize) 
+        g_regionsize = getregionsize ();
+    /* Assert preconditions */
+    assert ((unsigned) ptr % g_regionsize == 0);
+    assert (size % g_pagesize == 0);
+    /* Free this */
+    if (! VirtualFree (ptr, 0, 
+                       MEM_RELEASE))
+        goto munmap_exit;
+    rc = 0;
+#ifdef TRACE
+    printf ("Release %p %d\n", ptr, size);
+#endif
+munmap_exit:
+#if defined (USE_MALLOC_LOCK) && defined (NEEDED)
+    /* Release spin lock */
+    slrelease (&g_sl);
+#endif
+    return rc;
+}
+
+static void vminfo (CHUNK_SIZE_T  *free, CHUNK_SIZE_T  *reserved, CHUNK_SIZE_T  *committed) {
+    MEMORY_BASIC_INFORMATION memory_info;
+    memory_info.BaseAddress = 0;
+    *free = *reserved = *committed = 0;
+    while (VirtualQuery (memory_info.BaseAddress, &memory_info, sizeof (memory_info))) {
+        switch (memory_info.State) {
+        case MEM_FREE:
+            *free += memory_info.RegionSize;
+            break;
+        case MEM_RESERVE:
+            *reserved += memory_info.RegionSize;
+            break;
+        case MEM_COMMIT:
+            *committed += memory_info.RegionSize;
+            break;
+        }
+        memory_info.BaseAddress = (char *) memory_info.BaseAddress + memory_info.RegionSize;
+    }
+}
+
+static int cpuinfo (int whole, CHUNK_SIZE_T  *kernel, CHUNK_SIZE_T  *user) {
+    if (whole) {
+        __int64 creation64, exit64, kernel64, user64;
+        int rc = GetProcessTimes (GetCurrentProcess (), 
+                                  (FILETIME *) &creation64,  
+                                  (FILETIME *) &exit64, 
+                                  (FILETIME *) &kernel64, 
+                                  (FILETIME *) &user64);
+        if (! rc) {
+            *kernel = 0;
+            *user = 0;
+            return FALSE;
+        } 
+        *kernel = (CHUNK_SIZE_T) (kernel64 / 10000);
+        *user = (CHUNK_SIZE_T) (user64 / 10000);
+        return TRUE;
+    } else {
+        __int64 creation64, exit64, kernel64, user64;
+        int rc = GetThreadTimes (GetCurrentThread (), 
+                                 (FILETIME *) &creation64,  
+                                 (FILETIME *) &exit64, 
+                                 (FILETIME *) &kernel64, 
+                                 (FILETIME *) &user64);
+        if (! rc) {
+            *kernel = 0;
+            *user = 0;
+            return FALSE;
+        } 
+        *kernel = (CHUNK_SIZE_T) (kernel64 / 10000);
+        *user = (CHUNK_SIZE_T) (user64 / 10000);
+        return TRUE;
+    }
+}
+
+#endif /* WIN32 */
+
+/* ------------------------------------------------------------
+History:
+    V2.7.1 Thu Jul 25 10:58:03 2002  Doug Lea  (dl at gee)
+      * Allow tuning of FIRST_SORTED_BIN_SIZE
+      * Use PTR_UINT as type for all ptr->int casts. Thanks to John Belmonte.
+      * Better detection and support for non-contiguousness of MORECORE. 
+        Thanks to Andreas Mueller, Conal Walsh, and Wolfram Gloger
+      * Bypass most of malloc if no frees. Thanks To Emery Berger.
+      * Fix freeing of old top non-contiguous chunk im sysmalloc.
+      * Raised default trim and map thresholds to 256K.
+      * Fix mmap-related #defines. Thanks to Lubos Lunak.
+      * Fix copy macros; added LACKS_FCNTL_H. Thanks to Neal Walfield.
+      * Branch-free bin calculation
+      * Default trim and mmap thresholds now 256K.
+
+    V2.7.0 Sun Mar 11 14:14:06 2001  Doug Lea  (dl at gee)
+      * Introduce independent_comalloc and independent_calloc.
+        Thanks to Michael Pachos for motivation and help.
+      * Make optional .h file available
+      * Allow > 2GB requests on 32bit systems.
+      * new WIN32 sbrk, mmap, munmap, lock code from <Walter@GeNeSys-e.de>.
+        Thanks also to Andreas Mueller <a.mueller at paradatec.de>,
+        and Anonymous.
+      * Allow override of MALLOC_ALIGNMENT (Thanks to Ruud Waij for 
+        helping test this.)
+      * memalign: check alignment arg
+      * realloc: don't try to shift chunks backwards, since this
+        leads to  more fragmentation in some programs and doesn't
+        seem to help in any others.
+      * Collect all cases in malloc requiring system memory into sYSMALLOc
+      * Use mmap as backup to sbrk
+      * Place all internal state in malloc_state
+      * Introduce fastbins (although similar to 2.5.1)
+      * Many minor tunings and cosmetic improvements
+      * Introduce USE_PUBLIC_MALLOC_WRAPPERS, USE_MALLOC_LOCK 
+      * Introduce MALLOC_FAILURE_ACTION, MORECORE_CONTIGUOUS
+        Thanks to Tony E. Bennett <tbennett@nvidia.com> and others.
+      * Include errno.h to support default failure action.
+
+    V2.6.6 Sun Dec  5 07:42:19 1999  Doug Lea  (dl at gee)
+      * return null for negative arguments
+      * Added Several WIN32 cleanups from Martin C. Fong <mcfong at yahoo.com>
+         * Add 'LACKS_SYS_PARAM_H' for those systems without 'sys/param.h'
+          (e.g. WIN32 platforms)
+         * Cleanup header file inclusion for WIN32 platforms
+         * Cleanup code to avoid Microsoft Visual C++ compiler complaints
+         * Add 'USE_DL_PREFIX' to quickly allow co-existence with existing
+           memory allocation routines
+         * Set 'malloc_getpagesize' for WIN32 platforms (needs more work)
+         * Use 'assert' rather than 'ASSERT' in WIN32 code to conform to
+           usage of 'assert' in non-WIN32 code
+         * Improve WIN32 'sbrk()' emulation's 'findRegion()' routine to
+           avoid infinite loop
+      * Always call 'fREe()' rather than 'free()'
+
+    V2.6.5 Wed Jun 17 15:57:31 1998  Doug Lea  (dl at gee)
+      * Fixed ordering problem with boundary-stamping
+
+    V2.6.3 Sun May 19 08:17:58 1996  Doug Lea  (dl at gee)
+      * Added pvalloc, as recommended by H.J. Liu
+      * Added 64bit pointer support mainly from Wolfram Gloger
+      * Added anonymously donated WIN32 sbrk emulation
+      * Malloc, calloc, getpagesize: add optimizations from Raymond Nijssen
+      * malloc_extend_top: fix mask error that caused wastage after
+        foreign sbrks
+      * Add linux mremap support code from HJ Liu
+
+    V2.6.2 Tue Dec  5 06:52:55 1995  Doug Lea  (dl at gee)
+      * Integrated most documentation with the code.
+      * Add support for mmap, with help from
+        Wolfram Gloger (Gloger@lrz.uni-muenchen.de).
+      * Use last_remainder in more cases.
+      * Pack bins using idea from  colin@nyx10.cs.du.edu
+      * Use ordered bins instead of best-fit threshhold
+      * Eliminate block-local decls to simplify tracing and debugging.
+      * Support another case of realloc via move into top
+      * Fix error occuring when initial sbrk_base not word-aligned.
+      * Rely on page size for units instead of SBRK_UNIT to
+        avoid surprises about sbrk alignment conventions.
+      * Add mallinfo, mallopt. Thanks to Raymond Nijssen
+        (raymond@es.ele.tue.nl) for the suggestion.
+      * Add `pad' argument to malloc_trim and top_pad mallopt parameter.
+      * More precautions for cases where other routines call sbrk,
+        courtesy of Wolfram Gloger (Gloger@lrz.uni-muenchen.de).
+      * Added macros etc., allowing use in linux libc from
+        H.J. Lu (hjl@gnu.ai.mit.edu)
+      * Inverted this history list
+
+    V2.6.1 Sat Dec  2 14:10:57 1995  Doug Lea  (dl at gee)
+      * Re-tuned and fixed to behave more nicely with V2.6.0 changes.
+      * Removed all preallocation code since under current scheme
+        the work required to undo bad preallocations exceeds
+        the work saved in good cases for most test programs.
+      * No longer use return list or unconsolidated bins since
+        no scheme using them consistently outperforms those that don't
+        given above changes.
+      * Use best fit for very large chunks to prevent some worst-cases.
+      * Added some support for debugging
+
+    V2.6.0 Sat Nov  4 07:05:23 1995  Doug Lea  (dl at gee)
+      * Removed footers when chunks are in use. Thanks to
+        Paul Wilson (wilson@cs.texas.edu) for the suggestion.
+
+    V2.5.4 Wed Nov  1 07:54:51 1995  Doug Lea  (dl at gee)
+      * Added malloc_trim, with help from Wolfram Gloger
+        (wmglo@Dent.MED.Uni-Muenchen.DE).
+
+    V2.5.3 Tue Apr 26 10:16:01 1994  Doug Lea  (dl at g)
+
+    V2.5.2 Tue Apr  5 16:20:40 1994  Doug Lea  (dl at g)
+      * realloc: try to expand in both directions
+      * malloc: swap order of clean-bin strategy;
+      * realloc: only conditionally expand backwards
+      * Try not to scavenge used bins
+      * Use bin counts as a guide to preallocation
+      * Occasionally bin return list chunks in first scan
+      * Add a few optimizations from colin@nyx10.cs.du.edu
+
+    V2.5.1 Sat Aug 14 15:40:43 1993  Doug Lea  (dl at g)
+      * faster bin computation & slightly different binning
+      * merged all consolidations to one part of malloc proper
+         (eliminating old malloc_find_space & malloc_clean_bin)
+      * Scan 2 returns chunks (not just 1)
+      * Propagate failure in realloc if malloc returns 0
+      * Add stuff to allow compilation on non-ANSI compilers
+          from kpv@research.att.com
+
+    V2.5 Sat Aug  7 07:41:59 1993  Doug Lea  (dl at g.oswego.edu)
+      * removed potential for odd address access in prev_chunk
+      * removed dependency on getpagesize.h
+      * misc cosmetics and a bit more internal documentation
+      * anticosmetics: mangled names in macros to evade debugger strangeness
+      * tested on sparc, hp-700, dec-mips, rs6000
+          with gcc & native cc (hp, dec only) allowing
+          Detlefs & Zorn comparison study (in SIGPLAN Notices.)
+
+    Trial version Fri Aug 28 13:14:29 1992  Doug Lea  (dl at g.oswego.edu)
+      * Based loosely on libg++-1.2X malloc. (It retains some of the overall
+         structure of old version,  but most details differ.)
+
+*/
index a615a64d9a28b3e197b09718f62e1932208e2aef..acd0661f8cea85e9da326a05112329e9b27c8def 100644 (file)
Binary files a/extras/pthreads.tar.gz and b/extras/pthreads.tar.gz differ
index ca8301720583307848ef83ada11b8558f955467a..53208b046e14ca6d16a8b16d3527dccfeb8c8337 100644 (file)
--- a/help.conf
+++ b/help.conf
@@ -190,7 +190,7 @@ help Who {
        " Retrieves information about users";
        " -";
        " Syntax:";
-       " /WHO [+|-][acghmnsuCM] [args]";
+       " /WHO [+|-][acghmnsuMR] [args]";
        " Flags are specified like channel modes, the flags cgmnsu all have arguments";
        " Flags are set to a positive check by +, a negative check by -";
        " The flags work as follows:";
@@ -204,11 +204,21 @@ help Who {
        " Flag s <server>: user is on server <server>, wildcards not accepted";
        " Flag u <user>: user has string <user> in their username, wildcards accepted";
        " Behavior flags:";
-       " Flag C: show first visible channel user is in";
        " Flag M: check for user in channels I am a member of";
+       " Flag R: show real hostnames (oper only.)";
        " -";
        " For backwards compatibility, /who 0 o still shows +o users";
        " Example: WHO +m o";
+       " -";
+       " The status flags returned by /WHO are as follows:";
+       "   G - The user is away (Gone)";
+       "   H - The user is not away (Here)";
+       "   * - The user is an operator.";
+       "   ! - The user is +H, and you only see them as * because you are also an oper.";
+       "   & - The user is invisible, in a secret channel or you would otherwise";
+        "       not see them except for the fact that you are an oper."
+       "   ~ - The channel shown in /who is secret or private and you are not on it.";
+       "   @, %, + - The user is an Op, Half-op, or Voice in the channel.";
 };
 
 help Whowas {
index 8279dcd341224570c0a56f192a3ebf8f7d60e780..d8f9eb2ddbc935136fc1d31339e3189377283fb4 100644 (file)
@@ -29,11 +29,13 @@ typedef     struct {
 #define AUTHTYPE_MD5        2
 #define AUTHTYPE_SHA1      3 
 #define AUTHTYPE_SSL_PUBKEY 4
+#define AUTHTYPE_RIPEMD160  5
 
 #ifdef USE_SSL
 #define AUTHENABLE_MD5
 #define AUTHENABLE_SHA1
 #define AUTHENABLE_SSL_PUBKEY
+#define AUTHENABLE_RIPEMD160
 /* OpenSSL provides a crypt() */
 #ifndef AUTHENABLE_UNIXCRYPT
 #define AUTHENABLE_UNIXCRYPT
@@ -41,7 +43,14 @@ typedef      struct {
 #endif
 
        
-
+#ifdef _WIN32
+#ifndef AUTHENABLE_MD5
+#define AUTHENABLE_MD5
+#endif
+#ifndef AUTHENABLE_SHA1
+#define AUTHENABLE_SHA1
+#endif
+#endif
 
 
 
index 7bb8312e7ca54c8e47e431020f86b454d7e7a0a4..fecc654a451f2b157f2a1319aac8346b78d92cd7 100644 (file)
 #include <time.h>
 #ifdef _WIN32
 #include <malloc.h>
+#ifdef INET6
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#endif
 #include <windows.h>
+#ifndef INET6
 #include <winsock.h>
+#endif
 #include <process.h>
 #include <io.h>
 #endif
@@ -213,9 +219,6 @@ static char *StsMalloc(size_t size, char *file, long line)
 
 extern struct SLink *find_user_link( /* struct SLink *, struct Client * */ );
 
-#define EVENT_HASHVALUE 337
-#define EVENT_CHECKIT match
-#define EVENT_CRC unreallogo
 /*
  * Protocol support text.  DO NO CHANGE THIS unless you know what
  * you are doing.
@@ -229,41 +232,50 @@ extern struct SLink *find_user_link( /* struct SLink *, struct Client * */ );
 
 /* IRCu/Hybrid/Unreal way now :) -Stskeeps */
 
-#define PROTOCTL_CLIENT           \
-               " MAP"            \
+#define PROTOCTL_CLIENT_1         \
+               "MAP"             \
                " KNOCK"          \
                " SAFELIST"       \
                " HCN"            \
-               " WALLCHOPS"      \
-               " WATCH=%i"       \
-               " SILENCE=%i"     \
-               " MODES=%i"       \
                " MAXCHANNELS=%i" \
                " MAXBANS=%i"     \
                " NICKLEN=%i"     \
                " TOPICLEN=%i"    \
                " KICKLEN=%i"     \
-               " CHANTYPES=%s"    \
-               " PREFIX=%s"     \
+               " MAXTARGETS=%i"  \
+               " AWAYLEN=%i"     \
+               " :are supported by this server"
+#define PROTOCTL_PARAMETERS_1    \
+               MAXCHANNELSPERUSER, \
+               MAXBANS, \
+               NICKLEN, \
+               TOPICLEN, \
+               TOPICLEN, \
+               MAXTARGETS, \
+               TOPICLEN
+
+#define PROTOCTL_CLIENT_2        \
+               "WALLCHOPS"       \
+               " WATCH=%i"       \
+               " SILENCE=%i"     \
+               " MODES=%i"       \
+               " CHANTYPES=%s"   \
+               " PREFIX=%s"      \
                " CHANMODES=%s,%s,%s,%s" \
-               " NETWORK=%s" \
+               " NETWORK=%s"     \
                " :are supported by this server"
 
-#define PROTOCTL_PARAMETERS MAXWATCH, \
-                            MAXSILES, \
-                            MAXMODEPARAMS, \
-                            MAXCHANNELSPERUSER, \
-                            MAXBANS, \
-                            NICKLEN, \
-                            TOPICLEN, \
-                            TOPICLEN, \
-                            "#",      \
-                            "(ohv)@%+", \
-                            "ohvbeqa", \
-                            "k", \
-                           "lfL", \
-                           "psmntirRcOAQKVHGCuzN", \
-                           ircnet005
+#define PROTOCTL_PARAMETERS_2    \
+                MAXWATCH, \
+                 MAXSILES, \
+                 MAXMODEPARAMS, \
+                 "#",      \
+                 "(ohv)@%+", \
+                 "ohvbeqa", \
+                 "kfL", \
+                "l", \
+                "psmntirRcOAQKVHGCuzN", \
+                ircnet005
                            
 /* Server-Server PROTOCTL -Stskeeps */
 #define PROTOCTL_SERVER "NOQUIT" \
index a579288b16ec1305594772fd0296ba2202060bd0..5f703cb0e03da49ec443469b460a57f8da5c06ce 100644 (file)
  *
  *
  */
-/*
- * To windows porters:
- *   You can specify name and url for their diff wircd sites
- *   #undef WIN32_SPECIFY for not having any notice about it in the wIRCd
- *    --Techie
- */
-#undef WIN32_SPECIFY
-
-#ifdef WIN32_SPECIFY
-#define WIN32_PORTER "McSkaf"
-#define WIN32_URL ""
-#endif
 
  /*
     * Define this if you're testing/debugging/programming.
  */
 #define ADMINCHAT 1
 
-/*
- * If we should catch SIGSEGVs..
-*/
-#define PROPER_COREDUMP
-
-
 /* 
  * If channel mode is +z, only send to secure links & people
  *
  */
 #undef COMPAT_BETA4_KEYS
 
-/*
- * Kill logging -otherguy
-*/
-#undef KILL_LOGGING
-
 /*
   If you want SHUN_NOTICES, define this
 */
 */
 #undef NO_OPEROVERRIDE
 
+/*
+ * OPEROVERRIDE_VERIFY
+ *   This will prompt opers before permitting them to join +p/+s
+ *   channels, decreasing the chances of someone "accidentally"
+ *   entering a random channel.
+ */
+#undef OPEROVERRIDE_VERIFY
+
 /*
  * NAZIISH_CHBAN_HANDLING (formerly ANNOYING_BAN_THING)
  *   Reject bans that are matched by existing bans, causes chanserv
 
 /* #undef      DEBUGMODE          define DEBUGMODE to enable debugging mode.*/
 
-/* We not check whether this is ok at compile time -- codemastr */
-/*
- * defining FORCE_CORE will automatically "unlimit core", forcing the
- * server to dump a core file whenever it has a fatal error.  -mlv
- */
-/* #define FORCE_CORE */
-
 /*
  * Full pathnames and defaults of irc system's support files. Please note that
  * these are only the recommened names and paths. Change as needed.
 #define        CPATH           "unrealircd.conf"       /* server configuration file */
 #define        MPATH           "ircd.motd"     /* server MOTD file */
 #define RPATH          "ircd.rules"    /* server rules file */
-#define ZPATH          "ircd.notes"    /* server notes */
-#define ZCONF          "networks/unrealircd.conf"      /* ircd configuration .. */
 #define OPATH          "oper.motd"     /* Operators MOTD file */
 #define        LPATH           "debug.log"     /* Where the debug file lives, if DEBUGMODE */
 #define        PPATH           "ircd.pid"      /* file for server pid */
 /* ------------------------- END CONFIGURATION SECTION -------------------- */
 #define MOTD MPATH
 #define RULES RPATH
-#define SNOTES ZPATH
 #define        MYNAME SPATH
 #define        CONFIGFILE CPATH
 #define        IRCD_PIDFILE PPATH
-#define GLINE_LOG GPATH
 
 #ifdef __osf__
 #define        OSF
index d34b19548c742b996767806d1d5cc9244a8fd600..a7ec465c480e3fc0eef50b2f2d76cee4d60f44f6 100644 (file)
@@ -99,6 +99,7 @@ extern ConfigItem_unknown_ext   *conf_unknown_set;
 extern ConfigItem_alias                *conf_alias;
 extern ConfigItem_include      *conf_include;
 extern ConfigItem_help         *conf_help;
+extern int             completed_connection(aClient *);
 extern void clear_unknown();
 extern EVENT(tkl_check_expire);
 extern EVENT(e_unload_module_delayed);
@@ -451,6 +452,7 @@ extern char *inetntop(int af, const void *in, char *local_dummy,
 char   *Inet_si2p(struct SOCKADDR_IN *sin);
 char   *Inet_si2pB(struct SOCKADDR_IN *sin, char *buf, int sz);
 char   *Inet_ia2p(struct IN_ADDR *ia);
+char   *Inet_ia2pNB(struct IN_ADDR *ia, int compressed);
 
 /*
  * CommandHash -Stskeeps
index f368af0b1631afcb1b6d28765aa0a3364fd7b518..7fe9d16d606065e56bf6789ce9bd69d2581db079 100644 (file)
 #define ERR_NONONREG        486
 #define ERR_NOTFORUSERS            487
 #define ERR_HTMDISABLED                 488
+#define ERR_SECUREONLYCHAN   489
 
 #define ERR_NOOPERHOST       491
 #define ERR_NOSERVICEHOST    492
 
 #define ERR_WHOSYNTAX 522
 #define ERR_WHOLIMEXCEED 523
+#define ERR_OPERSPVERIFY 524
 
 #define RPL_SNOMASK         8
 
diff --git a/include/relinfo.h b/include/relinfo.h
deleted file mode 100644 (file)
index 43909cd..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * Relinfo.h
- *
- * If anyone makes another release or a hybrid of Unreal
- * PLEASE CHANGE RELEASEID2 to the current time(NULL) (date +%s)
- * if another hybrid please change releaseprefix
- * if a unreal special edtion please select an IDTAG for it
- * - Stskeeps - 
-*/
-
-#include "stamp.h"
-#define RELEASEPREFIX "unrealircd"
-#define RELEASEIDTAG "000"
-#define RELEASEID RELEASEPREFIX "[" RELEASESTUFF "(" RELEASEID2 "/" RELEASEIDTAG ")]"
index 472e0261d7ed4df22d7d9902c97e983f8c45b338..ec5dc590822b6a333c085b348092aaf099cad205 100644 (file)
 
 /* Define if your system prepends an underscore to symbols */
 #undef UNDERSCORE
+
+/* Define if you have gethostbyname_r with 3 parameters */
+#undef HAVE_GETHOSTBYNAME_R_3
+
+/* Define if you have gethostbyname_r with 5 parameters */
+#undef HAVE_GETHOSTBYNAME_R_5
+
+/* Define if you have gethostbyname_r with 6 parameters */
+#undef HAVE_GETHOSTBYNAME_R_6
index 96c5e59a0a8e6db6ded59f01c5237b1a3856bb6d..a54b978dbd5ce169be9c2680fa0faa68876eb32e 100644 (file)
@@ -4,7 +4,17 @@
 
 
 extern   SSL_CTX * ctx;
+extern  SSL_CTX *ctx_server;
+extern  SSL_CTX *ctx_client;
+
 extern   SSL_METHOD *meth;
 extern   void init_ssl();
 extern   int ssl_handshake(aClient *);   /* Handshake the accpeted con.*/
 extern   int ssl_client_handshake(aClient *, ConfigItem_link *); /* and the initiated con.*/
+extern  int ircd_SSL_read(aClient *acptr, void *buf, int sz);
+extern  int ircd_SSL_write(aClient *acptr, const void *buf, int sz);
+extern  int ircd_SSL_accept(aClient *acptr, int fd);
+extern  int ircd_SSL_connect(aClient *acptr);
+extern  int SSL_smart_shutdown(SSL *ssl);
+extern  int ircd_SSL_client_handshake(aClient *acptr);
+extern   void SSL_set_nonblocking(SSL *s);
diff --git a/include/stamp.h b/include/stamp.h
deleted file mode 100644 (file)
index 0458de1..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-/* Auto created release stamping */
-#define RELEASEID2 "961323751"
-#define RELEASESTUFF "draconic"
index ebb0236dacc69550e4f8ecceb8d4199b4b7cb9f3..bafaeb83faefa8f5b34aa6a6eb852f68b9675c9f 100644 (file)
@@ -80,6 +80,7 @@ typedef struct _configitem_ulines ConfigItem_ulines;
 typedef struct _configitem_tld ConfigItem_tld;
 typedef struct _configitem_listen ConfigItem_listen;
 typedef struct _configitem_allow ConfigItem_allow;
+typedef struct _configflag_allow ConfigFlag_allow;
 typedef struct _configitem_allow_channel ConfigItem_allow_channel;
 typedef struct _configitem_vhost ConfigItem_vhost;
 typedef struct _configitem_ssl ConfigItem_ssl;
@@ -100,6 +101,10 @@ typedef struct _configitem_include ConfigItem_include;
 typedef struct _configitem_help ConfigItem_help;
 typedef struct liststruct ListStruct;
 
+#define CFG_TIME 0x0001
+#define CFG_SIZE 0x0002
+#define CFG_YESNO 0x0004
+
 typedef struct Watch aWatch;
 typedef struct Client aClient;
 typedef struct Channel aChannel;
@@ -190,8 +195,10 @@ typedef unsigned int u_int32_t;    /* XXX Hope this works! */
 #define        BOOT_AUTODIE    64
 #define BOOT_NOFORK     128
 
-#define        STAT_LOG        -6      /* logfile for -x */
-#define        STAT_CONNECTING -4
+#define        STAT_LOG        -7      /* logfile for -x */
+#define        STAT_CONNECTING -6
+#define STAT_SSL_CONNECT_HANDSHAKE -5
+#define STAT_SSL_ACCEPT_HANDSHAKE -4
 #define        STAT_HANDSHAKE  -3
 #define        STAT_ME         -2
 #define        STAT_UNKNOWN    -1
@@ -211,6 +218,13 @@ typedef unsigned int u_int32_t;    /* XXX Hope this works! */
 #define        IsClient(x)             ((x)->status == STAT_CLIENT)
 #define        IsLog(x)                ((x)->status == STAT_LOG)
 
+#ifdef USE_SSL
+#define IsSSLAcceptHandshake(x)        ((x)->status == STAT_SSL_ACCEPT_HANDSHAKE)
+#define IsSSLConnectHandshake(x)       ((x)->status == STAT_SSL_CONNECT_HANDSHAKE)
+#define SetSSLAcceptHandshake(x)       ((x)->status = STAT_SSL_ACCEPT_HANDSHAKE)
+#define SetSSLConnectHandshake(x)      ((x)->status = STAT_SSL_CONNECT_HANDSHAKE)
+#endif
+
 #define        SetConnecting(x)        ((x)->status = STAT_CONNECTING)
 #define        SetHandshake(x)         ((x)->status = STAT_HANDSHAKE)
 #define        SetMe(x)                ((x)->status = STAT_ME)
@@ -232,6 +246,8 @@ typedef unsigned int u_int32_t;     /* XXX Hope this works! */
 #define OPT_NOT_SJ3    0x0200
 #define OPT_SJB64      0x0400
 #define OPT_NOT_SJB64  0x0800
+#define OPT_VHP                0x1000
+#define OPT_NOT_VHP    0x2000
 
 #define        FLAGS_PINGSENT   0x0001 /* Unreplied ping sent */
 #define        FLAGS_DEADSOCKET 0x0002 /* Local socket is dead--Exiting soon */
@@ -262,7 +278,6 @@ typedef unsigned int u_int32_t;     /* XXX Hope this works! */
 #define FLAGS_SHUNNED    0x4000000
 #ifdef USE_SSL
 #define FLAGS_SSL       0x10000000
-#define FLAGS_SSL_HSHAKE 0x20000000
 #endif
 #define FLAGS_DCCBLOCK 0x40000000
 #define FLAGS_MAP       0x80000000     /* Show this entry in /map */
@@ -326,7 +341,6 @@ typedef unsigned int u_int32_t;     /* XXX Hope this works! */
 #ifdef STRIPBADWORDS
 #define IsFilteringWords(x)    ((x)->umodes & UMODE_STRIPBADWORDS)
 #endif
-
 #define IsNetAdmin(x)          ((x)->umodes & UMODE_NETADMIN)
 #define IsCoAdmin(x)           ((x)->umodes & UMODE_COADMIN)
 #define IsSAdmin(x)            ((x)->umodes & UMODE_SADMIN)
@@ -368,7 +382,9 @@ typedef unsigned int u_int32_t;     /* XXX Hope this works! */
 #define ClearHybNotice(x)      ((x)->flags &= ~FLAGS_HYBNOTICE)
 #define IsHidden(x)             ((x)->umodes & UMODE_HIDE)
 #define IsHideOper(x)          ((x)->umodes & UMODE_HIDEOPER)
-
+#ifdef USE_SSL
+#define IsSSL(x)               IsSecure(x)
+#endif
 #ifdef NOSPOOF
 #define        IsNotSpoof(x)           ((x)->nospoof == 0)
 #else
@@ -397,7 +413,7 @@ typedef unsigned int u_int32_t;     /* XXX Hope this works! */
 #define SetRegNick(x)          ((x)->umodes & UMODE_REGNICK)
 #define SetHidden(x)            ((x)->umodes |= UMODE_HIDE)
 #define SetHideOper(x)      ((x)->umodes |= UMODE_HIDEOPER)
-
+#define IsSecureConnect(x)     ((x)->umodes & UMODE_SECURE)
 #define ClearAdmin(x)          ((x)->umodes &= ~UMODE_ADMIN)
 #define ClearNetAdmin(x)       ((x)->umodes &= ~UMODE_NETADMIN)
 #define ClearCoAdmin(x)                ((x)->umodes &= ~UMODE_COADMIN)
@@ -591,6 +607,7 @@ struct aloopStruct {
        unsigned do_garbage_collect : 1;
        unsigned ircd_booted : 1;
        unsigned do_bancheck : 1;
+       unsigned tainted : 1;
 };
 
 typedef struct Whowas {
@@ -763,7 +780,7 @@ struct Client {
        struct Zdata *zip;      /* zip data */
 #endif
 #ifdef USE_SSL
-       struct  SSL     *ssl;
+       SSL             *ssl;
 #endif
 #ifndef NO_FDLIST
        long lastrecvM;         /* to check for activity --Mika */
@@ -885,6 +902,11 @@ struct _configitem_class {
        int        pingfreq, connfreq, maxclients, sendq, clients;
 };
 
+struct _configflag_allow {
+       unsigned        noident :1;
+       unsigned        useip :1;
+};
+
 struct _configitem_allow {
        ConfigItem       *prev, *next;
        ConfigFlag       flag;
@@ -893,6 +915,7 @@ struct _configitem_allow {
        short            maxperip;
        int              port;
        ConfigItem_class *class;
+       ConfigFlag_allow flags;
 };
 
 struct _configitem_oper {
@@ -1115,6 +1138,11 @@ struct stats {
        unsigned int is_loc;    /* local connections made */
 };
 
+typedef struct _MemoryInfo {
+       unsigned int classes;
+       unsigned long classesmem;
+} MemoryInfo;
+
 struct ListOptions {
        LOpts *next;
        Link *yeslist, *nolist;
index c39e36a194be8a7df7f6fec9e4dcd9a4fc987039..0d6ab1d780992bb883d765bc058437b86e80bf89 100644 (file)
@@ -45,7 +45,6 @@
 #ifdef STDLIBH
 #include <stdlib.h>
 #endif
-
 #ifdef STRINGSH
 #include <strings.h>
 #else
 #include <openssl/ssl.h>
 #endif
 #ifdef INET6
+#ifndef _WIN32
 #include <netinet/in.h>
 #include <sys/socket.h>
+#else
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#endif
 #endif
 #ifndef GOT_STRCASECMP
 #define        strcasecmp      mycmp
@@ -194,7 +198,7 @@ static const struct in6_addr in6addr_any = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
  * Socket, File, and Error portability macros
  */
 #ifndef _WIN32
-
+#define SET_ERRNO(x) errno = x
 #define READ_SOCK(fd, buf, len) read((fd), (buf), (len))
 #define WRITE_SOCK(fd, buf, len) write((fd), (buf), (len))
 #define CLOSE_SOCK(fd) close(fd)
@@ -211,7 +215,7 @@ static const struct in6_addr in6addr_any = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 #define P_EINTR         EINTR
 #define P_ETIMEDOUT     ETIMEDOUT
 #define P_ENOTSOCK     ENOTSOCK
-
+#define P_EIO          EIO
 #else
 
 /* IO and Error portability macros */
@@ -221,7 +225,7 @@ static const struct in6_addr in6addr_any = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 #define IOCTL(x, y, z) ioctlsocket((x), (y), (z))
 #define ERRNO WSAGetLastError()
 #define STRERROR(x) nt_strerror(x)
-
+#define SET_ERRNO(x) WSASetLastError(x)
 /* Error constant portability */
 #define P_EMFILE        WSAEMFILE
 #define P_ENOBUFS       WSAENOBUFS
@@ -231,6 +235,7 @@ static const struct in6_addr in6addr_any = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
 #define P_EINTR         WSAEINTR
 #define P_ETIMEDOUT     WSAETIMEDOUT
 #define P_ENOTSOCK     WSAENOTSOCK
+#define P_EIO          EIO
 #endif
 
 #endif /* __sys_include__ */
index e38b9898e7cfd6323d5a7e9a8c7307973127a680..c8706414cce249e26a1f82096a7f01356cbdeba8 100644 (file)
@@ -7,7 +7,6 @@
 #ifndef __versioninclude
 #define __versioninclude 1
 
-#include "relinfo.h"
 /* 
  * Mark of settings
  */
@@ -31,7 +30,7 @@
 #define PATCH1                 "3"
 #define PATCH2                 ".2"
 #define PATCH3                 "-Selene"
-#define PATCH4                 "[beta10]"
+#define PATCH4                 "[beta11]"
 #define PATCH5                 ""
 #define PATCH6                 ""
 #define PATCH7                 ""
index 8d0b6623e42845f6271d03f78c487710ef3c6fb8..f478c0019b6ab5ed6e28f13d25da36aaaf86d9d6 100755 (executable)
--- a/makeconf
+++ b/makeconf
@@ -54,17 +54,6 @@ else
        n='-n'
 fi
 
-# If Settings exist, load the info, otherwise tell them to run Config.
-
-if [ -r "config.settings" ]; then
-       . config.settings
-else
-       echo "Hmm, you need to run Config first!"
-       echo "Type ./Config"
-       echo "If you have run Config, make sure you are in the directory"
-       echo "you ran it from."
-       exit 1
-fi
 # we use a modified mkpasswd credit to Nelson Minar (minar@reed.edu)
 # for creating the original mkpasswd
 if test "x$CRYPT_OPER_PASSWORD" != "x" -o "x$CRYPT_LINK_PASSWORD" != "x" -o "x$CRYPT_XLINE_PASSWORD" != "x" ; then
@@ -246,7 +235,6 @@ echo "  O = global oper"
 echo "  N = network administrator"
 echo "  A = server administrator"
 echo "  C = co administrator"
-echo "  T = technical administrator"
 echo "  read unrealircd.doc for more info about O:line flags)"
 echo $n " [$FLAGS] -> $c"
 read cc
index c1c22cad07c9cdbfe4c0d222e9accec5e83f3e4a..0838af979dccd213eb924b25045e10c0f5a7acd9 100644 (file)
@@ -9,12 +9,13 @@ DEBUG=1
 FD_SETSIZE=/D SCAN_API=1 /D FD_SETSIZE=16384
 !IFNDEF DEBUG 
 CFLAGS=/MT /O2 /G5 /I ./INCLUDE /Fosrc/ /nologo $(FD_SETSIZE) $(NS_ADDRESS) /D STATIC_LINKING /D _WIN32GUI /D NOSPOOF=1 /c
-LFLAGS=kernel32.lib user32.lib gdi32.lib shell32.lib ws2_32.lib \
+LFLAGS=kernel32.lib user32.lib gdi32.lib shell32.lib ws2_32.lib advapi32.lib dbghelp.lib \
  oldnames.lib libcmt.lib comctl32.lib comdlg32.lib /nodefaultlib /nologo /out:WIRCD.EXE
 !ELSE
 CFLAGS=  /MTd /Zi /I ./INCLUDE /Fosrc/ /nologo $(FD_SETSIZE) $(NS_ADDRESS) /D STATIC_LINKING /D _WIN32GUI /D NOSPOOF=1 /c
-LFLAGS=kernel32.lib user32.lib gdi32.lib shell32.lib wsock32.lib \
- oldnames.lib libcmt.lib comctl32.lib comdlg32.lib /nodefaultlib /nologo /debug /debugtype:BOTH /OUT:WIRCD.EXE
+LFLAGS=kernel32.lib user32.lib gdi32.lib shell32.lib wsock32.lib dbghelp.lib\
+ oldnames.lib libcmt.lib comctl32.lib comdlg32.lib \
+ advapi32.lib /nodefaultlib /nologo /debug /debugtype:BOTH /OUT:WIRCD.EXE 
 !ENDIF
 
 
@@ -33,7 +34,8 @@ OBJ_FILES=SRC/CHANNEL.OBJ SRC/SEND.OBJ SRC/SOCKET.OBJ \
  SRC/VERSION.OBJ SRC/S_UNREAL.OBJ SRC/RES_INIT.OBJ \
  SRC/S_KLINE.OBJ SRC/S_EXTRA.OBJ SRC/IRCSPRINTF.OBJ SRC/LUSERS.OBJ \
  SRC/SCACHE.OBJ SRC/ALN.OBJ SRC/BADWORDS.OBJ SRC/WEBTV.OBJ SRC/RES.OBJ SRC/MODULES.OBJ \
- SRC/S_SVS.OBJ SRC/EVENTS.OBJ SRC/UMODES.OBJ SRC/AUTH.OBJ SRC/CIDR.OBJ SRC/SSL.OBJ
+ SRC/S_SVS.OBJ SRC/EVENTS.OBJ SRC/UMODES.OBJ SRC/AUTH.OBJ SRC/CIDR.OBJ SRC/SSL.OBJ \
+ SRC/SERVICE.OBJ SRC/DEBUG.OBJ
 
 MOD_FILES=SRC/L_COMMANDS.OBJ SRC/M_CHGHOST.OBJ SRC/M_SDESC.OBJ SRC/M_SETIDENT.OBJ \
  SRC/M_SETNAME.OBJ SRC/M_SETHOST.OBJ SRC/M_CHGIDENT.OBJ SRC/M_SVSMOTD.OBJ \
@@ -47,7 +49,7 @@ MOD_FILES=SRC/L_COMMANDS.OBJ SRC/M_CHGHOST.OBJ SRC/M_SDESC.OBJ SRC/M_SETIDENT.OB
  SRC/SCAN.OBJ SRC/SCAN_SOCKS.OBJ SRC/SCAN_HTTP.OBJ SRC/M_TKL.OBJ SRC/INVISIBILITY.OBJ
 
 
-ALL: CONF WIRCD.EXE
+ALL: CONF UNREAL.EXE WIRCD.EXE
 
 CLEAN:
         -@erase src\*.obj >NUL
@@ -56,13 +58,18 @@ CLEAN:
         -@erase src\win32\*.obj >NUL
         -@erase .\*.exe >NUL
 
+./UNREAL.EXE: SRC/UNREAL.OBJ SRC/WIN32/UNREAL.RES
+       $(LINK) advapi32.lib src/unreal.obj src/win32/unreal.res
+
 CONF:
        -@copy include\win32\setup.h include\setup.h >NUL
        $(CC) src/win32/config.c
        -@config.exe
 
+       
+
 ./WIRCD.EXE: $(OBJ_FILES) $(MOD_FILES) SRC/win32/WIN32.RES
-        $(LINK) $(LFLAGS) $(OBJ_FILES) $(MOD_FILES) SRC/win32/WIN32.RES SRC/WIN32/GNU_REGEX.LIB SRC/WIN32/DEBUG/STACKTRACE.LIB /MAPINFO:LINES /MAP
+        $(LINK) $(LFLAGS) $(OBJ_FILES) $(MOD_FILES) SRC/win32/WIN32.RES SRC/WIN32/GNU_REGEX.LIB  /MAPINFO:LINES /MAP
        -@erase src\win32\win32.res
 !IFNDEF DEBUG
  @echo Non Debug version built 
@@ -191,6 +198,15 @@ src/crule.obj: src/crule.c $(INCLUDES)
 src/win32gui.obj: src/win32/win32gui.c $(INCLUDES) ./include/resource.h
         $(CC) $(CFLAGS) src/win32/win32gui.c
 
+src/service.obj: src/win32/service.c $(INCLUDES)
+       $(CC) $(CFLAGS) src/win32/service.c
+
+src/unreal.obj: src/win32/unreal.c $(INCLUDES)
+       $(CC) $(CFLAGS) src/win32/unreal.c
+
+src/debug.obj: src/win32/debug.c $(INCLUDES)
+       $(CC) $(CFLAGS) src/win32/debug.c
+
 src/res_comp.obj: src/res_comp.c $(INCLUDES)
         $(CC) $(CFLAGS) src/res_comp.c
 
@@ -361,6 +377,10 @@ src/win32/win32.res: src/win32/win32gui.rc
         $(RC) /l 0x409 /fosrc/win32/win32.res /i ./include /i ./src \
               /d NDEBUG src/win32/win32gui.rc
 
+src/win32/unreal.res: src/win32/unreal.rc
+        $(RC) /l 0x409 /fosrc/win32/unreal.res /i ./include /i ./src \
+              /d NDEBUG src/win32/unreal.rc
+
 dummy:
 
 
diff --git a/networks/action-irc.network b/networks/action-irc.network
deleted file mode 100644 (file)
index 2e04f4a..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Action-IRC (Irc.Action-IRC.Net) Network Configuration File
- * --------------------------------------------------
- *  Added-at:     20 February 2001 19:59
- *  Author: bLaDe
- *  Email: bLaDe@action-irc.net
- * -----------------------------------------
- */
-
-set {
-        network-name            "Action-IRC";
-        default-server          "Irc.Action-IRC.Net";
-        services-server         "Services.Action-IRC.Net";
-        stats-server            "Stats.Action-IRC.Net";
-        help-channel            "#Action-Desk";
-        hiddenhost-prefix       "Action-IRC";
-        prefix-quit             "Quit:";
-        hosts {
-                local           "LocOp.Action-IRC.Net";
-                global          "Oper.Action-IRC.Net";
-                coadmin         "CoAdmin.Action-IRC.Net";
-                admin           "Admin.Action-IRC.Net";
-                servicesadmin   "CSOp.Action-IRC.Net";
-                netadmin        "NetAdmin.Action-IRC.Net";
-                host-on-oper-up "off";
-        };
-};
diff --git a/networks/bitchx.network b/networks/bitchx.network
deleted file mode 100644 (file)
index 2b2d49a..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * BitchX (irc.BitchX.cl) Network Configuration File
- * --------------------------------------------------
- *  Added-at:     11 June 2001 15:23
- *  Author: skier
- *  Email: admin@BitchX.cl
- * -----------------------------------------
- */
-
-set {
-        network-name            "BitchX";
-        default-server          "irc.BitchX.cl";
-        services-server         "services.BitchX.cl";
-        stats-server            "stats.BitchX.cl";
-        help-channel            "#linux";
-        hiddenhost-prefix       "bx.owns.you-";
-        prefix-quit             "Quit:";
-        hosts {
-                local           "locop.BitchX.cl";
-                global          "Oper.BitchX.cl";
-                coadmin         "coadmin.BitchX.cl";
-                admin           "Admin.BitchX.cl";
-                servicesadmin   "cops.BitchX.cl";
-                netadmin        "NETWORK-ADMINISTARTOR.BitchX.cl";
-                host-on-oper-up "on";
-        };
-};
diff --git a/networks/blind-irc.network b/networks/blind-irc.network
deleted file mode 100644 (file)
index e0673f5..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Blind-Irc (irc.Blind-Irc.com) Network Configuration File
- * --------------------------------------------------
- *  Added-at:     04 February 2001 19:23
- *  Author: Blind_lemon
- *  Email: Blind_Lemon@blind-irc.com
- * -----------------------------------------
- */
-
-set {
-        network-name            "Blind-Irc";
-        default-server          "irc.Blind-Irc.com";
-        services-server         "Services.Blind-Irc.com";
-        stats-server            "Blind-Irc.Stats.com";
-        help-channel            "#help";
-        hiddenhost-prefix       "~~NO_PEEKING~~";
-        prefix-quit             "Quit:";
-        hosts {
-                local           "Blind-Irc.Locop.com";
-                global          "Blind-Irc.Oper.com";
-                coadmin         "Blind-Irc.Co.Admin.com";
-                admin           "Blind-Irc.Admin.com";
-                servicesadmin   "Blind-Irc.Csop.com";
-                netadmin        "Blind-Irc.NetAdmin.com";
-                host-on-oper-up "on";
-        };
-};
diff --git a/networks/cc2.network b/networks/cc2.network
deleted file mode 100644 (file)
index d503fa8..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-set {
-       network-name            "CC2";
-       default-server          "irc.cc2.org";
-       services-server         "services.cc2.org";
-       stats-server            "stats.ircnet.org";
-       help-channel            "#help";
-       hiddenhost-prefix       "user";
-       prefix-quit             "Quit:";
-       hosts {
-               local           "locop.cc2.org";
-               global          "ircop.cc2.org";
-               coadmin         "coadmin.cc2.org";
-               admin           "admin.cc2.org";
-               servicesadmin   "services.cc2.org";
-               netadmin        "netadmin.cc2.org";
-               host-on-oper-up "on";
-       };
-};
diff --git a/networks/coolchat.network b/networks/coolchat.network
deleted file mode 100644 (file)
index 8c6d2dc..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Coolchat Irc Network (irc.coolchat.net) Network Configuration
-File
- *
- * Added-at:     21 September 2001 18:41
- * Author: ZeR0
- * Email: admin@cedarcreekcomm.com
- */
-
-set {
-network-name "Coolchat Irc Network";
-default-server "irc.coolchat.net"; 
-services-server "services.coolchat.net";
-stats-server "stats.mynet.org";
-help-channel "#help";
-hiddenhost-prefix "staff";
-hosts {
-local "staff.coolchat.ent";
-global "staff.coolchat.net";
-coadmin "";
-admin "staff.coolchat.net";
-servicesadmin "[";
-netadmin "staff.coolchat.net";
-host-on-oper yes;
-};
-};
-
diff --git a/networks/cynicnet.network b/networks/cynicnet.network
deleted file mode 100644 (file)
index f3795f6..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * CynicNet (irc.cynicnet.org) Network Configuration File
- * --------------------------------------------------
- *  Added-at:     29 March 2001 01:02
- *  Author: MaTRiX
- *  Email: admin@cynicnet.org
- * -----------------------------------------
- */
-
-set {
-        network-name            "CynicNet";
-        default-server          "irc.cynicnet.org";
-        services-server         "services.cynicnet.org";
-        stats-server            "stats.cynicnet.org";
-        help-channel            "#help";
-        hiddenhost-prefix       "CynicNet";
-        prefix-quit             "Quit:";
-        hosts {
-                local           "Locop.CynicNet.org";
-                global          "Oper.CynicNet.org";
-                coadmin         "Coadmin.CynicNet.org";
-                admin           "Admin.CynicNet.org";
-                servicesadmin   "CSOP.CynicNet.org";
-                netadmin        "Netadmin.CynicNet.org";
-                host-on-oper-up "on";
-        };
-};
diff --git a/networks/dark-core.network b/networks/dark-core.network
deleted file mode 100644 (file)
index 65c7259..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Dark Core Networks (irc.dark-core.net) Network Configuration File
- *
- * Added-at:     15 July 2001 03:28
- * Author: evilbunny
- * Email: evilbunny@dark-core.net
- */
-
-set {
-       network-name "Dark Core Networks";
-       default-server "irc.dark-core.net"; 
-       services-server "services.dark-core.net";
-       stats-server "stats.dark-core.net";
-       help-channel "#darkcore";
-       hiddenhost-prefix "DCN";
-       hosts {
-               local "locop.dark-core.net";
-               global "oper.dark-core.net";
-               coadmin "coadmin.dark-core.net";
-               admin "admin.dark-core.net";
-               servicesadmin "csop.dark-core.net";
-               netadmin "netadmin.dark-core.net";
-               host-on-oper yes;
-       };
-};
diff --git a/networks/darkfyre.network b/networks/darkfyre.network
deleted file mode 100644 (file)
index 72ae2e9..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-set {
-       network-name            "Darkfyre";
-       default-server          "irc.darkfyre.net";
-       services-server         "Services.Darkfyre.Net";
-       stats-server            "Stats.Darkfyre.Net";
-       help-channel            "#help";
-       hiddenhost-prefix       "darkfyre";
-       prefix-quit             "Quit:";
-       hosts {
-               local           "LocalOp.Darkfyre.Net";
-               global          "IRCop.Darkfyre.Net";
-               coadmin         "CoAdmin.Darkfyre.Net";
-               admin           "Admin.Darkfyre.Net";
-               servicesadmin   "CSop.Darkfyre.Net";
-               netadmin        "NetAdmin.Darkfyre.Net";
-               host-on-oper-up "on";
-       };
-};
diff --git a/networks/darkwar.network b/networks/darkwar.network
deleted file mode 100644 (file)
index 63525cd..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Darkwar (irc.darkwar.net) Network Configuration File
- * --------------------------------------------------
- * Added-at: 22 October 2000 19:40
- * Author: stryker
- * Email: stryker@darkwar.net
- * -----------------------------------------
- */
-
-set {
-       network-name            "Darkwar";
-       default-server          "irc.darkwar.net";
-       services-server         "services.darkwar.net";
-       stats-server            "stats.darkwar.net";
-       help-channel            "#darkwar\b";
-       hiddenhost-prefix       "hide";
-       prefix-quit             "Quit:";
-       hosts {
-               local           "locop.darkwar.net";
-               global          "oper.darkwar.net";
-               coadmin         "coadmin.darkwar.net";
-               admin           "admin.darkwar.net";
-               servicesadmin   "csop.darkwar.net";
-               netadmin        "netadmin.darkwar.net";
-               host-on-oper-up "on";
-       };
-};
diff --git a/networks/fireirc.network b/networks/fireirc.network
deleted file mode 100644 (file)
index 41c3fcd..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-set {
-       network-name            "FireIRC";
-       default-server          "irc.FireIRC.Net";
-       services-server         "services.FireIRC.Net";
-       stats-server            "stats.FireIRC.Net";
-       help-channel            "#Services";
-       hiddenhost-prefix       "FireIRC";
-       prefix-quit             "Quit:";
-       hosts {
-               local           "localOP.FireIRC.Net";
-               global          "ircOP.FireIRC.Net";
-               coadmin         "CoADMIN.FireIRC.Net";
-               admin           "Admin.FireIRC.Net";
-               servicesadmin   "serviceOP.FireIRC.Net";
-               netadmin        "NetADMIN.FireIRC.Net";
-               host-on-oper-up "off";
-       };
-};
diff --git a/networks/flort.network b/networks/flort.network
deleted file mode 100644 (file)
index 4260789..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Flort.Net (irc.flort.net) Network Configuration File
- *
- * Added-at:     12 October 2001 19:38
- * Author: dzhakimi
- * Email: ircadmin@flort.net
- */
-
-set {
-network-name "Flort.Net";
-default-server "irc.flort.net"; 
-services-server "services.flort.net";
-stats-server "stats.flort.net";
-help-channel "#Destek";
-hiddenhost-prefix "hide";
-hosts {
-local "locop.flort.net";
-global "oper.flort.net";
-coadmin "coadmin.flort.net";
-admin "admin.flort.net";
-servicesadmin "csop.flort.net";
-netadmin "netadmin.flort.net";
-host-on-oper yes;
-};
-};
-
diff --git a/networks/friendlyirc.network b/networks/friendlyirc.network
deleted file mode 100644 (file)
index 31b6b34..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * FriendlyIRC (irc.friendlyirc.net) Network Configuration File
- * --------------------------------------------------
- *  Added-at:     13 January 2001 18:19
- *  Author: Shukie
- *  Email: shukuwolf@glacierwinds.com
- * -----------------------------------------
- */
-
-set {
-        network-name            "FriendlyIRC";
-        default-server          "irc.friendlyirc.net";
-        services-server         "services.friendlyirc.net";
-        stats-server            "stats.friendlyirc.net";
-        help-channel            "#HelpDesk";
-        hiddenhost-prefix       "FriendlyIRC";
-        prefix-quit             "Quit:";
-        hosts {
-                local           "locop.friendlyirc.net";
-                global          "oper.friendlyirc.net";
-                coadmin         "coadmin.friendlyirc.net";
-                admin           "admin.friendlyirc.net";
-                servicesadmin   "csop.friendlyirc.net";
-                netadmin        "netadmin.friendlyirc.net";
-                host-on-oper-up "on";
-        };
-};
diff --git a/networks/geridnet.network b/networks/geridnet.network
deleted file mode 100644 (file)
index eff2492..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Gerid.Net (pi.gerid.net) Network Configuration File
- * --------------------------------------------------
- *  Added-at:     31 January 2001 13:22
- *  Author: Pi
- *  Email: support@gerid.net
- * -----------------------------------------
- */
-
-set {
-        network-name            "Gerid.Net";
-        default-server          "pi.gerid.net";
-        services-server         "services.gerid.net";
-        stats-server            "stats.gerid.net";
-        help-channel            "#help";
-        hiddenhost-prefix       "gerid";
-        prefix-quit             "Quit:";
-        hosts {
-                local           "localized.killing.spr.ee";
-                global          "is.a.bad.motherfucker.org";
-                coadmin         "helps.kill.your.ass";
-                admin           "owns.you";
-                servicesadmin   "will.kill.your.ass";
-                netadmin        "will.crucify.you";
-                host-on-oper-up "on";
-        };
-};
diff --git a/networks/globo.network b/networks/globo.network
deleted file mode 100644 (file)
index 727a0d1..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Globo (irc.globo.ircweb.com.br) Network Configuration File
- * --------------------------------------------------
- *  Added-at:     23 maio 2001 05:02
- *  Author: Titan
- *  Email: globo@ircweb.com.br
- * -----------------------------------------
- */
-
-set {
-        network-name            "Globo";
-        default-server          "irc.globo.ircweb.com.br";
-        services-server         "services.globo.com.br";
-        stats-server            "stats.globo.com.br";
-        help-channel            "#ajuda";
-        hiddenhost-prefix       "hide";
-        prefix-quit             "Quit:";
-        hosts {
-                local           "locop.globo.com.br";
-                global          "oper.globo.com.br";
-                coadmin         "coadmin.globo.com.br";
-                admin           "admin.globo.com.br";
-                servicesadmin   "csop.globo.com.br";
-                netadmin        "netadmin.globo.com.br";
-                host-on-oper-up "on";
-        };
-};
diff --git a/networks/irc4ever.network b/networks/irc4ever.network
deleted file mode 100644 (file)
index 8d65d51..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * IRC4ever.net (irc.IRC4ever.net) Network Configuration File
- *
- * Added-at:     18 August 2001 13:33
- * Author: [KrEciK]
- * Email: krecik@IRC4ever.net
- */
-
-set {
-network-name "IRC4ever.net";
-default-server "irc.IRC4ever.net"; 
-services-server "Services.IRC4ever.net";
-stats-server "Stats.IRC4ever.net";
-help-channel "#Pomoc";
-hiddenhost-prefix "I4e";
-hosts {
-local "IRC4ever.net";
-global "IRC4ever.net";
-coadmin "IRC4ever.net";
-admin "IRC4ever.net";
-servicesadmin "IRC4ever.net";
-netadmin "IRC4ever.net";
-host-on-oper yes;
-};
-};
-
diff --git a/networks/irclatino.network b/networks/irclatino.network
deleted file mode 100644 (file)
index f7f7524..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * IRCLatino (irc.redperu.com) Network Configuration File
- * --------------------------------------------------
- * Added-at:     30 May 2001 22:09
- *  Author: Tek
- *  Email: aleph@w-link.net
- * -----------------------------------------
- */
-
-set {
-        network-name            "IRCLatino";
-        default-server          "irc.redperu.com";
-        services-server         "services.united-irc.net";
-        stats-server            "stats.irclatino.org";
-        help-channel            "#Services";
-        hiddenhost-prefix       "IRCLatino";
-        prefix-quit             "Quit:";
-        hosts {
-                local           "Local-operator.irclatino.org";
-                global          "irc-operator.irclatino.org";
-                coadmin         "Co-Admin.irclatino.org";
-                admin           "server-admin.irclatino.org";
-                servicesadmin   "services-operator.irclatino.org";
-                netadmin        "NetAdmin.irclatino.org";
-                host-on-oper-up "on";
-        };
-};
diff --git a/networks/israelnet.network b/networks/israelnet.network
deleted file mode 100644 (file)
index 14438a3..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * IsraelNet (irc.israel.net) Network Configuration File
- * --------------------------------------------------
- * Added-at: 14 September 2000 14:39
- * Author: Web
- * Email: dors@Nonstop.net.il
- * -----------------------------------------
- */
-
-set {
-       network-name            "IsraelNet";
-       default-server          "irc.israel.net";
-       services-server         "services.israel.net";
-       stats-server            "stats.israel.net";
-       help-channel            "#OperHelp";
-       hiddenhost-prefix       "israel";
-       prefix-quit             "Quit:";
-       hosts {
-               local           "LocOP.Israel.Net";
-               global          "Oper.Israel.Net";
-               coadmin         "CoAdmin.Israel.Net";
-               admin           "Admin.Israel.Net";
-               servicesadmin   "CSop.Israel.Net";
-               netadmin        "NetAdmin.Israel.Net";
-               host-on-oper-up "on";
-       };
-};
diff --git a/networks/lostchat.network b/networks/lostchat.network
deleted file mode 100644 (file)
index bd0423b..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Lostchat (irc.lostchat.net) Network Configuration File
- * --------------------------------------------------
- *  Added-at:     22 February 2001 20:47
- *  Author: cerberus
- *  Email: cerberus@storm-services.net
- * -----------------------------------------
- */
-
-set {
-        network-name            "Lostchat";
-        default-server          "irc.lostchat.net";
-        services-server         "services.lostchat.net";
-        stats-server            "stats.mynet.org";
-        help-channel            "#lostchat";
-        hiddenhost-prefix       "lostchat";
-        prefix-quit             "Quit:";
-        hosts {
-                local           "locop.lostchat.net";
-                global          "oper.lostchat.net";
-                coadmin         "coadmin.lostchat.net";
-                admin           "admin.lostchat.net";
-                servicesadmin   "csop.lostchat.net";
-                netadmin        "netadmin.lostchat.net";
-                host-on-oper-up "on";
-        };
-};
diff --git a/networks/maxatnet.network b/networks/maxatnet.network
deleted file mode 100644 (file)
index e43fb79..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * MaxatNet (irc.maxat.net) Network Configuration File
- * --------------------------------------------------
- *  Added-at:     12 January 2001 23:35
- *  Author: Leo
- *  Email: anders-ove@anders-ove.net
- * -----------------------------------------
- */
-
-set {
-        network-name            "MaxatNet";
-        default-server          "irc.maxat.net";
-        services-server         "services.maxat.net";
-        stats-server            "stats.maxat.net";
-        help-channel            "#help";
-        hiddenhost-prefix       "hide";
-        prefix-quit             "Quit:";
-        hosts {
-                local           "locop.hub.no.maxat.net";
-                global          "oper.hub.no.maxat.net";
-                coadmin         "coadmin.hub.no.maxat.net";
-                admin           "admin.hub.no.maxat.net";
-                servicesadmin   "csop.hub.no.maxat.net";
-                netadmin        "netadmin.hub.no.maxat.net";
-                host-on-oper-up "off";
-        };
-};
diff --git a/networks/phatnet.network b/networks/phatnet.network
deleted file mode 100644 (file)
index ec9c238..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * PhatNet (irc.phat-net.de) Network Configuration File
- * --------------------------------------------------
- *  Date:         19 November 2000 00:49 CET(DE)
- *  Author:       [ins4ne]
- *  E-Mail:       ins4ne@phat-net.de
- * -----------------------------------------
- */
-
-set {
-        network-name            "PhatNet";
-        default-server          "irc.phat-net.de";
-        services-server         "service.phat-net.de";
-        stats-server            "stats.phat-net.de";
-        help-channel            "#phatnet";
-        hiddenhost-prefix       "PHAT";
-        prefix-quit             "Quit:";
-        hosts {
-                local           "locop.phat-net.de";
-                global          "ircop.phat-net.de";
-                coadmin         "coadmin.phat-net.de";
-                admin           "admin.phat-net.de";
-                servicesadmin   "csop.phat-net.de";
-                netadmin        "admin.phat-net.de";
-                host-on-oper-up "on";
-        };
-};
diff --git a/networks/pheernet.network b/networks/pheernet.network
deleted file mode 100644 (file)
index cd27e04..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * PheerNet (irc.pheernet.org) Network Configuration File
- * --------------------------------------------------
- *  Added-at:     05 February 2001 15:30
- *  Author: A_Xer0
- *  Email: korn@pheernet.org
- * -----------------------------------------
- */
-
-set {
-        network-name            "PheerNet";
-        default-server          "irc.pheernet.org";
-        services-server         "services.pheernet.org";
-        stats-server            "stats.pheernet.org";
-        help-channel            "#PheerNet";
-        hiddenhost-prefix       "DP";
-        prefix-quit             "Quit:";
-        hosts {
-                local           "locop.pheernet.org";
-                global          "ircop.pheernet.org";
-                coadmin         "coadmin.pheernet.org";
-                admin           "admin.pheernet.org";
-                servicesadmin   "csops.pheernet.org";
-                netadmin        "netadmin.pheernet.org";
-                host-on-oper-up "on";
-        };
-};
diff --git a/networks/roxnet.network b/networks/roxnet.network
deleted file mode 100644 (file)
index 14f90c8..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * ROXnet (irc.rox.za.net) Network Configuration File
- * --------------------------------------------------
- *  Added-at:     14 July 1999 00:00 GMT
- *  Author:       Stskeeps (Carsten Munk)
- *  E-Mail:       stskeeps@roxnet.org
- * $Id$
- * -----------------------------------------
- */
-
-set {
-       network-name            "ROXnet";
-       default-server          "irc.roxnet.org";
-       services-server         "services.roxnet.org";
-       stats-server            "stats.roxnet.org";
-       help-channel            "#ROXnet";
-       hiddenhost-prefix       "rox";
-       prefix-quit             "Quit:";
-       hosts {
-               local           "locop.roxnet.org";
-               global          "ircop.roxnet.org";
-               coadmin         "coadmin.roxnet.org";
-               admin           "admin.roxnet.org";
-               servicesadmin   "csops.roxnet.org";
-               netadmin        "netadmin.roxnet.org";
-               host-on-oper-up "off";
-       };
-};
diff --git a/networks/shallomchat.network b/networks/shallomchat.network
deleted file mode 100644 (file)
index 2347f9c..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * ShallomChat (IRC.ShallomChat.org) Network Configuration File
- * --------------------------------------------------
- *  Added-at:     30 March 2001 13:27
- *  Author: MasterScript
- *  Email: MasterScript@shallomchat.org
- * -----------------------------------------
- */
-
-set {
-        network-name            "ShallomChat";
-        default-server          "IRC.ShallomChat.org";
-        services-server         "Services.ShallomChat.org";
-        stats-server            "Stats.ShallomChat.org";
-        help-channel            "#SChelp";
-        hiddenhost-prefix       "ShallomChat";
-        prefix-quit             "Quit:";
-        hosts {
-                local           "Locop.ShallomChat.org";
-                global          "Oper.ShallomChat.org";
-                coadmin         "COadmin.ShallomChat.org";
-                admin           "Admin.ShallomChat.org";
-                servicesadmin   "CSop.ShallomChat.org";
-                netadmin        "Netadmin.ShallomChat.org";
-                host-on-oper-up "on";
-        };
-};
diff --git a/networks/solargalaxy.network b/networks/solargalaxy.network
deleted file mode 100644 (file)
index 5691eb5..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-set {
-       network-name            "SolarGalaxy";
-       default-server          "Irc.SolarGalaxy.Net";
-       services-server         "Services.SolarGalaxy.Net";
-       stats-server            "Stats.SolarGalaxy.Net";
-       help-channel            "#SolarGalaxy";
-       hiddenhost-prefix       "solargalaxy";
-       prefix-quit             "Quit:";
-       hosts {
-               local           "Locop.SolarGalaxy.Net";
-               global          "IRCop.SolarGalaxy.Net";
-               coadmin         "CoAdmin.SolarGalaxy.Net";
-               admin           "Admin.SolarGalaxy.Net";
-               servicesadmin   "ServiceOp.SolarGalaxy.Net";
-               netadmin        "NetAdmin.SolarGalaxy.Net";
-               host-on-oper-up "on";
-       };
-};
diff --git a/networks/spamnet.network b/networks/spamnet.network
deleted file mode 100644 (file)
index f9c1dcd..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * SpamNet (irc.spamnet.org) Network Configuration File
- * --------------------------------------------------
- *  Added-at:     29 July 2000 00:00 GMT
- *  Author:       cij (Brian Rogers)
- *  E-Mail:       n1uro@n1uro.com
- * -----------------------------------------
- */
-
-set {
-       network-name            "SpamNet";
-       default-server          "irc.spamnet.org";
-       services-server         "services.spamnet.org";
-       stats-server            "services.spamnet.org";
-       help-channel            "#SpamNet";
-       hiddenhost-prefix       "SpamNet";
-       prefix-quit             "Quit:";
-       hosts {
-               local           "locop.spamnet.org";
-               global          "ircop.spamnet.org";
-               coadmin         "coadmin.spamnet.org";
-               admin           "admin.spamnet.org";
-               servicesadmin   "csops.spamnet.org";
-               netadmin        "netadmin.spamnet.org";
-               host-on-oper-up "on";
-       };
-};
diff --git a/networks/spin.network b/networks/spin.network
deleted file mode 100644 (file)
index 760f18e..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * SpiN (irc.SpinEmpire.com) Network Configuration File
- * --------------------------------------------------
- * Added-at: 12 November 2000 04:26
- * Author: chris
- * Email: chris@netherrealm.org <mailto:chris@netherrealm.org>
- * -----------------------------------------
- */
-
-set {
-       network-name            "SpiN";
-       default-server          "irc.SpinEmpire.com";
-       services-server         "Services.SpinEmpire.com";
-       stats-server            "Stats.SpinEmpire.com";
-       help-channel            "#Lobby";
-       hiddenhost-prefix       "Spin";
-       prefix-quit             "Quit:";
-       hosts {
-               local           "LocalOper.SpinEmpire.com";
-               global          "Oper.SpinEmpire.org";
-               coadmin         "CoAdmin.SpinEmpire.com";
-               admin           "Admin.SpinEmpire.com";
-               servicesadmin   "ServicesOper.SpinEmpire.com";
-               netadmin        "NetAdmin.SpinEmpire.com";
-               host-on-oper-up "on";
-       };
-};
diff --git a/networks/starequinox.network b/networks/starequinox.network
deleted file mode 100644 (file)
index 1ddee9b..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * StarEquinox IRC Network (irc.StarEquinox.Net) Network
-Configuration File
- *
- * Added-at:     10 September 2001 13:54
- * Author: Starfire
- * Email: trish@starequinox.net
- */
-
-set {
-network-name "StarEquinox IRC Network";
-default-server "irc.StarEquinox.Net"; 
-services-server "Services.StarEquinox.Net";
-stats-server "Stats.StarEquinox.Net";
-help-channel "#help";
-hiddenhost-prefix "star";
-hosts {
-local "Oper.StarEquinox.Net";
-global "Oper.StarEquinox.Net";
-coadmin "CoAdmin.StarEquinox.Net";
-admin "Admin.StarEquinox.Net";
-servicesadmin "Oper.StarEquinox.Net";
-netadmin "NetAdmin.StarEquinox.Net";
-host-on-oper yes;
-};
-};
-
diff --git a/networks/tspre.network b/networks/tspre.network
deleted file mode 100644 (file)
index dbb9073..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-set {
-       network-name            "TSpre";
-       default-server          "irc.tspre.org";
-       services-server         "services.tspre.org";
-       stats-server            "stats.tspre.org";
-       help-channel            "#TSpre";
-       hiddenhost-prefix       "ts";
-       prefix-quit             "Quit:";
-       hosts {
-               local           "locop.tspre.org";
-               global          "ircop.tspre.org";
-               coadmin         "coadmin.tspre.org";
-               admin           "admin.tspre.org";
-               servicesadmin   "serviceop.tspre.org";
-               netadmin        "netadmin.tspre.org";
-               host-on-oper-up "off";
-       };
-};
diff --git a/networks/united-irc.network b/networks/united-irc.network
deleted file mode 100644 (file)
index 6aa034b..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * united-irc (irc.united-irc.net) Network Configuration File
- * --------------------------------------------------
- *  Added-at:     24 Mai 2001 12:52
- *  Author: Madkiss
- *  Email: madkiss@rylpz.de
- * -----------------------------------------
- */
-
-set {
-        network-name            "united-irc";
-        default-server          "irc.united-irc.net";
-        services-server         "services.united-irc.net";
-        stats-server            "stats.united-irc.net";
-        help-channel            "#help";
-        hiddenhost-prefix       "hide";
-        prefix-quit             "Quit:";
-        hosts {
-                local           "locop.united-irc.net";
-                global          "oper.united-irc.net";
-                coadmin         "coadmin.united-irc.net";
-                admin           "admin.united-irc.net";
-                servicesadmin   "csop.united-irc.net";
-                netadmin        "netadmin.united-irc.net";
-                host-on-oper-up "on";
-        };
-};
diff --git a/networks/unitedirc.network b/networks/unitedirc.network
deleted file mode 100644 (file)
index d7160ce..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-set {
-       network-name            "UnitedIRC";
-       default-server          "irc.unitedirc.com";
-       services-server         "services.unitedirc.com";
-       stats-server            "stats.unitedirc.com";
-       help-channel            "#UnitedIRC";
-       hiddenhost-prefix       "UnitedIRC";
-       prefix-quit             "Quit:";
-       hosts {
-               local           "locop.unitedirc.com";
-               global          "ircop.unitedirc.com";
-               coadmin         "coadmin.unitedirc.com";
-               admin           "admin.unitedirc.com";
-               servicesadmin   "csops.unitedirc.com";
-               netadmin        "netadmin.unitedirc.com";
-               host-on-oper-up "on";
-       };
-};
diff --git a/networks/uzaynet.network b/networks/uzaynet.network
deleted file mode 100644 (file)
index 2a4d0f2..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-set {
-       network-name            "UzayNet";
-       default-server          "uzaynet.com";
-       services-server         "service.uzaynet.com";
-       stats-server            "statserv.uzaynet.com";
-       help-channel            "#Help";
-       hiddenhost-prefix       "UzayNet";
-       prefix-quit             "Quit:";
-       hosts {
-               local           "locop.uzaynet.com";
-               global          "ircop.uzaynet.com";
-               coadmin         "coadmin.uzaynet.com";
-               admin           "admin.uzaynet.com";
-               servicesadmin   "serviceop.uzaynet.com";
-               netadmin        "netadmin.uzaynet.com";
-               host-on-oper-up "on";
-       };
-};
index bdf0610098d490539a4f8bcd56418e302b594b7a..5a24b190869d42b5ea9c3be87adf7c5a9989ed09 100644 (file)
@@ -153,7 +153,7 @@ help.o: help.c $(INCLUDES)
 #      ./buildm4 ${IRCDDIR}
 
 clean:
-       $(RM) -f *.o *.so *~ core ircd version.c chkconf; \
+       $(RM) -f *.o *.so *~ core ircd version.c; \
        cd modules; make clean
 
 cleandir: clean
index 035eded31046986366c01e59f7a2956fff45109a..3dd52e434b44e2559bc2a481ceb00a187623a0df 100644 (file)
@@ -54,6 +54,9 @@ anAuthStruct AuthTypes[] = {
 #endif
 #ifdef AUTHENABLE_SSL_PUBKEY
        {"sslpubkey",   AUTHTYPE_SSL_PUBKEY},
+#endif
+#ifdef AUTHENABLE_RIPEMD160
+       {"ripemd160",   AUTHTYPE_RIPEMD160},
 #endif
        {NULL,          0}
 };
@@ -137,17 +140,11 @@ int       Auth_Check(aClient *cptr, anAuthStruct *as, char *para)
 #ifdef AUTHENABLE_UNIXCRYPT
        extern  char *crypt();
 #endif
-#if defined(AUTHENABLE_MD5) || defined(AUTHENABLE_SHA1)
+#if defined(AUTHENABLE_MD5) || defined(AUTHENABLE_SHA1) || defined(AUTHENABLE_RIPEMD160)
         static char    buf[512];
         int            i;
 #endif
 
-#ifdef  AUTHENABLE_MD5
-       MD5_CTX md5_ctx;
-#endif
-#ifdef  AUTHENABLE_SHA1
-        SHA_CTX sha1_ctx;
-#endif
 #ifdef AUTHENABLE_SSL_PUBKEY
        EVP_PKEY *evp_pkey = NULL;
        EVP_PKEY *evp_pkeyfile = NULL;
@@ -185,7 +182,7 @@ int Auth_Check(aClient *cptr, anAuthStruct *as, char *para)
                case AUTHTYPE_MD5:
                        if (!para)
                                return -1;
-                       
+#ifndef _WIN32
                        if ((i = b64_encode(MD5(para, strlen(para), NULL),
                                 MD5_DIGEST_LENGTH, buf, sizeof(buf))))
                        {
@@ -197,11 +194,37 @@ int       Auth_Check(aClient *cptr, anAuthStruct *as, char *para)
                        else
                                return -1;
                        break;
+#else
+                       {
+                               HCRYPTPROV hProv;
+                               HCRYPTHASH hHash;
+                               char buf2[512];
+                               DWORD size = 512;
+                               if (!CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL, 0))
+                                       return -1;
+                               if (!CryptCreateHash(hProv, CALG_MD5, 0, 0, &hHash))
+                                       return -1;
+                               if (!CryptHashData(hHash, para, strlen(para), 0))
+                                       return -1;
+                               if (!CryptGetHashParam(hHash, HP_HASHVAL, buf, &size, 0))
+                                       return -1;
+                               CryptDestroyHash(hHash);
+                               CryptReleaseContext(hProv, 0);
+                               b64_encode(buf, 16, buf2, sizeof(buf2));
+                               if (!strcmp(buf2, as->data))
+                                       return 2;
+                               else
+                                       return -1;
+                       }
+                       break;
+
+#endif
 #endif
 #ifdef AUTHENABLE_SHA1
                case AUTHTYPE_SHA1:
                        if (!para)
                                return -1;
+#ifndef _WIN32
                        
                        if ((i = b64_encode(SHA1(para, strlen(para), NULL),
                                 SHA_DIGEST_LENGTH, buf, sizeof(buf))))
@@ -214,6 +237,47 @@ int        Auth_Check(aClient *cptr, anAuthStruct *as, char *para)
                        else
                                return -1;
                        break;
+#else
+                       {
+                               HCRYPTPROV hProv;
+                               HCRYPTHASH hHash;
+                               char buf2[512];
+                               DWORD size = 512;
+                               if (!CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL, 0))
+                                       return -1;
+                               if (!CryptCreateHash(hProv, CALG_SHA1, 0, 0, &hHash))
+                                       return -1;
+                               if (!CryptHashData(hHash, para, strlen(para), 0))
+                                       return -1;
+                               if (!CryptGetHashParam(hHash, HP_HASHVAL, buf, &size, 0))
+                                       return -1;
+                               CryptDestroyHash(hHash);
+                               CryptReleaseContext(hProv, 0);
+                               b64_encode(buf, 20, buf2, sizeof(buf2));
+                               if (!strcmp(buf2, as->data))
+                                       return 2;
+                               else 
+                                       return -1;
+                       }
+                       break;
+#endif
+#endif
+#ifdef AUTHENABLE_RIPEMD160
+               case AUTHTYPE_RIPEMD160:
+                       if (!para)
+                               return -1;
+                       
+                       if ((i = b64_encode(RIPEMD160(para, strlen(para), NULL),
+                                RIPEMD160_DIGEST_LENGTH, buf, sizeof(buf))))
+                       {
+                               if (!strcmp(buf, as->data))
+                                       return 2;
+                               else
+                                       return -1;
+                       }
+                       else
+                               return -1;
+                       break;
 #endif
 #ifdef AUTHENABLE_SSL_PUBKEY
                case AUTHTYPE_SSL_PUBKEY:
@@ -264,16 +328,12 @@ char      *Auth_Make(short type, char *para)
        char    salt[3];
        extern  char *crypt();
 #endif
-#if defined(AUTHENABLE_MD5) || defined(AUTHENABLE_SHA1)
+#if defined(AUTHENABLE_MD5) || defined(AUTHENABLE_SHA1) || defined(AUTHENABLE_RIPEMD160)
         static char    buf[512];
        int             i;
 #endif
-
-#ifdef  AUTHENABLE_MD5
-       MD5_CTX md5_ctx;
-#endif
-#ifdef  AUTHENABLE_SHA1
-        SHA_CTX sha1_ctx;
+#ifdef _WIN32
+       static char buf2[512];
 #endif
 
        switch (type)
@@ -296,6 +356,7 @@ char        *Auth_Make(short type, char *para)
                case AUTHTYPE_MD5:
                        if (!para)
                                return NULL;
+#ifndef _WIN32
                        
                        if ((i = b64_encode(MD5(para, strlen(para), NULL),
                                 MD5_DIGEST_LENGTH, buf, sizeof(buf))))
@@ -305,12 +366,32 @@ char      *Auth_Make(short type, char *para)
                        else
                                return NULL;
                        break;
+#else  
+                       {
+                               HCRYPTPROV hProv;
+                               HCRYPTHASH hHash;
+                               DWORD size = 512;
+                               if (!CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL, 0))
+                                       return NULL;
+                               if (!CryptCreateHash(hProv, CALG_MD5, 0, 0, &hHash))
+                                       return NULL;
+                               if (!CryptHashData(hHash, para, strlen(para), 0))
+                                       return NULL;
+                               if (!CryptGetHashParam(hHash, HP_HASHVAL, buf, &size, 0))
+                                       return NULL;
+                               CryptDestroyHash(hHash);
+                               CryptReleaseContext(hProv, 0);
+                               b64_encode(buf, 16, buf2, sizeof(buf2));
+                               return (buf2);
+                       }
+                       break;
+#endif
 #endif
 #ifdef AUTHENABLE_SHA1
                case AUTHTYPE_SHA1:
                        if (!para)
                                return NULL;
-                       
+#ifndef _WIN32                 
                        if ((i = b64_encode(SHA1(para, strlen(para), NULL),
                                 SHA_DIGEST_LENGTH, buf, sizeof(buf))))
                        {
@@ -319,6 +400,41 @@ char       *Auth_Make(short type, char *para)
                        else
                                return NULL;
                        break;
+#else
+                       {
+                               HCRYPTPROV hProv;
+                               HCRYPTHASH hHash;
+                               DWORD size = 512;
+                               if (!CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL, 0))
+                                       return NULL;
+                               if (!CryptCreateHash(hProv, CALG_SHA1, 0, 0, &hHash))
+                                       return NULL;
+                               if (!CryptHashData(hHash, para, strlen(para), 0))
+                                       return NULL;
+                               if (!CryptGetHashParam(hHash, HP_HASHVAL, buf, &size, 0))
+                                       return NULL;
+                               CryptDestroyHash(hHash);
+                               CryptReleaseContext(hProv, 0);
+                               b64_encode(buf, 20, buf2, sizeof(buf2));
+                               return (buf2);
+                       }
+                       break;
+#endif
+
+#endif
+#ifdef AUTHENABLE_RIPEMD160
+               case AUTHTYPE_RIPEMD160:
+                       if (!para)
+                               return NULL;
+                       
+                       if ((i = b64_encode(RIPEMD160(para, strlen(para), NULL),
+                                RIPEMD160_DIGEST_LENGTH, buf, sizeof(buf))))
+                       {
+                               return (buf);
+                       }
+                       else
+                               return NULL;
+                       break;
 #endif
                default:
                        return (NULL);
diff --git a/src/buildm4 b/src/buildm4
deleted file mode 100644 (file)
index 894c9ec..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/bin/sh
-# IRC - Internet Relay Chat, ircd/buildm4
-# Copyright (C) 1993 Darren Reed
-#
-# 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
-# the Free Software Foundation; either version 1, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-# - $Id$
-#
-# If only this was a perl script...*sigh*
-#
-IRCDDIR=$1
-M4=$IRCDDIR/ircd.m4
-/bin/rm -f $M4
-egrep "^#def[^P]*VERSION" ../include/version.h | \
-sed -e 's/[^\"]*\"\([^\"]*\)\"/define(VERSION,\1)/' >>$M4
-DEBUG=`egrep "^#define[                ]*DEBUGMODE" ../include/config.h`
-if [ -n "$DEBUG" ] ; then
-       echo "define(DEBUGMODE,1)" >>$M4
-else
-       echo "undefine(DEBUGMODE)" >>$M4
-fi
-echo -n "define(HOSTNAME," >> $M4
-echo "`hostname`" | sed -e 's/\([a-zA-Z0-9\-]*\).*/\1)/' >> $M4
-echo "define(USER,$USER)" >>$M4
-echo -n 'define(PORT,' >>$M4
-PORT=`egrep '^#define[         ]*PORT[         ]*[0-9]*' ../include/config.h`
-echo "$PORT" | sed -e 's/[^0-9]*\([0-9]*\).*/\1)/' >> $M4
-echo -n 'define(PFREQ,' >>$M4
-PING=`egrep '^#define[         ]*PINGFREQUENCY[        ]*[0-9]*' ../include/config.h`
-echo "$PING" | sed -e 's/[^0-9]*\([0-9]*\).*/\1)/' >> $M4
-echo -n 'define(CFREQ,' >>$M4
-CONT=`egrep '^#define[         ]*CONNECTFREQUENCY[     ]*[0-9]*' ../include/config.h`
-echo "$CONT" | sed -e 's/[^0-9]*\([0-9]*\).*/\1)/' >> $M4
-echo -n "define(MAXSENDQ," >>$M4
-MAXQ=`egrep '^#define[         ]*MAXSENDQLENGTH[       ]*[0-9]*' ../include/config.h`
-echo "$MAXQ" | sed -e 's/[^0-9]*\([0-9]*\).*/\1)/' >> $M4
-echo -n "define(MAXLINKS," >>$M4
-MAXL=`egrep '^#define[         ]*MAXIMUM_LINKS[        ]*[0-9]* | head -1' \
-../include/config.h`
-echo "$MAXL" | sed -e 's/[^0-9]*\([0-9]*\).*/\1)/' >> $M4
-DOM=`egrep '^domain' /etc/resolv.conf | \
-sed -e 's/^domain[     ]*\([a-zA-Z\-\.0-9]*\).*/\1/'`
-echo "define(DOMAIN,$DOM)" >> $M4
-
-cat >>$M4 <<_EOF_
-define(CL,\`ifelse(len(\$1),0,0,\$1)')
-define(HOST,\$1)
-define(HOSTM,\$1)
-define(ID,*@\$1)
-define(PASS,\$1)
-define(PING,\`ifelse(len(\$1),0,PFREQ,\$1)')
-define(APORT,\`ifelse(len(\$1),0,PORT,\$1)')
-define(FREQ,\`ifelse(len(\$1),0,CFREQ,\$1)')
-define(SENDQ,\`ifelse(len(\$1),0,MAXSENDQ,\$1)')
-define(MAX,\`ifelse(len(\$1),0,MAXLINKS,\$1)')
-define(CPORT,\$1)
-define(SERV,\$1)
-define(ADMIN,A:\$1:\$2:\$3:\$4:\$5)
-define(ALLOW,N:\`HOST(\$1)':\`PASS(\$2)':\`SERV(\$3)':\`HOSTM(\$4)':\`CL(\$5)')
-define(BAN,K:\$1:\$2:\$3)
-define(CLASS,Y:\$1:\`PING(\$2)':\$3:\`MAX(\$4)':\`SENDQ(\$5)')
-define(CLIENT,I:\`HOST(\$1)':\`PASS(\$2)':\`ifelse(len(HOST(\$3)),0,\$1,\$3)':\
-\`APORT(\$4)':\`CL(\$5)')
-define(CONNECT,C:\`HOST(\$1)':\`PASS(\$2)':\`SERV(\$3)':\
-\`CPORT(\$4)':\`CL(\$5)')
-define(ME,M:\$1:\$2:\$3:\$4:\$5)
-define(HUB,H:\`ifelse(len(\$2),0,*,\$2)':*:\$1)
-define(LEAF,L:\`ifelse(len(\$2),0,*,\$2)':*:\$1:1)
-define(SERVER,\`
-CONNECT(\$1,\$2,\$3,\$5,\$6)
-ALLOW(\$1,\$2,\$3,\$4,\$6)
-')
-_EOF_
index a031103bb1426b3262e431161aa685370277dd67..3d85cdbfaac637612eeb72343c1840b851f2a0d0 100644 (file)
@@ -70,7 +70,6 @@ extern ircstats IRCstats;
 extern int lifesux;
 #endif
 
-void over_notice(aClient *, aClient *, aChannel *, char *);
 static void add_invite(aClient *, aChannel *);
 static int add_banid(aClient *, aChannel *, char *);
 static int can_join(aClient *, aClient *, aChannel *, char *, char *,
@@ -101,7 +100,7 @@ static char *PartFmt2 = ":%s PART %s :%s";
  * some buffers for rebuilding channel/nick lists with ,'s
  */
 static char nickbuf[BUFSIZE], buf[BUFSIZE];
-char modebuf[MODEBUFLEN], parabuf[MODEBUFLEN];
+char modebuf[MAXMODEPARAMS*2+1], parabuf[504];
 #include "sjoin.h"
 
 #ifdef USE_LONGMODE
@@ -1049,7 +1048,6 @@ CMD_FUNC(m_samode)
  */
 CMD_FUNC(m_mode)
 {
-       static char mode_buf[MODEBUFLEN], parabuf[MODEBUFLEN];
        long unsigned sendts = 0;
        Ban *ban;
        aClient *user;
@@ -1086,12 +1084,12 @@ CMD_FUNC(m_mode)
 
        if (parc < 3)
        {
-               *mode_buf = *parabuf = '\0';
+               *modebuf = *parabuf = '\0';
                
-               mode_buf[1] = '\0';
-               channel_modes(sptr, mode_buf, parabuf, chptr);
+               modebuf[1] = '\0';
+               channel_modes(sptr, modebuf, parabuf, chptr);
                sendto_one(sptr, rpl_str(RPL_CHANNELMODEIS), me.name, parv[0],
-                   chptr->chname, mode_buf, parabuf);
+                   chptr->chname, modebuf, parabuf);
                sendto_one(sptr, rpl_str(RPL_CREATIONTIME), me.name, parv[0],
                    chptr->chname, chptr->creationtime);
                return 0;
@@ -1221,24 +1219,24 @@ CMD_FUNC(m_mode)
                return 0;
        }
        opermode = 0;
-       /* opermode stuff --sts */
+
 #ifndef NO_OPEROVERRIDE
-       if (IsPerson(sptr) && !IsULine(sptr) && !is_chan_op(sptr, chptr))
-               if (IsOper(sptr))
-               {
-                       sendts = 0;
-                       opermode = 1;
-                       goto aftercheck;
-               }
+        if (IsPerson(sptr) && !IsULine(sptr) && !is_chan_op(sptr, chptr)
+            && !is_half_op(sptr, chptr) && IsOper(sptr))
+        {
+                sendts = 0;
+                opermode = 1;
+                goto aftercheck;
+        }
+
+        if (IsPerson(sptr) && !IsULine(sptr) && !is_chan_op(sptr, chptr)
+            && is_half_op(sptr, chptr) && IsOper(sptr))
+        {
+                opermode = 2;
+                goto aftercheck;
+        }
 #endif
-/*-------*/
-
 
-       if (is_half_op(sptr, chptr))
-       {
-               opermode = 2;
-               goto aftercheck;
-       }
        if (IsPerson(sptr) && !IsULine(sptr) && !is_chan_op(sptr, chptr)
            && !is_half_op(sptr, chptr)
            && (cptr == sptr || !IsSAdmin(sptr) || !IsOper(sptr)))
@@ -1306,19 +1304,17 @@ void bounce_mode(aChannel *chptr, aClient *cptr, int parc, char *parv[])
        char pvar[MAXMODEPARAMS][MODEBUFLEN + 3];
        int  pcount;
        long oldm, oldl;
-       char mode_buf[MODEBUFLEN], parabuf[MODEBUFLEN];
 
        oldm = chptr->mode.mode;
        oldl = chptr->mode.limit;
        set_mode(chptr, cptr, parc, parv, &pcount, pvar, 1);
-       make_mode_str(chptr, oldm, oldl, pcount, pvar, mode_buf, parabuf, 1);
 
        if (chptr->creationtime)
                sendto_one(cptr, ":%s MODE %s &%s %s %lu", me.name,
-                   chptr->chname, mode_buf, parabuf, chptr->creationtime);
+                   chptr->chname, modebuf, parabuf, chptr->creationtime);
        else
                sendto_one(cptr, ":%s MODE %s &%s %s", me.name, chptr->chname,
-                   mode_buf, parabuf);
+                   modebuf, parabuf);
 
        /* the '&' denotes a bounce so servers won't bounce a bounce */
 }
@@ -1333,7 +1329,6 @@ void do_mode(aChannel *chptr, aClient *cptr, aClient *sptr, int parc, char *parv
        int  pcount;
        long oldm, oldl;
        char tschange = 0, isbounce = 0;        /* fwd'ing bounce */
-       char mode_buf[MODEBUFLEN], parabuf[MODEBUFLEN];
 
        if (**parv == '&')
                isbounce = 1;
@@ -1341,7 +1336,6 @@ void do_mode(aChannel *chptr, aClient *cptr, aClient *sptr, int parc, char *parv
        oldl = chptr->mode.limit;
 
        set_mode(chptr, sptr, parc, parv, &pcount, pvar, 0);
-       make_mode_str(chptr, oldm, oldl, pcount, pvar, mode_buf, parabuf, 0);
 
        if (IsServer(sptr))
        {
@@ -1372,8 +1366,8 @@ void do_mode(aChannel *chptr, aClient *cptr, aClient *sptr, int parc, char *parv
                if (sendts == -1 && chptr->creationtime)
                        sendts = chptr->creationtime;
        }
-       if (*mode_buf == '\0' || (*(mode_buf + 1) == '\0' && (*mode_buf == '+'
-           || *mode_buf == '-')))
+       if (*modebuf == '\0' || (*(modebuf + 1) == '\0' && (*modebuf == '+'
+           || *modebuf == '-')))
        {
                if (tschange || isbounce) {     /* relay bounce time changes */
                        if (chptr->creationtime)
@@ -1392,10 +1386,11 @@ void do_mode(aChannel *chptr, aClient *cptr, aClient *sptr, int parc, char *parv
 #ifndef NO_OPEROVERRIDE
        if (opermode == 1)
        {
-               if (MyClient(sptr) && mode_buf[1])
+               if (modebuf[1])
                        sendto_snomask(SNO_EYES,
-                           "*** OperMode [IRCop: %s] - [Channel: %s] - [Mode: %s %s]",
-                           sptr->name, chptr->chname, mode_buf, parabuf);
+                           "*** OperOverride -- %s (%s@%s) MODE %s %s %s",
+                           sptr->name, sptr->user->username, sptr->user->realhost,
+                           chptr->chname, modebuf, parabuf);
                sendts = 0;
        }
 #endif
@@ -1404,27 +1399,27 @@ void do_mode(aChannel *chptr, aClient *cptr, aClient *sptr, int parc, char *parv
        {
                sendto_serv_butone_token(NULL, me.name, MSG_GLOBOPS,
                    TOK_GLOBOPS, ":%s used SAMODE %s (%s %s)", sptr->name,
-                   chptr->chname, mode_buf, parabuf);
+                   chptr->chname, modebuf, parabuf);
                sendto_failops_whoare_opers
                    ("from %s: %s used SAMODE %s (%s %s)", me.name, sptr->name,
-                   chptr->chname, mode_buf, parabuf);
+                   chptr->chname, modebuf, parabuf);
                sptr = &me;
                sendts = 0;
        }
        /* Should stop null modes */
-       if (*(mode_buf + 1) == '\0')
+       if (*(modebuf + 1) == '\0')
                return;
        
        sendto_channel_butserv(chptr, sptr, ":%s MODE %s %s %s",
-           sptr->name, chptr->chname, mode_buf, parabuf);
+           sptr->name, chptr->chname, modebuf, parabuf);
        if (IsServer(sptr) && sendts != -1)
                sendto_serv_butone_token(cptr, sptr->name, MSG_MODE, TOK_MODE,
                    "%s %s%s %s %lu", chptr->chname, isbounce ? "&" : "",
-                   mode_buf, parabuf, sendts);
+                   modebuf, parabuf, sendts);
        else
                sendto_serv_butone_token(cptr, sptr->name, MSG_MODE, TOK_MODE,
                    "%s %s%s %s", chptr->chname, isbounce ? "&" : "",
-                   mode_buf, parabuf);
+                   modebuf, parabuf);
        /* tell them it's not a timestamp, in case the last param
           ** is a number. */
 }
@@ -1434,10 +1429,10 @@ void do_mode(aChannel *chptr, aClient *cptr, aClient *sptr, int parc, char *parv
  *  If bounce is set to 1, it will make the string it needs for a bounce.
  */
 void make_mode_str(aChannel *chptr, long oldm, long oldl, int pcount, 
-       char pvar[MAXMODEPARAMS][MODEBUFLEN + 3], char *mode_buf, char *parabuf, char bounce)
+       char pvar[MAXMODEPARAMS][MODEBUFLEN + 3], char *mode_buf, char *para_buf, char bounce)
 {
 
-       char tmpbuf[MODEBUFLEN], *tmpstr;
+       char tmpbuf[MODEBUFLEN+3], *tmpstr;
        aCtab *tab = &cFlagTab[0];
        char *x = mode_buf;
        int  what, cnt, z;
@@ -1446,7 +1441,7 @@ void make_mode_str(aChannel *chptr, long oldm, long oldl, int pcount,
 
        *tmpbuf = '\0';
        *mode_buf = '\0';
-       *parabuf = '\0';
+       *para_buf = '\0';
        what = 0;
        /* + param-less modes */
        tab = &cFlagTab[0];
@@ -1468,7 +1463,7 @@ void make_mode_str(aChannel *chptr, long oldm, long oldl, int pcount,
        }
 
        *x = '\0';
-/* + param-less modes */
+       /* - param-less modes */
        tab = &cFlagTab[0];
        while (tab->mode != 0x0)
        {
@@ -1513,7 +1508,7 @@ void make_mode_str(aChannel *chptr, long oldm, long oldl, int pcount,
                        *x++ = 'l';
                        if (bounce)
                                chptr->mode.limit = oldl;       /* set it back */
-                       ircsprintf(parabuf, "%s%d ", parabuf, chptr->mode.limit);
+                       ircsprintf(para_buf, "%s%d ", para_buf, chptr->mode.limit);
                }
        }
        /* reconstruct bkov chain */
@@ -1531,10 +1526,10 @@ void make_mode_str(aChannel *chptr, long oldm, long oldl, int pcount,
                }
                *x++ = *(pvar[cnt] + 1);
                tmpstr = &pvar[cnt][2];
-               z = MODEBUFLEN - 1 - strlen(parabuf);
-               m = parabuf;
+               z = (MODEBUFLEN * MAXMODEPARAMS);
+               m = para_buf;
                while ((*m)) { m++; }
-               while ((*tmpstr) && ((m-parabuf) < z))
+               while ((*tmpstr) && ((m-para_buf) < z))
                {
                        *m = *tmpstr; 
                        m++;
@@ -1545,9 +1540,9 @@ void make_mode_str(aChannel *chptr, long oldm, long oldl, int pcount,
        }
        if (bounce)
                chptr->mode.mode = oldm;
-       z = strlen(parabuf);
-       if (parabuf[z - 1] == ' ')
-               parabuf[z - 1] = '\0';
+       z = strlen(para_buf);
+       if (para_buf[z - 1] == ' ')
+               para_buf[z - 1] = '\0';
        *x = '\0';
        if (*mode_buf == '\0')
        {
@@ -1585,9 +1580,10 @@ int  do_mode_char(aChannel *chptr, long modetype, char modechar, char *param,
        int  xxi, xyi, xzi, hascolon;
        char *xxx;
        char *xp;
-
+       int  notsecure;
        chasing = 0;
-       if (opermode == 2 && !is_chan_op(cptr, chptr) && !IsULine(cptr))
+       if (is_half_op(cptr, chptr) && !is_chan_op(cptr, chptr) && !IsULine(cptr)
+           && !IsOper(cptr))
        {
                /* Ugly halfop hack --sts 
                   - this allows halfops to do +b +e +v and so on */
@@ -1614,7 +1610,7 @@ int  do_mode_char(aChannel *chptr, long modetype, char modechar, char *param,
                  if (!IsNetAdmin(cptr) && !is_chanowner(cptr, chptr))
                  {
                          sendto_one(cptr,
-                             ":%s %s %s :*** Channel mode +u can only be set by the channel owner",
+                             ":%s %s %s :*** Auditorium mode (+u) can only be set by the channel owner.",
                              me.name, IsWebTV(cptr) ? "PRIVMSG" : "NOTICE", cptr->name);
                          break;
                  }
@@ -1626,7 +1622,7 @@ int  do_mode_char(aChannel *chptr, long modetype, char modechar, char *param,
                      && !IsULine(cptr))
                  {
                          sendto_one(cptr,
-                             ":%s %s %s :*** Only IRCops can set that mode",
+                             ":%s %s %s :*** Opers Only mode (+O) can only be set by IRC Operators.",
                              me.name, IsWebTV(cptr) ? "PRIVMSG" : "NOTICE", cptr->name);
                          break;
                  }
@@ -1636,21 +1632,26 @@ int  do_mode_char(aChannel *chptr, long modetype, char modechar, char *param,
                      && !IsULine(cptr))
                  {
                          sendto_one(cptr,
-                             ":%s %s %s :*** Only admins can set that mode",
+                             ":%s %s %s :*** Admins Only mode (+A) can only be set by Administrators.",
                              me.name, IsWebTV(cptr) ? "PRIVMSG" : "NOTICE", cptr->name);
                          break;
                  }
                  goto setthephuckingmode;
          case MODE_RGSTR:
                  if (!IsServer(cptr) && !IsULine(cptr))
+                 {
+                         sendto_one(cptr,
+                             ":%s %s %s :*** Registered mode (+r) can only be set by Services.",
+                             me.name, IsWebTV(cptr) ? "PRIVMSG" : "NOTICE", cptr->name);
                          break;
+                 }
                  goto setthephuckingmode;
          case MODE_NOHIDING:
                  if (!IsSkoAdmin(cptr) && !IsServer(cptr)
                      && !IsULine(cptr))
                  {
                          sendto_one(cptr,
-                             ":%s %s %s :*** Only admins can set that mode",
+                             ":%s %s %s :*** No Hiding mode (+H) can only be set by Administrators.",
                              me.name, IsWebTV(cptr) ? "PRIVMSG" : "NOTICE", cptr->name);
                          break;
                  }
@@ -1660,42 +1661,68 @@ int  do_mode_char(aChannel *chptr, long modetype, char modechar, char *param,
          case MODE_MODERATED:
          case MODE_TOPICLIMIT:
          case MODE_NOPRIVMSGS:
-         case MODE_INVITEONLY:
-               if (what == MODE_DEL && modetype == MODE_INVITEONLY && (chptr->mode.mode & MODE_NOKNOCK))
-                       chptr->mode.mode &= ~MODE_NOKNOCK;
          case MODE_RGSTRONLY:
          case MODE_NOCOLOR:
          case MODE_NOKICKS:
          case MODE_STRIP:
+               goto setthephuckingmode;
+         case MODE_INVITEONLY:
+               if (what == MODE_DEL && modetype == MODE_INVITEONLY && (chptr->mode.mode & MODE_NOKNOCK))
+                       chptr->mode.mode &= ~MODE_NOKNOCK;
+               goto setthephuckingmode;
          case MODE_NOKNOCK:
                if (what == MODE_ADD && modetype == MODE_NOKNOCK && !(chptr->mode.mode & MODE_INVITEONLY))
+               {
+                       sendto_one(cptr,
+                           ":%s %s %s :*** No Knocks mode (+K) can only be set when the channel is invite only (+i)",
+                           me.name, IsWebTV(cptr) ? "PRIVMSG" : "NOTICE", cptr->name);
                        break;
+               }
+               goto setthephuckingmode;
+         case MODE_ONLYSECURE:
+               notsecure = 0;
+               if (what == MODE_ADD && modetype == MODE_ONLYSECURE && !(IsServer(cptr) || IsULine(cptr)))
+               {
+                 for (member = chptr->members; member; member = member->next)
+                 {
+                   if (!IsSecureConnect(member->cptr) && !IsULine(member->cptr))
+                   {
+                     sendto_one(cptr,
+                       ":%s %s %s :*** Secure Mode (+z) can only be set when all members of the channel are connected via SSL.",
+                       me.name, IsWebTV(cptr) ? "PRIVMSG" : "NOTICE", cptr->name);
+                     notsecure = 1;
+                     break;
+                   }
+                 }
+                 member = NULL;
+                 /* first break nailed the for loop, this one nails switch() */
+                 if (notsecure == 1) break;
+               }
+               goto setthephuckingmode;
 #ifdef STRIPBADWORDS
          case MODE_STRIPBADWORDS:
 #endif
          case MODE_NOCTCP:
-         case MODE_ONLYSECURE:
-               if (what == MODE_ADD && modetype == MODE_ONLYSECURE && !(IsServer(cptr) || IsULine(cptr) || IsSecure(cptr)))
-                       break;          
          case MODE_NONICKCHANGE:
          case MODE_NOINVITE:
                setthephuckingmode:
-                 /* +sp bugfix.. */
-                 if (modetype == MODE_SECRET
-                     && (chptr->mode.mode & MODE_PRIVATE))
-                         chptr->mode.mode &= ~MODE_PRIVATE;
-                 if (modetype == MODE_PRIVATE
-                     && (chptr->mode.mode & MODE_SECRET))
-                         chptr->mode.mode &= ~MODE_SECRET;
-                 if (modetype == MODE_NOCOLOR
-                     && (chptr->mode.mode & MODE_STRIP))
-                         chptr->mode.mode &= ~MODE_STRIP;
-                 if (modetype == MODE_STRIP
-                     && (chptr->mode.mode & MODE_NOCOLOR))
-                         chptr->mode.mode &= ~MODE_NOCOLOR;
                  retval = 0;
-                 if (what == MODE_ADD)
+                 if (what == MODE_ADD) {
+                         /* +sp bugfix.. (by JK/Luke)*/
+                        if (modetype == MODE_SECRET
+                             && (chptr->mode.mode & MODE_PRIVATE))
+                                 chptr->mode.mode &= ~MODE_PRIVATE;
+                         if (modetype == MODE_PRIVATE
+                             && (chptr->mode.mode & MODE_SECRET))
+                                 chptr->mode.mode &= ~MODE_SECRET;
+                         if (modetype == MODE_NOCOLOR
+                             && (chptr->mode.mode & MODE_STRIP))
+                                 chptr->mode.mode &= ~MODE_STRIP;
+                         if (modetype == MODE_STRIP
+                             && (chptr->mode.mode & MODE_NOCOLOR))
+                                 chptr->mode.mode &= ~MODE_NOCOLOR;
                          chptr->mode.mode |= modetype;
+                 }
                  else
                          chptr->mode.mode &= ~modetype;
                  break;
@@ -1714,7 +1741,7 @@ int  do_mode_char(aChannel *chptr, long modetype, char modechar, char *param,
                      && !IsNetAdmin(cptr) && !is_chanowner(cptr, chptr))
                  {
                          sendto_one(cptr,
-                             ":%s %s %s :*** Protected users can only be set by the channel owner.",
+                             ":%s %s %s :*** Protected User mode (+a) can only be set by the channel owner",
                              me.name, IsWebTV(cptr) ? "PRIVMSG" : "NOTICE", cptr->name);
                          break;
                  }
@@ -1725,10 +1752,10 @@ int  do_mode_char(aChannel *chptr, long modetype, char modechar, char *param,
                  switch (modetype)
                  {
                    case MODE_CHANOWNER:
-                           xxx = "deown";
+                           xxx = "dechannelown";
                            break;
                    case MODE_CHANPROT:
-                           xxx = "deprot";
+                           xxx = "deprotect";
                            break;
                    case MODE_HALFOP:
                            xxx = "dehalfop";
@@ -1779,7 +1806,7 @@ int  do_mode_char(aChannel *chptr, long modetype, char modechar, char *param,
                          if (MyClient(cptr))
                          {
                                  sendto_one(cptr,
-                                     ":%s %s %s :*** You cannot %s because %s is %s channel owner (+q)",
+                                     ":%s %s %s :*** You cannot %s %s in %s, they are the channel owner (+q).",
                                      me.name, IsWebTV(cptr) ? "PRIVMSG" : "NOTICE", cptr->name, xxx,
                                      member->cptr->name, chptr->chname);
                          }
@@ -1793,7 +1820,7 @@ int  do_mode_char(aChannel *chptr, long modetype, char modechar, char *param,
                          if (MyClient(cptr))
                          {
                                  sendto_one(cptr,
-                                     ":%s %s %s :*** You cannot %s because %s is %s protected user (+a)",
+                                     ":%s %s %s :*** You cannot %s %s in %s, they are a protected user (+a).",
                                      me.name, IsWebTV(cptr) ? "PRIVMSG" : "NOTICE", cptr->name, xxx,
                                      member->cptr->name, chptr->chname);
                          }
@@ -1950,7 +1977,7 @@ int  do_mode_char(aChannel *chptr, long modetype, char modechar, char *param,
                  if (!IsNetAdmin(cptr) && !is_chanowner(cptr, chptr))
                  {
                          sendto_one(cptr,
-                             ":%s %s %s :*** Channel mode +L can only be set by the channel owner",
+                             ":%s %s %s :*** Channel Linking (+L) can only be set by the channel owner.",
                              me.name, IsWebTV(cptr) ? "PRIVMSG" : "NOTICE", cptr->name);
                          break;
                  }
@@ -1959,7 +1986,7 @@ int  do_mode_char(aChannel *chptr, long modetype, char modechar, char *param,
                  if (!chptr->mode.limit && what == MODE_ADD)
                  {
                          sendto_one(cptr,
-                             ":%s %s %s :*** Channel mode +l <max> is requried for +L to be set",
+                             ":%s %s %s :*** A Channel Limit (+l <max>) is required for +L to be set.",
                              me.name, IsWebTV(cptr) ? "PRIVMSG" : "NOTICE", cptr->name);
                          break;
                  }
@@ -1987,7 +2014,7 @@ int  do_mode_char(aChannel *chptr, long modetype, char modechar, char *param,
                          {
                                  if (MyClient(cptr))
                                          sendto_one(cptr,
-                                             ":%s %s %s :*** You can't link %s to itself",
+                                             ":%s %s %s :*** %s cannot be linked to itself.",
                                              me.name, IsWebTV(cptr) ? "PRIVMSG" : "NOTICE", cptr->name,
                                              chptr->chname);
                                  break;
@@ -1996,7 +2023,7 @@ int  do_mode_char(aChannel *chptr, long modetype, char modechar, char *param,
                          {
                                  if (MyClient(cptr))
                                          sendto_one(cptr,
-                                             ":%s %s %s :*** You may only specify 1 channel to link to",
+                                             ":%s %s %s :*** Only one channel may be specified for linking.",
                                              me.name, IsWebTV(cptr) ? "PRIVMSG" : "NOTICE", cptr->name);
                                  break;
                          }
@@ -2182,15 +2209,22 @@ void set_mode(aChannel *chptr, aClient *cptr, int parc, char *parv[], u_int *pco
        char *curchr;
        u_int what = MODE_ADD;
        long modetype = 0;
-       char *param = NULL;
+       int  paracount = 1;
 #ifdef DEVELOP
        char *tmpo = NULL;
 #endif
        aCtab *tab = &cFlagTab[0];
        aCtab foundat;
        int  found = 0;
-       int  paracount = 1;
+       unsigned int htrig = 0;
+       long oldm, oldl;
+       
+       paracount = 1;
        *pcount = 0;
+
+       oldm = chptr->mode.mode;
+       oldl = chptr->mode.limit;
+
        for (curchr = parv[0]; *curchr; curchr++)
        {
                switch (*curchr)
@@ -2238,23 +2272,43 @@ void set_mode(aChannel *chptr, aClient *cptr, int parc, char *parv[], u_int *pco
                                      me.name, cptr->name, *curchr);
                                  break;
                          }
+
+#ifndef NO_OPEROVERRIDE
+                          if ((Halfop_mode(modetype) == FALSE) && opermode == 2 && htrig != 1)
+                          {
+                               opermode = 0;
+                               htrig = 1;
+                          }
+#endif
+
                          /* We can afford to send off a param */
-                         if (parc - paracount >= 1)
-                         {
-                               param = parv[paracount];
-                         }
-                         else
-                               param = NULL;
-                         
-                         if (param && ((strlen(param) >= MODEBUFLEN)))
-                                 param[MODEBUFLEN - 1] = '\0';
+                         if (parc <= paracount)
+                               parv[paracount] = NULL;
+                         if (parv[paracount] &&
+                             strlen(parv[paracount]) >= MODEBUFLEN)
+                               parv[paracount][MODEBUFLEN-1] = '\0';
                          paracount +=
                              do_mode_char(chptr, modetype, *curchr,
-                             param, what, cptr, pcount, pvar,
+                             parv[paracount], what, cptr, pcount, pvar,
                              bounce);
                          break;
                }
        }
+
+       make_mode_str(chptr, oldm, oldl, *pcount, pvar, modebuf, parabuf, bounce);
+
+#ifndef NO_OPEROVERRIDE
+        if (htrig == 1)
+        {
+                /* This is horrible. Just horrible. */
+                if (!((modebuf[0] == '+' || modebuf[0] == '-') && modebuf[1] == '\0'))
+                sendto_snomask(SNO_EYES, "*** OperOverride -- %s (%s@%s) MODE %s %s %s",
+                      cptr->name, cptr->user->username, cptr->user->realhost,
+                      chptr->chname, modebuf, parabuf);
+                htrig = 0;
+        }
+#endif
+
 }
 
 int  DoesOp(char *modebuf)
@@ -2307,147 +2361,78 @@ char *pretty_mask(char *mask)
 
 static int can_join(aClient *cptr, aClient *sptr, aChannel *chptr, char *key, char *link, char *parv[])
 {
-       Link *lp;
-#ifndef NO_OPEROVERRIDE
-       int  ib = 1;
-#else
-       int  ib = 0;
-#endif
-
-
-       /* 0 = noone 1 = IRCops 2 = Net Admins 3 =Net/Tech admins  (override) */
-
-       if ((chptr->mode.limit && chptr->users >= chptr->mode.limit))
-       {
-               if (chptr->mode.link)
-               {
-                       if (*chptr->mode.link != '\0')
-                       {
-                               /* We are linked. */
-                               sendto_one(sptr,
-                                   err_str(ERR_LINKCHANNEL), me.name,
-                                   sptr->name, chptr->chname,
-                                   chptr->mode.link);
-                               parv[0] = sptr->name;
-                               parv[1] = (chptr->mode.link);
-                               channel_link(cptr, sptr, 2, parv);
-                               return -1;
-                       }
-               }
-               /* We check this later return (ERR_CHANNELISFULL); */
-       }
-
-/*    if ((chptr->mode.mode & MODE_OPERONLY) && IsOper(sptr)) {
-       goto admok;
-    } */
-       if ((chptr->mode.mode & MODE_ONLYSECURE) &&
-               !(sptr->umodes & UMODE_SECURE))
-       {
-               sendto_one(sptr, ":%s %s %s :*** Cannot join: %s is a Secure-only channel (+z)",
-                               me.name, IsWebTV(sptr) ? "PRIVMSG" : "NOTICE", sptr->name, chptr->chname); 
-               return (ERR_BANNEDFROMCHAN);    
-       }
-       if ((chptr->mode.mode & MODE_OPERONLY) && !IsOper(sptr))
-       {
-               return (ERR_OPERONLY);
-       }
-       if ((chptr->mode.mode & MODE_ADMONLY))
-       {
-               if (!IsSkoAdmin(sptr))
-                       return (ERR_ADMONLY);
-       }
-
-       if ((chptr->mode.mode & MODE_NOHIDING) && IsHiding(sptr))
-               return (ERR_NOHIDING);
-
-       if ((IsOper(sptr) && !((chptr->mode.mode & MODE_ADMONLY))) && !(ib==0))
-       {
-               return 0;       /* may override */
-       }
-       if ((IsOper(sptr) && is_banned(cptr, sptr, chptr)
-           && (chptr->mode.mode & MODE_OPERONLY)))
-               return (ERR_BANNEDFROMCHAN);    /* banned as an ircop at a +O cannot join */
-
-/*     if (ib == 1)
-               if (IsOper(sptr))
-                       return 0;
-       else
-               if (ib == 2)
-                       if (IsNetAdmin(sptr))
-                               return 0;
-*/
-       switch (ib)
-       {
-         case 1:
-                 if (IsOper(sptr))
-                 {
-                         return 0;
-                 }
-                 break;
-         case 2:
-                 if (IsNetAdmin(sptr))
-                 {
-                         return 0;
-                 }
-                 break;
-         case 3:
-                 if (IsNetAdmin(sptr))
-                         return 0;
-                 break;
-         default:
-                 break;
-       }
-       if ((chptr->mode.mode & MODE_RGSTRONLY) && !IsARegNick(sptr))
-               return (ERR_NEEDREGGEDNICK);
-
-       if (*chptr->mode.key && (BadPtr(key) || mycmp(chptr->mode.key, key)))
-               return (ERR_BADCHANNELKEY);
-
-       for (lp = sptr->user->invited; lp; lp = lp->next)
-               if (lp->value.chptr == chptr)
-                       break;
-
-       if ((chptr->mode.mode & MODE_INVITEONLY) && !lp)
-               return (ERR_INVITEONLYCHAN);
-
-       if ((chptr->mode.limit && chptr->users >= chptr->mode.limit))
-               return (ERR_CHANNELISFULL);
+        Link *lp;
 
-       if (is_banned(sptr, sptr, chptr) && !lp)
-               return (ERR_BANNEDFROMCHAN);
+        if ((chptr->mode.mode & MODE_ONLYSECURE) &&
+                !(sptr->umodes & UMODE_SECURE))
+                return (ERR_SECUREONLYCHAN);
 
+        if ((chptr->mode.mode & MODE_OPERONLY) && !IsOper(sptr))
+                return (ERR_OPERONLY);
 
+        if ((chptr->mode.mode & MODE_ADMONLY) && !IsSkoAdmin(sptr))
+                return (ERR_ADMONLY);
 
-       return 0;
-}
-
-/* Sends notices to +e's about opers possibly abusing priv's
- * By NiQuiL (niquil@programmer.net)
- * suggestion by -ins4ne-
- */
+#ifdef ENABLE_INVISOPER
+        if ((chptr->mode.mode & MODE_NOHIDING) && IsHiding(sptr))
+                return (ERR_NOHIDING);
+#endif
 
-void over_notice(aClient *cptr, aClient *sptr, aChannel *chptr, char *key)
-{
-       Link *lp;
+        if ((IsOper(sptr) && is_banned(cptr, sptr, chptr)
+            && (chptr->mode.mode & MODE_OPERONLY)))
+                return (ERR_BANNEDFROMCHAN);    /* banned as an ircop at a +O cannot join */
+
+        for (lp = sptr->user->invited; lp; lp = lp->next)
+                if (lp->value.chptr == chptr)
+                        return 0;
+
+        if ((chptr->mode.limit && chptr->users >= chptr->mode.limit))
+        {
+                if (chptr->mode.link)
+                {
+                        if (*chptr->mode.link != '\0')
+                        {
+                                /* We are linked. */
+                                sendto_one(sptr,
+                                    err_str(ERR_LINKCHANNEL), me.name,
+                                    sptr->name, chptr->chname,
+                                    chptr->mode.link);
+                                parv[0] = sptr->name;
+                                parv[1] = (chptr->mode.link);
+                                channel_link(cptr, sptr, 2, parv);
+                                return -1;
+                        }
+                }
+                /* We check this later return (ERR_CHANNELISFULL); */
+        }
+
+        if ((chptr->mode.mode & MODE_RGSTRONLY) && !IsARegNick(sptr))
+                return (ERR_NEEDREGGEDNICK);
+
+        if (*chptr->mode.key && (BadPtr(key) || mycmp(chptr->mode.key, key)))
+                return (ERR_BADCHANNELKEY);
+
+        if ((chptr->mode.mode & MODE_INVITEONLY))
+                return (ERR_INVITEONLYCHAN);
+
+        if ((chptr->mode.limit && chptr->users >= chptr->mode.limit))
+                return (ERR_CHANNELISFULL);
+
+        if (is_banned(sptr, sptr, chptr))
+                return (ERR_BANNEDFROMCHAN);
 
-       for (lp = sptr->user->invited; lp; lp = lp->next)
-        if (lp->value.chptr == chptr)
-         break;
+#ifndef NO_OPEROVERRIDE
+#ifdef OPEROVERRIDE_VERIFY
+        if (IsOper(sptr) && (chptr->mode.mode & MODE_SECRET ||
+            chptr->mode.mode & MODE_PRIVATE))
+                return (ERR_OPERSPVERIFY);
+#endif
+#endif
 
-       if (is_banned(cptr, sptr, chptr) && IsOper(sptr) && !IsULine(sptr))
-       {
-               sendto_snomask(SNO_EYES, "*** Banwalk [IRCop: %s] [Channel: %s]",sptr->name,chptr->chname);
-       } else if (IsOper(sptr) && !IsULine(sptr) && *chptr->mode.key && (BadPtr(key) || 
-            mycmp(chptr->mode.key, key))) {
-               sendto_snomask(SNO_EYES, "*** Keywalk [IRCop: %s] [Channel: %s]",sptr->name,chptr->chname);
-       } else if (IsOper(sptr) && !IsULine(sptr) && (chptr->mode.mode & MODE_INVITEONLY) && !lp) {
-               sendto_snomask(SNO_EYES, "*** Invitewalk [IRCop: %s] [Channel: %s]",sptr->name,chptr->chname);
-       }
 
+        return 0;
 }
 
-
-
 /*
 ** Remove bells and commas from channel name
 */
@@ -3073,7 +3058,6 @@ CMD_FUNC(m_join)
                /*
                   **  Complete user entry to the new channel (if any)
                 */
-               (void)over_notice(cptr, sptr, chptr, key);
                add_user_to_channel(chptr, sptr, flags);
                /*
                   ** notify all other users on the new channel
@@ -3476,10 +3460,9 @@ CMD_FUNC(m_kick)
                                            && is_chan_op(who, chptr)))
                                        {
                                                sendto_snomask(SNO_EYES,
-                                                   "*** OperKick [%s @ %s -> %s (%s)]",
-                                                   sptr->name,
-                                                   chptr->chname,
-                                                   who->name, comment);
+                                                   "*** OperOverride -- %s (%s@%s) KICK %s %s (%s)",
+                                                   sptr->name, sptr->user->username, sptr->user->realhost,
+                                                   chptr->chname, who->name, comment);
                                                goto attack;
                                        }       /* is_chan_op */
                                if (is_chanprot(who, chptr)
@@ -3488,10 +3471,9 @@ CMD_FUNC(m_kick)
                                        if (IsNetAdmin(sptr))
                                        {       /* IRCop kicking owner/prot */
                                                sendto_snomask(SNO_EYES,
-                                                   "*** OperKick [%s @ %s -> %s (%s)]",
-                                                   sptr->name,
-                                                   chptr->chname,
-                                                   who->name, comment);
+                                                   "*** OperOverride -- %s (%s@%s) KICK %s %s (%s)",
+                                                   sptr->name, sptr->user->username, sptr->user->realhost,
+                                                   chptr->chname, who->name, comment);
                                                goto attack;
                                        }
                                        else if (!IsULine(sptr)
@@ -3707,8 +3689,9 @@ CMD_FUNC(m_topic)
                                return 0;
 #endif
                                sendto_snomask(SNO_EYES,
-                                   "*** OperTopic [IRCop: %s] - [Channel: %s] - [Topic: %s]",
-                                   sptr->name, chptr->chname, topic);
+                                   "*** OperOverride -- %s (%s@%s) TOPIC %s \'%s\'",
+                                   sptr->name, sptr->user->username, sptr->user->realhost,
+                                   chptr->chname, topic);
                        }
                        /* setting a topic */
                        topiClen = strlen(topic);
@@ -3760,104 +3743,193 @@ CMD_FUNC(m_topic)
 */
 CMD_FUNC(m_invite)
 {
-       aClient *acptr;
-       aChannel *chptr;
-
+        aClient *acptr;
+        aChannel *chptr;
+        short over = 0;
+
+        if (parc < 3 || *parv[1] == '\0')
+        {
+                sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS),
+                    me.name, parv[0], "INVITE");
+                return -1;
+        }
+
+        if (!(acptr = find_person(parv[1], (aClient *)NULL)))
+        {
+                sendto_one(sptr, err_str(ERR_NOSUCHNICK),
+                    me.name, parv[0], parv[1]);
+                return -1;
+        }
+
+        if (MyConnect(sptr))
+                clean_channelname(parv[2]);
+
+        if (check_channelmask(sptr, cptr, parv[2]))
+                return -1;
+
+        if (!(chptr = find_channel(parv[2], NullChn)))
+        {
+                sendto_one(sptr, err_str(ERR_NOSUCHCHANNEL),
+                    me.name, parv[0], parv[2]);
+                return -1;
+        }
+
+        if (chptr->mode.mode & MODE_NOINVITE && !IsULine(sptr))
+        {
+#ifndef NO_OPEROVERRIDE
+                if (IsOper(sptr) && sptr == acptr)
+                        over = 1;
+                else {
+#endif
+                        sendto_one(sptr, err_str(ERR_NOINVITE),
+                            me.name, parv[0], parv[2]);
+                        return -1;
+#ifndef NO_OPEROVERRIDE
+                }
+#endif
+        }
 
-       if (parc < 3 || *parv[1] == '\0')
-       {
-               sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS),
-                   me.name, parv[0], "INVITE");
-               return -1;
-       }
+        if (!IsMember(sptr, chptr) && !IsULine(sptr))
+        {
+#ifndef NO_OPEROVERRIDE
+                if (IsOper(sptr) && sptr == acptr)
+                        over = 1;
+                else {
+#endif
+                        sendto_one(sptr, err_str(ERR_NOTONCHANNEL),
+                            me.name, parv[0], parv[2]);
+                        return -1;
+#ifndef NO_OPEROVERRIDE
+                }
+#endif
+        }
 
-       if (!(acptr = find_person(parv[1], (aClient *)NULL)))
-       {
-               sendto_one(sptr, err_str(ERR_NOSUCHNICK),
-                   me.name, parv[0], parv[1]);
-               return 0;
-       }
+        if (IsMember(acptr, chptr))
+        {
+                sendto_one(sptr, err_str(ERR_USERONCHANNEL),
+                    me.name, parv[0], parv[1], parv[2]);
+                return 0;
+        }
 
-       if (MyConnect(sptr))
-               clean_channelname(parv[2]);
-       if (check_channelmask(sptr, cptr, parv[2]))
-               return 0;
-       if (!(chptr = find_channel(parv[2], NullChn)))
-       {
+        if (chptr->mode.mode & MODE_INVITEONLY)
+        {
+                if (!is_chan_op(sptr, chptr) && !IsULine(sptr))
+                {
+#ifndef NO_OPEROVERRIDE
+                        if (IsOper(sptr) && sptr == acptr)
+                                over = 1;
+                        else {
+#endif
+                                sendto_one(sptr, err_str(ERR_CHANOPRIVSNEEDED),
+                                    me.name, parv[0], chptr->chname);
+                                return -1;
+#ifndef NO_OPEROVERRIDE
+                        }
+#endif
+                }
+                else if (!IsMember(sptr, chptr) && !IsULine(sptr))
+                {
+#ifndef NO_OPEROVERRIDE
+                        if (IsOper(sptr) && sptr == acptr)
+                                over = 1;
+                        else {
+#endif
+                                sendto_one(sptr, err_str(ERR_CHANOPRIVSNEEDED),
+                                    me.name, parv[0],
+                                        ((chptr) ? (chptr->chname) : parv[2]));
+                                return -1;
+#ifndef NO_OPEROVERRIDE
+                        }
+#endif
+                }
+        }
+
+        if (MyConnect(sptr))
+        {
+                if (check_for_target_limit(sptr, acptr, acptr->name))
+                        return 0;
+                if (!over)
+                {
+                        sendto_one(sptr, rpl_str(RPL_INVITING), me.name,
+                            parv[0], acptr->name,
+                            ((chptr) ? (chptr->chname) : parv[2]));
+                        if (acptr->user->away)
+                                sendto_one(sptr, rpl_str(RPL_AWAY), me.name,
+                                    parv[0], acptr->name, acptr->user->away);
+                }
+        }
+        /* Note: is_banned() here will cause some extra CPU load,
+         *       and we're really only relying on the existence
+         *       of the limit because we could momentarily have
+         *       less people on channel.
+         */
+
+        /* Yes, it's crack induced. This checks if we should even bother going further */
+        if (!(MyConnect(acptr) && chptr && sptr->user &&
+            (is_chan_op(sptr,chptr) || IsULine(sptr)
+#ifndef NO_OPEROVERRIDE
+             || IsOper(sptr)
+#endif
+            )))
+               return 0;
+
+        if (is_banned(acptr, sptr, chptr))
+        {
+                if (over)
+                        sendto_snomask(SNO_EYES,
+                          "*** OperOverride -- %s (%s@%s) invited him/herself into %s (overriding +b).",
+                          sptr->name, sptr->user->username, sptr->user->realhost, chptr->chname);
+        }
+        else if (chptr->mode.mode & MODE_INVITEONLY)
+        {
+                if (over)
+                        sendto_snomask(SNO_EYES,
+                          "*** OperOverride -- %s (%s@%s) invited him/herself into %s (overriding +i).",
+                          sptr->name, sptr->user->username, sptr->user->realhost, chptr->chname);
+        }
+        else if (chptr->mode.limit)
+        {
+                if (over)
+                        sendto_snomask(SNO_EYES,
+                          "*** OperOverride -- %s (%s@%s) invited him/herself into %s (overriding +l).",
+                          sptr->name, sptr->user->username, sptr->user->realhost, chptr->chname);
+        }
+        else if (chptr->mode.mode & MODE_RGSTRONLY)
+        {
+                if (over)
+                        sendto_snomask(SNO_EYES,
+                          "*** OperOverride -- %s (%s@%s) invited him/herself into %s (overriding +R).",
+                          sptr->name, sptr->user->username, sptr->user->realhost, chptr->chname);
+        }
+        else if (*chptr->mode.key)
+        {
+                if (over)
+                        sendto_snomask(SNO_EYES,
+                          "*** OperOverride -- %s (%s@%s) invited him/herself into %s (overriding +k).",
+                          sptr->name, sptr->user->username, sptr->user->realhost, chptr->chname);
+        }
+#ifdef OPEROVERRIDE_VERIFY
+        else if (chptr->mode.mode & MODE_SECRET || chptr->mode.mode & MODE_PRIVATE)
+               over = -1;
+#endif
+        else
+                return 0;
 
-               sendto_prefix_one(acptr, sptr, ":%s INVITE %s :%s",
-                   parv[0], parv[1], parv[2]);
-               return 0;
-       }
-       if (chptr->mode.mode & MODE_NOINVITE)
-               if (!IsULine(sptr))
-               {
-                       sendto_one(sptr, err_str(ERR_NOINVITE),
-                           me.name, parv[0], parv[2]);
-                       return -1;
-               }
-       if (chptr && !IsMember(sptr, chptr) && !IsULine(sptr))
-       {
-               sendto_one(sptr, err_str(ERR_NOTONCHANNEL),
-                   me.name, parv[0], parv[2]);
-               return -1;
-       }
+        if (over == 1)
+                sendto_channelops_butone(NULL, &me, chptr,
+                  ":%s NOTICE @%s :OperOverride -- %s invited him/herself into the channel.",
+                  me.name, chptr->chname, sptr->name);
+        else if (over == 0)
+                sendto_channelops_butone(NULL, &me, chptr,
+                  ":%s NOTICE @%s :%s invited %s into the channel.",
+                  me.name, chptr->chname, sptr->name, acptr->name);
 
-       if (IsMember(acptr, chptr))
-       {
-               sendto_one(sptr, err_str(ERR_USERONCHANNEL),
-                   me.name, parv[0], parv[1], parv[2]);
-               return 0;
-       }
-       if (chptr && (chptr->mode.mode & MODE_INVITEONLY))
-       {
-               if (!is_chan_op(sptr, chptr) && !IsULine(sptr))
-               {
-                       sendto_one(sptr, err_str(ERR_CHANOPRIVSNEEDED),
-                           me.name, parv[0], chptr->chname);
-                       return -1;
-               }
-               else if (!IsMember(sptr, chptr) && !IsULine(sptr))
-               {
-                       sendto_one(sptr, err_str(ERR_CHANOPRIVSNEEDED),
-                           me.name, parv[0],
-                           ((chptr) ? (chptr->chname) : parv[2]));
-                       return -1;
-               }
-       }
+        add_invite(acptr, chptr);
 
-       if (MyConnect(sptr))
-       {
-               if (check_for_target_limit(sptr, acptr, acptr->name))
-                       return 0;
+        sendto_prefix_one(acptr, sptr, ":%s INVITE %s :%s", parv[0],
+            acptr->name, ((chptr) ? (chptr->chname) : parv[2]));
 
-               sendto_one(sptr, rpl_str(RPL_INVITING), me.name,
-                   parv[0], acptr->name,
-                   ((chptr) ? (chptr->chname) : parv[2]));
-               if (acptr->user->away)
-                       sendto_one(sptr, rpl_str(RPL_AWAY), me.name,
-                           parv[0], acptr->name, acptr->user->away);
-       }
-       /* Note: is_banned() here will cause some extra CPU load, 
-        *       and we're really only relying on the existence
-        *       of the limit because we could momentarily have
-        *       less people on channel.
-        */
-       if (MyConnect(acptr))
-               if (chptr && sptr->user
-                   && (is_banned(acptr, sptr, chptr)
-                   || (chptr->mode.mode & MODE_INVITEONLY)
-                   || chptr->mode.limit) && (is_chan_op(sptr, chptr)
-                   || IsULine(sptr)))
-               {
-                       add_invite(acptr, chptr);
-                       sendto_channelops_butone(NULL, &me, chptr,
-                           ":%s NOTICE @%s :%s invited %s into the channel.",
-                           me.name, chptr->chname, sptr->name, acptr->name);
-               }
-       sendto_prefix_one(acptr, sptr, ":%s INVITE %s :%s", parv[0],
-           acptr->name, ((chptr) ? (chptr->chname) : parv[2]));
-       return 0;
+        return 0;
 }
 
 
@@ -3884,9 +3956,6 @@ void send_list(aClient *cptr, int numsend)
        aChannel *chptr;
        LOpts *lopt = cptr->user->lopt;
        unsigned int  hashnum;
-#ifdef LIST_SHOW_MODES
-char mode_buf[MODEBUFLEN], parabuf[MODEBUFLEN];
-#endif
 
        for (hashnum = lopt->starthash; hashnum < CH_MAX; hashnum++)
        {
@@ -3933,12 +4002,12 @@ char mode_buf[MODEBUFLEN], parabuf[MODEBUFLEN];
                                    lopt->yeslist, chptr->topic)))
                                        continue;
 #ifdef LIST_SHOW_MODES
-                               mode_buf[0] = '[';
-                               channel_modes(cptr, &mode_buf[1], parabuf, chptr);
-                               if (mode_buf[2] == '\0')
-                                       mode_buf[0] = '\0';
+                               modebuf[0] = '[';
+                               channel_modes(cptr, &modebuf[1], parabuf, chptr);
+                               if (modebuf[2] == '\0')
+                                       modebuf[0] = '\0';
                                else
-                                       strlcat(mode_buf, "]", sizeof mode_buf);
+                                       strlcat(modebuf, "]", sizeof modebuf);
 #endif
                                if (!IsAnOper(cptr))
                                        sendto_one(cptr,
@@ -3949,7 +4018,7 @@ char mode_buf[MODEBUFLEN], parabuf[MODEBUFLEN];
                                            "*", chptr->users,
 #ifdef LIST_SHOW_MODES
                                            ShowChannel(cptr, chptr) ?
-                                           mode_buf : "",
+                                           modebuf : "",
 #endif
                                            ShowChannel(cptr,
                                            chptr) ? (chptr->topic ?
@@ -3960,7 +4029,7 @@ char mode_buf[MODEBUFLEN], parabuf[MODEBUFLEN];
                                            cptr->name, chptr->chname,
                                            chptr->users,
 #ifdef LIST_SHOW_MODES
-                                           mode_buf,
+                                           modebuf,
 #endif                                     
                                            (chptr->topic ? chptr->topic : ""));
                                numsend--;
@@ -4087,9 +4156,6 @@ CMD_FUNC(m_list)
        TS   chantimemin, chantimemax;
        TS   topictimemin, topictimemax;
        Link *yeslist = NULL, *nolist = NULL;
-#ifdef LIST_SHOW_MODES
-       char mode_buf[MODEBUFLEN], parabuf[MODEBUFLEN];
-#endif
 
        static char *usage[] = {
                "   Usage: /LIST <options>",
@@ -4268,12 +4334,12 @@ CMD_FUNC(m_list)
                                  chptr = find_channel(name, NullChn);
                                  if (chptr && ShowChannel(sptr, chptr)) {
 #ifdef LIST_SHOW_MODES
-                                       mode_buf[0] = '[';
-                                       channel_modes(sptr, &mode_buf[1], parabuf, chptr);
-                                       if (mode_buf[2] == '\0')
-                                               mode_buf[0] = '\0';
+                                       modebuf[0] = '[';
+                                       channel_modes(sptr, &modebuf[1], parabuf, chptr);
+                                       if (modebuf[2] == '\0')
+                                               modebuf[0] = '\0';
                                        else
-                                               strlcat(mode_buf, "]", sizeof mode_buf);
+                                               strlcat(modebuf, "]", sizeof modebuf);
 #endif
                                          sendto_one(sptr,
                                              rpl_str(RPL_LIST),
@@ -4283,7 +4349,7 @@ CMD_FUNC(m_list)
                                              chptr->users,
 #ifdef LIST_SHOW_MODES
                                              ShowChannel(sptr, chptr) ?
-                                             mode_buf : "",
+                                             modebuf : "",
 #endif
                                              (chptr->topic ? chptr->topic :
                                              ""));
@@ -4790,7 +4856,11 @@ CMD_FUNC(m_sjoin)
 
                }
                /* remove bans */
+               /* reset the buffers */
+               modebuf[0] = '-';
+               modebuf[1] = '\0';
                parabuf[0] = '\0';
+               b = 1;
                for (ban = chptr->banlist; ban; ban = ban->next)
                {
                        Addit('b', ban->banstr);
@@ -4799,7 +4869,6 @@ CMD_FUNC(m_sjoin)
                {
                        Addit('e', ban->banstr);
                }
-               b = 1;
                for (lp = chptr->members; lp; lp = lp->next)
                {
                        lp2 = find_membership_link(lp->cptr->user->channel, chptr);
@@ -5120,10 +5189,7 @@ CMD_FUNC(m_sjoin)
                if (oldmode.key[0] && chptr->mode.key[0]
                    && strcmp(oldmode.key, chptr->mode.key))
                {
-                       x = strlen(oldmode.key);
-                       y = strlen(chptr->mode.key);
-                       z = MAX(x, y);
-                       if (z == x)
+                       if (strcmp(oldmode.key, chptr->mode.key) > 0)                   
                        {
                                strlcpy(chptr->mode.key, oldmode.key, sizeof chptr->mode.key);
                        }
@@ -5132,14 +5198,11 @@ CMD_FUNC(m_sjoin)
                                Addit('k', chptr->mode.key);
                        }
                }
-               /* same as above .. */
+               /* same as above (except case insensitive #test == #TEST -- codemastr) */
                if (oldmode.link[0] && chptr->mode.link[0]
-                   && strcmp(oldmode.link, chptr->mode.link))
+                   && stricmp(oldmode.link, chptr->mode.link))
                {
-                       x = strlen(oldmode.link);
-                       y = strlen(chptr->mode.link);
-                       z = MAX(x, y);
-                       if (z == x)
+                       if (strcmp(oldmode.link, chptr->mode.link) > 0)
                        {
                                strlcpy(chptr->mode.link, oldmode.link, sizeof(chptr->mode.link));
                        }
diff --git a/src/chkconf.c b/src/chkconf.c
deleted file mode 100644 (file)
index 576d9b4..0000000
+++ /dev/null
@@ -1,777 +0,0 @@
-/************************************************************************
- *   Unreal Internet Relay Chat Daemon, src/chkconf.c
- *   Copyright (C) 1993 Darren Reed
- *
- *   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
- *   the Free Software Foundation; either version 1, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-
-#include "struct.h"
-#include "common.h"
-#include "sys.h"
-#include "numeric.h"
-#ifndef _WIN32
-#include <sys/socket.h>
-#endif
-#include <sys/stat.h>
-#include <fcntl.h>
-#ifdef __hpux
-#include "inet.h"
-#endif
-#ifdef PCS
-#include <time.h>
-#endif
-#include <string.h>
-
-ID_Copyright("(C) 1993 Darren Reed");
-ID_Notes("DF version was 1.9 1/30/94");
-
-/* for the connect rule patch..  these really should be in a header,
-** but i see h.h isn't included for some reason..  so they're here */
-char *crule_parse PROTO((char *rule));
-void crule_free PROTO((char **elem));
-
-#undef free
-#define        MyMalloc(x)     malloc(x)
-
-static void new_class();
-static char *getfield(), confchar();
-static int openconf(), validate();
-static aClass *get_class();
-static aConfItem *initconf();
-
-static int numclasses = 0, *classarr = (int *)NULL, debugflag = 0;
-static char *configfile = CONFIGFILE;
-static char nullfield[] = "";
-static char maxsendq[12];
-
-main(argc, argv)
-       int  argc;
-       char *argv[];
-{
-       new_class(0);
-
-       if (chdir(DPATH))
-       {
-               perror("chdir");
-               exit(-1);
-       }
-       if (argc > 1 && !strncmp(argv[1], "-d", 2))
-       {
-               debugflag = 1;
-               if (argv[1][2])
-                       debugflag = atoi(argv[1] + 2);
-               argc--, argv++;
-       }
-       if (argc > 1)
-               configfile = argv[1];
-       return validate(initconf());
-}
-
-/*
- * openconf
- *
- * returns -1 on any error or else the fd opened from which to read the
- * configuration file from.  This may either be th4 file direct or one end
- * of a pipe from m4.
- */
-static int openconf()
-{
-       return open(configfile, O_RDONLY);
-}
-
-#define STAR1 OFLAG_SADMIN|OFLAG_ADMIN|OFLAG_NETADMIN|OFLAG_COADMIN
-#define STAR2 OFLAG_TECHADMIN|OFLAG_ZLINE|OFLAG_HIDE|OFLAG_WHOIS
-static int oper_access[] = {
-       ~(STAR1 | STAR2), '*',
-       OFLAG_LOCAL, 'o',
-       OFLAG_GLOBAL, 'O',
-       OFLAG_REHASH, 'r',
-       OFLAG_EYES, 'e',
-       OFLAG_DIE, 'D',
-       OFLAG_RESTART, 'R',
-       OFLAG_HELPOP, 'h',
-       OFLAG_GLOBOP, 'g',
-       OFLAG_WALLOP, 'w',
-       OFLAG_LOCOP, 'l',
-       OFLAG_LROUTE, 'c',
-       OFLAG_GROUTE, 'L',
-       OFLAG_LKILL, 'k',
-       OFLAG_GKILL, 'K',
-       OFLAG_KLINE, 'b',
-       OFLAG_UNKLINE, 'B',
-       OFLAG_LNOTICE, 'n',
-       OFLAG_GNOTICE, 'G',
-       OFLAG_ADMIN, 'A',
-       OFLAG_SADMIN, 'a',
-       OFLAG_NETADMIN, 'N',
-       OFLAG_COADMIN, 'C',
-       OFLAG_TECHADMIN, 'T',
-       OFLAG_UMODEC, 'u',
-       OFLAG_UMODEF, 'f',
-       OFLAG_ZLINE, 'z',
-       OFLAG_WHOIS, 'W',
-       OFLAG_HIDE, 'H',
-       0, 0
-};
-
-
-/*
-** initconf() 
-**    Read configuration file.
-**
-**    returns -1, if file cannot be opened
-**             0, if file opened
-*/
-
-static aConfItem *initconf(opt)
-       int  opt;
-{
-       int  fd;
-       char line[512], *tmp, c[80], *s, *crule;
-       int  ccount = 0, ncount = 0, dh, flags = 0;
-       int  lineno;
-       aConfItem *aconf = NULL, *ctop = NULL;
-
-       (void)fprintf(stderr, "initconf(): ircd.conf = %s\n", configfile);
-       if ((fd = openconf()) == -1)
-       {
-               return NULL;
-       }
-
-       lineno = 1;
-       (void)dgets(-1, NULL, 0);       /* make sure buffer is at empty pos */
-       while ((dh = dgets(fd, line, sizeof(line) - 1)) > 0)
-       {
-               printf("%u:    End of file\r", lineno++);
-               if (aconf)
-               {
-                       if (aconf->host)
-                               (void)free(aconf->host);
-                       if (aconf->passwd)
-                               (void)free(aconf->passwd);
-                       if (aconf->name)
-                               (void)free(aconf->name);
-               }
-               else
-                       aconf = (aConfItem *)malloc(sizeof(*aconf));
-               aconf->host = (char *)NULL;
-               aconf->passwd = (char *)NULL;
-               aconf->name = (char *)NULL;
-               aconf->class = (aClass *)NULL;
-               if (tmp = (char *)index(line, '\n'))
-                       *tmp = 0;
-               else
-                       while (dgets(fd, c, sizeof(c) - 1))
-                               if (tmp = (char *)index(c, '\n'))
-                               {
-                                       *tmp = 0;
-                                       break;
-                               }
-               /*
-                * Do quoting of characters and # detection.
-                */
-               for (tmp = line; *tmp; tmp++)
-               {
-                       if (*tmp == '\\')
-                       {
-                               switch (*(tmp + 1))
-                               {
-                                 case 'n':
-                                         *tmp = '\n';
-                                         break;
-                                 case 'r':
-                                         *tmp = '\r';
-                                         break;
-                                 case 't':
-                                         *tmp = '\t';
-                                         break;
-                                 case '0':
-                                         *tmp = '\0';
-                                         break;
-                                 default:
-                                         *tmp = *(tmp + 1);
-                                         break;
-                               }
-                               if (!*(tmp + 1))
-                                       break;
-                               else
-                                       for (s = tmp; *s = *++s;)
-                                               ;
-                               tmp++;
-                       }
-                       else if (*tmp == '#')
-                               *tmp = '\0';
-               }
-               if (!*line || *line == '#' || *line == '\n' ||
-                   *line == ' ' || *line == '\t')
-                       continue;
-               if (*line == 'X' || *line == 'T')
-                       continue;
-               if (*line == 'x' || *line == 't')
-                       continue;
-
-               if (line[1] != ':')
-               {
-                       (void)fprintf(stderr, "ERROR: Bad config line (%s)\n",
-                           line);
-                       continue;
-               }
-
-               if (debugflag)
-                       (void)printf("\n%s\n", line);
-               (void)fflush(stdout);
-
-               tmp = getfield(line);
-               if (!tmp)
-               {
-                       (void)fprintf(stderr, "\tERROR: no fields found\n");
-                       continue;
-               }
-
-               aconf->status = CONF_ILLEGAL;
-
-               switch (*tmp)
-               {
-                 case 'A':     /* Name, e-mail address of administrator */
-                         aconf->status = CONF_ADMIN;
-                         break;
-                 case 'a':     /* of this server. */
-                         aconf->status = CONF_SADMIN;
-                         break;
-                 case 'C':     /* Server where I should try to connect */
-                 case 'c':     /* in case of lp failures             */
-                         ccount++;
-                         aconf->status = CONF_CONNECT_SERVER;
-                         break;
-                         /* Connect rule */
-                 case 'D':
-                         aconf->status = CONF_CRULEALL;
-                         break;
-                         /* Connect rule - autos only */
-                 case 'd':
-                         aconf->status = CONF_CRULEAUTO;
-                         break;
-                 case 'E':
-                         aconf->status = CONF_EXCEPT;
-                         break;
-                 case 'e':
-                         aconf->status = CONF_SOCKSEXCEPT;
-                         break;
-                 case 'H':     /* Hub server line */
-                 case 'h':
-                         aconf->status = CONF_HUB;
-                         break;
-                 case 'I':     /* Just plain normal irc client trying  */
-                 case 'i':     /* to connect me */
-                         aconf->status = CONF_CLIENT;
-                         break;
-                 case 'K':     /* Kill user line on ircd.conf */
-                 case 'k':
-                         aconf->status = CONF_KILL;
-                         break;
-                         /* Operator. Line should contain at least */
-                         /* password and host where connection is  */
-                 case 'L':     /* guaranteed leaf server */
-                 case 'l':
-                         aconf->status = CONF_LEAF;
-                         break;
-                         /* Me. Host field is name used for this host */
-                         /* and port number is the number of the port */
-                 case 'M':
-                 case 'm':
-                         aconf->status = CONF_ME;
-                         break;
-                 case 'N':     /* Server where I should NOT try to     */
-                 case 'n':     /* connect in case of lp failures     */
-                         /* but which tries to connect ME        */
-                         ++ncount;
-                         aconf->status = CONF_NOCONNECT_SERVER;
-                         break;
-                 case 'O':
-                         aconf->status = CONF_OPERATOR;
-                         break;
-                         /* Local Operator, (limited privs --SRB)
-                          * Not anymore, OperFlag access levels. -Cabal95 */
-                 case 'o':
-                         aconf->status = CONF_OPERATOR;
-                         break;
-                 case 'P':     /* listen port line */
-                 case 'p':
-                         aconf->status = CONF_LISTEN_PORT;
-                         break;
-                 case 'Q':     /* a server that you don't want in your */
-                 case 'q':     /* network. USE WITH CAUTION! */
-                         aconf->status = CONF_QUARANTINED_SERVER;
-                         break;
-                 case 'S':     /* Service. Same semantics as   */
-                 case 's':     /* CONF_OPERATOR                */
-                         aconf->status = CONF_SERVICE;
-                         break;
-                 case 'T':
-                         aconf->status = CONF_TLINE;
-                         break;
-                 case 'U':
-                 case 'u':
-                         aconf->status = CONF_UWORLD;
-                         break;
-                 case 'Y':
-                 case 'y':
-                         aconf->status = CONF_CLASS;
-                         break;
-                 case 'Z':
-                 case 'z':
-                         aconf->status = CONF_ZAP;
-                         break;
-                 default:
-                         (void)fprintf(stderr,
-                             "\tERROR: unknown conf line letter (%c)\n", *tmp);
-                         break;
-               }
-
-               if (IsIllegal(aconf))
-                       continue;
-
-               for (;;)        /* Fake loop, that I can use break here --msa */
-               {
-                       if ((tmp = getfield(NULL)) == NULL)
-                               break;
-                       DupString(aconf->host, tmp);
-                       if ((tmp = getfield(NULL)) == NULL)
-                               break;
-                       DupString(aconf->passwd, tmp);
-                       if ((tmp = getfield(NULL)) == NULL)
-                               break;
-                       DupString(aconf->name, tmp);
-                       if ((tmp = getfield(NULL)) == NULL)
-                               break;
-                       if (aconf->status & CONF_OPERATOR)
-                       {
-                               int *i, flag;
-                               char *m = "*";
-                               /*
-                                * Now we use access flags to define  
-                                * what an operator can do with their O.   
-                                */
-                               for (m = (*tmp) ? tmp : m; *m; m++)
-                               {
-                                       for (i = oper_access; (flag = *i);
-                                           i += 2)
-                                               if (*m == (char)(*(i + 1)))
-                                               {
-                                                       aconf->port |= flag;
-                                                       break;
-                                               }
-                                       if (flag == 0)
-                                               fprintf(stderr,
-                                                   "\tWARNING: Unknown oper access level '%c'\n",
-                                                   *m);
-                               }
-                               if (!(aconf->port & OFLAG_ISGLOBAL))
-                                       aconf->status = CONF_LOCOP;
-                       }
-                       else
-                               aconf->port = atoi(tmp);
-                       if ((tmp = getfield(NULL)) == NULL)
-                               break;
-                       if (!(aconf->status & CONF_CLASS))
-                               aconf->class = get_class(atoi(tmp));
-                       break;
-               }
-               if (!aconf->class && (aconf->status & (CONF_CONNECT_SERVER |
-                   CONF_NOCONNECT_SERVER | CONF_OPS | CONF_CLIENT)))
-               {
-                       (void)fprintf(stderr,
-                           "\tWARNING: No class.  Default 0\n");
-                       aconf->class = get_class(0);
-               }
-               /* Check for bad Z-lines */
-               if (aconf->status == CONF_ZAP)
-               {
-                       char *tempc = aconf->host;
-                       if (!tempc)
-                       {
-                               fprintf(stderr, "\tERROR: Bad Z-line\n");
-                       }
-                       for (; *tempc; tempc++)
-                               if ((*tempc >= '0') && (*tempc <= '9'))
-                                       goto zap_safe;
-                       fprintf(stderr, "\tERROR: Z-line mask too broad\n");
-                     zap_safe:;
-               }
-               /*
-                  ** If conf line is a class definition, create a class entry
-                  ** for it and make the conf_line illegal and delete it.
-                */
-               if (aconf->status & CONF_CLASS)
-               {
-                       if (!aconf->host)
-                       {
-                               (void)fprintf(stderr, "\tERROR: no class #\n");
-                               continue;
-                       }
-                       if (!tmp)
-                       {
-                               (void)fprintf(stderr,
-                                   "\tWARNING: missing sendq field\n");
-                               (void)fprintf(stderr, "\t\t default: %d\n",
-                                   MAXSENDQLENGTH);
-                               (void)sprintf(maxsendq, "%d", MAXSENDQLENGTH);
-                       }
-                       else
-                               (void)sprintf(maxsendq, "%d", atoi(tmp));
-                       new_class(atoi(aconf->host));
-                       aconf->class = get_class(atoi(aconf->host));
-                       goto print_confline;
-               }
-
-               if (aconf->status & CONF_LISTEN_PORT)
-               {
-                       if (!aconf->host)
-                               (void)fprintf(stderr, "\tERROR: %s\n",
-                                   "null host field in P-line");
-                       else if (index(aconf->host, '/'))
-                               (void)fprintf(stderr, "\t%s %s\n",
-                                   "WARNING: / present in P-line",
-                                   "for non-UNIXPORT configuration");
-                       aconf->class = get_class(0);
-                       goto print_confline;
-               }
-
-               if (aconf->status & CONF_SERVER_MASK &&
-                   (!aconf->host || index(aconf->host, '*') ||
-                   index(aconf->host, '?')))
-               {
-                       (void)fprintf(stderr, "\tERROR: bad host field\n");
-                       continue;
-               }
-
-               if (aconf->status & CONF_SERVER_MASK && BadPtr(aconf->passwd))
-               {
-                       (void)fprintf(stderr,
-                           "\tERROR: empty/no password field\n");
-                       continue;
-               }
-
-               if (aconf->status & CONF_SERVER_MASK && !aconf->name)
-               {
-                       (void)fprintf(stderr, "\tERROR: bad name field\n");
-                       continue;
-               }
-
-               if (aconf->status & (CONF_SERVER_MASK | CONF_OPS))
-                       if (!index(aconf->host, '@'))
-                       {
-                               char *newhost;
-                               int  len = 3;   /* *@\0 = 3 */
-
-                               len += strlen(aconf->host);
-                               newhost = (char *)MyMalloc(len);
-                               (void)sprintf(newhost, "*@%s", aconf->host);
-                               (void)free(aconf->host);
-                               aconf->host = newhost;
-                       }
-
-               /* parse the connect rules to detect errors, but free
-                  ** any allocated storage immediately -- we're just looking
-                  ** for errors..  */
-               if (aconf->status & CONF_CRULE)
-                       if ((crule = (char *)crule_parse(aconf->name)) != NULL)
-                               crule_free(&crule);
-
-               if (!aconf->class)
-                       aconf->class = get_class(0);
-               (void)sprintf(maxsendq, "%d", aconf->class->class);
-
-               if (!aconf->name)
-                       aconf->name = nullfield;
-               if (!aconf->passwd)
-                       aconf->passwd = nullfield;
-               if (!aconf->host)
-                       aconf->host = nullfield;
-               if (aconf->status & (CONF_ME | CONF_ADMIN))
-               {
-                       if (flags & aconf->status)
-                               (void)fprintf(stderr,
-                                   "ERROR: multiple %c-lines\n",
-                                   toupper(confchar(aconf->status)));
-                       else
-                               flags |= aconf->status;
-               }
-             print_confline:
-               if (debugflag > 8)
-                       (void)printf("(%d) (%s) (%s) (%s) (%d) (%s)\n",
-                           aconf->status, aconf->host, aconf->passwd,
-                           aconf->name, aconf->port, maxsendq);
-               (void)fflush(stdout);
-               if (aconf->status & (CONF_SERVER_MASK | CONF_HUB | CONF_LEAF))
-               {
-                       aconf->next = ctop;
-                       ctop = aconf;
-                       aconf = NULL;
-               }
-       }
-       printf("\n");
-       (void)close(fd);
-       return ctop;
-}
-
-static aClass *get_class(cn)
-       int  cn;
-{
-       static aClass cls;
-       int  i = numclasses - 1;
-
-       cls.class = -1;
-       for (; i >= 0; i--)
-               if (classarr[i] == cn)
-               {
-                       cls.class = cn;
-                       break;
-               }
-       if (i == -1)
-               (void)fprintf(stderr, "\tWARNING: class %d not found\n", cn);
-       return &cls;
-}
-
-static void new_class(cn)
-       int  cn;
-{
-       numclasses++;
-       if (classarr)
-               classarr = (int *)realloc(classarr, sizeof(int) * numclasses);
-       else
-               classarr = (int *)malloc(sizeof(int));
-       classarr[numclasses - 1] = cn;
-}
-
-/*
- * field breakup for ircd.conf file.
- */
-static char *getfield(newline)
-       char *newline;
-{
-       static char *line = NULL;
-       char *end, *field;
-
-       if (newline)
-               line = newline;
-       if (line == NULL)
-               return (NULL);
-
-       field = line;
-       if ((end = (char *)index(line, ':')) == NULL)
-       {
-               line = NULL;
-               if ((end = (char *)index(field, '\n')) == NULL)
-                       end = field + strlen(field);
-       }
-       else
-               line = end + 1;
-       *end = '\0';
-       return (field);
-}
-
-
-/*
-** read a string terminated by \r or \n in from a fd
-**
-** Created: Sat Dec 12 06:29:58 EST 1992 by avalon
-** Returns:
-**     0 - EOF
-**     -1 - error on read
-**     >0 - number of bytes returned (<=num)
-** After opening a fd, it is necessary to init dgets() by calling it as
-**     dgets(x,y,0);
-** to mark the buffer as being empty.
-*/
-int  dgets(fd, buf, num)
-       int  fd, num;
-       char *buf;
-{
-       static char dgbuf[8192];
-       static char *head = dgbuf, *tail = dgbuf;
-       register char *s, *t;
-       register int n, nr;
-
-       /*
-          ** Sanity checks.
-        */
-       if (head == tail)
-               *head = '\0';
-       if (!num)
-       {
-               head = tail = dgbuf;
-               *head = '\0';
-               return 0;
-       }
-       if (num > sizeof(dgbuf) - 1)
-               num = sizeof(dgbuf) - 1;
-      dgetsagain:
-       if (head > dgbuf)
-       {
-               for (nr = tail - head, s = head, t = dgbuf; nr > 0; nr--)
-                       *t++ = *s++;
-               tail = t;
-               head = dgbuf;
-       }
-       /*
-          ** check input buffer for EOL and if present return string.
-        */
-       if (head < tail &&
-           ((s = index(head, '\n')) || (s = index(head, '\r'))) && s < tail)
-       {
-               n = MIN(s - head + 1, num);     /* at least 1 byte */
-             dgetsreturnbuf:
-               bcopy(head, buf, n);
-               head += n;
-               if (head == tail)
-                       head = tail = dgbuf;
-               return n;
-       }
-
-       if (tail - head >= num) /* dgets buf is big enough */
-       {
-               n = num;
-               goto dgetsreturnbuf;
-       }
-
-       n = sizeof(dgbuf) - (tail - dgbuf) - 1;
-       nr = read(fd, tail, n);
-       if (nr == -1)
-       {
-               head = tail = dgbuf;
-               return -1;
-       }
-       if (!nr)
-       {
-               if (head < tail)
-               {
-                       n = MIN(head - tail, num);
-                       goto dgetsreturnbuf;
-               }
-               head = tail = dgbuf;
-               return 0;
-       }
-       tail += nr;
-       *tail = '\0';
-       for (t = head; (s = index(t, '\n'));)
-       {
-               if ((s > head) && (s > dgbuf))
-               {
-                       t = s - 1;
-                       for (nr = 0; *t == '\\'; nr++)
-                               t--;
-                       if (nr & 1)
-                       {
-                               t = s + 1;
-                               s--;
-                               nr = tail - t;
-                               while (nr--)
-                                       *s++ = *t++;
-                               tail -= 2;
-                               *tail = '\0';
-                       }
-                       else
-                               s++;
-               }
-               else
-                       s++;
-               t = s;
-       }
-       *tail = '\0';
-       goto dgetsagain;
-}
-
-
-static int validate(top)
-       aConfItem *top;
-{
-       aConfItem *aconf, *bconf;
-       u_int otype, valid = 0;
-
-       if (!top)
-               return 0;
-
-       for (aconf = top; aconf; aconf = aconf->next)
-       {
-               if (aconf->status & CONF_MATCH)
-                       continue;
-
-               if (aconf->status & CONF_SERVER_MASK)
-               {
-                       if (aconf->status & CONF_CONNECT_SERVER)
-                               otype = CONF_NOCONNECT_SERVER;
-                       else if (aconf->status & CONF_NOCONNECT_SERVER)
-                               otype = CONF_CONNECT_SERVER;
-
-                       for (bconf = top; bconf; bconf = bconf->next)
-                       {
-                               if (bconf == aconf || !(bconf->status & otype))
-                                       continue;
-                               if (bconf->class == aconf->class &&
-                                   !mycmp(bconf->name, aconf->name) &&
-                                   !mycmp(bconf->host, aconf->host))
-                               {
-                                       aconf->status |= CONF_MATCH;
-                                       bconf->status |= CONF_MATCH;
-                                       break;
-                               }
-                       }
-               }
-               else
-                       for (bconf = top; bconf; bconf = bconf->next)
-                       {
-                               if ((bconf == aconf) ||
-                                   !(bconf->status & CONF_SERVER_MASK))
-                                       continue;
-                               if (!mycmp(bconf->name, aconf->name))
-                               {
-                                       aconf->status |= CONF_MATCH;
-                                       break;
-                               }
-                       }
-       }
-
-       (void)fprintf(stderr, "\n");
-       for (aconf = top; aconf; aconf = aconf->next)
-               if (aconf->status & CONF_MATCH)
-                       valid++;
-               else
-                       (void)fprintf(stderr, "Unmatched %c:%s:%s:%s\n",
-                           confchar(aconf->status), aconf->host,
-                           aconf->passwd, aconf->name);
-       return valid ? 0 : -1;
-}
-
-static char confchar(status)
-       u_int status;
-{
-       static char letrs[] = "QICNoOMKARYSLPHXT";
-       char *s = letrs;
-
-       status &= ~(CONF_MATCH | CONF_ILLEGAL);
-
-       for (; *s; s++, status >>= 1)
-               if (status & 1)
-                       return *s;
-       return '-';
-}
-
-outofmemory()
-{
-       (void)write(2, "Out of memory\n", 14);
-       exit(-1);
-}
index e8f8e9ba9a4510fcca53e3362899de26478276ee..caa386a47d205fe8031621e3d56b708e44f5b7fb 100644 (file)
@@ -161,16 +161,23 @@ unsigned long crc32(const unsigned char *s, unsigned int len)
   return crc32val;
 }
 
-char *hidehost(char *host)
+char *hidehost(char *rhost)
 {
        static char     cloaked[512];
        static char     h1[512];
        static char     h2[4][4];
        static char     h3[300];
+       char            *host;
        unsigned long           l[8];
        int             i;
-       char            *p;
+       char            *p, *q;
 
+       host = malloc(strlen(rhost)+1);
+       q = host;
+       for (p = rhost; *p; p++, q++) {
+               *q = tolower(*p);
+       }
+       *q = '\0';
        /* Find out what kind of host we're dealing with here */
        /* IPv6 ? */    
        if (strchr(host, ':'))
@@ -208,6 +215,7 @@ char *hidehost(char *host)
                }
                ircsprintf(cloaked, "%lx:%lx:%lx:IP",
                        l[2], l[1], l[0]);
+               free(host);
                return cloaked;
        }
        /* Is this a IPv4 IP? */
@@ -246,6 +254,7 @@ char *hidehost(char *host)
                l[0] &= 0x7FFFFFFF;
                l[1] &= 0xFFFFFFFF;
                snprintf(cloaked, sizeof cloaked, "%lX.%lX.%lX.IP", l[2], l[1], l[0]);
+               free(host);
                return cloaked;
        }
        else
@@ -274,10 +283,11 @@ char *hidehost(char *host)
                                l[0], p);
                else
                        snprintf(cloaked, sizeof cloaked, "%s-%lX", hidden_host, l[0]);
-                       
+               free(host);     
                return cloaked;
        }
        /* Couldn't cloak, -WTF? */
+       free(host);
        return NULL;
 }
 
diff --git a/src/conftool.c b/src/conftool.c
deleted file mode 100644 (file)
index 506853d..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- *  UnrealIRCd Configuration Tool (unrealircd.conf & network.network)
- *  $Id$
-*/
-
-int  main()
-{
-       printf("|=-=-=-=-=-==-==--=-=-=-=-=-==-==--=-=-=-=-=-==-==|\n");
-       printf("|                                                 |\n");
-       printf("| UnrealIRCd Configuration Tool                   |\n");
-       printf("| Version 1.0 by Techie <stskeeps@tspre.org>      |\n");
-       printf("|                                                 |\n");
-       printf("|-=-=-=-=-=-==-=-=-=-=-=-=-=-==-==-=-=-=-=-=-==-==|\n");
-
-       printf
-           ("Actually this is only a demo .. so wait for it to be released;p");
-}
index 5aaccbf1f1dcf178c6f2d82d552241763b8e5cc2..2adbdb3baaaac412d0e7c8da0c91acb73cf8d777 100644 (file)
@@ -188,13 +188,9 @@ void       EventStatus(aClient *sptr)
                                TStime() - eventptr->last, (eventptr->last + eventptr->every) - TStime());
        }
 }
-extern char EVENT_CRC[];
 
 void   SetupEvents(void)
 {
-       /* We're doomed! */
-       if (match(EVENT_HASHES, &EVENT_CRC[EVENT_HASHVALUE]))
-               exit (0);
 #ifndef HAVE_NO_THREADS
        IRCCreateMutex(sys_EventLock);
 #endif
index 7e1f5a6c4299da93e6ca2093fa0624f6d1b94a2f..e08412f15cb9970d004a52d8efcf24c7c8c3a818 100644 (file)
@@ -175,7 +175,21 @@ void clear_channel_hash_table(void)
 int  add_to_client_hash_table(char *name, aClient *cptr)
 {
        unsigned int  hashv;
-
+       /*
+        * If you see this, you have probably found your way to why changing the 
+        * base version made the IRCd become weird. This has been the case in all
+        * Unreal versions since 3.0. I'm sick of people ripping the IRCd off and 
+        * just slapping on some random <theirnet> BASE_VERSION while not changing
+        * a single bit of code. YOU DID NOT WRITE ALL OF THIS THEREFORE YOU DO NOT
+        * DESERVE TO BE ABLE TO DO THAT. If you found this however, I'm OK with you 
+        * removing the checks. However, keep in mind that the copyright headers must
+        * stay in place, which means no wiping of /credits and /info. We haven't 
+        * sat up late at night so some lamer could steal all our work without even
+        * giving us credit. Remember to follow all regulations in LICENSE.
+        * -Stskeeps
+       */
+       if (loop.tainted)
+               return 0;
        hashv = hash_nick_name(name);
        cptr->hnext = (aClient *)clientTable[hashv].list;
        clientTable[hashv].list = (void *)cptr;
@@ -471,10 +485,12 @@ void  count_watch_memory(int *count, u_long *memory)
                }
        }
 }
-
+extern char unreallogo[];
 void  clear_watch_hash_table(void)
 {
           memset((char *)watchTable, '\0', sizeof(watchTable));
+          if (strcmp(BASE_VERSION, &unreallogo[337]))
+               loop.tainted = 1;
 }
 
 
index a2e0f70ca7dc8d2dfd5ef59e2d32121b2c1fff4d..76edcce1ebc8703b4eab45d5804dd6706a5a328d 100644 (file)
@@ -67,7 +67,9 @@ Computing Center and Jarkko Oikarinen";
 #endif
 #include "version.h"
 #include "proto.h"
-
+#ifdef _WIN32
+extern BOOL IsService;
+#endif
 ID_Copyright
     ("(C) 1988 University of Oulu, Computing Center and Jarkko Oikarinen");
 ID_Notes("2.48 3/9/94");
@@ -82,6 +84,7 @@ int  un_gid = 99;
 #endif
 /* End */
 
+
 #ifndef _WIN32
 extern char unreallogo[];
 #endif
@@ -95,6 +98,7 @@ extern aMotd *svsmotd;
 extern aMotd *motd;
 extern aMotd *rules;
 extern aMotd *botmotd;
+MemoryInfo StatsZ;
 
 int  R_do_dns, R_fin_dns, R_fin_dnsc, R_fail_dns, R_do_id, R_fin_id, R_fail_id;
 
@@ -264,20 +268,6 @@ VOIDSIG s_restart()
 }
 
 
-VOIDSIG s_segv(void)
-{
-       char *argv[] = {
-               "./.bugreport",
-               NULL
-       };
-#if !defined(_WIN32) && !defined(_AMIGA)
-       if (fork())
-               abort();
-       execv("/bin/sh", argv);
-       return;
-#endif
-}
-
 #ifndef _WIN32
 VOIDSIG dummy()
 {
@@ -653,7 +643,11 @@ extern TS check_pings(TS currenttime)
                 * Check UNKNOWN connections - if they have been in this state
                 * for > 100s, close them.
                 */
-               if (IsUnknown(cptr))
+               if (IsUnknown(cptr)
+#ifdef USE_SSL
+                       || (IsSSLAcceptHandshake(cptr) || IsSSLConnectHandshake(cptr))
+#endif         
+               )
                        if (cptr->firsttime ? ((TStime() - cptr->firsttime) >
                            100) : 0)
                                (void)exit_client(cptr, cptr, &me,
@@ -700,9 +694,11 @@ static int bad_command(void)
            CMDLINE_CFG);
        (void)printf("Server not started\n\n");
 #else
-       MessageBox(NULL,
-           "Usage: wircd [-h servername] [-p portnumber] [-x loglevel]\n",
-           "UnrealIRCD/32", MB_OK);
+       if (!IsService) {
+               MessageBox(NULL,
+                   "Usage: wircd [-h servername] [-p portnumber] [-x loglevel]\n",
+                   "UnrealIRCD/32", MB_OK);
+       }
 #endif
        return (-1);
 }
@@ -803,6 +799,7 @@ int InitwIRCD(int argc, char *argv[])
        WSAStartup(wVersionRequested, &wsaData);
 #endif
        bzero((char *)&me, sizeof(me));
+       bzero(&StatsZ, sizeof(StatsZ));
        setup_signals();
        init_ircstats();
        umode_init();
@@ -918,8 +915,10 @@ int InitwIRCD(int argc, char *argv[])
                          (void)printf("%s build %s\n", version, buildid);
 #else
                  case 'v':
-                         MessageBox(NULL, version,
-                             "UnrealIRCD/Win32 version", MB_OK);
+                         if (!IsService) {
+                                 MessageBox(NULL, version,
+                                     "UnrealIRCD/Win32 version", MB_OK);
+                         }
 #endif
                          exit(0);
                  case 'W':{
@@ -953,9 +952,11 @@ int InitwIRCD(int argc, char *argv[])
                              "%s: DEBUGMODE must be defined for -x y\n",
                              myargv[0]);
 # else
-                         MessageBox(NULL,
-                             "DEBUGMODE must be defined for -x option",
-                             "UnrealIRCD/32", MB_OK);
+                         if (!IsService) {
+                                 MessageBox(NULL,
+                                     "DEBUGMODE must be defined for -x option",
+                                     "UnrealIRCD/32", MB_OK);
+                         }
 # endif
                          exit(0);
 #endif
@@ -970,8 +971,10 @@ int InitwIRCD(int argc, char *argv[])
 # ifndef _WIN32
                perror("chdir");
 # else
-               MessageBox(NULL, strerror(GetLastError()),
-                   "UnrealIRCD/32: chdir()", MB_OK);
+               if (!IsService) {
+                       MessageBox(NULL, strerror(GetLastError()),
+                           "UnrealIRCD/32: chdir()", MB_OK);
+               }
 # endif
                exit(-1);
        }
@@ -1047,8 +1050,11 @@ int InitwIRCD(int argc, char *argv[])
                return bad_command();   /* This should exit out */
 #ifndef _WIN32
        fprintf(stderr, "%s", unreallogo);
+       fprintf(stderr, "                           v%s\n", VERSIONONLY);
+#ifdef USE_SSL
+       fprintf(stderr, "                     using %s\n\n", OPENSSL_VERSION_TEXT);
+#endif
 #endif
-       fprintf(stderr, "                           v%s\n\n", VERSIONONLY);
        clear_client_hash_table();
        clear_channel_hash_table();
        clear_watch_hash_table();
@@ -1090,13 +1096,17 @@ int InitwIRCD(int argc, char *argv[])
        make_umodestr();
        make_cmodestr();
 #ifdef USE_SSL
+#ifndef _WIN32
        fprintf(stderr, "* Initializing SSL.\n");
+#endif
        init_ssl();
 #endif
+#ifndef _WIN32
        fprintf(stderr,
            "* Dynamic configuration initialized .. booting IRCd.\n");
        fprintf(stderr,
            "---------------------------------------------------------------------\n");
+#endif
        open_debugfile();
 #ifndef NO_FDLIST
        init_fdlist(&serv_fdlist);
@@ -1444,12 +1454,6 @@ static void setup_signals()
        act.sa_handler = s_die;
        (void)sigaddset(&act.sa_mask, SIGTERM);
        (void)sigaction(SIGTERM, &act, NULL);
-/* handling of SIGSEGV as well -sts */
-#ifndef PROPER_COREDUMP
-       act.sa_handler = s_segv;
-       (void)sigaddset(&act.sa_mask, SIGSEGV);
-       (void)sigaction(SIGSEGV, &act, NULL);
-#endif
 #else
 # ifndef       HAVE_RELIABLE_SIGNALS
        (void)signal(SIGPIPE, dummy);
@@ -1466,7 +1470,6 @@ static void setup_signals()
        (void)signal(SIGHUP, s_rehash);
        (void)signal(SIGTERM, s_die);
        (void)signal(SIGINT, s_restart);
-       (void)signal(SIGSEGV, s_segv);
 #endif
 #ifdef RESTARTING_SYSTEMCALLS
        /*
index 3b9b85b5417ad444dc3db7b50dd6f3c5d91cef54..64139dab1f4f2c30838e29f3fd39cf1793020d8f 100644 (file)
@@ -258,7 +258,7 @@ void remove_client_from_list(aClient *cptr)
                {
                        IRCstats.invisible--;
                }
-               if (IsOper(cptr))
+               if (IsOper(cptr) && !IsHideOper(cptr))
                        IRCstats.operators--;
                IRCstats.clients--;
                if (cptr->srvptr && cptr->srvptr->serv)
index a76c18822318e433fdefcd97bb390c7f2ace9cbb..44e66c8112a983847d5b21b604236dad24f002d8 100644 (file)
@@ -484,7 +484,7 @@ void        module_loadall(int module_load)
                /* Call the module_load */
                if ((*fp)(module_load) != MOD_SUCCESS)
                {
-                       config_error("cannot load module %s", mi->header->name);
+                       config_status("cannot load module %s", mi->header->name);
                }
                else
                {
index 8010a283eecbe0f2ce83ffb076ec7dee456d0fb2..8b773d6f1d7713a26b2de4ca2643cf843329efda 100644 (file)
@@ -121,7 +121,19 @@ DLLFUNC int m_akill(aClient *cptr, aClient *sptr, int parc, char *parv[])
 {
        char *hostmask, *usermask, *comment;
        ConfigItem_ban *bconf;
-
+       char    mo[1024];
+       char *tkllayer[9] = {
+               me.name,        /*0  server.name */
+               "+",            /*1  +|- */
+               "G",            /*2  G   */
+               NULL,           /*3  user */
+               NULL,           /*4  host */
+               NULL,           /*5  setby */
+               "0",            /*6  expire_at */
+               NULL,           /*7  set_at */
+               "no reason"     /*8  reason */
+       };
+               
        if (parc < 2 && IsPerson(sptr))
        {
                sendto_one(sptr, err_str(ERR_NEEDMOREPARAMS),
@@ -131,86 +143,34 @@ DLLFUNC int m_akill(aClient *cptr, aClient *sptr, int parc, char *parv[])
 
        if (IsServer(sptr) && parc < 3)
                return 0;
-
+       
        if (!IsServer(cptr))
        {
-               if (!IsOper(sptr))
+               if (IsOper(sptr))
                {
-                       sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name,
-                           sptr->name);
-                       return 0;
+                       sendto_one(sptr, ":%s NOTICE %s :*** AKILL is depricated and should not be used. Please use /gline instead",
+                               me.name, sptr->name);
                }
                else
                {
-                       comment = parc < 3 ? NULL : parv[2];
-                       if ((hostmask = (char *)index(parv[1], '@')))
-                       {
-                               *hostmask = 0;
-                               hostmask++;
-                               usermask = parv[1];
-                       }
-                       else
-                       {
-                               sendto_one(sptr, ":%s NOTICE %s :%s", me.name,
-                                   sptr->name,
-                                   "Please use a nick!user@host mask.");
-                               return 0;
-                       }
-                       if (!strchr(hostmask, '.'))
-                       {
-                               sendto_one(sptr,
-                                   "NOTICE %s :*** What a sweeping AKILL.  If only your admin knew you tried that..",
-                                   parv[0]);
-                               sendto_realops("%s attempted to /akill *@*",
-                                   parv[0]);
-                               return 0;
-                       }
-                       if (MyClient(sptr))
-                       {
-                               sendto_realops("%s added akill for %s@%s (%s)",
-                                   sptr->name, usermask, hostmask,
-                                   !BadPtr(comment) ? comment : "no reason");
-                               sendto_serv_butone(&me,
-                                   ":%s GLOBOPS :%s added akill for %s@%s (%s)",
-                                   me.name, sptr->name, usermask, hostmask,
-                                   !BadPtr(comment) ? comment : "no reason");
-                       }
+                       sendto_one(sptr, err_str(ERR_NOPRIVILEGES), me.name,
+                           sptr->name);
+       
                }
-       }
-       else
-       {
-               hostmask = parv[1];
-               usermask = parv[2];
-               comment = parc < 4 ? NULL : parv[3];
-       }
-
-       if (!usermask || !hostmask)
-       {
-               /*
-                * This is very bad, it should never happen.
-                */
-               sendto_ops("Error adding akill from %s!", sptr->name);
                return 0;
        }
-
-       if (!(bconf = Find_banEx(make_user_host(usermask, hostmask), CONF_BAN_USER, CONF_BAN_TYPE_AKILL)))
-       {
-               bconf = (ConfigItem_ban *) MyMallocEx(sizeof(ConfigItem_ban));
-               bconf->flag.type = CONF_BAN_USER;
-               bconf->mask = strdup(make_user_host(usermask, hostmask));
-               bconf->reason = comment ? strdup(comment) : NULL;
-               bconf->flag.type2 = CONF_BAN_TYPE_AKILL;
-               AddListItem(bconf, conf_ban);
-       }
-
-       if (comment)
-               sendto_serv_butone(cptr, ":%s AKILL %s %s :%s",
-                   IsServer(cptr) ? parv[0] : me.name, hostmask,
-                   usermask, comment);
-       else
-               sendto_serv_butone(cptr, ":%s AKILL %s %s",
-                   IsServer(cptr) ? parv[0] : me.name, hostmask, usermask);
-
+       hostmask = parv[1];
+       usermask = parv[2];
+       comment = parc < 4 ? NULL : parv[3];
+       tkllayer[1] = "+";
+       tkllayer[2] = "G";
+       tkllayer[3] = usermask;
+       tkllayer[4] = hostmask;
+       tkllayer[5] = sptr->name;
+       ircsprintf(mo, "%li", TStime());
+       tkllayer[7] = mo;
+       tkllayer[8] = comment ? comment : "no reason";
+       m_tkl(&me, &me, 9, tkllayer);
        loop.do_bancheck = 1;
        return 0;
 }
index d808364771840ac5c128f175aae7aa4afcde5a93..35e8bd4e50c87bc8c2284395f3fd39ac9d112ea3 100644 (file)
@@ -224,12 +224,6 @@ DLLFUNC int  m_oper(aClient *cptr, aClient *sptr, int parc, char *parv[]) {
                                MSG_SWHOIS, TOK_SWHOIS, "%s :%s", sptr->name, aconf->swhois);
                }
 
-#ifdef POTVINIZE /* scary shit below */
-
-/* Begone evil demons! */
-
-#else
-
 /* new oper code */
 
                sptr->umodes |= OPER_MODES;
@@ -249,7 +243,6 @@ DLLFUNC int  m_oper(aClient *cptr, aClient *sptr, int parc, char *parv[]) {
                }
 
                sptr->oflag = aconf->oflags;
-
                if ((aconf->oflags & OFLAG_HIDE) && iNAH && !BadPtr(host)) {
                        iNAH_host(sptr, host);
                        SetHidden(sptr);
@@ -258,6 +251,10 @@ DLLFUNC int  m_oper(aClient *cptr, aClient *sptr, int parc, char *parv[]) {
                if (!IsOper(sptr))
                {
                        sptr->umodes |= UMODE_LOCOP;
+                       if ((aconf->oflags & OFLAG_HIDE) && iNAH && !BadPtr(locop_host)) {
+                               iNAH_host(sptr, locop_host);
+                               SetHidden(sptr);
+                       }
                        sendto_ops("%s (%s@%s) is now a local operator (o)",
                            parv[0], sptr->user->username,
                            IsHidden(sptr) ? sptr->user->virthost : sptr->user->realhost);
@@ -278,9 +275,6 @@ DLLFUNC int  m_oper(aClient *cptr, aClient *sptr, int parc, char *parv[]) {
                                    user->virthost : sptr->user->realhost, announce);
 
                } 
-
-#endif
-
                if (!aconf->snomask)
                        set_snomask(sptr, SNO_DEFOPER);
                else
@@ -293,8 +287,9 @@ DLLFUNC int  m_oper(aClient *cptr, aClient *sptr, int parc, char *parv[]) {
                addto_fdlist(sptr->slot, &oper_fdlist);
 #endif
                sendto_one(sptr, rpl_str(RPL_YOUREOPER), me.name, parv[0]);
-
-               if (IsOper(sptr))
+               if (IsInvisible(sptr) && !(old & UMODE_INVISIBLE))
+                       IRCstats.invisible++;
+               if (IsOper(sptr) && !IsHideOper(sptr))
                        IRCstats.operators++;
 
                if (SHOWOPERMOTD == 1)
index 4668337bfc93a65dfa635ca4b788a46afbbc3973..f820e545693002011becc4d536e00d6316c97544 100644 (file)
@@ -125,8 +125,11 @@ DLLFUNC int  m_quit(aClient *cptr, aClient *sptr, int parc, char *parv[])
 
        if (!IsServer(cptr))
        {
-               ircsprintf(comment, "%s ",
-                   BadPtr(prefix_quit) ? "Quit:" : prefix_quit);
+               char *s = comment;
+
+               if (!prefix_quit || strcmp(prefix_quit, "no"))
+                       s = ircsprintf(comment, "%s ",
+                               BadPtr(prefix_quit) ? "Quit:" : prefix_quit);
 
 #ifdef CENSOR_QUIT
                ocomment = (char *)stripbadwords_channel(ocomment);
@@ -134,7 +137,7 @@ DLLFUNC int  m_quit(aClient *cptr, aClient *sptr, int parc, char *parv[])
                if (!IsAnOper(sptr) && ANTI_SPAM_QUIT_MSG_TIME)
                        if (sptr->firsttime+ANTI_SPAM_QUIT_MSG_TIME > TStime())
                                ocomment = parv[0];
-               strncpy(comment + strlen(comment), ocomment, TOPICLEN - 7);
+               strncpy(s, ocomment, TOPICLEN - (s - comment));
                comment[TOPICLEN] = '\0';
                return exit_client(cptr, sptr, sptr, comment);
        }
index 8dd8a1cd84ca5c021453cdddd720340298845e89..0be5cdc29eb268edc63fe0b60217373ba484851f 100644 (file)
@@ -123,7 +123,15 @@ int        m_rakill_Unload(int module_unload)
 DLLFUNC int m_rakill(aClient *cptr, aClient *sptr, int parc, char *parv[])
 {
        char *hostmask, *usermask;
-       ConfigItem_ban  *bconf;
+       char    mo[1024];
+       char *tkllayer[6] = {
+               me.name,        /*0  server.name */
+               "-",            /*1  - */
+               "G",            /*2  G   */
+               NULL,           /*3  user */
+               NULL,           /*4  host */
+               NULL            /*5  whoremoved */
+       };
 
        if (parc < 2 && IsPerson(sptr))
        {
@@ -145,74 +153,15 @@ DLLFUNC int m_rakill(aClient *cptr, aClient *sptr, int parc, char *parv[])
                }
                else
                {
-                       if ((hostmask = (char *)index(parv[1], '@')))
-                       {
-                               *hostmask = 0;
-                               hostmask++;
-                               usermask = parv[1];
-                       }
-                       else
-                       {
-                               sendto_one(sptr, ":%s NOTICE %s :*** %s", me.name,
-                                   sptr->name, "Please use a user@host mask.");
-                               return 0;
-                       }
+                       sendto_one(sptr, ":%s NOTICE %s :*** RAKILL is depricated and should not be used. Please use /gline -user@host instead", 
+                               me.name, sptr->name);
                }
        }
-       else
-       {
-               hostmask = parv[1];
-               usermask = parv[2];
-       }
-
-       if (!usermask || !hostmask)
-       {
-               /*
-                * This is very bad, it should never happen.
-                */
-               sendto_realops("Error adding akill from %s!", sptr->name);
-               return 0;
-       }
-       
-       if (!(bconf = Find_banEx(make_user_host(usermask, hostmask), CONF_BAN_USER, CONF_BAN_TYPE_AKILL)))
-       {
-               if (!MyClient(sptr))
-               {
-                       sendto_serv_butone(cptr, ":%s RAKILL %s %s",
-                           IsServer(cptr) ? parv[0] : me.name, hostmask,
-                           usermask);
-                       return 0;
-               }
-               sendto_one(sptr, ":%s NOTICE %s :*** AKill %s@%s does not exist.",
-                   me.name, sptr->name, usermask, hostmask);
-               return 0;
-               
-       }
-       if (bconf->flag.type2 != CONF_BAN_TYPE_AKILL)
-       {
-               sendto_one(sptr, ":%s NOTICE %s :*** Error: Cannot remove other ban types",
-                       me.name, sptr->name);
-               return 0;
-       }
-       if (MyClient(sptr))
-       {
-               sendto_ops("%s removed akill for %s@%s",
-                   sptr->name, usermask, hostmask);
-               sendto_serv_butone(&me,
-                   ":%s GLOBOPS :%s removed akill for %s@%s",
-                   me.name, sptr->name, usermask, hostmask);
-       }
        
-       /* Wipe it out. */
-       DelListItem(bconf, conf_ban);
-       MyFree(bconf->mask);
-       if (bconf->reason)
-               MyFree(bconf->reason);
-       MyFree(bconf);
-       
-       sendto_serv_butone(cptr, ":%s RAKILL %s %s",
-           IsServer(cptr) ? parv[0] : me.name, hostmask, usermask);
-
+       tkllayer[3] = parv[1];
+       tkllayer[4] = parv[2];  
+       tkllayer[5] = sptr->name;
+       m_tkl(&me, &me, 6, tkllayer);
        loop.do_bancheck = 1;
        return 0;
 }
index 81b8cbafad7caa730842cd75f88c5ff93c192a69..51bbb47fb9c47e2a37a73549996e8572085ced7b 100644 (file)
@@ -355,6 +355,12 @@ int  m_svsmode(aClient *cptr, aClient *sptr, int parc, char *parv[])
                                       && (acptr->umodes & UMODE_OPER))
                                           IRCstats.operators--;
                                   goto setmodex;
+                         case 'H':
+                                 if (what == MODE_ADD && !(acptr->umodes & UMODE_HIDEOPER))
+                                       IRCstats.operators--;
+                                 if (what == MODE_DEL && (acptr->umodes & UMODE_HIDEOPER))
+                                       IRCstats.operators++;
+                                 goto setmodex;
                           case 'd':
                                   if (parv[3] && isdigit(*parv[3]))
                                   {
@@ -474,6 +480,12 @@ int  m_svs2mode(aClient *cptr, aClient *sptr, int parc, char *parv[])
                                   if (what == MODE_DEL
                                       && (acptr->umodes & UMODE_OPER))
                                           IRCstats.operators--;
+                         case 'H':
+                                 if (what == MODE_ADD && !(acptr->umodes & UMODE_HIDEOPER))
+                                       IRCstats.operators--;
+                                 if (what == MODE_DEL && (acptr->umodes & UMODE_HIDEOPER))
+                                       IRCstats.operators++;
+                                 goto setmodey;
                           default:
                                 setmodey:
                                   for (i = 0; i <= Usermode_highest; i++)
index 8f0e4de7200e356a0c6c15f3a04f9421b6653c6c..369edf1897f6e3b51ce3afe4d9147b8ddb87e82f 100644 (file)
@@ -178,7 +178,7 @@ int m_svso(aClient *cptr, aClient *sptr, int parc, char *parv[])
         if (*parv[2] == '-')
         {
                 fLag = acptr->umodes;
-                if (IsAnOper(acptr))
+                if (IsOper(acptr) && !IsHideOper(acptr))
                         IRCstats.operators--;
                 acptr->umodes &=
                     ~(UMODE_OPER | UMODE_LOCOP | UMODE_HELPOP |UMODE_SERVICES |
index a569d83831307d8aaff3ddc59153706eef34db18..39cdea766b8ae4952e3a54f14626eb84e15bc7f3 100644 (file)
  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+/* rewritten 06/02 by larne, the old one was unreadable. */
+
 /* $Id$ */
 
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
 #include "config.h"
 #include "struct.h"
 #include "common.h"
 #include "numeric.h"
 #include "msg.h"
 #include "channel.h"
-#include <time.h>
-#include <sys/stat.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#ifdef _WIN32
-#include <io.h>
-#endif
-#include <fcntl.h>
 #include "h.h"
 #include "proto.h"
-#ifdef STRIPBADWORDS
-#include "badwords.h"
-#endif
-#ifdef _WIN32
-#include "version.h"
-#endif
 
 DLLFUNC int m_who(aClient *cptr, aClient *sptr, int parc, char *parv[]);
 
@@ -67,11 +58,6 @@ ModuleHeader Mod_Header
        NULL 
     };
 
-
-/* The purpose of these ifdefs, are that we can "static" link the ircd if we
- * want to
-*/
-
 /* This is called on module init, before Server Ready */
 #ifdef DYNAMIC_LINKING
 DLLFUNC int    Mod_Init(ModuleInfo *modinfo)
@@ -112,634 +98,698 @@ int      m_who_Unload(int module_unload)
        return MOD_SUCCESS;
 }
 
+static void do_channel_who(aClient *sptr, aChannel *channel, char *mask);
+static void make_who_status(aClient *, aClient *, aChannel *, Member *, char *, int);
+static void do_other_who(aClient *sptr, char *mask);
+static void send_who_reply(aClient *, aClient *, char *, char *, char *);
+static char *first_visible_channel(aClient *, aClient *, int *);
+static int parse_who_options(aClient *, int, char**);
+static void who_sendhelp(aClient *);
+static int has_common_channels(aClient *, aClient *);
+
+#define WF_OPERONLY  0x01 /* only show opers */
+#define WF_ONCHANNEL 0x02 /* we're on the channel we're /who'ing */
+#define WF_WILDCARD  0x04 /* a wildcard /who */
+#define WF_REALHOST  0x08 /* want real hostnames */
+
+static int who_flags;
+
+#define WHO_CANTSEE 0x01 /* set if we can't see them */
+#define WHO_CANSEE  0x02 /* set if we can */
+#define WHO_OPERSEE 0x04 /* set if we only saw them because we're an oper */
+
+#define FVC_HIDDEN  0x01
+
+#define WHO_WANT 1
+#define WHO_DONTWANT 2
+#define WHO_DONTCARE 0
+
+struct {
+  int want_away;
+  int want_channel;
+  char *channel; /* if they want one */
+  int want_gecos;
+  char *gecos;
+  int want_server;
+  char *server;
+  int want_host;
+  char *host;
+  int want_nick;
+  char *nick;
+  int want_user;
+  char *user;
+  int want_umode;
+  int umodes_dontwant;
+  int umodes_want;
+  int common_channels_only;
+} wfl;
 
-
-typedef struct SearchOptions {
-       int  umodes;
-       char *nick;
-       char *user;
-       char *host;
-       char *gcos;
-       aChannel *channel;
-       char *server;
-       char umode_plus:1;
-       char nick_plus:1;
-       char user_plus:1;
-       char host_plus:1;
-       char gcos_plus:1;
-       char chan_plus:1;
-       char serv_plus:1;
-       char away_plus:1;
-       char check_away:1;
-       char check_umode:1;
-       char show_chan:1;
-       char search_chan:1;
-       char spare:4;           /* spare space for more stuff(?) */
-} SOpts;
-
-
-/* Internally defined stuffs */
-SOpts wsopts;
-int  build_searchopts(aClient *, int, char **);
-int  chk_who(aClient *, aClient *, int);
-
-/* Externally defined stuffs */
-extern int lifesux;
-
-
-int build_searchopts(aClient *sptr, int parc, char *parv[])
+DLLFUNC int m_who(aClient *cptr, aClient *sptr, int parc, char *parv[])
 {
-       static char *who_help[] = {
-               "/WHO [+|-][acghmnsuCM] [args]",
-               "Flags are specified like channel modes, the flags cgmnsu all have arguments",
-               "Flags are set to a positive check by +, a negative check by -",
-               "The flags work as follows:",
-               "Flag a: user is away",
-               "Flag c <channel>: user is on <channel>,",
-               "                  no wildcards accepted",
-               "Flag g <gcos/realname>: user has string <gcos> in their GCOS,",
-               "                        wildcards accepted, oper only",
-               "Flag h <host>: user has string <host> in their hostname,",
-               "               wildcards accepted",
-               "Flag m <usermodes>: user has <usermodes> set on them,",
-               "                    only o/A/a for nonopers",
-               "Flag n <nick>: user has string <nick> in their nickname,",
-               "               wildcards accepted",
-               "Flag s <server>: user is on server <server>,",
-               "                 wildcards not accepted",
-               "Flag u <user>: user has string <user> in their username,",
-               "               wildcards accepted",
-               "Behavior flags:",
-               "Flag C: show first visible channel user is in",
-               "Flag M: check for user in channels I am a member of",
-               NULL
-       };
-       char *flags, change = 1, *s;
-       int  args = 1, i;
-       aClient *srvpptr = NULL;        
-       memset((char *)&wsopts, '\0', sizeof(SOpts));
-       /*
-        * if we got no extra arguments, send them the help. yeech. 
-        */
-       /*
-        * if it's /who ?, send them the help 
-        */
-       if (parc < 1 || parv[0][0] == '?') {
-               char **ptr = who_help;
-               for (; *ptr; ptr++)
-                       sendto_one(sptr, getreply(RPL_LISTSYNTAX), me.name,
-                           sptr->name, *ptr);
-               sendto_one(sptr, getreply(RPL_ENDOFWHO), me.name, sptr->name,
-                   "?");
-               return 0;
-       }
-       /*
-        * backwards compatibility 
-        */
-       else if (parv[0][0] == '0' && parv[0][1] == 0) {
-               if (parc > 1 && *parv[1] == 'o') {
-                       wsopts.check_umode = 1;
-                       wsopts.umode_plus = 1;
-                       wsopts.umodes = UMODE_OPER;
-               }
-               wsopts.host_plus = 1;
-               wsopts.host = "*";
-               return 1;
-       }
-       /*
-        * if the first argument isn't a list of stuff 
-        */
-       else if (parv[0][0] != '+' && parv[0][0] != '-') {
-               if (parv[0][0] == '#') {
-                       wsopts.channel = find_channel(parv[0], NullChn);
-                       if (wsopts.channel == NULL) {
-                               sendto_one(sptr, getreply(ERR_NOSUCHCHANNEL),
-                                   me.name, sptr->name, parv[0]);
-                               return 0;
-                       }
-               } else {
-                       /*
-                        * If the arguement has a . in it, treat it as an
-                        * * address. Otherwise treat it as a nick. -Rak 
-                        */
-                       if (strchr(parv[0], '.')) {
-                               wsopts.host_plus = 1;
-                               wsopts.host = parv[0];
-                       } else {
-                               wsopts.nick_plus = 1;
-                               wsopts.nick = parv[0];
-                       }
-               }
-               return 1;
-       }
-       /*
-        * now walk the list (a lot like set_mode) and set arguments
-        * * as appropriate. 
-        */
-       flags = parv[0];
-       while (*flags) {
-               switch (*flags) {
-                 case '+':
-                 case '-':
-                         change = (*flags == '+' ? 1 : 0);
-                         break;
-                 case 'a':
-                         if (change)
-                                 wsopts.away_plus = 1; /* they want here people */
-                         else
-                                 wsopts.away_plus = 0;
-                         wsopts.check_away = 1;
-                         break;
-                 case 'C':
-                         wsopts.show_chan = change;
-                         break;
-                 case 'M':
-                         wsopts.search_chan = change;
-                         break;
-                 case 'c':
-                         if (parv[args] == NULL || !change) {
-                                 sendto_one(sptr, getreply(ERR_WHOSYNTAX),
-                                     me.name, sptr->name);
-                                 return 0;
-                         }
-                         wsopts.channel = find_channel(parv[args], NullChn);
-                         if (wsopts.channel == NULL) {
-                                 sendto_one(sptr, getreply(ERR_NOSUCHCHANNEL),
-                                     me.name, sptr->name, parv[args]);
-                                 return 0;
-                         }
-                         wsopts.chan_plus = change;
-                         args++;
-                         break;
-                 case 'g':
-                         if (parv[args] == NULL || !IsAnOper(sptr)) {
-                                 sendto_one(sptr, getreply(ERR_WHOSYNTAX),
-                                     me.name, sptr->name);
-                                 return 0;
-                         }
-                         wsopts.gcos = parv[args];
-                         wsopts.gcos_plus = change;
-                         args++;
-                         break;
-                 case 'h':
-                         if (parv[args] == NULL) {
-                                 sendto_one(sptr, getreply(ERR_WHOSYNTAX),
-                                     me.name, sptr->name);
-                                 return 0;
-                         }
-                         wsopts.host = parv[args];
-                         wsopts.host_plus = change;
-                         args++;
-                         break;
-                 case 'm':
-                         if (parv[args] == NULL) {
-                                 sendto_one(sptr, getreply(ERR_WHOSYNTAX),
-                                     me.name, sptr->name);
-                                 return 0;
-                         }
-                         s = parv[args];
-                         while (*s) {
-                                 for (i = 0; i <= Usermode_highest; i++) {
-                                         if (*s == Usermode_Table[i].flag) {
-                                                 wsopts.umodes |=
-                                                    Usermode_Table[i].mode;
-                                                 break;
-                                         }
-                                 }
-                                 s++;
-                         }
-                         if (!IsAnOper(sptr))  /* only let users search for +/-oOaA */
-                                 wsopts.umodes =
-                                     (wsopts.
-                                     umodes & (UMODE_OPER | UMODE_LOCOP | UMODE_SADMIN |
-                                     UMODE_ADMIN));
-                         wsopts.umode_plus = change;
-                         if (wsopts.umodes)
-                                 wsopts.check_umode = 1;
-                         args++;
-                         break;
-                 case 'n':
-                         if (parv[args] == NULL) {
-                                 sendto_one(sptr, getreply(ERR_WHOSYNTAX),
-                                     me.name, sptr->name);
-                                 return 0;
-                         }
-                         wsopts.nick = parv[args];
-                         wsopts.nick_plus = change;
-                         args++;
-                         break;
-                 case 's':
-                         
-                         if (parv[args] == NULL || !change) {
-                                 sendto_one(sptr, getreply(ERR_WHOSYNTAX),
-                                     me.name, sptr->name);
-                                 return 0;
-                         }
-                         srvpptr = find_server(parv[args], NULL);
-                         if (srvpptr == NULL) {
-                                 sendto_one(sptr, getreply(ERR_NOSUCHSERVER),
-                                     me.name, sptr->name, parv[args]);
-                                 return 0;
-                         }
-                         wsopts.server = find_or_add(srvpptr->name);
-                         wsopts.serv_plus = change;
-                         args++;
-                         break;
-                 case 'u':
-                         if (parv[args] == NULL) {
-                                 sendto_one(sptr, getreply(ERR_WHOSYNTAX),
-                                     me.name, sptr->name);
-                                 return 0;
-                         }
-                         wsopts.user = parv[args];
-                         wsopts.user_plus = change;
-                         args++;
-                         break;
-               }
-               flags++;
-       }
-
-       /*
-        * if we specified search_chan, we _must_ specify something useful to go with it.
-        * * specifying a channel makes no sense, and no params make no sense either, as does
-        * * specifying a nick. 
-        */
-
-       if (wsopts.search_chan && !(wsopts.check_away || wsopts.gcos
-           || wsopts.host || wsopts.check_umode || wsopts.server
-           || wsopts.user)) {
-               if (parv[args] == NULL || wsopts.channel || wsopts.nick
-                   || parv[args][0] == '#' || parv[args][0] == '&') {
-                       sendto_one(sptr, getreply(ERR_WHOSYNTAX), me.name,
-                           sptr->name);
-                       return 0;
-               }
-
-               if (strchr(parv[args], '.')) {
-                       wsopts.host_plus = 1;
-                       wsopts.host = parv[args];
-               } else {
-                       sendto_one(sptr, getreply(ERR_WHOSYNTAX), me.name,
-                           sptr->name);
-                       return 0;
-               }
-       } else /* can't show_chan if nothing else is set! */ if (wsopts.
-    show_chan && !(wsopts.check_away || wsopts.gcos || wsopts.host
-    || wsopts.check_umode ||
-           wsopts.server || wsopts.user || wsopts.nick || wsopts.channel)) {
-               if (parv[args] == NULL) {
-                       sendto_one(sptr, getreply(ERR_WHOSYNTAX), me.name,
-                           sptr->name);
-                       return 0;
-               }
-
-               if (strchr(parv[args], '.')) {
-                       wsopts.host_plus = 1;
-                       wsopts.host = parv[args];
-               } else {
-                       wsopts.nick_plus = 1;
-                       wsopts.nick = parv[args];
-               }
+  aClient *target_client;
+  aChannel *target_channel;
+  int opers_only = 0;
+  char *mask = parv[1];
+  char star[] = "*";
+  int i = 0;
+
+  who_flags = 0;
+  memset(&wfl, 0, sizeof(wfl));
+
+  if (parc > 1)
+    {
+      i = parse_who_options(sptr, parc - 1, parv + 1);
+      if (i < 0)
+       {
+         sendto_one(sptr, getreply(RPL_ENDOFWHO), me.name, parv[0],
+                    mask);
+         return 0;
        }
+    }
+
+  if (parc-i < 2 || strcmp(parv[1 + i], "0") == 0)
+    mask = star;
+  else
+    mask = parv[1 + i];
+
+  if (!i && parc > 2 && *parv[2] == 'o')
+    who_flags |= WF_OPERONLY;
+
+  collapse(mask);
+
+  if (*mask == '\0')
+    {
+      /* no mask given */
+      sendto_one(sptr, getreply(RPL_ENDOFWHO), me.name, parv[0], "*");
+      return 0;
+    }
+
+
+  if ((target_channel = find_channel(mask, NULL)) != NULL)
+    {
+      do_channel_who(sptr, target_channel, mask);
+      sendto_one(sptr, getreply(RPL_ENDOFWHO), me.name, parv[0], mask);
+      return 0;
+    }
+  else
+    {
+      do_other_who(sptr, mask);
+      sendto_one(sptr, getreply(RPL_ENDOFWHO), me.name, parv[0], mask);
+      return 0;
+    }
+
+  return 0;
+}
 
-
-       /*
-        * hey cool, it all worked! 
-        */
-       return 1;
+static void who_sendhelp(aClient *sptr)
+{
+  char *who_help[] = {
+    "/WHO [+|-][acghmnsuCM] [args]",
+    "Flags are specified like channel modes, the flags cgmnsu all have arguments",
+    "Flags are set to a positive check by +, a negative check by -",
+    "The flags work as follows:",
+    "Flag a: user is away",
+    "Flag c <channel>: user is on <channel>,",
+    "                  no wildcards accepted",
+    "Flag g <gcos/realname>: user has string <gcos> in their GCOS,",
+    "                        wildcards accepted, oper only",
+    "Flag h <host>: user has string <host> in their hostname,",
+    "               wildcards accepted",
+    "Flag m <usermodes>: user has <usermodes> set on them,",
+    "                    only o/A/a for nonopers",
+    "Flag n <nick>: user has string <nick> in their nickname,",
+    "               wildcards accepted",
+    "Flag s <server>: user is on server <server>,",
+    "                 wildcards not accepted",
+    "Flag u <user>: user has string <user> in their username,",
+    "               wildcards accepted",
+    "Behavior flags:",
+    "Flag M: check for user in channels I am a member of",
+    "Flag R: show users' real hostnames (oper only.)",
+    NULL
+  };
+  char **s;
+
+  for (s = who_help; *s; s++)
+    sendto_one(sptr, getreply(RPL_LISTSYNTAX), me.name, sptr->name, *s);
 }
 
-/* these four are used by chk_who to check gcos/nick/user/host
- * respectively */
-int  (*gchkfn) (char *, char *);
-int  (*nchkfn) (char *, char *);
-int  (*uchkfn) (char *, char *);
-int  (*hchkfn) (char *, char *);
-int  (*ichkfn) (char *, char *);
+#define WHO_ADD 1
+#define WHO_DEL 2
 
-int chk_who(aClient *from, aClient *ac, int showall)
+static int parse_who_options(aClient *sptr, int argc, char **argv)
 {
-       if (!IsPerson(ac))
-               return 0;
-       if (IsInvisible(ac) && !showall)
-               return 0;
-       if (wsopts.check_umode)
-               if ((wsopts.umode_plus
-                   && !((ac->umodes & wsopts.umodes) == wsopts.umodes))
-                   || (!wsopts.umode_plus
-                   && ((ac->umodes & wsopts.umodes) == wsopts.umodes)))
-                       return 0;
-       if (wsopts.check_away)
-               if ((wsopts.away_plus && ac->user->away == NULL) ||
-                   (!wsopts.away_plus && ac->user->away != NULL))
-                       return 0;
-       /*
-        * while this is wasteful now, in the future
-        * * when clients contain pointers to their servers
-        * * of origin, this'll become a 4 byte check instead of a mycmp
-        * * -wd 
-        */
-       /*
-        * welcome to the future... :) - lucas 
-        */
-       if (wsopts.serv_plus)
-               if (wsopts.server != ac->user->server)
-                       return 0;
-       /*
-        * we only call match once, since if the first condition
-        * * isn't true, most (all?) compilers will never try the
-        * * second...phew :) 
-        */
-       if (wsopts.user != NULL)
-               if ((wsopts.user_plus
-                   && uchkfn(wsopts.user, ac->user->username))
-                   || (!wsopts.user_plus
-                   && !uchkfn(wsopts.user, ac->user->username)))
-                       return 0;
-
-       if (wsopts.nick != NULL)
-               if ((wsopts.nick_plus && nchkfn(wsopts.nick, ac->name)) ||
-                   (!wsopts.nick_plus && !nchkfn(wsopts.nick, ac->name)))
-                       return 0;
-
-       if (!IsOper(from))
+  char *s = argv[0];
+  int what;
+  int i = 1;
+
+  if (*s != '-' && *s != '+')
+    return 0;
+
+  while (*s)
+    {
+      switch (*s)
        {
-               if (wsopts.host != NULL)
-                       if ((wsopts.host_plus && hchkfn(wsopts.host, IsHidden(ac) ? ac->user->virthost : ac->user->realhost)) ||
-                           (!wsopts.host_plus && !hchkfn(wsopts.host, IsHidden(ac) ? ac->user->virthost : ac->user->realhost)))
-                               return 0;
+       case '+':
+         what = WHO_ADD;
+         break;
+
+       case '-':
+         what = WHO_DEL;
+         break;
+
+       case 'a':
+         if (what == WHO_ADD)
+           wfl.want_away = WHO_WANT;
+         else
+           wfl.want_away = WHO_DONTWANT;
+         break;
+
+       case 'c':
+         if (i >= argc)
+           {
+             who_sendhelp(sptr);
+             return -1;
+           }
+
+         wfl.channel = argv[i];
+
+         if (what == WHO_ADD)
+           wfl.want_channel = WHO_WANT;
+         else
+           wfl.want_channel = WHO_DONTWANT;
+
+         i++;
+         break;
+         
+       case 'g':
+         if (i >= argc)
+           {
+             who_sendhelp(sptr);
+             return -1;
+           }
+         
+         if (!IsAnOper(sptr))
+           continue; /* oper-only */
+
+         wfl.gecos = argv[i];
+         if (what == WHO_ADD)
+           wfl.want_gecos = WHO_WANT;
+         else
+           wfl.want_gecos = WHO_DONTWANT;
+
+         i++;
+         break;
+
+       case 's':
+         if (i >= argc)
+           {
+             who_sendhelp(sptr);
+             return -1;
+           }
+
+         wfl.server = argv[i];
+         if (what == WHO_ADD)
+           wfl.want_server = WHO_WANT;
+         else
+           wfl.want_server = WHO_DONTWANT;
+
+         i++;
+         break;
+
+       case 'h':
+         if (i >= argc)
+           {
+             who_sendhelp(sptr);
+             return -1;
+           }
+
+         wfl.host = argv[i];
+         if (what == WHO_ADD)
+           wfl.want_host = WHO_WANT;
+         else
+           wfl.want_host = WHO_DONTWANT;
+
+         i++;
+         break;
+
+       case 'n':
+         if (i >= argc)
+           {
+             who_sendhelp(sptr);
+             return -1;
+           }
+
+         wfl.nick = argv[i];
+         if (what == WHO_ADD)
+           wfl.want_nick = WHO_WANT;
+         else
+           wfl.want_nick = WHO_DONTWANT;
+
+         i++;
+         break;
+
+       case 'u':
+         if (i >= argc)
+           {
+             who_sendhelp(sptr);
+             return -1;
+           }
+
+         wfl.user = argv[i];
+         if (what == WHO_ADD)
+           wfl.want_user = WHO_WANT;
+         else
+           wfl.want_user = WHO_DONTWANT;
+
+         i++;
+         break;
+
+       case 'm':
+         if (i >= argc)
+           {
+             who_sendhelp(sptr);
+             return -1;
+           }
+
+         {
+           char *s = argv[i];
+           int *umodes;
+
+           if (what == WHO_ADD)
+             umodes = &wfl.umodes_want;
+           else
+             umodes = &wfl.umodes_dontwant;
+
+           while (*s)
+             {
+               int i;
+
+               for (i = 0; i <= Usermode_highest; i++) 
+                 {
+                   if (*s == Usermode_Table[i].flag)
+                     {
+                       *umodes |= Usermode_Table[i].mode;
+                       break;
+                     }
+                 }
+               s++;
+             }
+
+           if (!IsAnOper(sptr))
+             *umodes = *umodes & (UMODE_OPER | UMODE_LOCOP | UMODE_SADMIN |
+                                  UMODE_ADMIN);
+         }
+
+         i++;
+         break;
+
+       case 'M':
+         if (what == WHO_ADD)
+           wfl.common_channels_only = 1;
+         else
+           wfl.common_channels_only = 0;
+         break;
+
+       case 'R':
+         if (!IsAnOper(sptr))
+           break;
+
+         if (what == WHO_ADD)
+           who_flags |= WF_REALHOST;
+         else
+           who_flags &= ~WF_REALHOST;
+
+         break;
+
+       default:
+         who_sendhelp(sptr);
+         return -1;
        }
+      s++;
+    }
+
+  return i;
+}
+
+static int can_see(aClient *sptr, aClient *acptr, aChannel *channel)
+{
+  int ret = 0;
+
+  do {
+    /* can only see people */
+    if (!IsPerson(acptr))
+      return WHO_CANTSEE;
+
+    /* can only see opers if thats what they want */
+    if (who_flags & WF_OPERONLY)
+      {
+       if (!IsAnOper(acptr))
+         return ret | WHO_CANTSEE;
+
+       if (IsHideOper(acptr))
+         if (IsAnOper(sptr))
+           ret |= WHO_OPERSEE;
+         else
+           return ret | WHO_CANTSEE;
+      }
+
+    /* if they only want people who are away */
+    if ((wfl.want_away == WHO_WANT && !acptr->user->away) ||
+       wfl.want_away == WHO_DONTWANT && acptr->user->away)
+      return WHO_CANTSEE;
+
+    /* if they only want people on a certain channel. */
+    if (wfl.want_channel != WHO_DONTCARE)
+      {
+       aChannel *chan = find_channel(wfl.channel, NULL);
+
+       if (!chan && wfl.want_channel == WHO_WANT)
+         return WHO_CANTSEE;
+
+       if ((wfl.want_channel == WHO_WANT) &&
+           !IsMember(acptr, chan))
+         return WHO_CANTSEE;
+
+       if ((wfl.want_channel == WHO_DONTWANT) &&
+           IsMember(acptr, chan))
+         return WHO_CANTSEE;
+      }
+
+    /* if they only want people with a certain gecos */
+    if (wfl.want_gecos != WHO_DONTCARE)
+      {
+       if (((wfl.want_gecos == WHO_WANT) && match(wfl.gecos, acptr->info)) ||
+           ((wfl.want_gecos == WHO_DONTWANT) && !match(wfl.gecos, acptr->info)))
+         {
+           return WHO_CANTSEE;
+         }
+      }
+
+    /* if they only want people with a certain server */
+    if (wfl.want_server != WHO_DONTCARE)
+      {
+       if (((wfl.want_server == WHO_WANT) && strcmp(wfl.server, acptr->user->server)) ||
+           ((wfl.want_server == WHO_DONTWANT) && !strcmp(wfl.server, acptr->user->server)))
+         {
+           return WHO_CANTSEE;
+         }
+      }
+
+    /* if they only want people with a certain host */
+    if (wfl.want_host != WHO_DONTCARE)
+      {
+       char *host;
+
+       if (IsAnOper(sptr))
+         host = acptr->user->realhost;
        else
-       {
-               if (wsopts.host != NULL)
-                       if ((wsopts.host_plus && hchkfn(wsopts.host, ac->user->realhost)) ||
-                           (!wsopts.host_plus && !hchkfn(wsopts.host, ac->user->realhost)))
-                               return 0;
-       }
+         {
+           if (IsHidden(sptr))
+             host = acptr->user->virthost;
+           else
+             host = acptr->user->realhost;
+         }
+
+       if (((wfl.want_host == WHO_WANT) && match(wfl.host, host)) ||
+           ((wfl.want_host == WHO_DONTWANT) && !match(wfl.host, host)))
+         {
+           return WHO_CANTSEE;
+         }
+      }
+
+    /* if they only want people with a certain nick.. */
+    if (wfl.want_nick != WHO_DONTCARE)
+      {
+       if (((wfl.want_nick == WHO_WANT) && match(wfl.nick, acptr->name)) ||
+           ((wfl.want_nick == WHO_DONTWANT) && !match(wfl.nick, acptr->name)))
+         {
+           return WHO_CANTSEE;
+         }
+      }
+
+    /* if they only want people with a certain username */
+    if (wfl.want_user != WHO_DONTCARE)
+      {
+       if (((wfl.want_user == WHO_WANT) && match(wfl.user, acptr->user->username)) ||
+           ((wfl.want_user == WHO_DONTWANT) && !match(wfl.user, acptr->user->username)))
+         {
+           return WHO_CANTSEE;
+         }
+      }
+
+    /* if they only want people with a certain umode */
+    if (wfl.umodes_want)
+      {
+       if (!(acptr->umodes & wfl.umodes_want))
+         return WHO_CANTSEE;
+      }
+
+    if (wfl.umodes_dontwant)
+      {
+       if (acptr->umodes & wfl.umodes_dontwant)
+         return WHO_CANTSEE;
+      }
+
+    /* if they only want common channels */
+    if (wfl.common_channels_only)
+      {
+       if (!has_common_channels(sptr, acptr))
+         return WHO_CANTSEE;
+      }
+
+    if (channel)
+      {
+       int member = who_flags & WF_ONCHANNEL;
+
+       if (SecretChannel(channel) ||
+           HiddenChannel(channel))
+         {
+           /* if they aren't on it.. they can't see it */
+           if (!(who_flags & WF_ONCHANNEL))
+             break;
+         }
+
+       if (IsHiding(acptr))
+         /* if they're +I .. only show them if the other person is an oper */
+         break;
+
+       if (IsInvisible(acptr) && !member)
+         break;
+
+       if ((channel->mode.mode & MODE_AUDITORIUM) &&
+           !is_chan_op(acptr, channel) &&
+           !is_chan_op(sptr, channel))
+         break;
+      }
+    else
+      {
+       /* a user/mask who */
+       
+       if (IsInvisible(acptr))
+         {
+           /* don't show them unless it's an exact match */
+           if ((who_flags & WF_WILDCARD))
+             break;
+         }
+      }
+
+    /* phew.. show them. */
+    return WHO_CANSEE;
+  } while (0);
+
+  /* if we get here, it's oper-dependant. */
+  if (IsAnOper(sptr))
+    return ret | WHO_OPERSEE | WHO_CANSEE;
+  else
+    if (sptr == acptr)
+      return ret | WHO_CANSEE;
+    else
+      return ret | WHO_CANTSEE;
+}
 
-       if (wsopts.gcos != NULL)
-               if ((wsopts.gcos_plus && gchkfn(wsopts.gcos, ac->info)) ||
-                   (!wsopts.gcos_plus && !gchkfn(wsopts.gcos, ac->info)))
-                       return 0;
-       return 1;
+static void do_channel_who(aClient *sptr, aChannel *channel, char *mask)
+{
+  Member *cm = channel->members;
+  
+  if (IsMember(sptr, channel))
+    who_flags |= WF_ONCHANNEL;
+
+  for (cm = channel->members; cm; cm = cm->next)
+    {
+      aClient *acptr = cm->cptr;
+      char status[20];
+
+      int cansee;
+
+      if ((cansee = can_see(sptr, acptr, channel)) & WHO_CANTSEE)
+       continue;
+
+      make_who_status(sptr, acptr, channel, cm, status, cansee);
+      send_who_reply(sptr, acptr, channel->chname, status, "");
+    }
+
+  return;
 }
 
-inline char *first_visible_channel(aClient *cptr, aClient *sptr)
+static void make_who_status(aClient *sptr, aClient *acptr, aChannel *channel, 
+                           Member *cm, char *status, int cansee)
 {
-       Membership *lp;
-       int  secret = 0;
-       aChannel *chptr = NULL;
-       static char chnbuf[CHANNELLEN + 2];
-
-       if (IsHiding(cptr))
-               return ("*");
-       if (cptr->user->channel) {
-               if (IsAdmin(sptr)) {
-                       chptr = cptr->user->channel->chptr;
-                       if (!(ShowChannel(sptr, chptr)))
-                               secret = 1;
-               } else {
-                       for (lp = cptr->user->channel; lp; lp = lp->next) {
-                               if (ShowChannel(sptr, lp->chptr))
-                                       break;
-                       }
-                       if (lp)
-                               chptr = lp->chptr;
-               }
-
-               if (chptr) {
-                       if (!secret)
-                               return chptr->chname;
-                       ircsprintf(chnbuf, "%%%s", chptr->chname);
-                       return chnbuf;
-               }
-       }
-       return "*";
+  int i = 0;
+
+  if (acptr->user->away)
+    status[i++] = 'G';
+  else
+    status[i++] = 'H';
+  
+  if (IsARegNick(acptr))
+    status[i++] = 'r';
+
+  if (IsAnOper(acptr) &&
+      (!IsHideOper(acptr) || sptr == acptr || IsAnOper(sptr)))
+    status[i++] = '*';
+  
+  if (IsAnOper(acptr) &&
+      (IsHideOper(acptr) && sptr != acptr && IsAnOper(sptr)))
+    status[i++] = '!';
+  
+  if (cansee & WHO_OPERSEE)
+    status[i++] = '&';
+
+  if (cm)
+    {
+      if (cm->flags & CHFL_CHANOP)
+       status[i++] = '@';
+      else if (cm->flags & CHFL_HALFOP)
+       status[i++] = '%';
+      else if (cm->flags & CHFL_VOICE)
+       status[i++] = '+';
+    }
+
+  status[i] = '\0';
 }
 
-/* allow lusers only 200 replies from /who */
-#define MAXWHOREPLIES 200
-#define WHO_HOPCOUNT(s, a) ((IsULine((a)) && !IsOper((s))) ? 0 : a->hopcount)
-DLLFUNC int m_who(aClient *cptr, aClient *sptr, int parc, char *parv[])
+static void do_other_who(aClient *sptr, char *mask)
 {
-       aClient *ac;
-       Member *cm;
-       Membership *lp;
-       int  shown = 0, i = 0, showall = IsAnOper(sptr);
-       char status[10];
+  /* wildcard? */
+  if (strchr(mask, '*') || strchr(mask, '?'))
+    {
+      /* go through all users.. */
+      aClient *acptr;
 
-       /*
-        * drop nonlocal clients 
-        */
-       if (!MyClient(sptr))
-               return 0;
+      who_flags |= WF_WILDCARD;
 
-       if (!build_searchopts(sptr, parc - 1, parv + 1))
-               return 0;       /* /who was no good */
+      for (acptr = client; acptr; acptr = acptr->next)
+       {
+         int cansee;
+         char status[20];
+         char *channel;
+         int flg;
+
+         if (match(mask, acptr->name))
+           continue;
+
+         if ((cansee = can_see(sptr, acptr, NULL)) & WHO_CANTSEE)
+           continue;
+
+         channel = first_visible_channel(sptr, acptr, &flg);
+         make_who_status(sptr, acptr, NULL, NULL, status, cansee);
+         send_who_reply(sptr, acptr, channel, status, (flg & FVC_HIDDEN) ? "~" : "");
+       }         
+    }
+  else
+    {
+      /* just a single client */
+      aClient *acptr = find_client(mask, NULL);
+      int cansee;
+      char status[20];
+      char *channel;
+      int flg;
+
+      if (!acptr)
+       return;
+
+      if ((cansee = can_see(sptr, acptr, NULL)) == WHO_CANTSEE)
+       return;
+      
+      channel = first_visible_channel(sptr, acptr, &flg);
+      make_who_status(sptr, acptr, NULL, NULL, status, cansee);
+      send_who_reply(sptr, acptr, channel, status, (flg & FVC_HIDDEN) ? "~" : "");
+    }
+
+  return;
+}
 
-       if (wsopts.gcos != NULL && (strchr(wsopts.gcos, '?')) == NULL &&
-           (strchr(wsopts.gcos, '*')) == NULL)
-               gchkfn = smycmp;
-       else
-               gchkfn = match;
-       if (wsopts.nick != NULL && (strchr(wsopts.nick, '?')) == NULL &&
-           (strchr(wsopts.nick, '*')) == NULL)
-               nchkfn = smycmp;
-       else
-               nchkfn = match;
-       if (wsopts.user != NULL && (strchr(wsopts.user, '?')) == NULL &&
-           (strchr(wsopts.user, '*')) == NULL)
-               uchkfn = smycmp;
-       else
-               uchkfn = match;
-       if (wsopts.host != NULL && (strchr(wsopts.host, '?')) == NULL &&
-           (strchr(wsopts.host, '*')) == NULL)
-               hchkfn = smycmp;
-       else
-               hchkfn = match;
-
-       if (wsopts.channel != NULL) {
-               if (IsMember(sptr, wsopts.channel))
-                       showall = 1;
-               else if (SecretChannel(wsopts.channel) && IsAdmin(sptr))
-                       showall = 1;
-               else if (!SecretChannel(wsopts.channel) && IsAnOper(sptr))
-                       showall = 1;
-               else
-                       showall = 0;
-               if (showall || !SecretChannel(wsopts.channel)) {
-                       for (cm = wsopts.channel->members; cm; cm = cm->next) {
-                               ac = cm->cptr;
-                               i = 0;
-                               if (!chk_who(sptr, ac, showall))
-                                       continue;
-                               if (IsHiding(ac) && !IsNetAdmin(sptr))
-                                       continue;
-                                
-                               /*
-                                * get rid of the pidly stuff first 
-                                */
-                               /*
-                                * wow, they passed it all, give them the reply...
-                                * * IF they haven't reached the max, or they're an oper 
-                                */
-                               status[i++] =
-                                   (ac->user->away ? 'G' : 'H');
-                               if (IsARegNick(ac))
-                                       status[i++] = 'r';
-                               if (IsAnOper(ac) && (!IsHideOper(ac) || sptr == ac || IsAnOper(sptr)))
-                                       status[i++] = '*';
-                               else if (IsInvisible(ac) && sptr != ac && IsAnOper(sptr))
-                                       status[i++] = '%';
-                               if (cm->flags & CHFL_CHANOP)
-                                       status[i++] = '@';
-                               else if (cm->flags & CHFL_VOICE)
-                                       i++;                            
-                               status[i] = 0;
-                               sendto_one(sptr, getreply(RPL_WHOREPLY),
-                                   me.name, sptr->name, wsopts.channel->chname,
-                                   ac->user->username, 
-                                   IsHidden(ac) ? ac->user->virthost :
-                                   ac->user->realhost,
-                                   ac->user->server, ac->name, status,
-                                   WHO_HOPCOUNT(sptr, ac), ac->info);
-                       }
-               }
-               sendto_one(sptr, getreply(RPL_ENDOFWHO), me.name, sptr->name,
-                   wsopts.channel->chname);
-               return 0;
-       }
-       /*
-        * if (for whatever reason) they gave us a nick with no
-        * * wildcards, just do a find_person, bewm! 
-        */
-       else if (nchkfn == smycmp) {
-               ac = find_person(wsopts.nick, NULL);
-               if (ac != NULL) {
-                       if (!chk_who(sptr, ac, 1)) {
-                               sendto_one(sptr, getreply(RPL_ENDOFWHO),
-                                   me.name, sptr->name,
-                                   wsopts.host !=
-                                   NULL ? wsopts.host : wsopts.nick);
-                               return 0;
-                       } else {
-                               i = 0;
-                               status[i++] =
-                                   (ac->user->away ? 'G' : 'H');
-                               if (IsARegNick(ac))
-                                       status[i++] = 'r';
-                               if (IsAnOper(ac) && (!IsHideOper(ac) || sptr == ac || IsAnOper(sptr)))
-                                       status[i++] = '*';
-                               else if (IsInvisible(ac) && sptr != ac && IsAnOper(sptr))
-                                       status[i++] = '%';
-                               status[i] = 0;
-                               sendto_one(sptr, getreply(RPL_WHOREPLY),
-                                   me.name, sptr->name,
-                                   wsopts.show_chan ? first_visible_channel(ac,
-                                   sptr) : "*", ac->user->username,
-                                   IsHidden(ac) ? ac->user->virthost :
-                                   ac->user->realhost,
-   
-                                    ac->user->server, ac->name,
-                                   status, WHO_HOPCOUNT(sptr, ac), ac->info);
-                               sendto_one(sptr, getreply(RPL_ENDOFWHO),
-                                   me.name, sptr->name,
-                                   wsopts.host !=
-                                   NULL ? wsopts.host : wsopts.nick);
-                               return 0;
-                       }
-               }
-               sendto_one(sptr, getreply(RPL_ENDOFWHO), me.name, sptr->name,
-                   wsopts.host != NULL ? wsopts.host : wsopts.nick);
-               return 0;
-       }
-       /*
-        * if HTM, drop this too 
-        */
-       if (lifesux && !IsAnOper(sptr)) {
-               sendto_one(sptr, rpl_str(ERR_HTMDISABLED), me.name, sptr->name, "WHO");
-               return 0;
-       }
+static void send_who_reply(aClient *sptr, aClient *acptr, 
+                          char *channel, char *status, char *xstat)
+{
+  char *stat;
+
+  stat = malloc(strlen(status) + strlen(xstat) + 1);
+
+  sprintf(stat, "%s%s", status, xstat);
+
+  sendto_one(sptr, getreply(RPL_WHOREPLY), me.name, sptr->name,      
+            channel,       /* channel name */
+            acptr->user->username, /* user name */
+            (IsHidden(acptr) && !(who_flags & WF_REALHOST)) ?
+            acptr->user->virthost :
+            acptr->user->realhost, /* hostname */
+            acptr->user->server,   /* server name */
+            acptr->name,           /* nick */
+            stat,                  /* status */
+            acptr->hopcount,        /* hops */ 
+            acptr->info            /* realname */
+            );
+  free(stat);
+}
+
+static char *first_visible_channel(aClient *sptr, aClient *acptr, int *flg)
+{
+  aChannel *chptr;
+  Membership *lp;
+  static char chbuf[CHANNELLEN + 2];
+
+  *flg = 0;
+
+  /* this is a bit cack, but it seems the only way
+     (and is the current behaviour) since +I is not channel-specific */
+  if (IsHiding(acptr))
+    return "*";
 
-       if (wsopts.search_chan) {
-               for (lp = sptr->user->channel; lp; lp = lp->next) {
-                       for (cm = lp->chptr->members; cm; cm = cm->next) {
-                               ac = cm->cptr;
-                               if (!chk_who(sptr, ac, 1))
-                                       continue;
-                               if ((lp->chptr->mode.mode & MODE_AUDITORIUM) && !((cm->flags & CHFL_CHANOP)))
-                                       continue;
-                               if (shown == MAXWHOREPLIES && !IsAnOper(sptr)) {
-                                       sendto_one(sptr,
-                                           getreply(ERR_WHOLIMEXCEED), me.name,
-                                           sptr->name, MAXWHOREPLIES);
-                                       break;
-                               }
-                               
-                               i = 0;
-                               status[i++] =
-                                   (ac->user->away ? 'G' : 'H');
-                               if (IsARegNick(ac))
-                                       status[i++] = 'r';
-                               if (IsAnOper(ac) && (!IsHideOper(ac) || sptr == ac || IsAnOper(sptr)))
-                                       status[i++] = '*';
-                               else if (IsInvisible(ac) && sptr != ac && IsAnOper(sptr))
-                                       status[i++] = '%';
-                               if (cm->flags & CHFL_CHANOP)
-                                       status[i++] = '@';
-                               else if (cm->flags & CHFL_VOICE)
-                                       i++;                            
-                               status[i] = 0;
-                               sendto_one(sptr, getreply(RPL_WHOREPLY),
-                                   me.name, sptr->name,
-                                   lp->chptr->chname, ac->user->username,
-                                   IsHidden(ac) ? ac->user->virthost :
-                                   ac->user->realhost,
-                                    ac->user->server, ac->name,
-                                   status, WHO_HOPCOUNT(sptr, ac), ac->info);
-                               shown++;
-                       }
-               }
-       } else {
-               for (ac = client; ac; ac = ac->next) {
-                       if (!chk_who(sptr, ac, showall))
-                               continue;
-                       /*
-                        * wow, they passed it all, give them the reply...
-                        * * IF they haven't reached the max, or they're an oper 
-                        */
-                       if (shown == MAXWHOREPLIES && !IsAnOper(sptr)) {
-                               sendto_one(sptr, getreply(ERR_WHOLIMEXCEED),
-                                   me.name, sptr->name, MAXWHOREPLIES);
-                               break;  /* break out of loop so we can send end of who */
-                       }
-                       i = 0;
-                       status[i++] =
-                           (ac->user->away ? 'G' : 'H');
-                       if (IsARegNick(ac))
-                               status[i++] = 'r';
-                       if (IsAnOper(ac) && (!IsHideOper(ac) || sptr == ac || IsAnOper(sptr)))
-                               status[i++] = '*';
-                       else if (IsInvisible(ac) && sptr != ac && IsAnOper(sptr))
-                               status[i++] = '%';
-                       status[i] = 0;
-                       sendto_one(sptr, getreply(RPL_WHOREPLY), me.name,
-                           sptr->name,
-                           wsopts.show_chan ? first_visible_channel(ac,
-                           sptr) : "*", ac->user->username, 
-                           IsHidden(ac) ? ac->user->virthost :
-                                   ac->user->realhost,
-
-                           ac->user->server, ac->name, status,
-                           WHO_HOPCOUNT(sptr, ac), ac->info);
-                       shown++;
-               }
+  for (lp = acptr->user->channel; lp; lp = lp->next)
+    {
+      aChannel *chptr = lp->chptr;
+      int cansee = ShowChannel(sptr, chptr);
+
+      if (!cansee)
+       {
+         if (IsAnOper(sptr))
+           *flg |= FVC_HIDDEN;
+         else
+           continue;
        }
-       sendto_one(sptr, getreply(RPL_ENDOFWHO), me.name, sptr->name,
-           (wsopts.host != NULL ? wsopts.host :
-           (wsopts.nick != NULL ? wsopts.nick :
-           (wsopts.user != NULL ? wsopts.user :
-           (wsopts.gcos != NULL ? wsopts.gcos :
-           (wsopts.server != NULL ? wsopts.server : "*"))))));
-       return 0;
+      
+      return chptr->chname;
+    }
+  /* no channels that they can see */
+
+  return "*";
+}
+
+static int has_common_channels(aClient *c1, aClient *c2)
+{
+  Membership *lp;
+
+  if (!IsAnOper(c1) && IsHiding(c2))
+    return 0;
+
+  for (lp = c1->user->channel; lp; lp = lp->next)
+    {
+      if (IsMember(c2, lp->chptr))
+       return 1;
+    }
+
+  return 0;
 }
index 72a90fa918fe66cc088adb385cb01bee745e2e66..120fd2915c694ea8c8b14f076021ff9fbb6e1cad 100644 (file)
 #include "modules/scan.h"
 /* IRCd will fill with a pointer to this module */
 struct SOCKADDR_IN Scan_endpoint;
+struct IN_ADDR Scan_bind;
 int Scan_BanTime = 0, Scan_TimeOut = 0;
 static Scan_AddrStruct *Scannings = NULL;
 MUTEX Scannings_lock;
+static char    *scan_message;
 
 DLLFUNC int h_scan_connect(aClient *sptr);
 DLLFUNC int    h_config_set_scan(void);
@@ -92,11 +94,13 @@ int    m_scan_Init(ModuleInfo *modinfo)
 #endif
 {
        int id;
+       scan_message = NULL;
        bcopy(modinfo,&ScanModInfo,modinfo->size);
        ScanHost = (Hooktype *)HooktypeAdd(modinfo->handle, "HOOKTYPE_SCAN_HOST", &HOOKTYPE_SCAN_HOST);
        LocConnect = HookAddEx(ScanModInfo.handle, HOOKTYPE_LOCAL_CONNECT, h_scan_connect);
        ConfUnknown = HookAddEx(ScanModInfo.handle, HOOKTYPE_CONFIG_UNKNOWN, h_config_set_scan);
        ServerStats = HookAddEx(ScanModInfo.handle, HOOKTYPE_STATS, h_stats_scan);
+       bzero(&Scan_bind, sizeof(Scan_bind));
        IRCCreateMutex(Scannings_lock);
        return MOD_SUCCESS;
 }
@@ -132,14 +136,14 @@ int    m_scan_Load(int module_load)
                Scan_endpoint.SIN_PORT = htons(conf_listen->port);
                Scan_endpoint.SIN_FAMILY = AFINET;
        }
+       
        if (Scan_BanTime == 0)
                Scan_BanTime = 86400;
 
        if (Scan_TimeOut == 0)
                Scan_TimeOut = 20;
        LockEventSystem();
-       Scannings_clean = EventAddEx(ScanModInfo.handle, "e_scannings_clean", 0, 0, e_scannings_clean,
-NULL);
+       Scannings_clean = EventAddEx(ScanModInfo.handle, "e_scannings_clean", 0, 0, e_scannings_clean, NULL);
        UnlockEventSystem();
        return MOD_SUCCESS;
 }
@@ -177,6 +181,8 @@ int m_scan_Unload(void)
                EventDel(Scannings_clean);
                UnlockEventSystem();
                IRCMutexDestroy(Scannings_lock);
+               if (scan_message)
+                       free(scan_message);
        }
        return ret;
 }
@@ -194,7 +200,7 @@ int Scan_IsBeingChecked(struct IN_ADDR *ia)
        IRCMutexLock(Scannings_lock);
        for (sr = Scannings; sr; sr = sr->next)
        {
-               if (bcmp(&sr->in, ia, sizeof(Scan_AddrStruct)))
+               if (!bcmp(&sr->in, ia, sizeof(Scan_AddrStruct)))
                {
                        ret = 1;
                        break;
@@ -307,7 +313,9 @@ DLLFUNC int h_scan_connect(aClient *sptr)
        
        if (Scan_IsBeingChecked(&sptr->ip))
                return 0;
-       
+       if (scan_message)
+               sendto_one(sptr, ":%s NOTICE %s :%s",
+                       me.name, sptr->name, scan_message);
        sr = MyMalloc(sizeof(Scan_AddrStruct));
        sr->in = sptr->ip;
        sr->refcnt = 0;
@@ -357,46 +365,47 @@ DLLFUNC int       h_config_set_scan(void)
                        {
                                if (!strcmp(ce->ce_varname, "bantime")) {
                                        if (!ce->ce_vardata) {
-                                               config_error("%s:%i: set::scan::bantime has no value",
+                                               config_status("%s:%i: set::scan::bantime has no value",
                                                                ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
                                                break;
                                        }
-                                       Scan_BanTime = atime(ce->ce_vardata);
+                                       Scan_BanTime = config_checkval(ce->ce_vardata,CFG_TIME);
                                }
+                               else
                                if (!strcmp(ce->ce_varname, "timeout")) {
                                        if (!ce->ce_vardata) {
-                                               config_error("%s:%i: set::scan::timeout has no value",
+                                               config_status("%s:%i: set::scan::timeout has no value",
                                                                ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
                                                break;
                                        }
-                                       Scan_TimeOut = atime(ce->ce_vardata);
+                                       Scan_TimeOut = config_checkval(ce->ce_vardata,CFG_TIME);
                                }
-
+                               else
                                if (!strcmp(ce->ce_varname, "endpoint"))
                                {
                                        if (!ce->ce_vardata)
                                        {
-                                               config_error("%s:%i: set::scan::endpoint: syntax [ip]:port",
+                                               config_status("%s:%i: set::scan::endpoint: syntax [ip]:port",
                                                             ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
                                                break;
                                        }
                                        ipport_seperate(ce->ce_vardata, &ip, &port);
                                        if (!ip || !*ip)
                                        {
-                                               config_error("%s:%i: set::scan::endpoint: illegal ip",
+                                               config_status("%s:%i: set::scan::endpoint: illegal ip",
                                                             ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
                                                break;
                                        }
                                        if (!port || !*port)
                                        {
-                                               config_error("%s:%i: set::scan::endpoint: missing/invalid port",
+                                               config_status("%s:%i: set::scan::endpoint: missing/invalid port",
                                                            ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
                                                break;
                                        }
                                        iport = atol(port);
                                        if ((iport < 0) || (iport > 65535))
                                        {
-                                               config_error("%s:%i: set::scan::endpoint: illegal port",
+                                               config_status("%s:%i: set::scan::endpoint: illegal port",
                                                             ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
                                                break;
                                        }
@@ -408,8 +417,32 @@ DLLFUNC int        h_config_set_scan(void)
                                        Scan_endpoint.SIN_PORT = htons(iport);
                                        Scan_endpoint.SIN_FAMILY = AFINET;
                                }
-                               
-                               
+                               else if (!strcmp(ce->ce_varname, "bind-ip"))
+                               {
+                                       if (!ce->ce_vardata)
+                                       {
+                                               config_status("%s:%i: set::scan::bind: syntax [ip]",
+                                                            ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+                                               break;
+                                       }
+#ifndef INET6
+                                       Scan_bind.S_ADDR = inet_addr(ce->ce_vardata);
+#else
+                                       inet_pton(AFINET, ce->ce_vardata, Scan_bind.S_ADDR);
+#endif
+                               }
+                               else if (!strcmp(ce->ce_varname, "message"))
+                               {
+                                       if (!ce->ce_vardata)
+                                       {
+                                               config_status("%s:%i: set::scan::message requires an argument",
+                                                       ce->ce_fileptr->cf_filename, ce->ce_varlinenum);
+                                               break;
+                                       }
+                                       if (scan_message)
+                                               free(scan_message);
+                                       scan_message = strdup(ce->ce_vardata);
+                               }
                        }
                        del_ConfigItem(sets, conf_unknown_set);
                }       
@@ -425,6 +458,10 @@ DLLFUNC int h_stats_scan(aClient *sptr, char *stats) {
                                Scan_BanTime);
                sendto_one(sptr, ":%s %i %s :scan::timeout: %d", me.name, RPL_TEXT, sptr->name,
                                Scan_TimeOut);
+               sendto_one(sptr, ":%s %i %s :scan::bind-ip: %s",
+                       me.name, RPL_TEXT, sptr->name, Inet_ia2p(&Scan_bind));
+               sendto_one(sptr, ":%s %i %s :scan::message: %s",
+                       me.name, RPL_TEXT, sptr->name, scan_message ? scan_message : "<NULL>");
        }
         return 0;
 }
index 33b63f2230aff9f45c07c67aaaa9714fd234c3cd..d45ce8860ded4d308b1ed69ce77cd6f60442bf14 100644 (file)
@@ -63,7 +63,8 @@ struct _hsstruct
 
 static vFP                     xEadd_scan = NULL;
 static struct SOCKADDR_IN      *xScan_endpoint = NULL;
-static int xScan_TimeOut = 0;
+static struct IN_ADDR          *xScan_bind = NULL;
+static int *xScan_TimeOut = 0;
 static Hook *HttpScanHost = NULL;
 static int HOOKTYPE_SCAN_HOST;
 static Hooktype *ScanHost;
@@ -71,11 +72,13 @@ static Hooktype *ScanHost;
 extern void Eadd_scan();
 extern struct SOCKADDR_IN      Scan_endpoint;
 extern int Scan_TimeOut;
+extern struct IN_ADDR Scan_bind;
 #endif
 static Mod_SymbolDepTable modsymdep[] = 
 {
        MOD_Dep(Eadd_scan, xEadd_scan, "src/modules/scan.so"),
        MOD_Dep(Scan_endpoint, xScan_endpoint, "src/modules/scan.so"),
+       MOD_Dep(Scan_bind, xScan_bind, "src/modules/scan.so"),
        MOD_Dep(Scan_TimeOut, xScan_TimeOut, "src/modules/scan.so"),
        {NULL, NULL}
 };
@@ -188,6 +191,7 @@ void        scan_http_scan_port(HSStruct *z)
        unsigned char                   *cp;
 #endif
        struct                  SOCKADDR_IN sin;
+       struct                  SOCKADDR_IN bin;
        SOCKET                  fd;
        unsigned char           httpbuf[160];
        fd_set                  rfds;
@@ -218,6 +222,14 @@ void       scan_http_scan_port(HSStruct *z)
                goto exituniverse;
                return;
        }
+#ifndef INET6
+       bin.SIN_ADDR = *xScan_bind;
+#else
+       bcopy((char *)xScan_bind, (char *)&bin.SIN_ADDR, sizeof(struct IN_ADDR));
+#endif
+       bin.SIN_FAMILY = AFINET;
+       bin.SIN_PORT = 0;
+       bind(fd, (struct SOCKADDR *)&bin, sizeof(bin));
 
        sin.SIN_PORT = htons((unsigned short)z->port);
        sin.SIN_FAMILY = AFINET;
@@ -249,7 +261,7 @@ void        scan_http_scan_port(HSStruct *z)
        }
        
        /* We wait for write-ready */
-       tv.tv_sec = xScan_TimeOut;
+       tv.tv_sec = *xScan_TimeOut;
        tv.tv_usec = 0;
        FD_ZERO(&rfds);
        FD_SET(fd, &rfds);
@@ -268,7 +280,7 @@ void        scan_http_scan_port(HSStruct *z)
                goto exituniverse;
        }
        /* Now we wait for data. 10 secs ought to be enough  */
-       tv.tv_sec = xScan_TimeOut;
+       tv.tv_sec = *xScan_TimeOut;
        tv.tv_usec = 0;
        FD_ZERO(&rfds);
        FD_SET(fd, &rfds);
index 168d803e6b0d3951dd94ce1889402c232df1fe62..92ff31536e4dfc46383eb6a354d4b509f27993a1 100644 (file)
 static Hook *SocksScanHost = NULL;
 static vFP                     xEadd_scan = NULL;
 static struct SOCKADDR_IN      *xScan_endpoint = NULL;
-static int xScan_TimeOut = 0;
+static struct IN_ADDR          *xScan_bind = NULL;
+static int *xScan_TimeOut = 0;
 #ifdef STATIC_LINKING
 extern void Eadd_scan();
 extern struct SOCKADDR_IN      Scan_endpoint;
 extern int Scan_TimeOut;
+extern struct IN_ADDR Scan_bind;
 #endif
 void   scan_socks_scan(Scan_AddrStruct *sr);
 void   scan_socks4_scan(Scan_AddrStruct *sr);
@@ -74,6 +76,7 @@ static Mod_SymbolDepTable modsymdep[] =
 {
        MOD_Dep(Eadd_scan, xEadd_scan, "src/modules/scan.so"),
        MOD_Dep(Scan_endpoint, xScan_endpoint, "src/modules/scan.so"),
+       MOD_Dep(Scan_bind, xScan_bind, "src/modules/scan.so"),
        MOD_Dep(Scan_TimeOut, xScan_TimeOut, "src/modules/scan.so"),
        {NULL, NULL}
 };
@@ -167,6 +170,7 @@ void        scan_socks4_scan(Scan_AddrStruct *h)
        unsigned char           *cp;
 #endif
        struct                  SOCKADDR_IN sin;
+       struct                  SOCKADDR_IN bin;
        struct                  in_addr ia4;
        SOCKET                  fd;
        unsigned char           socksbuf[10];
@@ -184,15 +188,7 @@ void       scan_socks4_scan(Scan_AddrStruct *h)
        bcopy(sin.SIN_ADDR.S_ADDR, h->in.S_ADDR, sizeof(h->in.S_ADDR));
 #endif
        IRCMutexUnlock((h->lock));
-       /* IPv6 ?*/
 #ifdef INET6
-       IRCMutexLock((h->lock));
-#ifndef INET6
-       sin.SIN_ADDR.S_ADDR = h->in.S_ADDR;
-#else
-       bcopy(sin.SIN_ADDR.S_ADDR, h->in.S_ADDR, sizeof(h->in.S_ADDR));
-#endif
-       IRCMutexUnlock((h->lock));
        /* ::ffff:ip hack */
        cp = (u_char *)&h->in.s6_addr;
        if (!(cp[0] == 0 && cp[1] == 0 && cp[2] == 0 && cp[3] == 0 && cp[4] == 0
@@ -207,6 +203,15 @@ void       scan_socks4_scan(Scan_AddrStruct *h)
                goto exituniverse;
                return;
        }
+
+#ifndef INET6
+       bin.SIN_ADDR = *xScan_bind;
+#else
+       bcopy((char *)xScan_bind, (char *)&bin.SIN_ADDR, sizeof(struct IN_ADDR));
+#endif
+       bin.SIN_FAMILY = AFINET;
+       bin.SIN_PORT = 0;
+       bind(fd, (struct SOCKADDR *)&bin, sizeof(bin));
        sin.SIN_PORT = htons((unsigned short)SCAN_ON_PORT);
        sin.SIN_FAMILY = AFINET;
        /* We do this non-blocking to prevent a hang of the entire ircd with newer
@@ -235,10 +240,9 @@ void       scan_socks4_scan(Scan_AddrStruct *h)
                goto exituniverse;
                return;
        }
-ircd_log(LOG_ERROR, "%s:%d - (Connection Established)", Inet_ia2p(&h->in), SCAN_ON_PORT);
        
        /* We wait for write-ready */
-       tv.tv_sec = xScan_TimeOut;
+       tv.tv_sec = *xScan_TimeOut;
        tv.tv_usec = 0;
        FD_ZERO(&rfds);
        FD_SET(fd, &rfds);
@@ -269,7 +273,7 @@ ircd_log(LOG_ERROR, "%s:%d - (Connection Established)", Inet_ia2p(&h->in), SCAN_
                goto exituniverse;
        }
        /* Now we wait for data. 10 secs ought to be enough  */
-       tv.tv_sec = xScan_TimeOut;
+       tv.tv_sec = *xScan_TimeOut;
        tv.tv_usec = 0;
        FD_ZERO(&rfds);
        FD_SET(fd, &rfds);
@@ -375,7 +379,7 @@ void        scan_socks5_scan(Scan_AddrStruct *h)
        }
        
        /* We wait for write-ready */
-       tv.tv_sec = xScan_TimeOut;
+       tv.tv_sec = *xScan_TimeOut;
        tv.tv_usec = 0;
        FD_ZERO(&rfds);
        FD_SET(fd, &rfds);
@@ -397,7 +401,7 @@ void        scan_socks5_scan(Scan_AddrStruct *h)
                CLOSE_SOCK(fd);
                goto exituniverse;
        }
-       tv.tv_sec = xScan_TimeOut;
+       tv.tv_sec = *xScan_TimeOut;
        tv.tv_usec = 0;
        FD_ZERO(&rfds);
        FD_SET(fd, &rfds);
diff --git a/src/mutex.c b/src/mutex.c
deleted file mode 100644 (file)
index d18977a..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-#include "threads.h"
-
-#define MUTEX_MAX_LOCK 30000
-
-#define MUTEX_SUCCESS (0)
-#define MUTEX_IN_USE (-1)
-#define MUTEX_TOO_MANY_LOCKS (-2)
-#define MUTEX_NOT_MINE (-3)
-
-int my_trylock_mutex(MUTEX* mutex)
-{
-
-       THREAD me;
-       me = IRCThreadSelf();
-       if (mutex->lock_index && !IRCThreadEqual(me, mutex->lockedby))
-               return MUTEX_IN_USE;
-       if (mutex->lock_index > 30000)
-               return MUTEX_TOO_MANY_LOCKS;
-       mutex->lockedby = me;
-       mutex->lock_index++;
-       return MUTEX_SUCCESS;
-}
-
-int my_lock_mutex(MUTEX* mutex)
-{
-       int ret;
-       ret = my_trylock_mutex(mutex);
-
-       if (ret != MUTEX_IN_USE)
-               return ret;
-
-       while(mutex->lock_index > 0)
-               ;
-
-       return my_trylock_mutex(mutex);
-}
-
-int my_unlock_mutex(MUTEX* mutex)
-{
-       THREAD me;
-       me = IRCThreadSelf();
-
-       if (!IRCThreadEqual(me, mutex->lockedby))
-               return MUTEX_NOT_MINE;
-
-       mutex->lock_index--;
-
-       if (mutex->lock_index < 0)
-               mutex->lock_index = 0;
-
-       return MUTEX_SUCCESS;
-}
index a04163f3a98fa4ab5a2bf955848e703fc21bf706..cf90ed525a03c033c1f1764ce82dad09bff53116 100644 (file)
@@ -205,6 +205,7 @@ void        init_CommandHash(void)
        add_Command(MSG_CYCLE, TOK_CYCLE, m_cycle, MAXPARA);    
        add_Command(MSG_MODULE, TOK_MODULE, m_module, MAXPARA); 
        add_Command(MSG_TKL, TOK_TKL, m_tkl, MAXPARA);
+               
 #ifdef DEVELOP_DEBUG
        for (i = 0; i <= 255; i++)
        {
index 5c0f0c6c01f4a7d44b89b3f01e49478c2de8e7c4..08ac4e28a2012a85b0ce248472a7d4758c893179 100644 (file)
--- a/src/res.c
+++ b/src/res.c
@@ -581,7 +581,11 @@ static int do_query_number(Link *lp, struct IN_ADDR *numb, ResRQ *rptr)
 #endif
                rptr->he.h_length = sizeof(struct IN_ADDR);
 #else
+#ifndef INET6
                rptr->addr.S_ADDR = numb->S_ADDR;
+#else
+               bcopy(numb->s6_addr, rptr->addr.s6_addr, IN6ADDRSZ);
+#endif
                rptr->he->h_length = sizeof(struct IN_ADDR);
 
 /*             rptr->addr.s_addr = numb->s_addr;
@@ -1942,7 +1946,13 @@ int      res_copyhostent(struct hostent *from, struct hostent *to)
            {
                amt += 4;
                to->h_addr_list[i] = (char *)(amt+x);
+#ifndef INET6
                ((struct IN_ADDR *)to->h_addr_list[i])->S_ADDR = ((struct IN_ADDR *)from->h_addr_list[i])->S_ADDR;
+#else
+               bcopy(((struct IN_ADDR *)from->h_addr_list[i])->S_ADDR,((struct IN_ADDR *)to->h_addr_list[i])->S_ADDR, IN6ADDRSZ);
+#endif
+
+
            }
        to->h_addr_list[i] = NULL;
 }
index 81fcbe0f9b1c53b0e940294bd419ad141843d91d..0f347b0d56bf10c8eb601bb8daa5778740a957c0 100644 (file)
@@ -88,7 +88,11 @@ void start_auth(aClient *cptr)
 
 
        /* Use the listener that the user got in on, dah? */
+#ifndef INET6
        sock.SIN_ADDR = cptr->listener->ip; 
+#else
+       bcopy((char *)&cptr->listener->ip, (char *)&sock.SIN_ADDR, sizeof(struct IN_ADDR));
+#endif
        sock.SIN_PORT = 0;
        sock.SIN_FAMILY = AFINET;       /* redundant? */
        (void)bind(cptr->authfd, (struct SOCKADDR *)&sock, sizeof(sock));
@@ -111,8 +115,8 @@ void start_auth(aClient *cptr)
                cptr->authfd = -1;
                if (!DoingDNS(cptr))
                        SetAccess(cptr);
-       if (SHOWCONNECTINFO)
-               sendto_one(cptr, REPORT_FAIL_ID);
+               if (SHOWCONNECTINFO) 
+                       sendto_one(cptr, REPORT_FAIL_ID);
                return;
        }
        cptr->flags |= (FLAGS_WRAUTH | FLAGS_AUTH);
index 968d0ad04b1a8302cbf82601949333a6b48d2e72..ea1fca2de0e07fbf6a1598faafccd5aa6ef10220 100644 (file)
@@ -35,7 +35,7 @@
 
 #ifndef CLEAN_COMPILE
 static char sccsid[] =
-    "@(#)s_bsd.c       2.78 2/7/94 (C) 1988 University of Oulu, \
+    "@(#)      2.78 2/7/94 (C) 1988 University of Oulu, \
 Computing Center and Jarkko Oikarinen";
 #endif
 
@@ -105,7 +105,7 @@ int readcalls = 0, resfd = -1;
 static struct SOCKADDR_IN mysk;
 
 static struct SOCKADDR *connect_inet(ConfigItem_link *, aClient *, int *);
-static int completed_connection(aClient *);
+int completed_connection(aClient *);
 static int check_init(aClient *, char *, size_t);
 #ifndef _WIN32
 static void do_dns_async();
@@ -144,6 +144,7 @@ extern fdlist socks_fdlist;
 #  endif
 # endif
 #endif
+void   start_of_normal_client_handshake(aClient *acptr);
 
 /* winlocal */
 void add_local_client(aClient* cptr)
@@ -207,7 +208,7 @@ void close_connections(void)
   OpenFiles = 0;
   LastSlot = -1;
 #ifdef _WIN32
-  WSACleanup();
+         WSACleanup();
 #endif
 }
 
@@ -616,6 +617,10 @@ init_dgram:
 
        resfd = init_resolver(0x1f);
        Debug((DEBUG_DNS, "resfd %d", resfd));
+#ifndef _WIN32
+       if (MAXCONNECTIONS > FD_SETSIZE)
+               abort();
+#endif
        return;
 }
 
@@ -762,7 +767,7 @@ int  check_client(aClient *cptr)
 **     Return  TRUE, if successfully completed
 **             FALSE, if failed and ClientExit
 */
-static int completed_connection(aClient *cptr)
+int completed_connection(aClient *cptr)
 {
        ConfigItem_link *aconf = cptr->serv ? cptr->serv->conf : NULL;
        extern char serveropts[];
@@ -773,20 +778,6 @@ static int completed_connection(aClient *cptr)
                sendto_ops("Lost configuration for %s", get_client_name(cptr, FALSE));
                return -1;
        }
-#ifdef USE_SSL
-       if ((aconf->options & CONNECT_SSL))
-               if (ssl_client_handshake(cptr, aconf) == -2)
-               {
-                       sendto_realops("Could not handshake SSL with %s", get_client_name(cptr, FALSE));
-                       return FALSE;
-               }
-               else
-               {
-
-                       sendto_realops("Handshaked SSL with %s", cptr->name);
-                       cptr->flags |= FLAGS_SSL;
-               }
-#endif
        if (!BadPtr(aconf->connpwd))
                sendto_one(cptr, "PASS :%s", aconf->connpwd);
 
@@ -896,6 +887,14 @@ void close_connection(aClient *cptr)
        {
                flush_connections(cptr);
                remove_local_client(cptr);
+#ifdef USE_SSL
+               if (IsSSL(cptr) && cptr->ssl) {
+                       SSL_set_shutdown((SSL *)cptr->ssl, SSL_RECEIVED_SHUTDOWN);
+                       SSL_smart_shutdown((SSL *)cptr->ssl);
+                       SSL_free((SSL *)cptr->ssl);
+                       cptr->ssl = NULL;
+               }
+#endif
                CLOSE_SOCK(cptr->fd);
                cptr->fd = -2;
                --OpenFiles;
@@ -905,17 +904,6 @@ void close_connection(aClient *cptr)
        }
 
        cptr->from = NULL;      /* ...this should catch them! >:) --msa */
-#ifdef USE_SSL
-       if (cptr->flags & FLAGS_SSL)
-       {
-               if (cptr->ssl)
-               {
-                       SSL_shutdown((SSL *)cptr->ssl);
-                       SSL_free((SSL *)cptr->ssl);
-               }
-       }
-#endif
-
        /*
         * fd remap to keep local[i] filled at the bottom.
         */
@@ -1152,7 +1140,7 @@ void set_non_blocking(int fd, aClient *cptr)
  */
 aClient *add_connection(aClient *cptr, int fd)
 {
-       Link lin;
+       Link    lin;
        aClient *acptr;
        ConfigItem_ban *bconf;
        int i, j;
@@ -1194,7 +1182,11 @@ add_con_refuse:
                for (i = LastSlot; i >= 0; i--)
                {
                        if (local[i] && IsUnknown(local[i]) &&
+#ifndef INET6
                                local[i]->ip.S_ADDR == acptr->ip.S_ADDR)
+#else
+                               !bcmp(local[i]->ip.S_ADDR, cptr->ip.S_ADDR, sizeof(cptr->ip.S_ADDR)))
+#endif
                        {
                                j++;
                                if (j > MAXUNKNOWNCONNECTIONSPERIP)
@@ -1234,25 +1226,6 @@ add_con_refuse:
                        goto add_con_refuse;
                }
                acptr->port = ntohs(addr.SIN_PORT);
-               if (SHOWCONNECTINFO) {
-                       /* Start of the very first DNS check */
-                       if (!(cptr->umodes & LISTENER_SSL))
-                               FDwrite(fd, REPORT_DO_DNS, R_do_dns);
-               }
-               lin.flags = ASYNC_CLIENT;
-               lin.value.cptr = acptr;
-               Debug((DEBUG_DNS, "lookup %s", acptr->sockhost));
-               acptr->hostp = gethost_byaddr((char *)&acptr->ip, &lin);
-
-               if (!acptr->hostp)
-                       SetDNS(acptr);
-               else
-               {
-                       if (SHOWCONNECTINFO)
-                               if (!(cptr->umodes & LISTENER_SSL))
-                                       FDwrite(fd, REPORT_FIN_DNSC, R_fin_dnsc);
-               }
-               nextdnscheck = 1;
        }
 
        acptr->fd = fd;
@@ -1266,22 +1239,57 @@ add_con_refuse:
        {
                ((ConfigItem_listen *) acptr->listener->class)->clients++;
        }
+       add_client_to_list(acptr);
+       set_non_blocking(acptr->fd, acptr);
+       set_sock_opts(acptr->fd, acptr);
+       IRCstats.unknown++;
 #ifdef USE_SSL
        if (cptr->umodes & LISTENER_SSL)
        {
-               ssl_handshake(acptr);
+               SetSSLAcceptHandshake(acptr);
+               if ((acptr->ssl = SSL_new(ctx_server)) == NULL)
+               {
+                       goto add_con_refuse;
+               }
                acptr->flags |= FLAGS_SSL;
+               SSL_set_fd(acptr->ssl, fd);
+               SSL_set_nonblocking(acptr->ssl);
+               if (!ircd_SSL_accept(acptr, fd)) {
+                       SSL_set_shutdown(acptr->ssl, SSL_RECEIVED_SHUTDOWN);
+                       SSL_smart_shutdown(acptr->ssl);
+                       SSL_free(acptr->ssl);
+                       goto add_con_refuse;
+               }
        }
+       else
 #endif
-       add_client_to_list(acptr);
-       set_non_blocking(acptr->fd, acptr);
-       set_sock_opts(acptr->fd, acptr);
-       IRCstats.unknown++;
-       start_auth(acptr);
-
+               start_of_normal_client_handshake(acptr);
        return acptr;
 }
 
+void   start_of_normal_client_handshake(aClient *acptr)
+{
+       Link    lin;
+       acptr->status = STAT_UNKNOWN;   
+       if (SHOWCONNECTINFO) {
+               sendto_one(acptr, REPORT_DO_DNS);
+       }
+       lin.flags = ASYNC_CLIENT;
+       lin.value.cptr = acptr;
+       Debug((DEBUG_DNS, "lookup %s", acptr->sockhost));
+       acptr->hostp = gethost_byaddr((char *)&acptr->ip, &lin);
+       
+       if (!acptr->hostp)
+               SetDNS(acptr);
+       else
+       {
+               if (SHOWCONNECTINFO)
+                       sendto_one(acptr, REPORT_FIN_DNSC);
+       }
+       nextdnscheck = 1;
+       start_auth(acptr);
+}
+
 /*
 ** read_packet
 **
@@ -1300,20 +1308,12 @@ static int read_packet(aClient *cptr, fd_set *rfd)
            !(IsPerson(cptr) && DBufLength(&cptr->recvQ) > 6090))
        {
                SET_ERRNO(0);
-#ifdef INET6
-               length = recvfrom(cptr->fd, readbuf, sizeof(readbuf), 0, 0, 0);
-#else
-#ifndef USE_SSL
-               length = recv(cptr->fd, readbuf, sizeof(readbuf), 0);
-#else
+#ifdef USE_SSL
                if (cptr->flags & FLAGS_SSL)
-                       length = SSL_read((SSL *)cptr->ssl, readbuf, sizeof(readbuf));
+                       length = ircd_SSL_read(cptr, readbuf, sizeof(readbuf));
                else
-                       length = recv(cptr->fd, readbuf, sizeof(readbuf), 0);
-
 #endif
-#endif
-
+                       length = recv(cptr->fd, readbuf, sizeof(readbuf), 0);
                cptr->lasttime = now;
                if (cptr->lasttime > cptr->since)
                        cptr->since = cptr->lasttime;
@@ -1471,15 +1471,12 @@ static int read_packet(aClient *cptr)
        {
                errno = 0;
 
-#ifndef USE_SSL
-               length = recv(cptr->fd, readbuf, sizeof(readbuf), 0);
-#else
+#ifdef USE_SSL
                if (cptr->flags & FLAGS_SSL)
-                       length = SSL_read((SSL *)cptr->ssl, readbuf, sizeof(readbuf));
+                       length = ircd_SSL_read((SSL *)cptr->ssl, readbuf, sizeof(readbuf));
                else
-                       length = recv(cptr->fd, readbuf, sizeof(readbuf), 0);
-
 #endif
+                       length = recv(cptr->fd, readbuf, sizeof(readbuf), 0);
                cptr->lasttime = now;
                if (cptr->lasttime > cptr->since)
                        cptr->since = cptr->lasttime;
@@ -1487,7 +1484,7 @@ static int read_packet(aClient *cptr)
                /*
                 * If not ready, fake it so it isnt closed
                 */
-           if (length < 0 && ((ERRNO == P_EWOULDBLOCK) || ERRNO == P_EAGAIN)))
+               if (length < 0 && ((ERRNO == P_EWOULDBLOCK) || ERRNO == P_EAGAIN)))
                        return 1;
                if (length <= 0)
                        return length;
@@ -1548,7 +1545,9 @@ int  read_message(time_t delay)
 int  read_message(time_t delay, fdlist *listp)
 #endif
 {
-       aClient *cptr;
+/* 
+   #undef FD_SET(x,y) do { if (fcntl(x, F_GETFD, &sockerr) == -1) abort(); FD_SET(x,y); } while(0)
+*/     aClient *cptr;
        int  nfds;
        struct timeval wait;
 #ifndef _WIN32
@@ -1591,7 +1590,7 @@ int  read_message(time_t delay, fdlist *listp)
                                continue;
                        if (IsLog(cptr))
                                continue;
-
+                       
                        if (DoingAuth(cptr))
                        {
                                auth++;
@@ -1623,7 +1622,9 @@ int  read_message(time_t delay, fdlist *listp)
                        }
                        if ((cptr->fd >= 0) && (DBufLength(&cptr->sendQ) || IsConnecting(cptr) ||
                            (DoList(cptr) && IsSendable(cptr))))
+                       {
                                FD_SET(cptr->fd, &write_set);
+                       }
                }
 
 #ifndef _WIN32
@@ -1636,13 +1637,13 @@ int  read_message(time_t delay, fdlist *listp)
                wait.tv_sec = MIN(delay, delay2);
                wait.tv_usec = 0;
 #ifdef HPUX
-               nfds = select(FD_SETSIZE, (int *)&read_set, (int *)&write_set,
+               nfds = select(MAXCONNECTIONS, (int *)&read_set, (int *)&write_set,
                    0, &wait);
 #else
 # ifndef _WIN32
-               nfds = select(FD_SETSIZE, &read_set, &write_set, 0, &wait);
+               nfds = select(MAXCONNECTIONS, &read_set, &write_set, 0, &wait);
 # else
-               nfds = select(FD_SETSIZE, &read_set, &write_set, &excpt_set, &wait);
+               nfds = select(MAXCONNECTIONS, &read_set, &write_set, &excpt_set, &wait);
 # endif
 #endif
            if (nfds == -1 && ((ERRNO == P_EINTR) || (ERRNO == P_ENOTSOCK)))
@@ -1797,7 +1798,14 @@ int  read_message(time_t delay, fdlist *listp)
                         */
                        ClearBlocked(cptr);
                        if (IsConnecting(cptr))
-                               write_err = completed_connection(cptr);
+#ifdef USE_SSL
+                               if ((cptr->serv) && (cptr->serv->conf->options & CONNECT_SSL))
+                               {
+                                       write_err = ircd_SSL_client_handshake(cptr);
+                               }
+                               else
+#endif
+                                       write_err = completed_connection(cptr);
                        if (!write_err)
                        {
                                if (DoList(cptr) && IsSendable(cptr))
@@ -1820,8 +1828,35 @@ deadsocket:
                        }
                }
                length = 1;     /* for fall through case */
-               if (!NoNewLine(cptr) || FD_ISSET(cptr->fd, &read_set))
+               if ((!NoNewLine(cptr) || FD_ISSET(cptr->fd, &read_set)) 
+#ifdef USE_SSL
+                       && 
+                       !(IsSSLAcceptHandshake(cptr) || IsSSLConnectHandshake(cptr))
+#endif         
+                       )
                        length = read_packet(cptr, &read_set);
+#ifdef USE_SSL
+               if ((cptr->ssl != NULL) && 
+                       (IsSSLAcceptHandshake(cptr) || IsSSLConnectHandshake(cptr)) &&
+                       FD_ISSET(cptr->fd, &read_set))
+               {
+                       if (!SSL_is_init_finished(cptr->ssl))
+                       {
+                               if (IsDead(cptr) || IsSSLAcceptHandshake(cptr) ? !ircd_SSL_accept(cptr, cptr->fd) : ircd_SSL_connect(cptr) < 0)
+                               {
+                                       length = -1;
+                               }
+                       }
+                       else
+                       {
+                               if (IsSSLAcceptHandshake(cptr))
+                                       start_of_normal_client_handshake(cptr);
+                               else
+                                       completed_connection(cptr);
+
+                       }
+               }
+#endif
                if (length > 0)
                        flush_connections(cptr);
                if ((length != FLUSH_BUFFER) && IsDead(cptr))
@@ -1959,6 +1994,7 @@ int  read_message(time_t delay, fdlist *listp)
                                continue;
                        if (IsLog(cptr))
                                continue;
+                       
                        if (DoingAuth(cptr))
                        {
                                if (auth == 0)
index 713171f45d5e273e1e7adad344f960fa17cb112a..10e5f96a9b27f185f7e0cbb884e49d3b446c8ed1 100644 (file)
@@ -50,7 +50,7 @@
 #ifdef _WIN32
 #undef GLOBH
 #endif
-
+extern MemoryInfo StatsZ;
 /*
  * TODO:
  *  - deny version {} (V:lines)
@@ -327,53 +327,115 @@ void     ipport_seperate(char *string, char **ip, char **port)
        }
 }
 
-int conf_yesno(char *value) {
-       if (!stricmp(value, "yes") || !stricmp(value, "true") || !stricmp(value, "on") || strcmp(value, "1"))
-               return 1;
-       if (!stricmp(value, "no") || !stricmp(value, "false") || !stricmp(value, "off") || strcmp(value, "0"))
-               return 0;
 
-       return -1;
-}
 
-#define KB 1024
-#define MB 1048576
-#define GB 1073741824
-#define TB 1099511627776
+long config_checkval(char *value, unsigned short flags) {
+       char *text, *ptr;
+       long ret = 0;
 
-long conf_size(char *value) {
-       char *numbuf;
-       char *buf = value;
-       long num = 0;
-       int i;
-       if (!buf)
-               return 0;
 
-       numbuf = MyMalloc(strlen(value));
-       for (i = 0;*buf; buf++) {
-               if (isdigit(*buf)) {
-                       numbuf[i++] = *buf;
-                       continue;
+       if (flags == CFG_YESNO) {
+               for (text = value; *text; text++) {
+                       if (!isalnum(*text))
+                               continue;
+                       if (tolower(*text) == 'y' || (tolower(*text) == 'o' &&
+tolower(*(text+1)) == 'n') || *text == '1' || tolower(*text) == 't') {
+                               ret = 1;
+                               break;
+                       }
                }
-               if (isalpha(*buf)) {
-                       num = atol(numbuf);
-                       if (tolower(*buf) == 't')
-                               num *= TB;
-                       else if (tolower(*buf) == 'g')
-                               num *= GB;
-                       else if (tolower(*buf) == 'm')
-                               num *= MB;
-                       else if (tolower(*buf) == 'k')
-                               num *= MB;
-                       break;
+       }
+       else if (flags == CFG_SIZE) {
+               int mfactor = 1;
+               char *sz;
+               for (text = value; *text; text++) {
+                       if (!isalpha(*text))
+                               text++;
+                       if (isalpha(*text)) {
+                               if (tolower(*text) == 'k') 
+                                       mfactor = 1024;
+                               else if (tolower(*text) == 'm') 
+                                       mfactor = 1048576;
+                               else if (tolower(*text) == 'g') 
+                                       mfactor = 1073741824;
+                               else 
+                                       mfactor = 1;
+                               sz = text;
+                               while (isalpha(*text))
+                                       text++;
+
+                               *sz-- = 0;
+                               while (sz-- > value && *sz) {
+                                       if (isspace(*sz)) 
+                                               *sz = 0;
+                                       if (!isdigit(*sz)) 
+                                               break;
+                               }
+                               ret += atoi(sz+1)*mfactor;
+                               
+                       }
                }
+               mfactor = 1;
+               sz = text;
+               sz--;
+               while (sz-- > value) {
+                       if (isspace(*sz)) 
+                               *sz = 0;
+                       if (!isdigit(*sz)) 
+                               break;
+               }
+               ret += atoi(sz+1)*mfactor;
+
+               
        }
-       if (!num)
-               num = atol(numbuf);
-       free(numbuf);
-       return num;
-}
+       else if (flags == CFG_TIME) {
+               int mfactor = 1;
+               char *sz;
+               for (text = value; *text; text++) {
+                       if (!isalpha(*text))
+                               text++;
+                       if (isalpha(*text)) {
+                               if (tolower(*text) == 'w')
+                                       mfactor = 604800;       
+                               else if (tolower(*text) == 'd') 
+                                       mfactor = 86400;
+                               else if (tolower(*text) == 'h') 
+                                       mfactor = 3600;
+                               else if (tolower(*text) == 'm') 
+                                       mfactor = 60;
+                               else 
+                                       mfactor = 1;
+                               sz = text;
+                               while (isalpha(*text))
+                                       text++;
+
+                               *sz-- = 0;
+                               while (sz-- > value && *sz) {
+                                       if (isspace(*sz)) 
+                                               *sz = 0;
+                                       if (!isdigit(*sz)) 
+                                               break;
+                               }
+                               ret += atoi(sz+1)*mfactor;
+                               
+                       }
+               }
+               mfactor = 1;
+               sz = text;
+               sz--;
+               while (sz-- > value) {
+                       if (isspace(*sz)) 
+                               *sz = 0;
+                       if (!isdigit(*sz)) 
+                               break;
+               }
+               ret += atoi(sz+1)*mfactor;
+
                
+       }
+
+       return ret;
+}
 
 int    config_error_flag = 0;
 /* Small function to bitch about stuff */
@@ -402,7 +464,7 @@ void config_error(char *format, ...)
 }
 
 /* Like above */
-static void config_status(char *format, ...)
+void config_status(char *format, ...)
 {
        va_list         ap;
        char            buffer[1024];
@@ -438,13 +500,15 @@ void config_progress(char *format, ...)
        sendto_realops("%s", buffer);
 }
 
-void clear_unknown() {
+void clear_unknown(ConfigFile *file) {
        ConfigItem_unknown *p;
        ListStruct *next;
        ConfigItem_unknown_ext *q;
 
        for (p = conf_unknown; p; p = (ConfigItem_unknown *)next) {
                next = (ListStruct *)p->next;
+               if (p->ce->ce_fileptr != file)
+                       continue;
                if (!strcmp(p->ce->ce_varname, "ban")) 
                        config_status("%s:%i: unknown ban type %s",
                                p->ce->ce_fileptr->cf_filename, p->ce->ce_varlinenum,
@@ -471,6 +535,8 @@ void clear_unknown() {
        }
        for (q = conf_unknown_set; q; q = (ConfigItem_unknown_ext *)next) {
                next = (ListStruct *)q->next;
+               if (q->ce_fileptr != file)
+                       continue;
                config_status("%s:%i: unknown directive set::%s",
                        q->ce_fileptr->cf_filename, q->ce_varlinenum,
                        q->ce_varname);
@@ -864,7 +930,7 @@ int init_conf2(char *filename)
                        filename);
                i = ConfigParse(cfptr);
                RunHook0(HOOKTYPE_CONFIG_UNKNOWN);
-               clear_unknown();
+               clear_unknown(cfptr);
                config_free(cfptr);
                if (!stricmp(filename, CPATH))
                        return i;
@@ -1164,7 +1230,7 @@ int       _conf_class(ConfigFile *conf, ConfigEntry *ce)
                        continue;
                }
        }
-       if (isnew)
+       if (isnew) 
                AddListItem(class, conf_class);
        return 0;
 }
@@ -1299,7 +1365,7 @@ int       _conf_loadmodule(ConfigFile *conf, ConfigEntry *ce)
        }
        FindClose(hFind);
 #else
-       if ((ret = Module_Load(ce->ce_vardata,0)))) {
+       if ((ret = Module_Load(ce->ce_vardata,0))) {
                        config_status("%s:%i: loadmodule %s: failed to load: %s",
                                ce->ce_fileptr->cf_filename, ce->ce_varlinenum,
                                ce->ce_vardata, ret);
@@ -1713,7 +1779,7 @@ int       _conf_listen(ConfigFile *conf, ConfigEntry *ce)
 */
 int    _conf_allow(ConfigFile *conf, ConfigEntry *ce)
 {
-       ConfigEntry *cep;
+       ConfigEntry *cep, *cepp;
        ConfigItem_allow *allow;
        unsigned char isnew = 0;
 
@@ -1743,12 +1809,6 @@ int      _conf_allow(ConfigFile *conf, ConfigEntry *ce)
                                cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
                        continue;
                }
-               if (!cep->ce_vardata)
-               {
-                       config_status("%s:%i: allow item without parameter",
-                               cep->ce_fileptr->cf_filename, cep->ce_varlinenum);
-                       continue;
-               }
                if (!strcmp(cep->ce_varname, "ip"))
                {
                        allow->ip = strdup(cep->ce_vardata);
@@ -1784,6 +1844,14 @@ int      _conf_allow(ConfigFile *conf, ConfigEntry *ce)
                else if (!strcmp(cep->ce_varname, "redirect-port")) {
                        allow->port = atoi(cep->ce_vardata);
                }
+               else if (!strcmp(cep->ce_varname, "options")) {
+                       for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) {
+                               if (!strcmp(cepp->ce_varname, "noident"))
+                                       allow->flags.noident = 1;
+                               else if (!strcmp(cepp->ce_varname, "useip")) 
+                                       allow->flags.useip = 1;
+                       }
+               }
                else
                {
                        config_status("%s:%i: unknown directive allow::%s",
@@ -2272,7 +2340,7 @@ int       _conf_set(ConfigFile *conf, ConfigEntry *ce)
                }
                else if (!strcmp(cep->ce_varname, "anti-spam-quit-message-time")) {
                        CheckNull(cep);
-                       ANTI_SPAM_QUIT_MSG_TIME = atime(cep->ce_vardata);
+                       ANTI_SPAM_QUIT_MSG_TIME = config_checkval(cep->ce_vardata,CFG_TIME);
                }
                else if (!strcmp(cep->ce_varname, "oper-only-stats")) {
                        CheckNull(cep);
@@ -2316,7 +2384,7 @@ int       _conf_set(ConfigFile *conf, ConfigEntry *ce)
                }
                else if (!strcmp(cep->ce_varname, "prefix-quit")) {
                        CheckNull(cep);
-                       if (conf_yesno(cep->ce_vardata) == 0)
+                       if (!stricmp(cep->ce_vardata, "no") || *cep->ce_vardata == '0')
                        {
                                ircstrdup(prefix_quit, "Quit: ");
                        }
@@ -2326,10 +2394,10 @@ int     _conf_set(ConfigFile *conf, ConfigEntry *ce)
                        for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next) {
                                CheckNull(cepp);
                                if (!strcmp(cepp->ce_varname, "timeout")) {
-                                       HOST_TIMEOUT = atime(cepp->ce_vardata);
+                                       HOST_TIMEOUT = config_checkval(cepp->ce_vardata,CFG_TIME);
                                }
                                else if (!strcmp(cepp->ce_varname, "retries")) {
-                                       HOST_RETRIES = atime(cepp->ce_vardata);
+                                       HOST_RETRIES = config_checkval(cepp->ce_vardata,CFG_TIME);
                                }
                                else if (!strcmp(cepp->ce_varname, "nameserver")) {
                                        ircstrdup(NAME_SERVER, cepp->ce_vardata);
@@ -2385,7 +2453,7 @@ int       _conf_set(ConfigFile *conf, ConfigEntry *ce)
                                        ircstrdup(netadmin_host, cepp->ce_vardata);
                                }
                                else if (!strcmp(cepp->ce_varname, "host-on-oper-up")) {
-                                       iNAH = conf_yesno(cepp->ce_vardata);
+                                       iNAH = config_checkval(cepp->ce_vardata,CFG_YESNO);
                                }
                        }
                }
@@ -2755,7 +2823,7 @@ int       _conf_log(ConfigFile *conf, ConfigEntry *ce)
                        continue;
                }
                if (!strcmp(cep->ce_varname, "maxsize")) {
-                       log->maxsize = conf_size(cep->ce_vardata);
+                       log->maxsize = config_checkval(cep->ce_vardata,CFG_SIZE);
                }
                if (!strcmp(cep->ce_varname, "flags")) {
                        for (cepp = cep->ce_entries; cepp; cepp = cepp->ce_next)
@@ -3043,7 +3111,7 @@ void      validate_configuration(void)
                in.s_addr = inet_addr(NAME_SERVER);
                if (strcmp((char *)inet_ntoa(in), NAME_SERVER))
                {
-                       Warning("set::dns::nameserver (%s) is not an valid IP. Using 127.0.0.1 as default", NAME_SERVER);
+                       Warning("set::dns::nameserver (%s) is not a valid IP. Using 127.0.0.1 as default", NAME_SERVER);
                        ircstrdup(NAME_SERVER, "127.0.0.1");
                        in.s_addr = inet_addr(NAME_SERVER);
                }
@@ -3072,7 +3140,7 @@ void      validate_configuration(void)
                hide_host = 0;
        }
        if (Missing(locop_host)) {
-               Warning("set::hosts:local is missing");
+               Warning("set::hosts::local is missing");
                hide_host = 0;
        }
        if (Missing(sadmin_host)) {
@@ -3146,6 +3214,8 @@ void      validate_configuration(void)
                                class_ptr->maxclients = 100;
                        }
                }
+               StatsZ.classes++;
+               StatsZ.classesmem += sizeof(ConfigItem_class);
        }
        for (oper_ptr = conf_oper; oper_ptr; oper_ptr = (ConfigItem_oper *) oper_ptr->next)
        {
@@ -3416,7 +3486,7 @@ int     rehash(aClient *cptr, aClient *sptr, int sig)
        ConfigItem_help                 *help_ptr;
        ListStruct      *next, *next2;
 
-
+       bzero(&StatsZ, sizeof(StatsZ));
        flush_connections(&me);
        if (sig == 1)
        {
@@ -3959,8 +4029,13 @@ int      AllowClient(aClient *cptr, struct hostent *hp, char *sockhost)
                        goto attach;
                continue;
              attach:
-               if (index(uhost, '@'))
+/*             if (index(uhost, '@'))  now flag based -- codemastr */
+               if (!aconf->flags.noident)
                        cptr->flags |= FLAGS_DOID;
+               if (!aconf->flags.useip && hp) 
+                       (void)strncpy(uhost, fullname, sizeof(uhost));
+               else
+                       (void)strncpy(uhost, sockhost, sizeof(uhost));
                get_sockhost(cptr, uhost);
                /* FIXME */
                if (aconf->maxperip)
@@ -3968,7 +4043,11 @@ int      AllowClient(aClient *cptr, struct hostent *hp, char *sockhost)
                        ii = 1;
                        for (i = LastSlot; i >= 0; i--)
                                if (local[i] && MyClient(local[i]) &&
+#ifndef INET6
                                    local[i]->ip.S_ADDR == cptr->ip.S_ADDR)
+#else
+                                   !bcmp(local[i]->ip.S_ADDR, cptr->ip.S_ADDR, sizeof(cptr->ip.S_ADDR)))
+#endif
                                {
                                        ii++;
                                        if (ii > aconf->maxperip)
index fbde9d1fc41abe546305952b7bb786ff1e9fb556..59ee4294d516b67ca727aa60adf6eb96caa412c1 100644 (file)
@@ -357,6 +357,7 @@ void count_memory(aClient *cptr, char *nick)
        extern aChannel *channel;
        extern int flinks;
        extern Link *freelink;
+       extern MemoryInfo StatsZ;
 
        aClient *acptr;
        Ban *ban;
@@ -404,11 +405,11 @@ void count_memory(aClient *cptr, char *nick)
        {
                if (MyConnect(acptr))
                {
-/*                     lc++;
-                       for (link = acptr->confs; link; link = link->next)
+                       lc++;
+                       /*for (link = acptr->confs; link; link = link->next)
                                lcc++;
-                       wle += acptr->notifies;
-                       */
+                       wle += acptr->notifies;*/
+                       
                }
                else
                        rc++;
@@ -482,7 +483,7 @@ void count_memory(aClient *cptr, char *nick)
            me.name, RPL_STATSDEBUG, nick, co, com);
 
        sendto_one(cptr, ":%s %d %s :Classes %d(%d)",
-           me.name, RPL_STATSDEBUG, nick, cl, cl * sizeof(aClass));
+           me.name, RPL_STATSDEBUG, nick, StatsZ.classes, StatsZ.classesmem);
 
        sendto_one(cptr, ":%s %d %s :Channels %d(%d) Bans %d(%d)",
            me.name, RPL_STATSDEBUG, nick, ch, chm, chb, chbm);
index c00f8af71f54c3d55eb650925a8f41e257b85e71..26adea7e607f84027369de7f436c8fe6668df10a 100644 (file)
@@ -34,7 +34,7 @@ static char *replies[] = {
 /* 002    RPL_YOURHOST */ ":%s 002 %s :Your host is %s, running version %s",
 /* 003    RPL_CREATED */  ":%s 003 %s :This server was created %s",
 /* 004    RPL_MYINFO */   ":%s 004 %s %s %s %s %s",
-/* 005    RPL_PROTOCTL */ ":%s 005 %s" PROTOCTL_CLIENT,
+/* 005    RPL_PROTOCTL */ ":%s 005 %s",
 /* 006    RPL_MAP */      ":%s 006 %s :%s%-*s(%d)  %s",
 /* 007    RPL_MAPEND */   ":%s 007 %s :End of /MAP",
 /* 008    RPL_SNOMASK */  ":%s 008 %s :Server notice mask (%s)",
@@ -134,7 +134,7 @@ static char *replies[] = {
 /* 102 */ NULL,
 /* 103 */ NULL,
 /* 104 */ NULL,
-/* 105    RPL_REMOTEPROTOCTL */ ":%s 105 %s" PROTOCTL_CLIENT,
+/* 105    RPL_REMOTEPROTOCTL */ ":%s 105 %s",
 /* 106 */ NULL,
 /* 107 */ NULL,
 /* 108 */ NULL,
@@ -237,7 +237,7 @@ static char *replies[] = {
 /* 205    RPL_TRACEUSER */       ":%s 205 %s User %s %s [%s] %ld",
 /* 206    RPL_TRACESERVER */     ":%s 206 %s Server %s %dS %dC %s %s!%s@%s %ld",
 /* 207    RPL_TRACESERVICE */    ":%s 207 %s Service %s %s",
-/* 208    RPL_TRACENEWTYPE */    ":%s 208 %s <newtype> 0 %s",
+/* 208    RPL_TRACENEWTYPE */    ":%s 208 %s %s 0 %s",
 /* 209    RPL_TRACECLASS */      ":%s 209 %s Class %s %d",
 /* 210    RPL_STATSHELP */       ":%s 210 %s :%s",
 /* 211 */ NULL, /* Used */
@@ -541,7 +541,7 @@ static char *replies[] = {
 /* 486    ERR_NONONREG */ ":%s 486 %s :You must identify to a registered nick to private message %s",
 /* 487    ERR_NOTFORUSERS */ ":%s 487 %s :%s is a server only command",
 /* 488    ERR_HTMDISABLED */ ":%s 488 %s :%s is currently disabled, please try again later.",
-/* 489 */ NULL,
+/* 489    ERR_SECUREONLYCHAN */ ":%s 489 %s %s :Cannot join channel (+z)",
 /* 490 */ NULL,
 /* 491    ERR_NOOPERHOST */ ":%s 491 %s :No O-lines for your host",
 /* 492 */ NULL,
@@ -576,7 +576,7 @@ static char *replies[] = {
 /* 521    ERR_LISTSYNTAX */ ":%s 521 %s Bad list syntax, type /quote list ? or /raw list ?",
 /* 522    ERR_WHOSYNTAX */ ":%s 522 %s :/WHO Syntax incorrect, use /who ? for help",
 /* 523           ERR_WHOLIMEXCEED */ ":%s 523 %s :Error, /who limit of %d exceed.   Please narrow your search down and try again",
-/* 524 */ NULL,
+/* 524    ERR_OPERSPVERIFY */ ":%s 524 %s :Trying to join +s or +p channel as an oper. Please invite yourself first.",
 /* 525 */ NULL,
 /* 526 */ NULL,
 /* 527 */ NULL,
index 034be349a385a698f0f72b653393200b00616cff..f5cd69351cda6742a171ccd38b8f6f7779cf62f9 100644 (file)
@@ -431,7 +431,7 @@ int  exit_client(aClient *cptr, aClient *sptr, aClient *from, char *comment)
                        sendto_conn_hcn
                            ("*** Notice -- Client exiting: %s (%s@%s) [%s] [%s]",
                            sptr->name, sptr->user->username,
-                           sptr->user->realhost, comment, inet_ntoa(sptr->ip));
+                           sptr->user->realhost, comment, Inet_ia2p(&sptr->ip));
 
                        /* Clean out list and watch structures -Donwulff */
                        hash_del_watch_list(sptr);
index cce6490e5fcf9d22b3e6fd762e849299c7e1c271..68a93c9f486c584b491dbefdccb36d002c9d0f22 100644 (file)
@@ -143,12 +143,14 @@ CMD_FUNC(m_version)
                    serveropts, extraflags ? extraflags : "",
                    tainted ? "3" : "",
                    (IsAnOper(sptr) ? MYOSNAME : "*"), UnrealProtocol);
-               if (MyClient(sptr))
-                       sendto_one(sptr, rpl_str(RPL_PROTOCTL), me.name,
-                           sptr->name, PROTOCTL_PARAMETERS);
-               else 
-                       sendto_one(sptr, rpl_str(RPL_REMOTEPROTOCTL), me.name,
-                               sptr->name, PROTOCTL_PARAMETERS);
+               if (MyClient(sptr)) {
+                       sendto_one(sptr, ":%s 005 %s " PROTOCTL_CLIENT_1, me.name, sptr->name, PROTOCTL_PARAMETERS_1);
+                       sendto_one(sptr, ":%s 005 %s " PROTOCTL_CLIENT_2, me.name, sptr->name, PROTOCTL_PARAMETERS_2);
+               }
+               else {
+                       sendto_one(sptr, ":%s 105 %s " PROTOCTL_CLIENT_1, me.name, sptr->name, PROTOCTL_PARAMETERS_1);
+                       sendto_one(sptr, ":%s 105 %s " PROTOCTL_CLIENT_2, me.name, sptr->name, PROTOCTL_PARAMETERS_2);
+               }
        }
        return 0;
 }
@@ -626,6 +628,19 @@ CMD_FUNC(m_server)
                   are better */
                aconf = Find_link(cptr->username, cptr->sockhost, cptr->sockhost,
                    servername);
+               
+#ifdef INET6
+               /*  
+                * We first try match on uncompressed form ::ffff:192.168.1.5 thing included
+               */
+               if (!aconf)
+                       aconf = Find_link(cptr->username, cptr->sockhost, Inet_ia2pNB(&cptr->ip, 0), servername);
+               /* 
+                * Then on compressed 
+               */
+               if (!aconf)
+                       aconf = Find_link(cptr->username, cptr->sockhost, Inet_ia2pNB(&cptr->ip, 1), servername);
+#endif         
                if (!aconf)
                {
                        sendto_one(cptr,
@@ -1442,6 +1457,10 @@ void m_info_send(aClient *sptr)
            me.name, RPL_INFO, sptr->name);
        sendto_one(sptr, ":%s %d %s :| * Griever      <griever@unrealircd.com>",
            me.name, RPL_INFO, sptr->name);
+       sendto_one(sptr, ":%s %d %s :| * nighthawk    <nighthawk@unrealircd.com>",
+           me.name, RPL_INFO, sptr->name);
+       sendto_one(sptr, ":%s %d %s :| * Luke         <luke@unrealircd.com>",
+           me.name, RPL_INFO, sptr->name);
        sendto_one(sptr, ":%s %d %s :|", me.name, RPL_INFO, sptr->name);
        sendto_one(sptr, ":%s %d %s :| Coder team:", me.name, RPL_INFO, sptr->name);
        sendto_one(sptr, ":%s %d %s :|", me.name, RPL_INFO, sptr->name);
@@ -1453,6 +1472,8 @@ void m_info_send(aClient *sptr)
            me.name, RPL_INFO, sptr->name);
        sendto_one(sptr, ":%s %d %s :| * chasm     <chasm@unrealircd.org>",
            me.name, RPL_INFO, sptr->name);
+       sendto_one(sptr, ":%s %d %s :| * McSkaf    <mcskaf@unrealircd.org>",
+           me.name, RPL_INFO, sptr->name);
        sendto_one(sptr, ":%s %d %s :|", me.name, RPL_INFO, sptr->name);
        sendto_one(sptr, ":%s %d %s :| Previous versions:",
            me.name, RPL_INFO, sptr->name);
@@ -1461,8 +1482,6 @@ void m_info_send(aClient *sptr)
            me.name, RPL_INFO, sptr->name);
        sendto_one(sptr, ":%s %d %s :| * llthangel    <llthangel@unrealircd.com>",
            me.name, RPL_INFO, sptr->name);
-       sendto_one(sptr, ":%s %d %s :| * McSkaf    <mcskaf@unrealircd.org>",
-           me.name, RPL_INFO, sptr->name);
        sendto_one(sptr, ":%s %d %s :|", me.name, RPL_INFO, sptr->name);
        sendto_one(sptr, ":%s %d %s :| Credits - Type /Credits",
            me.name, RPL_INFO, sptr->name);
@@ -2020,7 +2039,7 @@ CMD_FUNC(m_stats)
 #else
                                      pbuf);
 #endif
-                                 if (!IsServer(acptr) && !IsMe(acptr) && IsAnOper(acptr))
+                                 if (!IsServer(acptr) && !IsMe(acptr) && IsAnOper(acptr) && sptr != acptr)
                                          sendto_one(acptr,
                                              ":%s %s %s :*** %s did a /stats L on you! IP may have been shown",
                                              me.name, IsWebTV(acptr) ? "PRIVMSG" : "NOTICE", acptr->name, sptr->name);
@@ -3685,9 +3704,21 @@ CMD_FUNC(m_trace)
                              parv[0], LOGFILE, acptr->port);
                          cnt++;
                          break;
+#ifdef USE_SSL
+                 case STAT_SSL_CONNECT_HANDSHAKE:
+                       sendto_one(sptr, rpl_str(RPL_TRACENEWTYPE), me.name,
+                        parv[0], "SSL-Connect-Handshake", name); 
+                       cnt++;
+                       break;
+                 case STAT_SSL_ACCEPT_HANDSHAKE:
+                       sendto_one(sptr, rpl_str(RPL_TRACENEWTYPE), me.name,
+                        parv[0], "SSL-Accept-Handshake", name); 
+                       cnt++;
+                       break;
+#endif
                  default:      /* ...we actually shouldn't come here... --msa */
                          sendto_one(sptr, rpl_str(RPL_TRACENEWTYPE), me.name,
-                             parv[0], name);
+                             parv[0], "<newtype>", name);
                          cnt++;
                          break;
                }
index ab892f69650f4d2ab7f160bdabccc651da3a3ba3..db80bfc3a6ba66bbc8504744a32589ea7b65935c 100644 (file)
@@ -251,9 +251,15 @@ int m_alias(aClient *cptr, aClient *sptr, int parc, char *parv[], char *cmd) {
                                parv[0], alias->nick);
        }
        else if (alias->type == ALIAS_NORMAL) {
-               if ((acptr = find_person(alias->nick, NULL)))
-                       sendto_one(acptr, ":%s PRIVMSG %s :%s", parv[0],
-                               alias->nick, parv[1]);
+               if ((acptr = find_person(alias->nick, NULL))) {
+                       if (MyClient(acptr))
+                               sendto_one(acptr, ":%s!%s@%s PRIVMSG %s :%s", parv[0], 
+                                       sptr->user->username, IsHidden(sptr) ? sptr->user->virthost : sptr->user->realhost,
+                                       alias->nick, parv[1]);
+                       else
+                               sendto_one(acptr, ":%s PRIVMSG %s :%s", parv[0],
+                                       alias->nick, parv[1]);
+               }
                else
                        sendto_one(sptr, err_str(ERR_NOSUCHNICK), me.name,
                                parv[0], alias->nick);
index cf372702da4f04b209462cdee1c6f6638ed35c94..4dfd2242721113267652847e4043600be482c064 100644 (file)
@@ -787,15 +787,15 @@ extern int register_user(aClient *cptr, aClient *sptr, char *nick, char *usernam
                 *
                 * Moved the noident stuff here. -OnyxDragon
                 */
-               if (!(sptr->flags & FLAGS_DOID))
+               if (!(sptr->flags & FLAGS_DOID)) 
                        strncpyzt(user->username, username, USERLEN + 1);
-               else if (sptr->flags & FLAGS_GOTID)
+               else if (sptr->flags & FLAGS_GOTID) 
                        strncpyzt(user->username, sptr->username, USERLEN + 1);
                else
                {
+
                        /* because username may point to user->username */
                        char temp[USERLEN + 1];
-
                        strncpyzt(temp, username, USERLEN + 1);
                        if (IDENT_CHECK == 0) {
                                strncpy(user->username, temp, USERLEN);
@@ -805,10 +805,11 @@ extern int register_user(aClient *cptr, aClient *sptr, char *nick, char *usernam
                                *user->username = '~';
                                (void)strncpy(&user->username[1], temp, USERLEN);
                                user->username[USERLEN] = '\0';
-                       }
 #ifdef HOSTILENAME
-                       noident = 1;
+                               noident = 1;
 #endif
+                       }
+
                }
 #ifdef HOSTILENAME
                /*
@@ -821,6 +822,11 @@ extern int register_user(aClient *cptr, aClient *sptr, char *nick, char *usernam
                 *
                 * Moved the noident thing to the right place - see above
                 * -OnyxDragon
+                * 
+                * No longer use nickname if the entire ident is invalid,
+                 * if thats the case, it is likely the user is trying to cause
+                * problems so just ban them. (Using the nick could introduce
+                * hostile chars) -- codemastr
                 */
                for (u2 = user->username + noident; *u2; u2++)
                {
@@ -844,8 +850,7 @@ extern int register_user(aClient *cptr, aClient *sptr, char *nick, char *usernam
                {
                        if (stripuser[0] == '\0')
                        {
-                               strncpy(stripuser, cptr->name, 8);
-                               stripuser[8] = '\0';
+                               return exit_client(cptr, cptr, cptr, "Hostile username. Please use only 0-9 a-z A-Z _ - and . in your username.");
                        }
 
                        strcpy(olduser, user->username + noident);
@@ -923,8 +928,8 @@ extern int register_user(aClient *cptr, aClient *sptr, char *nick, char *usernam
                                    me.name, parv[0],
                                    me.name, version, umodestring, cmodestring);
                        
-               sendto_one(sptr, rpl_str(RPL_PROTOCTL), me.name, nick,
-                   PROTOCTL_PARAMETERS);
+               sendto_one(sptr, ":%s 005 %s " PROTOCTL_CLIENT_1, me.name, nick, PROTOCTL_PARAMETERS_1);
+               sendto_one(sptr, ":%s 005 %s " PROTOCTL_CLIENT_2, me.name, nick, PROTOCTL_PARAMETERS_2);
 #ifdef USE_SSL
                if (sptr->flags & FLAGS_SSL)
                        if (sptr->ssl)
@@ -2350,6 +2355,8 @@ CMD_FUNC(m_umode)
                }
                sptr->user->virthost = (char *)make_virthost(sptr->user->realhost,
                    sptr->user->virthost, 1);
+               sendto_serv_butone_token_opt(cptr, OPT_VHP, sptr->name,
+                       MSG_SETHOST, TOK_SETHOST, "%s", sptr->user->virthost);
        }
        if (!IsHidden(sptr) && (setflags & UMODE_HIDE))
        {
index 04c6e5b0b798b395dfb6ed2d7a9af421a2ca0168..4319296804eb77e27573002f7803d39da258a1bd 100644 (file)
@@ -793,6 +793,10 @@ void sendto_serv_butone_token_opt(aClient *one, int opt, char *prefix, char *com
                        continue;
                if ((opt & OPT_NOT_SJB64) && (cptr->proto & PROTO_SJB64))
                        continue;
+               if ((opt & OPT_VHP) && !(cptr->proto & PROTO_VHP))
+                       continue;
+               if ((opt & OPT_NOT_VHP) && (cptr->proto & PROTO_VHP))
+                       continue;
 
                if (IsToken(cptr))
                {
@@ -1659,7 +1663,7 @@ void sendto_connectnotice(char *nick, anUser *user, aClient *sptr)
 #endif
        ircsprintf(connecth,
            "*** Notice -- Client connecting: %s (%s@%s) [%s] {%s}", nick,
-           user->username, user->realhost, inet_ntoa(sptr->ip),
+           user->username, user->realhost, Inet_ia2p(&sptr->ip),
            sptr->class ? sptr->class->name : "0");
 
        for (i = 0; i <= LastSlot; i++)
index 04f2eae6d26994158ed9cd649c836c88beb5f738..e827a87ec7f43fb01e33b5950a69587a1b87ae32 100644 (file)
@@ -84,16 +84,10 @@ int  deliver_it(aClient *cptr, char *str, int len)
 
 #ifdef USE_SSL
        if (cptr->flags & FLAGS_SSL)
-                retval = SSL_write((SSL *)cptr->ssl, str, len);        
+                retval = ircd_SSL_write(cptr, str, len);       
        else
-               retval = send(cptr->fd, str, len, 0);
-#else
-#ifndef INET6
-       retval = send(cptr->fd, str, len, 0);
-#else
-       retval = sendto(cptr->fd, str, len, 0, 0, 0);
-#endif
 #endif
+               retval = send(cptr->fd, str, len, 0);
        /*
           ** Convert WOULDBLOCK to a return of "0 bytes moved". This
           ** should occur only if socket was non-blocking. Note, that
@@ -232,3 +226,16 @@ char       *Inet_ia2p(struct IN_ADDR *ia)
                return((char *)inet_ntop(AFINET, ia, buf, sizeof(buf)));
 #endif
 }
+
+char   *Inet_ia2pNB(struct IN_ADDR *ia, int compressed)
+{
+       static char buf[256];
+#ifndef INET6
+       return ((char *)inet_ntoa(*ia));
+#else
+       if (compressed)
+               return ((char *)inet_ntop(AFINET, ia, buf, sizeof(buf)));
+       else
+               return ((char *)inetntop(AFINET, ia, buf, sizeof(buf)));
+#endif 
+}
\ No newline at end of file
index fba340e59f9b9516aecfcae60316636d1523941e..1816f5575b35bbb95c5d4dcc00c7582883bc905b 100644 (file)
--- a/src/ssl.c
+++ b/src/ssl.c
 
 #include "config.h"
 #ifdef USE_SSL
-
+#include "common.h"
 #include "struct.h"
+#include "h.h"
+#include "sys.h"
 #ifdef _WIN32
 #include <windows.h>
 
 extern HINSTANCE hInst;
 extern HWND hwIRCDWnd;
 #endif
+
+#define SAFE_SSL_READ 1
+#define SAFE_SSL_WRITE 2
+#define SAFE_SSL_ACCEPT 3
+#define SAFE_SSL_CONNECT 4
+
+static int fatal_ssl_error(int ssl_error, int where, aClient *sptr);
+
 /* The SSL structures */
 SSL_CTX *ctx_server;
 SSL_CTX *ctx_client;
@@ -114,7 +124,7 @@ void init_ctx_server(void)
                exit(2);
        }
        SSL_CTX_set_default_passwd_cb(ctx_server, ssl_pem_passwd_cb);
-
+       SSL_CTX_set_options(ctx_server, SSL_OP_NO_SSLv2);
        if (SSL_CTX_use_certificate_file(ctx_server, CERTF, SSL_FILETYPE_PEM) <= 0)
        {
                ircd_log(LOG_ERROR, "Failed to load SSL certificate %s", CERTF);
@@ -181,7 +191,7 @@ int  ssl_handshake(aClient *cptr)
        char *str;
        int  err;
 
-       cptr->ssl = (struct SSL *)SSL_new(ctx_server);
+       cptr->ssl = SSL_new(ctx_server);
        CHK_NULL(cptr->ssl);
        SSL_set_fd((SSL *) cptr->ssl, cptr->fd);
        set_non_blocking(cptr->fd, cptr);
@@ -192,10 +202,11 @@ int  ssl_handshake(aClient *cptr)
         *    The behaviour of SSL_write() depends on the underlying BIO. 
         *   
         */
-       err = SSL_accept((SSL *) cptr->ssl);
-       if (err == -1)
-       {       
-               /* wtf. it works, so ? */
+       if (!ircd_SSL_accept(cptr, cptr->fd)) {
+               SSL_set_shutdown((SSL *)cptr->ssl, SSL_RECEIVED_SHUTDOWN);
+               SSL_smart_shutdown((SSL *)cptr->ssl);
+               SSL_free((SSL *)cptr->ssl);
+               cptr->ssl = NULL;
                return -1;
        }
 
@@ -252,7 +263,7 @@ int  ssl_handshake(aClient *cptr)
 */
 int  ssl_client_handshake(aClient *cptr, ConfigItem_link *l)
 {
-       cptr->ssl = (struct SSL *) SSL_new((SSL_CTX *)ctx_client);
+       cptr->ssl = SSL_new((SSL_CTX *)ctx_client);
        if (!cptr->ssl)
        {
                sendto_realops("Couldn't SSL_new(ctx_client) on %s",
@@ -293,6 +304,12 @@ int        SSL_change_fd(SSL *s, int fd)
        return 1;
 }
 
+void   SSL_set_nonblocking(SSL *s)
+{
+       BIO_set_nbio(SSL_get_rbio(s),1);  
+       BIO_set_nbio(SSL_get_wbio(s),1);  
+}
+
 char   *ssl_get_cipher(SSL *ssl)
 {
        static char buf[400];
@@ -321,5 +338,226 @@ char      *ssl_get_cipher(SSL *ssl)
        return (buf);
 }
 
+int ircd_SSL_read(aClient *acptr, void *buf, int sz)
+{
+    int len, ssl_err;
+    len = SSL_read((SSL *)acptr->ssl, buf, sz);
+    if (len <= 0)
+    {
+       switch(ssl_err = SSL_get_error((SSL *)acptr->ssl, len)) {
+           case SSL_ERROR_SYSCALL:
+               if (ERRNO == P_EWOULDBLOCK || ERRNO == P_EAGAIN ||
+                       ERRNO == P_EINTR) {
+           case SSL_ERROR_WANT_READ:
+                   SET_ERRNO(P_EWOULDBLOCK);
+                  Debug((DEBUG_ERROR, "ircd_SSL_read: returning EWOULDBLOCK and 0 for %s - %s", acptr->name,
+                       ssl_err == SSL_ERROR_WANT_READ ? "SSL_ERROR_WANT_READ" : "SSL_ERROR_SYSCALL"               
+                  ));
+                   return -1;
+               }
+           case SSL_ERROR_SSL:
+               if(ERRNO == EAGAIN)
+                   return -1;
+           default:
+               Debug((DEBUG_ERROR, "ircd_SSL_read: returning fatal_ssl_error for %s",
+                acptr->name));
+               return fatal_ssl_error(ssl_err, SAFE_SSL_READ, acptr);        
+       }
+    }
+    Debug((DEBUG_ERROR, "ircd_SSL_read for %s (%p, %i): success", acptr->name, buf, sz));
+    return len;
+}
+int ircd_SSL_write(aClient *acptr, const void *buf, int sz)
+{
+    int len, ssl_err;
+
+    len = SSL_write((SSL *)acptr->ssl, buf, sz);
+    if (len <= 0)
+    {
+       switch(ssl_err = SSL_get_error((SSL *)acptr->ssl, len)) {
+           case SSL_ERROR_SYSCALL:
+               if (ERRNO == P_EWOULDBLOCK || ERRNO == P_EAGAIN ||
+                       ERRNO == P_EINTR)
+               {
+                       SET_ERRNO(P_EWOULDBLOCK);
+                       return -1;
+               }
+               return -1;
+          case SSL_ERROR_WANT_WRITE:
+                   SET_ERRNO(P_EWOULDBLOCK);
+                   return -1;
+           case SSL_ERROR_SSL:
+               if(ERRNO == EAGAIN)
+                   return -1;
+           default:
+               return fatal_ssl_error(ssl_err, SAFE_SSL_WRITE, acptr);
+       }
+    }
+    return len;
+}
+
+int ircd_SSL_client_handshake(aClient *acptr)
+{
+       int ssl_err;
+       
+       acptr->ssl = SSL_new(ctx_client);
+       if (!acptr->ssl)
+       {
+               sendto_realops("Failed to SSL_new(ctx_client)");
+               return FALSE;
+       }
+       SSL_set_fd(acptr->ssl, acptr->fd);
+       SSL_set_connect_state(acptr->ssl);
+       SSL_set_nonblocking(acptr->ssl);
+       if (acptr->serv && acptr->serv->conf->ciphers)
+       {
+               if (SSL_set_cipher_list((SSL *)acptr->ssl, 
+                       acptr->serv->conf->ciphers) == 0)
+               {
+                       /* We abort */
+                       sendto_realops("SSL cipher selecting for %s was unsuccesful (%s)",
+                               acptr->serv->conf->servername, 
+                               acptr->serv->conf->ciphers);
+                       return -2;
+               }
+       }
+       acptr->flags |= FLAGS_SSL;
+       switch (ircd_SSL_connect(acptr))
+       {
+               case -1: 
+                       return -1;
+               case 0: 
+                       SetSSLConnectHandshake(acptr);
+                       return 0;
+               case 1: 
+                       /* SSL_init_finished in s_bsd will finish the job */
+                       return 1;
+               default:
+                       return -1;              
+       }
+
+}
+
+int ircd_SSL_accept(aClient *acptr, int fd) {
+
+    int ssl_err;
+
+    if((ssl_err = SSL_accept((SSL *)acptr->ssl)) <= 0) {
+       switch(ssl_err = SSL_get_error((SSL *)acptr->ssl, ssl_err)) {
+           case SSL_ERROR_SYSCALL:
+               if (ERRNO == P_EINTR || ERRNO == P_EWOULDBLOCK
+                       || ERRNO == P_EAGAIN)
+           case SSL_ERROR_WANT_READ:
+           case SSL_ERROR_WANT_WRITE:
+                   /* handshake will be completed later . . */
+                   return 1;
+           default:
+               return fatal_ssl_error(ssl_err, SAFE_SSL_ACCEPT, acptr);
+               
+       }
+       /* NOTREACHED */
+       return -1;
+    }
+    return 1;
+}
+
+int ircd_SSL_connect(aClient *acptr) {
+
+    int ssl_err;
+    if((ssl_err = SSL_connect((SSL *)acptr->ssl)) <= 0) {
+       switch(ssl_err = SSL_get_error((SSL *)acptr->ssl, ssl_err)) {
+           case SSL_ERROR_SYSCALL:
+               if (ERRNO == P_EINTR || ERRNO == P_EWOULDBLOCK
+                       || ERRNO == P_EAGAIN)
+           case SSL_ERROR_WANT_READ:
+           case SSL_ERROR_WANT_WRITE:
+                   /* handshake will be completed later . . */
+                   return 0;
+           default:
+               return fatal_ssl_error(ssl_err, SAFE_SSL_CONNECT, acptr);
+               
+       }
+       /* NOTREACHED */
+       return -1;
+    }
+    return 1;
+}
+
+int SSL_smart_shutdown(SSL *ssl) {
+    char i;
+    int rc;
+    rc = 0;
+    for(i = 0; i < 4; i++) {
+       if((rc = SSL_shutdown(ssl)))
+           break;
+    }
+
+    return rc;
+}
+
+static int fatal_ssl_error(int ssl_error, int where, aClient *sptr)
+{
+    /* don`t alter ERRNO */
+    int errtmp = ERRNO;
+    char *errstr = (char *)strerror(errtmp);
+    char *ssl_errstr, *ssl_func;
+
+    switch(where) {
+       case SAFE_SSL_READ:
+           ssl_func = "SSL_read()";
+           break;
+       case SAFE_SSL_WRITE:
+           ssl_func = "SSL_write()";
+           break;
+       case SAFE_SSL_ACCEPT:
+           ssl_func = "SSL_accept()";
+           break;
+       case SAFE_SSL_CONNECT:
+           ssl_func = "SSL_connect()";
+           break;
+       default:
+           ssl_func = "undefined SSL func";
+    }
+
+    switch(ssl_error) {
+       case SSL_ERROR_NONE:
+           ssl_errstr = "SSL: No error";
+           break;
+       case SSL_ERROR_SSL:
+           ssl_errstr = "Internal OpenSSL error or protocol error";
+           break;
+       case SSL_ERROR_WANT_READ:
+           ssl_errstr = "OpenSSL functions requested a read()";
+           break;
+       case SSL_ERROR_WANT_WRITE:
+           ssl_errstr = "OpenSSL functions requested a write()";
+           break;
+       case SSL_ERROR_WANT_X509_LOOKUP:
+           ssl_errstr = "OpenSSL requested a X509 lookup which didn`t arrive";
+           break;
+       case SSL_ERROR_SYSCALL:
+           ssl_errstr = "Underlying syscall error";
+           break;
+       case SSL_ERROR_ZERO_RETURN:
+           ssl_errstr = "Underlying socket operation returned zero";
+           break;
+       case SSL_ERROR_WANT_CONNECT:
+           ssl_errstr = "OpenSSL functions wanted a connect()";
+           break;
+       default:
+           ssl_errstr = "Unknown OpenSSL error (huh?)";
+    }
+    /* if we reply() something here, we might just trigger another
+     * fatal_ssl_error() call and loop until a stack overflow... 
+     * the client won`t get the ERROR : ... string, but this is
+     * the only way to do it.
+     * IRC protocol wasn`t SSL enabled .. --vejeta
+     */
+    sendto_snomask(SNO_JUNK, "Exiting ssl client %s: %s: %s",
+       sptr->name, ssl_func, ssl_errstr);
+    SET_ERRNO(errtmp ? errtmp : P_EIO); /* Stick a generic I/O error */
+    sptr->flags |= FLAGS_DEADSOCKET;
+    return -1;
+}
 
 #endif
index bca937cc8912549d9d705345ea26fda69dfb0e43..29e4fd66cf4ba21fbe1f643faa22268b9677125d 100644 (file)
Binary files a/src/ssl.rnd and b/src/ssl.rnd differ
index 8189259ee64865826b98fd9748b70fcceb1f4ba3..5c4c0eb3954c4f8ef619b2946320aa8a718494bc 100644 (file)
@@ -176,7 +176,7 @@ char *inetntoa(char *in)
 
        return buf;
 }
-
+#ifndef INET6
 #ifdef NEED_INET_NETOF
 /*
 **     inet_netof --   return the net portion of an internet number
@@ -199,7 +199,7 @@ int  inet_netof(struct IN_ADDR in)
 }
 
 #endif /* NEED_INET_NETOF */
-
+#endif
 /*
  * -1 - error on read *     >0 - number of bytes returned (<=num) *
  * After opening a fd, it is necessary to init dgets() by calling it as *
@@ -324,6 +324,8 @@ int  dgets(int fd, char *buf, int num)
 }
 
 #ifdef INET6
+
+
 /*
  * inetntop: return the : notation of a given IPv6 internet number.
  *           make sure the compressed representation (rfc 1884) isn't used.
index 9225e4252ceed4575d5b2d2ee2e3beacaa7b5a56..5f48dcda51299d0b9c98d044dedf5cb84c40a301 100644 (file)
@@ -63,204 +63,50 @@ char *infotext[] =
 char *unrealcredits[] =
 {
        "-=-=-=-=-=-=-=-=-=-= [ " IRCDTOTALVERSION " Credits ] -=-=-=-=-",
-       "The people on this list is people who have helped up through",
-       "the development of UnrealIRCd. The Unreal Team would like to thank",
-       "those people by listing them here:",
+       "The people on this list are people who have helped us with the development",
+       "of UnrealIRCd and who have made remarkable contributions to the project.",
+       "People who have helped in previous versions are listed on",
+       "http://unrealircd.com/credits.html - and not forgotten",
        "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=",
-       "              \2\37The UnrealIRCd Team would like to thank:\2\37",
-       "Nutcais (Phil Hawkins)",
-       "- the original shell for Unreal development, useful comments,",
-       "  being a real IRCbrother for me (Stskeeps) :), learning me a lot",
-       "  about IRC stuff, getting me more and more into IRCd business",
-       "  thanks for the *.tspre.org domain as well :)",
-       "",
-       "Mick and Sp^",
-       "- Amiga port of Unreal (UnrealIRCd/Amiga), continually strange",
-       "  comments on #UnrealIRCd, being great supporters of Unreal",
-       "  and following Unreal development all the way",
-       "DrBin (Dave) drbin@tspre.org",
-       "- Recoded & made the new UnrealIRCd/32 code, support,"
-       "  finding bugs, and tonnes of other stuff:)",
-       "Headbang (Melle Visser)",
-       "- Donation of ircsystems.net, hardware for Stskeeps, and for",
-       "  being a great supporter of Unreal, and helping out at the",
-       "  support channel",
-       "WonderWal (Alan Wolff)",
-       "- Sending Stskeeps Slackware 7, and Visual Studio",
-       "  helping out in the help channel, and a lot of other stuff",
-       "{X} (Laurie) x@tspre.org",
-       "- Making the main code/design of UnrealIRCd/32 gui",
-       "  bugfounds, etc",
-       "Phil Veale - email@philipveale.com - www.flame.tiefighter.org",
-       "- Donating webhosting",
-       "TheDarkOne & x-irc.net",
-       "- Development shells",
-       "RaYmAn (Jens Andersen)",
-       "- Supporting with hardware, software, movies, etc, and for",
-       "  a great friendship, and spending a lot of time with sts",
-       "",
-       "noriko             noriko@linuxsquare.net",
-       "- Giving us an OpenBSD shell to develop on :)",
-       "Anonymos           Anonymos@secretservices.net",
-       "- Shell provider, mirror, support, bugfinds",
-       "llthangel",
-       "- A good job helping with bugs/especially SJ3",
-       "",
-       "                         \37Donations to Unreal:\37",
-       "BlueFlame^",
-       " - the first UnrealIRCd donation :)",
-       "[Real] from ChatFIRST.com",
-       " - donation to UnrealIRCd project :)",
-       "Jameno123 & ByteHosting Internet Services",
-       "- Hardware donations (diskspace!)",
-       "Anonymos",
-       "- Shell donation for tspre.org",
-       "Interlink Access Corp",
-       " - donation to the UnrealIRCd development",
-       "Jan Knutar (JK@IRC)",
-       " - RAM donation, Shell donations :D, and a hell lot of other stuff",
-       "ThePlayer",
-       " - Donation to re-buy tspre.org",
-       "Thanks to Headbang and WonderWal too for hardware+software",
-       "donations",
-       "powerstorm.net",
-       " - Donating an alpha shell",
-       "   (yes your name can be here too;)",
-       "",
-       "         \37These people have helped alpha/betatesting/fixing bugs\37",
-       "zshack, Headbang, Mick, Sp^, WonderWal, bomb, BullFrog, JacobD,",
-       "SirDeath, l33, EiniD, uo, RevPsych and the subgenius.net network,",
-       "^RavenX^, Mich[a]el, {X}, Fish, Shmad, Killer, BrainSCAN, RevNull,",
-       "GoNiS, Mikey, DrBin, rapta, crow, SevenEagle, Curt|s, Scooter,",
-       "auspice, RaYmAn, Taz, HERZ, Pique, ROXnet, trinity, script0r",
-       "BiGi, [ins4ne], Zogg",
-       "",
-       "                  \2\37The UnrealIRCd Support Staff:\2\37",
-       "apt        - apt@unrealircd.info",
-       "TheEggMan  - TheEggMan@unrealircd.info",
-       "nemesis    - nemesis@unrealircd.info",
-       "Ron885     - Ron885@unrealircd.info",
-       "iDW-badSol - iDW-badSol@unrealircd.info",
-       "SciFi      - SciFi@unrealircd.info",
-       "",
-       "Thanks to former supporters, and anyone who has helped without",
-       "officially joining the staff",
-       "",
-        "                   \2\37Stskeeps would like to thank:\2\37", 
-       "Morrigan             Julie Frederiksen",
-       " - Being a friend, thinking I was cute, uhm laying on a recycle",
-       "   thing.. 'Its the wrong recycle box Julie!', 'you got too cold",
-       "   hands *freezing*', etc ;).",
-       "DJBoxy       *unknown*                *unknown*",
-       " - For getting me up from #wIRCd bringing me to Mp3fansNet and",
-       "   after we linked to Global-IRC.net - and made people choose me",
-       "   as netadmin/ircd coder - Thanx!",
-       "TC           Tabita Clausen           (reallife)",
-       " - Being a friend, always willing to watch a movie, go up in",
-       "   town with me.. be honest.. thanks for all that have been",
-       "M_Girly      Michelle Howie           *grin*",
-       " - Always with me, always in my heart, since the very start",
-       "   Thanks for being a friend in so many years, I hope I will",
-       "   never see your tears..",
-        "SL7          Steve Lake               sl7 @ austnet.org",
-        " - Bug testing, comments, lotsa ideas, wierd reactions,",
-        "   making Apollo, supporting Unreal and other freakout",
-        "   thingies, being a general wierdoe etc. ",
-       "Dark-Prince",
-       " - Systray code, sharing ideas, code, bugs, and a lot of stuff",
-       "Bleep",
-       " - The brilliant ircu win32 port",
-       "Sporty_McFly  Cedric",
-       " - Comments, helping me when I got problems with my life and so on",
-        "   *toh* to him - Thanks!",
-       "psych1ks      Ashley",
-       " - Always nice and willing to talk .. test things out, with me in",
-       "   hard times, breaking stuff for me to find and fix. All and all",
-       "   the best friend you could ever get",
-       "catgirl-tifa  Kate",
-       "  - Talking, showing me anime on a MMS stream, japanese pop music, ",
-       "    thanks for being a good friendlet",
-       "RaYmAn        (no..)",
-       " - Coming up in weekends, crazy testing, being a great friend..",
-       "   beating me in .. all games?",
-       "JK            Jan Knutar",
-       " - Being a friend, a great one. Sharing problems, and for IPv6",
-       "   testing",
-       "The Lamer Removal Task Force (lrtf.turkeyland.net)",
-       " - Well. let's see.. pissing off users.. etc etc ... etc..",
-       "evilpanda",
-       " - Hosting CVS and causing more trouble than a stone in a ant nest",
-       "^Tux^, Luke, ][rish, narf",
-       " - Luke: gotcha. ^Tux^/][rish: Inspirations for the MEXS project", 
-       "evilgoat",
-       " - When asked to clone flood development server with 200 clones",
-       "   in exchange for /credits item, he flooded #unrealircd by",
-       "   accident (or?)", 
-       "Skywalker     Chris Morley            skywalker@irc.ru.ac.za",
-       " - Helping me start up ROXnet at first (which brought me",
-       "   into IRCd business.. + Numerous kicks /Kills akills and alike;)",
-       "zero9000      Kevin Alford",
-       " - UnrealIRCd logo, graphics, null desu ;), ideas etc.",
-       "jfc           John Crowhurst",
-       " - Thanks for hosting the project for long time."
-       "HERZ",
-       " - For proving me wrong in the beta phases....",
-        "                   \2\37codemastr would like to thank:\2\37", 
-       "CaliMonk      Ivo Teel                calimonk@axenet.org",
-       " - Getting me started at NeoHorizon which basically got me",
-       "   started coding IRCd",
-       "[FBI]         Corey Lang              fbi@dal.net",
-       " - Being a good IRC friend and getting me started with",
-       "   IRC through our old little wIRCd net :)",
-       "Fish",
-       " - For converting a bunch of commands to modules",
-       "The +x 2.0 team: RaYmAn, NiQuiL, narf, Griever (great thinking)",
-       "                 eternal, bball, JK. Thanks for makin a",
-       "                 drop dead gorgeous algoritm.",
-       "",
-       "                   \2\37Griever would like to thank:\2\37",
-       "TRON          Nathan Martin          tron@t2n.org",
-       " - For first getting me interested in ircd and for all of",
-       "   the help and support, and for being a good friend :D",
-       "C_Dreamer     Richard Heathfield     cd@eton.powernet.co.uk",
-       " - For writing the best C programming manual in",
-       "   existance and teaching me to be a total pedant",
-       "   when I program :D (pedants make the best programmers btw)",
-       "The Yahoo chat Programming room regulars:",
-       " tekk, cap, angel, C_Q, scoob, strom, anon, PCS, and the",
-       " whole gang, thanks for teaching me all I know",
-       "ChibiChibi    Christina Gonzalez     chibichibi@vauss.com",
-       " For being a great first love and still a good friend :D",
-       "Rook          Daniel Lee Brabble     exile@soundtrack-central.com",
-       " - Like a big brother to me, thanks for all those heartfelt",
-       "   conversations and all those fun Descent ][ games :D",
-       "Ransom        Sean Ouimet            ransom@t2n.org (I think)",
-       " - Infinite patience on my hogging of hard drive space on his",
-       "   linux box, providing my ircd shell (which has since been", 
-       "   used for many other things)",
-       "Alcan         Andrew Church          achurch@achurch.org",
-       " - Giving me fun things to do with C and IRC, discussions about",
-       "   the intricacies of the protocol (thanks to the eso.nu ppl",
-       "   for the same reason)",
-       "Other people I don't remember",
-       "",
-       "Oh, and code and sts too, thanks for providing such a valuable",
-       "Learning experience :P~",
-       "",
-       "",                     
-       "                            \2\37Also thanks to:\2\37",
-       "Enforcer, Andy Church, Mick, Sp^, ShadowMastr, Almaris",
-       "}{, Erik/Dr|zzt, Hedge, Kyle, MissKel, jfc, Fish, kore, Syndicate, Bagge,",
-       "#Coder-Com@Undernet, ^NeVeR^, flygirl^, DannyM, JuliuZ, wah-wah^, Lisa,",
-       "Melisa, Dukemaster, NonMortal, Andryan, TomaHawk, Lushes, Skywalker, Merlin, Sporty_McFly,", 
-       "zero9000, #wIRCd@DALnet, comstud, dog3, Dianora, Isomer, and others who arent listed here:)",
-       "",
-       "------------------------------------------------------",
-       "Unreal 3.0, 3.1, 3.1.1 and up is dedicated to Morrigan",
-       "------------------------------------------------------",
-       "This IRCd is dedicated to the love that has always been",
-       "and will always be there - Thanks to the girls & friends that kept me up",
-       "when I was down",
+"      The UnrealIRCd Team would like to thank:",
+""
+"Nutcais - Phil Hawkins",
+"- the original shell for Unreal development, useful comments,",
+"  and supporting the project all through its life. Thanks for",
+"  helping to get this project to take off.",
+"",
+"Thanks for donations to:",
+"",
+"BlueFlame^ ",
+"- The first donation",
+"",
+"[Real] from ChatFIRST.com",
+"Jameno123 & ByteHosting Internet Services",
+"Interlink Access Corp, Jan Knutar, ThePlayer, Headbang",
+"noriko, powerstorm.net",
+"- Hardware, software, or financial donations - Thank you",
+"  for the support. ",
+"",
+"Phil Veale - email@phillipveale.com - http://www.flame.tiefighter.org",
+"- Donating webhosting for the project amongst other things",
+"",
+"Thanks to the supporter staff:",
+"apt, TheEggMan, nemesis, Ron885, iDw-badSol, SciFi",
+"They can be reached at nickname@unrealircd.info",
+"",
+"Thanks to former supporters and anyone who has helped",
+"without officially joining the staff.",
+"",
+"Thanks go to all current mirror & DNS hosters. We really",
+"value your donations. ",
+"",
+"Stskeeps would primarily like to thank Julie for her",
+"support through the years. See the page for a more extensive",
+"list of all the coders' credits.",
+"",
+"This IRCd is dedicated to those who have kept us rocking and", 
+"in good mood all through the years we've struggled with this"
+"project. Unreal3.0 and up is dedicated to Morrigan.",
        0
 };
 char unreallogo[] = 
index dfc62d85ae8d9ce38ce6d20530e1755aa4ea9ff6..09aba04c69dd2d78d68008ec1133b2e31a27084f 100644 (file)
@@ -1,6 +1,6 @@
 /************************************************************************
  *   IRC - Internet Relay Chat, Win32GUI.c
- *   Copyright (C) 2000-2001 David Flynn (DrBin) & Dominick Meglio (codemastr)
+ *   Copyright (C) 2000-2002 David Flynn (DrBin) & Dominick Meglio (codemastr)
  *   
  *   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
 #define IRCDTOTALVERSION BASE_VERSION PATCH1 PATCH2 PATCH3 PATCH4 PATCH5 PATCH6 PATCH7 PATCH8 PATCH9
 #endif
 
-#define WIN32_VERSION BASE_VERSION PATCH1 PATCH2 PATCH3 PATCH4 PATCH9
-#include <windows.h>
-#include <windowsx.h>
+#define WIN32_VERSION BASE_VERSION PATCH1 PATCH2 PATCH3 PATCH4
 #include "resource.h"
 #include "version.h"
 #include "setup.h"
+#ifdef INET6
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#endif
+#include <windows.h>
+#include <windowsx.h>
 #include <commctrl.h>
 #include "struct.h"
 #include "common.h"
 
 #define MIRC_COLORS "{\\colortbl ;\\red255\\green255\\blue255;\\red0\\green0\\blue127;\\red0\\green147\\blue0;\\red255\\green0\\blue0;\\red147\\green0\\blue0;\\red128\\green0\\blue128;\\red255\\green128\\blue0;\\red255\\green255\\blue0;\\red0\\green255\\blue0;\\red0\\green128\\blue128;\\red0\\green255\\blue255;\\red0\\green0\\blue252;\\red255\\green0\\blue255;\\red128\\green128\\blue128;\\red192\\green192\\blue192;\\red0\\green0\\blue0;}"
 
+/* Lazy macro */
+#define ShowDialog(handle, inst, template, parent, proc) {\
+       if (!IsWindow(handle)) { \
+               handle = CreateDialog(inst, template, parent, (DLGPROC)proc); ShowWindow(handle, SW_SHOW); \
+       }\
+       else\
+               SetForegroundWindow(handle);\
+}
 /* Comments:
  * 
  * DrBin did a great job with the original GUI, but he has been gone a long time
@@ -82,6 +94,8 @@ extern Link *Servers;
 extern ircstats IRCstats;
 char *errors = NULL, *RTFBuf = NULL;
 extern aMotd *botmotd, *opermotd, *motd, *rules;
+extern VOID WINAPI ServiceMain(DWORD dwArgc, LPTSTR *lpszArgv);
+extern BOOL IsService;
 void CleanUp(void)
 {
        Shell_NotifyIcon(NIM_DELETE ,&SysTray);
@@ -90,6 +104,7 @@ void CleanUpSegv(int sig)
 {
        Shell_NotifyIcon(NIM_DELETE ,&SysTray);
 }
+HWND hStatusWnd;
 HWND hwIRCDWnd=NULL;
 HWND hwTreeView;
 HWND hWndMod;
@@ -449,15 +464,23 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
        HWND hWnd;
        WSADATA WSAData;
        HICON hIcon;
-       InitCommonControls();
-
-       WM_TASKBARCREATED = RegisterWindowMessage("TaskbarCreated");
-       atexit(CleanUp);
-       if(!LoadLibrary("riched20.dll"))
-               LoadLibrary("riched32.dll");
-       InitStackTraceLibrary();
+       SERVICE_TABLE_ENTRY DispatchTable[] = {
+               { "UnrealIRCd", ServiceMain },
+               { 0, 0 }
+       };
+       DWORD need;
+       
        VerInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
        GetVersionEx(&VerInfo);
+       if (VerInfo.dwPlatformId == VER_PLATFORM_WIN32_NT) {
+               SC_HANDLE hService, hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_CREATE_SERVICE);
+               if ((hService = OpenService(hSCManager, "UnrealIRCd", GENERIC_READ))) {
+                       CloseServiceHandle(hService);
+                       CloseServiceHandle(hSCManager);
+                       StartServiceCtrlDispatcher(DispatchTable);
+                       exit(0);
+               }
+       }
        strcpy(OSName, "Windows ");
        if (VerInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {
                if (VerInfo.dwMajorVersion == 4) {
@@ -485,11 +508,19 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
                                strcat(OSName, "2000 ");
                        else if (VerInfo.dwMinorVersion == 1)
                                strcat(OSName, "XP ");
+                       else if (VerInfo.dwMinorVersion == 2)
+                               strcat(OSName, ".NET Server ");
                }
                strcat(OSName, VerInfo.szCSDVersion);
        }
        if (OSName[strlen(OSName)-1] == ' ')
                OSName[strlen(OSName)-1] = 0;
+       InitCommonControls();
+       WM_TASKBARCREATED = RegisterWindowMessage("TaskbarCreated");
+       atexit(CleanUp);
+       if(!LoadLibrary("riched20.dll"))
+               LoadLibrary("riched32.dll");
+       InitDebug();
 
        if (WSAStartup(MAKEWORD(1, 1), &WSAData) != 0)
        {
@@ -508,11 +539,11 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
                MessageBox(NULL, "UnrealIRCd has failed to initialize in InitwIRCD()", "UnrealIRCD Initalization Error" ,MB_OK);
                return FALSE;
        }
-
+       ShowWindow(hWnd, SW_SHOW);
        hMainThread = (HANDLE)_beginthread(SocketLoop, 0, NULL);
        while (GetMessage(&msg, NULL, 0, 0))
     {
-               if (hWndMod == NULL || !IsDialogMessage(hWndMod, &msg)) {
+               if (!IsWindow(hStatusWnd) || !IsDialogMessage(hStatusWnd, &msg)) {
                        TranslateMessage(&msg);
                        DispatchMessage(&msg);
                }
@@ -539,6 +570,7 @@ static HMENU hRehash, hAbout, hConfig, hTray, hLogs;
        switch (message)
                        {
                        case WM_INITDIALOG: {
+                               ShowWindow(hDlg, SW_HIDE);
                                hCursor = LoadCursor(hInst, MAKEINTRESOURCE(CUR_HAND));
                                hContext = GetSubMenu(LoadMenu(hInst, MAKEINTRESOURCE(MENU_CONTEXT)),0);
                                /* Rehash popup menu */
@@ -548,7 +580,6 @@ static HMENU hRehash, hAbout, hConfig, hTray, hLogs;
                                /* Systray popup menu set the items to point to the other menus*/
                                hTray = GetSubMenu(LoadMenu(hInst, MAKEINTRESOURCE(MENU_SYSTRAY)),0);
                                ModifyMenu(hTray, IDM_REHASH, MF_BYCOMMAND|MF_POPUP|MF_STRING, (UINT)hRehash, "&Rehash");
-                               ModifyMenu(hTray, IDM_CONFIG, MF_BYCOMMAND|MF_POPUP|MF_STRING, (UINT)hConfig, "&Config");
                                ModifyMenu(hTray, IDM_ABOUT, MF_BYCOMMAND|MF_POPUP|MF_STRING, (UINT)hAbout, "&About");
                                
                                SetWindowText(hDlg, WIN32_VERSION);
@@ -582,13 +613,54 @@ static HMENU hRehash, hAbout, hConfig, hTray, hLogs;
                                        case WM_RBUTTONDOWN:
                                                SetForegroundWindow(hDlg);
                                                break;
-                                       case WM_RBUTTONUP: 
+                                       case WM_RBUTTONUP: {
+                                               unsigned long i = 60000;
                                                GetCursorPos(&p);
+                                               DestroyMenu(hConfig);
+                                               hConfig = CreatePopupMenu();
+                                               DestroyMenu(hLogs);
+                                               hLogs = CreatePopupMenu();
+                                               AppendMenu(hConfig, MF_STRING, IDM_CONF, CPATH);
+                                               if (conf_log) {
+                                                       ConfigItem_log *logs;
+                                                       AppendMenu(hConfig, MF_POPUP|MF_STRING, (UINT)hLogs, "Logs");
+                                                       for (logs = conf_log; logs; logs = (ConfigItem_log *)logs->next) {
+                                                               AppendMenu(hLogs, MF_STRING, i++, logs->file);
+                                                       }
+                                               }
+                                               AppendMenu(hConfig, MF_SEPARATOR, 0, NULL);
+                                               if (conf_include) {
+                                                       ConfigItem_include *inc;
+                                                       for (inc = conf_include; inc; inc = (ConfigItem_include *)inc->next) {
+                                                               AppendMenu(hConfig, MF_STRING, i++, inc->file);
+                                                       }
+                                                       AppendMenu(hConfig, MF_SEPARATOR, 0, NULL);
+                                               }
+
+                                               AppendMenu(hConfig, MF_STRING, IDM_MOTD, MPATH);
+                                               AppendMenu(hConfig, MF_STRING, IDM_OPERMOTD, OPATH);
+                                               AppendMenu(hConfig, MF_STRING, IDM_BOTMOTD, BPATH);
+                                               AppendMenu(hConfig, MF_STRING, IDM_RULES, RPATH);
+                                               
+                                               if (conf_tld) {
+                                                       ConfigItem_tld *tlds;
+                                                       AppendMenu(hConfig, MF_SEPARATOR, 0, NULL);
+                                                       for (tlds = conf_tld; tlds; tlds = (ConfigItem_tld *)tlds->next) {
+                                                               if (!tlds->flag.motdptr)
+                                                                       AppendMenu(hConfig, MF_STRING, i++, tlds->motd_file);
+                                                               if (!tlds->flag.rulesptr)
+                                                                       AppendMenu(hConfig, MF_STRING, i++, tlds->rules_file);
+                                                       }
+                                               }
+                                               AppendMenu(hConfig, MF_SEPARATOR, 0, NULL);
+                                               AppendMenu(hConfig, MF_STRING, IDM_NEW, "New File");
+                                               ModifyMenu(hTray, IDM_CONFIG, MF_BYCOMMAND|MF_POPUP|MF_STRING, (UINT)hConfig, "&Config");
                                                TrackPopupMenu(hTray, TPM_LEFTALIGN|TPM_LEFTBUTTON,p.x,p.y,0,hDlg,NULL);
                                                /* Kludge for a win bug */
                                                SendMessage(hDlg, WM_NULL, 0, 0);
                                                break;
                                        }
+                               }
                                return 0;
                        }
                        case WM_DESTROY:
@@ -621,8 +693,8 @@ static HMENU hRehash, hAbout, hConfig, hTray, hLogs;
                                return 0;
                         }
                         else if ((p.x >= 85) && (p.x <= 132) && (p.y >= 178) && (p.y <= 190))  {
-                                DialogBox(hInst, "Status", hDlg, (DLGPROC)StatusDLG);
-                                return 0;
+                               ShowDialog(hStatusWnd, hInst, "Status", hDlg, StatusDLG);
+                               return 0;
                         }
                         else if ((p.x >= 140) && (p.x <= 186) && (p.y >= 178) && (p.y <= 190))  {
                                unsigned long i = 60000;
@@ -703,7 +775,7 @@ static HMENU hRehash, hAbout, hConfig, hTray, hLogs;
                                switch(LOWORD(wParam)) {
 
                                        case IDM_STATUS:
-                                               DialogBox(hInst, "Status", hDlg, (DLGPROC)StatusDLG);
+                                               ShowDialog(hStatusWnd, hInst, "Status", hDlg, StatusDLG);
                                                break;
                                        case IDM_SHUTDOWN:
                                                if (MessageBox(hDlg, "Close UnrealIRCd?", "Are you sure?", MB_YESNO|MB_ICONQUESTION) == IDNO)
@@ -1477,8 +1549,8 @@ LRESULT CALLBACK StatusDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
                                return (TRUE);
                        }
                case WM_CLOSE:
-                       EndDialog(hDlg, TRUE);
-                       break;
+                       DestroyWindow(hDlg);
+                       return TRUE;
                case WM_TIMER:
                                TreeView_DeleteAllItems(hwTreeView);
                                win_map(&me, hwTreeView, 1);
@@ -1500,8 +1572,10 @@ LRESULT CALLBACK StatusDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
                                SetTimer(hDlg, 1, 5000, NULL);
                                return (TRUE);
                case WM_COMMAND:
-                       if (LOWORD(wParam) == IDOK)
-                               EndDialog(hDlg, TRUE);
+                       if (LOWORD(wParam) == IDOK) {
+                               DestroyWindow(hDlg);
+                               return TRUE;
+                       }
                        break;
 
                }
@@ -1885,23 +1959,30 @@ void win_log(char *format, ...) {
                char *buf2;
         va_start(ap, format);
         ircvsprintf(buf, format, ap);
-       strcat(buf, "\r\n");
-       if (errors) {
-               buf2 = MyMalloc(strlen(errors)+strlen(buf)+1);
-               sprintf(buf2, "%s%s",errors,buf);
-               MyFree(errors);
-               errors = NULL;
+       if (!IsService) {
+               strcat(buf, "\r\n");
+               if (errors) {
+                       buf2 = MyMalloc(strlen(errors)+strlen(buf)+1);
+                       sprintf(buf2, "%s%s",errors,buf);
+                       MyFree(errors);
+                       errors = NULL;
+               }
+               else {
+                       buf2 = MyMalloc(strlen(buf)+1);
+                       sprintf(buf2, "%s",buf);
+               }
+               errors = buf2;
        }
        else {
-               buf2 = MyMalloc(strlen(buf)+1);
-               sprintf(buf2, "%s",buf);
+               FILE *fd = fopen("service.log", "a");
+               fprintf(fd, "%s\n", buf);
+               fclose(fd);
        }
-       errors = buf2;
         va_end(ap);
 }
 
 void win_error() {
-       if (errors)
+       if (errors && !IsService)
                DialogBox(hInst, "ConfigError", hwIRCDWnd, (DLGPROC)ConfigErrorDLG);
 }
 
index 412863cb953c94fabdfeb98242925a13bb08ff44..8b8346963942e05959690287138d222866e4d0e0 100644 (file)
@@ -32,7 +32,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
 
 WIRCD DIALOG DISCARDABLE  0, 0, 228, 127
 STYLE DS_MODALFRAME | DS_3DLOOK | DS_NOFAILCREATE | DS_CENTER | 
-    WS_MINIMIZEBOX | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+    WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU
 FONT 8, "MS Sans Serif"
 BEGIN
     CONTROL         130,IDC_STATIC,"Static",SS_BITMAP | SS_NOTIFY,14,10,200,
@@ -60,7 +60,7 @@ FONT 8, "MS Sans Serif"
 BEGIN
     DEFPUSHBUTTON   "OK",IDOK,134,73,50,14
     LTEXT           "Where to get help:",IDC_STATIC,14,11,60,8
-    LTEXT           "Point your IRC client to irc.unrealircd.com and join #UnrealIRCd",
+    LTEXT           "Point your IRC client to irc.unrealircd.com and join #Unreal-Support",
                     IDC_STATIC,14,20,234,9
     LTEXT           "Email us at",IDC_STATIC,14,30,37,8
     CONTROL         "coders@lists.unrealircd.org",IDC_EMAIL,"Button",
@@ -331,7 +331,7 @@ BEGIN
             VALUE "Comments", "\0"
             VALUE "CompanyName", "none\0"
             VALUE "FileDescription", "\0"
-            VALUE "FileVersion", "1.0\0"
+            VALUE "FileVersion", "3.2\0"
             VALUE "InternalName", "UnrealIRCd\0"
             VALUE "LegalCopyright", "\0"
             VALUE "LegalTrademarks", "\0"
diff --git a/src/win32/debug.c b/src/win32/debug.c
new file mode 100644 (file)
index 0000000..bf76e27
--- /dev/null
@@ -0,0 +1,221 @@
+/************************************************************************
+ *   IRC - Internet Relay Chat, win32/debug.c
+ *   Copyright (C) 2002 Dominick Meglio (codemastr)
+ *   
+ *   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
+ *   the Free Software Foundation; either version 1, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include "setup.h"
+#ifdef INET6
+#include <winsock2.h>
+#include <ws2tcpip.h>
+#endif
+#include <windows.h>
+#include <dbghelp.h>
+#include "struct.h"
+#include "h.h"
+#include "proto.h"
+#include "version.h"
+#include <string.h>
+#ifndef IRCDTOTALVERSION
+#define IRCDTOTALVERSION BASE_VERSION PATCH1 PATCH2 PATCH3 PATCH4 PATCH5 PATCH6 PATCH7 PATCH8 PATCH9
+#endif
+#define BUFFERSIZE   0x200
+extern OSVERSIONINFO VerInfo;
+extern char OSName[256];
+extern char backupbuf[8192];
+extern char *buildid;
+extern char serveropts[];
+extern char *extraflags;
+void CleanUp(void);
+extern BOOL IsService;
+
+__inline char *StackTrace(EXCEPTION_POINTERS *e) {
+       static char buffer[5000];
+       char curmodule[32];
+       DWORD symOptions, dwDisp, frame;
+       HANDLE hProcess = GetCurrentProcess();
+       IMAGEHLP_SYMBOL *pSym = malloc(sizeof(IMAGEHLP_SYMBOL)+500);
+       IMAGEHLP_LINE pLine;
+       IMAGEHLP_MODULE pMod;
+       STACKFRAME Stack;
+       Stack.AddrPC.Offset = e->ContextRecord->Eip;
+       Stack.AddrPC.Mode = AddrModeFlat;
+       Stack.AddrFrame.Offset = e->ContextRecord->Ebp;
+       Stack.AddrFrame.Mode = AddrModeFlat;
+       if (VerInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
+               hProcess = (HANDLE)GetCurrentProcessId();
+       else
+               hProcess = GetCurrentProcess(); 
+
+       SymInitialize(hProcess, NULL, TRUE);
+       SymSetOptions(SYMOPT_LOAD_LINES|SYMOPT_UNDNAME);
+       bzero(pSym, sizeof(IMAGEHLP_SYMBOL)+500);
+       pSym->SizeOfStruct = sizeof(IMAGEHLP_SYMBOL);
+       pSym->MaxNameLength = 500;
+       bzero(&pLine, sizeof(IMAGEHLP_LINE));
+       pLine.SizeOfStruct = sizeof(IMAGEHLP_LINE);
+       bzero(&pMod, sizeof(IMAGEHLP_MODULE));
+       pMod.SizeOfStruct = sizeof(IMAGEHLP_MODULE);
+       SymGetModuleInfo(hProcess, Stack.AddrPC.Offset, &pMod);
+       strcpy(curmodule, pMod.ModuleName);
+       sprintf(buffer, "\tModule: %s\n", pMod.ModuleName);
+       for (frame = 0; ; frame++) {
+               char buf[500];
+               if (!StackWalk(IMAGE_FILE_MACHINE_I386, GetCurrentProcess(), GetCurrentThread(),
+                       &Stack, NULL, NULL, SymFunctionTableAccess, SymGetModuleBase, NULL))
+                       break;
+               SymGetModuleInfo(hProcess, Stack.AddrPC.Offset, &pMod);
+               if (strcmp(curmodule, pMod.ModuleName)) {
+                       strcpy(curmodule, pMod.ModuleName);
+                       sprintf(buf, "\tModule: %s\n", pMod.ModuleName);
+                       strcat(buffer, buf);
+               }
+               SymGetLineFromAddr(hProcess, Stack.AddrPC.Offset, &dwDisp, &pLine);
+               SymGetSymFromAddr(hProcess, Stack.AddrPC.Offset, &dwDisp, pSym);
+               sprintf(buf, "\t\t#%d %s:%d: %s\n", frame, pLine.FileName, pLine.LineNumber, pSym->Name);
+               strcat(buffer, buf);
+       }
+       return buffer;
+
+}
+
+__inline char *GetRegisters(CONTEXT *context) {
+       static char buffer[1024];
+       sprintf(buffer, "\tEAX=0x%08x EBX=0x%08x ECX=0x%08x\n"
+                       "\tEDX=0x%08x ESI=0x%08x EDI=0x%08x\n"
+                       "\tEIP=0x%08x EBP=0x%08x ESP=0x%08x\n",
+                       context->Eax, context->Ebx, context->Ecx, context->Edx,
+                       context->Esi, context->Edi, context->Eip, context->Ebp,
+                       context->Esp);
+       return buffer;
+}
+
+/*__inline char *GetCpuName() {
+       static char cpuname[48];
+       __try { 
+               _asm {
+                       mov     eax,080000002h
+                       CPUID
+                       mov     DWORD PTR [cpuname+0],eax
+                       mov     DWORD PTR [cpuname+4],ebx
+                       mov     DWORD PTR [cpuname+8],ecx
+                       mov     DWORD PTR [cpuname+12],edx
+                       mov     eax,080000003h
+                       CPUID
+                       mov     DWORD PTR [cpuname+16],eax
+                       mov     DWORD PTR [cpuname+20],ebx
+                       mov     DWORD PTR [cpuname+24],ecx
+                       mov     DWORD PTR [cpuname+28],edx
+                       mov     eax,080000004h
+                       CPUID
+                       mov     DWORD PTR [cpuname+32],eax
+                       mov     DWORD PTR [cpuname+36],ebx
+                       mov     DWORD PTR [cpuname+40],ecx
+                       mov     DWORD PTR [cpuname+44],edx
+               }
+       } __except(EXCEPTION_EXECUTE_HANDLER) { return NULL; }
+       return cpuname; 
+}*/
+
+__inline char *GetException(DWORD code) {
+       switch (code) {
+               case EXCEPTION_ACCESS_VIOLATION:
+                       return "Access Violation";
+               case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
+                       return "Array Bounds Exceeded";
+               case EXCEPTION_BREAKPOINT:
+                       return "Breakpoint";
+               case EXCEPTION_DATATYPE_MISALIGNMENT:
+                       return "Datatype Misalignment";
+               case EXCEPTION_FLT_DENORMAL_OPERAND:
+                       return "Floating Point Denormal Operand";
+               case EXCEPTION_FLT_DIVIDE_BY_ZERO:
+                       return "Floating Point Division By Zero";
+               case EXCEPTION_FLT_INEXACT_RESULT:
+                       return "Floating Point Inexact Result";
+               case EXCEPTION_FLT_INVALID_OPERATION:
+                       return "Floating Point Invalid Operation";
+               case EXCEPTION_FLT_OVERFLOW:
+                       return "Floating Point Overflow";
+               case EXCEPTION_FLT_STACK_CHECK:
+                       return "Floating Point Stack Overflow";
+               case EXCEPTION_FLT_UNDERFLOW:
+                       return "Floating Point Underflow";
+               case EXCEPTION_ILLEGAL_INSTRUCTION:
+                       return "Illegal Instruction";
+               case EXCEPTION_IN_PAGE_ERROR:
+                       return "In Page Error";
+               case EXCEPTION_INT_DIVIDE_BY_ZERO:
+                       return "Integer Division By Zero";
+               case EXCEPTION_INT_OVERFLOW:
+                       return "Integer Overflow";
+               case EXCEPTION_INVALID_DISPOSITION:
+                       return "Invalid Disposition";
+               case EXCEPTION_NONCONTINUABLE_EXCEPTION:
+                       return "Noncontinuable Exception";
+               case EXCEPTION_PRIV_INSTRUCTION:
+                       return "Unallowed Instruction";
+               case EXCEPTION_SINGLE_STEP:
+                       return "Single Step";
+               case EXCEPTION_STACK_OVERFLOW:
+                       return "Stack Overflow";
+       }
+       return "Unknown Exception";
+}
+
+
+LONG __stdcall ExceptionFilter(EXCEPTION_POINTERS *e) {
+       MEMORYSTATUS memStats;
+       char file[512], text[1024];
+       FILE *fd;
+       time_t timet = time(NULL);
+       sprintf(file, "wircd.%d.core", getpid());
+       fd = fopen(file, "w");
+       GlobalMemoryStatus(&memStats);
+       fprintf(fd, "Generated at %s\n%s (%d.%d.%d)\n%s[%s%s] (%s)\n-----------------\nMemory Information:\n"
+       "\tPhysical: (Available:%ldMB/Total:%ldMB)\n\tVirtual: (Available:%ldMB/Total:%ldMB)\n"
+       "-----------------\nException:\n\t%s\n-----------------\nBackup Buffer:\n\t%s\n"
+       "-----------------\nRegisters:\n%s-----------------\nStack Trace:\n%s", asctime(gmtime(&timet)),
+       OSName, VerInfo.dwMajorVersion, VerInfo.dwMinorVersion, VerInfo.dwBuildNumber, 
+       IRCDTOTALVERSION, serveropts, extraflags ? extraflags : "", 
+       buildid, memStats.dwAvailPhys/1048576, memStats.dwTotalPhys/1048576, 
+       memStats.dwAvailVirtual/1048576, memStats.dwTotalVirtual/1048576, 
+       GetException(e->ExceptionRecord->ExceptionCode), backupbuf, 
+       GetRegisters(e->ContextRecord), StackTrace(e));
+       sprintf(text, "UnrealIRCd has encountered a fatal error. Debugging information has"
+               " been dumped to wircd.%d.core, please email this file to coders@lists.unrealircd.org.",
+               getpid());
+       if (!IsService)
+               MessageBox(NULL, text, "Fatal Error", MB_OK);
+       else {
+               FILE *fd = fopen("service.log", "a");
+               fprintf(fd, "UnrealIRCd has encountered a fatal error. Debugging information has"
+                       " been dumped to wircd.%d.core, please email this file to coders@lists.unrealircd.org.", getpid());
+               fclose(fd);
+       }
+       CleanUp();
+       fclose(fd);
+       return EXCEPTION_EXECUTE_HANDLER;
+}
+
+void InitDebug(void) {
+       SetUnhandledExceptionFilter(&ExceptionFilter);
+}
+
+void Crash() {
+       int o = 0;
+       o = 1/o;
+}
diff --git a/src/win32/debug/StackTrace.dll b/src/win32/debug/StackTrace.dll
deleted file mode 100644 (file)
index aaf29ec..0000000
Binary files a/src/win32/debug/StackTrace.dll and /dev/null differ
diff --git a/src/win32/debug/StackTrace.exp b/src/win32/debug/StackTrace.exp
deleted file mode 100644 (file)
index 66654e8..0000000
Binary files a/src/win32/debug/StackTrace.exp and /dev/null differ
diff --git a/src/win32/debug/StackTrace.lib b/src/win32/debug/StackTrace.lib
deleted file mode 100644 (file)
index f26139f..0000000
Binary files a/src/win32/debug/StackTrace.lib and /dev/null differ
diff --git a/src/win32/gpl.rtf b/src/win32/gpl.rtf
new file mode 100644 (file)
index 0000000..553333e
--- /dev/null
@@ -0,0 +1,97 @@
+{\rtf1\ansi\ansicpg1250\deff0\deflang1033\deflangfe1060{\fonttbl{\f0\fswiss\fprq2\fcharset0 Verdana;}{\f1\fmodern\fprq1\fcharset0 Lucida Console;}}
+{\colortbl ;\red0\green0\blue0;}
+\viewkind4\uc1\pard\nowidctlpar\sb100\sa100\qc\lang1060\kerning36\b\f0\fs28 GNU General Public License
+\par \kerning0\b0\fs16 Version 2, June 1991
+\par \pard\nowidctlpar\f1\fs14 
+\par Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+\par 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
+\par 
+\par Everyone is permitted to copy and distribute verbatim copies
+\par of this license document, but changing it is not allowed.
+\par 
+\par \pard\keepn\nowidctlpar\sb100\sa100\qc\cf1\b\f0\fs20 Preamble\cf0\fs24 
+\par \pard\nowidctlpar\fi142\sb100\sa100\b0\fs16 The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. 
+\par When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. 
+\par To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. 
+\par For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. 
+\par We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. 
+\par Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. 
+\par Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. 
+\par The precise terms and conditions for copying, distribution and modification follow. 
+\par \pard\keepn\nowidctlpar\sb100\sa100\qc\cf1\b\fs20 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+\par \pard\nowidctlpar\fi142\sb100\sa100\cf0\fs16 0.\b0  This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". 
+\par \pard\nowidctlpar\sb100\sa100 Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 
+\par \pard\nowidctlpar\fi142\sb100\sa100\b 1.\b0  You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. 
+\par \pard\nowidctlpar\sb100\sa100 You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 
+\par \pard\nowidctlpar\fi142\sb100\sa100\b 2.\b0  You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: 
+\par \pard\nowidctlpar\li284\sb100\sa100\b a)\b0  You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. 
+\par \b b)\b0  You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. 
+\par \b c)\b0  If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) 
+\par \pard\nowidctlpar\sb100\sa100 These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. 
+\par Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. 
+\par In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 
+\par \pard\nowidctlpar\fi142\sb100\sa100\b 3.\b0  You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: \v <!-- we use this doubled UL to get the sub-sections indented, --><!-- while making the bullets as unobvious as possible. -->\v0 
+\par \pard\nowidctlpar\li284\sb100\sa100\b a)\b0  Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, 
+\par \b b)\b0  Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, 
+\par \b c)\b0  Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) 
+\par \pard\nowidctlpar\sb100\sa100 The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. 
+\par If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 
+\par \pard\nowidctlpar\fi142\sb100\sa100\b 4.\b0  You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 
+\par \b 5.\b0  You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 
+\par \b 6.\b0  Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 
+\par \b 7.\b0  If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. 
+\par \pard\nowidctlpar\sb100\sa100 If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. 
+\par It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. 
+\par This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 
+\par \pard\nowidctlpar\fi142\sb100\sa100\b 8.\b0  If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 
+\par \b 9.\b0  The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. 
+\par \pard\nowidctlpar\sb100\sa100 Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 
+\par \pard\nowidctlpar\fi142\sb100\sa100\b 10.\b0  If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. 
+\par \pard\nowidctlpar\sb100\sa100\qc\cf1\fs20 NO WARRANTY
+\par \pard\nowidctlpar\fi142\sb100\sa100\cf0\b\fs16 11.\b0  BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 
+\par \b 12.\b0  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 
+\par \pard\keepn\nowidctlpar\sb100\sa100\qc\cf1\b END OF TERMS AND CONDITIONS
+\par \fs20 How to Apply These Terms to Your New Programs
+\par \pard\nowidctlpar\fi142\sb100\sa100\cf0\b0\fs16 If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. 
+\par To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. 
+\par \pard\nowidctlpar\li284\f1\fs14 
+\par \i one line to give the program's name and an idea of what it does.\i0 
+\par Copyright (C) \i yyyy\i0   \i name of author\i0 
+\par 
+\par This program is free software; you can redistribute it and/or
+\par modify it under the terms of the GNU General Public License
+\par as published by the Free Software Foundation; either version 2
+\par of the License, or (at your option) any later version.
+\par 
+\par This program is distributed in the hope that it will be useful,
+\par but WITHOUT ANY WARRANTY; without even the implied warranty of
+\par MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+\par GNU General Public License for more details.
+\par 
+\par You should have received a copy of the GNU General Public License
+\par along with this program; if not, write to the Free Software
+\par Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+\par 
+\par \pard\nowidctlpar\sb100\sa100\f0\fs16 Also add information on how to contact you by electronic and paper mail. 
+\par If the program is interactive, make it output a short notice like this when it starts in an interactive mode: 
+\par \pard\nowidctlpar\li284\f1\fs14 
+\par Gnomovision version 69, Copyright (C) \i year\i0  \i name of author\i0 
+\par Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
+\par type `show w'.  This is free software, and you are welcome
+\par to redistribute it under certain conditions; type `show c' 
+\par for details.
+\par 
+\par \pard\nowidctlpar\sb100\sa100\f0\fs16 The hypothetical commands \f1\fs14 `show w'\f0\fs16  and \f1\fs14 `show c'\f0\fs16  should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than \f1\fs14 `show w'\f0\fs16  and \f1\fs14 `show c'\f0\fs16 ; they could even be mouse-clicks or menu items--whatever suits your program. 
+\par You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: 
+\par \pard\nowidctlpar\li284\f1\fs14 
+\par Yoyodyne, Inc., hereby disclaims all copyright
+\par interest in the program `Gnomovision'
+\par (which makes passes at compilers) written 
+\par by James Hacker.
+\par 
+\par \i signature of Ty Coon\i0 , 1 April 1989
+\par Ty Coon, President of Vice
+\par 
+\par \pard\nowidctlpar\sb100\sa100\f0\fs16 This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. 
+\par }
+\0
\ No newline at end of file
diff --git a/src/win32/service.c b/src/win32/service.c
new file mode 100644 (file)
index 0000000..7d5c3d6
--- /dev/null
@@ -0,0 +1,153 @@
+/************************************************************************
+ *   IRC - Internet Relay Chat, win32/service.c
+ *   Copyright (C) 2002 Dominick Meglio (codemastr)
+ *   
+ *   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
+ *   the Free Software Foundation; either version 1, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+
+#include <windows.h>
+#include <winsvc.h>
+#include "struct.h"
+#include "h.h"
+#include "proto.h"
+#include "version.h"
+#include <string.h>
+
+static SERVICE_STATUS IRCDStatus; 
+static SERVICE_STATUS_HANDLE IRCDStatusHandle; 
+#define IRCD_SERVICE_CONTROL_REHASH 128
+
+BOOL IsService = FALSE;
+
+extern OSVERSIONINFO VerInfo;
+#define WIN32_VERSION BASE_VERSION PATCH1 PATCH2 PATCH3 PATCH4
+                               
+VOID WINAPI IRCDCtrlHandler(DWORD opcode) {
+       DWORD status;
+       int i;
+       aClient *acptr;
+       if (opcode == SERVICE_CONTROL_STOP) {
+               IRCDStatus.dwCurrentState = SERVICE_STOP_PENDING;
+               SetServiceStatus(IRCDStatusHandle, &IRCDStatus);
+               for (i = 0; i <= LastSlot; i++) {
+                       if (!(acptr = local[i]))
+                               continue;
+                       if (IsClient(acptr))
+                               sendto_one(acptr,
+                               ":%s %s %s :Server Terminating.",
+                                me.name, IsWebTV(acptr) ? "PRIVMSG" : "NOTICE", acptr->name);
+                       else if (IsServer(acptr))
+                               sendto_one(acptr, ":%s ERROR :Terminated", me.name);
+               }
+               unload_all_modules();
+               for (i = LastSlot; i >= 0; i--)
+                       if ((acptr = local[i]) && DBufLength(&acptr->sendQ) > 0)
+                               (void)send_queued(acptr);
+               IRCDStatus.dwWin32ExitCode = 0; 
+               IRCDStatus.dwCurrentState = SERVICE_STOPPED;
+               IRCDStatus.dwCheckPoint = 0;
+               IRCDStatus.dwWaitHint = 0;  
+               SetServiceStatus(IRCDStatusHandle, &IRCDStatus);
+       }
+       else if (opcode == IRCD_SERVICE_CONTROL_REHASH) {
+               rehash(&me,&me,0);
+       }
+
+  SetServiceStatus(IRCDStatusHandle, &IRCDStatus);
+} 
+
+VOID WINAPI ServiceMain(DWORD dwArgc, LPTSTR *lpszArgv) {
+       WSADATA WSAData;
+       DWORD error = 0;
+       char path[MAX_PATH], *folder;
+       IsService = TRUE;
+       IRCDStatus.dwServiceType = SERVICE_WIN32_OWN_PROCESS;
+       IRCDStatus.dwCurrentState = SERVICE_START_PENDING;
+       IRCDStatus.dwControlsAccepted = SERVICE_ACCEPT_STOP|SERVICE_ACCEPT_SHUTDOWN;
+       IRCDStatus.dwWin32ExitCode = NO_ERROR;
+       IRCDStatus.dwServiceSpecificExitCode = 0;
+       IRCDStatus.dwCheckPoint = 0;
+       IRCDStatus.dwWaitHint = 0;  
+       GetModuleFileName(NULL,path,MAX_PATH);
+       folder = strrchr(path, '\\');
+       *folder = 0;
+       chdir(path);
+       IRCDStatusHandle = RegisterServiceCtrlHandler("unreal", IRCDCtrlHandler);  
+       VerInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+       GetVersionEx(&VerInfo);
+       strcpy(OSName, "Windows ");
+       if (VerInfo.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) {
+               if (VerInfo.dwMajorVersion == 4) {
+                       if (VerInfo.dwMinorVersion == 0) {
+                               strcat(OSName, "95 ");
+                               if (!strcmp(VerInfo.szCSDVersion," C"))
+                                       strcat(OSName, "OSR2 ");
+                       }
+                       else if (VerInfo.dwMinorVersion == 10) {
+                               strcat(OSName, "98 ");
+                               if (!strcmp(VerInfo.szCSDVersion, " A"))
+                                       strcat(OSName, "SE ");
+                       }
+                       else if (VerInfo.dwMinorVersion == 90)
+                               strcat(OSName, "Me ");
+               }
+       }
+       else if (VerInfo.dwPlatformId == VER_PLATFORM_WIN32_NT) {
+               if (VerInfo.dwMajorVersion == 3 && VerInfo.dwMinorVersion == 51)
+                       strcat(OSName, "NT 3.51 ");
+               else if (VerInfo.dwMajorVersion == 4 && VerInfo.dwMinorVersion == 0)
+                       strcat(OSName, "NT 4.0 ");
+               else if (VerInfo.dwMajorVersion == 5) {
+                       if (VerInfo.dwMinorVersion == 0)
+                               strcat(OSName, "2000 ");
+                       else if (VerInfo.dwMinorVersion == 1)
+                               strcat(OSName, "XP ");
+                       else if (VerInfo.dwMinorVersion == 2)
+                               strcat(OSName, ".NET Server ");
+               }
+               strcat(OSName, VerInfo.szCSDVersion);
+       }
+       if (OSName[strlen(OSName)-1] == ' ')
+               OSName[strlen(OSName)-1] = 0;
+
+       if ((error = WSAStartup(MAKEWORD(1, 1), &WSAData)) != 0) {
+               IRCDStatus.dwCurrentState = SERVICE_STOPPED;
+               IRCDStatus.dwCheckPoint = 0;
+               IRCDStatus.dwWaitHint = 0;
+               IRCDStatus.dwWin32ExitCode = error;
+               IRCDStatus.dwServiceSpecificExitCode = error;
+               SetServiceStatus(IRCDStatusHandle, &IRCDStatus); 
+               return;
+       }
+       if ((error = InitwIRCD(dwArgc, lpszArgv)) != 1) {
+               IRCDStatus.dwCurrentState = SERVICE_STOPPED;
+               IRCDStatus.dwCheckPoint = 0;
+               IRCDStatus.dwWaitHint = 0;
+               IRCDStatus.dwWin32ExitCode = error;
+               IRCDStatus.dwServiceSpecificExitCode = error;
+               SetServiceStatus(IRCDStatusHandle, &IRCDStatus); 
+               return;
+       }       
+
+       IRCDStatus.dwCurrentState = SERVICE_RUNNING;
+       IRCDStatus.dwCheckPoint = 0;
+       IRCDStatus.dwWaitHint = 0;  
+
+       SetServiceStatus(IRCDStatusHandle, &IRCDStatus);
+
+       SocketLoop(0);
+       return;
+}
diff --git a/src/win32/unreal.c b/src/win32/unreal.c
new file mode 100644 (file)
index 0000000..81bf328
--- /dev/null
@@ -0,0 +1,132 @@
+/************************************************************************
+ *   IRC - Internet Relay Chat, win32/unreal.c
+ *   Copyright (C) 2002 Dominick Meglio (codemastr)
+ *   
+ *   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
+ *   the Free Software Foundation; either version 1, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <windows.h>
+#include <string.h>
+#include <stdio.h>
+
+#define IRCD_SERVICE_CONTROL_REHASH 128
+void show_usage() {
+       fprintf(stderr, "unreal start|stop|rehash|restart|install|uninstall");
+}
+
+char *show_error(DWORD code) {
+       static char buf[1024];
+       FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, code, 0, buf, 1024, NULL);
+       return buf;
+}
+
+
+int main(int argc, char *argv[]) {
+       OSVERSIONINFO VerInfo;
+       char *bslash;
+       if (argc < 2) {
+               show_usage();
+               return -1;
+                       
+       }
+       VerInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
+       GetVersionEx(&VerInfo);
+       if (!stricmp(argv[1], "install")) {
+               SC_HANDLE hService, hSCManager;
+               char path[MAX_PATH+1];
+               char binpath[MAX_PATH+1];
+               hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_CREATE_SERVICE);
+
+               if (!hSCManager) {
+                       exit(0);
+               }
+               GetModuleFileName(NULL,path,MAX_PATH);
+               if ((bslash = strrchr(path, '\\')))
+                       *bslash = 0;
+               
+               strcpy(binpath,path);
+               strcat(binpath, "\\wircd.exe");
+               hService = CreateService(hSCManager, "UnrealIRCd", "UnrealIRCd",
+                                SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS,
+                                SERVICE_AUTO_START, SERVICE_ERROR_NORMAL, binpath,
+                                NULL, NULL, NULL, NULL, NULL); 
+               if (hService) 
+                       printf("UnrealIRCd NT Service successfully installed");
+               else
+                       printf("Failed to install UnrealIRCd NT Service - %s", show_error(GetLastError()));
+               if (VerInfo.dwMajorVersion == 5) {
+                       SERVICE_DESCRIPTION info;
+                       info.lpDescription = "Internet Relay Chat Server. Allows users to chat with eachother via an IRC client.";
+                       ChangeServiceConfig2(hService, SERVICE_CONFIG_DESCRIPTION, &info);
+               }
+               CloseServiceHandle(hService);
+               CloseServiceHandle(hSCManager);
+               return 0;
+       }
+       else if (!stricmp(argv[1], "uninstall")) {
+               SC_HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
+               SC_HANDLE hService = OpenService(hSCManager, "UnrealIRCd", DELETE); 
+               if (DeleteService(hService)) 
+                       printf("UnrealIRCd NT Service successfully uninstalled");
+               else
+                       printf("Failed to uninstall UnrealIRCd NT Service - %s", show_error(GetLastError()));
+               CloseServiceHandle(hService);
+               CloseServiceHandle(hSCManager);
+               return 0;
+       }
+       else if (!stricmp(argv[1], "start")) {
+               SC_HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
+               SC_HANDLE hService = OpenService(hSCManager, "UnrealIRCd", SERVICE_START); 
+               if (StartService(hService, 0, NULL)) 
+                       printf("UnrealIRCd NT Service successfully started");
+               else
+                       printf("Failed to start UnrealIRCd NT Service - %s", show_error(GetLastError()));
+               CloseServiceHandle(hService);
+               CloseServiceHandle(hSCManager);
+               return 0;
+       }
+       else if (!stricmp(argv[1], "stop")) {
+               SERVICE_STATUS status;
+               SC_HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
+               SC_HANDLE hService = OpenService(hSCManager, "UnrealIRCd", SERVICE_STOP); 
+               ControlService(hService, SERVICE_CONTROL_STOP, &status);
+               printf("UnrealIRCd NT Service successfully stopped");
+               CloseServiceHandle(hService);
+               CloseServiceHandle(hSCManager);
+               return 0;
+       }
+       else if (!stricmp(argv[1], "restart")) {
+               SERVICE_STATUS status;
+               SC_HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
+               SC_HANDLE hService = OpenService(hSCManager, "UnrealIRCd", SERVICE_STOP|SERVICE_START); 
+               ControlService(hService, SERVICE_CONTROL_STOP, &status);
+               if (StartService(hService, 0, NULL)) 
+                       printf("UnrealIRCd NT Service successfully restarted");
+               CloseServiceHandle(hService);
+               CloseServiceHandle(hSCManager);
+               return 0;
+       }
+       else if (!stricmp(argv[1], "rehash")) {
+               SERVICE_STATUS status;
+               SC_HANDLE hSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
+               SC_HANDLE hService = OpenService(hSCManager, "UnrealIRCd", SERVICE_USER_DEFINED_CONTROL); 
+               ControlService(hService, IRCD_SERVICE_CONTROL_REHASH, &status);
+               printf("UnrealIRCd NT Service successfully rehashed");
+       }
+
+               
+                       
+}
+
diff --git a/src/win32/unreal.rc b/src/win32/unreal.rc
new file mode 100644 (file)
index 0000000..66826c5
--- /dev/null
@@ -0,0 +1,99 @@
+//Microsoft Developer Studio generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#define APSTUDIO_HIDDEN_SYMBOLS
+#include "windows.h"
+#undef APSTUDIO_HIDDEN_SYMBOLS
+#include "resource.h"
+#include "winver.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+
+#ifndef _MAC
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VER_UNREAL VERSIONINFO
+ FILEVERSION 1,0,0,0
+ PRODUCTVERSION 1,0,0,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x10004L
+ FILETYPE 0x1L
+ FILESUBTYPE 0x0L
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040904b0"
+        BEGIN
+            VALUE "Comments", "\0"
+            VALUE "CompanyName", "none\0"
+            VALUE "FileDescription", "\0"
+            VALUE "FileVersion", "1.0\0"
+            VALUE "InternalName", "UnrealIRCd Service Utility\0"
+            VALUE "LegalCopyright", "\0"
+            VALUE "LegalTrademarks", "\0"
+            VALUE "OriginalFilename", "\0"
+            VALUE "PrivateBuild", "\0"
+            VALUE "ProductName", "UnrealIRCd Service Utility\0"
+            VALUE "ProductVersion", "1.0\0"
+            VALUE "SpecialBuild", "\0"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x409, 1200
+    END
+END
+
+#endif    // !_MAC
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+ICO_MAIN                ICON    DISCARDABLE     "icon1.ico"
+
+
+#endif    // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // not APSTUDIO_INVOKED
+
diff --git a/src/win32/unrealinst.iss b/src/win32/unrealinst.iss
new file mode 100644 (file)
index 0000000..014cc0b
--- /dev/null
@@ -0,0 +1,104 @@
+; UnrealIRCd Win32 Installation Script for My Inno Setup Extensions
+
+[Setup]
+AppName=UnrealIRCd
+AppVerName=UnrealIRCd3.2-beta11
+AppPublisher=UnrealIRCd Team
+AppPublisherURL=http://www.unrealircd.com
+AppSupportURL=http://www.unrealircd.com
+AppUpdatesURL=http://www.unrealircd.com
+DefaultDirName={pf}\Unreal3.2
+DefaultGroupName=UnrealIRCd
+AllowNoIcons=yes
+LicenseFile=.\gpl.rtf
+Compression=bzip/9
+MinVersion=4.0.1111,4.0.1381
+OutputDir=../../
+
+[Tasks]
+Name: "desktopicon"; Description: "Create a &desktop icon"; GroupDescription: "Additional icons:"
+Name: "quicklaunchicon"; Description: "Create a &Quick Launch icon"; GroupDescription: "Additional icons:"; Flags: unchecked
+Name: "installservice"; Description: "Install &Service"; GroupDescription: "Service support:"; MinVersion: 0,4.0
+
+[Files]
+Source: "..\..\wircd.exe"; DestDir: "{app}"; CopyMode: alwaysoverwrite
+Source: "..\..\WIRCD.pdb"; DestDir: "{app}"; CopyMode: alwaysoverwrite
+Source: "..\..\.CHANGES.NEW"; DestDir: "{app}\CHANGES.NEW.txt"; CopyMode: alwaysoverwrite
+Source: "..\..\.CONFIG.RANT"; DestDir: "{app}\CONFIG.RANT.txt"; CopyMode: alwaysoverwrite
+Source: "..\..\.NEW_CONFIG"; DestDir: "{app}\NEW_CONFIG.txt"; CopyMode: alwaysoverwrite
+Source: "..\..\.RELEASE.NOTES"; DestDir: "{app}\RELEASE.NOTES.txt"; CopyMode: alwaysoverwrite
+Source: "..\..\.SICI"; DestDir: "{app}\SICI.txt"; CopyMode: alwaysoverwrite
+Source: "..\..\badwords.channel.conf"; DestDir: "{app}"; CopyMode: alwaysoverwrite
+Source: "..\..\badwords.message.conf"; DestDir: "{app}"; CopyMode: alwaysoverwrite
+Source: "..\..\Changes"; DestDir: "{app}"; CopyMode: alwaysoverwrite
+Source: "..\..\Changes.old"; DestDir: "{app}"; CopyMode: alwaysoverwrite
+Source: "..\..\Donation"; DestDir: "{app}"; CopyMode: alwaysoverwrite
+Source: ".\gnu_regex.dll"; DestDir: "{app}"; CopyMode: alwaysoverwrite
+Source: "..\..\help.conf"; DestDir: "{app}"; CopyMode: alwaysoverwrite
+Source: "..\..\LICENSE"; DestDir: "{app}\LICENSE.txt"; CopyMode: alwaysoverwrite
+Source: "..\..\Unreal.nfo"; DestDir: "{app}"; CopyMode: alwaysoverwrite
+Source: "..\..\doc\*.*"; DestDir: "{app}\doc"; CopyMode: alwaysoverwrite
+Source: "..\..\aliases\*"; DestDir: "{app}\aliases"; CopyMode: alwaysoverwrite
+Source: "..\..\networks\*"; DestDir: "{app}\networks"; CopyMode: alwaysoverwrite
+Source: "..\..\unreal.exe"; DestDir: "{app}"; CopyMode: alwaysoverwrite; MinVersion: 0,4.0
+Source: isxdl.dll; DestDir: {tmp}; CopyMode: dontcopy
+
+[UninstallDelete]
+Type: files; Name: "{app}\DbgHelp.Dll"
+
+[Code]
+function isxdl_Download(hWnd: Integer; URL, Filename: PChar): Integer;
+external 'isxdl_Download@files:isxdl.dll stdcall';
+function isxdl_SetOption(Option, Value: PChar): Integer;
+external 'isxdl_SetOption@files:isxdl.dll stdcall';
+const url = 'http://www.unrealircd.com/downloads/DbgHelp.Dll';
+
+function NextButtonClick(CurPage: Integer): Boolean;
+var
+dbghelp,tmp,output: String;
+m: String;
+hWnd,answer: Integer;
+begin
+  dbghelp := ExpandConstant('{sys}\DbgHelp.Dll');
+  output := ExpandConstant('{app}\DbgHelp.Dll');
+  GetVersionNumbersString(dbghelp,m);
+  if ((CurPage = wpReady) AND NOT FileExists(output)) then begin
+    if StrToInt(m[1]) < 5 then begin
+     answer := MsgBox('DbgHelp.dll version 5.0 or higher is required to install Unreal, do you wish to install it now?', mbConfirmation, MB_YESNO);
+     if answer = IDYES then begin
+      tmp := ExpandConstant('{tmp}\dbghelp.dll');
+      isxdl_SetOption('title', 'Downloading DbgHelp.dll');
+      hWnd := StrToInt(ExpandConstant('{wizardhwnd}'));
+      if isxdl_Download(hWnd, url, tmp) = 0 then
+         MsgBox('Download and installation of DbgHelp.Dll failed, the file must be manually installed. The file can be downloaded at http://www.unrealircd.com/downloads/DbgHelp.Dll', mbInformation, MB_OK);
+     end else
+       MsgBox('In order for Unreal to properly function you must manually install this dll. The dll can be downloaded from http://www.unrealircd.com/downloads/DbgHelp.Dll', mbInformation, MB_OK);
+    end;
+  end;
+  Result := true;
+end;
+procedure DeInitializeSetup();
+var
+input,output: String;
+begin
+  input := ExpandConstant('{tmp}\dbghelp.dll');
+  output := ExpandConstant('{app}\dbghelp.dll');
+  FileCopy(input, output, true);
+end;
+
+[Icons]
+Name: "{group}\UnrealIRCd"; Filename: "{app}\wircd.exe"; WorkingDir: "{app}"
+Name: "{group}\Uninstall UnrealIRCd"; Filename: "{uninstallexe}"; WorkingDir: "{app}"
+Name: "{userdesktop}\UnrealIRCd"; Filename: "{app}\wircd.exe"; WorkingDir: "{app}"; Tasks: desktopicon
+Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\UnrealIRCd"; Filename: "{app}\wircd.exe"; WorkingDir: "{app}"; Tasks: quicklaunchicon
+
+[Run]
+Filename: "notepad"; Description: "View example.conf"; Parameters: "{app}\doc\example.conf"; Flags: postinstall skipifsilent shellexec runmaximized
+Filename: "notepad"; Description: "View conf.doc"; Parameters: "{app}\doc\conf.doc"; Flags: postinstall skipifsilent shellexec runmaximized
+Filename: "notepad"; Description: "View Release Notes"; Parameters: "{app}\RELEASE.NOTES.txt"; Flags: postinstall skipifsilent shellexec runmaximized
+Filename: "notepad"; Description: "View Changes"; Parameters: "{app}\Changes"; Flags: postinstall skipifsilent shellexec runmaximized
+Filename: "{app}\unreal.exe"; Parameters: "install"; Flags: runminimized nowait; Tasks: installservice
+
+[UninstallRun]
+Filename: "{app}\unreal.exe"; Parameters: "uninstall"; Flags: runminimized; RunOnceID: "DelService"; Tasks: installservice
+
diff --git a/src/win32/unrealinstssl.iss b/src/win32/unrealinstssl.iss
new file mode 100644 (file)
index 0000000..817c251
--- /dev/null
@@ -0,0 +1,108 @@
+; UnrealIRCd Win32 Installation Script for My Inno Setup Extensions
+
+[Setup]
+AppName=UnrealIRCd
+AppVerName=UnrealIRCd3.2-beta11
+AppPublisher=UnrealIRCd Team
+AppPublisherURL=http://www.unrealircd.com
+AppSupportURL=http://www.unrealircd.com
+AppUpdatesURL=http://www.unrealircd.com
+DefaultDirName={pf}\Unreal3.2
+DefaultGroupName=UnrealIRCd
+AllowNoIcons=yes
+LicenseFile=.\gpl.rtf
+Compression=bzip/9
+MinVersion=4.0.1111,4.0.1381
+OutputDir=../../
+
+[Tasks]
+Name: "desktopicon"; Description: "Create a &desktop icon"; GroupDescription: "Additional icons:"
+Name: "quicklaunchicon"; Description: "Create a &Quick Launch icon"; GroupDescription: "Additional icons:"; Flags: unchecked
+Name: "installservice"; Description: "Install &Service"; GroupDescription: "Service support:"; MinVersion: 0,4.0
+
+[Files]
+Source: "..\..\wircd.exe"; DestDir: "{app}"; CopyMode: alwaysoverwrite
+Source: "..\..\WIRCD.pdb"; DestDir: "{app}"; CopyMode: alwaysoverwrite
+Source: "..\..\.CHANGES.NEW"; DestDir: "{app}\CHANGES.NEW.txt"; CopyMode: alwaysoverwrite
+Source: "..\..\.CONFIG.RANT"; DestDir: "{app}\CONFIG.RANT.txt"; CopyMode: alwaysoverwrite
+Source: "..\..\.NEW_CONFIG"; DestDir: "{app}\NEW_CONFIG.txt"; CopyMode: alwaysoverwrite
+Source: "..\..\.RELEASE.NOTES"; DestDir: "{app}\RELEASE.NOTES.txt"; CopyMode: alwaysoverwrite
+Source: "..\..\.SICI"; DestDir: "{app}\SICI.txt"; CopyMode: alwaysoverwrite
+Source: "..\..\badwords.channel.conf"; DestDir: "{app}"; CopyMode: alwaysoverwrite
+Source: "..\..\badwords.message.conf"; DestDir: "{app}"; CopyMode: alwaysoverwrite
+Source: "..\..\Changes"; DestDir: "{app}"; CopyMode: alwaysoverwrite
+Source: "..\..\Changes.old"; DestDir: "{app}"; CopyMode: alwaysoverwrite
+Source: "..\..\Donation"; DestDir: "{app}"; CopyMode: alwaysoverwrite
+Source: ".\gnu_regex.dll"; DestDir: "{app}"; CopyMode: alwaysoverwrite
+Source: "..\..\help.conf"; DestDir: "{app}"; CopyMode: alwaysoverwrite
+Source: "..\..\LICENSE"; DestDir: "{app}\LICENSE.txt"; CopyMode: alwaysoverwrite
+Source: "..\..\Unreal.nfo"; DestDir: "{app}"; CopyMode: alwaysoverwrite
+Source: "..\..\doc\*.*"; DestDir: "{app}\doc"; CopyMode: alwaysoverwrite
+Source: "..\..\aliases\*"; DestDir: "{app}\aliases"; CopyMode: alwaysoverwrite
+Source: "..\..\networks\*"; DestDir: "{app}\networks"; CopyMode: alwaysoverwrite
+Source: "..\..\openssl.exe"; DestDir: "{app}"; CopyMode: alwaysoverwrite
+Source: "..\..\ssleay32.dll"; DestDir: "{app}"; CopyMode: alwaysoverwrite
+Source: "..\..\libeay32.dll"; DestDir: "{app}"; CopyMode: alwaysoverwrite
+Source: ".\makecert.bat"; DestDir: "{app}"; CopyMode: alwaysoverwrite
+Source: ".\encpem.bat"; DestDir: "{app}"; CopyMode: alwaysoverwrite
+Source: "..\..\unreal.exe"; DestDir: "{app}"; CopyMode: alwaysoverwrite; MinVersion: 0,4.0
+Source: isxdl.dll; DestDir: {tmp}; CopyMode: dontcopy
+
+[UninstallDelete]
+Type: files; Name: "{app}\DbgHelp.Dll"
+
+[Code]
+function isxdl_Download(hWnd: Integer; URL, Filename: PChar): Integer;
+external 'isxdl_Download@files:isxdl.dll stdcall';
+function isxdl_SetOption(Option, Value: PChar): Integer;
+external 'isxdl_SetOption@files:isxdl.dll stdcall';
+const url = 'http://www.unrealircd.com/downloads/DbgHelp.Dll';
+
+function NextButtonClick(CurPage: Integer): Boolean;
+var
+dbghelp,tmp,output: String;
+m: String;
+hWnd,answer: Integer;
+begin
+  dbghelp := ExpandConstant('{sys}\DbgHelp.Dll');
+  output := ExpandConstant('{app}\DbgHelp.Dll');
+  GetVersionNumbersString(dbghelp,m);
+  if ((CurPage = wpReady) AND NOT FileExists(output)) then begin
+    if StrToInt(m[1]) < 5 then begin
+     answer := MsgBox('DbgHelp.dll version 5.0 or higher is required to install Unreal, do you wish to install it now?', mbConfirmation, MB_YESNO);
+     if answer = IDYES then begin
+      tmp := ExpandConstant('{tmp}\dbghelp.dll');
+      isxdl_SetOption('title', 'Downloading DbgHelp.dll');
+      hWnd := StrToInt(ExpandConstant('{wizardhwnd}'));
+      if isxdl_Download(hWnd, url, tmp) = 0 then
+         MsgBox('Download and installation of DbgHelp.Dll failed, the file must be manually installed. The file can be downloaded at http://www.unrealircd.com/downloads/DbgHelp.Dll', mbInformation, MB_OK);
+     end else
+       MsgBox('In order for Unreal to properly function you must manually install this dll. The dll can be downloaded from http://www.unrealircd.com/downloads/DbgHelp.Dll', mbInformation, MB_OK);
+    end;
+  end;
+  Result := true;
+end;
+procedure DeInitializeSetup();
+var
+input,output: String;
+begin
+  input := ExpandConstant('{tmp}\dbghelp.dll');
+  output := ExpandConstant('{app}\dbghelp.dll');
+  FileCopy(input, output, true);
+end;
+
+[Icons]
+Name: "{group}\UnrealIRCd"; Filename: "{app}\wircd.exe"; WorkingDir: "{app}"
+Name: "{group}\Uninstall UnrealIRCd"; Filename: "{uninstallexe}"; WorkingDir: "{app}"
+Name: "{userdesktop}\UnrealIRCd"; Filename: "{app}\wircd.exe"; WorkingDir: "{app}"; Tasks: desktopicon
+Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\UnrealIRCd"; Filename: "{app}\wircd.exe"; WorkingDir: "{app}"; Tasks: quicklaunchicon
+
+[Run]
+Filename: "notepad"; Description: "View example.conf"; Parameters: "{app}\doc\example.conf"; Flags: postinstall skipifsilent shellexec runmaximized
+Filename: "notepad"; Description: "View conf.doc"; Parameters: "{app}\doc\conf.doc"; Flags: postinstall skipifsilent shellexec runmaximized
+Filename: "notepad"; Description: "View Release Notes"; Parameters: "{app}\.RELEASE.NOTES"; Flags: postinstall skipifsilent shellexec runmaximized
+Filename: "notepad"; Description: "View Changes"; Parameters: "{app}\Changes"; Flags: postinstall skipifsilent shellexec runmaximized
+Filename: "{app}\unreal.exe"; Parameters: "install"; Flags: runminimized nowait; Tasks: installservice
+
+[UninstallRun]
+Filename: "{app}\unreal.exe"; Parameters: "uninstall"; Flags: runminimized; RunOnceID: "DelService"; Tasks: installservice
diff --git a/update b/update
index d8a8b1a215ce30bd09d82dbaac4bf6734d648c3e..aef3ea6c4804329620230beabc05253ad56274c5 100755 (executable)
--- a/update
+++ b/update
@@ -7,7 +7,7 @@
 # or included in any package without permission from the author.
 #
 # NO WARRANTY IS INCLUDED
-CURRENT_VERSION="Unreal3.1.1-Darkshades"
+CURRENT_VERSION="Unreal3.2-beta11"
 WHATYAWANT="wget"
 clear
 cat .UPDATE
@@ -21,13 +21,13 @@ TMP=`which wget`
 TMP2=`echo $TMP | cut -c1`
 
 if [ "$TMP2" == "/" ] ; then
-       wget http://unreal.tspre.org/update.sh
+       wget http://update.unrealircd.com/update.sh
 else
        echo "wget not found trying lynx"
-       lynx -source http://unreal.tspre.org/update.sh > update.sh
+       lynx -source http://update.unrealircd.com/update.sh > update.sh
 fi
 else
-       lynx -source http://unreal.tspre.org/update.sh > update.sh
+       lynx -source http://update.unrealircd.com/update.sh > update.sh
 fi
 
 chmod +x update.sh
diff --git a/win32 b/win32
deleted file mode 100644 (file)
index 5b6f4e2..0000000
--- a/win32
+++ /dev/null
@@ -1,35 +0,0 @@
-Changed
-To do win32 compiling
-- Copy include/win32/setup.h to include/
-- Modify config.h to suit you
-- Make settings.h to suit you
-- unzip src/win32/unrealircd.bmp.gz using your favorite program to the src/win32 dir
-- From the root dir of unreal and in a command prompt (where the make file is) run 'nmake makefile.win32'
-
-UnrealIRCd is not absolute to compile on Win32 yet
-
-Secondly, there has been a small problem with the fact that many
-users have been unsuccessful in compiling the wIRCd using MSVC 6 ...
-the problem is that as Unreal is a GUI, the header files that come
-with VC6 are out of date and need updating, as the header files in
-use are from the original win95 release sort of time, even though the
-code is compatable, things have moved on in the way of controlls so
-to compile it you will want to download the Jan2000 Platform SDK from
-ftp.microsoft.com/developr/platformsdk/jan2000/ you will want to
-probabaly down load the whole lot, but its a wee bit big (over 500mb
-for the x86 version) i will be looking up which cab files you will
-neeed, alternitivley you can try to contact M$ and i am sure that for
-the price to cover p&p or the CD they will send you it all ... if you
-are a real diplomat you will talk them into sending it and all the
-other updates to you for free.  Really to compare with the *nix
-world, its like trying to compile something that requires a later
-kernel than you have, or that your glibc is xhundred years old =).
-
-If you have any problems with that, dont understand what on earth i
-am going on about then do contact me on either #unrealircd on
-irc.ircsystems.net or you can e-mail me on this list.
-
-DrBin (Dave)
-drbin@tspre.org
-
-