[hamradio-commits] [yagiuda] 01/04: Imported Upstream version 1.19

Dave Hibberd hibby-guest at moszumanska.debian.org
Sat Sep 19 16:26:55 UTC 2015


This is an automated email from the git hooks/post-receive script.

hibby-guest pushed a commit to branch master
in repository yagiuda.

commit e8af1fc5cb90f3366bfb03dbd62c7888965ebbb6
Author: Dave Hibberd <d at vehibberd.com>
Date:   Thu Sep 3 22:48:35 2015 +0100

    Imported Upstream version 1.19
---
 AUTHORS                               |    2 +
 BUGS                                  |    4 +
 COPYING                               |  340 +++
 ChangeLog                             |  113 +
 INSTALL                               |  182 ++
 Makefile.am                           |    3 +
 Makefile.in                           |  480 +++
 NEWS                                  |   15 +
 README                                |   21 +
 TODO                                  |   30 +
 aclocal.m4                            |  785 +++++
 config.guess                          | 1363 +++++++++
 config.sub                            | 1470 +++++++++
 configure                             | 5294 +++++++++++++++++++++++++++++++++
 configure.ac                          |   31 +
 depcomp                               |  436 +++
 doc/Makefile.am                       |    1 +
 doc/Makefile.in                       |  242 ++
 doc/dipole.1.html                     |   47 +
 doc/first.1.html                      |  134 +
 doc/index.html                        |  134 +
 doc/input.1.html                      |  132 +
 doc/optimise.1.html                   |  819 +++++
 doc/output.1.html                     |  188 ++
 doc/pattern.jpg                       |  Bin 0 -> 27941 bytes
 doc/yagi.1.html                       |  138 +
 doc/yagi.jpg                          |  Bin 0 -> 8497 bytes
 install-sh                            |  251 ++
 man/Makefile.am                       |    2 +
 man/Makefile.in                       |  382 +++
 man/man1/Makefile.am                  |    2 +
 man/man1/Makefile.in                  |  292 ++
 man/man1/dipole.1                     |   42 +
 man/man1/first.1                      |   74 +
 man/man1/input.1                      |   72 +
 man/man1/optimise.1                   |  649 ++++
 man/man1/output.1                     |  154 +
 man/man1/yagi.1                       |   77 +
 man/man5/Makefile.am                  |    2 +
 man/man5/Makefile.in                  |  292 ++
 man/man5/first.5                      |   20 +
 man/man5/input.5                      |   84 +
 man/man5/optimise.5                   |   44 +
 man/man5/output.5                     |  126 +
 man/man5/yagi.5                       |   74 +
 missing                               |  336 +++
 mkinstalldirs                         |   40 +
 src/3-element-yagi                    |   15 +
 src/Makefile.am                       |   45 +
 src/Makefile.in                       |  667 +++++
 src/auto.c                            |   74 +
 src/better.c                          |   94 +
 src/change_max_percentage_changes.c   |   25 +
 src/check_flags.c                     |   86 +
 src/ci.c                              |   13 +
 src/cin.c                             |   13 +
 src/cis_hack.c                        |   84 +
 src/com_hack.c                        |  254 ++
 src/com_hack.h                        |   33 +
 src/copy_matrix.c                     |   61 +
 src/dipole.c                          |   27 +
 src/display_antenna_currents.c        |   47 +
 src/dobetter.c                        |   45 +
 src/dynamic.c                         |   46 +
 src/end_stop.c                        |   19 +
 src/error_message.c                   |   10 +
 src/fill_v_vector.c                   |   38 +
 src/fill_z_matrix.c                   |   45 +
 src/first.c                           |  107 +
 src/fitness.c                         |   51 +
 src/gain.c                            |  134 +
 src/gaussian.c                        |   34 +
 src/genetic.c                         |  158 +
 src/genetic_algorithm_lib.c           |  325 ++
 src/get_command_line_options.c        |  365 +++
 src/get_number_of_elements.c          |   72 +
 src/getfiles.c                        |   30 +
 src/getopt.c                          |  106 +
 src/globals.h                         |   16 +
 src/input.c                           |  210 ++
 src/install-sh                        |  251 ++
 src/linear.c                          |   44 +
 src/lub_hack.c                        |   25 +
 src/lud_hack.c                        |   62 +
 src/max_gain.c                        |   59 +
 src/max_side.c                        |  108 +
 src/missing                           |  190 ++
 src/mkinstalldirs                     |   40 +
 src/mpr_hack.c                        |   21 +
 src/mutual.c                          |  113 +
 src/new_length.c                      |   50 +
 src/nr_hack.h                         |   19 +
 src/nrutil.c                          |  618 ++++
 src/nrutil.h                          |  101 +
 src/optimise.c                        |  310 ++
 src/optimising_for.c                  |   60 +
 src/output.c                          |  296 ++
 src/perform.c                         |  137 +
 src/power_input.c                     |   27 +
 src/print_relavent_performance_data.c |   27 +
 src/print_z_matrix.c                  |   17 +
 src/random.c                          |   88 +
 src/randomise.c                       |  122 +
 src/rantest.c                         |   31 +
 src/read_header.c                     |   46 +
 src/read_yagi_data.c                  |   79 +
 src/reflection_coefficient.c          |   28 +
 src/self.c                            |   47 +
 src/self2.c                           |   70 +
 src/selftest.c                        |   18 +
 src/sens.c                            |   48 +
 src/set_mean_structure.c              |   26 +
 src/set_performance_structures.c      |   34 +
 src/show_all_optimise_parameters.c    |   41 +
 src/solve.c                           |  130 +
 src/string.c                          |   98 +
 src/subtract_structures.c             |   20 +
 src/test2.c                           |   81 +
 src/test_stop.c                       |   18 +
 src/usage_first.c                     |   18 +
 src/usage_input.c                     |   27 +
 src/usage_optimise.c                  |   32 +
 src/usage_output.c                    |   34 +
 src/usage_yagi.c                      |   20 +
 src/version.c                         |   12 +
 src/vswr.c                            |   28 +
 src/write_coordinates.c               |   31 +
 src/write_gain.c                      |   43 +
 src/write_gnuplot_header.c            |   41 +
 src/write_header_to_disk.c            |   33 +
 src/write_input_data.c                |   32 +
 src/yagi.c                            |  241 ++
 src/yagi.h                            |  199 ++
 src/z_input.c                         |   27 +
 src/zbr_hack.c                        |   74 +
 135 files changed, 23260 insertions(+)

diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 0000000..58a5b35
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,2 @@
+The Yagi-Uda project was written by Dr. David Kirkby, Ph.D. G8WRB.
+
diff --git a/BUGS b/BUGS
new file mode 100644
index 0000000..720a28f
--- /dev/null
+++ b/BUGS
@@ -0,0 +1,4 @@
+# All those I don't know about. 
+The main package will not handle a single dipole. 
+A new program 'dipole' has been written for this, but 
+it is a bit simplistic, as it can't plot gains etc. 
diff --git a/COPYING b/COPYING
new file mode 100644
index 0000000..d60c31a
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,340 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  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.
+
+  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.
+
+  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.
+
+  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.
+
+  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.
+
+  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.
+
+  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.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+

+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. 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".
+
+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.
+
+  1. 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.
+
+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.
+
+  2. 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:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) 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.
+
+    c) 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.)
+

+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.
+
+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.
+
+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.
+
+  3. 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:
+
+    a) 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,
+
+    b) 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,
+
+    c) 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.)
+
+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.
+
+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.
+

+  4. 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.
+
+  5. 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.
+
+  6. 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.
+
+  7. 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.
+
+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.
+
+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.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+

+  8. 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.
+
+  9. 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.
+
+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.
+
+  10. 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.
+
+			    NO WARRANTY
+
+  11. 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.
+
+  12. 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.
+
+		     END OF TERMS AND CONDITIONS
+

+	    How to Apply These Terms to Your New Programs
+
+  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.
+
+  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.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    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 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year  name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+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:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+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.
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..dde4075
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,113 @@
+Version 1.0  26th Sept 1994.
+This was the first version put onto the anonymous ftp server 
+medphys.ucl.ac.uk
+
+Version 1.01 30th Sept 1994.
+This corrected a number of problems with the original code, so that it now runs
+properly on the acc (Sun ANSI C) and gcc (GNU C/C++) compilers. The original 
+version only compiled properly only on g++ (GNU C++) and CC (Sun C++) 
+compilers. 
+
+Version 1.02 14 Oct  1994
+This release corrected a number of memory allocation errors in 'yagi', 'output'
+and 'optimise'. Memory was not always freed in earlier releases. Also, a for
+loop in all 3 programs had a calls to routines which allocated memory many 
+times, when it was only needed once. The output file now has # to mark comments,
+which the gnuplot (GNU plotting program) recognises.
+
+Version 1.03
+'optimise' was compleatly re-written, so that it no longer used lots of
+tempory files on disk. This makes it much faster (6-7x on a 6ele beam ).
+
+Version 1.04 First DOS based version.
+
+Version 1.05 26 Oct 1994.
+
+Optimise now takes lots of options. You dont need such a complex command to get it to work. There are sensible defaults. Some options dont work on optimise - '-g' , '-T' , -t' and '-p'.
+
+Version 1.06 28/10/94
+
+Released on to one user. Options 'T' and 't' now work. Genetic algorithm still does, although man page mention them.
+
+Version 1.07 31/10/94
+
+Added option '-w' that averages data of 3 frequencies to build wide-band antenna. A lot of integers for best/latest design were removed, puting them instead in a structure. 
+
+Version 1.08 5/11/94.
+
+Genetic algorithm works now. Parameters used internally (probability of crossover etc) may not be anywhere near optimum. GA does not seem to offer any real advantage, but early days yet.
+
+Added a new program 'rantest' to check the randome number generators are working
+okay.
+
+Version 1.09
+
+Added a facility in 'output' to print 3dB bandwidths. Removed printing of parameter 'F', as this is of little use and space is needed. 
+
+Changed default elements altering form only parasitic to all elements.
+
+Corrected an error in which the .gai file prints the E-plane data and H-plane data refersed.
+
+Version 1.10 Thursday 3 October 1995.
+
+Corrected a bug where 'output' would fail, due to a problem with assuming
+where the 3dB points were in the H plane. Added options '-i' so you can
+completely ignore 3dB beamwidths, also options '-E' and '-H' so you
+can specify the maximum value of theta and phi over which the beamwidths
+are calculated. A better fix, wherby the program always gets it right
+will possibly be added, but this will slow the program considerably. Needs
+some though of the best way to do this.
+
+Program now computes the maximum level of any sidelobe. Obviously
+there no point worrying about getting a good FB, if one of the other
+lobes is more significant.
+
+Version 1.11 Never released.
+
+Changed most of the things done in 1.10! The '-i' option on optimise has been droped, but insread a '-e' option was added to avoid calculation of the E-palne
+BW and a -h to avoid calculation of the H-plane BW.
+
+Version 1.12
+
+Changed GA length. eg min length can now go below 0.4 lambda. Changed 
+program 'first; to calculate the according to the well known DL6WU antennnas.
+
+fitness computed in a different was. weight.swr=1-log10(swr), rather than the
+old 1-((swr-1)/(swr+1))^2.*weight.gain.
+
+'yagi' now prints the element currents, as a row of *'s, if the -d option is
+added.
+
+Version 1.13 16th Oct 2000
+Much improved documentation. There are now some html files on my web
+site, plus all the man pages are now also in html. The code has not
+changed much since the last vesion 
+
+Version 1.14 20th October 2000
+The main change on this version has been the introduction of the 'configure' scripts, which should make the
+programme easier to build. Some minor changes to the docs have been made, to keep them upto date. 
+
+Version 1.15 21st October 2000
+Corrected an error, whereby the file 'version.c' was linked into yagi twice.
+Corrected a bug in yagi.c, whereby the dflg was not initiallised to 0.
+
+Version 1.16 23rd October 2000
+Added a -p option to output, which generates data for gnuplot.
+Updated the man pages correcting a few spelling errors in the process.
+
+Version 1.18 29/10/2000
+Generate output for gnuplot on a linear scale in addition to a log scale
+Changed the names of a few files, to be more explicit
+Cleaned up a lot of code, so gcc generates far less warnings. 
+Corrected a bug in first.c so that it works okay for non-uniform diamater elements.
+included stdlib.h if possible in all files, to remove a linux bug             
+Correct a few spelling errors in first and input.
+Changed input so it can handle antennas with different diameter elements. 
+
+Version 1.18 10/7/2005
+Added a new program 'dipole' to compute slef Z of dipole
+Changed the file structure layout, so docs are better organinsed
+made new directories man, man/man1 and man/man5
+moved .1 and .5 files to the respective directories.
+Added a couple of files that prevented 'make distcheck' from
+working. 
diff --git a/INSTALL b/INSTALL
new file mode 100644
index 0000000..b42a17a
--- /dev/null
+++ b/INSTALL
@@ -0,0 +1,182 @@
+Basic Installation
+==================
+
+   These are generic installation instructions.
+
+   The `configure' shell script attempts to guess correct values for
+various system-dependent variables used during compilation.  It uses
+those values to create a `Makefile' in each directory of the package.
+It may also create one or more `.h' files containing system-dependent
+definitions.  Finally, it creates a shell script `config.status' that
+you can run in the future to recreate the current configuration, a file
+`config.cache' that saves the results of its tests to speed up
+reconfiguring, and a file `config.log' containing compiler output
+(useful mainly for debugging `configure').
+
+   If you need to do unusual things to compile the package, please try
+to figure out how `configure' could check whether to do them, and mail
+diffs or instructions to the address given in the `README' so they can
+be considered for the next release.  If at some point `config.cache'
+contains results you don't want to keep, you may remove or edit it.
+
+   The file `configure.in' is used to create `configure' by a program
+called `autoconf'.  You only need `configure.in' if you want to change
+it or regenerate `configure' using a newer version of `autoconf'.
+
+The simplest way to compile this package is:
+
+  1. `cd' to the directory containing the package's source code and type
+     `./configure' to configure the package for your system.  If you're
+     using `csh' on an old version of System V, you might need to type
+     `sh ./configure' instead to prevent `csh' from trying to execute
+     `configure' itself.
+
+     Running `configure' takes awhile.  While running, it prints some
+     messages telling which features it is checking for.
+
+  2. Type `make' to compile the package.
+
+  3. Optionally, type `make check' to run any self-tests that come with
+     the package.
+
+  4. Type `make install' to install the programs and any data files and
+     documentation.
+
+  5. You can remove the program binaries and object files from the
+     source code directory by typing `make clean'.  To also remove the
+     files that `configure' created (so you can compile the package for
+     a different kind of computer), type `make distclean'.  There is
+     also a `make maintainer-clean' target, but that is intended mainly
+     for the package's developers.  If you use it, you may have to get
+     all sorts of other programs in order to regenerate files that came
+     with the distribution.
+
+Compilers and Options
+=====================
+
+   Some systems require unusual options for compilation or linking that
+the `configure' script does not know about.  You can give `configure'
+initial values for variables by setting them in the environment.  Using
+a Bourne-compatible shell, you can do that on the command line like
+this:
+     CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
+
+Or on systems that have the `env' program, you can do it like this:
+     env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
+
+Compiling For Multiple Architectures
+====================================
+
+   You can compile the package for more than one kind of computer at the
+same time, by placing the object files for each architecture in their
+own directory.  To do this, you must use a version of `make' that
+supports the `VPATH' variable, such as GNU `make'.  `cd' to the
+directory where you want the object files and executables to go and run
+the `configure' script.  `configure' automatically checks for the
+source code in the directory that `configure' is in and in `..'.
+
+   If you have to use a `make' that does not supports the `VPATH'
+variable, you have to compile the package for one architecture at a time
+in the source code directory.  After you have installed the package for
+one architecture, use `make distclean' before reconfiguring for another
+architecture.
+
+Installation Names
+==================
+
+   By default, `make install' will install the package's files in
+`/usr/local/bin', `/usr/local/man', etc.  You can specify an
+installation prefix other than `/usr/local' by giving `configure' the
+option `--prefix=PATH'.
+
+   You can specify separate installation prefixes for
+architecture-specific files and architecture-independent files.  If you
+give `configure' the option `--exec-prefix=PATH', the package will use
+PATH as the prefix for installing programs and libraries.
+Documentation and other data files will still use the regular prefix.
+
+   In addition, if you use an unusual directory layout you can give
+options like `--bindir=PATH' to specify different values for particular
+kinds of files.  Run `configure --help' for a list of the directories
+you can set and what kinds of files go in them.
+
+   If the package supports it, you can cause programs to be installed
+with an extra prefix or suffix on their names by giving `configure' the
+option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
+
+Optional Features
+=================
+
+   Some packages pay attention to `--enable-FEATURE' options to
+`configure', where FEATURE indicates an optional part of the package.
+They may also pay attention to `--with-PACKAGE' options, where PACKAGE
+is something like `gnu-as' or `x' (for the X Window System).  The
+`README' should mention any `--enable-' and `--with-' options that the
+package recognizes.
+
+   For packages that use the X Window System, `configure' can usually
+find the X include and library files automatically, but if it doesn't,
+you can use the `configure' options `--x-includes=DIR' and
+`--x-libraries=DIR' to specify their locations.
+
+Specifying the System Type
+==========================
+
+   There may be some features `configure' can not figure out
+automatically, but needs to determine by the type of host the package
+will run on.  Usually `configure' can figure that out, but if it prints
+a message saying it can not guess the host type, give it the
+`--host=TYPE' option.  TYPE can either be a short name for the system
+type, such as `sun4', or a canonical name with three fields:
+     CPU-COMPANY-SYSTEM
+
+See the file `config.sub' for the possible values of each field.  If
+`config.sub' isn't included in this package, then this package doesn't
+need to know the host type.
+
+   If you are building compiler tools for cross-compiling, you can also
+use the `--target=TYPE' option to select the type of system they will
+produce code for and the `--build=TYPE' option to select the type of
+system on which you are compiling the package.
+
+Sharing Defaults
+================
+
+   If you want to set default values for `configure' scripts to share,
+you can create a site shell script called `config.site' that gives
+default values for variables like `CC', `cache_file', and `prefix'.
+`configure' looks for `PREFIX/share/config.site' if it exists, then
+`PREFIX/etc/config.site' if it exists.  Or, you can set the
+`CONFIG_SITE' environment variable to the location of the site script.
+A warning: not all `configure' scripts look for a site script.
+
+Operation Controls
+==================
+
+   `configure' recognizes the following options to control how it
+operates.
+
+`--cache-file=FILE'
+     Use and save the results of the tests in FILE instead of
+     `./config.cache'.  Set FILE to `/dev/null' to disable caching, for
+     debugging `configure'.
+
+`--help'
+     Print a summary of the options to `configure', and exit.
+
+`--quiet'
+`--silent'
+`-q'
+     Do not print messages saying which checks are being made.  To
+     suppress all normal output, redirect it to `/dev/null' (any error
+     messages will still be shown).
+
+`--srcdir=DIR'
+     Look for the package's source code in directory DIR.  Usually
+     `configure' can determine that directory automatically.
+
+`--version'
+     Print the version of Autoconf used to generate the `configure'
+     script, and exit.
+
+`configure' also accepts some other, not widely useful, options.
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..719f039
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,3 @@
+SUBDIRS = . src doc man 
+
+EXTRA_DIST = BUGS TODO
diff --git a/Makefile.in b/Makefile.in
new file mode 100644
index 0000000..538eeff
--- /dev/null
+++ b/Makefile.in
@@ -0,0 +1,480 @@
+# Makefile.in generated by automake 1.7 from Makefile.am.
+# @configure_input@
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = .
+
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__quote = @am__quote@
+bindir = @bindir@
+build_alias = @build_alias@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+SUBDIRS = . src doc man 
+
+EXTRA_DIST = BUGS TODO
+subdir = .
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+
+RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
+	ps-recursive install-info-recursive uninstall-info-recursive \
+	all-recursive install-data-recursive install-exec-recursive \
+	installdirs-recursive install-recursive uninstall-recursive \
+	check-recursive installcheck-recursive
+DIST_COMMON = README AUTHORS COPYING ChangeLog INSTALL Makefile.am \
+	Makefile.in NEWS TODO aclocal.m4 config.guess config.sub \
+	configure configure.ac depcomp install-sh missing mkinstalldirs
+DIST_SUBDIRS = $(SUBDIRS)
+all: all-recursive
+
+.SUFFIXES:
+
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno
+$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.ac $(ACLOCAL_M4)
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  Makefile
+Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
+	cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)
+
+$(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+	$(SHELL) ./config.status --recheck
+$(srcdir)/configure:  $(srcdir)/configure.ac $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
+	cd $(srcdir) && $(AUTOCONF)
+
+$(ACLOCAL_M4):  configure.ac 
+	cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@set fnord $$MAKEFLAGS; amf=$$2; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+	@set fnord $$MAKEFLAGS; amf=$$2; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	done
+
+ETAGS = etags
+ETAGSFLAGS =
+
+CTAGS = ctags
+CTAGSFLAGS =
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(ETAGS_ARGS)$$tags$$unique" \
+	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	     $$tags $$unique
+
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = .
+distdir = $(PACKAGE)-$(VERSION)
+
+am__remove_distdir = \
+  { test ! -d $(distdir) \
+    || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
+         && rm -fr $(distdir); }; }
+
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
+
+distdir: $(DISTFILES)
+	$(am__remove_distdir)
+	mkdir $(distdir)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkinstalldirs) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d $(distdir)/$$subdir \
+	    || mkdir $(distdir)/$$subdir \
+	    || exit 1; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$(top_distdir)" \
+	        distdir=../$(distdir)/$$subdir \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+	-find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
+	  ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+	  ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+	  ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
+	|| chmod -R a+r $(distdir)
+dist-gzip: distdir
+	$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+	$(am__remove_distdir)
+
+dist dist-all: distdir
+	$(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+	$(am__remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration.  Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+	$(am__remove_distdir)
+	GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf -
+	chmod -R a-w $(distdir); chmod a+w $(distdir)
+	mkdir $(distdir)/=build
+	mkdir $(distdir)/=inst
+	chmod a-w $(distdir)
+	dc_install_base=`$(am__cd) $(distdir)/=inst && pwd` \
+	  && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+	  && $(mkinstalldirs) $$dc_destdir \
+	  && cd $(distdir)/=build \
+	  && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+	    $(DISTCHECK_CONFIGURE_FLAGS) \
+	  && $(MAKE) $(AM_MAKEFLAGS) \
+	  && $(MAKE) $(AM_MAKEFLAGS) dvi \
+	  && $(MAKE) $(AM_MAKEFLAGS) check \
+	  && $(MAKE) $(AM_MAKEFLAGS) install \
+	  && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+	  && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+	  && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+	        distuninstallcheck \
+	  && chmod -R a-w "$$dc_install_base" \
+	  && ({   $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+	       && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+	            distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+	      } || { rm -rf "$$dc_destdir"; exit 1; }) \
+	  && rm -rf "$$dc_destdir" \
+	  && $(MAKE) $(AM_MAKEFLAGS) dist-gzip \
+	  && rm -f $(distdir).tar.gz \
+	  && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
+	$(am__remove_distdir)
+	@echo "$(distdir).tar.gz is ready for distribution" | \
+	  sed 'h;s/./=/g;p;x;p;x'
+distuninstallcheck:
+	cd $(distuninstallcheck_dir) \
+	&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+	   || { echo "ERROR: files left after uninstall:" ; \
+	        if test -n "$(DESTDIR)"; then \
+	          echo "  (check DESTDIR support)"; \
+	        fi ; \
+	        $(distuninstallcheck_listfiles) ; \
+	        exit 1; } >&2
+distcleancheck: distclean
+	if test '$(srcdir)' = . ; then \
+	  echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+	  exit 1 ; \
+	fi
+	test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+	  || { echo "ERROR: files left in build directory after distclean:" ; \
+	       $(distcleancheck_listfiles) ; \
+	       exit 1; } >&2
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-rm -f Makefile $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-recursive
+	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+	-rm -f $(am__CONFIG_DISTCLEAN_FILES)
+	-rm -rf autom4te.cache
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \
+	clean-generic clean-recursive ctags ctags-recursive dist \
+	dist-all dist-gzip distcheck distclean distclean-generic \
+	distclean-recursive distclean-tags distcleancheck distdir \
+	distuninstallcheck dvi dvi-am dvi-recursive info info-am \
+	info-recursive install install-am install-data install-data-am \
+	install-data-recursive install-exec install-exec-am \
+	install-exec-recursive install-info install-info-am \
+	install-info-recursive install-man install-recursive \
+	install-strip installcheck installcheck-am installdirs \
+	installdirs-am installdirs-recursive maintainer-clean \
+	maintainer-clean-generic maintainer-clean-recursive mostlyclean \
+	mostlyclean-generic mostlyclean-recursive pdf pdf-am \
+	pdf-recursive ps ps-am ps-recursive tags tags-recursive \
+	uninstall uninstall-am uninstall-info-am \
+	uninstall-info-recursive uninstall-recursive
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/NEWS b/NEWS
new file mode 100644
index 0000000..ab8213d
--- /dev/null
+++ b/NEWS
@@ -0,0 +1,15 @@
+Yagiusa- 1.19 10/6/2005
+Added a new program 'dipole' that finds the impedance of a 
+simple dipole. 
+Changed the file layout, to sepparte man pages from htlm pages.
+
+YagiUda-1.1.18, 29/10/2000
+
+Generate output for gnuplot on a linear scale in addition to a log scale
+Changed the names of a few files, to be more explicit
+Cleaned up a lot of code, so gcc generates far less warnings.
+Corrected a bug in first.c so that it works okay for non-uniform diamater elements.
+included stdlib.h if possible in all files, to remove a linux bug
+Correct a few spelling errors in first and input.
+Changed input so it can handle antennas with different diameter elements.
+
diff --git a/README b/README
new file mode 100644
index 0000000..a5588ca
--- /dev/null
+++ b/README
@@ -0,0 +1,21 @@
+TITLE:  YagiUda-1.18.tar.gz
+
+PURPOSE: To analyse performance of Yagi-Uda antennas. You
+give the dimensions and positions of each element, and the
+program calculates gain, input impedance, front-to back ratio,
+beam-patterns etc. An optimisation program 'optimise' tries to
+optimise a design. The optimiser can also tell you the sensitivity
+of a good design, to small mechanical errors.
+
+AUTHOR: Dr. David Kirkby B.Sc. M.Sc. Ph.D G8WRB.
+email:david.kirkby at onetel.net
+             Department of Medical Physics,
+             University College London,
+             11-20 Capper St,
+             London WC1E 6JA.
+             Tel: 020 7679 6262 
+             Fax: 020 7679 6406 
+
+The *latest* version will be found at:
+http://www.medphys.ucl.ac.uk/~davek/ham/yagi/
+
diff --git a/TODO b/TODO
new file mode 100644
index 0000000..0e68de8
--- /dev/null
+++ b/TODO
@@ -0,0 +1,30 @@
+Here is a list of things I consider need improving in the programs, 
+as of version 1.08.
+
+
+1) Some graphical interface would be nice. I personally am not much
+into writing X or Windows software, but realise that it would be better
+if the program run under one or the other (both??). It would be nice to
+move and adjust elements with a mouse, and the program recalculate
+performance. 
+
+2) The functions that do the LU decomposition and back substitution are
+a bit wasteful of time and storage space, since they are basically real
+routines, being pushed to do complex maths. Hence  rewriting them to
+handle complex maths would be very nice.
+
+3) The optimisation routine adjusts elements randomly. Whist I feel this
+is useful, since you could otherwise reach a local optimum in
+performance, but really not have a global optimum, its rather slow. The
+option of a more intelligent optimisation algorithm (stepest decent etc)
+would be nice. The GA is one answer to this.
+
+4) Identify and remove all unknown bugs!
+
+5) Optimise parameters og the genetic algorithm (GA).
+
+If anyone intends to re-write some of the code, please e-mail me and tell
+me what you are doing. Then I will be able to keep a track of what
+people are doing. It might save duplication. If you then send me updated
+files, I'll put on an ftp site. 
+
diff --git a/aclocal.m4 b/aclocal.m4
new file mode 100644
index 0000000..bbbcf59
--- /dev/null
+++ b/aclocal.m4
@@ -0,0 +1,785 @@
+# generated automatically by aclocal 1.7 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002
+# Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+# Do all the work for Automake.                            -*- Autoconf -*-
+
+# This macro actually does too much some checks are only needed if
+# your package does certain things.  But this isn't really a big deal.
+
+# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002
+# Free Software Foundation, Inc.
+
+# 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 2, 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., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 8
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery.  Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+AC_PREREQ([2.54])
+
+# Autoconf 2.50 wants to disallow AM_ names.  We explicitly allow
+# the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out.  PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition.  After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+ AC_REQUIRE([AC_PROG_INSTALL])dnl
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+   test -f $srcdir/config.status; then
+  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+ AC_SUBST([PACKAGE], [AC_PACKAGE_TARNAME])dnl
+ AC_SUBST([VERSION], [AC_PACKAGE_VERSION])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
+ AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
+AM_MISSING_PROG(AUTOCONF, autoconf)
+AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
+AM_MISSING_PROG(AUTOHEADER, autoheader)
+AM_MISSING_PROG(MAKEINFO, makeinfo)
+AM_MISSING_PROG(AMTAR, tar)
+AM_PROG_INSTALL_SH
+AM_PROG_INSTALL_STRIP
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+                  [_AM_DEPENDENCIES(CC)],
+                  [define([AC_PROG_CC],
+                          defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+                  [_AM_DEPENDENCIES(CXX)],
+                  [define([AC_PROG_CXX],
+                          defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
+])
+])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated.  The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[_am_stamp_count=`expr ${_am_stamp_count-0} + 1`
+echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
+
+# Copyright 2002  Free Software Foundation, Inc.
+
+# 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 2, 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., 59 Temple Place - Suite 330, Boston, MA
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.7"])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION so it can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+	 [AM_AUTOMAKE_VERSION([1.7])])
+
+# Helper functions for option handling.                    -*- Autoconf -*-
+
+# Copyright 2001, 2002  Free Software Foundation, Inc.
+
+# 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 2, 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., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 2
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# ------------------------------
+# Set option NAME.  Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ----------------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+#
+# Check to make sure that the build environment is sane.
+#
+
+# Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
+
+# 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 2, 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., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 3
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   if test "$[*]" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$[*]" != "X $srcdir/configure conftest.file" \
+      && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
+alias in your environment])
+   fi
+
+   test "$[2]" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT(yes)])
+
+#  -*- Autoconf -*-
+
+
+# Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
+
+# 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 2, 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., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 3
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  AC_MSG_WARN([`missing' script is too old or missing])
+fi
+])
+
+# AM_AUX_DIR_EXPAND
+
+# Copyright 2001 Free Software Foundation, Inc.
+
+# 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 2, 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., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
+# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory.  The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run.  This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+#    fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+#    fails if $ac_aux_dir is absolute,
+#    fails when called from a subdirectory in a VPATH build with
+#          a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir.  In an in-source build this is usually
+# harmless because $srcdir is `.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
+#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+#   MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH.  The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+# Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])
+
+AC_DEFUN([AM_AUX_DIR_EXPAND], [
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+
+# Copyright 2001 Free Software Foundation, Inc.
+
+# 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 2, 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., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+AC_SUBST(install_sh)])
+
+# AM_PROG_INSTALL_STRIP
+
+# Copyright 2001 Free Software Foundation, Inc.
+
+# 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 2, 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., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# One issue with vendor `install' (even GNU) is that you can't
+# specify the program used to strip binaries.  This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in `make install-strip', and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
+if test "$cross_compiling" != no; then
+  AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# serial 4						-*- Autoconf -*-
+
+# Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
+
+# 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 2, 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., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+
+# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery.  Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
+       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
+       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
+                   [depcc="$$1"   am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+               [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+
+  am_cv_$1_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    echo '#include "conftest.h"' > conftest.c
+    echo 'int i;' > conftest.h
+    echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=conftest.c object=conftest.o \
+       depfile=conftest.Po tmpdepfile=conftest.TPo \
+       $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 &&
+       grep conftest.h conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      am_cv_$1_dependencies_compiler_type=$depmode
+      break
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES
+AC_DEFUN([AM_SET_DEPDIR],
+[rm -f .deps 2>/dev/null
+mkdir .deps 2>/dev/null
+if test -d .deps; then
+  DEPDIR=.deps
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  DEPDIR=_deps
+fi
+rmdir .deps 2>/dev/null
+AC_SUBST([DEPDIR])
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE(dependency-tracking,
+[  --disable-dependency-tracking Speeds up one-time builds
+  --enable-dependency-tracking  Do not reject slow dependency extractors])
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])
+])
+
+# Generate code to set up dependency tracking.   -*- Autoconf -*-
+
+# Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+
+# 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 2, 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., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+#serial 2
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[for mf in $CONFIG_FILES; do
+  # Strip MF so we end up with the name of the file.
+  mf=`echo "$mf" | sed -e 's/:.*$//'`
+  # Check whether this is an Automake generated Makefile or not.
+  # We used to match only the files named `Makefile.in', but
+  # some people rename them; so instead we look at the file content.
+  # Grep'ing the first line is not enough: some people post-process
+  # each Makefile.in and add a new line on top of each file to say so.
+  # So let's grep whole file.
+  if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+    dirpart=`AS_DIRNAME("$mf")`
+  else
+    continue
+  fi
+  grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue
+  # Extract the definition of DEP_FILES from the Makefile without
+  # running `make'.
+  DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
+  test -z "$DEPDIR" && continue
+  # When using ansi2knr, U may be empty or an underscore; expand it
+  U=`sed -n -e '/^U = / s///p' < "$mf"`
+  test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
+  # We invoke sed twice because it is the simplest approach to
+  # changing $(DEPDIR) to its actual value in the expansion.
+  for file in `sed -n -e '
+    /^DEP_FILES = .*\\\\$/ {
+      s/^DEP_FILES = //
+      :loop
+	s/\\\\$//
+	p
+	n
+	/\\\\$/ b loop
+      p
+    }
+    /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
+       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+    # Make sure the directory exists.
+    test -f "$dirpart/$file" && continue
+    fdir=`AS_DIRNAME(["$file"])`
+    AS_MKDIR_P([$dirpart/$fdir])
+    # echo "creating $dirpart/$file"
+    echo '# dummy' > "$dirpart/$file"
+  done
+done
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled.  FIXME.  This creates each `.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Check to see how 'make' treats includes.	-*- Autoconf -*-
+
+# Copyright (C) 2001, 2002 Free Software Foundation, Inc.
+
+# 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 2, 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., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 2
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+doit:
+	@echo done
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+   am__include=include
+   am__quote=
+   _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+      am__include=.include
+      am__quote="\""
+      _am_result=BSD
+   fi
+fi
+AC_SUBST(am__include)
+AC_SUBST(am__quote)
+AC_MSG_RESULT($_am_result)
+rm -f confinc confmf
+])
+
+# AM_CONDITIONAL                                              -*- Autoconf -*-
+
+# Copyright 1997, 2000, 2001 Free Software Foundation, Inc.
+
+# 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 2, 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., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# serial 5
+
+AC_PREREQ(2.52)
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
+        [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])
+AC_SUBST([$1_FALSE])
+if $2; then
+  $1_TRUE=
+  $1_FALSE='#'
+else
+  $1_TRUE='#'
+  $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+  AC_MSG_ERROR([conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.])
+fi])])
+
diff --git a/config.guess b/config.guess
new file mode 100644
index 0000000..f1657bb
--- /dev/null
+++ b/config.guess
@@ -0,0 +1,1363 @@
+#! /bin/sh
+# Attempt to guess a canonical system name.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002 Free Software Foundation, Inc.
+
+timestamp='2002-09-03'
+
+# This file is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Per Bothner <per at bothner.com>.
+# Please send patches to <config-patches at gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# This script attempts to guess a canonical system name similar to
+# config.sub.  If it succeeds, it prints the system name on stdout, and
+# exits with 0.  Otherwise, it exits with 1.
+#
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION]
+
+Output the configuration name of the system \`$me' is run on.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches at gnu.org>."
+
+version="\
+GNU config.guess ($timestamp)
+
+Originally written by Per Bothner.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit 0 ;;
+    --version | -v )
+       echo "$version" ; exit 0 ;;
+    --help | --h* | -h )
+       echo "$usage"; exit 0 ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help" >&2
+       exit 1 ;;
+    * )
+       break ;;
+  esac
+done
+
+if test $# != 0; then
+  echo "$me: too many arguments$help" >&2
+  exit 1
+fi
+
+trap 'exit 1' 1 2 15
+
+# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
+# compiler to aid in system detection is discouraged as it requires
+# temporary files to be created and, as you can see below, it is a
+# headache to deal with in a portable fashion.
+
+# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
+# use `HOST_CC' if defined, but it is deprecated.
+
+# This shell variable is my proudest work .. or something. --bje
+
+set_cc_for_build='tmpdir=${TMPDIR-/tmp}/config-guess-$$ ;
+(old=`umask` && umask 077 && mkdir $tmpdir && umask $old && unset old)
+   || (echo "$me: cannot create $tmpdir" >&2 && exit 1) ;
+dummy=$tmpdir/dummy ;
+files="$dummy.c $dummy.o $dummy.rel $dummy" ;
+trap '"'"'rm -f $files; rmdir $tmpdir; exit 1'"'"' 1 2 15 ;
+case $CC_FOR_BUILD,$HOST_CC,$CC in
+ ,,)    echo "int x;" > $dummy.c ;
+	for c in cc gcc c89 c99 ; do
+	  if ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; then
+	     CC_FOR_BUILD="$c"; break ;
+	  fi ;
+	done ;
+	rm -f $files ;
+	if test x"$CC_FOR_BUILD" = x ; then
+	  CC_FOR_BUILD=no_compiler_found ;
+	fi
+	;;
+ ,,*)   CC_FOR_BUILD=$CC ;;
+ ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
+esac ;
+unset files'
+
+# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
+# (ghazi at noc.rutgers.edu 1994-08-24)
+if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
+	PATH=$PATH:/.attbin ; export PATH
+fi
+
+UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
+UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
+UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
+UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+
+# Note: order is significant - the case branches are not exclusive.
+
+case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
+    *:NetBSD:*:*)
+	# NetBSD (nbsd) targets should (where applicable) match one or
+	# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
+	# *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
+	# switched to ELF, *-*-netbsd* would select the old
+	# object file format.  This provides both forward
+	# compatibility and a consistent mechanism for selecting the
+	# object file format.
+	#
+	# Note: NetBSD doesn't particularly care about the vendor
+	# portion of the name.  We always set it to "unknown".
+	sysctl="sysctl -n hw.machine_arch"
+	UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
+	    /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
+	case "${UNAME_MACHINE_ARCH}" in
+	    armeb) machine=armeb-unknown ;;
+	    arm*) machine=arm-unknown ;;
+	    sh3el) machine=shl-unknown ;;
+	    sh3eb) machine=sh-unknown ;;
+	    *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
+	esac
+	# The Operating System including object format, if it has switched
+	# to ELF recently, or will in the future.
+	case "${UNAME_MACHINE_ARCH}" in
+	    arm*|i386|m68k|ns32k|sh3*|sparc|vax)
+		eval $set_cc_for_build
+		if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
+			| grep __ELF__ >/dev/null
+		then
+		    # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
+		    # Return netbsd for either.  FIX?
+		    os=netbsd
+		else
+		    os=netbsdelf
+		fi
+		;;
+	    *)
+	        os=netbsd
+		;;
+	esac
+	# The OS release
+	release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
+	# Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
+	# contains redundant information, the shorter form:
+	# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
+	echo "${machine}-${os}${release}"
+	exit 0 ;;
+    amiga:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    arc:OpenBSD:*:*)
+	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    hp300:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mac68k:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    macppc:OpenBSD:*:*)
+	echo powerpc-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mvme68k:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mvme88k:OpenBSD:*:*)
+	echo m88k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    mvmeppc:OpenBSD:*:*)
+	echo powerpc-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    pmax:OpenBSD:*:*)
+	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    sgi:OpenBSD:*:*)
+	echo mipseb-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    sun3:OpenBSD:*:*)
+	echo m68k-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    wgrisc:OpenBSD:*:*)
+	echo mipsel-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    *:OpenBSD:*:*)
+	echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE}
+	exit 0 ;;
+    alpha:OSF1:*:*)
+	if test $UNAME_RELEASE = "V4.0"; then
+		UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
+	fi
+	# A Vn.n version is a released version.
+	# A Tn.n version is a released field test version.
+	# A Xn.n version is an unreleased experimental baselevel.
+	# 1.2 uses "1.2" for uname -r.
+	eval $set_cc_for_build
+	cat <<EOF >$dummy.s
+	.data
+\$Lformat:
+	.byte 37,100,45,37,120,10,0	# "%d-%x\n"
+
+	.text
+	.globl main
+	.align 4
+	.ent main
+main:
+	.frame \$30,16,\$26,0
+	ldgp \$29,0(\$27)
+	.prologue 1
+	.long 0x47e03d80 # implver \$0
+	lda \$2,-1
+	.long 0x47e20c21 # amask \$2,\$1
+	lda \$16,\$Lformat
+	mov \$0,\$17
+	not \$1,\$18
+	jsr \$26,printf
+	ldgp \$29,0(\$26)
+	mov 0,\$16
+	jsr \$26,exit
+	.end main
+EOF
+	$CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null
+	if test "$?" = 0 ; then
+		case `$dummy` in
+			0-0)
+				UNAME_MACHINE="alpha"
+				;;
+			1-0)
+				UNAME_MACHINE="alphaev5"
+				;;
+			1-1)
+				UNAME_MACHINE="alphaev56"
+				;;
+			1-101)
+				UNAME_MACHINE="alphapca56"
+				;;
+			2-303)
+				UNAME_MACHINE="alphaev6"
+				;;
+			2-307)
+				UNAME_MACHINE="alphaev67"
+				;;
+			2-1307)
+				UNAME_MACHINE="alphaev68"
+				;;
+			3-1307)
+				UNAME_MACHINE="alphaev7"
+				;;
+		esac
+	fi
+	rm -f $dummy.s $dummy && rmdir $tmpdir
+	echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+	exit 0 ;;
+    Alpha\ *:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# Should we change UNAME_MACHINE based on the output of uname instead
+	# of the specific Alpha model?
+	echo alpha-pc-interix
+	exit 0 ;;
+    21064:Windows_NT:50:3)
+	echo alpha-dec-winnt3.5
+	exit 0 ;;
+    Amiga*:UNIX_System_V:4.0:*)
+	echo m68k-unknown-sysv4
+	exit 0;;
+    *:[Aa]miga[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-amigaos
+	exit 0 ;;
+    *:[Mm]orph[Oo][Ss]:*:*)
+	echo ${UNAME_MACHINE}-unknown-morphos
+	exit 0 ;;
+    *:OS/390:*:*)
+	echo i370-ibm-openedition
+	exit 0 ;;
+    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
+	echo arm-acorn-riscix${UNAME_RELEASE}
+	exit 0;;
+    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
+	echo hppa1.1-hitachi-hiuxmpp
+	exit 0;;
+    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
+	# akee at wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
+	if test "`(/bin/universe) 2>/dev/null`" = att ; then
+		echo pyramid-pyramid-sysv3
+	else
+		echo pyramid-pyramid-bsd
+	fi
+	exit 0 ;;
+    NILE*:*:*:dcosx)
+	echo pyramid-pyramid-svr4
+	exit 0 ;;
+    DRS?6000:UNIX_SV:4.2*:7*)
+	case `/usr/bin/uname -p` in
+	    sparc) echo sparc-icl-nx7 && exit 0 ;;
+	esac ;;
+    sun4H:SunOS:5.*:*)
+	echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit 0 ;;
+    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
+	echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit 0 ;;
+    i86pc:SunOS:5.*:*)
+	echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit 0 ;;
+    sun4*:SunOS:6*:*)
+	# According to config.sub, this is the proper way to canonicalize
+	# SunOS6.  Hard to guess exactly what SunOS6 will be like, but
+	# it's likely to be more like Solaris than SunOS4.
+	echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit 0 ;;
+    sun4*:SunOS:*:*)
+	case "`/usr/bin/arch -k`" in
+	    Series*|S4*)
+		UNAME_RELEASE=`uname -v`
+		;;
+	esac
+	# Japanese Language versions have a version number like `4.1.3-JL'.
+	echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
+	exit 0 ;;
+    sun3*:SunOS:*:*)
+	echo m68k-sun-sunos${UNAME_RELEASE}
+	exit 0 ;;
+    sun*:*:4.2BSD:*)
+	UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
+	test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
+	case "`/bin/arch`" in
+	    sun3)
+		echo m68k-sun-sunos${UNAME_RELEASE}
+		;;
+	    sun4)
+		echo sparc-sun-sunos${UNAME_RELEASE}
+		;;
+	esac
+	exit 0 ;;
+    aushp:SunOS:*:*)
+	echo sparc-auspex-sunos${UNAME_RELEASE}
+	exit 0 ;;
+    # The situation for MiNT is a little confusing.  The machine name
+    # can be virtually everything (everything which is not
+    # "atarist" or "atariste" at least should have a processor
+    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
+    # to the lowercase version "mint" (or "freemint").  Finally
+    # the system name "TOS" denotes a system which is actually not
+    # MiNT.  But MiNT is downward compatible to TOS, so this should
+    # be no problem.
+    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit 0 ;;
+    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
+	echo m68k-atari-mint${UNAME_RELEASE}
+        exit 0 ;;
+    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
+        echo m68k-atari-mint${UNAME_RELEASE}
+	exit 0 ;;
+    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
+        echo m68k-milan-mint${UNAME_RELEASE}
+        exit 0 ;;
+    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
+        echo m68k-hades-mint${UNAME_RELEASE}
+        exit 0 ;;
+    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
+        echo m68k-unknown-mint${UNAME_RELEASE}
+        exit 0 ;;
+    powerpc:machten:*:*)
+	echo powerpc-apple-machten${UNAME_RELEASE}
+	exit 0 ;;
+    RISC*:Mach:*:*)
+	echo mips-dec-mach_bsd4.3
+	exit 0 ;;
+    RISC*:ULTRIX:*:*)
+	echo mips-dec-ultrix${UNAME_RELEASE}
+	exit 0 ;;
+    VAX*:ULTRIX*:*:*)
+	echo vax-dec-ultrix${UNAME_RELEASE}
+	exit 0 ;;
+    2020:CLIX:*:* | 2430:CLIX:*:*)
+	echo clipper-intergraph-clix${UNAME_RELEASE}
+	exit 0 ;;
+    mips:*:*:UMIPS | mips:*:*:RISCos)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+#ifdef __cplusplus
+#include <stdio.h>  /* for printf() prototype */
+	int main (int argc, char *argv[]) {
+#else
+	int main (argc, argv) int argc; char *argv[]; {
+#endif
+	#if defined (host_mips) && defined (MIPSEB)
+	#if defined (SYSTYPE_SYSV)
+	  printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_SVR4)
+	  printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
+	#endif
+	#if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
+	  printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
+	#endif
+	#endif
+	  exit (-1);
+	}
+EOF
+	$CC_FOR_BUILD $dummy.c -o $dummy \
+	  && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \
+	  && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+	rm -f $dummy.c $dummy && rmdir $tmpdir
+	echo mips-mips-riscos${UNAME_RELEASE}
+	exit 0 ;;
+    Motorola:PowerMAX_OS:*:*)
+	echo powerpc-motorola-powermax
+	exit 0 ;;
+    Motorola:*:4.3:PL8-*)
+	echo powerpc-harris-powermax
+	exit 0 ;;
+    Night_Hawk:*:*:PowerMAX_OS)
+	echo powerpc-harris-powermax
+	exit 0 ;;
+    Night_Hawk:Power_UNIX:*:*)
+	echo powerpc-harris-powerunix
+	exit 0 ;;
+    m88k:CX/UX:7*:*)
+	echo m88k-harris-cxux7
+	exit 0 ;;
+    m88k:*:4*:R4*)
+	echo m88k-motorola-sysv4
+	exit 0 ;;
+    m88k:*:3*:R3*)
+	echo m88k-motorola-sysv3
+	exit 0 ;;
+    AViiON:dgux:*:*)
+        # DG/UX returns AViiON for all architectures
+        UNAME_PROCESSOR=`/usr/bin/uname -p`
+	if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
+	then
+	    if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
+	       [ ${TARGET_BINARY_INTERFACE}x = x ]
+	    then
+		echo m88k-dg-dgux${UNAME_RELEASE}
+	    else
+		echo m88k-dg-dguxbcs${UNAME_RELEASE}
+	    fi
+	else
+	    echo i586-dg-dgux${UNAME_RELEASE}
+	fi
+ 	exit 0 ;;
+    M88*:DolphinOS:*:*)	# DolphinOS (SVR3)
+	echo m88k-dolphin-sysv3
+	exit 0 ;;
+    M88*:*:R3*:*)
+	# Delta 88k system running SVR3
+	echo m88k-motorola-sysv3
+	exit 0 ;;
+    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
+	echo m88k-tektronix-sysv3
+	exit 0 ;;
+    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
+	echo m68k-tektronix-bsd
+	exit 0 ;;
+    *:IRIX*:*:*)
+	echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
+	exit 0 ;;
+    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
+	echo romp-ibm-aix      # uname -m gives an 8 hex-code CPU id
+	exit 0 ;;              # Note that: echo "'`uname -s`'" gives 'AIX '
+    i*86:AIX:*:*)
+	echo i386-ibm-aix
+	exit 0 ;;
+    ia64:AIX:*:*)
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
+	exit 0 ;;
+    *:AIX:2:3)
+	if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
+		eval $set_cc_for_build
+		sed 's/^		//' << EOF >$dummy.c
+		#include <sys/systemcfg.h>
+
+		main()
+			{
+			if (!__power_pc())
+				exit(1);
+			puts("powerpc-ibm-aix3.2.5");
+			exit(0);
+			}
+EOF
+		$CC_FOR_BUILD $dummy.c -o $dummy && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+		rm -f $dummy.c $dummy && rmdir $tmpdir
+		echo rs6000-ibm-aix3.2.5
+	elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
+		echo rs6000-ibm-aix3.2.4
+	else
+		echo rs6000-ibm-aix3.2
+	fi
+	exit 0 ;;
+    *:AIX:*:[45])
+	IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
+	if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
+		IBM_ARCH=rs6000
+	else
+		IBM_ARCH=powerpc
+	fi
+	if [ -x /usr/bin/oslevel ] ; then
+		IBM_REV=`/usr/bin/oslevel`
+	else
+		IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
+	fi
+	echo ${IBM_ARCH}-ibm-aix${IBM_REV}
+	exit 0 ;;
+    *:AIX:*:*)
+	echo rs6000-ibm-aix
+	exit 0 ;;
+    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
+	echo romp-ibm-bsd4.4
+	exit 0 ;;
+    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
+	echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
+	exit 0 ;;                           # report: romp-ibm BSD 4.3
+    *:BOSX:*:*)
+	echo rs6000-bull-bosx
+	exit 0 ;;
+    DPX/2?00:B.O.S.:*:*)
+	echo m68k-bull-sysv3
+	exit 0 ;;
+    9000/[34]??:4.3bsd:1.*:*)
+	echo m68k-hp-bsd
+	exit 0 ;;
+    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
+	echo m68k-hp-bsd4.4
+	exit 0 ;;
+    9000/[34678]??:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	case "${UNAME_MACHINE}" in
+	    9000/31? )            HP_ARCH=m68000 ;;
+	    9000/[34]?? )         HP_ARCH=m68k ;;
+	    9000/[678][0-9][0-9])
+		if [ -x /usr/bin/getconf ]; then
+		    sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
+                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+                    case "${sc_cpu_version}" in
+                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+                      532)                      # CPU_PA_RISC2_0
+                        case "${sc_kernel_bits}" in
+                          32) HP_ARCH="hppa2.0n" ;;
+                          64) HP_ARCH="hppa2.0w" ;;
+			  '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
+                        esac ;;
+                    esac
+		fi
+		if [ "${HP_ARCH}" = "" ]; then
+		    eval $set_cc_for_build
+		    sed 's/^              //' << EOF >$dummy.c
+
+              #define _HPUX_SOURCE
+              #include <stdlib.h>
+              #include <unistd.h>
+
+              int main ()
+              {
+              #if defined(_SC_KERNEL_BITS)
+                  long bits = sysconf(_SC_KERNEL_BITS);
+              #endif
+                  long cpu  = sysconf (_SC_CPU_VERSION);
+
+                  switch (cpu)
+              	{
+              	case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+              	case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+              	case CPU_PA_RISC2_0:
+              #if defined(_SC_KERNEL_BITS)
+              	    switch (bits)
+              		{
+              		case 64: puts ("hppa2.0w"); break;
+              		case 32: puts ("hppa2.0n"); break;
+              		default: puts ("hppa2.0"); break;
+              		} break;
+              #else  /* !defined(_SC_KERNEL_BITS) */
+              	    puts ("hppa2.0"); break;
+              #endif
+              	default: puts ("hppa1.0"); break;
+              	}
+                  exit (0);
+              }
+EOF
+		    (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`$dummy`
+		    if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi
+		    rm -f $dummy.c $dummy && rmdir $tmpdir
+		fi ;;
+	esac
+	echo ${HP_ARCH}-hp-hpux${HPUX_REV}
+	exit 0 ;;
+    ia64:HP-UX:*:*)
+	HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
+	echo ia64-hp-hpux${HPUX_REV}
+	exit 0 ;;
+    3050*:HI-UX:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <unistd.h>
+	int
+	main ()
+	{
+	  long cpu = sysconf (_SC_CPU_VERSION);
+	  /* The order matters, because CPU_IS_HP_MC68K erroneously returns
+	     true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
+	     results, however.  */
+	  if (CPU_IS_PA_RISC (cpu))
+	    {
+	      switch (cpu)
+		{
+		  case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
+		  case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
+		  default: puts ("hppa-hitachi-hiuxwe2"); break;
+		}
+	    }
+	  else if (CPU_IS_HP_MC68K (cpu))
+	    puts ("m68k-hitachi-hiuxwe2");
+	  else puts ("unknown-hitachi-hiuxwe2");
+	  exit (0);
+	}
+EOF
+	$CC_FOR_BUILD $dummy.c -o $dummy && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+	rm -f $dummy.c $dummy && rmdir $tmpdir
+	echo unknown-hitachi-hiuxwe2
+	exit 0 ;;
+    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
+	echo hppa1.1-hp-bsd
+	exit 0 ;;
+    9000/8??:4.3bsd:*:*)
+	echo hppa1.0-hp-bsd
+	exit 0 ;;
+    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
+	echo hppa1.0-hp-mpeix
+	exit 0 ;;
+    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
+	echo hppa1.1-hp-osf
+	exit 0 ;;
+    hp8??:OSF1:*:*)
+	echo hppa1.0-hp-osf
+	exit 0 ;;
+    i*86:OSF1:*:*)
+	if [ -x /usr/sbin/sysversion ] ; then
+	    echo ${UNAME_MACHINE}-unknown-osf1mk
+	else
+	    echo ${UNAME_MACHINE}-unknown-osf1
+	fi
+	exit 0 ;;
+    parisc*:Lites*:*:*)
+	echo hppa1.1-hp-lites
+	exit 0 ;;
+    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
+	echo c1-convex-bsd
+        exit 0 ;;
+    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+        exit 0 ;;
+    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
+	echo c34-convex-bsd
+        exit 0 ;;
+    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
+	echo c38-convex-bsd
+        exit 0 ;;
+    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
+	echo c4-convex-bsd
+        exit 0 ;;
+    CRAY*Y-MP:*:*:*)
+	echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit 0 ;;
+    CRAY*[A-Z]90:*:*:*)
+	echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
+	| sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
+	      -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
+	      -e 's/\.[^.]*$/.X/'
+	exit 0 ;;
+    CRAY*TS:*:*:*)
+	echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit 0 ;;
+    CRAY*T3D:*:*:*)
+	echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit 0 ;;
+    CRAY*T3E:*:*:*)
+	echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit 0 ;;
+    CRAY*SV1:*:*:*)
+	echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
+	exit 0 ;;
+    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
+	FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
+        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+        exit 0 ;;
+    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
+	echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
+	exit 0 ;;
+    sparc*:BSD/OS:*:*)
+	echo sparc-unknown-bsdi${UNAME_RELEASE}
+	exit 0 ;;
+    *:BSD/OS:*:*)
+	echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
+	exit 0 ;;
+    *:FreeBSD:*:*)
+	# Determine whether the default compiler uses glibc.
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <features.h>
+	#if __GLIBC__ >= 2
+	LIBC=gnu
+	#else
+	LIBC=
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+	rm -f $dummy.c && rmdir $tmpdir
+	echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC}
+	exit 0 ;;
+    i*:CYGWIN*:*)
+	echo ${UNAME_MACHINE}-pc-cygwin
+	exit 0 ;;
+    i*:MINGW*:*)
+	echo ${UNAME_MACHINE}-pc-mingw32
+	exit 0 ;;
+    i*:PW*:*)
+	echo ${UNAME_MACHINE}-pc-pw32
+	exit 0 ;;
+    x86:Interix*:3*)
+	echo i386-pc-interix3
+	exit 0 ;;
+    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
+	# How do we know it's Interix rather than the generic POSIX subsystem?
+	# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
+	# UNAME_MACHINE based on the output of uname instead of i386?
+	echo i386-pc-interix
+	exit 0 ;;
+    i*:UWIN*:*)
+	echo ${UNAME_MACHINE}-pc-uwin
+	exit 0 ;;
+    p*:CYGWIN*:*)
+	echo powerpcle-unknown-cygwin
+	exit 0 ;;
+    prep*:SunOS:5.*:*)
+	echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+	exit 0 ;;
+    *:GNU:*:*)
+	echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+	exit 0 ;;
+    i*86:Minix:*:*)
+	echo ${UNAME_MACHINE}-pc-minix
+	exit 0 ;;
+    arm*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    ia64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    m68*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    mips:Linux:*:*)
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#undef CPU
+	#undef mips
+	#undef mipsel
+	#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+	CPU=mipsel
+	#else
+	#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+	CPU=mips
+	#else
+	CPU=
+	#endif
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
+	rm -f $dummy.c && rmdir $tmpdir
+	test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0
+	;;
+    ppc:Linux:*:*)
+	echo powerpc-unknown-linux-gnu
+	exit 0 ;;
+    ppc64:Linux:*:*)
+	echo powerpc64-unknown-linux-gnu
+	exit 0 ;;
+    alpha:Linux:*:*)
+	case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+	  EV5)   UNAME_MACHINE=alphaev5 ;;
+	  EV56)  UNAME_MACHINE=alphaev56 ;;
+	  PCA56) UNAME_MACHINE=alphapca56 ;;
+	  PCA57) UNAME_MACHINE=alphapca56 ;;
+	  EV6)   UNAME_MACHINE=alphaev6 ;;
+	  EV67)  UNAME_MACHINE=alphaev67 ;;
+	  EV68*) UNAME_MACHINE=alphaev68 ;;
+        esac
+	objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+	if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+	echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+	exit 0 ;;
+    parisc:Linux:*:* | hppa:Linux:*:*)
+	# Look for CPU level
+	case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
+	  PA7*) echo hppa1.1-unknown-linux-gnu ;;
+	  PA8*) echo hppa2.0-unknown-linux-gnu ;;
+	  *)    echo hppa-unknown-linux-gnu ;;
+	esac
+	exit 0 ;;
+    parisc64:Linux:*:* | hppa64:Linux:*:*)
+	echo hppa64-unknown-linux-gnu
+	exit 0 ;;
+    s390:Linux:*:* | s390x:Linux:*:*)
+	echo ${UNAME_MACHINE}-ibm-linux
+	exit 0 ;;
+    sh*:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    sparc:Linux:*:* | sparc64:Linux:*:*)
+	echo ${UNAME_MACHINE}-unknown-linux-gnu
+	exit 0 ;;
+    x86_64:Linux:*:*)
+	echo x86_64-unknown-linux-gnu
+	exit 0 ;;
+    i*86:Linux:*:*)
+	# The BFD linker knows what the default object file format is, so
+	# first see if it will tell us. cd to the root directory to prevent
+	# problems with other programs or directories called `ld' in the path.
+	# Set LC_ALL=C to ensure ld outputs messages in English.
+	ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+			 | sed -ne '/supported targets:/!d
+				    s/[ 	][ 	]*/ /g
+				    s/.*supported targets: *//
+				    s/ .*//
+				    p'`
+        case "$ld_supported_targets" in
+	  elf32-i386)
+		TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+		;;
+	  a.out-i386-linux)
+		echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+		exit 0 ;;
+	  coff-i386)
+		echo "${UNAME_MACHINE}-pc-linux-gnucoff"
+		exit 0 ;;
+	  "")
+		# Either a pre-BFD a.out linker (linux-gnuoldld) or
+		# one that does not give us useful --help.
+		echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+		exit 0 ;;
+	esac
+	# Determine whether the default compiler is a.out or elf
+	eval $set_cc_for_build
+	sed 's/^	//' << EOF >$dummy.c
+	#include <features.h>
+	#ifdef __ELF__
+	# ifdef __GLIBC__
+	#  if __GLIBC__ >= 2
+	LIBC=gnu
+	#  else
+	LIBC=gnulibc1
+	#  endif
+	# else
+	LIBC=gnulibc1
+	# endif
+	#else
+	#ifdef __INTEL_COMPILER
+	LIBC=gnu
+	#else
+	LIBC=gnuaout
+	#endif
+	#endif
+EOF
+	eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
+	rm -f $dummy.c && rmdir $tmpdir
+	test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0
+	test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0
+	;;
+    i*86:DYNIX/ptx:4*:*)
+	# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
+	# earlier versions are messed up and put the nodename in both
+	# sysname and nodename.
+	echo i386-sequent-sysv4
+	exit 0 ;;
+    i*86:UNIX_SV:4.2MP:2.*)
+        # Unixware is an offshoot of SVR4, but it has its own version
+        # number series starting with 2...
+        # I am not positive that other SVR4 systems won't match this,
+	# I just have to hope.  -- rms.
+        # Use sysv4.2uw... so that sysv4* matches it.
+	echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
+	exit 0 ;;
+    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
+	UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
+	if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
+		echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
+	else
+		echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
+	fi
+	exit 0 ;;
+    i*86:*:5:[78]*)
+	case `/bin/uname -X | grep "^Machine"` in
+	    *486*)	     UNAME_MACHINE=i486 ;;
+	    *Pentium)	     UNAME_MACHINE=i586 ;;
+	    *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
+	esac
+	echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
+	exit 0 ;;
+    i*86:*:3.2:*)
+	if test -f /usr/options/cb.name; then
+		UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
+		echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
+	elif /bin/uname -X 2>/dev/null >/dev/null ; then
+		UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
+		(/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
+		(/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
+			&& UNAME_MACHINE=i586
+		(/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		(/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
+			&& UNAME_MACHINE=i686
+		echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
+	else
+		echo ${UNAME_MACHINE}-pc-sysv32
+	fi
+	exit 0 ;;
+    i*86:*DOS:*:*)
+	echo ${UNAME_MACHINE}-pc-msdosdjgpp
+	exit 0 ;;
+    pc:*:*:*)
+	# Left here for compatibility:
+        # uname -m prints for DJGPP always 'pc', but it prints nothing about
+        # the processor, so we play safe by assuming i386.
+	echo i386-pc-msdosdjgpp
+        exit 0 ;;
+    Intel:Mach:3*:*)
+	echo i386-pc-mach3
+	exit 0 ;;
+    paragon:*:*:*)
+	echo i860-intel-osf1
+	exit 0 ;;
+    i860:*:4.*:*) # i860-SVR4
+	if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
+	  echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
+	else # Add other i860-SVR4 vendors below as they are discovered.
+	  echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
+	fi
+	exit 0 ;;
+    mini*:CTIX:SYS*5:*)
+	# "miniframe"
+	echo m68010-convergent-sysv
+	exit 0 ;;
+    mc68k:UNIX:SYSTEM5:3.51m)
+	echo m68k-convergent-sysv
+	exit 0 ;;
+    M68*:*:R3V[567]*:*)
+	test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;;
+    3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0)
+	OS_REL=''
+	test -r /etc/.relid \
+	&& OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
+	/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+	  && echo i486-ncr-sysv4.3${OS_REL} && exit 0
+	/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+	  && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;;
+    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
+        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+          && echo i486-ncr-sysv4 && exit 0 ;;
+    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
+	echo m68k-unknown-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    mc68030:UNIX_System_V:4.*:*)
+	echo m68k-atari-sysv4
+	exit 0 ;;
+    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+	echo i386-unknown-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    TSUNAMI:LynxOS:2.*:*)
+	echo sparc-unknown-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    rs6000:LynxOS:2.*:*)
+	echo rs6000-unknown-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+	echo powerpc-unknown-lynxos${UNAME_RELEASE}
+	exit 0 ;;
+    SM[BE]S:UNIX_SV:*:*)
+	echo mips-dde-sysv${UNAME_RELEASE}
+	exit 0 ;;
+    RM*:ReliantUNIX-*:*:*)
+	echo mips-sni-sysv4
+	exit 0 ;;
+    RM*:SINIX-*:*:*)
+	echo mips-sni-sysv4
+	exit 0 ;;
+    *:SINIX-*:*:*)
+	if uname -p 2>/dev/null >/dev/null ; then
+		UNAME_MACHINE=`(uname -p) 2>/dev/null`
+		echo ${UNAME_MACHINE}-sni-sysv4
+	else
+		echo ns32k-sni-sysv
+	fi
+	exit 0 ;;
+    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+                      # says <Richard.M.Bartel at ccMail.Census.GOV>
+        echo i586-unisys-sysv4
+        exit 0 ;;
+    *:UNIX_System_V:4*:FTX*)
+	# From Gerald Hewes <hewes at openmarket.com>.
+	# How about differentiating between stratus architectures? -djm
+	echo hppa1.1-stratus-sysv4
+	exit 0 ;;
+    *:*:*:FTX*)
+	# From seanf at swdc.stratus.com.
+	echo i860-stratus-sysv4
+	exit 0 ;;
+    *:VOS:*:*)
+	# From Paul.Green at stratus.com.
+	echo hppa1.1-stratus-vos
+	exit 0 ;;
+    mc68*:A/UX:*:*)
+	echo m68k-apple-aux${UNAME_RELEASE}
+	exit 0 ;;
+    news*:NEWS-OS:6*:*)
+	echo mips-sony-newsos6
+	exit 0 ;;
+    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
+	if [ -d /usr/nec ]; then
+	        echo mips-nec-sysv${UNAME_RELEASE}
+	else
+	        echo mips-unknown-sysv${UNAME_RELEASE}
+	fi
+        exit 0 ;;
+    BeBox:BeOS:*:*)	# BeOS running on hardware made by Be, PPC only.
+	echo powerpc-be-beos
+	exit 0 ;;
+    BeMac:BeOS:*:*)	# BeOS running on Mac or Mac clone, PPC only.
+	echo powerpc-apple-beos
+	exit 0 ;;
+    BePC:BeOS:*:*)	# BeOS running on Intel PC compatible.
+	echo i586-pc-beos
+	exit 0 ;;
+    SX-4:SUPER-UX:*:*)
+	echo sx4-nec-superux${UNAME_RELEASE}
+	exit 0 ;;
+    SX-5:SUPER-UX:*:*)
+	echo sx5-nec-superux${UNAME_RELEASE}
+	exit 0 ;;
+    SX-6:SUPER-UX:*:*)
+	echo sx6-nec-superux${UNAME_RELEASE}
+	exit 0 ;;
+    Power*:Rhapsody:*:*)
+	echo powerpc-apple-rhapsody${UNAME_RELEASE}
+	exit 0 ;;
+    *:Rhapsody:*:*)
+	echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
+	exit 0 ;;
+    *:Darwin:*:*)
+	echo `uname -p`-apple-darwin${UNAME_RELEASE}
+	exit 0 ;;
+    *:procnto*:*:* | *:QNX:[0123456789]*:*)
+	UNAME_PROCESSOR=`uname -p`
+	if test "$UNAME_PROCESSOR" = "x86"; then
+		UNAME_PROCESSOR=i386
+		UNAME_MACHINE=pc
+	fi
+	echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
+	exit 0 ;;
+    *:QNX:*:4*)
+	echo i386-pc-qnx
+	exit 0 ;;
+    NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*)
+	echo nsr-tandem-nsk${UNAME_RELEASE}
+	exit 0 ;;
+    *:NonStop-UX:*:*)
+	echo mips-compaq-nonstopux
+	exit 0 ;;
+    BS2000:POSIX*:*:*)
+	echo bs2000-siemens-sysv
+	exit 0 ;;
+    DS/*:UNIX_System_V:*:*)
+	echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
+	exit 0 ;;
+    *:Plan9:*:*)
+	# "uname -m" is not consistent, so use $cputype instead. 386
+	# is converted to i386 for consistency with other x86
+	# operating systems.
+	if test "$cputype" = "386"; then
+	    UNAME_MACHINE=i386
+	else
+	    UNAME_MACHINE="$cputype"
+	fi
+	echo ${UNAME_MACHINE}-unknown-plan9
+	exit 0 ;;
+    i*86:OS/2:*:*)
+	# If we were able to find `uname', then EMX Unix compatibility
+	# is probably installed.
+	echo ${UNAME_MACHINE}-pc-os2-emx
+	exit 0 ;;
+    *:TOPS-10:*:*)
+	echo pdp10-unknown-tops10
+	exit 0 ;;
+    *:TENEX:*:*)
+	echo pdp10-unknown-tenex
+	exit 0 ;;
+    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
+	echo pdp10-dec-tops20
+	exit 0 ;;
+    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
+	echo pdp10-xkl-tops20
+	exit 0 ;;
+    *:TOPS-20:*:*)
+	echo pdp10-unknown-tops20
+	exit 0 ;;
+    *:ITS:*:*)
+	echo pdp10-unknown-its
+	exit 0 ;;
+    i*86:XTS-300:*:STOP)
+	echo ${UNAME_MACHINE}-unknown-stop
+	exit 0 ;;
+    i*86:atheos:*:*)
+	echo ${UNAME_MACHINE}-unknown-atheos
+	exit 0 ;;
+esac
+
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
+eval $set_cc_for_build
+cat >$dummy.c <<EOF
+#ifdef _SEQUENT_
+# include <sys/types.h>
+# include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+          "4"
+#else
+	  ""
+#endif
+         ); exit (0);
+#endif
+#endif
+
+#if defined (__arm) && defined (__acorn) && defined (__unix)
+  printf ("arm-acorn-riscix"); exit (0);
+#endif
+
+#if defined (hp300) && !defined (hpux)
+  printf ("m68k-hp-bsd\n"); exit (0);
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+  int version;
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+    struct utsname un;
+
+    uname(&un);
+
+    if (strncmp(un.version, "V2", 2) == 0) {
+	printf ("i386-sequent-ptx2\n"); exit (0);
+    }
+    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+	printf ("i386-sequent-ptx1\n"); exit (0);
+    }
+    printf ("i386-sequent-ptx\n"); exit (0);
+
+#endif
+
+#if defined (vax)
+# if !defined (ultrix)
+#  include <sys/param.h>
+#  if defined (BSD)
+#   if BSD == 43
+      printf ("vax-dec-bsd4.3\n"); exit (0);
+#   else
+#    if BSD == 199006
+      printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#    else
+      printf ("vax-dec-bsd\n"); exit (0);
+#    endif
+#   endif
+#  else
+    printf ("vax-dec-bsd\n"); exit (0);
+#  endif
+# else
+    printf ("vax-dec-ultrix\n"); exit (0);
+# endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0
+rm -f $dummy.c $dummy && rmdir $tmpdir
+
+# Apollos put the system type in the environment.
+
+test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; }
+
+# Convex versions that predate uname can use getsysinfo(1)
+
+if [ -x /usr/convex/getsysinfo ]
+then
+    case `getsysinfo -f cpu_type` in
+    c1*)
+	echo c1-convex-bsd
+	exit 0 ;;
+    c2*)
+	if getsysinfo -f scalar_acc
+	then echo c32-convex-bsd
+	else echo c2-convex-bsd
+	fi
+	exit 0 ;;
+    c34*)
+	echo c34-convex-bsd
+	exit 0 ;;
+    c38*)
+	echo c38-convex-bsd
+	exit 0 ;;
+    c4*)
+	echo c4-convex-bsd
+	exit 0 ;;
+    esac
+fi
+
+cat >&2 <<EOF
+$0: unable to guess system type
+
+This script, last modified $timestamp, has failed to recognize
+the operating system you are using. It is advised that you
+download the most up to date version of the config scripts from
+
+    ftp://ftp.gnu.org/pub/gnu/config/
+
+If the version you run ($0) is already up to date, please
+send the following data and any information you think might be
+pertinent to <config-patches at gnu.org> in order to provide the needed
+information to handle your system.
+
+config.guess timestamp = $timestamp
+
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
+
+hostinfo               = `(hostinfo) 2>/dev/null`
+/bin/universe          = `(/bin/universe) 2>/dev/null`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
+/bin/arch              = `(/bin/arch) 2>/dev/null`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
+
+UNAME_MACHINE = ${UNAME_MACHINE}
+UNAME_RELEASE = ${UNAME_RELEASE}
+UNAME_SYSTEM  = ${UNAME_SYSTEM}
+UNAME_VERSION = ${UNAME_VERSION}
+EOF
+
+exit 1
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/config.sub b/config.sub
new file mode 100644
index 0000000..1dea9b7
--- /dev/null
+++ b/config.sub
@@ -0,0 +1,1470 @@
+#! /bin/sh
+# Configuration validation subroutine script.
+#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+#   2000, 2001, 2002 Free Software Foundation, Inc.
+
+timestamp='2002-09-05'
+
+# This file is (in principle) common to ALL GNU software.
+# The presence of a machine in this file suggests that SOME GNU software
+# can handle that machine.  It does not imply ALL GNU software can.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Please send patches to <config-patches at gnu.org>.  Submit a context
+# diff and a properly formatted ChangeLog entry.
+#
+# Configuration subroutine to validate and canonicalize a configuration type.
+# Supply the specified configuration type as an argument.
+# If it is invalid, we print an error message on stderr and exit with code 1.
+# Otherwise, we print the canonical config type on stdout and succeed.
+
+# This file is supposed to be the same for all GNU packages
+# and recognize all the CPU types, system types and aliases
+# that are meaningful with *any* GNU software.
+# Each package is responsible for reporting which valid configurations
+# it does not support.  The user should be able to distinguish
+# a failure to support a valid configuration from a meaningless
+# configuration.
+
+# The goal of this file is to map all the various variations of a given
+# machine specification into a single specification in the form:
+#	CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
+# or in some cases, the newer four-part form:
+#	CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
+# It is wrong to echo any other type of specification.
+
+me=`echo "$0" | sed -e 's,.*/,,'`
+
+usage="\
+Usage: $0 [OPTION] CPU-MFR-OPSYS
+       $0 [OPTION] ALIAS
+
+Canonicalize a configuration name.
+
+Operation modes:
+  -h, --help         print this help, then exit
+  -t, --time-stamp   print date of last modification, then exit
+  -v, --version      print version number, then exit
+
+Report bugs and patches to <config-patches at gnu.org>."
+
+version="\
+GNU config.sub ($timestamp)
+
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+
+This is free software; see the source for copying conditions.  There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
+
+help="
+Try \`$me --help' for more information."
+
+# Parse command line
+while test $# -gt 0 ; do
+  case $1 in
+    --time-stamp | --time* | -t )
+       echo "$timestamp" ; exit 0 ;;
+    --version | -v )
+       echo "$version" ; exit 0 ;;
+    --help | --h* | -h )
+       echo "$usage"; exit 0 ;;
+    -- )     # Stop option processing
+       shift; break ;;
+    - )	# Use stdin as input.
+       break ;;
+    -* )
+       echo "$me: invalid option $1$help"
+       exit 1 ;;
+
+    *local*)
+       # First pass through any local machine types.
+       echo $1
+       exit 0;;
+
+    * )
+       break ;;
+  esac
+done
+
+case $# in
+ 0) echo "$me: missing argument$help" >&2
+    exit 1;;
+ 1) ;;
+ *) echo "$me: too many arguments$help" >&2
+    exit 1;;
+esac
+
+# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
+# Here we must recognize all the valid KERNEL-OS combinations.
+maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
+case $maybe_os in
+  nto-qnx* | linux-gnu* | freebsd*-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*)
+    os=-$maybe_os
+    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
+    ;;
+  *)
+    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
+    if [ $basic_machine != $1 ]
+    then os=`echo $1 | sed 's/.*-/-/'`
+    else os=; fi
+    ;;
+esac
+
+### Let's recognize common machines as not being operating systems so
+### that things like config.sub decstation-3100 work.  We also
+### recognize some manufacturers as not being operating systems, so we
+### can provide default operating systems below.
+case $os in
+	-sun*os*)
+		# Prevent following clause from handling this invalid input.
+		;;
+	-dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
+	-att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
+	-unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
+	-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
+	-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
+	-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
+	-apple | -axis)
+		os=
+		basic_machine=$1
+		;;
+	-sim | -cisco | -oki | -wec | -winbond)
+		os=
+		basic_machine=$1
+		;;
+	-scout)
+		;;
+	-wrs)
+		os=-vxworks
+		basic_machine=$1
+		;;
+	-chorusos*)
+		os=-chorusos
+		basic_machine=$1
+		;;
+ 	-chorusrdb)
+ 		os=-chorusrdb
+		basic_machine=$1
+ 		;;
+	-hiux*)
+		os=-hiuxwe2
+		;;
+	-sco5)
+		os=-sco3.2v5
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco4)
+		os=-sco3.2v4
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2.[4-9]*)
+		os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco3.2v[4-9]*)
+		# Don't forget version if it is 3.2v4 or newer.
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-sco*)
+		os=-sco3.2v2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-udk*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-isc)
+		os=-isc2.2
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-clix*)
+		basic_machine=clipper-intergraph
+		;;
+	-isc*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
+		;;
+	-lynx*)
+		os=-lynxos
+		;;
+	-ptx*)
+		basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
+		;;
+	-windowsnt*)
+		os=`echo $os | sed -e 's/windowsnt/winnt/'`
+		;;
+	-psos*)
+		os=-psos
+		;;
+	-mint | -mint[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+esac
+
+# Decode aliases for certain CPU-COMPANY combinations.
+case $basic_machine in
+	# Recognize the basic CPU types without company name.
+	# Some are omitted here because they have special meanings below.
+	1750a | 580 \
+	| a29k \
+	| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
+	| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
+	| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
+	| clipper \
+	| d10v | d30v | dlx | dsp16xx \
+	| fr30 | frv \
+	| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
+	| i370 | i860 | i960 | ia64 \
+	| ip2k \
+	| m32r | m68000 | m68k | m88k | mcore \
+	| mips | mipsbe | mipseb | mipsel | mipsle \
+	| mips16 \
+	| mips64 | mips64el \
+	| mips64vr | mips64vrel \
+	| mips64orion | mips64orionel \
+	| mips64vr4100 | mips64vr4100el \
+	| mips64vr4300 | mips64vr4300el \
+	| mips64vr5000 | mips64vr5000el \
+	| mipsisa32 | mipsisa32el \
+	| mipsisa64 | mipsisa64el \
+	| mipsisa64sb1 | mipsisa64sb1el \
+	| mipsisa64sr71k | mipsisa64sr71kel \
+	| mipstx39 | mipstx39el \
+	| mn10200 | mn10300 \
+	| ns16k | ns32k \
+	| openrisc | or32 \
+	| pdp10 | pdp11 | pj | pjl \
+	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
+	| pyramid \
+	| sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+	| sh64 | sh64le \
+	| sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \
+	| strongarm \
+	| tahoe | thumb | tic80 | tron \
+	| v850 | v850e \
+	| we32k \
+	| x86 | xscale | xstormy16 | xtensa \
+	| z8k)
+		basic_machine=$basic_machine-unknown
+		;;
+	m6811 | m68hc11 | m6812 | m68hc12)
+		# Motorola 68HC11/12.
+		basic_machine=$basic_machine-unknown
+		os=-none
+		;;
+	m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
+		;;
+
+	# We use `pc' rather than `unknown'
+	# because (1) that's what they normally are, and
+	# (2) the word "unknown" tends to confuse beginning users.
+	i*86 | x86_64)
+	  basic_machine=$basic_machine-pc
+	  ;;
+	# Object if more than one company name word.
+	*-*-*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+	# Recognize the basic CPU types with company name.
+	580-* \
+	| a29k-* \
+	| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
+	| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
+	| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
+	| arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
+	| avr-* \
+	| bs2000-* \
+	| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* \
+	| clipper-* | cydra-* \
+	| d10v-* | d30v-* | dlx-* \
+	| elxsi-* \
+	| f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
+	| h8300-* | h8500-* \
+	| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
+	| i*86-* | i860-* | i960-* | ia64-* \
+	| ip2k-* \
+	| m32r-* \
+	| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
+	| m88110-* | m88k-* | mcore-* \
+	| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
+	| mips16-* \
+	| mips64-* | mips64el-* \
+	| mips64vr-* | mips64vrel-* \
+	| mips64orion-* | mips64orionel-* \
+	| mips64vr4100-* | mips64vr4100el-* \
+	| mips64vr4300-* | mips64vr4300el-* \
+	| mips64vr5000-* | mips64vr5000el-* \
+	| mipsisa32-* | mipsisa32el-* \
+	| mipsisa64-* | mipsisa64el-* \
+	| mipsisa64sb1-* | mipsisa64sb1el-* \
+	| mipsisa64sr71k-* | mipsisa64sr71kel-* \
+	| mipstx39 | mipstx39el \
+	| none-* | np1-* | ns16k-* | ns32k-* \
+	| orion-* \
+	| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
+	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
+	| pyramid-* \
+	| romp-* | rs6000-* \
+	| sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \
+	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+	| sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \
+	| sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
+	| tahoe-* | thumb-* | tic30-* | tic4x-* | tic54x-* | tic80-* | tron-* \
+	| v850-* | v850e-* | vax-* \
+	| we32k-* \
+	| x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \
+	| xtensa-* \
+	| ymp-* \
+	| z8k-*)
+		;;
+	# Recognize the various machine names and aliases which stand
+	# for a CPU type and a company and sometimes even an OS.
+	386bsd)
+		basic_machine=i386-unknown
+		os=-bsd
+		;;
+	3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
+		basic_machine=m68000-att
+		;;
+	3b*)
+		basic_machine=we32k-att
+		;;
+	a29khif)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	adobe68k)
+		basic_machine=m68010-adobe
+		os=-scout
+		;;
+	alliant | fx80)
+		basic_machine=fx80-alliant
+		;;
+	altos | altos3068)
+		basic_machine=m68k-altos
+		;;
+	am29k)
+		basic_machine=a29k-none
+		os=-bsd
+		;;
+	amdahl)
+		basic_machine=580-amdahl
+		os=-sysv
+		;;
+	amiga | amiga-*)
+		basic_machine=m68k-unknown
+		;;
+	amigaos | amigados)
+		basic_machine=m68k-unknown
+		os=-amigaos
+		;;
+	amigaunix | amix)
+		basic_machine=m68k-unknown
+		os=-sysv4
+		;;
+	apollo68)
+		basic_machine=m68k-apollo
+		os=-sysv
+		;;
+	apollo68bsd)
+		basic_machine=m68k-apollo
+		os=-bsd
+		;;
+	aux)
+		basic_machine=m68k-apple
+		os=-aux
+		;;
+	balance)
+		basic_machine=ns32k-sequent
+		os=-dynix
+		;;
+	c90)
+		basic_machine=c90-cray
+		os=-unicos
+		;;
+	convex-c1)
+		basic_machine=c1-convex
+		os=-bsd
+		;;
+	convex-c2)
+		basic_machine=c2-convex
+		os=-bsd
+		;;
+	convex-c32)
+		basic_machine=c32-convex
+		os=-bsd
+		;;
+	convex-c34)
+		basic_machine=c34-convex
+		os=-bsd
+		;;
+	convex-c38)
+		basic_machine=c38-convex
+		os=-bsd
+		;;
+	cray | j90)
+		basic_machine=j90-cray
+		os=-unicos
+		;;
+	crds | unos)
+		basic_machine=m68k-crds
+		;;
+	cris | cris-* | etrax*)
+		basic_machine=cris-axis
+		;;
+	da30 | da30-*)
+		basic_machine=m68k-da30
+		;;
+	decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
+		basic_machine=mips-dec
+		;;
+	decsystem10* | dec10*)
+		basic_machine=pdp10-dec
+		os=-tops10
+		;;
+	decsystem20* | dec20*)
+		basic_machine=pdp10-dec
+		os=-tops20
+		;;
+	delta | 3300 | motorola-3300 | motorola-delta \
+	      | 3300-motorola | delta-motorola)
+		basic_machine=m68k-motorola
+		;;
+	delta88)
+		basic_machine=m88k-motorola
+		os=-sysv3
+		;;
+	dpx20 | dpx20-*)
+		basic_machine=rs6000-bull
+		os=-bosx
+		;;
+	dpx2* | dpx2*-bull)
+		basic_machine=m68k-bull
+		os=-sysv3
+		;;
+	ebmon29k)
+		basic_machine=a29k-amd
+		os=-ebmon
+		;;
+	elxsi)
+		basic_machine=elxsi-elxsi
+		os=-bsd
+		;;
+	encore | umax | mmax)
+		basic_machine=ns32k-encore
+		;;
+	es1800 | OSE68k | ose68k | ose | OSE)
+		basic_machine=m68k-ericsson
+		os=-ose
+		;;
+	fx2800)
+		basic_machine=i860-alliant
+		;;
+	genix)
+		basic_machine=ns32k-ns
+		;;
+	gmicro)
+		basic_machine=tron-gmicro
+		os=-sysv
+		;;
+	go32)
+		basic_machine=i386-pc
+		os=-go32
+		;;
+	h3050r* | hiux*)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	h8300hms)
+		basic_machine=h8300-hitachi
+		os=-hms
+		;;
+	h8300xray)
+		basic_machine=h8300-hitachi
+		os=-xray
+		;;
+	h8500hms)
+		basic_machine=h8500-hitachi
+		os=-hms
+		;;
+	harris)
+		basic_machine=m88k-harris
+		os=-sysv3
+		;;
+	hp300-*)
+		basic_machine=m68k-hp
+		;;
+	hp300bsd)
+		basic_machine=m68k-hp
+		os=-bsd
+		;;
+	hp300hpux)
+		basic_machine=m68k-hp
+		os=-hpux
+		;;
+	hp3k9[0-9][0-9] | hp9[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k2[0-9][0-9] | hp9k31[0-9])
+		basic_machine=m68000-hp
+		;;
+	hp9k3[2-9][0-9])
+		basic_machine=m68k-hp
+		;;
+	hp9k6[0-9][0-9] | hp6[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hp9k7[0-79][0-9] | hp7[0-79][0-9])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k78[0-9] | hp78[0-9])
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
+		# FIXME: really hppa2.0-hp
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][13679] | hp8[0-9][13679])
+		basic_machine=hppa1.1-hp
+		;;
+	hp9k8[0-9][0-9] | hp8[0-9][0-9])
+		basic_machine=hppa1.0-hp
+		;;
+	hppa-next)
+		os=-nextstep3
+		;;
+	hppaosf)
+		basic_machine=hppa1.1-hp
+		os=-osf
+		;;
+	hppro)
+		basic_machine=hppa1.1-hp
+		os=-proelf
+		;;
+	i370-ibm* | ibm*)
+		basic_machine=i370-ibm
+		;;
+# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
+	i*86v32)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv32
+		;;
+	i*86v4*)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv4
+		;;
+	i*86v)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-sysv
+		;;
+	i*86sol2)
+		basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
+		os=-solaris2
+		;;
+	i386mach)
+		basic_machine=i386-mach
+		os=-mach
+		;;
+	i386-vsta | vsta)
+		basic_machine=i386-unknown
+		os=-vsta
+		;;
+	iris | iris4d)
+		basic_machine=mips-sgi
+		case $os in
+		    -irix*)
+			;;
+		    *)
+			os=-irix4
+			;;
+		esac
+		;;
+	isi68 | isi)
+		basic_machine=m68k-isi
+		os=-sysv
+		;;
+	m88k-omron*)
+		basic_machine=m88k-omron
+		;;
+	magnum | m3230)
+		basic_machine=mips-mips
+		os=-sysv
+		;;
+	merlin)
+		basic_machine=ns32k-utek
+		os=-sysv
+		;;
+	mingw32)
+		basic_machine=i386-pc
+		os=-mingw32
+		;;
+	miniframe)
+		basic_machine=m68000-convergent
+		;;
+	*mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
+		basic_machine=m68k-atari
+		os=-mint
+		;;
+	mips3*-*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
+		;;
+	mips3*)
+		basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
+		;;
+	mmix*)
+		basic_machine=mmix-knuth
+		os=-mmixware
+		;;
+	monitor)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	morphos)
+		basic_machine=powerpc-unknown
+		os=-morphos
+		;;
+	msdos)
+		basic_machine=i386-pc
+		os=-msdos
+		;;
+	mvs)
+		basic_machine=i370-ibm
+		os=-mvs
+		;;
+	ncr3000)
+		basic_machine=i486-ncr
+		os=-sysv4
+		;;
+	netbsd386)
+		basic_machine=i386-unknown
+		os=-netbsd
+		;;
+	netwinder)
+		basic_machine=armv4l-rebel
+		os=-linux
+		;;
+	news | news700 | news800 | news900)
+		basic_machine=m68k-sony
+		os=-newsos
+		;;
+	news1000)
+		basic_machine=m68030-sony
+		os=-newsos
+		;;
+	news-3600 | risc-news)
+		basic_machine=mips-sony
+		os=-newsos
+		;;
+	necv70)
+		basic_machine=v70-nec
+		os=-sysv
+		;;
+	next | m*-next )
+		basic_machine=m68k-next
+		case $os in
+		    -nextstep* )
+			;;
+		    -ns2*)
+		      os=-nextstep2
+			;;
+		    *)
+		      os=-nextstep3
+			;;
+		esac
+		;;
+	nh3000)
+		basic_machine=m68k-harris
+		os=-cxux
+		;;
+	nh[45]000)
+		basic_machine=m88k-harris
+		os=-cxux
+		;;
+	nindy960)
+		basic_machine=i960-intel
+		os=-nindy
+		;;
+	mon960)
+		basic_machine=i960-intel
+		os=-mon960
+		;;
+	nonstopux)
+		basic_machine=mips-compaq
+		os=-nonstopux
+		;;
+	np1)
+		basic_machine=np1-gould
+		;;
+	nsr-tandem)
+		basic_machine=nsr-tandem
+		;;
+	op50n-* | op60c-*)
+		basic_machine=hppa1.1-oki
+		os=-proelf
+		;;
+	or32 | or32-*)
+		basic_machine=or32-unknown
+		os=-coff
+		;;
+	OSE68000 | ose68000)
+		basic_machine=m68000-ericsson
+		os=-ose
+		;;
+	os68k)
+		basic_machine=m68k-none
+		os=-os68k
+		;;
+	pa-hitachi)
+		basic_machine=hppa1.1-hitachi
+		os=-hiuxwe2
+		;;
+	paragon)
+		basic_machine=i860-intel
+		os=-osf
+		;;
+	pbd)
+		basic_machine=sparc-tti
+		;;
+	pbb)
+		basic_machine=m68k-tti
+		;;
+	pc532 | pc532-*)
+		basic_machine=ns32k-pc532
+		;;
+	pentium | p5 | k5 | k6 | nexgen | viac3)
+		basic_machine=i586-pc
+		;;
+	pentiumpro | p6 | 6x86 | athlon | athlon_*)
+		basic_machine=i686-pc
+		;;
+	pentiumii | pentium2)
+		basic_machine=i686-pc
+		;;
+	pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
+		basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumpro-* | p6-* | 6x86-* | athlon-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pentiumii-* | pentium2-*)
+		basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	pn)
+		basic_machine=pn-gould
+		;;
+	power)	basic_machine=power-ibm
+		;;
+	ppc)	basic_machine=powerpc-unknown
+		;;
+	ppc-*)	basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppcle | powerpclittle | ppc-le | powerpc-little)
+		basic_machine=powerpcle-unknown
+		;;
+	ppcle-* | powerpclittle-*)
+		basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64)	basic_machine=powerpc64-unknown
+		;;
+	ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ppc64le | powerpc64little | ppc64-le | powerpc64-little)
+		basic_machine=powerpc64le-unknown
+		;;
+	ppc64le-* | powerpc64little-*)
+		basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
+		;;
+	ps2)
+		basic_machine=i386-ibm
+		;;
+	pw32)
+		basic_machine=i586-unknown
+		os=-pw32
+		;;
+	rom68k)
+		basic_machine=m68k-rom68k
+		os=-coff
+		;;
+	rm[46]00)
+		basic_machine=mips-siemens
+		;;
+	rtpc | rtpc-*)
+		basic_machine=romp-ibm
+		;;
+	s390 | s390-*)
+		basic_machine=s390-ibm
+		;;
+	s390x | s390x-*)
+		basic_machine=s390x-ibm
+		;;
+	sa29200)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	sb1)
+		basic_machine=mipsisa64sb1-unknown
+		;;
+	sb1el)
+		basic_machine=mipsisa64sb1el-unknown
+		;;
+	sequent)
+		basic_machine=i386-sequent
+		;;
+	sh)
+		basic_machine=sh-hitachi
+		os=-hms
+		;;
+	sparclite-wrs | simso-wrs)
+		basic_machine=sparclite-wrs
+		os=-vxworks
+		;;
+	sps7)
+		basic_machine=m68k-bull
+		os=-sysv2
+		;;
+	spur)
+		basic_machine=spur-unknown
+		;;
+	st2000)
+		basic_machine=m68k-tandem
+		;;
+	stratus)
+		basic_machine=i860-stratus
+		os=-sysv4
+		;;
+	sun2)
+		basic_machine=m68000-sun
+		;;
+	sun2os3)
+		basic_machine=m68000-sun
+		os=-sunos3
+		;;
+	sun2os4)
+		basic_machine=m68000-sun
+		os=-sunos4
+		;;
+	sun3os3)
+		basic_machine=m68k-sun
+		os=-sunos3
+		;;
+	sun3os4)
+		basic_machine=m68k-sun
+		os=-sunos4
+		;;
+	sun4os3)
+		basic_machine=sparc-sun
+		os=-sunos3
+		;;
+	sun4os4)
+		basic_machine=sparc-sun
+		os=-sunos4
+		;;
+	sun4sol2)
+		basic_machine=sparc-sun
+		os=-solaris2
+		;;
+	sun3 | sun3-*)
+		basic_machine=m68k-sun
+		;;
+	sun4)
+		basic_machine=sparc-sun
+		;;
+	sun386 | sun386i | roadrunner)
+		basic_machine=i386-sun
+		;;
+	sv1)
+		basic_machine=sv1-cray
+		os=-unicos
+		;;
+	symmetry)
+		basic_machine=i386-sequent
+		os=-dynix
+		;;
+	t3d)
+		basic_machine=alpha-cray
+		os=-unicos
+		;;
+	t3e)
+		basic_machine=alphaev5-cray
+		os=-unicos
+		;;
+	t90)
+		basic_machine=t90-cray
+		os=-unicos
+		;;
+        tic4x | c4x*)
+		basic_machine=tic4x-unknown
+		os=-coff
+		;;
+	tic54x | c54x*)
+		basic_machine=tic54x-unknown
+		os=-coff
+		;;
+	tx39)
+		basic_machine=mipstx39-unknown
+		;;
+	tx39el)
+		basic_machine=mipstx39el-unknown
+		;;
+	toad1)
+		basic_machine=pdp10-xkl
+		os=-tops20
+		;;
+	tower | tower-32)
+		basic_machine=m68k-ncr
+		;;
+	udi29k)
+		basic_machine=a29k-amd
+		os=-udi
+		;;
+	ultra3)
+		basic_machine=a29k-nyu
+		os=-sym1
+		;;
+	v810 | necv810)
+		basic_machine=v810-nec
+		os=-none
+		;;
+	vaxv)
+		basic_machine=vax-dec
+		os=-sysv
+		;;
+	vms)
+		basic_machine=vax-dec
+		os=-vms
+		;;
+	vpp*|vx|vx-*)
+		basic_machine=f301-fujitsu
+		;;
+	vxworks960)
+		basic_machine=i960-wrs
+		os=-vxworks
+		;;
+	vxworks68)
+		basic_machine=m68k-wrs
+		os=-vxworks
+		;;
+	vxworks29k)
+		basic_machine=a29k-wrs
+		os=-vxworks
+		;;
+	w65*)
+		basic_machine=w65-wdc
+		os=-none
+		;;
+	w89k-*)
+		basic_machine=hppa1.1-winbond
+		os=-proelf
+		;;
+	windows32)
+		basic_machine=i386-pc
+		os=-windows32-msvcrt
+		;;
+	xps | xps100)
+		basic_machine=xps100-honeywell
+		;;
+	ymp)
+		basic_machine=ymp-cray
+		os=-unicos
+		;;
+	z8k-*-coff)
+		basic_machine=z8k-unknown
+		os=-sim
+		;;
+	none)
+		basic_machine=none-none
+		os=-none
+		;;
+
+# Here we handle the default manufacturer of certain CPU types.  It is in
+# some cases the only manufacturer, in others, it is the most popular.
+	w89k)
+		basic_machine=hppa1.1-winbond
+		;;
+	op50n)
+		basic_machine=hppa1.1-oki
+		;;
+	op60c)
+		basic_machine=hppa1.1-oki
+		;;
+	romp)
+		basic_machine=romp-ibm
+		;;
+	rs6000)
+		basic_machine=rs6000-ibm
+		;;
+	vax)
+		basic_machine=vax-dec
+		;;
+	pdp10)
+		# there are many clones, so DEC is not a safe bet
+		basic_machine=pdp10-unknown
+		;;
+	pdp11)
+		basic_machine=pdp11-dec
+		;;
+	we32k)
+		basic_machine=we32k-att
+		;;
+	sh3 | sh4 | sh3eb | sh4eb | sh[1234]le | sh3ele)
+		basic_machine=sh-unknown
+		;;
+	sh64)
+		basic_machine=sh64-unknown
+		;;
+	sparc | sparcv9 | sparcv9b)
+		basic_machine=sparc-sun
+		;;
+	cydra)
+		basic_machine=cydra-cydrome
+		;;
+	orion)
+		basic_machine=orion-highlevel
+		;;
+	orion105)
+		basic_machine=clipper-highlevel
+		;;
+	mac | mpw | mac-mpw)
+		basic_machine=m68k-apple
+		;;
+	pmac | pmac-mpw)
+		basic_machine=powerpc-apple
+		;;
+	*-unknown)
+		# Make sure to match an already-canonicalized machine name.
+		;;
+	*)
+		echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
+		exit 1
+		;;
+esac
+
+# Here we canonicalize certain aliases for manufacturers.
+case $basic_machine in
+	*-digital*)
+		basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
+		;;
+	*-commodore*)
+		basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
+		;;
+	*)
+		;;
+esac
+
+# Decode manufacturer-specific aliases for certain operating systems.
+
+if [ x"$os" != x"" ]
+then
+case $os in
+        # First match some system type aliases
+        # that might get confused with valid system types.
+	# -solaris* is a basic system type, with this one exception.
+	-solaris1 | -solaris1.*)
+		os=`echo $os | sed -e 's|solaris1|sunos4|'`
+		;;
+	-solaris)
+		os=-solaris2
+		;;
+	-svr4*)
+		os=-sysv4
+		;;
+	-unixware*)
+		os=-sysv4.2uw
+		;;
+	-gnu/linux*)
+		os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
+		;;
+	# First accept the basic system types.
+	# The portable systems comes first.
+	# Each alternative MUST END IN A *, to match a version number.
+	# -sysv* is not here because it comes later, after sysvr4.
+	-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
+	      | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+	      | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
+	      | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
+	      | -aos* \
+	      | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
+	      | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
+	      | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \
+	      | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
+	      | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
+	      | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
+	      | -chorusos* | -chorusrdb* \
+	      | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+	      | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \
+	      | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \
+	      | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
+	      | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
+	      | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
+	      | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* | -powermax*)
+	# Remember, each alternative MUST END IN *, to match a version number.
+		;;
+	-qnx*)
+		case $basic_machine in
+		    x86-* | i*86-*)
+			;;
+		    *)
+			os=-nto$os
+			;;
+		esac
+		;;
+	-nto*)
+		os=-nto-qnx
+		;;
+	-sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
+	      | -windows* | -osx | -abug | -netware* | -os9* | -beos* \
+	      | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
+		;;
+	-mac*)
+		os=`echo $os | sed -e 's|mac|macos|'`
+		;;
+	-linux*)
+		os=`echo $os | sed -e 's|linux|linux-gnu|'`
+		;;
+	-sunos5*)
+		os=`echo $os | sed -e 's|sunos5|solaris2|'`
+		;;
+	-sunos6*)
+		os=`echo $os | sed -e 's|sunos6|solaris3|'`
+		;;
+	-opened*)
+		os=-openedition
+		;;
+	-wince*)
+		os=-wince
+		;;
+	-osfrose*)
+		os=-osfrose
+		;;
+	-osf*)
+		os=-osf
+		;;
+	-utek*)
+		os=-bsd
+		;;
+	-dynix*)
+		os=-bsd
+		;;
+	-acis*)
+		os=-aos
+		;;
+	-atheos*)
+		os=-atheos
+		;;
+	-386bsd)
+		os=-bsd
+		;;
+	-ctix* | -uts*)
+		os=-sysv
+		;;
+	-nova*)
+		os=-rtmk-nova
+		;;
+	-ns2 )
+		os=-nextstep2
+		;;
+	-nsk*)
+		os=-nsk
+		;;
+	# Preserve the version number of sinix5.
+	-sinix5.*)
+		os=`echo $os | sed -e 's|sinix|sysv|'`
+		;;
+	-sinix*)
+		os=-sysv4
+		;;
+	-triton*)
+		os=-sysv3
+		;;
+	-oss*)
+		os=-sysv3
+		;;
+	-svr4)
+		os=-sysv4
+		;;
+	-svr3)
+		os=-sysv3
+		;;
+	-sysvr4)
+		os=-sysv4
+		;;
+	# This must come after -sysvr4.
+	-sysv*)
+		;;
+	-ose*)
+		os=-ose
+		;;
+	-es1800*)
+		os=-ose
+		;;
+	-xenix)
+		os=-xenix
+		;;
+	-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+		os=-mint
+		;;
+	-none)
+		;;
+	*)
+		# Get rid of the `-' at the beginning of $os.
+		os=`echo $os | sed 's/[^-]*-//'`
+		echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
+		exit 1
+		;;
+esac
+else
+
+# Here we handle the default operating systems that come with various machines.
+# The value should be what the vendor currently ships out the door with their
+# machine or put another way, the most popular os provided with the machine.
+
+# Note that if you're going to try to match "-MANUFACTURER" here (say,
+# "-sun"), then you have to tell the case statement up towards the top
+# that MANUFACTURER isn't an operating system.  Otherwise, code above
+# will signal an error saying that MANUFACTURER isn't an operating
+# system, and we'll never get to this point.
+
+case $basic_machine in
+	*-acorn)
+		os=-riscix1.2
+		;;
+	arm*-rebel)
+		os=-linux
+		;;
+	arm*-semi)
+		os=-aout
+		;;
+	# This must come before the *-dec entry.
+	pdp10-*)
+		os=-tops20
+		;;
+	pdp11-*)
+		os=-none
+		;;
+	*-dec | vax-*)
+		os=-ultrix4.2
+		;;
+	m68*-apollo)
+		os=-domain
+		;;
+	i386-sun)
+		os=-sunos4.0.2
+		;;
+	m68000-sun)
+		os=-sunos3
+		# This also exists in the configure program, but was not the
+		# default.
+		# os=-sunos4
+		;;
+	m68*-cisco)
+		os=-aout
+		;;
+	mips*-cisco)
+		os=-elf
+		;;
+	mips*-*)
+		os=-elf
+		;;
+	or32-*)
+		os=-coff
+		;;
+	*-tti)	# must be before sparc entry or we get the wrong os.
+		os=-sysv3
+		;;
+	sparc-* | *-sun)
+		os=-sunos4.1.1
+		;;
+	*-be)
+		os=-beos
+		;;
+	*-ibm)
+		os=-aix
+		;;
+	*-wec)
+		os=-proelf
+		;;
+	*-winbond)
+		os=-proelf
+		;;
+	*-oki)
+		os=-proelf
+		;;
+	*-hp)
+		os=-hpux
+		;;
+	*-hitachi)
+		os=-hiux
+		;;
+	i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
+		os=-sysv
+		;;
+	*-cbm)
+		os=-amigaos
+		;;
+	*-dg)
+		os=-dgux
+		;;
+	*-dolphin)
+		os=-sysv3
+		;;
+	m68k-ccur)
+		os=-rtu
+		;;
+	m88k-omron*)
+		os=-luna
+		;;
+	*-next )
+		os=-nextstep
+		;;
+	*-sequent)
+		os=-ptx
+		;;
+	*-crds)
+		os=-unos
+		;;
+	*-ns)
+		os=-genix
+		;;
+	i370-*)
+		os=-mvs
+		;;
+	*-next)
+		os=-nextstep3
+		;;
+	*-gould)
+		os=-sysv
+		;;
+	*-highlevel)
+		os=-bsd
+		;;
+	*-encore)
+		os=-bsd
+		;;
+	*-sgi)
+		os=-irix
+		;;
+	*-siemens)
+		os=-sysv4
+		;;
+	*-masscomp)
+		os=-rtu
+		;;
+	f30[01]-fujitsu | f700-fujitsu)
+		os=-uxpv
+		;;
+	*-rom68k)
+		os=-coff
+		;;
+	*-*bug)
+		os=-coff
+		;;
+	*-apple)
+		os=-macos
+		;;
+	*-atari*)
+		os=-mint
+		;;
+	*)
+		os=-none
+		;;
+esac
+fi
+
+# Here we handle the case where we know the os, and the CPU type, but not the
+# manufacturer.  We pick the logical manufacturer.
+vendor=unknown
+case $basic_machine in
+	*-unknown)
+		case $os in
+			-riscix*)
+				vendor=acorn
+				;;
+			-sunos*)
+				vendor=sun
+				;;
+			-aix*)
+				vendor=ibm
+				;;
+			-beos*)
+				vendor=be
+				;;
+			-hpux*)
+				vendor=hp
+				;;
+			-mpeix*)
+				vendor=hp
+				;;
+			-hiux*)
+				vendor=hitachi
+				;;
+			-unos*)
+				vendor=crds
+				;;
+			-dgux*)
+				vendor=dg
+				;;
+			-luna*)
+				vendor=omron
+				;;
+			-genix*)
+				vendor=ns
+				;;
+			-mvs* | -opened*)
+				vendor=ibm
+				;;
+			-ptx*)
+				vendor=sequent
+				;;
+			-vxsim* | -vxworks* | -windiss*)
+				vendor=wrs
+				;;
+			-aux*)
+				vendor=apple
+				;;
+			-hms*)
+				vendor=hitachi
+				;;
+			-mpw* | -macos*)
+				vendor=apple
+				;;
+			-*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
+				vendor=atari
+				;;
+			-vos*)
+				vendor=stratus
+				;;
+		esac
+		basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
+		;;
+esac
+
+echo $basic_machine$os
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "timestamp='"
+# time-stamp-format: "%:y-%02m-%02d"
+# time-stamp-end: "'"
+# End:
diff --git a/configure b/configure
new file mode 100755
index 0000000..dad1dbc
--- /dev/null
+++ b/configure
@@ -0,0 +1,5294 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.57 for yagiuda 1.19.
+#
+# Report bugs to <david.kirkby at onetel.net>.
+#
+# 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.
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+
+# Support unset when possible.
+if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$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" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.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
+	     $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+	     $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+	     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
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  as_mkdir_p=false
+fi
+
+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
+
+
+# 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
+ac_config_libobj_dir=.
+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='yagiuda'
+PACKAGE_TARNAME='yagiuda'
+PACKAGE_VERSION='1.19'
+PACKAGE_STRING='yagiuda 1.19'
+PACKAGE_BUGREPORT='david.kirkby at onetel.net'
+
+# 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"
+
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STR [...]
+ac_subst_files=''
+
+# 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.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+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'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
+
+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"
+    ac_prev=
+    continue
+  fi
+
+  ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
+
+  # Accept the important Cygnus configure options, so we can diagnose typos.
+
+  case $ac_option in
+
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir=$ac_optarg ;;
+
+  -build | --build | --buil | --bui | --bu)
+    ac_prev=build_alias ;;
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+    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 ;;
+
+  --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 ;;
+
+  -disable-* | --disable-*)
+    ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    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=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    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'" ;;
+
+  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+  | --exec | --exe | --ex)
+    ac_prev=exec_prefix ;;
+  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+  | --exec=* | --exe=* | --ex=*)
+    exec_prefix=$ac_optarg ;;
+
+  -gas | --gas | --ga | --g)
+    # Obsolete; use --with-gas.
+    with_gas=yes ;;
+
+  -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_alias ;;
+  -host=* | --host=* | --hos=* | --ho=*)
+    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 ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir=$ac_optarg ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    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 ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst \
+  | --locals | --local | --loca | --loc | --lo)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+    localstatedir=$ac_optarg ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    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 | -n)
+    no_create=yes ;;
+
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    no_recursion=yes ;;
+
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir=$ac_optarg ;;
+
+  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+    ac_prev=prefix ;;
+  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+    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-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-transform-name | --program-transform-name \
+  | --program-transform-nam | --program-transform-na \
+  | --program-transform-n | --program-transform- \
+  | --program-transform | --program-transfor \
+  | --program-transfo | --program-transf \
+  | --program-trans | --program-tran \
+  | --progr-tra | --program-tr | --program-t)
+    ac_prev=program_transform_name ;;
+  -program-transform-name=* | --program-transform-name=* \
+  | --program-transform-nam=* | --program-transform-na=* \
+  | --program-transform-n=* | --program-transform-=* \
+  | --program-transform=* | --program-transfor=* \
+  | --program-transfo=* | --program-transf=* \
+  | --program-trans=* | --program-tran=* \
+  | --progr-tra=* | --program-tr=* | --program-t=*)
+    program_transform_name=$ac_optarg ;;
+
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil)
+    silent=yes ;;
+
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir=$ac_optarg ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir=$ac_optarg ;;
+
+  -site | --site | --sit)
+    ac_prev=site ;;
+  -site=* | --site=* | --sit=*)
+    site=$ac_optarg ;;
+
+  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+    ac_prev=srcdir ;;
+  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+    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 ;;
+
+  -target | --target | --targe | --targ | --tar | --ta | --t)
+    ac_prev=target_alias ;;
+  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+    target_alias=$ac_optarg ;;
+
+  -v | -verbose | --verbose | --verbos | --verbo | --verb)
+    verbose=yes ;;
+
+  -version | --version | --versio | --versi | --vers | -V)
+    ac_init_version=: ;;
+
+  -with-* | --with-*)
+    ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+    # Reject names that are not valid shell variable names.
+    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
+      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
+      *) ac_optarg=yes ;;
+    esac
+    eval "with_$ac_package='$ac_optarg'" ;;
+
+  -without-* | --without-*)
+    ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+    # Reject names that are not valid shell variable names.
+    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.
+    with_x=yes ;;
+
+  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+  | --x-incl | --x-inc | --x-in | --x-i)
+    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-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 ;;
+
+  -*) { 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 ;;
+
+  *)
+    # 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
+  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+  { echo "$as_me: error: missing argument to $ac_option" >&2
+   { (exit 1); exit 1; }; }
+fi
+
+# 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
+
+# Be sure to have absolute paths.
+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+              localstatedir libdir includedir oldincludedir infodir mandir
+do
+  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
+
+# 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
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+# 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_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=..
+  fi
+else
+  ac_srcdir_defaulted=no
+fi
+if test ! -r $srcdir/$ac_unique_file; then
+  if test "$ac_srcdir_defaulted" = yes; then
+    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
+   { (exit 1); exit 1; }; }
+  else
+    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+   { (exit 1); exit 1; }; }
+  fi
+fi
+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
+  { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+   { (exit 1); exit 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 yagiuda 1.19 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
+
+Program names:
+  --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
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+  case $ac_init_help in
+     short | recursive ) echo "Configuration of yagiuda 1.19:";;
+   esac
+  cat <<\_ACEOF
+
+Optional Features:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --disable-dependency-tracking Speeds up one-time builds
+  --enable-dependency-tracking  Do not reject slow dependency extractors
+
+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.
+
+Report bugs to <david.kirkby at onetel.net>.
+_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
+yagiuda configure 1.19
+generated by GNU Autoconf 2.57
+
+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 yagiuda $as_me 1.19, which was
+generated by GNU Autoconf 2.57.  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.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_sep=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+  for ac_arg
+  do
+    case $ac_arg in
+    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+    | -silent | --silent | --silen | --sile | --sil)
+      continue ;;
+    *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+      ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+    esac
+    case $ac_pass in
+    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+    2)
+      ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+      if test $ac_must_keep_next = true; then
+        ac_must_keep_next=false # Got value, back to normal.
+      else
+        case $ac_arg in
+          *=* | --config-cache | -C | -disable-* | --disable-* \
+          | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+          | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+          | -with-* | --with-* | -without-* | --without-* | --x)
+            case "$ac_configure_args0 " in
+              "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+            esac
+            ;;
+          -* ) ac_must_keep_next=true ;;
+        esac
+      fi
+      ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+      # Get rid of the leading space.
+      ac_sep=" "
+      ;;
+    esac
+  done
+done
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
+
+# 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
+
+    cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=$`echo $ac_var`
+      echo "$ac_var='"'"'$ac_val'"'"'"
+    done | sort
+    echo
+
+    if test -n "$ac_subst_files"; then
+      cat <<\_ASBOX
+## ------------- ##
+## Output files. ##
+## ------------- ##
+_ASBOX
+      echo
+      for ac_var in $ac_subst_files
+      do
+	eval ac_val=$`echo $ac_var`
+        echo "$ac_var='"'"'$ac_val'"'"'"
+      done | sort
+      echo
+    fi
+
+    if test -s confdefs.h; then
+      cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+      echo
+      sed "/^$/d" confdefs.h | sort
+      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
+    CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
+  else
+    CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
+  fi
+fi
+for ac_site_file in $CONFIG_SITE; do
+  if test -r "$ac_site_file"; then
+    { 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
+  # 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 "$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
+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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+am__api_version="1.7"
+ac_aux_dir=
+for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
+  if test -f $ac_dir/install-sh; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/install-sh -c"
+    break
+  elif test -f $ac_dir/install.sh; then
+    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 "$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="$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.
+
+# Find a good install program.  We prefer a C program (faster),
+# so one script is as good as another.  But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# ./install, which can be erroneously created by make from ./install.sh.
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
+if test -z "$INSTALL"; then
+if test "${ac_cv_path_install+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+  ./ | .// | /cC/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+        if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+          if test $ac_prog = install &&
+            grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+            # AIX install.  It has an incompatible calling convention.
+            :
+          elif test $ac_prog = install &&
+            grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+            # program-specific install script used by HP pwplus--don't use.
+            :
+          else
+            ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+            break 3
+          fi
+        fi
+      done
+    done
+    ;;
+esac
+done
+
+
+fi
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL=$ac_cv_path_install
+  else
+    # As a last resort, use the slow shell script.  We don't cache a
+    # path for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the path is relative.
+    INSTALL=$ac_install_sh
+  fi
+fi
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6
+# Just in case
+sleep 1
+echo timestamp > conftest.file
+# Do `set' in a subshell so we don't clobber the current shell's
+# arguments.  Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
+   if test "$*" = "X"; then
+      # -L didn't work.
+      set X `ls -t $srcdir/configure conftest.file`
+   fi
+   rm -f conftest.file
+   if test "$*" != "X $srcdir/configure conftest.file" \
+      && test "$*" != "X conftest.file $srcdir/configure"; then
+
+      # If neither matched, then we have a broken ls.  This can happen
+      # if, for instance, CONFIG_SHELL is bash and it inherits a
+      # broken ls alias from the environment.  This has actually
+      # happened.  Such a system could not be considered "sane".
+      { { echo "$as_me:$LINENO: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&5
+echo "$as_me: error: ls -t appears to fail.  Make sure there is not a broken
+alias in your environment" >&2;}
+   { (exit 1); exit 1; }; }
+   fi
+
+   test "$2" = conftest.file
+   )
+then
+   # Ok.
+   :
+else
+   { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
+Check your system clock" >&5
+echo "$as_me: error: newly created file is older than distributed files!
+Check your system clock" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+test "$program_prefix" != NONE &&
+  program_transform_name="s,^,$program_prefix,;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+  program_transform_name="s,\$,$program_suffix,;$program_transform_name"
+# Double any \ or $.  echo might interpret backslashes.
+# By default was `s,x,x', remove it if useless.
+cat <<\_ACEOF >conftest.sed
+s/[\\$]/&&/g;s/;s,x,x,$//
+_ACEOF
+program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
+rm conftest.sed
+
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+  am_missing_run="$MISSING --run "
+else
+  am_missing_run=
+  { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
+echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+for ac_prog in gawk mawk nawk awk
+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_AWK+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$AWK"; then
+  ac_cv_prog_AWK="$AWK" # 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_AWK="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+  echo "$as_me:$LINENO: result: $AWK" >&5
+echo "${ECHO_T}$AWK" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  test -n "$AWK" && break
+done
+
+echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
+set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'`
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.make <<\_ACEOF
+all:
+	@echo 'ac_maketemp="$(MAKE)"'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=`
+if test -n "$ac_maketemp"; then
+  eval ac_cv_prog_make_${ac_make}_set=yes
+else
+  eval ac_cv_prog_make_${ac_make}_set=no
+fi
+rm -f conftest.make
+fi
+if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+  SET_MAKE=
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+  SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+ # test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+   test -f $srcdir/config.status; then
+  { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
+echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+  if (cygpath --version) >/dev/null 2>/dev/null; then
+    CYGPATH_W='cygpath -w'
+  else
+    CYGPATH_W=echo
+  fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE=yagiuda
+ VERSION=1.19
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'.  However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; 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_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$STRIP"; then
+  ac_cv_prog_STRIP="$STRIP" # 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_STRIP="${ac_tool_prefix}strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+  echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+  ac_ct_STRIP=$STRIP
+  # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; 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_STRIP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_STRIP"; then
+  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # 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_STRIP="strip"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+  test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":"
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+  echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  STRIP=$ac_ct_STRIP
+else
+  STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+
+# We need awk for the "check" target.  The system "awk" is bad on
+# some platforms.
+
+
+
+
+
+
+ALL_LINGUAS="de fr es ko nl no pl pt sl sv"
+
+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
+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
+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
+
+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 "$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="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_ct_CC
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+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
+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
+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
+
+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
+
+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_ct_CC
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+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
+
+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
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+  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
+
+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 "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+    test -n "$CC" && break
+  done
+fi
+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
+
+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
+
+  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
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&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"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
+# 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=
+# b.out is created by i960 compilers.
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out
+do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj )
+        ;;
+    conftest.$ac_ext )
+        # This is the source file.
+        ;;
+    [ab].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,
+        # but it would be cool to find out if it's true.  Does anybody
+        # maintain Libtool? --akim.
+        export ac_cv_exeext
+        break;;
+    * )
+        break;;
+  esac
+done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&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'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&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 b.out
+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 conftest.exe conftest conftest.*; do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+    *.* ) 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
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+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"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  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 | *.xSYM | *.bb | *.bbg ) ;;
+    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+       break;;
+  esac
+done
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+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
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+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
+sed 's/^/| /' 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"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+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
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_prog_cc_g=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+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
+elif test $ac_cv_prog_cc_g = yes; then
+  if test "$GCC" = yes; then
+    CFLAGS="-g -O2"
+  else
+    CFLAGS="-g"
+  fi
+else
+  if test "$GCC" = yes; then
+    CFLAGS="-O2"
+  else
+    CFLAGS=
+  fi
+fi
+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
+  ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#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];
+}
+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;
+}
+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;
+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
+sed 's/^/| /' 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
+
+# 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"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+$ac_declaration
+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
+sed 's/^/| /' conftest.$ac_ext >&5
+
+continue
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_declaration
+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
+sed 's/^/| /' 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
+sed 's/^/| /' 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
+rm -f .deps 2>/dev/null
+mkdir .deps 2>/dev/null
+if test -d .deps; then
+  DEPDIR=.deps
+else
+  # MS-DOS does not allow filenames that begin with a dot.
+  DEPDIR=_deps
+fi
+rmdir .deps 2>/dev/null
+
+
+          ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+doit:
+	@echo done
+END
+# If we don't find an include directive, just comment out the code.
+echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
+echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# We grep out `Entering directory' and `Leaving directory'
+# messages which can occur if `w' ends up in MAKEFLAGS.
+# In particular we don't look at `^make:' because GNU make might
+# be invoked under some other name (usually "gmake"), in which
+# case it prints its new name instead of `make'.
+if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
+   am__include=include
+   am__quote=
+   _am_result=GNU
+fi
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+   echo '.include "confinc"' > confmf
+   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
+      am__include=.include
+      am__quote="\""
+      _am_result=BSD
+   fi
+fi
+
+
+echo "$as_me:$LINENO: result: $_am_result" >&5
+echo "${ECHO_T}$_am_result" >&6
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then
+  enableval="$enable_dependency_tracking"
+
+fi;
+if test "x$enable_dependency_tracking" != xno; then
+  am_depcomp="$ac_aux_dir/depcomp"
+  AMDEPBACKSLASH='\'
+fi
+
+
+if test "x$enable_dependency_tracking" != xno; then
+  AMDEP_TRUE=
+  AMDEP_FALSE='#'
+else
+  AMDEP_TRUE='#'
+  AMDEP_FALSE=
+fi
+
+
+
+
+depcc="$CC"   am_compiler_list=
+
+echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
+echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+  # We make a subdir and do the tests there.  Otherwise we can end up
+  # making bogus files that we don't know about and never remove.  For
+  # instance it was reported that on HP-UX the gcc test will end up
+  # making a dummy file named `D' -- because `-MD' means `put the output
+  # in D'.
+  mkdir conftest.dir
+  # Copy depcomp to subdir because otherwise we won't find it if we're
+  # using a relative directory.
+  cp "$am_depcomp" conftest.dir
+  cd conftest.dir
+
+  am_cv_CC_dependencies_compiler_type=none
+  if test "$am_compiler_list" = ""; then
+     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+  fi
+  for depmode in $am_compiler_list; do
+    # We need to recreate these files for each test, as the compiler may
+    # overwrite some of them when testing with obscure command lines.
+    # This happens at least with the AIX C compiler.
+    echo '#include "conftest.h"' > conftest.c
+    echo 'int i;' > conftest.h
+    echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf
+
+    case $depmode in
+    nosideeffect)
+      # after this tag, mechanisms are not by side-effect, so they'll
+      # only be used when explicitly requested
+      if test "x$enable_dependency_tracking" = xyes; then
+	continue
+      else
+	break
+      fi
+      ;;
+    none) break ;;
+    esac
+    # We check with `-c' and `-o' for the sake of the "dashmstdout"
+    # mode.  It turns out that the SunPro C++ compiler does not properly
+    # handle `-M -o', and we need to detect this.
+    if depmode=$depmode \
+       source=conftest.c object=conftest.o \
+       depfile=conftest.Po tmpdepfile=conftest.TPo \
+       $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 &&
+       grep conftest.h conftest.Po > /dev/null 2>&1 &&
+       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+      am_cv_CC_dependencies_compiler_type=$depmode
+      break
+    fi
+  done
+
+  cd ..
+  rm -rf conftest.dir
+else
+  am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
+echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+
+
+if
+  test "x$enable_dependency_tracking" != xno \
+  && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+  am__fastdepCC_TRUE=
+  am__fastdepCC_FALSE='#'
+else
+  am__fastdepCC_TRUE='#'
+  am__fastdepCC_FALSE=
+fi
+
+
+
+echo "$as_me:$LINENO: checking for library containing strerror" >&5
+echo $ECHO_N "checking for library containing strerror... $ECHO_C" >&6
+if test "${ac_cv_search_strerror+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_strerror=no
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end 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 strerror ();
+int
+main ()
+{
+strerror ();
+  ;
+  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_search_strerror="none required"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_strerror" = no; then
+  for ac_lib in cposix; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end 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 strerror ();
+int
+main ()
+{
+strerror ();
+  ;
+  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_search_strerror="-l$ac_lib"
+break
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+  done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_strerror" >&5
+echo "${ECHO_T}$ac_cv_search_strerror" >&6
+if test "$ac_cv_search_strerror" != no; then
+  test "$ac_cv_search_strerror" = "none required" || LIBS="$ac_cv_search_strerror $LIBS"
+
+fi
+
+
+
+echo "$as_me:$LINENO: checking for cos in -lm" >&5
+echo $ECHO_N "checking for cos in -lm... $ECHO_C" >&6
+if test "${ac_cv_lib_m_cos+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end 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 cos ();
+int
+main ()
+{
+cos ();
+  ;
+  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_m_cos=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_m_cos=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_m_cos" >&5
+echo "${ECHO_T}$ac_cv_lib_m_cos" >&6
+if test $ac_cv_lib_m_cos = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+  LIBS="-lm $LIBS"
+
+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 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 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.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # 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"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+                     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=$?
+  grep -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 "$as_me: failed program was:" >&5
+sed 's/^/| /' 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"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end 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=$?
+  grep -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
+sed 's/^/| /' 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
+  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.
+  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+  # <limits.h> exists even on freestanding compilers.
+  # 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"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+                     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=$?
+  grep -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 "$as_me: failed program was:" >&5
+sed 's/^/| /' 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"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end 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=$?
+  grep -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
+sed 's/^/| /' 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 "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&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 egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+    then ac_cv_prog_egrep='grep -E'
+    else ac_cv_prog_egrep='egrep'
+    fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
+
+
+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"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+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_header_stdc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_header_stdc=no
+fi
+rm -f conftest.$ac_objext 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"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end 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"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end 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*
+
+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
+  :
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end 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
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core core.* *.core gmon.out bb.out 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"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end 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
+sed 's/^/| /' 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
+
+done
+
+
+
+
+
+
+
+for ac_header in stdio.h math.h errno.h stdlib.h nan.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  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
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end 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
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' 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 $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -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
+sed 's/^/| /' 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: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf at gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+  no:yes )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf at gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+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
+  eval "$as_ac_Header=$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+
+for ac_header in ieeefp.h time.h sys/time.h random.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  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
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end 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
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' 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 $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -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
+sed 's/^/| /' 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: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf at gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+  no:yes )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf at gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+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
+  eval "$as_ac_Header=$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+
+
+for ac_header in string.h ctype.h sys/types.h unistd.h values.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  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
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end 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
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' 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 $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -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
+sed 's/^/| /' 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: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf at gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+  no:yes )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    (
+      cat <<\_ASBOX
+## ------------------------------------ ##
+## Report this to bug-autoconf at gnu.org. ##
+## ------------------------------------ ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+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
+  eval "$as_ac_Header=$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
+# for constant arguments.  Useless!
+echo "$as_me:$LINENO: checking for working alloca.h" >&5
+echo $ECHO_N "checking for working alloca.h... $ECHO_C" >&6
+if test "${ac_cv_working_alloca_h+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <alloca.h>
+int
+main ()
+{
+char *p = (char *) alloca (2 * sizeof (int));
+  ;
+  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_working_alloca_h=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_working_alloca_h=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_working_alloca_h" >&5
+echo "${ECHO_T}$ac_cv_working_alloca_h" >&6
+if test $ac_cv_working_alloca_h = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ALLOCA_H 1
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for alloca" >&5
+echo $ECHO_N "checking for alloca... $ECHO_C" >&6
+if test "${ac_cv_func_alloca_works+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+#else
+# ifdef _MSC_VER
+#  include <malloc.h>
+#  define alloca _alloca
+# else
+#  if HAVE_ALLOCA_H
+#   include <alloca.h>
+#  else
+#   ifdef _AIX
+ #pragma alloca
+#   else
+#    ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+#    endif
+#   endif
+#  endif
+# endif
+#endif
+
+int
+main ()
+{
+char *p = (char *) alloca (1);
+  ;
+  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_alloca_works=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_func_alloca_works=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_alloca_works" >&5
+echo "${ECHO_T}$ac_cv_func_alloca_works" >&6
+
+if test $ac_cv_func_alloca_works = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ALLOCA 1
+_ACEOF
+
+else
+  # The SVR3 libPW and SVR4 libucb both contain incompatible functions
+# that cause trouble.  Some versions do not even contain alloca or
+# contain a buggy version.  If you still want to use their alloca,
+# use ar to extract alloca.o from them instead of compiling alloca.c.
+
+ALLOCA=alloca.$ac_objext
+
+cat >>confdefs.h <<\_ACEOF
+#define C_ALLOCA 1
+_ACEOF
+
+
+echo "$as_me:$LINENO: checking whether \`alloca.c' needs Cray hooks" >&5
+echo $ECHO_N "checking whether \`alloca.c' needs Cray hooks... $ECHO_C" >&6
+if test "${ac_cv_os_cray+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#if defined(CRAY) && ! defined(CRAY2)
+webecray
+#else
+wenotbecray
+#endif
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+  $EGREP "webecray" >/dev/null 2>&1; then
+  ac_cv_os_cray=yes
+else
+  ac_cv_os_cray=no
+fi
+rm -f conftest*
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_os_cray" >&5
+echo "${ECHO_T}$ac_cv_os_cray" >&6
+if test $ac_cv_os_cray = yes; then
+  for ac_func in _getb67 GETB67 getb67; 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"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+/* 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 ();
+/* 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
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+  ;
+  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
+sed 's/^/| /' 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 CRAY_STACKSEG_END $ac_func
+_ACEOF
+
+    break
+fi
+
+  done
+fi
+
+echo "$as_me:$LINENO: checking stack direction for C alloca" >&5
+echo $ECHO_N "checking stack direction for C alloca... $ECHO_C" >&6
+if test "${ac_cv_c_stack_direction+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test "$cross_compiling" = yes; then
+  ac_cv_c_stack_direction=0
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+int
+find_stack_direction ()
+{
+  static char *addr = 0;
+  auto char dummy;
+  if (addr == 0)
+    {
+      addr = &dummy;
+      return find_stack_direction ();
+    }
+  else
+    return (&dummy > addr) ? 1 : -1;
+}
+
+int
+main ()
+{
+  exit (find_stack_direction () < 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_c_stack_direction=1
+else
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_c_stack_direction=-1
+fi
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_stack_direction" >&5
+echo "${ECHO_T}$ac_cv_c_stack_direction" >&6
+
+cat >>confdefs.h <<_ACEOF
+#define STACK_DIRECTION $ac_cv_c_stack_direction
+_ACEOF
+
+
+fi
+
+
+
+echo "$as_me:$LINENO: checking for struct stat.st_blksize" >&5
+echo $ECHO_N "checking for struct stat.st_blksize... $ECHO_C" >&6
+if test "${ac_cv_member_struct_stat_st_blksize+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static struct stat ac_aggr;
+if (ac_aggr.st_blksize)
+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_member_struct_stat_st_blksize=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+int
+main ()
+{
+static struct stat ac_aggr;
+if (sizeof ac_aggr.st_blksize)
+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_member_struct_stat_st_blksize=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_member_struct_stat_st_blksize=no
+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_member_struct_stat_st_blksize" >&5
+echo "${ECHO_T}$ac_cv_member_struct_stat_st_blksize" >&6
+if test $ac_cv_member_struct_stat_st_blksize = yes; then
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ST_BLKSIZE 1
+_ACEOF
+
+fi
+
+
+
+#AM_GNU_GETTEXT
+                                                            ac_config_files="$ac_config_files Makefile doc/Makefile src/Makefile man/Makefile man/man1/Makefile man/man5/Makefile"
+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, 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.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden 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 \
+        "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 diff $cache_file confcache >/dev/null 2>&1; then :; else
+  if test -w $cache_file; then
+    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
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+# 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[ 	]*=/{
+s/:*\$(srcdir):*/:/;
+s/:*\${srcdir}:*/:/;
+s/:*@srcdir@:*/:/;
+s/^\([^=]*=[ 	]*\):*/\1/;
+s/:*$//;
+s/^[^=]*=[ 	]*$//;
+}'
+fi
+
+# Transform confdefs.h into DEFS.
+# Protect against shell expansion while executing Makefile rules.
+# Protect against Makefile macro expansion.
+#
+# If the first sed substitution is executed (which looks for macros that
+# take arguments), then we branch to the quote section.  Otherwise,
+# look for a macro that doesn't take arguments.
+cat >confdef2opt.sed <<\_ACEOF
+t clear
+: clear
+s,^[ 	]*#[ 	]*define[ 	][ 	]*\([^ 	(][^ 	(]*([^)]*)\)[ 	]*\(.*\),-D\1=\2,g
+t quote
+s,^[ 	]*#[ 	]*define[ 	][ 	]*\([^ 	][^ 	]*\)[ 	]*\(.*\),-D\1=\2,g
+t quote
+d
+: quote
+s,[ 	`~#$^&*(){}\\|;'"<>?],\\&,g
+s,\[,\\&,g
+s,\],\\&,g
+s,\$,$$,g
+p
+_ACEOF
+# We use echo to avoid assuming a particular line-breaking character.
+# The extra dot is to prevent the shell from consuming trailing
+# line-breaks from the sub-command output.  A line-break within
+# single-quotes doesn't work because, if this script is created in a
+# platform that uses two characters for line-breaks (e.g., DOS), tr
+# would break.
+ac_LF_and_DOT=`echo; echo .`
+DEFS=`sed -n -f confdef2opt.sed confdefs.h | tr "$ac_LF_and_DOT" ' .'`
+rm -f confdef2opt.sed
+
+
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+  # 1. Remove the extension, and $U if already installed.
+  ac_i=`echo "$ac_i" |
+         sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+  # 2. Add them.
+  ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
+  ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+: ${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.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=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=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+
+# Support unset when possible.
+if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in \
+  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+  LC_TELEPHONE LC_TIME
+do
+  if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$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" >conf$$.sh
+  echo  "exit 0"   >>conf$$.sh
+  chmod +x conf$$.sh
+  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conf$$.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:$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
+	     $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+	     $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+	     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:$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
+}
+
+
+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
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  as_mkdir_p=false
+fi
+
+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
+
+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 yagiuda $as_me 1.19, which was
+generated by GNU Autoconf 2.57.  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
+  -q, --quiet      do not print progress messages
+  -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
+
+Configuration files:
+$config_files
+
+Configuration commands:
+$config_commands
+
+Report bugs to <bug-autoconf at gnu.org>."
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+yagiuda config.status 1.19
+configured by $0, generated by GNU Autoconf 2.57,
+  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
+INSTALL="$INSTALL"
+_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[^=]*=\(.*\)'`
+    ac_shift=:
+    ;;
+  -*)
+    ac_option=$1
+    ac_optarg=$2
+    ac_shift=shift
+    ;;
+  *) # This is not an option, so the user has probably given explicit
+     # arguments.
+     ac_option=$1
+     ac_need_defaults=false;;
+  esac
+
+  case $ac_option in
+  # Handling of the options.
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+    ac_cs_recheck=: ;;
+  --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 )
+    $ac_shift
+    CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+    ac_need_defaults=false;;
+  --header | --heade | --head | --hea )
+    $ac_shift
+    CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+    ac_need_defaults=false;;
+  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+  | -silent | --silent | --silen | --sile | --sil | --si | --s)
+    ac_cs_silent=: ;;
+
+  # 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
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+  exec 6>/dev/null
+  ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+if \$ac_cs_recheck; then
+  echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+  exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+fi
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+#
+# INIT-COMMANDS section.
+#
+
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+_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" ;;
+  "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
+  "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
+  "man/Makefile" ) CONFIG_FILES="$CONFIG_FILES man/Makefile" ;;
+  "man/man1/Makefile" ) CONFIG_FILES="$CONFIG_FILES man/man1/Makefile" ;;
+  "man/man5/Makefile" ) CONFIG_FILES="$CONFIG_FILES man/man5/Makefile" ;;
+  "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+  *) { { 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 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_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience.  Make it in the build tree
+# simply because there is no reason to put it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# 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.
+
+{
+  tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=./confstat$$-$RANDOM
+  (umask 077 && mkdir $tmp)
+} ||
+{
+   echo "$me: cannot create a temporary directory in ." >&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, at SHELL@,$SHELL,;t t
+s, at PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s, at PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s, at PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s, at PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s, at PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s, at PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s, at exec_prefix@,$exec_prefix,;t t
+s, at prefix@,$prefix,;t t
+s, at program_transform_name@,$program_transform_name,;t t
+s, at bindir@,$bindir,;t t
+s, at sbindir@,$sbindir,;t t
+s, at libexecdir@,$libexecdir,;t t
+s, at datadir@,$datadir,;t t
+s, at sysconfdir@,$sysconfdir,;t t
+s, at sharedstatedir@,$sharedstatedir,;t t
+s, at localstatedir@,$localstatedir,;t t
+s, at libdir@,$libdir,;t t
+s, at includedir@,$includedir,;t t
+s, at oldincludedir@,$oldincludedir,;t t
+s, at infodir@,$infodir,;t t
+s, at mandir@,$mandir,;t t
+s, at build_alias@,$build_alias,;t t
+s, at host_alias@,$host_alias,;t t
+s, at target_alias@,$target_alias,;t t
+s, at DEFS@,$DEFS,;t t
+s, at ECHO_C@,$ECHO_C,;t t
+s, at ECHO_N@,$ECHO_N,;t t
+s, at ECHO_T@,$ECHO_T,;t t
+s, at LIBS@,$LIBS,;t t
+s, at INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
+s, at INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
+s, at INSTALL_DATA@,$INSTALL_DATA,;t t
+s, at CYGPATH_W@,$CYGPATH_W,;t t
+s, at PACKAGE@,$PACKAGE,;t t
+s, at VERSION@,$VERSION,;t t
+s, at ACLOCAL@,$ACLOCAL,;t t
+s, at AUTOCONF@,$AUTOCONF,;t t
+s, at AUTOMAKE@,$AUTOMAKE,;t t
+s, at AUTOHEADER@,$AUTOHEADER,;t t
+s, at MAKEINFO@,$MAKEINFO,;t t
+s, at AMTAR@,$AMTAR,;t t
+s, at install_sh@,$install_sh,;t t
+s, at STRIP@,$STRIP,;t t
+s, at ac_ct_STRIP@,$ac_ct_STRIP,;t t
+s, at INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t
+s, at AWK@,$AWK,;t t
+s, at SET_MAKE@,$SET_MAKE,;t t
+s, at CC@,$CC,;t t
+s, at CFLAGS@,$CFLAGS,;t t
+s, at LDFLAGS@,$LDFLAGS,;t t
+s, at CPPFLAGS@,$CPPFLAGS,;t t
+s, at ac_ct_CC@,$ac_ct_CC,;t t
+s, at EXEEXT@,$EXEEXT,;t t
+s, at OBJEXT@,$OBJEXT,;t t
+s, at DEPDIR@,$DEPDIR,;t t
+s, at am__include@,$am__include,;t t
+s, at am__quote@,$am__quote,;t t
+s, at AMDEP_TRUE@,$AMDEP_TRUE,;t t
+s, at AMDEP_FALSE@,$AMDEP_FALSE,;t t
+s, at AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t
+s, at CCDEPMODE@,$CCDEPMODE,;t t
+s, at am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t
+s, at am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t
+s, at CPP@,$CPP,;t t
+s, at EGREP@,$EGREP,;t t
+s, at ALLOCA@,$ALLOCA,;t t
+s, at LIBOBJS@,$LIBOBJS,;t t
+s, at LTLIBOBJS@,$LTLIBOBJS,;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"
+
+_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
+  - | *:- | *:-:* ) # 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'`
+  { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+         X"$as_dir" : 'X\(//\)[^/]' \| \
+         X"$as_dir" : 'X\(//\)$' \| \
+         X"$as_dir" : 'X\(/\)' \| \
+         .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+  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`
+
+
+  case $INSTALL in
+  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+  *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
+  esac
+
+  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, at configure_input@,$configure_input,;t t
+s, at srcdir@,$ac_srcdir,;t t
+s, at abs_srcdir@,$ac_abs_srcdir,;t t
+s, at top_srcdir@,$ac_top_srcdir,;t t
+s, at abs_top_srcdir@,$ac_abs_top_srcdir,;t t
+s, at builddir@,$ac_builddir,;t t
+s, at abs_builddir@,$ac_abs_builddir,;t t
+s, at top_builddir@,$ac_top_builddir,;t t
+s, at abs_top_builddir@,$ac_abs_top_builddir,;t t
+s, at INSTALL@,$ac_INSTALL,;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_COMMANDS section.
+#
+for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue
+  ac_dest=`echo "$ac_file" | sed 's,:.*,,'`
+  ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'`
+  ac_dir=`(dirname "$ac_dest") 2>/dev/null ||
+$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+         X"$ac_dest" : 'X\(//\)[^/]' \| \
+         X"$ac_dest" : 'X\(//\)$' \| \
+         X"$ac_dest" : 'X\(/\)' \| \
+         .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_dest" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+  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`
+
+
+  { echo "$as_me:$LINENO: executing $ac_dest commands" >&5
+echo "$as_me: executing $ac_dest commands" >&6;}
+  case $ac_dest in
+    depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
+  # Strip MF so we end up with the name of the file.
+  mf=`echo "$mf" | sed -e 's/:.*$//'`
+  # Check whether this is an Automake generated Makefile or not.
+  # We used to match only the files named `Makefile.in', but
+  # some people rename them; so instead we look at the file content.
+  # Grep'ing the first line is not enough: some people post-process
+  # each Makefile.in and add a new line on top of each file to say so.
+  # So let's grep whole file.
+  if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
+    dirpart=`(dirname "$mf") 2>/dev/null ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+         X"$mf" : 'X\(//\)[^/]' \| \
+         X"$mf" : 'X\(//\)$' \| \
+         X"$mf" : 'X\(/\)' \| \
+         .     : '\(.\)' 2>/dev/null ||
+echo X"$mf" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+  else
+    continue
+  fi
+  grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue
+  # Extract the definition of DEP_FILES from the Makefile without
+  # running `make'.
+  DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"`
+  test -z "$DEPDIR" && continue
+  # When using ansi2knr, U may be empty or an underscore; expand it
+  U=`sed -n -e '/^U = / s///p' < "$mf"`
+  test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR"
+  # We invoke sed twice because it is the simplest approach to
+  # changing $(DEPDIR) to its actual value in the expansion.
+  for file in `sed -n -e '
+    /^DEP_FILES = .*\\\\$/ {
+      s/^DEP_FILES = //
+      :loop
+	s/\\\\$//
+	p
+	n
+	/\\\\$/ b loop
+      p
+    }
+    /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \
+       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
+    # Make sure the directory exists.
+    test -f "$dirpart/$file" && continue
+    fdir=`(dirname "$file") 2>/dev/null ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+         X"$file" : 'X\(//\)[^/]' \| \
+         X"$file" : 'X\(//\)$' \| \
+         X"$file" : 'X\(/\)' \| \
+         .     : '\(.\)' 2>/dev/null ||
+echo X"$file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+    { if $as_mkdir_p; then
+    mkdir -p $dirpart/$fdir
+  else
+    as_dir=$dirpart/$fdir
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+         X"$as_dir" : 'X\(//\)[^/]' \| \
+         X"$as_dir" : 'X\(//\)$' \| \
+         X"$as_dir" : 'X\(/\)' \| \
+         .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5
+echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+    # echo "creating $dirpart/$file"
+    echo '# dummy' > "$dirpart/$file"
+  done
+done
+ ;;
+  esac
+done
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+{ (exit 0); exit 0; }
+_ACEOF
+chmod +x $CONFIG_STATUS
+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=:
+  ac_config_status_args=
+  test "$silent" = yes &&
+    ac_config_status_args="$ac_config_status_args --quiet"
+  exec 5>/dev/null
+  $SHELL $CONFIG_STATUS $ac_config_status_args || 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
+
+
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..0e1d7b7
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,31 @@
+dnl Process this file with autoconf to produce a configure script.
+AC_INIT([yagiuda],[1.19],[david.kirkby at onetel.net])
+AM_INIT_AUTOMAKE
+AC_PREREQ([2.57])
+
+
+ALL_LINGUAS="de fr es ko nl no pl pt sl sv"
+ 
+dnl Checks for programs.
+AC_PROG_CC
+AC_ISC_POSIX
+     
+dnl Checks for libraries.
+AC_CHECK_LIB(m,cos)
+		
+dnl Checks for header files.
+AC_STDC_HEADERS
+AC_HAVE_HEADERS(stdio.h math.h errno.h stdlib.h nan.h )
+AC_HAVE_HEADERS(ieeefp.h time.h sys/time.h random.h )
+AC_HAVE_HEADERS(string.h ctype.h sys/types.h unistd.h values.h)
+							    
+dnl Checks for library functions.
+AC_FUNC_ALLOCA
+						   
+dnl Check for st_blksize in struct stat
+AC_ST_BLKSIZE
+
+dnl internationalization macros
+#AM_GNU_GETTEXT
+AC_OUTPUT([Makefile doc/Makefile src/Makefile man/Makefile man/man1/Makefile man/man5/Makefile])
+
diff --git a/depcomp b/depcomp
new file mode 100644
index 0000000..3480ce4
--- /dev/null
+++ b/depcomp
@@ -0,0 +1,436 @@
+#! /bin/sh
+
+# depcomp - compile a program generating dependencies as side-effects
+# Copyright 1999, 2000 Free Software Foundation, Inc.
+
+# 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 2, 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., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva at dcc.unicamp.br>.
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+  echo "depcomp: Variables source, object and depmode must be set" 1>&2
+  exit 1
+fi
+# `libtool' can also be set to `yes' or `no'.
+
+if test -z "$depfile"; then
+   base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'`
+   dir=`echo "$object" | sed 's,/.*$,/,'`
+   if test "$dir" = "$object"; then
+      dir=
+   fi
+   # FIXME: should be _deps on DOS.
+   depfile="$dir.deps/$base"
+fi
+
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags.  We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write.  Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+  # HP compiler uses -M and no extra arg.
+  gccflag=-M
+  depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+   # This is just like dashmstdout with a different argument.
+   dashmflag=-xM
+   depmode=dashmstdout
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff.  Hmm.
+  "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  mv "$tmpdepfile" "$depfile"
+  ;;
+
+gcc)
+## There are various ways to get dependency output from gcc.  Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+##   up in a subdir.  Having to rename by hand is ugly.
+##   (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+##   -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+##   than renaming).
+  if test -z "$gccflag"; then
+    gccflag=-MD,
+  fi
+  "$@" -Wp,"$gccflag$tmpdepfile"
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+  sed -e 's/^[^:]*: / /' \
+      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header).  We avoid this by adding
+## dummy dependencies for each header file.  Too bad gcc doesn't do
+## this for us directly.
+  tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'.  On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+hp)
+  # This case exists only to let depend.m4 do its work.  It works by
+  # looking at the text of this script.  This case will never be run,
+  # since it is checked for above.
+  exit 1
+  ;;
+
+sgi)
+  if test "$libtool" = yes; then
+    "$@" "-Wp,-MDupdate,$tmpdepfile"
+  else
+    "$@" -MDupdate "$tmpdepfile"
+  fi
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+  rm -f "$depfile"
+
+  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
+    echo "$object : \\" > "$depfile"
+
+    # Clip off the initial element (the dependent).  Don't try to be
+    # clever and replace this with sed code, as IRIX sed won't handle
+    # lines with more than a fixed number of characters (4096 in
+    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
+    # the IRIX cc adds comments like `#:fec' to the end of the
+    # dependency line.
+    tr ' ' '
+' < "$tmpdepfile" \
+    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+    tr '
+' ' ' >> $depfile
+    echo >> $depfile
+
+    # The second pass generates a dummy entry for each header file.
+    tr ' ' '
+' < "$tmpdepfile" \
+   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+   >> $depfile
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+aix)
+  # The C for AIX Compiler uses -M and outputs the dependencies
+  # in a .u file.  This file always lives in the current directory.
+  # Also, the AIX compiler puts `$object:' at the start of each line;
+  # $object doesn't have directory information.
+  stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'`
+  tmpdepfile="$stripped.u"
+  outname="$stripped.o"
+  if test "$libtool" = yes; then
+    "$@" -Wc,-M
+  else
+    "$@" -M
+  fi
+
+  stat=$?
+  if test $stat -eq 0; then :
+  else
+    rm -f "$tmpdepfile"
+    exit $stat
+  fi
+
+  if test -f "$tmpdepfile"; then
+    # Each line is of the form `foo.o: dependent.h'.
+    # Do two passes, one to just change these to
+    # `$object: dependent.h' and one to simply `dependent.h:'.
+    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
+    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
+  else
+    # The sourcefile does not contain any dependencies, so just
+    # store a dummy comment line, to avoid errors with the Makefile
+    # "include basename.Plo" scheme.
+    echo "#dummy" > "$depfile"
+  fi
+  rm -f "$tmpdepfile"
+  ;;
+
+tru64)
+   # The Tru64 compiler uses -MD to generate dependencies as a side
+   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 
+   # dependencies in `foo.d' instead, so we check for that too.
+   # Subdirectories are respected.
+
+   base=`echo "$object" | sed -e 's/\.o$//' -e 's/\.lo$//'`
+   tmpdepfile1="$base.o.d"
+   tmpdepfile2="$base.d"
+   if test "$libtool" = yes; then
+      "$@" -Wc,-MD
+   else
+      "$@" -MD
+   fi
+
+   stat=$?
+   if test $stat -eq 0; then :
+   else
+      rm -f "$tmpdepfile1" "$tmpdepfile2"
+      exit $stat
+   fi
+
+   if test -f "$tmpdepfile1"; then
+      tmpdepfile="$tmpdepfile1"
+   else
+      tmpdepfile="$tmpdepfile2"
+   fi
+   if test -f "$tmpdepfile"; then
+      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+      # That's a space and a tab in the [].
+      sed -e 's,^.*\.[a-z]*:[ 	]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+   else
+      echo "#dummy" > "$depfile"
+   fi
+   rm -f "$tmpdepfile"
+   ;;
+
+#nosideeffect)
+  # This comment above is used by automake to tell side-effect
+  # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the proprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  test -z "$dashmflag" && dashmflag=-M
+  ( IFS=" "
+    case " $* " in
+    *" --mode=compile "*) # this is libtool, let us make it quiet
+      for arg
+      do # cycle over the arguments
+        case "$arg" in
+	"--mode=compile")
+	  # insert --quiet before "--mode=compile"
+	  set fnord "$@" --quiet
+	  shift # fnord
+	  ;;
+	esac
+	set fnord "$@" "$arg"
+	shift # fnord
+	shift # "$arg"
+      done
+      ;;
+    esac
+    "$@" $dashmflag | sed 's:^[^:]*\:[ 	]*:'"$object"'\: :' > "$tmpdepfile"
+  ) &
+  proc=$!
+  "$@"
+  stat=$?
+  wait "$proc"
+  if test "$stat" != 0; then exit $stat; fi
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+dashXmstdout)
+  # This case only exists to satisfy depend.m4.  It is never actually
+  # run, as this mode is specially recognized in the preamble.
+  exit 1
+  ;;
+
+makedepend)
+  # X makedepend
+  (
+    shift
+    cleared=no
+    for arg in "$@"; do
+      case $cleared in no)
+        set ""; shift
+	cleared=yes
+      esac
+      case "$arg" in
+        -D*|-I*)
+	  set fnord "$@" "$arg"; shift;;
+	-*)
+	  ;;
+	*)
+	  set fnord "$@" "$arg"; shift;;
+      esac
+    done
+    obj_suffix="`echo $object | sed 's/^.*\././'`"
+    touch "$tmpdepfile"
+    ${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@"
+  ) &
+  proc=$!
+  "$@"
+  stat=$?
+  wait "$proc"
+  if test "$stat" != 0; then exit $stat; fi
+  rm -f "$depfile"
+  cat < "$tmpdepfile" > "$depfile"
+  sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly.  Breaking it into two sed invocations is a workaround.
+    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile" "$tmpdepfile".bak
+  ;;
+
+cpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the proprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  ( IFS=" "
+    case " $* " in
+    *" --mode=compile "*)
+      for arg
+      do # cycle over the arguments
+        case $arg in
+	"--mode=compile")
+	  # insert --quiet before "--mode=compile"
+	  set fnord "$@" --quiet
+	  shift # fnord
+	  ;;
+	esac
+	set fnord "$@" "$arg"
+	shift # fnord
+	shift # "$arg"
+      done
+      ;;
+    esac
+    "$@" -E |
+    sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+    sed '$ s: \\$::' > "$tmpdepfile"
+  ) &
+  proc=$!
+  "$@"
+  stat=$?
+  wait "$proc"
+  if test "$stat" != 0; then exit $stat; fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  cat < "$tmpdepfile" >> "$depfile"
+  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+msvisualcpp)
+  # Important note: in order to support this mode, a compiler *must*
+  # always write the proprocessed file to stdout, regardless of -o,
+  # because we must use -o when running libtool.
+  ( IFS=" "
+    case " $* " in
+    *" --mode=compile "*)
+      for arg
+      do # cycle over the arguments
+        case $arg in
+	"--mode=compile")
+	  # insert --quiet before "--mode=compile"
+	  set fnord "$@" --quiet
+	  shift # fnord
+	  ;;
+	esac
+	set fnord "$@" "$arg"
+	shift # fnord
+	shift # "$arg"
+      done
+      ;;
+    esac
+    for arg
+    do
+      case "$arg" in
+      "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+	set fnord "$@"
+	shift
+	shift
+	;;
+      *)
+	set fnord "$@" "$arg"
+	shift
+	shift
+	;;
+      esac
+    done
+    "$@" -E |
+    sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+  ) &
+  proc=$!
+  "$@"
+  stat=$?
+  wait "$proc"
+  if test "$stat" != 0; then exit $stat; fi
+  rm -f "$depfile"
+  echo "$object : \\" > "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
+  echo "	" >> "$depfile"
+  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+  rm -f "$tmpdepfile"
+  ;;
+
+none)
+  exec "$@"
+  ;;
+
+*)
+  echo "Unknown depmode $depmode" 1>&2
+  exit 1
+  ;;
+esac
+
+exit 0
diff --git a/doc/Makefile.am b/doc/Makefile.am
new file mode 100644
index 0000000..64bea14
--- /dev/null
+++ b/doc/Makefile.am
@@ -0,0 +1 @@
+EXTRA_DIST = yagi.1.html first.1.html input.1.html output.1.html optimise.1.html dipole.1.html index.html pattern.jpg  yagi.jpg
diff --git a/doc/Makefile.in b/doc/Makefile.in
new file mode 100644
index 0000000..de448e3
--- /dev/null
+++ b/doc/Makefile.in
@@ -0,0 +1,242 @@
+# Makefile.in generated by automake 1.7 from Makefile.am.
+# @configure_input@
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__quote = @am__quote@
+bindir = @bindir@
+build_alias = @build_alias@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+EXTRA_DIST = yagi.1.html first.1.html input.1.html output.1.html optimise.1.html dipole.1.html index.html pattern.jpg  yagi.jpg
+subdir = doc
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+DIST_COMMON = Makefile.am Makefile.in
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.ac $(ACLOCAL_M4)
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  doc/Makefile
+Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+uninstall-info-am:
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkinstalldirs) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile
+
+installdirs:
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-rm -f Makefile $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+	distclean-generic distdir dvi dvi-am info info-am install \
+	install-am install-data install-data-am install-exec \
+	install-exec-am install-info install-info-am install-man \
+	install-strip installcheck installcheck-am installdirs \
+	maintainer-clean maintainer-clean-generic mostlyclean \
+	mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \
+	uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/doc/dipole.1.html b/doc/dipole.1.html
new file mode 100644
index 0000000..2cec9ce
--- /dev/null
+++ b/doc/dipole.1.html
@@ -0,0 +1,47 @@
+<HTML>
+<BODY>
+<PRE>
+<!-- Manpage converted by man2html 3.0.1 -->
+.SH NAME
+dipole \- Yagi-Uda project file. Computez Z of a dipole
+.SH SYNOPSIS
+.B yagi 
+[
+.B -\ dhps
+]
+filename 
+.SH DESCRIPTION
+The program 
+.I dipole
+is one of a number of executable programs that forms part of a set of 
+programs, collectively known as the
+.I Yagi-Uda project
+, which were designed for analysis and optimisation of Yagi-Uda antennas. 
+.I dipole
+Was added to find the impedance of just a single dipole. 
+.br
+.SH "SEE ALSO"
+<B>first(1)</B>, <B>input(1)</B>, <B>output(1)</B>, <B>optimise(1)</B>, <B>first(5)</B>, <B>input(5)</B>, <B>output(5)</B> and <B>optimise(5)</B>.
+
+.SH PLATFORMS
+Only UNIX versions have been produced. I can't be bothered
+with brain-dead operating systems like Windoze. 
+.SH BUGS
+Bugs should be reported to
+.BR david.kirkby at onetel.net .
+Bugs tend actually to be fixed if they can be isolated, so it is in your
+interest to report them in such a way that they can be easily reproduced.
+If the input file is edited manually and done incorrectly, there can be unpredictable results.
+
+.SH AUTHORS
+
+Dr. David Kirkby G8WRB (david.kirkby at onetel.net), with 
+help with converting to DOS from Dr. Joe Mack NA3T (mack at fcrfv2.ncifcrf.gov).
+</PRE>
+<HR>
+<ADDRESS>
+Man(1) output converted with
+<a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>
+</ADDRESS>
+</BODY>
+</HTML>
diff --git a/doc/first.1.html b/doc/first.1.html
new file mode 100644
index 0000000..51145fe
--- /dev/null
+++ b/doc/first.1.html
@@ -0,0 +1,134 @@
+<HTML>
+<BODY>
+<PRE>
+<!-- Manpage converted by man2html 3.0.1 -->
+
+</PRE>
+<H2>NAME</H2><PRE>
+     first - Yagi-Uda project quick antenna builder
+
+
+</PRE>
+<H2>SYNOPSIS</H2><PRE>
+     <B>first</B> filename  elements f_min f_design f_max f_step  diame-
+     ter
+
+
+</PRE>
+<H2>DESCRIPTION</H2><PRE>
+     The program <B>first</B> is one of a number of executable  programs
+     that  forms part of a set of programs, collectively known as
+     the <I>Yagi</I>-<I>Uda</I> <I>project</I> , which were designed for analysis  and
+     optimisation  of  Yagi-Uda antennas. <I>first</I> is used to define
+     an antenna quickly, if you are not interested in analysing a
+     specific design (in which case use <I>input</I> ) but need to get a
+     design that is half-way reasonable so that it may be  optim-
+     ised.  It  is much faster in use (since its not interactive)
+     than <I>input</I> The design methodology that <I>first</I>  is  the  DL6WU
+     antenna  designs,  which  are valid for 10 or more elements,
+     although <I>first</I> will calculate for any  number  of  elements.
+     DL6WU  reccomends  a folded dipole, but the designs here are
+     for a simple dipole, since I don't yet know how to calculate
+     the self and mutual impedances of folded dipoles.
+
+
+</PRE>
+<H2>LIMITATIONS</H2><PRE>
+     Filenames, including full path, can't exceed 90 characters.
+
+     Does not take into account the variation of impedance  of  a
+     dipole with change in wavelength/diameter of elements.
+
+
+</PRE>
+<H2>FILES</H2><PRE>
+     filename          Yagi description, created by first.
+     filename.out      Binary data file, created by yagi.
+     filename.dat      Performance of antenna, created by output.
+     filename.gai      Gain of antenna, created by output.
+
+     The DOS .EXE files as distributed require a 387 maths copro-
+     cessor  to  be  present  and will not run without it. A 486,
+     Pentium, and I assume later processors of this  series  will
+     run it without any extra hardware.
+
+
+
+</PRE>
+<H2>PLATFORMS</H2><PRE>
+     Both DOS and and Unix versions have been built. The DOS ver-
+     sion  as  distributed  requires  a  386  PC with a 387 maths
+     coprocessor. The DOS version is no longer  being  developed,
+     so  the  DOS  executables included with the distribution are
+     not upto date with the current source code.
+
+
+
+</PRE>
+<H2>AUTHORS</H2><PRE>
+     Dr. David Kirkby G8WRB (david.kirkby at onetel.net).  with help
+     with  the  conversion  to the DOS/PC enviroment from Dr. Joe
+     Mack NA3T (mack at fcrfv2.ncifcrf.gov)
+
+
+</PRE>
+<H2>SEE ALSO</H2><PRE>
+     <B>input(1)</B>, <B>output(1)</B>, <B>yagi(1)</B>, <B>optimise(1)</B>.
+
+
+</PRE>
+<H2>BUGS</H2><PRE>
+     Bugs  should   be   reported   to:    David   Kirkby   G8WRB
+     (david.kirkby at onetel.net).   Bugs  tend actually to be fixed
+     if they can be isolated, so it is in your interest to report
+     them in such a way that they can be easily reproduced.
+
+     If the input file is edited manually and  done  incorrectly,
+     there can be unpredictable results.
+
+     Options are not checked for  sensible  numbers.  A  negative
+     length can be entered!
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+<HR>
+<ADDRESS>
+Man(1) output converted with
+<a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>
+</ADDRESS>
+</BODY>
+</HTML>
diff --git a/doc/index.html b/doc/index.html
new file mode 100644
index 0000000..e64b465
--- /dev/null
+++ b/doc/index.html
@@ -0,0 +1,134 @@
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+   <meta name="GENERATOR" content="Mozilla/4.7 [en] (X11; I; SunOS 5.8 sun4m) [Netscape]">
+   <title>Yagi antenna analysis with the Yagi-Uda Project.</title>
+</head>
+<body>
+
+<h1>
+Yagi antenna analysis with the Yagi-Uda Project</h1>
+
+<p><br><font size=+2>Written by Dr. David Kirkby, G8WRB. email <a href="mailto: david.kirkby at onetel.net">david.kirkby at onetel.net</a></font>
+<br><font size=+1>Homepage: <a href="http://www.medphys.ucl.ac.uk/~drkirkby/">http://www.medphys.ucl.ac.uk/~drkirkby/</a></font>
+<p><b><font size=+1>Introduction</font></b>
+<p><font size=+1>The Yagi-Uda project is a set of programmes for designing,
+analysing and optimising Yagi-Uda antennas, with 2 or more elements, such
+as shown below.</font>
+<p><img SRC="yagi.jpg" height=258 width=402>
+<p><font size=+1>The programmes were developed by Dr. David Kirkby (G8WRB)
+and run on unix systems. They have been successfully compiled on Solaris
+8 (SPARC), Red Hat linux (release 6.1 on a PC) and FreeBSD on a PC. In
+each case the gcc C compiler (2.95.1 or 2.95.1) were used. There are some
+old 32-bit DOS executables, but they are no longer updated. <font color="#FF0000">There
+are no executables for any version of Microsoft Windows (Win 3.1, 95, 88,
+NT or 2000).</font></font>
+<p><font size=+1>Several programmes are included:</font>
+<br> 
+<li>
+<i><font size=+1><a href="http://www.g8wrb/yagi/first.html">first</a></font></i></li>
+
+<li>
+<font size=+1><a href="http://www.g8wrb.org/yagi/input.html">input</a></font></li>
+
+<li>
+<font size=+1><a href="http://www.g8wrb.org/yagi/yagi.html">yagi</a></font></li>
+
+<li>
+<font size=+1><a href="http://www.g8wrb.org/yagi/output.html">output</a></font></li>
+
+<li>
+<font size=+1><a href="http://www.g8wrb.org/yagi/optimise.html">optimise</a></font></li>
+<li>
+<font size=+1><a href="http://www.g8wrb.org/yagi/dipole.html">dipole</a></font></li>
+
+<br> 
+<p> 
+<p><font size=+1>A few other programmes that were developed for test purposes
+are included, but there are not needed for normal use.</font>
+<p><font size=+1><a href="http://www.g8wrb.org/yagi/yagiuda-1.19.tar.gz">Download
+the latest  (version 1.19) source file for unix</a></font>
+<p><font size=+1>Here are the old source files -  versions  <a href="http://www.g8wrb.org/yagi/old_sources/yagiuda-1.15.tar.gz">1.15</a>
+
+<a href="http://www.g8wrb.org/yagi/old_sources/yagiuda-1.16.tar.gz">1.16</a>   
+<a href="http://www.g8wrb.org/yagi/old_sources/yagiuda-1.17.tar.gz">1.17</a>-</font>
+<p><font size=+1><a href="http://www.g8wrb.org/yagi/install.html">Building
+the programmes</a></font>
+<p><b><font size=+1>Designing an antenna.</font></b>
+<p><font size=+1>Several stages are needed to design a Yagi-Uda  antenna
+using these tools</font>
+<p><font size=+1>1) What you do first depends on whether you have an antenna
+design you wish to analyse (like one from a book) or if you want to design
+one using the tools in the Yagi-Uda project.</font>
+<p><font size=+1>a) If you have an antenna you wish to analyse, use <i><a href="http://www.g8wrb.org/yagi/input.html">input</a></i>
+to specify it in the form suitable for the programmes in the Yagi-Uda project.</font>
+<p><b><font size=+1>OR</font></b>
+<p><font size=+1>b) Assuming you don't know exactly what you wish to analyse,
+you can let the programme <i><a href="http://www.g8wrb.org/yagi/first.html">first</a></i>
+design you an antenna. It wont be good, but it is sufficiently close to
+optimal that it can be optimised with <i><a href="http://www.g8wrb.org/yagi/optimise.html">optimise</a></i>.</font>
+<p><font size=+1>2) Calculate the currents in the antenna, using the programme
+<u><a href="http://www.g8wrb.org/yagi/yagi.html">yagi</a></u></font>
+<p><font size=+1>3) Calculate the performance of the antenna using the
+programme
+<i><a href="http://www.g8wrb.org/yagi/output.html">output</a></i>.</font>
+<p><font size=+1>4) Look at the files created by <a href="output.html">output</a>
+to see how good the antenna is. A file<i> filename.gc</i> can be read into
+gnuplot.</font>
+<p><font size=+1>5) You may only want to do 1-4 above, but you will probably
+want to optimise the antenna, using <i><a href="http://www.g8wrb.org/yagi/optimise.html">optimise</a></i></font>
+<p><font size=+1>For more informaiton</font>
+<br><font size=+1>The programmes have on-line man pages, but there are
+available in html format too.  There were converted to html format
+using the programme <a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a></font>
+<li>
+<font size=+1><a href="http://www.g8wrb.org/yagi/first.1.html">first.1</a></font></li>
+
+<li>
+<font size=+1><a href="http://www.g8wrb.org/yagi/input.1.html">input.1</a></font></li>
+
+<li>
+<font size=+1><a href="http://www.g8wrb.org/yagi/yagi.1.html">yagi.1</a></font></li>
+
+<li>
+<font size=+1><a href="http://www.g8wrb.org/yagi/output.1.html">output.1</a></font></li>
+
+<li>
+<font size=+1><a href="http://www.g8wrb.org/yagi/optimise.1.html">optimise.1</a></font></li>
+
+<li>
+<font size=+1><a href="http://www.g8wrb.org/yagi/dipole.1.html">dipole.1</a></font></li>
+<br> 
+<p> 
+<br> 
+<br> 
+<br> 
+<br> 
+<p><font size=+1>There are also some files describing the file formats.</font>
+<br> 
+<li>
+<font size=+1><a href="http://www.g8wrb.org/yagi/first.5.html">first.5</a></font></li>
+
+<li>
+<font size=+1><a href="http://www.g8wrb.org/yagi/input.5.html">input.5</a></font></li>
+
+<li>
+<font size=+1><a href="http://www.g8wrb.org/yagi/yagi.5.html">yagi.5</a></font></li>
+
+<li>
+<font size=+1><a href="http://www.g8wrb.org/yagi/output.5.html">output.5</a></font></li>
+
+<li>
+<font size=+1><a href="http://www.g8wrb.org/yagi/optimise.5.html">optimise.5</a></font></li>
+
+<br> 
+<p> 
+<br> 
+<br> 
+<br> 
+<br> 
+<p><font size=+2>Dr. David Kirkby, G8WRB. email <a href="mailto: david.kirkby at onetel.net">david.kirkby at onetel.net</a></font>
+<br><font size=+1>homepage: <a href="http://www.medphys.ucl.ac.uk/~drkirkby/">http://www.medphys.ucl.ac.uk/~drkirkby/</a></font>
+</body>
+</html>
diff --git a/doc/input.1.html b/doc/input.1.html
new file mode 100644
index 0000000..01d289c
--- /dev/null
+++ b/doc/input.1.html
@@ -0,0 +1,132 @@
+<HTML>
+<BODY>
+<PRE>
+<!-- Manpage converted by man2html 3.0.1 -->
+
+</PRE>
+<H2>NAME</H2><PRE>
+     input - Yagi-Uda project antenna defining program
+
+
+</PRE>
+<H2>SYNOPSIS</H2><PRE>
+     <B>input</B> [ <B>-</B> <B>h</B> ]
+
+
+</PRE>
+<H2>DESCRIPTION</H2><PRE>
+     The program <I>input</I> is one of a number of executable  programs
+     that  forms part of a set of programs, collectively known as
+     the <I>Yagi</I>-<I>Uda</I> <I>project</I> , which were designed for analysis  and
+     optimisation  of  Yagi-Uda antennas. <I>input</I> is an interactive
+     program, that asks the user for  information  about  a  Yagi
+     design,  such  as position of elements, spacing between ele-
+     ments, frequency span of interest and a filename to save the
+     data  to.   <I>input</I> then writes this information into an ASCII
+     file, which can be read by <I>yagi</I>  or  <I>optimise</I>  The  file  is
+     ASCII  and  it's  format  is easily understood by inspection
+     (there are comments printed in it), so it can  if  necessary
+     be edited manually.
+
+     After running <I>input</I> and specifying a filename  (for  example
+     144e10)  you  should  then  type <I>yagi</I> <I>144e10</I> and then <I>output</I>
+     <I>144e10</I> and optionally <I>optimise</I> <I>144e10</I>
+
+
+</PRE>
+<H2>OPTIONS</H2><PRE>
+     -<B>h</B>   Print a help message.
+
+
+</PRE>
+<H2>FILES</H2><PRE>
+     filename         ASCII data file in which design is put.
+
+
+</PRE>
+<H2>PLATFORMS</H2><PRE>
+     Both DOS and Unix versions have been built. The DOS  version
+     as  distributed requires a 386 PC with a 387 maths coproces-
+     sor.
+
+
+
+</PRE>
+<H2>AUTHORS</H2><PRE>
+     Dr. David Kirkby G8WRB (david.kirkby at onetel.net).  with help
+     with  in  converting  to  DOS/PC  from  Dr.  Joe  Mack  NA3T
+     (mack at fcrfv2.ncifcrf.gov)
+
+
+</PRE>
+<H2>SEE ALSO</H2><PRE>
+     <B>first(1)</B>,  yagi(),  <B>output(1)</B>,   <B>optimise(1)</B>,   input   (5),
+     <B>first(5)</B>, <B>yagi(5)</B>, <B>output(5)</B> and <B>optimise(5)</B>.
+
+     Bugs should be reported to
+     <B>david.kirkby at onetel.net.</B>
+     Bugs tend actually to be fixed if they can be  isolated,  so
+     it  is  in  your  interest to report them in such a way that
+     they can be easily reproduced.
+
+
+     If a mistake is made  during  inputting  of  data  (such  as
+     entering an incorrect length), it is not possible to go back
+     and correct this. You should make a note of the  error,  and
+     edit  the  ASCII  text file with a text editor (vi, DOS edit
+     etc).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+<HR>
+<ADDRESS>
+Man(1) output converted with
+<a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>
+</ADDRESS>
+</BODY>
+</HTML>
diff --git a/doc/optimise.1.html b/doc/optimise.1.html
new file mode 100644
index 0000000..24e08d8
--- /dev/null
+++ b/doc/optimise.1.html
@@ -0,0 +1,819 @@
+<HTML>
+<BODY>
+<PRE>
+<!-- Manpage converted by man2html 3.0.1 -->
+
+</PRE>
+<H2>NAME</H2><PRE>
+     optimise - Yagi-Uda project antenna optimiser
+
+
+</PRE>
+<H2>SYNOPSIS</H2><PRE>
+     <B>optimise</B>   [   -<B>dhvwO</B>   ]   [   -<B>a</B><I>angular</I>_<I>stepsize</I>    ]    [
+     -<B>b</B><I>boom</I>_<I>extension</I> ] [ -<B>c</B><I>cleanliness</I>_<I>of</I>_<I>pattern</I> ] [ -<B>e</B><I>elements</I>
+     ] [ -<B>f</B><I>FBratio</I> ] [ -<B>g</B><I>GA</I>_<I>optimisation</I>_<I>method</I> ] -<B>l</B><I>percent</I>  ]  [
+     -<B>m</B><I>min</I>_<I>offset</I>_<I>from</I>_<I>peak</I> ] [ -<B>o</B><I>optimisation</I>_<I>criteria</I> ] [ -<B>p</B><I>po-</I>
+     <I>pulation</I> ] [ -<B>r</B><I>resistance</I> ] [ -<B>s</B><I>swr</I> ] [ -<B>t</B><I>length</I>_<I>tolerance</I> ]
+     [  -<B>x</B><I>reactance</I>  ]  [  -<B>A</B><I>Auto</I>_<I>gain</I> ] [ -<B>C</B><I>Currents</I>_<I>similar</I> ] [
+     -<B>F</B><I>weight</I>_<I>FB</I> ] [  -<B>G</B><I>weight</I>_<I>gain</I>  ]  [  -<B>K</B><I>keep</I>_<I>for</I>_<I>tries</I>  ]  [
+     -<B>P</B><I>weight</I>_<I>pattern</I>_<I>cleanliness</I>  ]  [  -<B>R</B><I>weight</I>_<I>resistance</I>  ] [
+     -<B>S</B><I>weight</I>_<I>swr</I>    ]     [     -<B>T</B><I>position</I>_<I>tolerance</I>     ]     [
+     -<B>W</B><I>Weighted</I>_<I>algorithm</I>   ]   [  -<B>X</B><I>weight</I>_<I>reactance</I>  [  <B>-Z</B><I>Zo</I>  ]
+     filename iterations
+
+
+</PRE>
+<H2>DESCRIPTION</H2><PRE>
+     The program <B>optimise</B> is one of a number of  executable  pro-
+     grams  that  forms  part  of a set of programs, collectively
+     known as the <I>Yagi</I>-<I>Uda</I> <I>project</I>  ,  which  were  designed  for
+     analysis  and  optimisation  of  Yagi-Uda antennas. <I>optimise</I>
+     attempts to optimise the performance of a Yagi  antenna  for
+     one  or  more parameters that are considered important, such
+     as gain, F/B ratio, VSWR  etc.  It  does  this  by  randomly
+     changing the lengths and positions, of one or more elements,
+     then comparing the performance before and after the  change.
+     Any   improvements   are   written  to  a  new  file  called
+     <I>filename</I>.<I>bes</I> where filename  is  the  name  of  the  antenna
+     description file created by <I>input</I> or <I>first</I>
+
+     When Yagi's are designed on paper, or  using  this  program,
+     its  possible  that they will be almost impossible to build,
+     if their performance depends too critically  on  the  dimen-
+     sions.  To  determine  if this is the case with a design, we
+     run optimise with  just  the  options  't'  and  'T'.  These
+     specify  the tolerance with which you can build the antenna,
+     expressed as a standard  deviation  in  mm.  In  this  case,
+     instead  of  trying to optimise a poor design, optimise will
+     calculate the minimum gain, maximum  VSWR,  and  minimum  FB
+     ratio  of  a  number of designs, all slightly different from
+     the input file. 99.7% of the components lie within 3  SD  of
+     the  mean, so if you think you can cut elements to with 1 mm
+     99.7% of the time, specify t0.33. If you can put them in the
+     boom to within 3 mm 99.7% of the time, specify T1.
+
+     If while <I>optimise</I> is running using the methods that  require
+     weights  to be attached to the gain, FB, SWR etc, it becomes
+     apparent, the weights are not optimum, its possible to pause
+     the  program  and  re-adjust the weights. If a file with the
+     name of <I>changes</I> is created, the  program  will  pause,  then
+     request new weights are entered at the keyboard.
+
+
+</PRE>
+<H2>AVAILABILITY</H2><PRE>
+
+</PRE>
+<H2>OPTIONS</H2><PRE>
+     -<B>d</B>   Print the  default  values  of  all  the  configureable
+          parameters  to  stdout.  Typing  this  option  with any
+          option  that  changes  a  parameter  (see  below)  will
+          display the new value of the parameter, rather than the
+          default.
+
+     -<B>h</B>   Print a help message.
+
+     -<B>v</B>   Print verbose status information.
+
+     -<B>w</B>   Instead of  optimising  at  one  fixed  frequency  (the
+          design frequency), this directs the program to optimise
+          at 3 separate frequencies (lowest, design and  highest)
+          then  to  average  data at all 3. This option is better
+          for wideband antenna. Note  that  the  input  impedance
+          printed is at the design frequency, *not* averaged over
+          3 frequencies. Averaging an  impedance,  is  likely  to
+          give  a very misleading impression. The impedance aver-
+          aged over 3 frequencies can be 50+i0 Ohms, even if  the
+          VSWR  is  very poor over all 3 frequencies, as the fol-
+          lowing 3 pieces of data show.
+          Z=147 + j 300  SWR= 15.46:1
+          Z=2   + j 100  SWR= 125:1
+          Z=1   - j 400  SWR= 3250:1
+          note in the above three cases, the average impedance is
+          50 + j 0, but average SWR is 1130:1.
+
+     -<B>O</B>   Over-optimisation allowed.   By  default,  the  program
+          does not over-optimise a parameter. For example, an SWR
+          of 1.01 is  usually  considered  good  enough  and  any
+          change, as long as the SWR stayed good, typically below
+          1.1:1, would be allowed,  even  if  the  SWR  rose.  By
+          default,  FB's  of 27 dB, VSWR's of 1.1 are acceptable.
+          However, by using the -<B>O</B> option,  you  can  insist  the
+          program always improves things, no matter how good they
+          are.
+
+          centage by setting <I>boom</I>_<I>extension</I> to whatever you wish.
+          -<I>b30</I>  will limit the boom to no more than 30% more than
+          the original length.
+
+     -<B>c</B><I>cleanliness</I>_<I>of</I>_<I>pattern</I>
+          Specify the number of dB down on the peak gain  to  aim
+          to  get  the  pattern. Any antenna pattern cleaner than
+          this will not effect the fitness, nor will it  be  con-
+          sidered  any  better when comparing to antenna designs.
+          20 dB seems reasonable, so the default is 20, but  this
+          may  of  course  change if it's deceided too. Check the
+          source code to be certain (see  REASONABLE_SIDELOBE  in
+          yagi.h).
+
+     -<B>e</B><I>elements</I>
+          is an integer which specifies the type of elements that
+          are changed in the optimisation cycle.  Possible values
+          are:
+           1 - alter only the driven element(s) length (useful to
+           bring to resonance)
+           2 - alter only  the  driven  element  position.  Don't
+           change its length.
+           4 - alter only the reflector length. The  position  is
+           always at x=0.
+           8 - alter only  the  director  lengths.  Don't  change
+           positions.
+           16 - alter only the director positions.  Don't  change
+           lengths.
+           32 - randomly adjust one element  length,  then  makes
+           all other the same. Don't change the positions.
+           64 - apply a linear taper to the lengths.
+           128 - Set the driven element to a resonate length.  It
+           may/may-not  be altered after the first run, depending
+           on the whether or not '1' is  invoked  too.  Eg  -e128
+           will  make it resonate and keep it there forever. How-
+           ever '-e129' will bring to resonance,  then  alter  to
+           maximuse performance.
+         The elements altered is made from a logical AND  of  the
+         above,  so  for  example to alter everything, except the
+         driven element length, use -e30, since 2+4+8+16=30.  The
+         default is equivalent to -<I>e31</I> , which changes everything
+         possible.  Note  the  reflector  position   is   *never*
+         changed. It's always at x=0.
+
+          greater than <I>FBratio</I> dB to be equal to <I>FBratio</I> dB. This
+          avoids optimising to a very high  FB  ratio,  which  is
+          impracticable,  as  the  bandwidth  over  which this FB
+          ratio will be maintained is very small  and  mechanical
+          considerations  will  prevent  you from constructing it
+          with such a high FB  ratio  anyway.  If  this  was  not
+          prevented, you might just happen to get an antenna with
+          100 dB FB ratio,  but  poor  gain  and  swr.  Since  by
+          default  all  parameters must improve, the optimisation
+          routine will most likely never being able to improve on
+          the  100  dB  FB  ratio, so no improvement will result.
+          Most people would prefer to get a few extra dB of gain,
+          even if the FB ratio dropped to 30 dB.
+
+     -<B>g</B><I>GA</I>_<I>optimisation</I>_<I>method</I>
+          Use a genetic algorithm. With  the  genetic  algorithm,
+          the  program  does not take any account any of the ini-
+          tial lengths/positions of  elements  specified  in  the
+          input file. Rather it works by initialising a number of
+          different antenna, then computing a 'fitness' value for
+          each.   The  fitness  value can depend on the gain, FB,
+          real part of the input impedance, reactive part of  the
+          input  impedance,  VSWR  or the level of the sidelobes.
+          The integer after the g tells  the  optimiser  what  to
+          consider.  -g1  Use gain
+          -g2  Use FB
+          -g4  Use R
+          -g8  Use X
+          -g16 Use the SWR
+          -g32 Use the level of the sidelobes.
+
+          You can use a logical AND of these, so for example -g49
+          will  use a genetic algorithm, optimising for gain, swr
+          and sidelobe level,  since  1(gain)+16(SWR)+32(sidelobe
+          level)=49.
+
+     -<B>l</B><I>percent</I>
+          is a parameter (floating point number) which  specifies
+          the  maximum  percentage  change  in  the  positions or
+          lengths of an elements at each iteration. If the option
+          is  not  used, it will be set internally at 10% for the
+          first 25% of the iterations, 1% for the next 25%,  0.1%
+          for  the  third 25% of the iterations and 0.01% for the
+          last 25% of the iterations. If set to a positive number
+          x  (eg optimise -l 0.3 145e10) then the percentage will
+          be set at x% for 25% of iterations, x/10 for the   next
+          25%, x/100 for the next 25 and x/1000 for the last 25%.
+          If set to a negative number  y  (eg  optimise  -l  -0.5
+          145e10)  then  the  paramters will stay fixed at y% (in
+          this example 0.5%) all the time.
+
+     -<B>m</B><I>min</I>_<I>offset</I>-<I>from</I>_<I>peak</I>
+          Sets the minimum angle in degrees offset from  theta=90
+          degrees,  where  the side lobes start and the main lobe
+          finishes. The higher the gain, the  smaller  it  should
+          be.  It  is  set  internally  if not set on the command
+          line.
+
+     -<B>o</B><I>optimisation</I>_<I>criteria</I>
+           1 -  Assume better if the gain has increased.
+           2 -  Assume better if the  front  to  back  ratio  has
+           improved.
+           4 -  Assume better if  the  real  part  of  the  input
+           impedance  is closer to the value that the program was
+           compiled for, or set using the '-Z' option. This  will
+           usually  be  50  Ohms, but you may wish to set this to
+           12.5 Ohms if you use a 4:1 balun.  Generally  you  can
+           get  higher  gain  from  a Yagi if you allow the input
+           impedance to fall, but of course  feeding  it  becomes
+           more difficult.
+           8 -  Assume better if the magnitude  of  the  reactive
+           component  of  the  input  impedance is lower (ie. the
+           antenna is nearer resonance).
+           16 - Assume better if the VSWR is lower.
+           32 - Assume better if the level of  all  sidelobes  is
+           lower.
+         The <I>optimisation</I>_<I>criteria</I> may be formed from  a  logical
+         AND  of these numbers, so for example choosing -<I>o19</I> will
+         only consider a revised antenna better than  the  previ-
+         ous,  if the SWR, gain and F/B ratio have all simultane-
+         ously improved.
+
+         Clearly an antenna which originally had 12 dB  gain  and
+         1.01:1  VSWR  but  then  changes  to 20 dB gain @ 1.02:1
+         VSWR, would to most people be better,  even  though  the
+         VSWR  has increased. By default, <I>optimise</I> only optimises
+         to sensible maximums, so to  not  let  the  optimisation
+         stall  prematurely.  By  running  <I>optimise</I> with no argu-
+         ments, the program will list the limits  of  acceptabil-
+         ity.  These might be typically F/B ratio > 27 dB, VSWR <
+         1.1:1, magnitude of input reactance less than 5 Ohms and
+         the  real  part  of the input impedance within 5 Ohms of
+         Zo. Choosing -<I>o19</I> (1+2+16=19)  will  optimise  for  gain
+         (since G=1), FB (since FB=2) and SWR (Since SWR=16), but
+         would consider a higher gain and FB ratio antenna better
+         than a previous one, even if the SWR rose, as long as it
+         stayed below 1.1:1 (or as was set  during  compilation).
+         The default behaviour (no options) is equivalent to -<I>o37</I>
+         which optimiseas for <B>gain(1)</B>, the real part of the input
+         <B>impedance(4)</B>  and  <B>sidelobes(32)</B> but this may be changed
+         at any time, so type <I>optimise</I> -<I>d</I> to  check  the  current
+         settings.  If  you  insist on the program optimisang for
+         the very best of all selected  parameters,  use  the  -O
+         option  too, but be warned the optimisation will probely
+         stick once it gets one parameter really good.
+
+     -<B>p</B><I>population</I>
+          This determines the initial population used   with  the
+          genetic algorithm.
+
+     -<B>r</B><I>resistance</I>
+          When optimising an antenna, consider any  input  resis-
+          tance  closer  to  Zo (usually 50 Ohms) than <I>resistance</I>
+          Ohms to be acceptable. This  avoids  optimising  to  an
+          input  resistance too close to Zo, which is impractica-
+          ble, as the bandwidth over which the  input  resistance
+          could  be  maintained is very small and mechanical con-
+          siderations will  prevent  you  from  constructing  the
+          antenna  with  such  an ideal input resistance. If this
+          was not prevented, you might  just  happen  to  get  an
+          antenna with an input resistance of 50.000001 Ohms, but
+          poor gain, FB and possibly even  a  poor  swr,  if  the
+          antenna  is  well away from resonance. Since by default
+          all parameters must improve, the  optimisation  routine
+          will get most likely never being able to improve on the
+          antenna, whereas we might be happier with a few more dB
+          gain,  if  the  input  resistance went to 50.1 Ohms. It
+          should be noted that the default  optimisation  routine
+          never  uses  the input resistance directly (only VSWR),
+          so this option cant be used without the '-o' option  to
+          optimise  for  other than the default parameters (gain,
+          VSWR and FB ratio).
+
+     -<B>s</B><I>swr</I>
+          When optimising an antenna, consider any SWR less  than
+          <I>swr</I> to be equal to <I>swr</I> This avoids optimising to a very
+          low swr, which is impracticable, as the bandwidth  over
+          which  such a low swr could be maintained would be very
+          small and mechanical considerations  will  prevent  you
+          from  constructing  such  an antenna anyway. If this is
+          was not prevented, you might  just  happen  to  get  an
+          antenna with an swr of 1.000000000001:1, but poor gain,
+          FB ratio. Since by default all parameters must improve,
+          the  optimisation  routine will most likely never being
+          able to improve on the antenna, even though in practice
+          you would like to get a few extra dB of gain if the SWR
+          would rise to 1.02:1. The default was equivalent  to  -
+          <I>s1</I>.<I>1</I>  but run <I>optimise</I> -<I>d</I> to display this and any other
+          defaults.
+
+     -<B>t</B><I>length</I>_<I>tolerance</I>
+          <I>length</I>_<I>tolerance</I> is the standard deviation in mm of the
+          accuracy  with  which you can cut elements. Since 99.7%
+          of elements will be with 3 standard deviations  of  the
+          mean length (stats theory says this), set -t0.2 if vir-
+          tually  all  (well  99.7%)  of  elements   are   within
+          3x0.2=0.6  mm of the correct length. This option *must*
+          be used with the '-T'  option and can't  be  used  with
+          any other options apart from
+
+     -<B>x</B><I>reactance</I>
+          When optimising an antenna, consider  any  input  reac-
+          tance  of  less  than  <I>reactance</I>  to be <I>reactance</I>. This
+          avoids over optimising the reactance, at the expense of
+          something else.
+
+     -<B>A</B><I>auto</I>_<I>gain</I>
+          When the <I>auto</I>_<I>gain</I> option is used. the program  maximes
+          the  gain of the antenna (ignoring all other parameters
+          such as SWR, FB ratio etc) by adjusting the length (not
+          position)  of  one element only. -A-1 will maximuse the
+          gain, by adjusting the length  of  the  reflector,  -A0
+          will  maximise  the gain by adjusting the length of the
+          driven element. Its generally *not* a good idea to max-
+          imise the gain by adjusting the driven element, but the
+          program lets you do it, but using the option -A0. Using
+          -A1  will  maximise gain by adjusting the length of the
+          first director, -A2 the second director and so  on,  up
+          to the last director. You must check carefully that the
+          input impedance in particular does not  fall  to  silly
+          values if you use this option. On a yagi with many ele-
+          ments (> 10 or so), you can pretty safely maximise  the
+          8th  or  more  director, but doing it on the reflector,
+          driven element or early directors often leads to  silly
+          input  impedances - so beware! Note, no matter how many
+          iterations you  specify,  this  process  is  only  done
+          once.Its  unlikely  you  will  be  able to do it again,
+          without things going out of hand, but if  you  must  do
+          it, you must re-run 'optimise' again.
+
+     -<B>C</B><I>currents</I>_<I>similar</I>
+          If this option is used, where  <I>currents</I>_<I>similar</I>  is  an
+          integer,  the program looks to make the currents in the
+          last <I>currents</I>_<I>similar</I> elements as similar as  possible.
+          It computes the sum of the squares of the deviations of
+          the absolute values of the element  currents  from  the
+          mean.  If  this  falls, and the criteria specified with
+          the -W option is also satisfied, the  antenna  is  con-
+          sidered  better. If <I>currents</I>_<I>similar</I> is three less than
+          the number of directors, it tries to make the  currents
+          in  the the directors (but ignoringing the first 3) all
+          similar. If <I>currents</I>_<I>similar</I> is equal to the number  of
+          directors,  it  tries  to  make  all the directors have
+          similar currents. If <I>currents</I>_<I>similar</I> is one more  than
+          the  number  of  directors,  it  tries  to make all the
+          directors and the reflector have similar  currents.  If
+          <I>currents</I>_<I>similar</I>  is  equal to the total number of ele-
+          ments, then it fails with an error message.
+
+     -<B>F</B><I>weight</I>_<I>FB</I>
+          is the floating point number (default  1.0)  specifying
+          the  weight  to  attach  to the FB ratio of the antenna
+          when using the '-W' option, which calculates a  fitness
+          for  the  antenna  based on one or more parameters (FB,
+          gain, input resistance, input reactance, SWR,  cleanli-
+          ness of antenna pattern). The '-F' option is similar to
+          the options -G, -P, -R, -S, -X (which  specify  weights
+          for  gain,  pattern  cleanliness, input resistance, SWR
+          and input reactance). When  using  the  -W  option  the
+          exact  algorithm used to compute the fitness (and hence
+          the effect of this parameter) is best checked by  look-
+          ing  at  the  source  code (see perform.c). This is one
+          area           of           constant            program
+          improvement/changes/development,  so  its  difficult to
+          say exactly the  effect  the  parameter  has.  However,
+          increasing the weight of a parameter (using the -F, -G,
+          -R, -S or -X options) will make  the associated parame-
+          ter  have  a  greater  effect  on the fitness. However,
+          unless you optimise for a high FB  ratio  with  the  -W
+          option, then setting the -F option will have no effect.
+          For example, setting the options -F2.5 -W1  is  a  com-
+          plete waste of time. There you have used the -W1 option
+          to optimise only for gain (see -W option section of man
+          page)  but have changed the weight of the FB ratio from
+          its default 1.0 to 2.5. If you are not  optimising  for
+          FB ratio, the weight you attach to it is irrelavent.
+
+     -<B>G</B><I>weight</I>_<I>gain</I>
+          is the floating point number (default  1.0)  specifying
+          the  weight  to  attach to the gain of the antenna when
+          using the '-W' option, which calculates a  fitness  for
+          the  antenna based on one or more parameters (FB, gain,
+          input resistance, input reactance, SWR, cleanliness  of
+          antenna  pattern).  The  '-G'  option is similar to the
+          options -F, -P, -R, -S, -X (which specify  weights  for
+          FB  ratio,  pattern  cleanliness, input resistance, SWR
+          and input reactance). When  using  the  -W  option  the
+          exact  algorithm used to compute the fitness (and hence
+          the effect of this parameter) is best checked by  look-
+          ing  at  the  source  code (see perform.c). This is one
+          area           of           constant            program
+          improvement/changes/development,  so  its  difficult to
+          say exactly the  effect  the  parameter  has.  However,
+          increasing the weight of a parameter (using the -F, -G,
+          -R, -S or -X options) will make  the associated parame-
+          ter  have  a  greater  effect  on the fitness. However,
+          unless you optimise for gain with the -W  option,  then
+          setting the -G option will have no effect. For example,
+          setting the options -G2.5 -W2 is a  complete  waste  of
+          time.  There  you  have used the -W2 option to optimise
+          only for FB ratio (see -W option section of  man  page)
+          but  have  changed  the  weight  of  the  gain from its
+          default 1.0 to 2.5. If you are not optimising for gain,
+          the weight you attach to it is irrelavent.
+
+     -<B>K</B><I>keep</I>_<I>for</I>_<I>tries</I>
+          <I>keep</I>_<I>for</I>_<I>tries</I> is the number of tries for the  optimise
+          to persist using the original data file as the starting
+          point for optimisation. By default it is 1, which means
+          the  program immediately looks from a new position once
+          a better one is found. It  is  theeoretically  possible
+          that  this might result in a quick, but poor local max-
+          imum. If however, <I>keep</I>_<I>for</I>_<I>tries</I> is 1000, it will  stay
+          at  a  position  for  1000 iterations after finding the
+          last best result, before considering this to be a  glo-
+          bal  optimum.  Then  it starts for the new position. In
+          practice, I have found  this  option  to  make  matters
+          worst  in  most cases. It was added to avoid the local-
+          minimum problem, but it appears the  optimisation  sur-
+          face  is  pretty  smooth, so it just slows the program,
+          without gaining much. Anyway, it can stay as an option,
+          but  check  the  results  with/without carefully before
+          using extensively.
+
+     -<B>P</B><I>pattern</I>_<I>cleanlyiness</I>
+          is the floating point number (default  1.0)  specifying
+          the  weight  to  attach to the cleanness of the antenna
+          pattern when using the '-W' option, which calculates  a
+          fitness for the antenna based on one or more parameters
+          (FB, gain,  input  resistance,  input  reactance,  SWR,
+          cleanliness  of  antenna  pattern).  The '-P' option is
+          similar to the  options  -F,  -G,  -R,  -S,  -X  (which
+          specify  weights  for FB ratio, gain, input resistance,
+          SWR and input reactance). When using the -W option  the
+          exact  algorithm used to compute the fitness (and hence
+          the effect of this parameter) is best checked by  look-
+          ing  at  the  source  code (see perform.c). This is one
+          area           of           constant            program
+          improvement/changes/development,  so  its  difficult to
+          say exactly the  effect  the  parameter  has.  However,
+          increasing the weight of a parameter (using the -F, -G,
+          -R, -S or -X options) will make  the associated parame-
+          ter  have  a  greater  effect  on the fitness. However,
+          unless you optimise for a clean  antenna  pattern  with
+          the  -W option, then setting the -P option will have no
+          effect. For example, setting the options -P2.5 -W1 is a
+          complete  waste  of  time.  There you have used the -W1
+          option to optimise only for gain (see -W option section
+          of man page) but have changed the weight of the pattern
+          cleanliness from its default 1.0 to 2.5. If you are not
+          optimising  for  a  clean radiation pattern, the weight
+          you attach to it is irrelavent.  With appropiate use of
+          the  -W  option (eg -W49 for gain, SWR and a clean pat-
+          tern), the computer program finds the level of the most
+          significant  sidelobe,  wherever  it may be outside the
+          main bean. It then optimises to  reduce  this.  The  -P
+          option tells it how much weight to put on reducing this
+          sidelobe.
+
+     -<B>R</B><I>weight</I>_<I>resistance</I>
+          is the floating point number (default  1.0)  specifying
+          the  weight  to attach to the obtaining an input resis-
+          tance close to Zo on the antenna when  using  the  '-W'
+          option,  which  calculates  a  fitness  for the antenna
+          based on one or more parameters (FB, gain, input resis-
+          tance,  input  reactance,  SWR,  cleanliness of antenna
+          pattern). The '-R' option is similar to the options -F,
+          -G,  -P,  -S,  -X  (which specify weights for FB, gain,
+          pattern cleanliness, SWR  and  input  reactance).  When
+          using the -W option the exact algorithm used to compute
+          the fitness (and hence the effect of this parameter) is
+          best  checked  by  looking  at  the  source  code  (see
+          perform.c).  This  is  one  area  of  constant  program
+          improvement/changes/development,  so  its  difficult to
+          say exactly the  effect  the  parameter  has.  However,
+          increasing the weight of a parameter (using the -F, -G,
+          -R, -S or -X options) will make  the associated parame-
+          ter  have  a  greater  effect  on the fitness. However,
+          unless you optimise for an an input resistance close to
+          Zo, with the -W option, then setting the -R option will
+          have no effect. For example, setting the options  -R2.5
+          -W1  is  a  complete waste of time. There you have used
+          the -W1 option to optimise only for gain (see -W option
+          section of man page) but have changed the weight of the
+          resistance from its default 1.0 to 2.5. If you are  not
+          optimising  for  an  input  resistance close to Zo, the
+          weight you attach to it is irrelavent.
+
+     -<B>S</B><I>weight</I>_<I>swr</I>
+          is the floating point number (default  1.0)  specifying
+          the  weight  to  attach  to the SWR of the antenna when
+          using the '-W' option, which calculates a  fitness  for
+          the  antenna based on one or more parameters (FB, gain,
+          input resistance, input reactance, SWR, cleanliness  of
+          antenna  pattern).  The  '-S'  option is similar to the
+          options -F, -G, -P, -R, -X (which specify  weights  for
+          FB,  gain,  pattern  cleanliness,  input resistance and
+          input reactance). When using the -W  option  the  exact
+          algorithm  used  to  compute the fitness (and hence the
+          effect of this parameter) is best checked by looking at
+          the  source  code  (see perform.c). This is one area of
+          constant  program  improvement/changes/development,  so
+          its  difficult  to say exactly the effect the parameter
+          has. However, increasing  the  weight  of  a  parameter
+          (using the -F, -G, -R, -S or -X options) will make  the
+          associated parameter have a greater effect on the  fit-
+          ness.  However, unless you optimise for SWR with the -W
+          option, then setting the -S option will have no effect.
+          For  example,  setting  the options -S2.5 -W1 is a com-
+          plete waste of time. There you have used the -W1 option
+          to optimise only for gain (see -W option section of man
+          page) but have changed the weight of the SWR  from  its
+          default  1.0 to 2.5. If you are not optimising for SWR,
+          the weight you attach to it is irrelavent.
+
+     -<B>T</B><I>position</I>_<I>tolerance</I>
+          <I>position</I>_<I>tolerance</I> is the standard deviation in  mm  of
+          the  accuracy  with  which  you can cut elements. Since
+          99.7% of elements will be with 3 standard deviations of
+          the  correct position (stats theory says this), set -T2
+          if virtually all (well 99.7%) of  elements  are  within
+          3x2=6  mm of the correct position.This option *must* be
+          used with the '-t'  option and can't be used  with  any
+          other options apart from
+
+     -<B>W</B><I>Weighted</I>_<I>algorithm</I>
+          Try to get an antenna which is better  according  to  a
+          weighted combination of parameters, rather than require
+          them all to improve. The integer specifies what to con-
+          sider in the weighted parameters.
+          W1 Gain.
+          W2 FB
+          W4 R
+          W8 X
+          W16 SWR
+          W32 SIDE_LOBE
+          You can logically AND these together,  so  for  example
+          -W3  will optimise using a weighted combination of gain
+          and FB. -W49, will use a weighted combination of  gain,
+          swr and sidelobe leve, since 32+16+1=49.
+
+     -<B>X</B><I>weight</I>_<I>reactance</I>
+          is the floating point number (default  1.0)  specifying
+          the weight to attach to achieving a low input reactance
+          on the antenna when using the '-W' option, which calcu-
+          lates  a  fitness  for the antenna based on one or more
+          parameters (FB, gain,  input  resistance,  input  reac-
+          tance,  SWR,  cleanliness of antenna pattern). The '-X'
+          option is similar to the options -F, G, -P, -R  and  -S
+          (which  specify  weights  for  FB  ratio, gain, pattern
+          cleanliness, input resistance, and SWR). When using the
+          -W  option the exact algorithm used to compute the fit-
+          ness (and hence the effect of this parameter)  is  best
+          checked  by looking at the source code (see perform.c).
+          This    is    one    area    of    constant     program
+          improvement/changes/development,  so  its  difficult to
+          say exactly the  effect  the  parameter  has.  However,
+          increasing the weight of a parameter (using the -F, -G,
+          -R, -S or -X options) will make  the associated parame-
+          ter  have  a  greater  effect  on the fitness. However,
+          unless you optimise for a low input reactance with  the
+          -W  option,  then  setting  the  -X option will have no
+          effect. For example, setting the options -X2.5 -W1 is a
+          complete  waste  of  time.  There you have used the -W1
+          option to optimise only for gain (see -W option section
+          of man page) but have changed the weight of the reacti-
+          ance from its default  1.0  to  2.5.  If  you  are  not
+          optimising  for  a  low input reactance, the weight you
+          attach to it is irrelavent.
+
+     -<B>Z</B><I>Zo</I>
+          <I>Zo</I> is the characteristic impedance used when evaluating
+          the VSWR, reflection coefficient and other similar cal-
+          culations. The optimiser usually  tries  to  bring  the
+          input impedance of the antenna to this value. It is set
+          by default to 50 Ohms, so the default is equivalent  to
+          -<I>Z50</I> but may be set to any positive number. Set to 12.5
+          Ohms if you are going to feed the antenna  with  a  4:1
+          balun.  Generally  speaking,  the gain of a Yagi can be
+          higher for low input impedances,  but  of  course  such
+          antennas are more difficult to feed.
+
+     <I>filename</I>
+          This is the name of the  file  containing  the  antenna
+          description.  It  is expected to be in a format created
+          by either <I>input</I> or <I>first</I> - two other  programs  in  the
+          <I>Yagi</I>-<I>Uda</I> <I>project</I>. This is an ASCII text file.
+
+     <I>iterations</I>
+          is an integer specifying the number of  iterations  for
+          the  optimiser  to  perform  to  try  to  get  the best
+          antenna. Time will limit the number  you  choose.  1000
+          iterations of a 1ele yagi takes about 5 seconds, a 6ele
+          approximately 60 seconds, an 11 element 350 seconds,  a
+          20 element 1030 seconds, a 33ele 2440 seconds, a 50ele-
+          ment 5400 seconds, 100ele 21320 seconds all on  an  old
+          25MHz 486 PC with no external cache.  When using the -<I>A</I>
+          option the <I>iterations</I> is automatically  set  internally
+          so  only  one attempt is made.  When using the '-t' and
+          '-T' options, <I>iterations</I> specifies the number of itera-
+          tions  to  attempt to get a poorer design, to check the
+          sensitivity of the design to small manufacturing toler-
+          ances.
+
+
+</PRE>
+<H2>EXAMPLES</H2><PRE>
+     Here are a number of examples of using <I>optimise</I>.
+
+     1) optimise 5ele 1000
+
+     Here the file 5ele will be optimised using the default  sys-
+     tem for 1000 iterations. The default might typically require
+     gain, FB and SWR to all improve, but this may be changed  at
+     any  time.  In  any  case,  the  program  tells you what its
+     optimising for. By default the program will only optimise to
+     the  selected  parameters  are good, not over-optimising any
+     one at the detrement of the others.
+
+     2) optimise -b30 -f50 -s2 5ele 1000
+
+     This is similar to above, but the boom  can  not  extend  by
+     more  than 30% from its  original length, FB ratios above 50
+     dB are considered acceptable, as are SWR's  less  than  2:1.
+     The  optimised resultant antenna is likely to have better FB
+     ratio, but poorer SWR than in (1) above.
+
+     3) optimise -o1 5ele 1000
+
+     This will simply optimise 5ele for maximum forward gain. The
+     resultant  antenna may have a poor FB ratio and is likely to
+     have an unacceptably low  input  impedance  and  hence  high
+     VSWR. This is not a very sensible method of optimisation.
+
+     4) optimise -W49 -l7 5ele 10000
+
+     This will optimise the file 5ele using for 10000 iterations.
+     It will require that the weighted performance of the antenna
+     in three important parameters (gain, sidelobe level and SWR)
+     improves  from one design to the next. One or two parameters
+     can actually get worst from one design to the next, but  the
+     weighted  performance  is  better. The positions of the ele-
+     ments or lengths of elements will not change by more than 7%
+     in each iteration.
+
+     5) optimise -g -S30 -G50 -F20 -p1500 5ele 10000
+
+     This will optimise the file 5ele using a genetic  algorithm.
+     1500  antennas will be randomly designed. The performance of
+     each of these will  measured  using  a  'fitness'  function,
+     weighted  30%  to  SWR, 50% to gain and 20% to FB ratio. The
+     probability of breading from a pair of antennas  is  propor-
+     tional to the fitness function.
+
+     6) optimise -w atv_antenna 10000
+
+     This will optimise the file atv_antenna for a  best  average
+     performance  over  a  wide band. The progrram calculates the
+     gain, FB and SWR at  three  frequencies,  then  computes  an
+     average  (mean)  performance of the antenna over the band. N
+     iterations will take 3x as long to execute as  N  iterations
+     on the same antenna without the '-w' option.
+
+     7) optimise -t0.1 -T1  good_design 100
+
+     This will take the file good_design and make  100  different
+     antennas from it, to simulate the effects of building toler-
+     ances. Each element is assumed to be cut so  that  the  mean
+     error  of  all elements is 0 mm, but a standard deviation of
+     0.1 mm, so 68.4% of element lengths are within 0.1 mm, 95.4%
+     within  0.2  mm  and  99.7%  with in 0.3 mm. The accuracy of
+     placing elements along the boom is much lower,  so  here  we
+     have  specified  a standard deviation of 1.0 mm, so 68.6% of
+     elements are placed within 1 mm  of  the  correct  position,
+     95.4%  within 2 mm of the correct position etc.  The program
+     will report the *worst* performances achieved. If  the  per-
+     formance  dips  too mush, then you either need to build them
+     better, or get a design that's less critical!
+
+
+
+</PRE>
+<H2>STOPPING</H2><PRE>
+     <I>Optimise</I> will stop after the number of iterations  specified
+     in  the  parameter  <I>iterations</I>.  It will also stop if a file
+     <I>stop</I> exits  in  the  current  directory  of  the  executable
+     <I>optimise</I>  This  file  can  of course only be created using a
+     multi-tasking operating system such as  Unix.  It  is  *not*
+     advisable  to stop the program by hitting the DEL key (Unix)
+     or CONTROL-C (DOS), as one of the files may be open  at  the
+     time, resulting in an empty file. Files are not open for any
+     longer than necessary (they  are  closed  immediately  after
+     writing  to  them),  so this is not a likely occurrence, but
+     can still occur.
+
+
+</PRE>
+<H2>LIMITATIONS</H2><PRE>
+     I'm not aware of any limitations, apart from that filenames,
+     including full path, can't exceed 90 characters.
+
+
+</PRE>
+<H2>FILES</H2><PRE>
+     filename           Antenna description, created by input or first.
+     filename.up    Update file, listing achievements of optimise.
+     filename.bes       Best file, containing the best design to date.
+     changes         File that causes the program to pause to re-adjust weights.
+     stop            File that stops optimisation process.
+
+
+</PRE>
+<H2>SEE ALSO</H2><PRE>
+     <B>first(1)</B>, <B>input(1)</B>, <B>output(1)</B>, <B>yagi(1)</B>,  <B>first(5)</B>,  <B>input(5)</B>
+     <B>output(5)</B> and <B>optimise(5)</B>.
+
+
+
+</PRE>
+<H2>PLATFORMS</H2><PRE>
+     Both DOS and Unix versions have been built. The DOS  version
+     as  distributed requires a 386 PC with a 387 maths coproces-
+     sor.
+
+     Although I have altered the source to make it more  compati-
+     ble  with DOS (reduced file name lengths etc), my wish is to
+     build a decent program, rather than fit the  program  to  an
+     outdated  operating  system.  If there is a *good* reason to
+     use code that is incompatible with DOS, this will be done.
+     Since <I>optimise</I> takes  a while to optimise an  antenna  (I've
+     optimised  one design for a week), it is obviously more sen-
+     sible to build this program under a multi-tasking  operating
+     system, as otherwise a PC can be tied up for days.
+
+
+</PRE>
+<H2>BUGS</H2><PRE>
+     Bugs should be reported  to  <B>david.kirkby at onetel.net</B>.   Bugs
+     tend  actually to be fixed if they can be isolated, so it is
+     in your interest to report them in such a way that they  can
+     be easily reproduced.
+
+     The program will dump core (crash) if asked  to  optimise  a
+     1ele  beam,  without  any arguments.  This is because a 1ele
+     beam has no parasitic elements and by  default  the  program
+     only changes parasitic elements.
+
+     Some of the options are not  checked  for  sensible  values,
+     although  most are now checked and report if they are out of
+     range.
+
+     If the user specifies very large manufacturing errors  using
+     the  '-t'  and  '-T'  options,  its possible for elements to
+     overlap or for element lengths to become negative. This will
+     cause numerical errors. Any reasonable values will not cause
+     this.
+
+
+     On long Yagi's (50 elements) optimise can go a bit silly. It
+     can  optimise  say  a 1296MHz Yagi to get 20 dB at 1296 MHz,
+     but less than 0 dB at only 1 MHz away. Needs some thought!
+
+     The level of the sidelobes is not computed with  the  GA  or
+     some other optimisation types. This will be corrected later.
+
+     All those I don't know about.
+
+
+
+</PRE>
+<H2>AUTHORS</H2><PRE>
+     Dr. David Kirkby G8WRB (david.kirkby at onetel.net).  with help
+     with   converting   to   DOS   from   Dr.   Joe   Mack  NA3T
+     (mack at fcrfv2.ncifcrf.gov)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+<HR>
+<ADDRESS>
+Man(1) output converted with
+<a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>
+</ADDRESS>
+</BODY>
+</HTML>
diff --git a/doc/output.1.html b/doc/output.1.html
new file mode 100644
index 0000000..6a3b7f2
--- /dev/null
+++ b/doc/output.1.html
@@ -0,0 +1,188 @@
+<HTML>
+<BODY>
+<PRE>
+<!-- Manpage converted by man2html 3.0.1 -->
+
+</PRE>
+<H2>NAME</H2><PRE>
+     output - Yagi-Uda project antenna display program
+
+
+</PRE>
+<H2>SYNOPSIS</H2><PRE>
+     <B>output</B> [ <B>-</B> <B>cehps</B> ] [ -<B>E</B><I>E</I>_<I>max</I> ] [ -<B>H</B><I>Hmax</I> ] [  -<B>r</B><I>minimum</I>  ]  [
+     -<B>R</B><I>maximum</I> ] [ -<B>Z</B><I>Zo</I> ]
+
+     filename
+
+
+</PRE>
+<H2>DESCRIPTION</H2><PRE>
+     The program <I>output</I> is one of a number of executable programs
+     that  forms part of a set of programs, collectively known as
+     the <I>Yagi</I>-<I>Uda</I> <I>project</I> , which were designed for analysis  and
+     optimisation  of  Yagi-Uda  antennas.  <I>output</I> calculates the
+     gain, FB ratio, input impedance etc etc of an  antenna  that
+     was  described by the program <I>input</I> or <I>first</I> and has had the
+     element currents calculated with the program <I>yagi</I>  The  data
+     about  the forward gain, VSWR, FB ratio, input impedance etc
+     is written to a file <I>filename</I>.<I>dat</I> Angular data,  giving  the
+     variation  of  gain  with  theta  and phi is put into a file
+     <I>filename</I>.<I>gai</I>
+     Sometimes the program fails to find the  3dB  bandwidths  in
+     the  E  and  H  planes, and bombs out with a 'zbrent' error.
+     This can occur if:
+     (1) The antenna has an almost isotropic  pattern,  in  which
+     case its never 3dB down, so the 3dB point is undefined.
+     (2) The 3dB point is outside the assumed angular range.  You
+     then have to either:
+     (a) Calculate with the -e option, which  avoids  calculation
+     of the 3dB E-plane beamwidth or
+     (b) Do (a) above, then  find  approximately  where  the  3dB
+     point  is  (from the .gai file -see later), then set options
+     -E and -H so the program calculates them properly.
+
+     The DOS .EXE files as distributed require a 387 maths copro-
+     cessor  to  be  present  and will not run without it. A 486,
+     Pentium, and I assume later processors of this  series  will
+     run  it  without  any  extra  hardware. The DOS files are no
+     longer being maintained, so are out of sync with the  latest
+     source.
+
+
+</PRE>
+<H2>OPTIONS</H2><PRE>
+     -<B>c</B>   Calculate the maximum level of any sidelobe - not  just
+          the  rear  on as the FB ratio tells us. If the sidelobe
+          and FB ratio are equal, it means the  biggest  sidelobe
+          is  the  rear  one. If the Sidelobe is less than the FB
+          ratio, then another lobe is more significant.  Look  in
+          the  '.gai'  file  (see below) to see where it is. This
+          option slows the program quite a bit.
+
+     -<B>e</B>   Suppress calculation of the 3dB E-plane bandwidth. This
+          is  sometimes  necessary  if the programme is unable to
+          find the 3 dB beamwidth, to prevent an error occuring.
+
+     -<B>h</B>   Suppress calculation of the 3dB H-plane bandwidth. This
+          is  sometimes  necessary  if the programme is unable to
+          find the 3 dB beamwidth, to prevent an error occuring.
+
+     -<B>p</B>   Put data into a file  filename.freq  for  reading  into
+          gnuplot, and a commmand file filename.gc for gnuplot to
+          use.  (run   'output   -p   filename'   then   'gnuplot
+          filename.gc' )
+
+     -<B>s</B>   Suppress all diagnostic output. By default, the program
+          print the percentage of the job completed.
+
+     -<B>E</B><I>E</I>_<I>max</I>
+          When the program computes the E-plane 3dB beamwidth, it
+          assumes  the  antenna  pattern is 3dB down somewhere in
+          the range 90 to Emax, where E_max  is  by  default  179
+          degrees.  This  can fail if it is never 3dB down in the
+          range, or if it happened to go 3dB down in two or  more
+          points.  You  can  change  E_max,  if  you need to, but
+          rarely if every should  need  to.  I've  never  seen  a
+          failure here, but are guarding against one. If you dont
+          want the pattern, use  the  -e  option  instead,  which
+          skips it. See also '-H' below.
+
+     -<B>H</B><I>H</I>_<I>max</I>
+          When the program computes the H-plane 3dB beamwidth, it
+          assumes  the  antenna  pattern is 3dB down somewhere in
+          the range 0 to Hmax,  where  H_max  is  by  defualt  60
+          degrees.  This  can fail if it is never 3dB down in the
+          range, or if it happended to go 3dB down in two or more
+          points.  Also,  if it goes more than 3dB down, but that
+          starts to come up again. You can change H_max,  if  you
+          need to, as failures do occasionally occur. If you dont
+          want the pattern use -h option instead, which will skip
+          it.
+          An obvious example of an antenna where  you  cant  find
+          the  3dB  bandwidth for the H-plane is the 1ele dipole.
+          The radiation is symmetrical about  its  axis,  so  the
+          level  is  the same everywhere in the H plane. The pro-
+          gram automatically avoids calculating it for  a  1  ele
+          beam.
+
+
+     -<B>Z</B><I>Zo</I> Zo is the characteristic impedance used when  calculat-
+          ing  the  VSWR.  By  default  it's  50 Ohms, but can be
+          changed to any real, positive value.
+
+
+      <I>filename</I>
+          is  the  name  of  the  file  containing  the   antenna
+          description.  It  is expected to be in a format created
+          by <I>input</I> or <I>first</I> - two other programs in the  <I>Yagi</I>-<I>Uda</I>
+          <I>project</I>.  The  is  also expected to exist a binary file
+          <I>filename</I>.<I>out</I> created by typing <I>yagi</I> <I>filename</I>
+
+
+</PRE>
+<H2>Limitations</H2><PRE>
+     I'm not aware of any limitations, apart from that filenames,
+     including full path, can't exceed 90 characters.
+
+
+</PRE>
+<H2>FILES</H2><PRE>
+     filename        ASCII file with antenna description.
+     filename.out    Binary data file, created by yagi.
+     filename.dat    ASCII file with gain, FB ratio etc.
+     filename.gai    ASCII file with angular dependence of gain.
+
+
+</PRE>
+<H2>SEE ALSO</H2><PRE>
+     <B>first(1)</B>, <B>input(1)</B>, <B>yagi(1)</B>, <B>optimise(1)</B>.
+
+
+
+</PRE>
+<H2>PLATFORMS</H2><PRE>
+     Both DOS and Unix versions have been built. The DOS  version
+     as  distributed requires a 386 PC with a 387 maths coproces-
+     sor.
+
+
+</PRE>
+<H2>BUGS</H2><PRE>
+     Bugs should be reported  to  <B>david.kirkby at onetel.net</B>.   Bugs
+     tend  actually to be fixed if they can be isolated, so it is
+     in your interest to report them in such a way that they  can
+     be  easily  reproduced.  The program gives errors if element
+     lengths are well away from a half-wave (by a factor  of  ~3)
+     due  to  a breakdown in the equations.  If the input file is
+     edited  manually  and  done  incorrectly,   there   can   be
+     unpredictable results.
+
+
+
+</PRE>
+<H2>AUTHORS</H2><PRE>
+     Dr. David Kirkby G8WRB (david.kirkby at onetel.net).  with help
+     with   converting   to   DOS   from   Dr.   Joe   Mack  NA3T
+     (mack at fcrfv2.ncifcrf.gov)
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+<HR>
+<ADDRESS>
+Man(1) output converted with
+<a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>
+</ADDRESS>
+</BODY>
+</HTML>
diff --git a/doc/pattern.jpg b/doc/pattern.jpg
new file mode 100644
index 0000000..362f505
Binary files /dev/null and b/doc/pattern.jpg differ
diff --git a/doc/yagi.1.html b/doc/yagi.1.html
new file mode 100644
index 0000000..1478044
--- /dev/null
+++ b/doc/yagi.1.html
@@ -0,0 +1,138 @@
+<HTML>
+<BODY>
+<PRE>
+<!-- Manpage converted by man2html 3.0.1 -->
+
+</PRE>
+<H2>NAME</H2><PRE>
+     yagi - Yagi-Uda project antenna current calculator
+
+
+</PRE>
+<H2>SYNOPSIS</H2><PRE>
+     <B>yagi</B> [ <B>-</B> <B>dhps</B> ] filename
+
+
+</PRE>
+<H2>DESCRIPTION</H2><PRE>
+     The program <I>yagi</I> is one of a number of  executable  programs
+     that  forms part of a set of programs, collectively known as
+     the <I>Yagi</I>-<I>Uda</I> <I>project</I> , which were designed for analysis  and
+     optimisation  of  Yagi-Uda  antennas.  <I>yagi</I>  calculates  the
+     currents at the centre of each element at one or  more  fre-
+     quencies, as specified in the input file.
+
+
+</PRE>
+<H2>AVAILABILITY</H2><PRE>
+
+</PRE>
+<H2>OPTIONS</H2><PRE>
+     -<B>d</B>   Display element currents. When this option is  used,  a
+          bar  graph  with  up to 70 stars (*) is used to display
+          the absolute magnitude of  the  element  currents.  The
+          element  with  the greatest element current has 70 *'s,
+          all others have a corresponding smaller number, depend-
+          ing on the their relative current. The element current,
+          normallised to the maximum, is also shown as a 4  digit
+          floating point number.
+
+     -<B>h</B>   Print a help message.
+
+     -<B>p</B>   Print the Z matrix.  The  Z  matrix  is  the  impedance
+          matrix,  showing  the self impedance of the elements on
+          the diagonal and the mutual impedance off the diagonal.
+
+     -<B>s</B>   Suppress all diagnostic output. By default, the program
+          print the percentage of the job completed.
+
+      <I>filename</I>
+          is the name of the file containing the antenna descrip-
+          tion.  It  is  expected  to  be  in a format created by
+          either <I>input</I> or <I>first</I>  -  two  other  programs  in  the
+          <I>Yagi</I>-<I>Uda</I>  <I>project</I>.  This  is  an  ASCII  text file. The
+          antenna currents are written  to  a  file  <I>filename</I>.<I>out</I>
+          which  is  a binary file. It is not intended to be read
+          by humans.
+
+
+
+</PRE>
+<H2>Limitations</H2><PRE>
+     I'm not aware of any limitations, apart from that filenames,
+     including full path, can't exceed 90 characters.
+
+
+</PRE>
+<H2>FILES</H2><PRE>
+     filename.out       Binary data file
+
+
+
+</PRE>
+<H2>SEE ALSO</H2><PRE>
+     <B>first(1)</B>,  <B>input(1)</B>,   <B>output(1)</B>,   <B>optimise(1)</B>,   <B>first(5)</B>,
+     <B>input(5)</B>, <B>output(5)</B> and <B>optimise(5)</B>.
+
+
+
+</PRE>
+<H2>PLATFORMS</H2><PRE>
+     Both DOS and Unix versions have been built. The DOS  version
+     as  distributed requires a 386 PC with a 387 maths coproces-
+     sor.
+
+
+</PRE>
+<H2>BUGS</H2><PRE>
+     Bugs should be reported  to  <B>david.kirkby at onetel.net</B>.   Bugs
+     tend  actually to be fixed if they can be isolated, so it is
+     in your interest to report them in such a way that they  can
+     be  easily reproduced.  If the input file is edited manually
+     and done incorrectly, there can be unpredictable results.
+
+
+
+</PRE>
+<H2>AUTHORS</H2><PRE>
+     Dr. David Kirkby G8WRB (david.kirkby at onetel.net), with  help
+     with   converting   to   DOS   from   Dr.   Joe   Mack  NA3T
+     (mack at fcrfv2.ncifcrf.gov).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+</PRE>
+<HR>
+<ADDRESS>
+Man(1) output converted with
+<a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>
+</ADDRESS>
+</BODY>
+</HTML>
diff --git a/doc/yagi.jpg b/doc/yagi.jpg
new file mode 100644
index 0000000..cc07708
Binary files /dev/null and b/doc/yagi.jpg differ
diff --git a/install-sh b/install-sh
new file mode 100644
index 0000000..e9de238
--- /dev/null
+++ b/install-sh
@@ -0,0 +1,251 @@
+#!/bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5 (mit/util/scripts/install.sh).
+#
+# Copyright 1991 by the Massachusetts Institute of Technology
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission.  M.I.T. makes no representations about the
+# suitability of this software for any purpose.  It is provided "as is"
+# without express or implied warranty.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.  It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+    case $1 in
+	-c) instcmd="$cpprog"
+	    shift
+	    continue;;
+
+	-d) dir_arg=true
+	    shift
+	    continue;;
+
+	-m) chmodcmd="$chmodprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-o) chowncmd="$chownprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-g) chgrpcmd="$chgrpprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-s) stripcmd="$stripprog"
+	    shift
+	    continue;;
+
+	-t=*) transformarg=`echo $1 | sed 's/-t=//'`
+	    shift
+	    continue;;
+
+	-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+	    shift
+	    continue;;
+
+	*)  if [ x"$src" = x ]
+	    then
+		src=$1
+	    else
+		# this colon is to work around a 386BSD /bin/sh bug
+		:
+		dst=$1
+	    fi
+	    shift
+	    continue;;
+    esac
+done
+
+if [ x"$src" = x ]
+then
+	echo "install:	no input file specified"
+	exit 1
+else
+	true
+fi
+
+if [ x"$dir_arg" != x ]; then
+	dst=$src
+	src=""
+	
+	if [ -d $dst ]; then
+		instcmd=:
+		chmodcmd=""
+	else
+		instcmd=mkdir
+	fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad 
+# if $src (and thus $dsttmp) contains '*'.
+
+	if [ -f $src -o -d $src ]
+	then
+		true
+	else
+		echo "install:  $src does not exist"
+		exit 1
+	fi
+	
+	if [ x"$dst" = x ]
+	then
+		echo "install:	no destination specified"
+		exit 1
+	else
+		true
+	fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+	if [ -d $dst ]
+	then
+		dst="$dst"/`basename $src`
+	else
+		true
+	fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+#  this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='	
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+	pathcomp="${pathcomp}${1}"
+	shift
+
+	if [ ! -d "${pathcomp}" ] ;
+        then
+		$mkdirprog "${pathcomp}"
+	else
+		true
+	fi
+
+	pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+	$doit $instcmd $dst &&
+
+	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+	if [ x"$transformarg" = x ] 
+	then
+		dstfile=`basename $dst`
+	else
+		dstfile=`basename $dst $transformbasename | 
+			sed $transformarg`$transformbasename
+	fi
+
+# don't allow the sed command to completely eliminate the filename
+
+	if [ x"$dstfile" = x ] 
+	then
+		dstfile=`basename $dst`
+	else
+		true
+	fi
+
+# Make a temp file name in the proper directory.
+
+	dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+	$doit $instcmd $src $dsttmp &&
+
+	trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing.  If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+	$doit $rmcmd -f $dstdir/$dstfile &&
+	$doit $mvcmd $dsttmp $dstdir/$dstfile 
+
+fi &&
+
+
+exit 0
diff --git a/man/Makefile.am b/man/Makefile.am
new file mode 100644
index 0000000..fcbd061
--- /dev/null
+++ b/man/Makefile.am
@@ -0,0 +1,2 @@
+SUBDIRS = man1 man5
+
diff --git a/man/Makefile.in b/man/Makefile.in
new file mode 100644
index 0000000..c950396
--- /dev/null
+++ b/man/Makefile.in
@@ -0,0 +1,382 @@
+# Makefile.in generated by automake 1.7 from Makefile.am.
+# @configure_input@
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__quote = @am__quote@
+bindir = @bindir@
+build_alias = @build_alias@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+SUBDIRS = man1 man5
+subdir = man
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+
+RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \
+	ps-recursive install-info-recursive uninstall-info-recursive \
+	all-recursive install-data-recursive install-exec-recursive \
+	installdirs-recursive install-recursive uninstall-recursive \
+	check-recursive installcheck-recursive
+DIST_COMMON = Makefile.am Makefile.in
+DIST_SUBDIRS = $(SUBDIRS)
+all: all-recursive
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.ac $(ACLOCAL_M4)
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  man/Makefile
+Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+uninstall-info-am:
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run `make' without going through this Makefile.
+# To change the values of `make' variables: instead of editing Makefiles,
+# (1) if the variable is set in `config.status', edit `config.status'
+#     (which will cause the Makefiles to be regenerated when you run `make');
+# (2) otherwise, pass the desired values on the `make' command line.
+$(RECURSIVE_TARGETS):
+	@set fnord $$MAKEFLAGS; amf=$$2; \
+	dot_seen=no; \
+	target=`echo $@ | sed s/-recursive//`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    dot_seen=yes; \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	done; \
+	if test "$$dot_seen" = "no"; then \
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+	fi; test -z "$$fail"
+
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+	@set fnord $$MAKEFLAGS; amf=$$2; \
+	dot_seen=no; \
+	case "$@" in \
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+	  *) list='$(SUBDIRS)' ;; \
+	esac; \
+	rev=''; for subdir in $$list; do \
+	  if test "$$subdir" = "."; then :; else \
+	    rev="$$subdir $$rev"; \
+	  fi; \
+	done; \
+	rev="$$rev ."; \
+	target=`echo $@ | sed s/-recursive//`; \
+	for subdir in $$rev; do \
+	  echo "Making $$target in $$subdir"; \
+	  if test "$$subdir" = "."; then \
+	    local_target="$$target-am"; \
+	  else \
+	    local_target="$$target"; \
+	  fi; \
+	  (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+	   || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	done && test -z "$$fail"
+tags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+	done
+ctags-recursive:
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+	done
+
+ETAGS = etags
+ETAGSFLAGS =
+
+CTAGS = ctags
+CTAGSFLAGS =
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \
+	  fi; \
+	done; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(ETAGS_ARGS)$$tags$$unique" \
+	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	     $$tags $$unique
+
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkinstalldirs) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+	list='$(SUBDIRS)'; for subdir in $$list; do \
+	  if test "$$subdir" = .; then :; else \
+	    test -d $(distdir)/$$subdir \
+	    || mkdir $(distdir)/$$subdir \
+	    || exit 1; \
+	    (cd $$subdir && \
+	      $(MAKE) $(AM_MAKEFLAGS) \
+	        top_distdir="$(top_distdir)" \
+	        distdir=../$(distdir)/$$subdir \
+	        distdir) \
+	      || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-recursive
+all-am: Makefile
+installdirs: installdirs-recursive
+installdirs-am:
+
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-rm -f Makefile $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-recursive
+
+distclean-am: clean-am distclean-generic distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-recursive
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \
+	clean-generic clean-recursive ctags ctags-recursive distclean \
+	distclean-generic distclean-recursive distclean-tags distdir \
+	dvi dvi-am dvi-recursive info info-am info-recursive install \
+	install-am install-data install-data-am install-data-recursive \
+	install-exec install-exec-am install-exec-recursive \
+	install-info install-info-am install-info-recursive install-man \
+	install-recursive install-strip installcheck installcheck-am \
+	installdirs installdirs-am installdirs-recursive \
+	maintainer-clean maintainer-clean-generic \
+	maintainer-clean-recursive mostlyclean mostlyclean-generic \
+	mostlyclean-recursive pdf pdf-am pdf-recursive ps ps-am \
+	ps-recursive tags tags-recursive uninstall uninstall-am \
+	uninstall-info-am uninstall-info-recursive uninstall-recursive
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/man/man1/Makefile.am b/man/man1/Makefile.am
new file mode 100644
index 0000000..d3db1ba
--- /dev/null
+++ b/man/man1/Makefile.am
@@ -0,0 +1,2 @@
+man_MANS = yagi.1 first.1 input.1 output.1 optimise.1 dipole.1
+EXTRA_DIST = $(man_MANS) 
diff --git a/man/man1/Makefile.in b/man/man1/Makefile.in
new file mode 100644
index 0000000..b2c2616
--- /dev/null
+++ b/man/man1/Makefile.in
@@ -0,0 +1,292 @@
+# Makefile.in generated by automake 1.7 from Makefile.am.
+# @configure_input@
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__quote = @am__quote@
+bindir = @bindir@
+build_alias = @build_alias@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+man_MANS = yagi.1 first.1 input.1 output.1 optimise.1 dipole.1
+EXTRA_DIST = $(man_MANS) 
+subdir = man/man1
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+
+NROFF = nroff
+MANS = $(man_MANS)
+DIST_COMMON = Makefile.am Makefile.in
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.ac $(ACLOCAL_M4)
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  man/man1/Makefile
+Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+uninstall-info-am:
+
+man1dir = $(mandir)/man1
+install-man1: $(man1_MANS) $(man_MANS)
+	@$(NORMAL_INSTALL)
+	$(mkinstalldirs) $(DESTDIR)$(man1dir)
+	@list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+	for i in $$l2; do \
+	  case "$$i" in \
+	    *.1*) list="$$list $$i" ;; \
+	  esac; \
+	done; \
+	for i in $$list; do \
+	  if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+	  else file=$$i; fi; \
+	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+	  case "$$ext" in \
+	    1*) ;; \
+	    *) ext='1' ;; \
+	  esac; \
+	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
+	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+	  echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \
+	  $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \
+	done
+uninstall-man1:
+	@$(NORMAL_UNINSTALL)
+	@list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \
+	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+	for i in $$l2; do \
+	  case "$$i" in \
+	    *.1*) list="$$list $$i" ;; \
+	  esac; \
+	done; \
+	for i in $$list; do \
+	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
+	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+	  echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \
+	  rm -f $(DESTDIR)$(man1dir)/$$inst; \
+	done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkinstalldirs) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(MANS)
+
+installdirs:
+	$(mkinstalldirs) $(DESTDIR)$(man1dir)
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-rm -f Makefile $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-man
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man: install-man1
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-man
+
+uninstall-man: uninstall-man1
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+	distclean-generic distdir dvi dvi-am info info-am install \
+	install-am install-data install-data-am install-exec \
+	install-exec-am install-info install-info-am install-man \
+	install-man1 install-strip installcheck installcheck-am \
+	installdirs maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \
+	uninstall-am uninstall-info-am uninstall-man uninstall-man1
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/man/man1/dipole.1 b/man/man1/dipole.1
new file mode 100644
index 0000000..f486288
--- /dev/null
+++ b/man/man1/dipole.1
@@ -0,0 +1,42 @@
+.TH YAGI 1 "24th October 2000 " "Version 1.16"
+.de BP
+.sp
+.ns
+.ti -.2i
+\(**
+..
+.SH NAME
+dipole \- Yagi-Uda project file. Computez Z of a dipole
+.SH SYNOPSIS
+.B yagi 
+[
+.B -\ dhps
+]
+filename 
+.SH DESCRIPTION
+The program 
+.I dipole
+is one of a number of executable programs that forms part of a set of 
+programs, collectively known as the
+.I Yagi-Uda project
+, which were designed for analysis and optimisation of Yagi-Uda antennas. 
+.I dipole
+Was added to find the impedance of just a single dipole. 
+.br
+.SH "SEE ALSO"
+first(1), input(1), output(1), optimise(1), first(5), input(5), output(5) and optimise(5).
+
+.SH PLATFORMS
+Only UNIX versions have been produced. I can't be bothered
+with brain-dead operating systems like Windoze. 
+.SH BUGS
+Bugs should be reported to
+.BR david.kirkby at onetel.net .
+Bugs tend actually to be fixed if they can be isolated, so it is in your
+interest to report them in such a way that they can be easily reproduced.
+If the input file is edited manually and done incorrectly, there can be unpredictable results.
+
+.SH AUTHORS
+
+Dr. David Kirkby G8WRB (david.kirkby at onetel.net), with 
+help with converting to DOS from Dr. Joe Mack NA3T (mack at fcrfv2.ncifcrf.gov).
diff --git a/man/man1/first.1 b/man/man1/first.1
new file mode 100644
index 0000000..eb76726
--- /dev/null
+++ b/man/man1/first.1
@@ -0,0 +1,74 @@
+.TH FIRST 1 "Fri Dec  2 1994" "Version 1.10 "
+.de BP
+.sp
+.ns
+.ti -.2i
+\(**
+..
+.SH NAME
+first \- Yagi-Uda project quick antenna builder
+.SH SYNOPSIS
+.B first 
+filename  elements f_min f_design f_max f_step diameter
+.SH DESCRIPTION
+The program 
+.B first
+is one of a number of executable programs that forms part of a set of 
+programs, collectively known as the
+.I Yagi-Uda project
+, which were designed for analysis and optimisation of Yagi-Uda antennas. 
+.I  first
+is used to define an antenna quickly, if you are not interested in analysing a specific design (in which case use
+.I input
+) but need to get a design that is half-way reasonable so that it may be optimised. It is much faster in use (since its not interactive) than
+.I input
+The design methodology that 
+.I first
+is the DL6WU antenna designs, which are valid for 10 or more elements, although 
+.I first
+will calculate for any number of elements. DL6WU reccomends a folded dipole, but
+the designs here are for a simple dipole, since I don't yet know how to calculate
+the self and mutual impedances of folded dipoles. 
+.LP
+.SH LIMITATIONS
+Filenames, including full
+path, can't exceed 90 characters. 
+.PP
+Does not take into account the variation of impedance of a dipole with
+change in wavelength/diameter of elements.
+.SH FILES
+.nf
+filename          Yagi description, created by first.
+filename.out      Binary data file, created by yagi.
+filename.dat      Performance of antenna, created by output.
+filename.gai      Gain of antenna, created by output.
+.fi
+.br
+
+.br
+The DOS .EXE files as distributed require a 387 maths coprocessor to be
+present and will not run without it. A 486, Pentium, and I assume later
+processors of this series will run it without any extra hardware.
+
+.SH PLATFORMS
+Both DOS and and Unix versions have been built. The DOS version as
+distributed requires a 386 PC with a 387 maths coprocessor. The DOS version is no longer being
+developed, so the DOS executables included with the distribution are not upto date with the current
+source code. 
+
+.SH AUTHORS
+
+Dr. David Kirkby G8WRB (david.kirkby at onetel.net).
+with help with the conversion to the DOS/PC enviroment from Dr. Joe Mack NA3T (mack at fcrfv2.ncifcrf.gov)
+.SH "SEE ALSO"
+input(1), output(1), yagi(1), optimise(1).
+.SH BUGS
+Bugs should be reported to:
+David Kirkby G8WRB (david.kirkby at onetel.net).
+Bugs tend actually to be fixed if they can be isolated, so it is in your
+interest to report them in such a way that they can be easily reproduced.
+.PP
+If the input file is edited manually and done incorrectly, there can be unpredictable results.
+.PP 
+Options are not checked for sensible numbers. A negative length can be
+entered!
diff --git a/man/man1/input.1 b/man/man1/input.1
new file mode 100644
index 0000000..61558eb
--- /dev/null
+++ b/man/man1/input.1
@@ -0,0 +1,72 @@
+.TH INPUT 1 "24th October  2000" "Version 1.16"
+.de BP
+.sp
+.ns
+.ti -.2i
+\(**
+..
+.SH NAME
+input \- Yagi-Uda project antenna defining program
+.SH SYNOPSIS
+.B  input
+[
+.B -\ h
+]
+.SH DESCRIPTION
+The program 
+.I input
+is one of a number of executable programs that forms part of a set of 
+programs, collectively known as the
+.I Yagi-Uda project
+, which were designed for analysis and optimisation of Yagi-Uda antennas. 
+.I input
+is an interactive program, that asks the user for information about a Yagi design, such as position
+of elements, spacing between elements, frequency span of interest and a filename to save the data
+to.
+.I input
+then writes this information into an ASCII file, which can be read by
+.I yagi
+or
+.I optimise
+The file is ASCII and it's format is easily understood by inspection (there are comments printed
+in it), so it can if necessary be edited manually.   
+.LP 
+After running   
+.I input
+and specifying a filename (for example 144e10) you should then type
+.I yagi 144e10
+and then
+.I output 144e10
+and optionally
+.I optimise 144e10
+.LP
+.br
+.SH OPTIONS
+.TP
+.B \-h  
+Print a help message.
+.SH FILES
+.nf
+filename         ASCII data file in which design is put.
+.fi
+.SH PLATFORMS
+Both DOS and Unix versions have been built. The DOS version as
+distributed requires a 386 PC with a 387 maths coprocessor. 
+
+.SH AUTHORS
+
+Dr. David Kirkby G8WRB (david.kirkby at onetel.net).
+with help with in converting to DOS/PC from Dr. Joe Mack NA3T (mack at fcrfv2.ncifcrf.gov)
+.SH SEE ALSO
+first(1), yagi(), output(1), optimise(1), input (5), first(5), yagi(5), output(5) and optimise(5).
+
+.nf
+Bugs should be reported to
+.BR david.kirkby at onetel.net.
+.fi
+Bugs tend actually to be fixed if they can be isolated, so it is in your
+interest to report them in such a way that they can be easily reproduced.
+.PP
+If a mistake is made during inputting of data (such as entering an incorrect length), it is not
+possible to go back and correct this. You should make a note of the error, and edit the ASCII
+text file with a text editor (vi, DOS edit etc).
diff --git a/man/man1/optimise.1 b/man/man1/optimise.1
new file mode 100644
index 0000000..5e7a556
--- /dev/null
+++ b/man/man1/optimise.1
@@ -0,0 +1,649 @@
+.TH OPTIMISE 1 "24 October 2000" "version 1.16"
+.de BP
+.sp
+.ns
+.ti -.2i
+\(**
+..
+.SH NAME
+optimise \- Yagi-Uda project antenna optimiser
+.SH SYNOPSIS
+.B optimise 
+[
+.B \-dhvwO
+]
+[
+.BI \-a angular_stepsize
+] 
+[
+.BI \-b boom_extension
+]
+[
+.BI \-c cleanliness_of_pattern
+]
+[
+.BI \-e elements
+]
+[
+.BI \-f FBratio
+]
+[
+.BI \-g GA_optimisation_method
+]
+.BI \-l percent
+]
+[
+.BI \-m min_offset_from_peak
+]
+[ 
+.BI \-o optimisation_criteria
+]
+[
+.BI \-p population
+]
+[
+.BI \-r resistance
+]
+[ 
+.BI \-s swr
+]
+[ 
+.BI \-t length_tolerance
+]
+[
+.BI \-x reactance
+]
+[
+.BI \-A Auto_gain
+]
+[
+.BI \-C Currents_similar
+]
+[
+.BI \-F weight_FB
+]
+[ 
+.BI \-G weight_gain
+]
+[
+.BI \-K keep_for_tries
+]
+[ 
+.BI \-P weight_pattern_cleanliness
+]
+[
+.BI \-R weight_resistance 
+]
+[
+.BI \-S weight_swr
+]
+[
+.BI \-T position_tolerance
+]
+[
+.BI \-W Weighted_algorithm
+] 
+[
+.BI \-X weight_reactance
+[ 
+.BI -Z Zo
+]
+filename iterations
+.SH DESCRIPTION
+The program 
+.B optimise
+is one of a number of executable programs that forms part of a set of 
+programs, collectively known as the
+.I Yagi-Uda project
+, which were designed for analysis and optimisation of Yagi-Uda antennas. 
+.I optimise 
+attempts to optimise the performance of a Yagi antenna for one or more
+parameters that are considered important, such as gain, F/B ratio, VSWR
+etc. It does this by randomly changing the lengths and positions, of one 
+or more elements, then comparing the performance before and after the change.
+Any improvements are written to a new file called
+.I filename.bes
+where
+filename is the name of the antenna description file created by 
+.I input
+or
+.I first
+.LP
+When Yagi's are designed on paper, or using this program, its possible that they will be almost
+impossible to build, if their performance depends too critically on the
+dimensions. To determine if this is the case with a design, we run optimise with just the options 't' and 'T'. These specify the tolerance with which you can build the antenna, expressed as a standard deviation in mm. In this case, instead
+of trying to optimise a poor design, optimise will calculate the minimum gain, maximum VSWR,
+and minimum FB ratio of a number of designs, all slightly different from the input file. 99.7% of the components
+lie within 3 SD of the mean, so if you think you can cut elements to with 1 mm 99.7% of the time,
+specify t0.33. If you can put them in the boom to within 3 mm 99.7% of the time, specify T1.
+.LP
+If while 
+.I optimise
+is running using the methods that require weights to be attached to the gain,
+FB, SWR etc, it becomes apparent, the weights are not optimum, its possible to
+pause the program and re-adjust the weights. If a file with the name of
+.I changes
+is created, the program will pause, then request new weights are entered at  
+the keyboard.
+.SH AVAILABILITY
+.SH OPTIONS
+.TP
+.B \-d  
+Print the default values of all the configureable parameters to stdout. Typing this option with any
+option that changes a parameter (see below) will display the new value of the parameter, rather
+than the default.
+.TP
+.B \-h  
+Print a help message.
+.TP
+.B \-v  
+Print verbose status information.
+.TP
+.B \-w
+Instead of optimising at one fixed frequency (the design frequency), this directs the program to
+optimise at 3 separate frequencies (lowest, design and highest) then to average data at all 3. This
+option is better for wideband antenna. Note that the input impedance printed is at the design
+frequency, *not* averaged over 3 frequencies. Averaging an impedance, is likely to give a very
+misleading impression. The impedance averaged over 3 frequencies can be 50+i0 Ohms, even
+if the VSWR is very poor over all 3 frequencies, as the following 3 pieces of data show.
+.br
+Z=147 + j 300  SWR= 15.46:1
+.br
+Z=2   + j 100  SWR= 125:1
+.br
+Z=1   - j 400  SWR= 3250:1
+.br
+note in the above three cases, the average impedance is 50 + j 0, but 
+average SWR is 1130:1. 
+.TP
+.B \-O
+Over-optimisation allowed.  By default, the program does not over-optimise a parameter. For example, an SWR of 1.01 is usually considered good enough and 
+any change, as long as the SWR stayed good, typically below 1.1:1, would
+be allowed, even if the SWR rose. By default, FB's of 27 dB, VSWR's of 1.1 are
+acceptable. However, by using the 
+.B \-O
+option, you can insist the program always improves things, no matter how good they are.
+.TP
+.TP
+.BI \-a Angular_stepsize
+When optimimising by trying to get a clean pattern, specifies the step size to
+use when looking for features in the pattern. If its set too small, the program  runs slow. If its set too large, the program may miss features in the pattern, such as a sidelobe. Then the resulting antenna will have poor sidelobe performance, even though you think it will be good. The program attempts to calculate
+a sensible value, based on 1/10th the approximate 3 dB beamwidth, if you don't 
+set.
+.TP
+.BI \-b boom_extension
+Generally speaking, the gain of a Yagi increases with boom length. Hence the optimiser would
+often give you a Yagi with a much longer boom than the input file. This may not be what you
+desire due to space restrictions. These long antennas often have high gain, but are very narrow in bandwidth. The default limits the antenna to 10x the original length, which
+means effectively there is no boom length limitation.
+You can adjust the percentage by setting 
+.I boom_extension
+to whatever you wish.
+.I -b30
+will limit the boom to no more than 30% more than the original length.
+.TP
+.BI \-c cleanliness_of_pattern
+Specify the number of dB down on the peak gain to aim to get the pattern. Any
+antenna pattern cleaner than this will not effect the fitness, nor will it
+be considered any better when comparing to antenna designs. 20 dB seems reasonable, so the default is 20, but this may of course change if it's deceided too. Check the source code to be certain (see REASONABLE_SIDELOBE in yagi.h).
+.TP
+.BI \-e elements
+is an integer which specifies the type of elements that are changed in the optimisation cycle.
+Possible values are:
+.br 
+.in +1.5
+1 - alter only the driven element(s) length (useful to bring to resonance)
+.br 
+2 - alter only the driven element position. Don't change its length.
+.br 
+4 - alter only the reflector length. The position is always at x=0.
+.br
+8 - alter only the director lengths. Don't change positions.
+.br 
+16 - alter only the director positions. Don't change lengths.
+.br 
+32 - randomly adjust one element length, then makes all other the same. Don't change the positions.
+.br  
+64 - apply a linear taper to the lengths.
+.br
+128 - Set the driven element to a resonate length. It may/may-not be altered after the first run, depending on the whether or not '1' is invoked too. Eg -e128
+will make it resonate and keep it there forever. However '-e129' will bring to
+resonance, then alter to maximuse performance.
+.in -1.5
+The elements altered is made from a logical AND of the above, so for example to alter everything, except the driven element length, use -e30, since 2+4+8+16=30.
+The  default is equivalent to 
+.I -e31
+, which changes everything possible. Note the
+reflector position is *never* changed. It's always at x=0.
+.TP
+.TP
+.BI \-f FBratio
+When optimising an antenna, consider any FB ratio greater than 
+.I FBratio
+dB to be equal to
+.I FBratio
+dB. This avoids optimising to a very high FB ratio, which is impracticable, as the bandwidth over
+which this FB ratio will be maintained is very small and mechanical considerations will prevent
+you from constructing it with such a high FB ratio anyway. If this was not prevented, you might
+just happen to get an antenna with 100 dB FB ratio, but poor gain and swr. Since by default all
+parameters must improve, the optimisation routine will most likely never being able to improve
+on the 100 dB FB ratio, so no improvement will result. Most people would prefer to get a few extra dB of gain,
+even if the FB ratio dropped to 30 dB.
+.TP
+.BI \-g GA_optimisation_method
+Use a genetic algorithm. With the genetic algorithm, the program does
+not take any account any of the initial lengths/positions of elements
+specified in the input file. Rather it works by initialising a
+number of different antenna, then computing a 'fitness' value for each.
+The fitness value can depend on the gain, FB, real part of the input impedance, reactive part of the input impedance, VSWR or the level of the sidelobes. The
+integer after the g tells the optimiser what to consider.
+-g1  Use gain
+.br
+-g2  Use FB
+.br
+-g4  Use R
+.br
+-g8  Use X
+.br
+-g16 Use the SWR
+.br
+-g32 Use the level of the sidelobes.
+.br
+
+You can use a logical AND of these, so for example -g49 will use a genetic algorithm, optimising for gain, swr and sidelobe level, since 1(gain)+16(SWR)+32(sidelobe level)=49.
+.TP
+.BI \-l percent
+is a parameter (floating point number) which specifies the maximum percentage
+change in the positions or lengths of an elements at each iteration. If the
+option is not used, it will be set internally at 10% for the first 25% of the
+iterations, 1% for the next 25%, 0.1% for the third 25% of the iterations and
+0.01% for the last 25% of the iterations. If set to a positive number x (eg optimise -l 0.3 145e10) then the percentage will be set at x% for 25% of iterations, x/10 for the  next 25%, x/100 for the next 25 and x/1000 for the last 25%. If set to a negative number y (eg optimise -l -0.5 145e10) then the paramters will stay fixed at y% (in this example 0.5%) all the time.
+.TP
+.BI \-m min_offset-from_peak
+Sets the minimum angle in degrees offset from theta=90 degrees, where the
+side lobes start and the main lobe finishes. The higher the gain, the smaller
+it should be. It is set internally if not set on the command line.
+.TP
+.BI \-o optimisation_criteria
+.br 
+.in +1.5
+1 -  Assume better if the gain has increased.
+.br 
+2 -  Assume better if the front to back ratio has improved.
+.br 
+4 -  Assume better if the real part of the input impedance is closer to the
+value that the program was compiled for, or set using the '-Z' option. 
+This will usually be 50 Ohms, but you may wish to set this to 12.5 Ohms if
+you use a 4:1 balun. Generally you can get higher gain from a Yagi if you 
+allow the input impedance to fall, but of course feeding it becomes more
+difficult.
+.br
+8 -  Assume better if the magnitude of the reactive component of the input impedance is lower
+(ie. the antenna is nearer resonance).
+.br 
+16 - Assume better if the VSWR is lower.
+.br 
+32 - Assume better if the level of all sidelobes is lower.
+.in -1.5
+The 
+.I optimisation_criteria 
+may be formed from a logical AND of these numbers, so for example choosing
+.I -o19
+will only consider a revised antenna better than the previous, if the SWR, 
+gain and F/B ratio have all simultaneously improved.
+.br 
+
+Clearly an antenna which originally had 12 dB gain and 1.01:1 VSWR but then 
+changes to 20 dB gain @ 1.02:1 VSWR, would to most people be better, even
+though the VSWR has increased. By default, 
+.I optimise
+only optimises to sensible maximums, so to not let the optimisation stall prematurely. By running 
+.I optimise
+with no arguments, the program will list the limits of acceptability.
+These might be typically F/B ratio > 27 dB, VSWR < 1.1:1, magnitude of input
+reactance less than 5 Ohms and the real part of the input impedance within 
+5 Ohms of Zo. Choosing 
+.I -o19
+(1+2+16=19) will optimise for gain (since G=1), FB (since FB=2) and SWR (Since SWR=16), but would consider a higher gain and FB ratio antenna better than a 
+previous one, even if the SWR rose, as long as it stayed
+below 1.1:1 (or as was set during compilation). The default behaviour (no options) is equivalent
+to
+.I -o37
+which optimiseas for gain(1), the real part of the input impedance(4) and sidelobes(32)
+but this may be changed at any time, so type
+.I optimise -d
+to check the current settings. If you insist on the program optimisang for the
+very best of all selected parameters, use the -O option too, but be warned the
+optimisation will probely stick once it gets one parameter really good.
+.TP
+.BI \-p population 
+This determines the initial population used  with the genetic
+algorithm.
+.TP
+.BI \-r resistance
+When optimising an antenna, consider any input resistance closer to Zo (usually 50 Ohms) than 
+.I resistance
+Ohms to be acceptable. This avoids optimising to an input resistance too close to Zo, which is
+impracticable, as the bandwidth over which the input resistance could be maintained is very small
+and mechanical considerations will prevent you from constructing the antenna with such an ideal
+input resistance. If this was not prevented, you might just happen to get an antenna with an input
+resistance of 50.000001 Ohms, but poor gain, FB and possibly even a poor swr, if the
+antenna is well away from resonance. Since by default all parameters must improve, the
+optimisation routine will get most likely never being able to improve on the antenna, whereas
+we might be happier with a few more dB gain, if the input resistance went to 50.1 Ohms. It
+should be noted that the default optimisation routine never uses the input resistance directly (only
+VSWR), so this option cant be used without the '-o' option to optimise for other than the default
+parameters (gain, VSWR and FB ratio).
+.TP
+.BI \-s swr
+When optimising an antenna, consider any SWR less than 
+.I swr
+to be equal to
+.I swr
+This avoids optimising to a very low swr, which is impracticable, as the bandwidth over which
+such a low swr could be maintained would be very small and mechanical considerations will
+prevent you from constructing such an antenna anyway. If this is was not prevented, you might
+just happen to get an antenna with an swr of 1.000000000001:1, but poor gain, FB ratio. Since
+by default all parameters must improve, the optimisation routine will most likely never being able
+to improve on the antenna, even though in practice you would like to get a few extra dB of gain
+if the SWR would rise to 1.02:1. The default was equivalent to
+.I -s1.1
+but run 
+.I optimise -d
+to display this and any other defaults.
+.TP
+.BI \-t length_tolerance
+.I length_tolerance 
+is the standard deviation in mm of the accuracy with which you can cut elements. Since 99.7%
+of elements will be with 3 standard deviations of the mean length (stats theory says this), set
+-t0.2 if virtually all (well 99.7%) of elements are within 3x0.2=0.6 mm of the correct length. This
+option *must* be used with the '-T'  option and can't be used with any other options apart from
+'-Z', '-v' and '-d'.
+.TP
+.BI \-x reactance
+When optimising an antenna, consider any input reactance of less than 
+.I reactance
+to be
+.I reactance.
+This avoids over optimising the reactance, at the expense of something else.
+.TP 
+.BI \-A auto_gain
+When the       
+.I auto_gain
+option is used. the program maximes the gain of the antenna (ignoring all other 
+parameters such as SWR, FB ratio etc) by adjusting the length (not position)
+of one element only. -A-1 will maximuse the gain, by adjusting the length of 
+the reflector, -A0 will maximise the gain by adjusting the length of the driven
+element. Its generally *not* a good idea to maximise the gain by adjusting the
+driven element, but the program lets you do it, but using the option -A0. Using
+-A1 will maximise gain by adjusting the length of the first director, -A2 the second director and so on, up to the last director. You must check carefully that the input impedance in particular does not fall to silly values if you use this option. On a yagi with many elements (> 10 or so), you can pretty safely maximise the 8th or more director, but doing it on the reflector, driven element or
+early directors often leads to silly input impedances - so beware! 
+Note, no matter how many iterations you specify, this process is only done once.Its unlikely you will be able to do it again, without things going out of hand, but if you must do it, you must re-run 'optimise' again.
+.TP
+.BI \-C currents_similar
+If this option is used, where
+.I currents_similar
+is an integer, the program looks to make the
+currents in the last 
+.I currents_similar
+elements as similar as possible. It computes the sum of the squares of the deviations of the absolute values of the element currents from the mean. If this falls, and the criteria specified with the -W option is also satisfied, the antenna is considered better. If 
+.I
+currents_similar
+is three less than the number of directors, it tries to make the currents in the the directors (but ignoringing the first 3) all similar. If 
+.I currents_similar
+is equal to the number of directors, it tries to make all the directors have similar currents. If 
+.I currents_similar
+is one more than the number of directors, it tries to make all the directors and the reflector have similar currents. If 
+.I currents_similar
+is equal to the total number of elements, then it fails with an error message. 
+.TP
+.BI \-F weight_FB
+is the floating point number (default 1.0) specifying the weight to attach to
+the FB ratio of the antenna when using the '-W' option, which calculates a fitness for the antenna based on one or more parameters (FB, gain, input resistance, input reactance, SWR, cleanliness of antenna pattern). The '-F' option is 
+similar to the options -G, -P, -R, -S, -X (which specify weights for gain, pattern cleanliness, input resistance, SWR and input reactance).  
+When using the -W option the exact algorithm used to compute the fitness (and hence the effect of this parameter) is best checked by looking at the source code (see perform.c). This is one area of constant program improvement/changes/development, so its difficult to say exactly the effect the parameter has. However, increasing the weight of a parameter (using the -F, -G, -R, -S or -X options) will make  the associated parameter have a greater effect on the fitness. 
+However, unless you optimise for a high FB ratio with the -W option, then setting the -F option will have no effect. For example, setting the options -F2.5 -W1 is a complete waste of time. There you have used the -W1 option to optimise only for gain (see -W option section of man page) but have changed the weight of the FB ratio from its default 1.0 to 2.5. If you are not optimising for FB ratio, the weight you attach to it is irrelavent.
+.TP
+.BI \-G weight_gain
+is the floating point number (default 1.0) specifying the weight to attach to
+the gain of the antenna when using the '-W' option, which calculates a fitness for the antenna based on one or more parameters (FB, gain, input resistance, input reactance, SWR, cleanliness of antenna pattern). The '-G' option is 
+similar to the options -F, -P, -R, -S, -X (which specify weights for FB ratio, pattern cleanliness, input resistance, SWR and input reactance).  
+When using the -W option the exact algorithm used to compute the fitness (and hence the effect of this parameter) is best checked by looking at the source code (see perform.c). This is one area of constant program improvement/changes/development, so its difficult to say exactly the effect the parameter has. However, increasing the weight of a parameter (using the -F, -G, -R, -S or -X options) will make  the associated parameter have a greater effect on the fitness. 
+However, unless you optimise for gain with the -W option, then setting the -G option will have no effect. For example, setting the options -G2.5 -W2 is a complete waste of time. There you have used the -W2 option to optimise only for FB ratio (see -W option section of man page) but have changed the weight of the gain from its default 1.0 to 2.5. If you are not optimising for gain, the weight you attach to it is irrelavent.
+.TP
+.BI \-K keep_for_tries
+.br
+.I keep_for_tries
+is the number of tries for the optimise to persist using the original data
+file as the starting point for optimisation. By default it is 1, which means the
+program immediately looks from a new position once a better one is found. It 
+is theeoretically possible that this might result in a quick, but poor local maximum. If however, 
+.I keep_for_tries
+is 1000, it will
+stay at a position for 1000 iterations after finding the last best result,
+before considering this to be a global optimum. Then it starts for the new 
+position. In practice, I have found this option to make matters worst in most cases. It was added to avoid the local-minimum problem, but it appears the optimisation surface is pretty smooth, so it just slows the program, without gaining much. Anyway, it can stay as an option, but check the results with/without carefully before using extensively. 
+.TP
+.BI \-P pattern_cleanlyiness
+is the floating point number (default 1.0) specifying the weight to attach to
+the cleanness of the antenna pattern when using the '-W' option, which calculates a fitness for the antenna based on one or more parameters (FB, gain, input resistance, input reactance, SWR, cleanliness of antenna pattern). The '-P' option is similar to the options -F, -G, -R, -S, -X (which specify weights for FB ratio, gain, input resistance, SWR and input reactance).  
+When using the -W option the exact algorithm used to compute the fitness (and hence the effect of this parameter) is best checked by looking at the source code (see perform.c). This is one area of constant program improvement/changes/development, so its difficult to say exactly the effect the parameter has. However, increasing the weight of a parameter (using the -F, -G, -R, -S or -X options) will make  the associated parameter have a greater effect on the fitness. 
+However, unless you optimise for a clean antenna pattern with the -W option, then setting the -P option will have no effect. For example, setting the options -P2.5 -W1 is a complete waste of time. There you have used the -W1 option to optimise only for gain (see -W option section of man page) but have changed the weight of the pattern cleanliness from its default 1.0 to 2.5. If you are not optimising for a clean radiation pattern, the weight you attach to it is irrelavent.
+With appropiate use of the -W option (eg -W49 for gain, SWR and a clean pattern), the computer program finds the level of the most significant sidelobe, wherever it may be outside the main bean. It then optimises to reduce this. The -P option tells it how much weight to put on reducing this sidelobe.
+.TP
+.BI \-R weight_resistance
+is the floating point number (default 1.0) specifying the weight to attach to
+the obtaining an input resistance close to Zo on the antenna when using the '-W' option, which calculates a fitness for the antenna based on one or more parameters (FB, gain, input resistance, input reactance, SWR, cleanliness of antenna pattern). The '-R' option is similar to the options -F, -G, -P, -S, -X (which specify weights for FB, gain, pattern cleanliness, SWR and input reactance).  
+When using the -W option the exact algorithm used to compute the fitness (and hence the effect of this parameter) is best checked by looking at the source code (see perform.c). This is one area of constant program improvement/changes/development, so its difficult to say exactly the effect the parameter has. However, increasing the weight of a parameter (using the -F, -G, -R, -S or -X options) will make  the associated parameter have a greater effect on the fitness. 
+However, unless you optimise for an an input resistance close to Zo, with the -W option, then setting the -R option will have no effect. For example, setting the options -R2.5 -W1 is a complete waste of time. There you have used the -W1 option to optimise only for gain (see -W option section of man page) but have changed the weight of the resistance from its default 1.0 to 2.5. If you are not optimising for an input resistance close to Zo, the weight you attach to it is irrelavent.
+.TP
+.BI \-S weight_swr
+is the floating point number (default 1.0) specifying the weight to attach to
+the SWR of the antenna when using the '-W' option, which calculates a fitness for the antenna based on one or more parameters (FB, gain, input resistance, input reactance, SWR, cleanliness of antenna pattern). The '-S' option is 
+similar to the options -F, -G, -P, -R, -X (which specify weights for FB, gain, pattern cleanliness, input resistance and input reactance).  
+When using the -W option the exact algorithm used to compute the fitness (and hence the effect of this parameter) is best checked by looking at the source code (see perform.c). This is one area of constant program improvement/changes/development, so its difficult to say exactly the effect the parameter has. However, increasing the weight of a parameter (using the -F, -G, -R, -S or -X options) will make  the associated parameter have a greater effect on the fitness. 
+However, unless you optimise for SWR with the -W option, then setting the -S option will have no effect. For example, setting the options -S2.5 -W1 is a complete waste of time. There you have used the -W1 option to optimise only for gain (see -W option section of man page) but have changed the weight of the SWR from its default 1.0 to 2.5. If you are not optimising for SWR, the weight you attach to it is irrelavent.
+.TP
+.BI \-T position_tolerance
+.I position_tolerance
+is the standard deviation in mm of the accuracy with which you can cut elements. Since 99.7%
+of elements will be with 3 standard deviations of the correct position (stats theory says this), set
+-T2 if virtually all (well 99.7%) of elements are within 3x2=6 mm of the correct position.This
+option *must* be used with the '-t'  option and can't be used with any other options apart from
+'-Z', '-v' and '-d'.
+.TP
+.BI \-W  Weighted_algorithm
+Try to get an antenna which is better according to a weighted combination of 
+parameters, rather than require them all to improve. The integer specifies
+what to consider in the weighted parameters.
+.br
+W1 Gain.
+.br
+W2 FB
+.br    
+W4 R
+.br
+W8 X
+.br
+W16 SWR
+.br
+W32 SIDE_LOBE 
+.br
+You can logically AND these together, so for example -W3 will optimise using a weighted combination of gain and FB. -W49, will use a weighted combination of gain, swr and sidelobe leve, since 32+16+1=49.
+.TP
+.BI \-X weight_reactance
+is the floating point number (default 1.0) specifying the weight to attach to
+achieving a low input reactance on the antenna when using the '-W' option, which calculates a fitness for the antenna based on one or more parameters (FB, gain, input resistance, input reactance, SWR, cleanliness of antenna pattern). The '-X' option is similar to the options -F, G, -P, -R and -S (which specify weights for FB ratio, gain, pattern cleanliness, input resistance, and SWR).  
+When using the -W option the exact algorithm used to compute the fitness (and hence the effect of this parameter) is best checked by looking at the source code (see perform.c). This is one area of constant program improvement/changes/development, so its difficult to say exactly the effect the parameter has. However, increasing the weight of a parameter (using the -F, -G, -R, -S or -X options) will make  the associated parameter have a greater effect on the fitness. 
+However, unless you optimise for a low input reactance with the -W option, then setting the -X option will have no effect. For example, setting the options -X2.5 -W1 is a complete waste of time. There you have used the -W1 option to optimise only for gain (see -W option section of man page) but have changed the weight of the reactiance from its default 1.0 to 2.5. If you are not optimising for a low input reactance, the weight you attach to it is irrelavent.
+.TP
+.BI \-Z Zo
+.br
+.I Zo
+is the characteristic impedance used when evaluating the VSWR, reflection coefficient and other
+similar calculations. The optimiser usually tries to bring the input impedance of the antenna to
+this value. It is set by default to 50 Ohms, so the default is equivalent to
+.I -Z50
+but may be set to any positive number. Set to 12.5 Ohms if you are going to feed the antenna
+with a 4:1 balun. Generally speaking, the gain of a Yagi
+can be higher for low input impedances, but of course such antennas are
+more difficult to feed.
+.TP
+.I  filename
+This is the name of the file containing the antenna description. It is expected
+to be in a format created by either
+.I input
+or
+.I first
+- two other programs in the 
+.I Yagi-Uda project.
+This is an ASCII text file.
+.TP
+.I iterations
+is an integer specifying the number of iterations for the optimiser to perform to try to get the best
+antenna. Time will limit the number you choose. 1000 iterations of a 1ele yagi takes about 5
+seconds, a 6ele approximately 60 seconds, an 11 element 350 seconds, a 20 element 1030
+seconds, a 33ele 2440 seconds, a 50element 5400 seconds, 100ele 21320 seconds all on an old
+25MHz 486 PC with no external cache.
+When using the 
+.I -A
+option the 
+.I iterations 
+is automatically set internally so only one attempt is
+made.
+When using the '-t' and '-T' options, 
+.I iterations     
+specifies the number of iterations to attempt to get a poorer design, to check the sensitivity of
+the design to small manufacturing tolerances.
+.SH EXAMPLES
+Here are a number of examples of using 
+.I optimise.
+.PP
+1) optimise 5ele 1000
+.PP
+Here the file 5ele will be optimised using the default system for 1000
+iterations. The default might typically require gain, FB and SWR to
+all improve, but this may be changed at any time. In any case, the
+program tells you what its optimising for. By default the program will
+only optimise to the selected parameters are good, not over-optimising any
+one at the detrement of the others.
+
+2) optimise -b30 -f50 -s2 5ele 1000
+.PP
+This is similar to above, but the boom can not extend by more than 30%
+from its  original length, FB ratios above 50 dB are considered acceptable,
+as are SWR's less than 2:1. The optimised resultant antenna is likely to have
+better FB ratio, but poorer SWR than in (1) above.
+
+3) optimise -o1 5ele 1000
+.PP
+This will simply optimise 5ele for maximum forward gain. The resultant
+antenna may have a poor FB ratio and is likely to have an unacceptably
+low input impedance and hence high VSWR. This is not a very sensible
+method of optimisation.
+
+4) optimise -W49 -l7 5ele 10000
+.PP
+This will optimise the file 5ele using for 10000 iterations. It will
+require that the weighted performance of the antenna in three important
+parameters (gain, sidelobe level and SWR) improves from one design to the
+next. One or two parameters can actually get worst from one design to
+the next, but the weighted performance is better. The positions of the elements or lengths of
+elements will not change by more than 7% in each iteration.
+.PP
+5) optimise -g -S30 -G50 -F20 -p1500 5ele 10000
+.PP
+This will optimise the file 5ele using a genetic algorithm. 1500 antennas will be randomly
+designed. The performance of each of these will measured using a 'fitness' function, weighted
+30% to SWR, 50% to gain and 20% to FB ratio. The probability of breading from a pair of
+antennas is proportional to the fitness function. 
+.PP
+6) optimise -w atv_antenna 10000
+.PP
+This will optimise the file atv_antenna for a best average performance over a wide band. The progrram calculates the gain, FB and SWR at three frequencies, then computes an average (mean) performance of the antenna over the band. N iterations will take 3x as long to execute as N iterations on the same antenna without the '-w' option.
+.PP
+7) optimise -t0.1 -T1  good_design 100
+.PP
+This will take the file good_design and make 100 different antennas from it,
+to simulate the effects of building tolerances. Each element is assumed to be cut so that the mean
+error of all elements is 0 mm, but a standard deviation of 0.1 mm, so 68.4% of element lengths
+are within 0.1 mm, 95.4% within 0.2 mm and 99.7% with in 0.3 mm. The accuracy of placing
+elements along the boom is much lower, so here we have specified a standard deviation of
+1.0 mm, so 68.6% of elements are placed within 1 mm of the correct position, 95.4% within 2 mm
+of the correct position etc.  The program will report the *worst* performances achieved. If the
+performance dips too mush, then you either need to build them better, or get a design that's less critical!
+
+.SH STOPPING
+.I Optimise
+will stop after the number of iterations specified in the parameter
+.I iterations. 
+It will also stop if a file 
+.I stop
+exits in the current directory of the executable 
+.I optimise
+This file can of course only be created using a multi-tasking operating
+system such as Unix. It is *not* advisable to stop the program by
+hitting the DEL key (Unix) or CONTROL-C (DOS), as one of the files may
+be open at the time, resulting in an empty file. Files are not open for
+any longer than necessary (they are closed immediately after writing to
+them), so this is not a likely occurrence, but can still occur.
+.SH LIMITATIONS
+I'm not aware of any limitations, apart from that filenames, including full
+path, can't exceed 90 characters. 
+.SH FILES
+.nf
+filename           Antenna description, created by input or first.
+filename.up    Update file, listing achievements of optimise.
+filename.bes       Best file, containing the best design to date.
+changes         File that causes the program to pause to re-adjust weights.
+stop            File that stops optimisation process.
+.br
+.fi
+.SH "SEE ALSO"
+first(1), input(1), output(1), yagi(1), first(5), input(5) output(5) and optimise(5).
+
+.SH PLATFORMS
+Both DOS and Unix versions have been built. The DOS version as
+distributed requires a 386 PC with a 387 maths coprocessor. 
+
+Although I have altered the source to make it more compatible with DOS (reduced file name
+lengths etc), my wish is to build a decent program, rather than fit the program to an outdated
+operating system. If there is a *good* reason to use code that is incompatible with DOS, this will
+be done.
+.br
+Since 
+.I optimise
+takes  a while to optimise an antenna (I've optimised one design for a week), it is obviously
+more sensible to build this program under a multi-tasking operating system, as otherwise a PC
+can be tied up for days.
+.SH BUGS
+Bugs should be reported to
+.BR david.kirkby at onetel.net .
+Bugs tend actually to be fixed if they can be isolated, so it is in your
+interest to report them in such a way that they can be easily reproduced.
+
+The program will dump core (crash) if asked to optimise a 1ele beam, without any arguments.
+This is because a 1ele beam has no parasitic elements and by default the program only changes
+parasitic elements.
+
+Some of the options are not checked for sensible values, although most are 
+now checked and report if they are out of range.
+
+If the user specifies very large manufacturing errors using the '-t' and '-T'
+options, its possible for elements to overlap or for element lengths to
+become negative. This will cause numerical errors. Any reasonable values 
+will not cause this.
+
+
+On long Yagi's (50 elements) optimise can go a bit silly. It can optimise
+say a 1296MHz Yagi to get 20 dB at 1296 MHz, but less than 0 dB at only 1 MHz 
+away. Needs some thought!
+
+The level of the sidelobes is not computed with the GA or some other optimisation types. This will be corrected later.
+
+All those I don't know about. 
+
+.nf
+.SH AUTHORS
+Dr. David Kirkby G8WRB (david.kirkby at onetel.net).
+with help with converting to DOS from Dr. Joe Mack NA3T (mack at fcrfv2.ncifcrf.gov)
diff --git a/man/man1/output.1 b/man/man1/output.1
new file mode 100644
index 0000000..9e9a30d
--- /dev/null
+++ b/man/man1/output.1
@@ -0,0 +1,154 @@
+.TH OUTPUT 1 "24th October 2000" "Version 1.16"
+.de BP
+.sp
+.ns
+.ti -.2i
+\(**
+..
+.SH NAME
+output \- Yagi-Uda project antenna display program
+.SH SYNOPSIS
+.B output
+[
+.B -\ cehps
+]
+[
+.BI \-E E_max
+]
+[
+.BI \-H Hmax
+]
+[
+.BI \-r minimum
+]
+[
+.BI \-R maximum
+]
+[
+.BI \-Z Zo
+]
+
+filename 
+.SH DESCRIPTION
+The program 
+.I output
+is one of a number of executable programs that forms part of a set of 
+programs, collectively known as the
+.I Yagi-Uda project
+, which were designed for analysis and optimisation of Yagi-Uda antennas. 
+.I  output
+calculates the gain, FB ratio, input impedance etc etc of an antenna that was described by the
+program 
+.I input
+or
+.I first
+and has had the element currents calculated with the program 
+.I yagi
+The data about the forward gain, VSWR, FB ratio, input impedance etc is written to a file
+.I filename.dat
+Angular data, giving the variation of gain with theta and phi is put into a file
+.I filename.gai
+.br 
+Sometimes the program fails to find the 3dB bandwidths in the E and H planes,
+and bombs out with a 'zbrent' error. This can occur if:
+.br
+(1) The antenna has an almost isotropic pattern, in which case its never 3dB 
+down, so the 3dB point is undefined.
+.br
+(2) The 3dB point is outside the assumed angular range. 
+You then have to either:
+.br
+(a) Calculate with the -e option, which avoids calculation of the 3dB E-plane beamwidth or
+.br
+(b) Do (a) above, then find approximately where the 3dB point is (from the .gai file -see later), then set
+options -E and -H so the program calculates them properly.
+.LP
+
+
+.br
+The DOS .EXE files as distributed require a 387 maths coprocessor to be
+present and will not run without it. A 486, Pentium, and I assume later
+processors of this series will run it without any extra hardware. The DOS files are no longer being
+maintained, so are out of sync with the latest source. 
+.SH OPTIONS
+.TP
+.B \-c
+Calculate the maximum level of any sidelobe - not just the rear on as the
+FB ratio tells us. If the sidelobe and FB ratio are equal, it means the 
+biggest sidelobe is the rear one. If the Sidelobe is less than the FB 
+ratio, then another lobe is more significant. Look in the '.gai' file (see
+below) to see where it is. This option slows the program quite a bit.
+.TP
+.B \-e  
+Suppress calculation of the 3dB E-plane bandwidth. This is sometimes necessary if the programme is
+unable to find the 3 dB beamwidth, to prevent an error occuring.
+.TP
+.B \-h  
+Suppress calculation of the 3dB H-plane bandwidth. This is sometimes necessary if the programme is 
+unable to find the 3 dB beamwidth, to prevent an error occuring.
+.TP
+.B \-p  
+Put data into a file filename.freq for reading into gnuplot, and a commmand file filename.gc for
+gnuplot to use. (run 'output -p filename' then 'gnuplot filename.gc' )
+.TP
+.B \-s
+Suppress all diagnostic output. By default, the program print the percentage of the job completed.
+.TP
+.BI \-E E_max
+When the program computes the E-plane 3dB beamwidth, it assumes the antenna pattern is 3dB down somewhere in the range 90 to Emax, where E_max is by default 179 degrees. This can fail if it is never 3dB down in the range, or if it happened to go 3dB down in two or more points. You can change E_max, if you need to, but
+rarely if every should need to. I've never seen a failure here, but are guarding against one. If you dont want the pattern, use the -e option instead, which skips it. See also '-H' below.
+.TP
+.BI \-H H_max
+When the program computes the H-plane 3dB beamwidth, it assumes the antenna pattern is 3dB down somewhere in the range 0 to Hmax, where H_max is by defualt 60 degrees. This can fail if it is never 3dB down in the range, or if it happended to go 3dB down in two or more points. Also, if it goes more than 3dB down, but that starts to come up again. You can change H_max, if you need to, as
+failures do occasionally occur. If you dont want the pattern use -h option instead, which will skip it.
+.br 
+An obvious example of an antenna where you cant find the 3dB bandwidth for the H-plane is the 1ele dipole. The radiation is symmetrical about its axis, so the level is the same everywhere in the H plane. The program automatically avoids calculating it for a 1 ele beam.
+
+.TP
+.BI \-Z Zo
+Zo is the characteristic impedance used when calculating the VSWR. By default it's 50 Ohms, but can be changed to any real, positive value.
+
+.TP
+.I \ filename
+is the name of the file containing the antenna description. It is expected
+to be in a format created by 
+.I input
+or
+.I first
+- two other programs in the 
+.I Yagi-Uda project.
+The is also expected to exist a binary file 
+.I filename.out
+created by typing
+.I yagi filename
+.SH Limitations
+I'm not aware of any limitations, apart from that filenames, including full
+path, can't exceed 90 characters. 
+.SH FILES
+.nf
+filename        ASCII file with antenna description.
+filename.out    Binary data file, created by yagi.
+filename.dat    ASCII file with gain, FB ratio etc.
+filename.gai    ASCII file with angular dependence of gain.
+.f
+.br
+.SH "SEE ALSO"
+first(1), input(1), yagi(1), optimise(1).
+
+.SH PLATFORMS
+Both DOS and Unix versions have been built. The DOS version as
+distributed requires a 386 PC with a 387 maths coprocessor. 
+.SH BUGS
+Bugs should be reported to
+.BR david.kirkby at onetel.net .
+Bugs tend actually to be fixed if they can be isolated, so it is in your
+interest to report them in such a way that they can be easily reproduced.
+The program gives errors if element lengths are well away from a half-wave (by a factor of ~3)
+due to a breakdown in the equations.
+If the input file is edited manually and done incorrectly, there can be unpredictable results.
+
+.nf
+.SH AUTHORS
+
+Dr. David Kirkby G8WRB (david.kirkby at onetel.net).
+with help with converting to DOS from Dr. Joe Mack NA3T (mack at fcrfv2.ncifcrf.gov)
diff --git a/man/man1/yagi.1 b/man/man1/yagi.1
new file mode 100644
index 0000000..e850d3b
--- /dev/null
+++ b/man/man1/yagi.1
@@ -0,0 +1,77 @@
+.TH YAGI 1 "24th October 2000 " "Version 1.16"
+.de BP
+.sp
+.ns
+.ti -.2i
+\(**
+..
+.SH NAME
+yagi \- Yagi-Uda project antenna current calculator
+.SH SYNOPSIS
+.B yagi 
+[
+.B -\ dhps
+]
+filename 
+.SH DESCRIPTION
+The program 
+.I yagi
+is one of a number of executable programs that forms part of a set of 
+programs, collectively known as the
+.I Yagi-Uda project
+, which were designed for analysis and optimisation of Yagi-Uda antennas. 
+.I yagi 
+calculates the currents at the centre of each element at one or more frequencies, as specified in
+the input file.
+.SH AVAILABILITY
+.SH OPTIONS
+.TP
+.B \-d
+Display element currents. When this option is used, a bar graph with up to 70
+stars (*) is used to display the absolute magnitude of the element currents. The element with the greatest element current has 70 *'s, all others have a corresponding smaller number, depending on the their relative current. The element current, normallised to the maximum, is also shown as a 4 digit floating point number.
+.TP
+.B \-h  
+Print a help message.
+.TP
+.B \-p
+Print the Z matrix. The Z matrix is the impedance matrix, showing the self
+impedance of the elements on the diagonal and the mutual impedance off the diagonal.
+.TP
+.B \-s
+Suppress all diagnostic output. By default, the program print the percentage of the job completed.
+.TP
+.I \ filename
+is the name of the file containing the antenna description. It is expected
+to be in a format created by either
+.I input
+or
+.I first
+- two other programs in the 
+.I Yagi-Uda project.
+This is an ASCII text file. The antenna currents are written to a file
+.I filename.out
+which is a binary file. It is not intended to be read by humans.
+
+.SH Limitations
+I'm not aware of any limitations, apart from that filenames, including full
+path, can't exceed 90 characters. 
+.SH FILES
+filename.out       Binary data file
+.br
+.SH "SEE ALSO"
+first(1), input(1), output(1), optimise(1), first(5), input(5), output(5) and optimise(5).
+
+.SH PLATFORMS
+Both DOS and Unix versions have been built. The DOS version as
+distributed requires a 386 PC with a 387 maths coprocessor. 
+.SH BUGS
+Bugs should be reported to
+.BR david.kirkby at onetel.net .
+Bugs tend actually to be fixed if they can be isolated, so it is in your
+interest to report them in such a way that they can be easily reproduced.
+If the input file is edited manually and done incorrectly, there can be unpredictable results.
+
+.SH AUTHORS
+
+Dr. David Kirkby G8WRB (david.kirkby at onetel.net), with 
+help with converting to DOS from Dr. Joe Mack NA3T (mack at fcrfv2.ncifcrf.gov).
diff --git a/man/man5/Makefile.am b/man/man5/Makefile.am
new file mode 100644
index 0000000..0ce092a
--- /dev/null
+++ b/man/man5/Makefile.am
@@ -0,0 +1,2 @@
+man_MANS = first.5     input.5     optimise.5  output.5    yagi.5
+EXTRA_DIST = $(man_MANS) 
diff --git a/man/man5/Makefile.in b/man/man5/Makefile.in
new file mode 100644
index 0000000..abb4209
--- /dev/null
+++ b/man/man5/Makefile.in
@@ -0,0 +1,292 @@
+# Makefile.in generated by automake 1.7 from Makefile.am.
+# @configure_input@
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__quote = @am__quote@
+bindir = @bindir@
+build_alias = @build_alias@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+man_MANS = first.5     input.5     optimise.5  output.5    yagi.5
+EXTRA_DIST = $(man_MANS) 
+subdir = man/man5
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+DIST_SOURCES =
+
+NROFF = nroff
+MANS = $(man_MANS)
+DIST_COMMON = Makefile.am Makefile.in
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.ac $(ACLOCAL_M4)
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  man/man5/Makefile
+Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+uninstall-info-am:
+
+man5dir = $(mandir)/man5
+install-man5: $(man5_MANS) $(man_MANS)
+	@$(NORMAL_INSTALL)
+	$(mkinstalldirs) $(DESTDIR)$(man5dir)
+	@list='$(man5_MANS) $(dist_man5_MANS) $(nodist_man5_MANS)'; \
+	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+	for i in $$l2; do \
+	  case "$$i" in \
+	    *.5*) list="$$list $$i" ;; \
+	  esac; \
+	done; \
+	for i in $$list; do \
+	  if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
+	  else file=$$i; fi; \
+	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+	  case "$$ext" in \
+	    5*) ;; \
+	    *) ext='5' ;; \
+	  esac; \
+	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
+	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+	  echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man5dir)/$$inst"; \
+	  $(INSTALL_DATA) $$file $(DESTDIR)$(man5dir)/$$inst; \
+	done
+uninstall-man5:
+	@$(NORMAL_UNINSTALL)
+	@list='$(man5_MANS) $(dist_man5_MANS) $(nodist_man5_MANS)'; \
+	l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
+	for i in $$l2; do \
+	  case "$$i" in \
+	    *.5*) list="$$list $$i" ;; \
+	  esac; \
+	done; \
+	for i in $$list; do \
+	  ext=`echo $$i | sed -e 's/^.*\\.//'`; \
+	  inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
+	  inst=`echo $$inst | sed -e 's/^.*\///'`; \
+	  inst=`echo $$inst | sed '$(transform)'`.$$ext; \
+	  echo " rm -f $(DESTDIR)$(man5dir)/$$inst"; \
+	  rm -f $(DESTDIR)$(man5dir)/$$inst; \
+	done
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkinstalldirs) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(MANS)
+
+installdirs:
+	$(mkinstalldirs) $(DESTDIR)$(man5dir)
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-rm -f Makefile $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-man
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man: install-man5
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am uninstall-man
+
+uninstall-man: uninstall-man5
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+	distclean-generic distdir dvi dvi-am info info-am install \
+	install-am install-data install-data-am install-exec \
+	install-exec-am install-info install-info-am install-man \
+	install-man5 install-strip installcheck installcheck-am \
+	installdirs maintainer-clean maintainer-clean-generic \
+	mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \
+	uninstall-am uninstall-info-am uninstall-man uninstall-man5
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/man/man5/first.5 b/man/man5/first.5
new file mode 100644
index 0000000..ca1f906
--- /dev/null
+++ b/man/man5/first.5
@@ -0,0 +1,20 @@
+'\" e
+.\" -*- nroff -*-
+.\" This man page must be preprocessed with eqn.
+.ie \n(.g .ds ic \/
+.el .ds ic \^
+.TH FIRST 5 "24 th October 2000" "first version 1.16"
+.SH NAME
+first \- output data file format
+.br
+
+The data files created by the 
+.IR Yagi-Uda 
+projects
+.IR first
+are in the same format as created by
+.IR input
+and are described under input(5).
+
+.SH "SEE ALSO"
+first(1), yagi(), output(1), optimise(1), input(5), yagi(5), output(5), optimise(5).
diff --git a/man/man5/input.5 b/man/man5/input.5
new file mode 100644
index 0000000..25c36d5
--- /dev/null
+++ b/man/man5/input.5
@@ -0,0 +1,84 @@
+'\" e
+.\" -*- nroff -*-
+.\" This man page must be preprocessed with eqn.
+.ie \n(.g .ds ic \/
+.el .ds ic \^
+.TH INPUT 5 "24th October 2000" "Yagi version 1.16"
+.SH NAME
+input \- input data file format
+.SH DESCRIPTION
+This manual page describes the output format of the file created by the
+.I Yagi-Uda project
+.IR input
+or
+.IR first
+programs. The file is an ASCII file, so can be edited manually
+if required. It is read by 
+.IR yagi
+or 
+.IR optimise. 
+The program
+.IR optimise
+also creates the same file format.
+.ul 11
+.nf
+
+NOTES 
+FREQUENCY 
+MIN_FREQUENCY 
+MAX_FREQUENCY 
+STEP_FREQUENCY
+ELEMENTS 
+DRIVEN 
+PARASITIC 
+ANGULAR_STEP   
+DATA_DRIVEN 
+DATA_PARASITIC
+
+.f
+The 
+.IR #
+is used as a comment.
+
+A typical file, for an antenna designed for the 2m amateur band (144-146
+MHz) might be as shown below. Note:
+1) Reflector is at position 0.0
+2) All elements lengths/positions are in m.
+
+.nf
+NOTES This line can be up to 400 characters.
+FREQUENCY 145.000000
+MIN_FREQUENCY 144.000000
+MAX_FREQUENCY 146.000000
+STEP_FREQUENCY 0.100000
+ELEMENTS 10
+DRIVEN 1
+PARASITIC 9
+ANGULAR_STEP   180.000000
+#DATA_DRIVEN x y length  diameter voltage phase
+DATA_DRIVEN  0.30993 0.000000 1.002492 0.0063000000000000 1.000000 0.000000                           
+# DATA_PARASITIC x y length  diameter
+DATA_PARASITIC
+   0.00000    0.00000    1.01902    0.00630                               
+   0.49859    0.00000    0.95551    0.00630                               
+   1.07338    0.00000    0.93595    0.00630                               
+   1.81020    0.00000    0.92050    0.00630                               
+   2.58152    0.00000    0.91322    0.00630                               
+   3.30390    0.00000    0.91243    0.00630                               
+   4.03692    0.00000    0.90423    0.00630                               
+   4.64108    0.00000    0.89081    0.00630                               
+   5.37418    0.00000    0.83912    0.00630                               
+
+.SH FILES
+
+	filename                            ASCII description of antenna.
+	filename.out                        binary file
+
+.SH SEE ALSO
+ 
+yagi(1), output(1), input(1), optimise(1), first(1) and yagi(5).
+
+.SH AUTHORS
+
+Dr. David Kirkby G8WRB (david.kirkby at onetel.net), with 
+help with converting to DOS from Dr. Joe Mack NA3T (mack at fcrfv2.ncifcrf.gov).
diff --git a/man/man5/optimise.5 b/man/man5/optimise.5
new file mode 100644
index 0000000..e9124ca
--- /dev/null
+++ b/man/man5/optimise.5
@@ -0,0 +1,44 @@
+'\" e
+.\" -*- nroff -*-
+.\" This man page must be preprocessed with eqn.
+.ie \n(.g .ds ic \/
+.el .ds ic \^
+.TH OPTIMISE 5 "24th October 2000" "Version 1.16"
+.SH NAME
+optimise \- output data file formats
+.SH DESCRIPTION
+This manual page describes the output formats of the files created by the
+.IR Yagi-Uda 
+project's 
+.IR optimise
+program. The input files required for optimise are plain ASCII which can be generated by 
+.IR input 
+or 
+.IR first.
+or may be generated manually with a text editor, if care is used. The format required by optimise is described in input(5). Optimise's output files, which have the .bes extension are the same format as the input files and are again obviously described by input(5).
+
+.SH Example of a .up file.
+
+The .up file list the improvements made by optimise to an antenna
+design. Starting from the original design, the file is appended each time a new better design is found. Here is an example, where the final line is the performance of the 4 element beam with the .dat file shown earlier.
+.nf
+    1 7.57dBi,  16.93dB F/B, Z=(31.77-56.34j) Ohms, SWR=3.95, SL=16.95 dB
+.br
+   84 7.58dBi,  16.93dB F/B, Z=(31.78-56.32j) Ohms, SWR=3.95, SL=16.95 dB
+.br
+  623 7.58dBi,  16.93dB F/B, Z=(31.78-56.28j) Ohms, SWR=3.95, SL=16.95 dB
+.br
+89345 9.74dBi, 103.06dB F/B, Z=(37.55 +1.61j) Ohms, SWR=1.33, SL=17.78 dB
+
+.br
+.SH What is what in the .up file
+The first column is an integer specifying the iteration. The other columns, going from left to right are gain(dBi), FB, input impedance, VSWR and level of the most significant sidelobe, in dB down on the peak gain.
+
+.SH "SEE ALS0"
+ 
+yagi(1), output(1), input(1), optimise(1), first(1), input(5), output(5) and yagi(5).
+
+.SH AUTHORS
+
+Dr. David Kirkby G8WRB (david.kirkby at onetel.net), with 
+help with converting to DOS from Dr. Joe Mack NA3T (mack at fcrfv2.ncifcrf.gov).
diff --git a/man/man5/output.5 b/man/man5/output.5
new file mode 100644
index 0000000..2e92826
--- /dev/null
+++ b/man/man5/output.5
@@ -0,0 +1,126 @@
+'\" e
+.\" -*- nroff -*-
+.\" This man page must be preprocessed with eqn.
+.ie \n(.g .ds ic \/
+.el .ds ic \^
+.TH OUTPUT 5 "24th October 2000" "Version 1.16"
+.SH NAME
+output \- output data file formats
+.SH DESCRIPTION
+This manual page describes the output formats of the files created by the
+.IR Yagi-Uda 
+project's 
+.IR output
+program. The files are ASCII file, so can be analysed with any graph plotting program.
+.SH Example of a .dat File
+Below is a typical .dat file, for a 4ele 144-146MHz beam, optimised for a huge
+(and useless) FB.
+
+.nf  
+.br
+# Driven=1 parasitic=3 total-elements=4 design=145.000MHz
+.br
+# Checked from 144.000MHz to 146.000MHz.
+.nf
+f(MHz) E(deg) H(deg) R       jX   VSWR  Gain(dBi)  FB(dB) SideLobes(dB)
+.br
+144.000 54.7  71.5  44.47  -2.35  1.136  9.386     21.944     16.650
+.br
+144.500 54.0  70.1  41.34  -0.75  1.210  9.553     27.244     17.153
+.br
+145.000 53.2  68.4  37.55   1.61  1.335  9.742    103.055     17.777
+.br
+145.500 52.3  66.6  33.26   5.00  1.530  9.947     25.734     18.547
+.b
+146.000 51.3  64.6  28.77   9.63  1.832 10.149     18.919     18.919
+
+.tp
+.br
+.SH What is what in the .dat file
+The f(MHz) column is the frequency (MHz) at which the data is evaluated at.
+.br
+The E(deg) column is the approximate 3dB E-plane bandwidth calculated to the nearest 0.1 degree.
+.br
+The H(deg) column is the approximate 3dB H-plane bandwidth calculated to the nearest 0.1 degree.
+.br
+The (R) column is the input resistance in Ohms.
+.br
+The (jX) column is the  input reactance in Ohms.
+.br
+The (VSWR) column is the input VSWR, usually refered to a 50 Ohm input, but this may be changed.
+.br
+The Gain (dBi) column is the gain at theta=90 degrees, which is the forward direction of the beam. It is possible that a higher gain occurs at other than 90 degrees, but this is not taken into account. The antenna is seriously at fault if this occurs.
+.br
+The FB(dB) column is the front to back ratio in dB. 
+.br
+The Sidelobes(dB) column is the minimum level in dB down from the peak gain of any sidelobe. This is not calculated unless the '-c' option is used, and then only on some optimisation techniques.
+
+.SH Example of a .gai File
+The following is a small section of the .gai file.
+.nf
+f(MHz)     theta  gain-E(dBi) G(E)-peak   phi   gain-H(dBi) G(H)-peak
+144.0000 -90.0000  -12.5584   -21.9444 -180.0000 -12.5584  -21.9444
+.br
+144.0000 -45.0000   -7.3507   -16.7367 -135.0000  -3.5971  -12.9830
+.br
+144.0000   0.0000 -999.0000 -1008.3860  -90.0000  -0.9010  -10.2870
+.br
+144.0000  45.0000    0.1848    -9.2012  -45.0000   4.0261   -5.3599
+.br
+144.0000  90.0000    9.3860     0.0000    0.0000   9.3860    0.0000
+.br
+144.0000 135.0000    0.1848    -9.2012   45.0000   4.0261   -5.3599
+.br
+144.0000 180.0000 -999.0000 -1008.3860   90.0000  -0.9010  -10.2870
+.br
+144.0000 225.0000   -7.3507   -16.7367  135.0000  -3.5971  -12.9830
+.br
+144.0000 270.0000  -12.5584   -21.9444  180.0000 -12.5584  -21.9444
+.br
+
+.SH What is what in the .gai file
+The f(MHz) column is the frequency in MHz.
+.br
+The theta column is the angle theta, for which the next two columns refer.
+.br
+The gain-E(dBi) is the gain at theta, relative to an isotropic radiator. 
+This is the E-plane gain. Hence at the peak (theta), this gives the
+peak forward gain.
+.br
+The G(E)-peak is the gain at theta, relative to the peak gain. Hence
+at the peak (theta=90 degrees), this is zero.
+.br
+The phi column has nothing to do with the previous 3 columns. It is the angle
+for which the next two columns refer.
+.br
+The gain-H(dBi) is the gain at phi, relative to an isotropic radiator. 
+This is the H-plane gain. Hence at the peak (phi=0), this gives the
+peak forward gain.
+.br
+The G(H)-peak is the gain at phi, relative to the peak gain. Hence
+at the peak (phi=0 degrees), this is zero.
+.br
+.SH Example of a .up File
+The .up file list the improvements made by optimise to an antenna
+design. Starting from the original design, the file is appended each time a new better design is found. Here is an example, where the final line is the performance of the 4ele beam with the .dat file shown earlier.
+.nf
+    1 7.57dBi,  16.93dB F/B, Z=(31.77-56.34j) Ohms, VSWR=3.95, SL=16.95 dB
+.br
+   84 7.58dBi,  16.93dB F/B, Z=(31.78-56.32j) Ohms, VSWR=3.95, SL=16.95 dB
+.br
+  623 7.58dBi,  16.93dB F/B, Z=(31.78-56.28j) Ohms, VSWR=3.95, SL=16.95 dB
+.br
+89345 9.74dBi, 103.06dB F/B, Z=(37.55 +1.61j) Ohms, VSWR=1.33, SL=17.78 dB
+
+.br
+.SH What is what in the .up file
+The first column is an integer specifying the iteration. The other columns, going from left to right are gain(dBi), FB, input impedance, VSWR and level of the most significant sidelobe, in dB down on the peak gain.
+
+.SH "SEE ALS0"
+ 
+yagi(1), output(1), input(1), optimise(1), first(1) and yagi(5).
+
+.SH AUTHORS
+
+Dr. David Kirkby G8WRB (david.kirkby at onetel.net), with 
+help with converting to DOS from Dr. Joe Mack NA3T (mack at fcrfv2.ncifcrf.gov).
diff --git a/man/man5/yagi.5 b/man/man5/yagi.5
new file mode 100644
index 0000000..c9807ce
--- /dev/null
+++ b/man/man5/yagi.5
@@ -0,0 +1,74 @@
+'\" e
+.\" -*- nroff -*-
+.\" This man page must be preprocessed with eqn.
+.ie \n(.g .ds ic \/
+.el .ds ic \^
+.TH YAGI 5 "24th October 2000" "Yagi version 1.16"
+.SH NAME
+yagi \- yagi binary output format
+.SH DESCRIPTION
+This manual page describes the output format of the file created by the
+.IR Yagi-Uda 
+project's 
+.IR yagi
+program. The file is a binary file with a header of 100 bytes. The
+header consists of:
+
+
+.nf
+.ul
+offset(bytes)              information          data-type 
+
+0                          elements             int
+4                          driven               int
+8                          parasitic            int
+12                         min_frequency        double
+20                         max_frequency        double
+28                         design frequency     double
+36                         step_frequency       double
+44                         angular_step         double
+52                         0                    double
+.                          .                      .
+.                          .                      .
+.                          .                      .
+92                         0                    double
+
+Following the header, there starts the coordinates(x,y,l) of each
+element and the voltage applied to each element. Then we write
+the element currents one after the other, at each frequency.
+Hence the element currents will be written 12,000 times with a
+3 element yagi analysed at 4,000 different frequencies. All complex
+data is stored in a structure of type fcomplex, defined as:
+
+struct fcomplex {double real, double imaginary};
+
+.ul
+offset(bytes)              information          data-type 
+
+100                        x1                   double /* coordinates */
+108                        y1                   double
+116                        l1                   double
+100+(n-1)*24               x_n                  double
+100+(n-1)*24+8             y_n                  double
+100+(n-1)*24+16            l_n                  double
+.............. Repeated for each element.
+100+24*elements            Voltage1             fcomplex  /* voltage */
+100+24*elements+(n-1)*16   Voltage_n            fcomplex
+.............. Repeated for each element n at each frequency step f.
+100+40*elements            Current1 at f1          fcomplex /* current */
+100+40*elements+(n-1)*16   Current_n at f1         fcomplex
+
+100+56*elements            Current at f2           fcomplex
+100+40*elements+(n-1)*16   Current_n at f2         fcomplex
+
+.SH FILES
+
+	filename.out                        binary file
+.SH SEE ALSO
+ 
+yagi(1), output(1), input(1), optimise(1), first(1) and input(5).
+
+.SH AUTHORS
+
+Dr. David Kirkby G8WRB (david.kirkby at onetel.net), with 
+help with converting to DOS from Dr. Joe Mack NA3T (mack at fcrfv2.ncifcrf.gov).
diff --git a/missing b/missing
new file mode 100644
index 0000000..dd58370
--- /dev/null
+++ b/missing
@@ -0,0 +1,336 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+# Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard at iro.umontreal.ca>, 1996.
+
+# 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 2, 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., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+  echo 1>&2 "Try \`$0 --help' for more information"
+  exit 1
+fi
+
+run=:
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+  configure_ac=configure.ac
+else
+  configure_ac=configure.in
+fi
+
+case "$1" in
+--run)
+  # Try to run requested program, and just exit if it succeeds.
+  run=
+  shift
+  "$@" && exit 0
+  ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case "$1" in
+
+  -h|--h|--he|--hel|--help)
+    echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+  -h, --help      display this help and exit
+  -v, --version   output version information and exit
+  --run           try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+  aclocal      touch file \`aclocal.m4'
+  autoconf     touch file \`configure'
+  autoheader   touch file \`config.h.in'
+  automake     touch all \`Makefile.in' files
+  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
+  flex         create \`lex.yy.c', if possible, from existing .c
+  help2man     touch the output file
+  lex          create \`lex.yy.c', if possible, from existing .c
+  makeinfo     touch the output file
+  tar          try tar, gnutar, gtar, then tar without non-portable flags
+  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]"
+    ;;
+
+  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+    echo "missing 0.4 - GNU automake"
+    ;;
+
+  -*)
+    echo 1>&2 "$0: Unknown \`$1' option"
+    echo 1>&2 "Try \`$0 --help' for more information"
+    exit 1
+    ;;
+
+  aclocal*)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    fi
+
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
+         to install the \`Automake' and \`Perl' packages.  Grab them from
+         any GNU archive site."
+    touch aclocal.m4
+    ;;
+
+  autoconf)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    fi
+
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`${configure_ac}'.  You might want to install the
+         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
+         archive site."
+    touch configure
+    ;;
+
+  autoheader)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    fi
+
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
+         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
+         from any GNU archive site."
+    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+    test -z "$files" && files="config.h"
+    touch_files=
+    for f in $files; do
+      case "$f" in
+      *:*) touch_files="$touch_files "`echo "$f" |
+				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+      *) touch_files="$touch_files $f.in";;
+      esac
+    done
+    touch $touch_files
+    ;;
+
+  automake*)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    fi
+
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+         You might want to install the \`Automake' and \`Perl' packages.
+         Grab them from any GNU archive site."
+    find . -type f -name Makefile.am -print |
+	   sed 's/\.am$/.in/' |
+	   while read f; do touch "$f"; done
+    ;;
+
+  autom4te)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    fi
+
+    echo 1>&2 "\
+WARNING: \`$1' is needed, and you do not seem to have it handy on your
+         system.  You might have modified some files without having the
+         proper tools for further handling them.
+         You can get \`$1Help2man' as part of \`Autoconf' from any GNU
+         archive site."
+
+    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
+    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
+    if test -f "$file"; then
+	touch $file
+    else
+	test -z "$file" || exec >$file
+	echo "#! /bin/sh"
+	echo "# Created by GNU Automake missing as a replacement of"
+	echo "#  $ $@"
+	echo "exit 0"
+	chmod +x $file
+	exit 1
+    fi
+    ;;
+
+  bison|yacc)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified a \`.y' file.  You may need the \`Bison' package
+         in order for those modifications to take effect.  You can get
+         \`Bison' from any GNU archive site."
+    rm -f y.tab.c y.tab.h
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+	case "$LASTARG" in
+	*.y)
+	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+	    if [ -f "$SRCFILE" ]; then
+	         cp "$SRCFILE" y.tab.c
+	    fi
+	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+	    if [ -f "$SRCFILE" ]; then
+	         cp "$SRCFILE" y.tab.h
+	    fi
+	  ;;
+	esac
+    fi
+    if [ ! -f y.tab.h ]; then
+	echo >y.tab.h
+    fi
+    if [ ! -f y.tab.c ]; then
+	echo 'main() { return 0; }' >y.tab.c
+    fi
+    ;;
+
+  lex|flex)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified a \`.l' file.  You may need the \`Flex' package
+         in order for those modifications to take effect.  You can get
+         \`Flex' from any GNU archive site."
+    rm -f lex.yy.c
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+	case "$LASTARG" in
+	*.l)
+	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+	    if [ -f "$SRCFILE" ]; then
+	         cp "$SRCFILE" lex.yy.c
+	    fi
+	  ;;
+	esac
+    fi
+    if [ ! -f lex.yy.c ]; then
+	echo 'main() { return 0; }' >lex.yy.c
+    fi
+    ;;
+
+  help2man)
+    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+       # We have it, but it failed.
+       exit 1
+    fi
+
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+	 you modified a dependency of a manual page.  You may need the
+	 \`Help2man' package in order for those modifications to take
+	 effect.  You can get \`Help2man' from any GNU archive site."
+
+    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    if test -z "$file"; then
+	file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
+    fi
+    if [ -f "$file" ]; then
+	touch $file
+    else
+	test -z "$file" || exec >$file
+	echo ".ab help2man is required to generate this page"
+	exit 1
+    fi
+    ;;
+
+  makeinfo)
+    if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
+       # We have makeinfo, but it failed.
+       exit 1
+    fi
+
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified a \`.texi' or \`.texinfo' file, or any other file
+         indirectly affecting the aspect of the manual.  The spurious
+         call might also be the consequence of using a buggy \`make' (AIX,
+         DU, IRIX).  You might want to install the \`Texinfo' package or
+         the \`GNU make' package.  Grab either from any GNU archive site."
+    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    if test -z "$file"; then
+      file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
+    fi
+    touch $file
+    ;;
+
+  tar)
+    shift
+    if test -n "$run"; then
+      echo 1>&2 "ERROR: \`tar' requires --run"
+      exit 1
+    fi
+
+    # We have already tried tar in the generic part.
+    # Look for gnutar/gtar before invocation to avoid ugly error
+    # messages.
+    if (gnutar --version > /dev/null 2>&1); then
+       gnutar ${1+"$@"} && exit 0
+    fi
+    if (gtar --version > /dev/null 2>&1); then
+       gtar ${1+"$@"} && exit 0
+    fi
+    firstarg="$1"
+    if shift; then
+	case "$firstarg" in
+	*o*)
+	    firstarg=`echo "$firstarg" | sed s/o//`
+	    tar "$firstarg" ${1+"$@"} && exit 0
+	    ;;
+	esac
+	case "$firstarg" in
+	*h*)
+	    firstarg=`echo "$firstarg" | sed s/h//`
+	    tar "$firstarg" ${1+"$@"} && exit 0
+	    ;;
+	esac
+    fi
+
+    echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+         You may want to install GNU tar or Free paxutils, or check the
+         command line arguments."
+    exit 1
+    ;;
+
+  *)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, and you do not seem to have it handy on your
+         system.  You might have modified some files without having the
+         proper tools for further handling them.  Check the \`README' file,
+         it often tells you about the needed prerequirements for installing
+         this package.  You may also peek at any GNU archive site, in case
+         some other package would contain this missing \`$1' program."
+    exit 1
+    ;;
+esac
+
+exit 0
diff --git a/mkinstalldirs b/mkinstalldirs
new file mode 100644
index 0000000..4f58503
--- /dev/null
+++ b/mkinstalldirs
@@ -0,0 +1,40 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+# Author: Noah Friedman <friedman at prep.ai.mit.edu>
+# Created: 1993-05-16
+# Public domain
+
+# $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $
+
+errstatus=0
+
+for file
+do
+   set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+   shift
+
+   pathcomp=
+   for d
+   do
+     pathcomp="$pathcomp$d"
+     case "$pathcomp" in
+       -* ) pathcomp=./$pathcomp ;;
+     esac
+
+     if test ! -d "$pathcomp"; then
+        echo "mkdir $pathcomp"
+
+        mkdir "$pathcomp" || lasterr=$?
+
+        if test ! -d "$pathcomp"; then
+  	  errstatus=$lasterr
+        fi
+     fi
+
+     pathcomp="$pathcomp/"
+   done
+done
+
+exit $errstatus
+
+# mkinstalldirs ends here
diff --git a/src/3-element-yagi b/src/3-element-yagi
new file mode 100644
index 0000000..c59fb4d
--- /dev/null
+++ b/src/3-element-yagi
@@ -0,0 +1,15 @@
+NOTES 23
+FREQUENCY 32.000000
+MIN_FREQUENCY 1.000000
+MAX_FREQUENCY 233.000000
+STEP_FREQUENCY 1.000000
+ELEMENTS 3
+DRIVEN 1
+PARASITIC 2
+ANGULAR_STEP   12.000000
+#DATA_DRIVEN        x         y       length     diameter voltage(r) voltage(i)
+DATA_DRIVEN     0.00000    0.00000    0.00000    0.00000    0.00000    0.00000
+#DATA_PARASITIC     x         y       length     diameter
+DATA_PARASITIC
+                0.00000    0.00000    0.00000    0.00000 reflector
+                0.10000    0.00000    0.30000    0.02300 D1
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..3ef3de5
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,45 @@
+bin_PROGRAMS = yagi input output first optimise  mutual \
+selftest randtest dipole
+
+yagi_SOURCES = yagi.c fill_v_vector.c get_number_of_elements.c \
+getfiles.c nrutil.c string.c read_yagi_data.c \
+self.c mutual.c fill_z_matrix.c cis_hack.c com_hack.c lud_hack.c \
+lub_hack.c write_header_to_disk.c \
+write_coordinates.c print_z_matrix.c version.c getopt.c usage_yagi.c mpr_hack.c \
+self2.c cin.c ci.c display_antenna_currents.c com_hack.h  globals.h   nr_hack.h   nrutil.h  yagi.h
+
+input_SOURCES = input.c nrutil.c string.c write_input_data.c get_number_of_elements.c \
+version.c  usage_input.c getopt.c  yagi.h
+
+output_SOURCES = output.c nrutil.c read_header.c string.c z_input.c vswr.c \
+reflection_coefficient.c com_hack.c power_input.c gain.c write_gain.c version.c  \
+usage_output.c write_gnuplot_header.c getopt.c zbr_hack.c max_side.c  yagi.h
+
+first_SOURCES = first.c nrutil.c write_input_data.c string.c getopt.c \
+usage_first.c version.c self2.c cis_hack.c com_hack.c ci.c new_length.c yagi.h
+
+optimise_SOURCES = optimise.c string.c read_yagi_data.c  nrutil.c \
+get_number_of_elements.c version.c fill_z_matrix.c lud_hack.c lub_hack.c \
+gain.c self.c mutual.c power_input.c com_hack.c set_mean_structure.c \
+cis_hack.c z_input.c randomise.c better.c  \
+write_input_data.c reflection_coefficient.c vswr.c set_performance_structures.c \
+copy_matrix.c perform.c getopt.c show_all_optimise_parameters.c solve.c print_z_matrix.c \
+check_flags.c error_message.c fill_v_vector.c \
+max_gain.c dobetter.c gaussian.c sens.c fitness.c mpr_hack.c genetic.c \
+genetic_algorithm_lib.c random.c get_command_line_options.c \
+change_max_percentage_changes.c max_side.c \
+usage_optimise.c optimising_for.c  test_stop.c \
+print_relavent_performance_data.c subtract_structures.c end_stop.c self2.c cin.c \
+ci.c dynamic.c auto.c linear.c yagi.h
+
+randtest_SOURCES=rantest.c random.c yagi.h
+
+mutual_SOURCES=test2.c cis_hack.c nrutil.c com_hack.c yagi.h
+
+selftest_SOURCES= selftest.c self2.c nrutil.c ci.c cis_hack.c com_hack.c
+
+dipole_SOURCES= dipole.c self2.c nrutil.c ci.c cis_hack.c com_hack.c yagi.h
+
+#yagi_LDADD = @LIBOBJS@
+
+EXTRA_DIST = 3-element-yagi
diff --git a/src/Makefile.in b/src/Makefile.in
new file mode 100644
index 0000000..30196bc
--- /dev/null
+++ b/src/Makefile.in
@@ -0,0 +1,667 @@
+# Makefile.in generated by automake 1.7 from Makefile.am.
+# @configure_input@
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+ACLOCAL = @ACLOCAL@
+ALLOCA = @ALLOCA@
+AMDEP_FALSE = @AMDEP_FALSE@
+AMDEP_TRUE = @AMDEP_TRUE@
+AMTAR = @AMTAR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_STRIP = @ac_ct_STRIP@
+am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
+am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
+am__include = @am__include@
+am__quote = @am__quote@
+bindir = @bindir@
+build_alias = @build_alias@
+datadir = @datadir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+oldincludedir = @oldincludedir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+bin_PROGRAMS = yagi input output first optimise  mutual \
+selftest randtest dipole
+
+
+yagi_SOURCES = yagi.c fill_v_vector.c get_number_of_elements.c \
+getfiles.c nrutil.c string.c read_yagi_data.c \
+self.c mutual.c fill_z_matrix.c cis_hack.c com_hack.c lud_hack.c \
+lub_hack.c write_header_to_disk.c \
+write_coordinates.c print_z_matrix.c version.c getopt.c usage_yagi.c mpr_hack.c \
+self2.c cin.c ci.c display_antenna_currents.c com_hack.h  globals.h   nr_hack.h   nrutil.h  yagi.h
+
+
+input_SOURCES = input.c nrutil.c string.c write_input_data.c get_number_of_elements.c \
+version.c  usage_input.c getopt.c  yagi.h
+
+
+output_SOURCES = output.c nrutil.c read_header.c string.c z_input.c vswr.c \
+reflection_coefficient.c com_hack.c power_input.c gain.c write_gain.c version.c  \
+usage_output.c write_gnuplot_header.c getopt.c zbr_hack.c max_side.c  yagi.h
+
+
+first_SOURCES = first.c nrutil.c write_input_data.c string.c getopt.c \
+usage_first.c version.c self2.c cis_hack.c com_hack.c ci.c new_length.c yagi.h
+
+
+optimise_SOURCES = optimise.c string.c read_yagi_data.c  nrutil.c \
+get_number_of_elements.c version.c fill_z_matrix.c lud_hack.c lub_hack.c \
+gain.c self.c mutual.c power_input.c com_hack.c set_mean_structure.c \
+cis_hack.c z_input.c randomise.c better.c  \
+write_input_data.c reflection_coefficient.c vswr.c set_performance_structures.c \
+copy_matrix.c perform.c getopt.c show_all_optimise_parameters.c solve.c print_z_matrix.c \
+check_flags.c error_message.c fill_v_vector.c \
+max_gain.c dobetter.c gaussian.c sens.c fitness.c mpr_hack.c genetic.c \
+genetic_algorithm_lib.c random.c get_command_line_options.c \
+change_max_percentage_changes.c max_side.c \
+usage_optimise.c optimising_for.c  test_stop.c \
+print_relavent_performance_data.c subtract_structures.c end_stop.c self2.c cin.c \
+ci.c dynamic.c auto.c linear.c yagi.h
+
+
+randtest_SOURCES = rantest.c random.c yagi.h
+
+mutual_SOURCES = test2.c cis_hack.c nrutil.c com_hack.c yagi.h
+
+selftest_SOURCES = selftest.c self2.c nrutil.c ci.c cis_hack.c com_hack.c
+
+dipole_SOURCES = dipole.c self2.c nrutil.c ci.c cis_hack.c com_hack.c yagi.h
+
+
+#yagi_LDADD = @LIBOBJS@
+EXTRA_DIST = 3-element-yagi
+subdir = src
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_CLEAN_FILES =
+bin_PROGRAMS = yagi$(EXEEXT) input$(EXEEXT) output$(EXEEXT) \
+	first$(EXEEXT) optimise$(EXEEXT) mutual$(EXEEXT) \
+	selftest$(EXEEXT) randtest$(EXEEXT) dipole$(EXEEXT)
+PROGRAMS = $(bin_PROGRAMS)
+
+am_dipole_OBJECTS = dipole.$(OBJEXT) self2.$(OBJEXT) nrutil.$(OBJEXT) \
+	ci.$(OBJEXT) cis_hack.$(OBJEXT) com_hack.$(OBJEXT)
+dipole_OBJECTS = $(am_dipole_OBJECTS)
+dipole_LDADD = $(LDADD)
+dipole_DEPENDENCIES =
+dipole_LDFLAGS =
+am_first_OBJECTS = first.$(OBJEXT) nrutil.$(OBJEXT) \
+	write_input_data.$(OBJEXT) string.$(OBJEXT) getopt.$(OBJEXT) \
+	usage_first.$(OBJEXT) version.$(OBJEXT) self2.$(OBJEXT) \
+	cis_hack.$(OBJEXT) com_hack.$(OBJEXT) ci.$(OBJEXT) \
+	new_length.$(OBJEXT)
+first_OBJECTS = $(am_first_OBJECTS)
+first_LDADD = $(LDADD)
+first_DEPENDENCIES =
+first_LDFLAGS =
+am_input_OBJECTS = input.$(OBJEXT) nrutil.$(OBJEXT) string.$(OBJEXT) \
+	write_input_data.$(OBJEXT) get_number_of_elements.$(OBJEXT) \
+	version.$(OBJEXT) usage_input.$(OBJEXT) getopt.$(OBJEXT)
+input_OBJECTS = $(am_input_OBJECTS)
+input_LDADD = $(LDADD)
+input_DEPENDENCIES =
+input_LDFLAGS =
+am_mutual_OBJECTS = test2.$(OBJEXT) cis_hack.$(OBJEXT) nrutil.$(OBJEXT) \
+	com_hack.$(OBJEXT)
+mutual_OBJECTS = $(am_mutual_OBJECTS)
+mutual_LDADD = $(LDADD)
+mutual_DEPENDENCIES =
+mutual_LDFLAGS =
+am_optimise_OBJECTS = optimise.$(OBJEXT) string.$(OBJEXT) \
+	read_yagi_data.$(OBJEXT) nrutil.$(OBJEXT) \
+	get_number_of_elements.$(OBJEXT) version.$(OBJEXT) \
+	fill_z_matrix.$(OBJEXT) lud_hack.$(OBJEXT) lub_hack.$(OBJEXT) \
+	gain.$(OBJEXT) self.$(OBJEXT) mutual.$(OBJEXT) \
+	power_input.$(OBJEXT) com_hack.$(OBJEXT) \
+	set_mean_structure.$(OBJEXT) cis_hack.$(OBJEXT) \
+	z_input.$(OBJEXT) randomise.$(OBJEXT) better.$(OBJEXT) \
+	write_input_data.$(OBJEXT) reflection_coefficient.$(OBJEXT) \
+	vswr.$(OBJEXT) set_performance_structures.$(OBJEXT) \
+	copy_matrix.$(OBJEXT) perform.$(OBJEXT) getopt.$(OBJEXT) \
+	show_all_optimise_parameters.$(OBJEXT) solve.$(OBJEXT) \
+	print_z_matrix.$(OBJEXT) check_flags.$(OBJEXT) \
+	error_message.$(OBJEXT) fill_v_vector.$(OBJEXT) \
+	max_gain.$(OBJEXT) dobetter.$(OBJEXT) gaussian.$(OBJEXT) \
+	sens.$(OBJEXT) fitness.$(OBJEXT) mpr_hack.$(OBJEXT) \
+	genetic.$(OBJEXT) genetic_algorithm_lib.$(OBJEXT) \
+	random.$(OBJEXT) get_command_line_options.$(OBJEXT) \
+	change_max_percentage_changes.$(OBJEXT) max_side.$(OBJEXT) \
+	usage_optimise.$(OBJEXT) optimising_for.$(OBJEXT) \
+	test_stop.$(OBJEXT) print_relavent_performance_data.$(OBJEXT) \
+	subtract_structures.$(OBJEXT) end_stop.$(OBJEXT) \
+	self2.$(OBJEXT) cin.$(OBJEXT) ci.$(OBJEXT) dynamic.$(OBJEXT) \
+	auto.$(OBJEXT) linear.$(OBJEXT)
+optimise_OBJECTS = $(am_optimise_OBJECTS)
+optimise_LDADD = $(LDADD)
+optimise_DEPENDENCIES =
+optimise_LDFLAGS =
+am_output_OBJECTS = output.$(OBJEXT) nrutil.$(OBJEXT) \
+	read_header.$(OBJEXT) string.$(OBJEXT) z_input.$(OBJEXT) \
+	vswr.$(OBJEXT) reflection_coefficient.$(OBJEXT) \
+	com_hack.$(OBJEXT) power_input.$(OBJEXT) gain.$(OBJEXT) \
+	write_gain.$(OBJEXT) version.$(OBJEXT) usage_output.$(OBJEXT) \
+	write_gnuplot_header.$(OBJEXT) getopt.$(OBJEXT) \
+	zbr_hack.$(OBJEXT) max_side.$(OBJEXT)
+output_OBJECTS = $(am_output_OBJECTS)
+output_LDADD = $(LDADD)
+output_DEPENDENCIES =
+output_LDFLAGS =
+am_randtest_OBJECTS = rantest.$(OBJEXT) random.$(OBJEXT)
+randtest_OBJECTS = $(am_randtest_OBJECTS)
+randtest_LDADD = $(LDADD)
+randtest_DEPENDENCIES =
+randtest_LDFLAGS =
+am_selftest_OBJECTS = selftest.$(OBJEXT) self2.$(OBJEXT) \
+	nrutil.$(OBJEXT) ci.$(OBJEXT) cis_hack.$(OBJEXT) \
+	com_hack.$(OBJEXT)
+selftest_OBJECTS = $(am_selftest_OBJECTS)
+selftest_LDADD = $(LDADD)
+selftest_DEPENDENCIES =
+selftest_LDFLAGS =
+am_yagi_OBJECTS = yagi.$(OBJEXT) fill_v_vector.$(OBJEXT) \
+	get_number_of_elements.$(OBJEXT) getfiles.$(OBJEXT) \
+	nrutil.$(OBJEXT) string.$(OBJEXT) read_yagi_data.$(OBJEXT) \
+	self.$(OBJEXT) mutual.$(OBJEXT) fill_z_matrix.$(OBJEXT) \
+	cis_hack.$(OBJEXT) com_hack.$(OBJEXT) lud_hack.$(OBJEXT) \
+	lub_hack.$(OBJEXT) write_header_to_disk.$(OBJEXT) \
+	write_coordinates.$(OBJEXT) print_z_matrix.$(OBJEXT) \
+	version.$(OBJEXT) getopt.$(OBJEXT) usage_yagi.$(OBJEXT) \
+	mpr_hack.$(OBJEXT) self2.$(OBJEXT) cin.$(OBJEXT) ci.$(OBJEXT) \
+	display_antenna_currents.$(OBJEXT)
+yagi_OBJECTS = $(am_yagi_OBJECTS)
+yagi_LDADD = $(LDADD)
+yagi_DEPENDENCIES =
+yagi_LDFLAGS =
+
+DEFAULT_INCLUDES =  -I. -I$(srcdir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+ at AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/auto.Po ./$(DEPDIR)/better.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/change_max_percentage_changes.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/check_flags.Po ./$(DEPDIR)/ci.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/cin.Po ./$(DEPDIR)/cis_hack.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/com_hack.Po ./$(DEPDIR)/copy_matrix.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/dipole.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/display_antenna_currents.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/dobetter.Po ./$(DEPDIR)/dynamic.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/end_stop.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/error_message.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/fill_v_vector.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/fill_z_matrix.Po ./$(DEPDIR)/first.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/fitness.Po ./$(DEPDIR)/gain.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/gaussian.Po ./$(DEPDIR)/genetic.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/genetic_algorithm_lib.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/get_command_line_options.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/get_number_of_elements.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/getfiles.Po ./$(DEPDIR)/getopt.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/input.Po ./$(DEPDIR)/linear.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/lub_hack.Po ./$(DEPDIR)/lud_hack.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/max_gain.Po ./$(DEPDIR)/max_side.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/mpr_hack.Po ./$(DEPDIR)/mutual.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/new_length.Po ./$(DEPDIR)/nrutil.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/optimise.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/optimising_for.Po ./$(DEPDIR)/output.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/perform.Po ./$(DEPDIR)/power_input.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/print_relavent_performance_data.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/print_z_matrix.Po ./$(DEPDIR)/random.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/randomise.Po ./$(DEPDIR)/rantest.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/read_header.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/read_yagi_data.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/reflection_coefficient.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/self.Po ./$(DEPDIR)/self2.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/selftest.Po ./$(DEPDIR)/sens.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/set_mean_structure.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/set_performance_structures.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/show_all_optimise_parameters.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/solve.Po ./$(DEPDIR)/string.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/subtract_structures.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/test2.Po ./$(DEPDIR)/test_stop.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/usage_first.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/usage_input.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/usage_optimise.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/usage_output.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/usage_yagi.Po ./$(DEPDIR)/version.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/vswr.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/write_coordinates.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/write_gain.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/write_gnuplot_header.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/write_header_to_disk.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/write_input_data.Po ./$(DEPDIR)/yagi.Po \
+ at AMDEP_TRUE@	./$(DEPDIR)/z_input.Po ./$(DEPDIR)/zbr_hack.Po
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+DIST_SOURCES = $(dipole_SOURCES) $(first_SOURCES) $(input_SOURCES) \
+	$(mutual_SOURCES) $(optimise_SOURCES) $(output_SOURCES) \
+	$(randtest_SOURCES) $(selftest_SOURCES) $(yagi_SOURCES)
+DIST_COMMON = Makefile.am Makefile.in install-sh missing mkinstalldirs
+SOURCES = $(dipole_SOURCES) $(first_SOURCES) $(input_SOURCES) $(mutual_SOURCES) $(optimise_SOURCES) $(output_SOURCES) $(randtest_SOURCES) $(selftest_SOURCES) $(yagi_SOURCES)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.ac $(ACLOCAL_M4)
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  src/Makefile
+Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+install-binPROGRAMS: $(bin_PROGRAMS)
+	@$(NORMAL_INSTALL)
+	$(mkinstalldirs) $(DESTDIR)$(bindir)
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  if test -f $$p \
+	  ; then \
+	    f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+	   echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \
+	   $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f || exit 1; \
+	  else :; fi; \
+	done
+
+uninstall-binPROGRAMS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+	  echo " rm -f $(DESTDIR)$(bindir)/$$f"; \
+	  rm -f $(DESTDIR)$(bindir)/$$f; \
+	done
+
+clean-binPROGRAMS:
+	-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+dipole$(EXEEXT): $(dipole_OBJECTS) $(dipole_DEPENDENCIES) 
+	@rm -f dipole$(EXEEXT)
+	$(LINK) $(dipole_LDFLAGS) $(dipole_OBJECTS) $(dipole_LDADD) $(LIBS)
+first$(EXEEXT): $(first_OBJECTS) $(first_DEPENDENCIES) 
+	@rm -f first$(EXEEXT)
+	$(LINK) $(first_LDFLAGS) $(first_OBJECTS) $(first_LDADD) $(LIBS)
+input$(EXEEXT): $(input_OBJECTS) $(input_DEPENDENCIES) 
+	@rm -f input$(EXEEXT)
+	$(LINK) $(input_LDFLAGS) $(input_OBJECTS) $(input_LDADD) $(LIBS)
+mutual$(EXEEXT): $(mutual_OBJECTS) $(mutual_DEPENDENCIES) 
+	@rm -f mutual$(EXEEXT)
+	$(LINK) $(mutual_LDFLAGS) $(mutual_OBJECTS) $(mutual_LDADD) $(LIBS)
+optimise$(EXEEXT): $(optimise_OBJECTS) $(optimise_DEPENDENCIES) 
+	@rm -f optimise$(EXEEXT)
+	$(LINK) $(optimise_LDFLAGS) $(optimise_OBJECTS) $(optimise_LDADD) $(LIBS)
+output$(EXEEXT): $(output_OBJECTS) $(output_DEPENDENCIES) 
+	@rm -f output$(EXEEXT)
+	$(LINK) $(output_LDFLAGS) $(output_OBJECTS) $(output_LDADD) $(LIBS)
+randtest$(EXEEXT): $(randtest_OBJECTS) $(randtest_DEPENDENCIES) 
+	@rm -f randtest$(EXEEXT)
+	$(LINK) $(randtest_LDFLAGS) $(randtest_OBJECTS) $(randtest_LDADD) $(LIBS)
+selftest$(EXEEXT): $(selftest_OBJECTS) $(selftest_DEPENDENCIES) 
+	@rm -f selftest$(EXEEXT)
+	$(LINK) $(selftest_LDFLAGS) $(selftest_OBJECTS) $(selftest_LDADD) $(LIBS)
+yagi$(EXEEXT): $(yagi_OBJECTS) $(yagi_DEPENDENCIES) 
+	@rm -f yagi$(EXEEXT)
+	$(LINK) $(yagi_LDFLAGS) $(yagi_OBJECTS) $(yagi_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT) core *.core
+
+distclean-compile:
+	-rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/auto.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/better.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/change_max_percentage_changes.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/check_flags.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ci.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cin.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/cis_hack.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/com_hack.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/copy_matrix.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dipole.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/display_antenna_currents.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dobetter.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/dynamic.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/end_stop.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/error_message.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fill_v_vector.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fill_z_matrix.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/first.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/fitness.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gain.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/gaussian.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/genetic.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/genetic_algorithm_lib.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_command_line_options.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/get_number_of_elements.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/getfiles.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/getopt.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/input.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/linear.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lub_hack.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/lud_hack.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/max_gain.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/max_side.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mpr_hack.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/mutual.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/new_length.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/nrutil.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/optimise.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/optimising_for.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/output.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/perform.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/power_input.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/print_relavent_performance_data.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/print_z_matrix.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/random.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/randomise.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/rantest.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/read_header.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/read_yagi_data.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/reflection_coefficient.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/self.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/self2.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/selftest.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/sens.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/set_mean_structure.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/set_performance_structures.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/show_all_optimise_parameters.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/solve.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/string.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/subtract_structures.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test2.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/test_stop.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/usage_first.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/usage_input.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/usage_optimise.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/usage_output.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/usage_yagi.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/version.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/vswr.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/write_coordinates.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/write_gain.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/write_gnuplot_header.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/write_header_to_disk.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/write_input_data.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/yagi.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/z_input.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/zbr_hack.Po at am__quote@
+
+distclean-depend:
+	-rm -rf ./$(DEPDIR)
+
+.c.o:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
+ at am__fastdepCC_TRUE@	  -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<; \
+ at am__fastdepCC_TRUE@	then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
+ at am__fastdepCC_TRUE@	else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
+ at am__fastdepCC_TRUE@	fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
+
+.c.obj:
+ at am__fastdepCC_TRUE@	if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" \
+ at am__fastdepCC_TRUE@	  -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'`; \
+ at am__fastdepCC_TRUE@	then mv "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; \
+ at am__fastdepCC_TRUE@	else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; \
+ at am__fastdepCC_TRUE@	fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(COMPILE) -c `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(srcdir)/$<'`
+uninstall-info-am:
+
+ETAGS = etags
+ETAGSFLAGS =
+
+CTAGS = ctags
+CTAGSFLAGS =
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(ETAGS_ARGS)$$tags$$unique" \
+	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	     $$tags $$unique
+
+ctags: CTAGS
+CTAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(CTAGS_ARGS)$$tags$$unique" \
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+	@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+	list='$(DISTFILES)'; for file in $$list; do \
+	  case $$file in \
+	    $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+	  esac; \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkinstalldirs) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+
+installdirs:
+	$(mkinstalldirs) $(DESTDIR)$(bindir)
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+	-rm -f Makefile $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-compile distclean-depend \
+	distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+	clean-generic ctags distclean distclean-compile \
+	distclean-depend distclean-generic distclean-tags distdir dvi \
+	dvi-am info info-am install install-am install-binPROGRAMS \
+	install-data install-data-am install-exec install-exec-am \
+	install-info install-info-am install-man install-strip \
+	installcheck installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+	uninstall-am uninstall-binPROGRAMS uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/src/auto.c b/src/auto.c
new file mode 100644
index 0000000..31e3c5d
--- /dev/null
+++ b/src/auto.c
@@ -0,0 +1,74 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <math.h>
+#include <errno.h>
+
+#include "yagi.h"
+
+extern int errno;
+/* The function automatic_enhancement optimises only for the gain, by 
+adjusting the length of the reflector (A=-1), the driven(A=0) the 
+first director (A=1), second director (A=2 ) etc */
+
+void automatic_enhancement(struct flags flag, double frequency, double **driven_data, double **parasitic_data, int driven, int parasites, struct FCOMPLEX *voltage, struct FCOMPLEX *current, struct FCOMPLEX *input_impedance, double *v, double **z,double **A, double *b, int *indx, struct element_data *coordinates)
+{
+	int elements,element;
+	double pin,E_fwd=0,H_fwd,max_gain=0.0,old_max=0.0;
+	elements=driven+parasites;
+	element=flag.Aflg-1000;
+	if(element > parasites-1)
+	{
+		fprintf(stderr,"You have set the option '-A%d', which will maximise gain using director number %d, but there are only %d directors\n", element,element, parasites-1);
+		exit(1);
+	}
+	if(element>0) /* optimise gain by adjusting a director */
+	{
+			parasitic_data[element+1][LENGTH]*=0.90;
+			max_gain=0.0;
+			old_max=0.0;
+			do{
+				parasitic_data[element+1][LENGTH]*=1.001;
+				solve_equations(frequency, driven, parasites, driven_data, parasitic_data, v, z, &pin, voltage, current, input_impedance, coordinates, A, b, indx);
+				gain(90.0,0.0,pin,1.0,coordinates,current,elements,&E_fwd,&H_fwd,frequency,frequency);
+				if(E_fwd>max_gain)
+				{
+					old_max=max_gain;
+					max_gain=E_fwd;
+				}
+			} while(E_fwd>old_max);
+	}
+	else if(element==-1) /* Optimise gain by adjeucting reflector */
+	{
+		parasitic_data[1][LENGTH]*=0.90;
+		max_gain=0.0;
+		old_max=0.0;
+		do{
+			parasitic_data[1][LENGTH]*=1.001;
+			solve_equations(frequency, driven, parasites, driven_data, parasitic_data, v, z, &pin, voltage, current, input_impedance, coordinates, A, b, indx);
+			gain(90.0,0.0,pin,1.0,coordinates,current,elements,&E_fwd,&H_fwd,frequency,frequency);
+			if(E_fwd>max_gain)
+			{
+				old_max=max_gain;
+				max_gain=E_fwd;
+			}
+		} while(E_fwd>old_max);
+	} 
+	else if(element==0) /* Optimise gain by adjeucting driven-element */
+	{
+		driven_data[1][LENGTH]*=0.90;
+		max_gain=0.0;
+		old_max=0.0;
+		do{
+			driven_data[1][LENGTH]*=1.001;
+			solve_equations(frequency, driven, parasites, driven_data, parasitic_data, v, z, &pin, voltage, current, input_impedance, coordinates, A, b, indx);
+			gain(90.0,0.0,pin,1.0,coordinates,current,elements,&E_fwd,&H_fwd,frequency,frequency);
+			if(E_fwd>max_gain)
+			{
+				old_max=max_gain;
+				max_gain=E_fwd;
+			}
+		} while(E_fwd>old_max);
+	} 
+}
diff --git a/src/better.c b/src/better.c
new file mode 100644
index 0000000..db1fbd9
--- /dev/null
+++ b/src/better.c
@@ -0,0 +1,94 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <math.h>
+#include <errno.h>
+#include "yagi.h"
+/* better.c This function compares new and old performance of a yagi to see if
+its better. */ 
+
+extern double vswr, Zo;
+extern struct performance_data max;
+extern int errno;
+int is_it_better(int criteria,struct performance_data n, struct performance_data o) 
+{
+	double resistance_error;
+	struct FCOMPLEX zi_new, zi_old;
+
+	resistance_error=fabs(n.r - Zo) - fabs( o.r - Zo );
+	zi_new.r=n.r;
+	zi_old.r=o.r;
+	zi_new.i=n.x;
+	zi_old.i=o.x;
+	/* printf("o=%.3lfdBi %.3f dB  %.4f:1\n", o.gain, o.fb, o.swr);
+	printf("n=%.3lfdBi %.3f dB  %.4f:1\n\n", n.gain, n.fb, n.swr); */
+	/* If the user add REASONABLE to the 'better' argument, the program
+	will make some intelligent guesses about whats a reasonale antenna. This
+	could for example avoid ignoring an antenna with 20dB gain but 1.02:1
+	vswr, in favour of 15dB gain but 1.01 vswr. Usually we would consider
+	(all other things equal) the former antenna better. Hence we wont 
+	bother optimising beyond these */
+
+	if( (criteria & REASONABLE) == REASONABLE)
+	{
+		if( (n.fb > max.fb) && (n.fb < o.fb))
+			n.fb=o.fb; 
+
+		if( (fabs(n.r-Zo) < max.r) && 
+		( fabs(n.r-Zo) > fabs(o.r-Zo) ) )
+		{
+			n.r=o.r;
+		}
+
+		if( (n.swr < max.swr) && (n.swr > o.swr) )
+			n.swr=o.swr;
+		
+		if( (fabs(n.x) < max.x) &&
+		fabs(n.x) > fabs(o.x)  )
+			n.x=o.x;
+
+		if( (n.sidelobe > max.sidelobe) && (n.sidelobe < o.sidelobe) )
+			n.sidelobe=o.sidelobe;
+	}
+	if( (criteria & GAIN) == GAIN)
+	{
+		if( n.gain < o.gain)
+			return(FALSE);
+	}
+	if( (criteria & FB) == FB)
+	{
+		if( n.fb < o.fb)
+			return(FALSE);
+	}
+	if( (criteria & RESISTANCE) == RESISTANCE)
+	{
+		resistance_error=fabs(n.r-Zo)-fabs(o.r-Zo);
+		if(resistance_error > 0.0)
+			return(FALSE);
+	}
+	if( (criteria & REACTANCE) == REACTANCE)
+	{
+		if(fabs(n.x) > fabs(o.x))
+			return(FALSE);
+	}
+	if( (criteria & VSWR) == VSWR)
+	{
+		if( n.swr > o.swr)
+			return(FALSE);
+	}
+	if((criteria & SIDE_LOBE_LEVEL) == SIDE_LOBE_LEVEL)
+	{
+		if(n.sidelobe < o.sidelobe)
+			return(FALSE);
+	}
+#ifdef DEBUG
+	if(errno)
+	{
+	fprintf(stderr,"Errno =%d in better.c\n", errno);
+	exit(1);
+	}
+#endif
+	return(TRUE);
+}
+
diff --git a/src/change_max_percentage_changes.c b/src/change_max_percentage_changes.c
new file mode 100644
index 0000000..05af545
--- /dev/null
+++ b/src/change_max_percentage_changes.c
@@ -0,0 +1,25 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <math.h>
+#include <stdio.h>
+#include "yagi.h"
+
+double change_max_percentage_changes(int i, int iterations, double original_percent)
+{
+	double pcent=0.0;
+	if(original_percent > 0.0)
+		{
+			if(i<iterations/4)
+				pcent=original_percent;
+			else if(i>=iterations/4 && i < iterations/2)
+				pcent=original_percent/10.0;
+			else if (i >=iterations/2 && i < 3*iterations/4)
+				pcent=original_percent/100.0;
+			else if(i >=3*iterations/4)
+				pcent=original_percent/1000.0;
+		}
+		else if (original_percent < 0.0  )
+			pcent =-original_percent;
+		return(pcent);
+}
diff --git a/src/check_flags.c b/src/check_flags.c
new file mode 100644
index 0000000..0e5a475
--- /dev/null
+++ b/src/check_flags.c
@@ -0,0 +1,86 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+/* file ck_flags.c */
+#include <errno.h>
+#include <stdio.h>
+#include "yagi.h"
+
+/* This function checks that all the options are sensible */
+
+extern int errno;
+
+void check_flags(struct flags flag, int argc, int optind, char *exefilename)
+{
+	if(flag.errflg==1)
+		usage_optimise(exefilename);		
+	if(flag.hflg==1) /* help flag */
+		usage_optimise(exefilename);		
+	if(flag.dflg==1)
+		show_all_optimise_parameters(exefilename,flag);
+
+	if((flag.gflg==1) && (flag.Wflg==1))
+	{
+		error_message("\nThe genetic algorithm invoked with the '-g' option must, due to the very nature of genetic algorithms, use a weighted combination of parameters. You need not (nor are you allowed too) specify the '-W' and '-g' options together.\n");
+		exit(1);
+	}
+	if(flag.gflg && flag.rflg)
+	{
+		error_message("\nYou can not specify the genetic algorithm flag '-g' and also specify the resistance flag '-r' at the same time.\n"); 
+		exit(1);
+	}
+	if(flag.gflg && flag.sflg)
+	{
+		error_message("\nYou can not specify the genetic algorithm flag '-g' and also specify the swr flag '-s' at the same time. To alter the genetic algorithms behaviour with reguard to swr, change the swr weight with the '-S' flag.\n"); 
+		exit(1);
+	}
+	if(flag.gflg && flag.lflg)
+	{
+		error_message("\nYou can not specify the genetic algorithm flag '-g' and also specify the flag '-l' at the same time.\n"); 
+		exit(1);
+	}
+	if( (flag.tflg && !flag.Tflg) || (flag.Tflg && !flag.tflg))
+	{
+		error_message("\nThe options '-t' and '-T' must both be used together. They can not be used with any other options\n");
+		exit(1);
+	}
+	if( flag.tflg &&( flag.bflg || flag.cflg || flag.fflg ||
+		 flag.gflg || flag.hflg || flag.oflg || flag.pflg || flag.lflg ||
+		 flag.rflg || flag.sflg || flag.xflg || flag.Fflg ||
+		 flag.Gflg || flag.Rflg || flag.Cflg || flag.Sflg || flag.Wflg   
+		 ) )
+	{
+		error_message("The flags '-t' and '-T' can not be used with one of the other options specified. The only option allowed with them is '-Z' to fix the charaterisitc impedance, '-d'  or '-v'\n");
+		exit(1);
+	}
+	if(flag.cflg && !(flag.gflg || flag.Wflg) )
+	{
+		error_message("The flag '-c' can only be used with the '-W' or '-g' flags\n");
+		exit(1);
+	}
+	if((flag.Fflg || flag.Gflg || flag.Rflg || flag.Pflg || flag.Sflg || flag.Xflg) && !(flag.gflg || flag.Wflg))
+	{
+		error_message("The weight flags (F, G, R, P, S and X) must be used either with the genetic algorithm flag (-g) or the the weithted performance flag (-W)\n");
+		exit(1);
+	}
+	if(flag.gflg && flag.wflg)
+	{
+		error_message("Sorry, the genetic algorithm can't optimise over a wide band yet, so you cant use the -w option\n");
+		exit(1);
+	}
+	if(flag.pflg && ! flag.gflg)
+	{
+		error_message("The '-p' population size option is only used with the genetic algorithm '-g' option\n");
+		exit(1);
+	}
+if( (argc - optind) != 3 &&  (argc-optind) !=2)
+		usage_optimise(exefilename);
+
+#ifdef DEBUG
+	if(errno)
+	{
+		fprintf(stderr,"Errno =%d in ck_flags.c\n", errno);
+		exit(1);
+	}
+#endif
+}
diff --git a/src/ci.c b/src/ci.c
new file mode 100644
index 0000000..021c81c
--- /dev/null
+++ b/src/ci.c
@@ -0,0 +1,13 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <math.h>
+#include "yagi.h"
+
+double ci(double x)			/* cosine integral */
+{
+	double null, result;
+
+	cisi(x, &result, &null);
+	return(result);
+}
diff --git a/src/cin.c b/src/cin.c
new file mode 100644
index 0000000..cf18dc4
--- /dev/null
+++ b/src/cin.c
@@ -0,0 +1,13 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <math.h>
+#include "yagi.h"
+
+double Cin(double x)
+{
+	double cix,temp,ans;
+	cisi(x,&cix,&temp);
+	ans=EULER+log(x)-cix;
+	return(ans);
+}
diff --git a/src/cis_hack.c b/src/cis_hack.c
new file mode 100644
index 0000000..45b0953
--- /dev/null
+++ b/src/cis_hack.c
@@ -0,0 +1,84 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <math.h>
+
+#include "yagi.h"
+
+#define EPS 6.0e-8
+#define EULER 0.57721566
+#define MAXIT 100
+#define PIBY2 1.5707963
+#define FPMIN 1.0e-30
+#define TMIN 2.0
+#define TRUE 1
+#define ONE Complex(1.0,0.0)
+
+void cisi(double x, double *ci, double *si)
+{
+	int i,k,odd;
+	double a,err,fact,sign,sum,sumc,sums,t,term;
+	fcomplex h,b,c,d,del;
+
+	t=fabs(x);
+	if (t == 0.0) {
+		*si=0.0;
+		*ci = -1.0/FPMIN;
+		return;
+	}
+	if (t > TMIN) {
+		b=Complex(1.0,t);
+		c=Complex(1.0/FPMIN,0.0);
+		d=h=Cdiv(ONE,b);
+		for (i=2;i<=MAXIT;i++) {
+			a = -(i-1)*(i-1);
+			b=Cadd(b,Complex(2.0,0.0));
+			d=Cdiv(ONE,Cadd(RCmul(a,d),b));
+			c=Cadd(b,Cdiv(Complex(a,0.0),c));
+			del=Cmul(c,d);
+			h=Cmul(h,del);
+			if (fabs(del.r-1.0)+fabs(del.i) < EPS) break;
+		}
+		if (i > MAXIT) nrerror("cf failed in cisi_hack.c");
+		h=Cmul(Complex(cos(t),-sin(t)),h);
+		*ci = -h.r;
+		*si=PIBY2+h.i;
+	} else {
+		if (t < sqrt(FPMIN)) {
+			sumc=0.0;
+			sums=t;
+		} else {
+			sum=sums=sumc=0.0;
+			sign=fact=1.0;
+			odd=TRUE;
+			for (k=1;k<=MAXIT;k++) {
+				fact *= t/k;
+				term=fact/k;
+				sum += sign*term;
+				err=term/fabs(sum);
+				if (odd) {
+					sign = -sign;
+					sums=sum;
+					sum=sumc;
+				} else {
+					sumc=sum;
+					sum=sums;
+				}
+				if (err < EPS) break;
+				odd=!odd;
+			}
+			if (k > MAXIT) nrerror("maxits exceeded in cisi");
+		}
+		*si=sums;
+		*ci=sumc+log(t)+EULER;
+	}
+	if (x < 0.0) *si = -(*si);
+}
+#undef EPS
+#undef EULER
+#undef MAXIT
+#undef PIBY2
+#undef FPMIN
+#undef TMIN
+#undef TRUE
+#undef ONE
diff --git a/src/com_hack.c b/src/com_hack.c
new file mode 100644
index 0000000..9fefa46
--- /dev/null
+++ b/src/com_hack.c
@@ -0,0 +1,254 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <math.h>
+#include "yagi.h"
+
+
+#if defined(__STDC__) || defined(ANSI) || defined(NRANSI) /* ANSI */
+
+fcomplex Cadd(fcomplex a, fcomplex b)
+{
+	fcomplex c;
+	c.r=a.r+b.r;
+	c.i=a.i+b.i;
+	return c;
+}
+
+fcomplex Csub(fcomplex a, fcomplex b)
+{
+	fcomplex c;
+	c.r=a.r-b.r;
+	c.i=a.i-b.i;
+	return c;
+}
+
+
+fcomplex Cmul(fcomplex a, fcomplex b)
+{
+	fcomplex c;
+	c.r=a.r*b.r-a.i*b.i;
+	c.i=a.i*b.r+a.r*b.i;
+	return c;
+}
+
+fcomplex Complex(double re, double im)
+{
+	fcomplex c;
+	c.r=re;
+	c.i=im;
+	return c;
+}
+
+fcomplex Conjg(fcomplex z)
+{
+	fcomplex c;
+	c.r=z.r;
+	c.i = -z.i;
+	return c;
+}
+
+fcomplex Cdiv(fcomplex a, fcomplex b)
+{
+	fcomplex c;
+	double r,den;
+	if (fabs(b.r) >= fabs(b.i)) {
+		r=b.i/b.r;
+		den=b.r+r*b.i;
+		c.r=(a.r+r*a.i)/den;
+		c.i=(a.i-r*a.r)/den;
+	} else {
+		r=b.r/b.i;
+		den=b.i+r*b.r;
+		c.r=(a.r*r+a.i)/den;
+		c.i=(a.i*r-a.r)/den;
+	}
+	return c;
+}
+
+double Cabs(fcomplex z)
+{
+	double x,y,ans,temp;
+	x=fabs(z.r);
+	y=fabs(z.i);
+	if (x == 0.0)
+		ans=y;
+	else if (y == 0.0)
+		ans=x;
+	else if (x > y) {
+		temp=y/x;
+		ans=x*sqrt(1.0+temp*temp);
+	} else {
+		temp=x/y;
+		ans=y*sqrt(1.0+temp*temp);
+	}
+	return ans;
+}
+
+fcomplex Csqrt(fcomplex z)
+{
+	fcomplex c;
+	double x,y,w,r;
+	if ((z.r == 0.0) && (z.i == 0.0)) {
+		c.r=0.0;
+		c.i=0.0;
+		return c;
+	} else {
+		x=fabs(z.r);
+		y=fabs(z.i);
+		if (x >= y) {
+			r=y/x;
+			w=sqrt(x)*sqrt(0.5*(1.0+sqrt(1.0+r*r)));
+		} else {
+			r=x/y;
+			w=sqrt(y)*sqrt(0.5*(r+sqrt(1.0+r*r)));
+		}
+		if (z.r >= 0.0) {
+			c.r=w;
+			c.i=z.i/(2.0*w);
+		} else {
+			c.i=(z.i >= 0) ? w : -w;
+			c.r=z.i/(2.0*c.i);
+		}
+		return c;
+	}
+}
+
+fcomplex RCmul(double x, fcomplex a)
+{
+	fcomplex c;
+	c.r=x*a.r;
+	c.i=x*a.i;
+	return c;
+}
+
+#else /* ANSI */
+/* traditional - K&R */
+
+fcomplex Cadd(a,b)
+fcomplex a,b;
+{
+	fcomplex c;
+	c.r=a.r+b.r;
+	c.i=a.i+b.i;
+	return c;
+}
+
+fcomplex Csub(a,b)
+fcomplex a,b;
+{
+	fcomplex c;
+	c.r=a.r-b.r;
+	c.i=a.i-b.i;
+	return c;
+}
+
+
+fcomplex Cmul(a,b)
+fcomplex a,b;
+{
+	fcomplex c;
+	c.r=a.r*b.r-a.i*b.i;
+	c.i=a.i*b.r+a.r*b.i;
+	return c;
+}
+
+fcomplex Complex(re,im)
+double im,re;
+{
+	fcomplex c;
+	c.r=re;
+	c.i=im;
+	return c;
+}
+
+fcomplex Conjg(z)
+fcomplex z;
+{
+	fcomplex c;
+	c.r=z.r;
+	c.i = -z.i;
+	return c;
+}
+
+fcomplex Cdiv(a,b)
+fcomplex a,b;
+{
+	fcomplex c;
+	double r,den;
+	if (fabs(b.r) >= fabs(b.i)) {
+		r=b.i/b.r;
+		den=b.r+r*b.i;
+		c.r=(a.r+r*a.i)/den;
+		c.i=(a.i-r*a.r)/den;
+	} else {
+		r=b.r/b.i;
+		den=b.i+r*b.r;
+		c.r=(a.r*r+a.i)/den;
+		c.i=(a.i*r-a.r)/den;
+	}
+	return c;
+}
+
+double Cabs(z)
+fcomplex z;
+{
+	double x,y,ans,temp;
+	x=fabs(z.r);
+	y=fabs(z.i);
+	if (x == 0.0)
+		ans=y;
+	else if (y == 0.0)
+		ans=x;
+	else if (x > y) {
+		temp=y/x;
+		ans=x*sqrt(1.0+temp*temp);
+	} else {
+		temp=x/y;
+		ans=y*sqrt(1.0+temp*temp);
+	}
+	return ans;
+}
+
+fcomplex Csqrt(z)
+fcomplex z;
+{
+	fcomplex c;
+	double x,y,w,r;
+	if ((z.r == 0.0) && (z.i == 0.0)) {
+		c.r=0.0;
+		c.i=0.0;
+		return c;
+	} else {
+		x=fabs(z.r);
+		y=fabs(z.i);
+		if (x >= y) {
+			r=y/x;
+			w=sqrt(x)*sqrt(0.5*(1.0+sqrt(1.0+r*r)));
+		} else {
+			r=x/y;
+			w=sqrt(y)*sqrt(0.5*(r+sqrt(1.0+r*r)));
+		}
+		if (z.r >= 0.0) {
+			c.r=w;
+			c.i=z.i/(2.0*w);
+		} else {
+			c.i=(z.i >= 0) ? w : -w;
+			c.r=z.i/(2.0*c.i);
+		}
+		return c;
+	}
+}
+
+fcomplex RCmul(x,a)
+fcomplex a;
+double x;
+{
+	fcomplex c;
+	c.r=x*a.r;
+	c.i=x*a.i;
+	return c;
+}
+
+#endif /* ANSI */
diff --git a/src/com_hack.h b/src/com_hack.h
new file mode 100644
index 0000000..ea3d0bb
--- /dev/null
+++ b/src/com_hack.h
@@ -0,0 +1,33 @@
+/* Here are the prototypes of the complex routines that are in the book
+'Numerical recipes in C' by Press et al, 2nd edition, 1992. All references to 
+'float' in that book have been changed to 'double' here. Hence the definitions 
+are not always the same.
+
+ie a routine:
+				 fcomplex complex(float re, float im);
+
+has been changed to:
+
+             fcomplex complex(double re, double im);
+
+Hence all the C routines used here *must* be converted to double. Please *dont*
+use the numerical recipes header file 'complex.h', use my 'complex_hack.h' 
+
+The line:
+
+typedef struct FCOMPLEX {double r, i;} fcomplex;
+
+in the file  complex_hack.c must be deleted, since its defined in this file.
+Otherwise its defined twice, which will give a compiler error. */
+
+typedef struct FCOMPLEX {double r, i;} fcomplex;
+
+fcomplex Cadd(fcomplex a, fcomplex b);  /* a+b */
+fcomplex Csub(fcomplex a, fcomplex b);  /* a-b */
+fcomplex Cmul(fcomplex a, fcomplex b);  /* a*b */
+fcomplex Complex(double re, double im); /* Set an fcomplex number */
+fcomplex Cdiv(fcomplex a, fcomplex b);  /* a/b */
+double Cabs(fcomplex z);                /* absolute value of z */
+
+fcomplex RCmul(double x, fcomplex a);   /* real (x) times compelx (a) */
+
diff --git a/src/copy_matrix.c b/src/copy_matrix.c
new file mode 100644
index 0000000..7e76588
--- /dev/null
+++ b/src/copy_matrix.c
@@ -0,0 +1,61 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <errno.h>
+#include "yagi.h"
+
+extern int errno;
+
+void copy_matrix(int length, int width, double **to, double **from) 
+{
+	int i,j;
+	for(i=1;i<=length;++i)
+	{
+		for(j=1;j<=width;++j)
+		{
+			to[i][j]=from[i][j];
+		}
+	}
+
+#ifdef DEBUG
+	if(errno)
+	{
+		fprintf(stderr,"Errno =%d in copy_matrix() of copym.c\n", errno);
+		exit(1);
+	}
+#endif
+}
+
+/* The following functions copies data from a matrix z containing real and
+imaqginary data to a much larger real matrix A, so that simultaneouis
+equations can be solved by the method in 'Numerical Recipes in C' 
+
+		put the data in the form:
+	
+		|Zr -Zi|   |Ir|   = |Vr|   which we will call A.x=b
+		|Zi  Zr|   |Ii|     |Vi| 
+		
+		so the Z data goes now in a 2Nx2N matrix. This is a bit wasteful of space
+		and time, but it will do here. */
+
+void copy_complex_data_to_real_matrix(int elements, double **z, double **A)
+{
+		int i, j;
+		for(i=1;i<=elements;++i)
+		{
+			for(j=1;j<=elements;++j)
+			{
+				A[i][j]=z[i][2*j-1];   /* real data, top left corner of Z */
+				A[i+elements][j+elements]=z[i][2*j-1]; /* Bot right, real data */
+				A[i][j+elements]=-z[i][2*j]; /* imaginary, top right */
+				A[i+elements][j]=z[i][2*j]; /* bottom left, imaginary */
+			}
+		}
+#ifdef DEBUG
+	if(errno)
+	{
+		fprintf(stderr,"Errno =%d in copy_complex_data_to_real_m() of copym.c\n", errno);
+		exit(1);
+	}
+#endif
+}
diff --git a/src/dipole.c b/src/dipole.c
new file mode 100644
index 0000000..1351c9f
--- /dev/null
+++ b/src/dipole.c
@@ -0,0 +1,27 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <math.h>
+#include "yagi.h"
+
+int main(int argc, char **argv)
+{
+   double freq, r, x, real, length, lambda, dia;
+   if (argc != 4) {
+     fprintf(stderr,"Usage: frequency(MHz) length(m) diamater(mm)\n");
+     exit(1);
+     }
+   freq=atof(argv[1]);
+   length=atof(argv[2]);
+   dia=atof(argv[3]); 
+
+   r=dia/2000;
+   lambda=300/freq;
+
+   self(r, length, lambda, &real, &x);
+   printf("Self impedance of a dipole:\n");
+   printf("%f MHz,  length %f m, diameter %f mm, is \n",freq,length,dia);
+   printf("Z = %f  %+f jX Ohms\n", real,x);
+   exit(0);
+}
diff --git a/src/display_antenna_currents.c b/src/display_antenna_currents.c
new file mode 100644
index 0000000..41bc730
--- /dev/null
+++ b/src/display_antenna_currents.c
@@ -0,0 +1,47 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <math.h>
+#include "yagi.h"
+
+void display_antenna_currents(struct FCOMPLEX *current, int elements)
+{
+	int j, stars, k;
+	double magnitude, max=0.0;
+	for(j=1;j<=elements;++j)
+	{
+		magnitude=sqrt(current[j].r*current[j].r+current[j].i*current[j].i);
+		if (magnitude > max)
+			max=magnitude;
+	}
+	/* find the reflector current */
+	magnitude=sqrt(current[2].r*current[2].r+current[2].i*current[2].i);
+	stars=(int) (68.0*magnitude/max+0.5);
+	printf("REF ");
+	for(k=1;k<=stars;++k)
+			printf("*");
+	for(k=k;k<=68;k++)
+		printf(" ");
+	printf(" %.3f\n",magnitude/max);
+
+	printf ("DR  ");
+	magnitude=sqrt(current[1].r*current[1].r+current[1].i*current[1].i);
+	stars=(int) (68.0*magnitude/max+0.5);
+	for(k=1;k<=stars;++k)
+			printf("*");
+	for(k=k;k<=68;k++)
+		printf(" ");
+	printf(" %.3f\n",magnitude/max);
+	for(j=3;j<=elements;++j)
+	{
+		magnitude=sqrt(current[j].r*current[j].r+current[j].i*current[j].i);
+		stars=(int) (68.0*magnitude/max+0.5);
+		printf("D%02d ",j-2);
+		for(k=1;k<=stars;++k)
+			printf("*");
+		for(k=k;k<=68;k++)
+			printf(" ");
+		printf(" %.3f\n",magnitude/max);
+	}
+}
diff --git a/src/dobetter.c b/src/dobetter.c
new file mode 100644
index 0000000..5cc222f
--- /dev/null
+++ b/src/dobetter.c
@@ -0,0 +1,45 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <errno.h>
+#include "yagi.h"
+
+/* This routine prints the data to disk and to stdout, since the new result
+is better than all previous */
+
+void do_since_better(int i, char *output_filename, char *update_filename, struct FCOMPLEX input_impedance, struct performance_data n,struct flags flag,char * notes,double frequency,double min_frequency,double max_frequency,double  step_frequency,int elements, int driven,int parasitic,double angular_step,double **driven_data,double **parasitic_data,double scale_factor,double new_perf)
+{
+			static int run_first_time=TRUE;
+
+			FILE *fp_out, *update_fp;
+			int print_fitnessQ;
+			n.r=input_impedance.r; n.x=input_impedance.i;
+			if(flag.Wflg || flag.gflg)
+				print_fitnessQ=TRUE;
+			else
+				print_fitnessQ=FALSE;
+			print_relavent_performance_data(stdout,"",i,flag,n,new_perf,TRUE,print_fitnessQ); 
+			update_fp=fopen(update_filename,"a");
+			if(run_first_time==TRUE && flag.wflg)
+				fprintf(update_fp, "Optimised for wide-band use\n");
+			if(run_first_time==TRUE && flag.gflg)
+				fprintf(update_fp, "Optimised With the genetic algoritm\n");
+			run_first_time=FALSE;
+
+			print_relavent_performance_data(update_fp,"",i,flag,n,new_perf,TRUE,print_fitnessQ); 
+			fclose(update_fp);
+			/* write our best design to date to disk */
+			
+			fp_out=fopen(output_filename,"wt");
+			write_input_data_to_disk(fp_out, notes, frequency/1e6,                          min_frequency/1e6,max_frequency/1e6, step_frequency/1e6, elements,              driven, parasitic, angular_step,driven_data, parasitic_data,                    scale_factor); 
+			fclose(fp_out);
+
+#ifdef DEBUG
+	if(errno)
+	{
+		fprintf(stderr,"Errno =%d in dobetter.c\n", errno);
+		exit(1);
+	}
+#endif
+}
diff --git a/src/dynamic.c b/src/dynamic.c
new file mode 100644
index 0000000..2c69ae7
--- /dev/null
+++ b/src/dynamic.c
@@ -0,0 +1,46 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <math.h>
+#include <stdio.h>
+#include "yagi.h"
+/* This function is supposed to allow the user to change the weights etc
+while the program is running. Until I can find a way of doing it under
+unix, it will stay commented out. */
+
+void dynamic_changing_of_weights(int i, int divisor, struct performance_data *weight)
+{
+	char c, *str;
+	if(i%divisor==0)
+	{
+		str=string(0L,100L);
+		if((fopen("change","rt"))!=NULL)
+		{
+			system("rm change");
+			printf("Enter a letter - G, F, P, R, S or X\n");
+			c=getc(stdin);
+			switch (c)
+			{
+				case 'G':
+				printf("Enter new weight for gain -current weight=%f\n",weight->gain);
+				scanf("%s",str);
+				weight->gain=atof(str);
+				fflush(stdin);
+				break;
+
+				case 'F':
+				printf("Enter new weight for FB -current weight=%f\n",weight->fb);
+				gets(str);
+				weight->fb=atof(str);
+				break;
+
+				case 'P':
+				printf("Enter new weight for sidelobe -current weight=%f\n",weight->sidelobe);
+				gets(str);
+				weight->sidelobe=atof(str);
+				break;
+			} /* end of switch statement */
+		} /* end of if file exits/user hit keyboard */
+	free_string(str,0L,100L);
+	} /* end of if divisor%10==0 */
+} /* function  */
diff --git a/src/end_stop.c b/src/end_stop.c
new file mode 100644
index 0000000..34b0d5f
--- /dev/null
+++ b/src/end_stop.c
@@ -0,0 +1,19 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include "yagi.h"
+
+extern int errno;
+
+void end_if_stop_exists(int *i, int iterations,int divisor)
+{
+	if(*i%divisor==0)
+	{
+		if(fopen("stop","rt") != NULL)
+			*i=iterations;  /* force it to exit very soon */
+		errno=0; /* Will be set to non zero if file dont exist */
+		printf("%d\r", *i);
+	} 
+}
+
diff --git a/src/error_message.c b/src/error_message.c
new file mode 100644
index 0000000..19a1c5e
--- /dev/null
+++ b/src/error_message.c
@@ -0,0 +1,10 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include "yagi.h"
+
+void error_message(char *str)
+{
+	fprintf(stderr,str);
+}
diff --git a/src/fill_v_vector.c b/src/fill_v_vector.c
new file mode 100644
index 0000000..0a652a8
--- /dev/null
+++ b/src/fill_v_vector.c
@@ -0,0 +1,38 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <math.h>
+#include <errno.h>
+#include "yagi.h"
+extern int errno;
+
+void fill_v_vector(int driven, int parasitic, double **driven_data, double *v)
+{
+	double real, imaginary;
+	int i, elements=driven+parasitic;
+
+	for(i=1;i<=elements;i++)		/* fill driven elements */
+	{
+		if(i<=driven)
+		{
+			real      = driven_data[i][VOLTAGE_R];
+			imaginary = driven_data[i][VOLTAGE_I];
+			v[2*i-1]=real;
+			v[2*i]=imaginary;
+		}
+		else  /* zero parasitic elements */
+		{
+			v[2*i-1]=0.0;
+			v[2*i]=0.0;
+		}
+	}
+
+#ifdef DEBUG
+	if(errno)
+	{
+		fprintf(stderr,"Errno =%d in fill_v_vector() of v.c\n", errno);
+		exit(1);
+	}
+#endif
+}
diff --git a/src/fill_z_matrix.c b/src/fill_z_matrix.c
new file mode 100644
index 0000000..605a214
--- /dev/null
+++ b/src/fill_z_matrix.c
@@ -0,0 +1,45 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <errno.h>
+#include "yagi.h"
+extern int errno;
+/* We calculate the full Z matrix. Since the matrix is symmetrical, we only
+need compute Z_i,j for j=1 to i. The function mutual, filles in Zji, when
+we ask it to fill in Zij. */
+
+void fill_z_matrix(double frequency, int driven, int parasitic, double **d, double **p, double **impedance)
+{
+
+	int i,j, elements=driven+parasitic;
+	for(i=1;i<=elements;++i)			/* for every antenna element */
+	{
+		for(j=1;j<=i;++j)     
+		{
+			if(i==j)							 				/* Need self impedance */
+			{
+				if(i<=driven)
+				{
+					self_impedance(i, frequency, driven, parasitic, d, impedance);
+				}
+				else if (i > driven ) 					  /* parasitic element */
+				{
+					self_impedance(i, frequency, driven, parasitic, p, impedance);
+				}
+			}
+			else if (i != j)		/* need mutual impedance */
+			{
+				 mutual_impedance(i,j,frequency,driven,parasitic, d, p, impedance); 
+			}
+		}
+	}
+
+#ifdef DEBUG
+	if(errno)
+	{
+		fprintf(stderr,"Errno =%d in z.c\n", errno);
+		exit(1);
+	}
+#endif
+}
diff --git a/src/first.c b/src/first.c
new file mode 100644
index 0000000..856749c
--- /dev/null
+++ b/src/first.c
@@ -0,0 +1,107 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <math.h>
+#include <string.h>
+#include "yagi.h"
+
+/* This program 'first' has a go at a first attempt of a yagi. It uses
+as a basis, the DL6WU Yagis, which are strictly only  okay for 10 or more
+elements, but this program takes liberties and calculates for any size of
+dipole. 
+
+The program 'first' disscussed in an article sent to RadCom, used a much
+worst method, by trying to extend a 33 ele beam form the ARRL handbook in
+both directions. I've abandoned this algorithm (if you could call it an   
+algorithm) in faviour of the DL6WU designs. 
+
+*/
+
+extern int optind, opterr;
+extern char *optarg;
+
+/* space between the eleemnts */
+double space[]={0.000,0.200,0.075,0.180,0.215,0.250,0.280,0.300,0.315,0.330,0.345,0.360,0.375,0.390,0.400,0.400,0.400,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4,0.4};
+/* elements length. These values are for a diamter of 0.01 lambda */
+double length[]={0.480,0.456,0.425,0.42,0.414,0.408,0.404,0.399,0.396,0.392,0.390,0.388,0.385,0.383,0.381,0.379,0.377,0.376,0.375,0.374,0.372,0.371,0.370,0.369,0.368,0.367,0.366,0.365,0.364,0.363};
+
+/* We now compute the element lengths. The program computes the self reactance 
+of eleemnts assuming a diamter of 0.01 lambda, then adjest the length for the 
+array 'length' so they have the same reactance. The resistance will change
+somewhat, so you cant expect the performance  to be identical with different
+element lengths */
+
+int main(int argc, char **argv)
+{
+	double min_f, f, max_f, step_f, angular_step=180, diameter, lambda;
+	double **d, **p,scale_factor=1.0;
+	int elements, driven, parasitic, i,c; 
+	FILE *fp;
+	char *output_filename, *notes="Automatically produced by first";
+
+
+   while ((c =  getoptions(argc,argv,"m")) != -1)
+   switch       (c) 
+   {
+	}
+	if((argc-optind!=7))
+	{
+		usage_first(argv[0]);
+		exit(1);
+	}
+	elements=atoi(argv[optind+1]);
+	if(elements <10)
+	{
+		printf("DL6WU antennas are only valid for 10 or more elements, but I'll do it!\n");
+	}
+	min_f=atof(argv[optind+2]);
+	f=atof(argv[optind+3]);
+	max_f=atof(argv[optind+4]);
+	step_f=atof(argv[optind+5]);
+	diameter=1e-3*atof(argv[optind+6]);
+	driven=1;
+	parasitic=elements-1;
+	output_filename=string(0L,100L);
+	d=dmatrix(1L,(long) driven,1L, 6L);
+	p=dmatrix(1L,(long) parasitic,1L, 4L);
+	lambda=300/f;
+	fp=fopen(*(argv+1),"wt");
+	d[1][X]=space[1]*lambda;
+	d[1][DIAMETER]=diameter;
+	d[1][LENGTH]=new_length(lambda*length[1],0.01*lambda,lambda,diameter);
+	d[1][VOLTAGE_R]=1.0;
+	d[1][VOLTAGE_I]=0.0;
+	/* now all the directors */
+	for(i=1;i<=parasitic;++i)
+	{
+		if(i==1)
+		{
+			p[1][X]=space[0]; /* position of reflector */
+			p[1][DIAMETER]=diameter; /* length of reflector */
+			p[1][LENGTH]=new_length(lambda*length[0],0.01*lambda,lambda,diameter);
+		}
+		else if (i==2)
+		{
+			p[i][X]=space[i]*lambda+d[1][X];
+			p[i][DIAMETER]=diameter; /* length of first director */
+			p[i][LENGTH]=new_length(lambda*length[2],0.01*lambda,lambda,diameter);
+		}
+		else if ((i>2) && (i < 26))
+		{
+			p[i][X]=space[i]*lambda+p[i-1][X];
+			p[i][DIAMETER]=diameter; /* length of subsequent directors */
+			p[i][LENGTH]=new_length(lambda*length[i],0.01*lambda,lambda,diameter);
+		}
+		else if(i>=26)
+		{ 
+			p[i][X]=0.400*lambda+p[i-1][X];
+			p[i][LENGTH]=0.997*p[i-1][LENGTH]; /* Log taper, eancjh element constant fraction of the length od the last one */
+			p[i][DIAMETER]=diameter; /* length of these, assume constant frac of previous */
+		}
+	}
+	write_input_data_to_disk(fp, notes, f, min_f, max_f, step_f, elements   , driven, parasitic, angular_step, d, p, scale_factor); 
+	fclose(fp);
+	free_string(output_filename,0L,100L); 
+	exit(0);
+}
diff --git a/src/fitness.c b/src/fitness.c
new file mode 100644
index 0000000..cf7c75d
--- /dev/null
+++ b/src/fitness.c
@@ -0,0 +1,51 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+/* This function solves all the simultaneous equatons and returns a
+double which increases with a better antenna. */
+
+#include <stdio.h>
+#include <errno.h>
+
+#include "yagi.h"
+
+extern int errno;
+extern struct performance_data max, weight;
+
+double get_genetic_algorithm_fitness(struct flags flag, double frequency, int driven, int parasitic, double **driven_data, double **parasitic_data, double *v, double **z, double *pin, struct FCOMPLEX *voltage, struct FCOMPLEX *current, struct FCOMPLEX *input_impedance, struct element_data *coordinates, double **A, double  *b, int *indx, struct performance_data *data2) 
+{
+	double result, E_fwd, E_back, H_fwd,
+	H_back; 
+	double mag, phase;
+	int elements;
+	struct performance_data data,start;
+	start.gain=0.0;
+	elements=driven+parasitic;
+	solve_equations(frequency, driven, parasitic, driven_data, parasitic_data, v, z, pin, voltage, current, input_impedance, coordinates, A, b, indx);
+	/* compute gain at theta=90, phi=0 (forward direction) */
+	gain(90,0,*pin,1.0,coordinates,current,elements,&E_fwd,&H_fwd,frequency,frequency);
+	/* now compute gain in the reverse direction */
+	gain(270,0,*pin,1.0,coordinates,current,elements,&E_back,&H_back,frequency,frequency);
+	data.gain=E_fwd;            /* in dB */
+	data.fb=E_fwd-E_back; /* gains are already in dB, so subtract */
+	data.r=input_impedance->r;
+	data.x=input_impedance->i;
+	reflection_coefficient(*input_impedance, &mag, &phase);
+	data.swr=calculate_vswr(mag);
+	if((flag.gflg&SIDE_LOBE_LEVEL)==SIDE_LOBE_LEVEL)
+		data.sidelobe=find_max_sidelobe_fast(E_fwd, *pin,coordinates, \
+		current,elements,frequency,frequency);
+	else
+		data.sidelobe=0.0;
+	*data2=data;
+	result=performance(flag, data, max, weight, start);
+
+#ifdef DEBUG
+	if(errno)
+	{
+		fprintf(stderr,"Errno =%d in fitness.c\n", errno);
+		exit(1);
+	}
+#endif
+	return (result);
+}
diff --git a/src/gain.c b/src/gain.c
new file mode 100644
index 0000000..de25502
--- /dev/null
+++ b/src/gain.c
@@ -0,0 +1,134 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <math.h>
+#include <malloc.h>
+#include <errno.h>
+#include "yagi.h"
+#define TINY 1e-10
+
+extern int errno;
+
+/* This function finds the gain both in the E plane (xz plane) and the
+H plane (xy plane) at angle (theta, phi). The method used is as described
+on page 1-12 of 'Yagi Antenna Design' by Dr. Lawson , ARRL */
+
+void gain(double theta, double phi, double pin, double F, struct element_data *coordinates, struct FCOMPLEX *current, int elements, double *gain_E_plane, double *gain_H_plane, double actual_frequency, double design_frequency) 
+{
+	int i;
+	double *r_E, *r_H, *g_E, *g_H,integer_bit;
+	double length, x, y, lamda_design, lamda, tmp;
+	struct FCOMPLEX temp_E, temp_H, e_gain, h_gain;
+	/* need to allocate space for FCOMPLEX types. Since there is no Numerical 
+	Recipes routine, I'll use the standard method. Since I've always used
+	elements positions 1 to N, I'll just wast the extra location */
+	r_E=dvector(1L,(long) elements); 
+	r_H=dvector(1L,(long) elements);
+	g_E=dvector(1L,(long) elements);
+	g_H=dvector(1L,(long) elements);
+	e_gain.r=0;   /* set to zero. Necessary as we sum into these */
+	e_gain.i=0;
+	h_gain.r=0;
+	h_gain.i=0;
+	/* convert theta and thi to radians from degrees */
+	theta=theta*M_PI/180;
+	phi=phi*M_PI/180;
+	lamda_design=3e8/design_frequency;
+	lamda=3e8/actual_frequency;
+	for(i=1;i<=elements;++i) 
+	{
+		length=coordinates[i].length/lamda;
+		x=coordinates[i].x/lamda_design;
+		y=coordinates[i].y/lamda_design;
+
+		/* for E -plane */
+		r_E[i]=sin(theta)*x;
+		if(fabs(theta) < TINY)    /* avoid division by zero if theta=0 */
+			g_E[i]=0;
+		else
+			g_E[i]=(cos(M_PI*length*cos(theta))-cos(M_PI*length))/sin(theta);
+
+		/* for H -plane */
+		r_H[i]=x*cos(phi)+y*sin(phi);
+		g_H[i]=1-cos(M_PI*length);
+		/* printf("g_H[%d]=%.16lf \n", i, g_H[i]);		 */
+		temp_E.r=0;
+		temp_E.i=2*M_PI*r_E[i]*F;
+		temp_E=E_to_complex_power(temp_E); /* exp(j 2 pi r[i] F) */
+
+		temp_H.r=0;
+		temp_H.i=2*M_PI*r_H[i]*F;
+		temp_H=E_to_complex_power(temp_H);
+      /* printf("element %d temp_H.r=%f temp_H.i=%f\n",i, temp_H.r, temp_H.i); */
+		/* get element currents */
+		temp_E=Cmul(temp_E,current[i]);
+		temp_H=Cmul(temp_H,current[i]);
+		/* printf("element %d: current = %.10lf i%.10lf = %.10lf (mag) at %f degrees\n", i,current[i].r, current[i].i, sqrt(current[i].r*current[i].r+current[i].i*current[i].i), 180*atan2(current[i].i,current[i].r)/M_PI);         */
+      /* printf("element %d I temp_H.r=%.10lf temp_H.i=%.10lf\n",i, temp_H.r, temp_H.i); */
+		e_gain=Cadd(e_gain,RCmul(g_E[i],temp_E));
+		h_gain=Cadd(h_gain,RCmul(g_H[i],temp_H));
+		/* printf("h_gain=%.16lf + i %.16lf \n", h_gain.r, h_gain.i); */
+	}
+	/* there will be a divide  by zero in calculating
+	equ 1.28, of Lawsons book, (see page 1-12)
+	at theta=0,180,360 degree, infact anywhere where 
+	sin(theta) is zero */
+
+	if( modf(theta/M_PI,&integer_bit) < TINY || fabs(theta-M_PI)<TINY)
+	{
+		*gain_E_plane=-150.0;   /* a very very small number */
+	}
+	else
+	{
+		tmp=(Cabs(e_gain)*Cabs(e_gain)*60/pin);  
+		*gain_E_plane=10*log10(tmp);  
+#ifdef DEBUG
+	if(errno)
+	{
+		fprintf(stderr,"Errno =%d in gain() of gain.c after E\n", errno);
+		printf("tmp=%f pin=%f theta=%f gainE=%f\n", tmp, pin,theta,*gain_E_plane);
+		exit(1);
+	}
+#endif
+	}
+	tmp=(Cabs(h_gain)*Cabs(h_gain)*60/pin);  
+	*gain_H_plane=10*log10(tmp);  
+
+#ifdef DEBUG
+	if(errno)
+	{
+		fprintf(stderr,"Errno =%d in gain() of gain.c after H\n", errno);
+		printf("tmp=%f pin=%f \n", tmp, pin);
+		exit(1);
+	}
+#endif
+	free_dvector(r_E,1L,(long) elements); 
+	free_dvector(r_H,1L,(long) elements); 
+	free_dvector(g_E,1L,(long) elements); 
+	free_dvector(g_H,1L,(long) elements); 
+
+#ifdef DEBUG
+	if(errno)
+	{
+		fprintf(stderr,"Errno =%d in gain() of gain.c\n", errno);
+		exit(1);
+	}
+#endif
+}
+
+struct FCOMPLEX E_to_complex_power(struct FCOMPLEX x)
+{
+	struct FCOMPLEX a, answer;
+	double real;
+
+	/* First real part */
+	real=exp(x.r);
+	/* now the imaginary part */
+	/* Exp(i theta) = cos(theta) + i sin(theta) */
+	a.r=cos(x.i);
+	a.i=sin(x.i);
+	answer=RCmul(real,a);
+	return(answer);
+}
+#undef TINY
diff --git a/src/gaussian.c b/src/gaussian.c
new file mode 100644
index 0000000..972148f
--- /dev/null
+++ b/src/gaussian.c
@@ -0,0 +1,34 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <math.h>
+#include <errno.h>
+#include "yagi.h"
+
+extern int errno;
+
+/* The function Gaussian (normal) distibuted  deviate with 0 mean
+and unit standard deviation. This is used in yagi to as it best represents
+the way mechanically the antenna elemnts will be placed */
+
+double gaussian()
+{
+	double fac,r,x,y;
+
+		do {
+			x=2.0*randreal()-1.0;
+			y=2.0*randreal()-1.0;
+			r=x*x+y*y;
+		} while (r >= 1.0 || r==0.0);
+		fac=sqrt(-2.0*log(r)/r);
+
+#ifdef DEBUG
+	if(errno)
+	{
+	fprintf(stderr,"Errno =%d in gaaussian.c\n", errno);
+	exit(1);
+	}
+#endif
+		return y*fac;
+}
diff --git a/src/genetic.c b/src/genetic.c
new file mode 100644
index 0000000..fe1ce13
--- /dev/null
+++ b/src/genetic.c
@@ -0,0 +1,158 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <errno.h>
+
+#ifdef HAVE_IEEEFP_H
+#include <ieeefp.h> 
+#endif
+
+#ifdef HAVE_NAN_H
+#include <nan.h> 
+#endif
+
+#include "yagi.h"
+
+#define granularity 8 /* 2^granularity = possible different lengths */
+
+#define LENGTH_MIN            0.35 /* min length of an element (in lambda) */
+#define LENGTH_DR_MIN         0.40 /* min length of an element (in lambda) */
+#define LENGTH_MIN_REFLECTOR  0.45 /* min length of reflector (in lambda) */
+#define LENGTH_MAX            0.50 /* max length of an element (in lambda) */
+#define SPACE_MIN             0.05 /* min spacing between elements(in lambda) */
+#define SPACE_MAX             0.42 /* max spacing between elements(in lambda) */
+#define MAX_CHANGE
+extern int popsize;
+extern int iterations;
+
+double **data_driveng, **data_parasiticg, *vg, **zg, **Ag, *bg;
+double *ping, design_frequencyg;
+int driveng, parasiticg, *indxg, elementsg;
+struct FCOMPLEX *voltageg, *currentg, *input_impedanceg;
+struct element_data *coordinatesg;
+double lambda;
+struct performance_data *mean_performanceg;
+struct flags flagg;
+char *output_filenameg, *update_filenameg;
+double min_frequencyg, max_frequencyg, step_frequencyg, angular_stepg;
+int k;
+
+void genetic_algorithm(char *output_filename, char *update_filename, struct flags flag, double design_frequency, double min_frequency, double max_frequency, double step_frequency, double angular_step, int driven, int parasitic, double **data_driven, double **data_parasitic, double *v, double **z, double *pin, struct FCOMPLEX *voltage, struct FCOMPLEX *current, struct FCOMPLEX *input_impedance, struct element_data *coordinates, double **A, double  *b, int *indx,struct performance_data *me [...]
+{
+	int elements;
+	elements=driven+parasitic;
+	/* Set up global pointers; save modifiy GA code too much */
+	data_driveng=data_driven;
+	data_parasiticg=data_parasitic;
+	ping=pin; 
+	mean_performanceg=mean_performance;
+	vg=v;
+	zg=z;
+	Ag=A;
+	bg=b;
+	voltageg=voltage;
+	currentg=current;
+	elementsg=elements;
+	input_impedanceg=input_impedance;
+	coordinatesg=coordinates;
+	indxg=indx;
+	driveng=driven;
+	flagg=flag;
+	parasiticg=parasitic;
+	design_frequencyg=design_frequency;
+	min_frequencyg=min_frequency;
+	max_frequencyg=max_frequency;
+	step_frequencyg=step_frequency;
+	angular_stepg=angular_step;
+	output_filenameg=output_filename;
+	update_filenameg=update_filename;
+	if(popsize ==0) /* ie  not set by user */
+		popsize = 40;
+
+	lambda = 3e8/design_frequency;  
+	/* Code with an granularity (eg 8) bit string the length in the range 0 to 
+	1, wavelength. Multiply by lambda to get true lengths.
+
+	Likewise code spacing between individual elements as a 8 bit
+	string, then convert to metres by multiplying by lambda */
+	Initialise(popsize,2*granularity*elements-granularity);
+	SetPrint(0) ;
+	for(k=1; k<=iterations; ++k)
+	{
+		if(k%1==0)
+		    SetPrint(0) ;
+		else
+			SetPrint(0);
+		end_if_stop_exists(&k,iterations,5);
+		Selection(stdout,k) ;
+	}
+	GA_Free();
+}
+
+double Objective(char *gene) 
+{
+		int i;  
+		double fitness,lmax;
+		static double max_fitness=0;
+		static int run_first_time=1;
+		if(run_first_time==1)
+		{
+			max_fitness=get_genetic_algorithm_fitness(flagg, design_frequencyg,driveng,parasiticg,data_driveng, data_parasiticg,vg, zg, ping, voltageg, currentg, input_impedanceg, coordinatesg, Ag, bg, indxg, mean_performanceg);
+			do_since_better(0,output_filenameg, update_filenameg, *input_impedanceg,*mean_performanceg, flagg, "Optimised with the genetic algorithm", design_frequencyg, min_frequencyg,max_frequencyg,step_frequencyg, elementsg, driveng, parasiticg,angular_stepg,data_driveng,data_parasiticg,1.0, max_fitness); 
+			run_first_time=0;
+		} 
+		data_parasiticg[1][X]=0.0; /* Set reflector at x=0 */
+		/* Find the length of the reflector */
+			data_parasiticg[1][LENGTH]=(ss2r(gene,0,granularity)*(LENGTH_MAX-LENGTH_MIN_REFLECTOR)+LENGTH_MIN_REFLECTOR)*lambda;
+		for(i=1; i<=driveng; i++) /* for every driven element */
+		{
+			data_driveng[i][X]=(ss2r(gene,granularity,granularity)*(SPACE_MAX-SPACE_MIN)+SPACE_MIN)*lambda;
+			data_driveng[i][LENGTH]=(ss2r(gene,2*granularity,granularity)*(LENGTH_MAX-LENGTH_DR_MIN)+LENGTH_DR_MIN)*lambda; 
+
+		}
+		/* put directors in + x direction */
+		lmax=LENGTH_MAX; /* must be longer than driven */
+		/* printf("  dr=%f lambda = %f m\n",data_driveng[1][LENGTH],data_driveng[1][LENGTH]*lambda);  */
+		for(i=2; i<=parasiticg; i++)
+		{
+			if(i==2) /* put first director ahead of the driven element */
+			data_parasiticg[i][X]=data_driveng[1][X] +(ss2r(gene,granularity*2*i-granularity,granularity)*(SPACE_MAX-SPACE_MIN)+SPACE_MIN)*lambda;  
+			else /* These directors must be ahead of the last director */
+		 data_parasiticg[i][X]=data_parasiticg[i-1][X] +(ss2r(gene,granularity*2*i-granularity,granularity)*(SPACE_MAX-SPACE_MIN)+SPACE_MIN)*lambda;  
+			data_parasiticg[i][LENGTH]=(ss2r(gene,granularity*2*i-granularity,granularity)*(lmax-LENGTH_MIN)+LENGTH_MIN)*lambda; 
+			/* printf("l=%f\n",data_parasiticg[i][LENGTH]/lambda);  */
+			lmax=data_parasiticg[i][LENGTH]/lambda;
+			if(lmax>LENGTH_MAX)
+				lmax=LENGTH_MAX;
+		}
+		/* printf("\n");     */
+		fitness=get_genetic_algorithm_fitness(flagg, design_frequencyg,driveng,parasiticg,data_driveng, data_parasiticg,vg, zg, ping, voltageg, currentg, input_impedanceg, coordinatesg, Ag, bg, indxg, mean_performanceg);
+		if(fitness > max_fitness)
+		{
+			max_fitness=fitness;
+			do_since_better(k,output_filenameg, update_filenameg, *input_impedanceg,*mean_performanceg, flagg, "Optimised with the genetic algorithm", design_frequencyg, min_frequencyg,max_frequencyg,step_frequencyg, elementsg, driveng, parasiticg,angular_stepg,data_driveng,data_parasiticg,1.0, fitness); 
+		}
+
+#ifdef DEBUG
+	if(errno)
+	{
+	fprintf(stderr,"Errno =%d in Objective() of genetic.c\n", errno);
+	exit(1);
+	}
+#endif
+		return(fitness);
+}
+
+double ss2r(char *string,int pos,int len)
+{
+		double result, x ;
+		int loop;
+
+		result=0 ;
+		for (loop=0 ; loop<len ; loop++) /* XXXXXXXXXXXXXXX */
+			result=result+result+string[pos+loop]-'0' ;     
+		
+		x=(result+1)/((double)(1<<granularity)); 
+		return(x);
+}
diff --git a/src/genetic_algorithm_lib.c b/src/genetic_algorithm_lib.c
new file mode 100644
index 0000000..5c0a610
--- /dev/null
+++ b/src/genetic_algorithm_lib.c
@@ -0,0 +1,325 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <string.h>
+
+#include <values.h>
+#include <math.h>
+#include <sys/types.h>
+#include <errno.h>
+#include "yagi.h"
+
+
+
+typedef struct {
+	int parent1,parent2 ;
+	char *gene ;
+	double fitness ;
+	} GeneRecord ;
+
+
+int population_size=0 ;
+int gene_length=0 ;
+int elite=1 ;
+int ramp=0 ;
+int PRINT=1 ;
+double MX ; 
+/* double pmutate=0.4 ;
+double pcross=0.6 ;
+double psimplex=0.4 ;
+double ptrans=0.2 ; */
+double pmutate=0.1 ; 
+double pcross=0.9 ;
+double psimplex=0.5 ;
+double ptrans=0.03 ;
+extern int errno;
+
+GeneRecord *Pop1=NULL,*Pop2=NULL ;
+
+void setprobs(double pm,double pc,double ps,double pt)
+{
+	pmutate=pm ;
+	pcross=pc ;
+	psimplex=ps;
+	ptrans=pt ;
+}
+
+int GA_Free(void) 
+{
+	int a ;
+	if (Pop1!=NULL) {
+		for(a=0 ; a<population_size ;a++)
+			if (Pop1[a].gene!=NULL) free(Pop1[a].gene) ;
+		free((char *) Pop1) ;
+	}
+	if (Pop2!=NULL) {
+		for(a=0 ; a<population_size ;a++)
+			if (Pop2[a].gene!=NULL) free(Pop2[a].gene) ;
+		free((char *) Pop2) ;
+	}
+	return(0);
+}
+
+int GA_Error(char *ErrorMsg) 
+{
+	int a ;
+	if (Pop1!=NULL) {
+		for(a=0 ; a<population_size ;a++)
+			if (Pop1[a].gene!=NULL) free(Pop1[a].gene) ;
+		free(Pop1) ;
+	}
+	if (Pop2!=NULL) {
+		for(a=0 ; a<population_size ;a++)
+			if (Pop2[a].gene!=NULL) free(Pop2[a].gene) ;
+		free(Pop2) ;
+	}
+	fprintf(stderr,"GA_LIB Error : %s \n\n",ErrorMsg) ;
+	exit(1) ;
+}       
+
+double GetMax()
+{
+	return(MX) ;
+}
+
+void SetPrint(int a)
+{
+	PRINT=a; 
+}
+void dump_pop1(FILE *fd,int generation,double max,double aver) 
+{
+	int a ;
+
+	if (PRINT==0) return ;
+	fprintf(fd,"Current contents of population: generation %d\n",generation);
+	for(a=0 ; a<gene_length ; a++) fprintf(fd,"-");
+	fprintf(fd,"------------------\n");
+	fprintf(fd,"Par1 Par2 Fitness   Code\n");
+	for(a=0 ; a<population_size ; a++)
+		fprintf(fd,"%4d %4d %9.4f %s\n",Pop1[a].parent1,Pop1[a].parent2,Pop1[a].fitness,Pop1[a].gene);
+	fprintf(fd,"\n Maximum %9.4f Average %9.4f\n",max,aver);
+	for(a=0 ; a<gene_length ; a++) fprintf(fd,"-");
+	fprintf(fd,"------------------\n\n");
+}        
+
+int Initialise(int PopSize, int GeneSize) 
+{
+	int a,b ;
+	char c[2] ;
+	
+	c[1]=0 ;
+
+	/* srandom(time(&a)); */
+	ramp=0 ;
+	population_size=PopSize ;
+	gene_length=GeneSize+1 ;
+	/* limit population size */
+	if ((PopSize<20)||(PopSize>1000)) GA_Error("Bad parameters to Initialise") ;
+	/* Allocate memory for population 1 */
+	Pop1=(GeneRecord *)calloc(PopSize,sizeof(GeneRecord)) ;
+	/* Mem alloc error */
+	if (Pop1==NULL) GA_Error((char *)"Memory allocation for population 1") ;
+	/* Blank population array */
+	for (a=0 ; a<population_size ; a++) {
+		Pop1[a].gene=NULL ;
+		Pop1[a].parent1=0 ;
+		Pop1[a].parent2=0 ;
+		Pop1[a].fitness=0.0 ;
+	}
+	/* Allocate memory for genes */
+	for (a=0 ; a<population_size ; a++) 
+		if ((Pop1[a].gene=malloc(gene_length))==NULL) 
+			GA_Error("Cannot allocate gene in population 1");
+	/* Allocate memory for population 2 */
+	Pop2=(GeneRecord *)calloc(PopSize,sizeof(GeneRecord)) ;
+	/* Mem alloc error */
+	if (Pop2==NULL) GA_Error((char *)"Memory allocation for population 1") ;
+	/* Blank population array */
+	for (a=0 ; a<population_size ; a++) {
+		Pop2[a].gene=NULL ;
+		Pop2[a].parent1=0 ;
+		Pop2[a].parent2=0 ;
+		Pop2[a].fitness=0.0 ;
+	}
+	/* Allocate memory for genes */
+	for (a=0 ; a<population_size ; a++) 
+		if ((Pop2[a].gene=malloc(gene_length))==NULL) 
+			GA_Error("Cannot allocate gene in population 2");
+	/* Initialise genes */
+	for (a=0 ; a<population_size ; a++) {
+		for (b=0 ; b<GeneSize ; b++) 
+			/* Pop1[a].gene[b]=(char)(48+(randint()&1)) ;XXXXXXXX */
+			Pop1[a].gene[b]=(char)(48+(randint()&1)) ;
+		Pop1[a].gene[GeneSize]=0 ;
+	}
+
+#ifdef DEBUG
+	if(errno)
+	{
+		fprintf(stderr,"Errno =%d in Initialise() of ga_lib.c\n", errno);
+		exit(1);
+	}
+#endif
+	return (0) ;
+}
+
+void crossover(char *s1,char *s2)
+{
+	int point;
+	char duplic ;
+	
+	/* only works for strings of same length */
+	if (strlen(s1)!=strlen(s2)) GA_Error((char *)"Gene length mismatch for crossover") ;
+	/* choose a point and swap tails of strings */
+	for (point=(randint()%(strlen(s1)-2))+1 ; point <strlen(s1) ; point++)
+	{
+		duplic=s1[point] ;
+		s1[point]=s2[point] ;
+		s2[point]=duplic ;
+	} 
+}
+
+void mutate(char *s1)
+{
+	/* flip a bit in at random point */
+	s1[randint()%strlen(s1)]^=1 ;
+}       
+
+int ga_simplex(char *s1,char *s2, char *s3)
+{
+	int point ;
+	for (point=0 ; point <(strlen(s1)-1) ; point++ )
+		if (s1[point]==s2[point]) 
+			s3[point]=s1[point] ;
+		else
+			s3[point]=s3[point]^1 ;
+	return(0);
+}
+
+void swap(int *x,int *y)
+{
+	int t ;
+	t=*x ;
+	*x=*y ;
+	*y=t ;
+}       
+
+void Sort() 
+{
+	GeneRecord T ;
+	int outer,inner,moved;
+	
+	for (outer=population_size-1; outer>0 ; outer--)
+	{
+		moved=0 ;
+		for (inner=0 ; inner<outer ; inner++)
+		{
+			if (Pop1[inner].fitness<Pop1[inner+1].fitness)
+			{
+				memcpy((char *) &T,(char *) &Pop1[inner],sizeof(GeneRecord)) ;
+				memcpy((char *) &Pop1[inner],(char *) &Pop1[inner+1],sizeof(GeneRecord)) ;
+				memcpy((char *) &Pop1[inner+1],(char *) &T,sizeof(GeneRecord)) ;
+				moved=1;
+			}
+		}
+		if (moved==0) break ;
+	}
+}
+	
+void transloc(char *gene) 
+{
+	int a,point,gene_size ;
+	char *dup;
+
+	gene_size=gene_length-1 ;
+	point=randint()%gene_size ;
+	dup=strdup(gene) ;
+	for(a=0 ; a<gene_size ; a++) gene[a]=dup[(a+point)%gene_size] ;
+	free(dup);
+}
+	
+int Selection(FILE *fd, int gen)
+{
+	int a,b,c,d ;
+	double sigma ;
+	GeneRecord *temp ;
+	double minfit,maxfit ;
+	sigma=0.0 ;
+	minfit=MAXDOUBLE ; 
+	maxfit=-minfit ;
+	/* minfit=1e308; maxfit=-1e308; XXXXXXXXXXXXXXXXXXXXXX */
+	for(a=0 ; a<population_size ; a++ ) 
+	{
+		Pop1[a].fitness=Objective(Pop1[a].gene) ;
+		if (Pop1[a].fitness<minfit) minfit=Pop1[a].fitness ;
+		if (Pop1[a].fitness>maxfit) maxfit=Pop1[a].fitness ;
+		sigma+=Pop1[a].fitness ;
+	}
+	MX=maxfit ;
+	Sort() ;
+	dump_pop1(fd,gen,maxfit,sigma/population_size);
+	for(a=0 ; a<population_size ; a++ ) 
+	{
+		if(minfit!=maxfit)
+		{
+			Pop1[a].fitness=((Pop1[a].fitness-minfit)*99.0/(maxfit-minfit))+1.0 ;
+		}
+	}
+	ramp++ ;
+	sigma=0.0 ;
+	for(a=0 ; a<population_size ; a++ ) 
+		sigma+=Pop1[a].fitness ;
+	c=0 ;
+	for(a=0 ; a<population_size ; a++ )
+	{
+		b=(int) (Pop1[a].fitness*population_size/sigma) ;
+		for (d=0 ; d<b ; d++)
+			strcpy(Pop2[c++].gene,Pop1[a].gene) ;
+	}       
+	for(d=c ; d<population_size ; d++)
+	{
+			b=randint()%population_size ;
+			strcpy(Pop2[d].gene,Pop1[b].gene) ;
+	}
+	for(a=0 ; a<population_size ;a++)
+	{
+		if (randreal()<pmutate) mutate(Pop2[a].gene) ;
+		if (randreal()<ptrans) transloc(Pop2[a].gene) ;
+	}
+	temp=Pop1 ;
+	Pop1=Pop2 ;
+	Pop2=temp ;
+	for(a=2 ; a<population_size ; a+=2 )
+	{
+		b=randint()%population_size ;
+		c=randint()%population_size ;
+		strcpy(Pop2[a].gene,Pop1[b].gene);
+		strcpy(Pop2[a+1].gene,Pop1[c].gene);
+		if (randreal()<pcross)
+		{
+			crossover(Pop2[a].gene,Pop2[a+1].gene) ;
+			Pop2[a].parent2=Pop2[a+1].parent1 ;
+			Pop2[a+1].parent2=Pop2[a].parent1 ;
+		} else {
+			Pop2[a].parent2=Pop2[a].parent1 ;
+			Pop2[a+1].parent2=Pop2[a+1].parent1 ;
+		}
+	}
+	if (randreal()<psimplex) {
+		a=randint()%population_size ;   
+		b=randint()%population_size ;   
+		c=randint()%population_size ;   
+		if (Pop1[a].fitness<Pop1[b].fitness) 
+			swap(&a,&b) ;
+		if (Pop1[b].fitness<Pop1[c].fitness) 
+			swap(&b,&c) ;
+		if (Pop1[a].fitness<Pop1[b].fitness) 
+			swap(&a,&b) ;
+		ga_simplex(Pop1[a].gene,Pop1[b].gene,Pop2[c].gene);
+	}
+	temp=Pop1 ;
+	Pop1=Pop2 ;
+	Pop2=temp ;
+	return 0 ;
+}
+				
diff --git a/src/get_command_line_options.c b/src/get_command_line_options.c
new file mode 100644
index 0000000..05ad16a
--- /dev/null
+++ b/src/get_command_line_options.c
@@ -0,0 +1,365 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <math.h>
+#include <string.h>
+#include <ctype.h>
+#include "yagi.h"
+
+extern char     *optarg;
+extern int optind, opterr;
+extern int errno;
+extern struct performance_data max, weight;
+extern double original_percent; 
+extern double percent;
+extern double magnitude, phase;
+extern double Zo; /* Z0 is defined in yagi.h, Zo can be set in optimise */
+extern double max_gain, boom_factor, diameter, best_perf;
+extern int popsize;
+extern int iterations, fitness_method;
+extern double vswr;
+extern double boom_sd, length_sd;
+extern int K_times, K_times_max;
+int errno;
+double min_offset_from_peak=0.0;
+double angular_stepsize_2=0.0;
+
+void get_command_line_options(int argc, char **argv, struct flags *flag)
+{
+	int c;
+	/* Since not all complilers come with the 'getopts' functions, I've
+	get a source of it and put it in the distribution of Yagi-Uda. 
+	To avoid conflics on unix systems, I've rename it to getoptions */
+   while((c=getoptions(argc,argv,"A:c:kwW:hvdg:Or:P:m:C:b:x:f:s:S:G:R:X:F:l:o:e:Z:p:t:T:K:")) != -1)
+   switch       (c) 
+   {
+			 case 'k': /* To keep the old start point with the GA */
+					flag ->kflg=1;
+					break;
+			 case 'C':     /* Optimise by making element current the same */
+					flag -> Cflg=atoi(optarg);
+					break;
+			 case 'A': /* Automatically maximise */
+					flag->Aflg=atoi(optarg)+1000;
+					if(flag->Aflg <-1)
+					{
+						fprintf(stderr,"Aflg x, where (-1<= x<= directors)\n");
+						exit(1);
+					}
+					break;
+			 case 'W':  /* weighted inprovement */
+					flag->Wflg=atoi(optarg);
+					if(flag->Wflg <1 || flag->Wflg>64)
+					{
+						fprintf(stderr,"-Wx, where x=1(gain),2() etc AND\n");
+						exit(1);
+					}
+					flag->Wflg+=32768;
+			      break;
+			 case 'a':  /* Angular step size to use when pattern searching */
+					flag->aflg=1;
+					if(!isdigit( (int) *optarg) && *optarg !='.')
+					{
+						error_message("Non numeric data entered for option -a which requires numeric data.\n");
+						exit(1);
+					}
+					angular_stepsize_2=atof(optarg);
+					if(angular_stepsize_2 < 0.0)
+					{
+						error_message("The '-a' requires a posistive float, signifying the angular stepsize to use when finding sidelobes.\n");
+						exit(1);
+					}
+			      break;
+			 case 'P':  /* Get average level of pattern down */
+					flag->Pflg=1;
+					if(!isdigit( (int) *optarg) && *optarg !='.')
+					{
+						error_message("Non numeric data entered for option -P which requires numeric data.\n");
+						exit(1);
+					}
+					weight.sidelobe=atof(optarg);
+					if(weight.sidelobe < 0.0)
+					{
+						error_message("The '-P' requires a posistive float, signifying the weight on the sidelobe level (default=1.0).\n");
+						exit(1);
+					}
+			      break;
+			 case 'c':  /* Get average level of pattern down */
+					if(!isdigit( (int) *optarg) && *optarg !='.')
+					{
+						error_message("Non numeric data entered for option -P which requires numeric data.\n");
+						exit(1);
+					}
+					max.sidelobe=atof(optarg);
+					if(max.sidelobe < 0.0)
+					{
+						error_message("The '-P' requires a posistive float, signifying the sidelobe level down to aim for in dB (20 is reasonable).\n");
+						exit(1);
+					}
+					break;
+			 case 'm':  /* Get minimum deviation from theta=90, to condsider a sidelobe. Higher the gain antenna, the smaller it should be set. */
+					flag->mflg=1;
+					if(!isdigit( (int) *optarg) && *optarg !='.')
+					{
+						error_message("Non numeric data entered for option -m which requires numeric data.\n");
+						exit(1);
+					}
+					min_offset_from_peak=atof(optarg);
+					if(min_offset_from_peak < 0.0|| min_offset_from_peak > 90)
+					{
+						error_message("The '-m' requires a posistive float, signifying the minimum offset in degrees from theta =90, to start considering a sidelobe, rather than the main beam.\n");
+						exit(1);
+					}
+			      break;
+			 case 'w':  /* wide band ant wanted - avg at low, design and upper f */
+					flag->wflg=2; /* do at three frequencies,  2 extra ones */
+			      break;
+			 case 'r':   /* acceptable_resistance_error option */
+					flag->rflg=1;
+					if(!isdigit( (int) *optarg) && *optarg !='.')
+					{
+						error_message("Non numeric data entered for option -r which requires numeric data.\n");
+						exit(1);
+					}
+					max.r=atof(optarg);
+					if(max.r < 0.0)
+					{
+						error_message("The '-r' option setting an acceptable vswr must >=0.0\n");
+						exit(1);
+					}
+			      break;
+			 case 'x':   /* acceptable_reactance option */
+					flag->xflg=1;
+					if(!isdigit( (int) *optarg) && *optarg !='.')
+					{
+						error_message("Non numeric data entered for option -x which requires numeric data.\n");
+						exit(1);
+					}
+					max.x=atof(optarg);
+					if(max.x < 0.0)
+					{
+						error_message("The '-x' option setting an acceptable reactance must >=0.0\n");
+						exit(1);
+					}
+			      break;
+			 case 's':   /* acceptable_vswr option */
+					flag->sflg=1;
+					if(!isdigit( (int) *optarg) && *optarg !='.')
+					{
+						error_message("Non numeric data entered for option -s which requires numeric data.\n");
+						exit(1);
+					}
+					max.swr=atof(optarg);
+					if(max.swr < 1.0)
+					{
+						error_message("The '-s' option setting an acceptable vswr must >= 1.\n");
+						exit(1);
+					}
+			      break;
+			 case 'f':   /* acceptable_fb_ratio option */
+					flag->fflg=1;
+					if(!isdigit( (int) *optarg) && *optarg !='.')
+					{
+						error_message("Non numeric data entered for option -f which requires numeric data.\n");
+						exit(1);
+					}
+					max.fb=atof(optarg);
+					if(max.fb < 0.0)
+					{
+						error_message("The '-f' option setting an acceptable FB ratio must >=0.0\n");
+						exit(1);
+					}
+			      break;
+			 case 'F':   /* fb_ratio weight */
+					flag->Fflg=1;
+					if(!isdigit( (int) *optarg) && *optarg !='.')
+					{
+						error_message("Non numeric data entered for option -F which requires numeric data.\n");
+						exit(1);
+					}
+					weight.fb=atof(optarg);
+					if(weight.fb < 0.0)
+					{
+						error_message("The '-F' option setting the weight for FB ratio must >=0.0\n");
+						exit(1);
+					}
+			      break;
+			 case 'G':   /* fb_ratio weight */
+					flag->Gflg=1;
+					if(!isdigit( (int) *optarg) && *optarg !='.')
+					{
+						error_message("Non numeric data entered for option -G which requires numeric data.\n");
+						exit(1);
+					}
+					weight.gain=atof(optarg);
+					if(weight.gain < 0.0)
+					{
+						error_message("The '-G' option setting the weight for gain must >=0.0\n");
+						exit(1);
+					}
+			      break;
+			 case 'S':   /* weight of swr*/
+					flag->Sflg=1;
+					if(!isdigit( (int) *optarg) && *optarg !='.')
+					{
+						error_message("Non numeric data entered for option -S which requires numeric data.\n");
+						exit(1);
+					}
+					weight.swr=atof(optarg);
+					if(weight.swr < 0.0)
+					{
+						error_message("The '-S' option setting the weight for swr must >=0.0\n");
+						exit(1);
+					}
+			      break;
+			 case 'l':   /* percentage change in ele positions */
+					flag->lflg=1;
+					if(!isdigit( (int) *optarg) && *optarg !='.'&& *optarg!='-')
+					{
+						error_message("Non numeric data entered for option -l which requires numeric data.\n");
+						exit(1);
+					}
+					original_percent=atof(optarg);
+			      break;
+			 case 'o':   /* optimise for gain, fb etc etc */
+					if(!isdigit( (int) *optarg))
+					{
+						error_message("Non numeric data entered for option -o which requires numeric data.\n");
+						exit(1);
+					}
+					flag->oflg=atoi(optarg);
+					if(flag->oflg< 0 || flag->oflg > 128)
+					{
+						error_message("The '-o' option setting the parameter(s) to optimise for must be in the range 0 to 128.\n");
+						exit(1);
+					}
+			      break;
+			 case 'O':
+					flag->Oflg=1;
+					break;
+			 case 'K':   /* Keep to original data, until K bad goes */
+					flag->Kflg=1;
+					if(!isdigit( (int) *optarg))
+					{
+						error_message("Non numeric data entered for option -K which requires an integer.\n");
+						exit(1);
+					}
+					K_times_max=atoi(optarg);
+					if(K_times_max < 1 )
+					{
+						error_message("The '-K' option setting the number of attemps to stay with hte original data after a good one found, to avoid local optimums, must be an integer > 1.\n");
+						exit(1);
+					}
+			      break;
+			 case 'b':   /* how long can boom be extended */
+					flag->bflg=1;
+					if(!isdigit( (int) *optarg) && *optarg !='.')
+					{
+						error_message("Non numeric data entered for option -b which requires numeric data.\n");
+						exit(1);
+					}
+					boom_factor=atof(optarg);
+					if(boom_factor < 0.0)
+					{
+						error_message("The '-b' option setting the maximum permissable change in the boom length (in %%) must be >=0.0\n");
+						exit(1);
+					}
+			      break;
+			 case 'Z':   /* Characteristic impedance */
+					flag->Zoflg=1;
+					if(!isdigit( (int) *optarg) && *optarg !='.')
+					{
+						error_message("Non numeric data entered for option -Z which requires numeric data.\n");
+						exit(1);
+					}
+					Zo=atof(optarg);
+					if(Zo <= 0.0)
+					{
+						error_message("The '-Z' option setting Zo must be > 0.0\n");
+						exit(1);
+					}
+			      break;
+			 case 'e':   /* type of element moved (driven, parasitic or both) */
+					if(!isdigit( (int) *optarg) )
+					{
+						error_message("Non numeric data entered for option -e which requires numeric data.\n");
+						exit(1);
+					}
+					flag->eflg=atoi(optarg);
+					if(flag->eflg < 0 || flag->eflg > 1024)
+					{
+						error_message("The '-e' option setting the type of elements moved must be an integer between 1 and 127\n");
+						exit(1);
+					}
+					if(flag->eflg==0)
+						printf("Thats odd, you dont want to move any elements (-e0 option)\n");
+			      break;
+			 case 'h':
+			      flag->hflg=1;
+					break;
+			 case 'v':
+					printf("version = %f\n", version());
+					break;
+			 case 'd':
+					flag->dflg=1;
+					break;
+			case 'g':
+				flag->gflg=atoi(optarg);
+				if(flag->gflg<1 || flag->gflg>64)
+				{
+					fprintf(stderr,"-gx, where x=1 to 64\n");
+					exit(1);
+				}
+				break;
+			case 'p':
+				flag->pflg=1;
+				if(!isdigit( (int) *optarg) && *optarg !='.')
+					{
+						error_message("Non numeric data entered for option -p which requires numeric data.\n");
+						exit(1);
+					}
+				popsize=atoi(optarg);
+				if(popsize < 2 || popsize > 10000000)
+				{
+						error_message("The '-p' option setting the population size of the genetric algorithm, mush be between 2 amd 1000000\n");
+						exit(1);
+				}
+				break;
+			case 't':
+				flag->tflg=1;
+				if(!isdigit( (int) *optarg) && *optarg !='.')
+					{
+						error_message("Non numeric data entered for option -t which requires numeric data.\n");
+						exit(1);
+					}
+				length_sd=atof(optarg); /* SD on lengths, in mm */
+				if(length_sd < 0 )
+				{
+						error_message("The '-t' option setting the standard deviation of the element lengths must be > 0\n");
+						exit(1);
+				}
+				break;
+			case 'T':
+				flag->Tflg=1;
+				if(!isdigit( (int) *optarg) && *optarg !='.')
+					{
+						error_message("Non numeric data entered for option -T which requires numeric data.\n");
+						exit(1);
+					}
+				boom_sd=atof(optarg); /* SD on lengths, in mm */
+				if(boom_sd < 0 )
+				{
+						error_message("The '-T' option setting the standard deviation of the boom postions must be > 0\n");
+						exit(1);
+				}
+				break;
+			 case '?':
+			   flag->errflg++;
+				break;
+	 }
+	 if(flag->Oflg)
+	 {
+		flag->oflg-=32768;
+	 }
+}
diff --git a/src/get_number_of_elements.c b/src/get_number_of_elements.c
new file mode 100644
index 0000000..37c831f
--- /dev/null
+++ b/src/get_number_of_elements.c
@@ -0,0 +1,72 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include "yagi.h"
+
+extern int errno;
+
+int get_number_of_elements(char *input_filename, int *driven , int *parasitic)
+{
+	FILE *ifp;
+	char *null, *line;
+	int num_elements;
+
+	null=string(0L,12L);
+	line=string(0L,81L);
+	ifp=fopen(input_filename, "rt");
+	*driven=-1;
+	*parasitic=-1;
+	if(ifp == NULL)
+	{
+		fprintf(stderr,"Sorry, cant find file:  %s\n", input_filename);
+		exit(2);
+	}
+	/* Read line by line, looking for data on number of elements */
+	while(!feof(ifp))
+	{
+		fgets(line, 80, ifp);
+		if(strncmp(line,"ELEMENTS",8) == 0)  
+		{
+			sscanf(line,"%s %d\n", null, &num_elements);						
+		}
+		if(strncmp(line,"DRIVEN",6) == 0)  
+		{
+			sscanf(line,"%s %d\n", null, driven);						
+		}
+		if(strncmp(line,"PARASITIC",8) == 0)  
+		{
+			sscanf(line,"%s %d\n", null, parasitic);						
+		}
+	}
+#ifdef DEBUG
+	errno=0;
+#endif
+	fclose(ifp);
+	if(num_elements == -1)
+		fprintf(stderr,"Error in data file %s: ELEMENTS undefined\n",input_filename); 
+	if(*driven == -1)
+		fprintf(stderr,"Error in data file %s : DRIVEN undefined\n", input_filename); 
+	if(*parasitic == -1)
+		fprintf(stderr,"Error in data file %s: PARASITIC undefined\n", input_filename); 
+	if(num_elements != *driven + *parasitic)
+	{
+		fprintf(stderr,"Check ELEMENTS, DRIVEN & PARASITIC in data file %s\n", input_filename);
+		fprintf(stderr,"ELEMENTS = %d DRIVEN = %d PARASITIC = %d\n", num_elements,      *driven, *parasitic);
+		exit(3);
+	}
+	free_string(line,0L,81L);
+	free_string(null,0L,12L);
+
+#ifdef DEBUG
+	if(errno)
+	{
+		fprintf(stderr,"Errno =%d in mum_elem.c\n", errno);
+		exit(1);
+	}
+#endif
+	return(num_elements);
+}
+
diff --git a/src/getfiles.c b/src/getfiles.c
new file mode 100644
index 0000000..6bce416
--- /dev/null
+++ b/src/getfiles.c
@@ -0,0 +1,30 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include "yagi.h"
+
+extern int errno;
+
+/* This routine checks the number of arguments. If thats OK, the 
+only arguemnt is the input data file. The output data file name is
+got by adding '.out' to the input data file name. */
+char *get_data_filenames(int optind, char **argv, char *input)
+{
+	char *output;
+	output=string(0L,100L);
+	strcpy(input, argv[optind]);
+	strcpy(output, argv[optind]);
+	strcat(output,".out");
+
+#ifdef DEBUG
+	if(errno)
+	{
+		fprintf(stderr,"Errno =%d in get_data_filenames() of getfiles.c\n", errno);
+		exit(1);
+	}
+#endif
+	return(output);
+}
diff --git a/src/getopt.c b/src/getopt.c
new file mode 100644
index 0000000..70281bd
--- /dev/null
+++ b/src/getopt.c
@@ -0,0 +1,106 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+/*
+ * Here's something you've all been waiting for:  the AT&T public domain
+ * source for getopt(3).  It is the code which was given out at the 1985
+ * UNIFORUM conference in Dallas.  I obtained it by electronic mail
+ * directly from AT&T.  The people there assure me that it is indeed
+ * in the public domain.
+ * 
+ * There is no manual page.  That is because the one they gave out at
+ * UNIFORUM was slightly different from the current System V Release 2
+ * manual page.  The difference apparently involved a note about the
+ * famous rules 5 and 6, recommending using white space between an option
+ * and its first argument, and not grouping options that have arguments.
+ * Getopt itself is currently lenient about both of these things White
+ * space is allowed, but not mandatory, and the last option in a group can
+ * have an argument.  That particular version of the man page evidently
+ * has no official existence, and my source at AT&T did not send a copy.
+ * The current SVR2 man page reflects the actual behavor of this getopt.
+ * However, I am not about to post a copy of anything licensed by AT&T.
+ */
+
+#include <stdio.h>
+#include <strings.h>
+#include <string.h>
+
+/*LINTLIBRARY*/
+#ifndef NULL
+#define NULL    0
+#endif
+#define EOF     (-1)
+
+
+int     opterr = 1;
+int     optind = 1;
+int     optopt;
+char    *optarg;
+
+void ERR(char *s, char c, char **argv)  
+{
+	if(opterr)
+	{
+		char errbuf[2];
+		errbuf[0] = c;
+		errbuf[1] = '\n';
+		/* (void) write(2, argv[0], (unsigned)strlen(argv[0]));
+		(void) write(2, s, (unsigned)strlen(s));
+		(void) write(2, errbuf, 2); */
+		(void) fwrite(argv[0], (unsigned)strlen(argv[0]),1,stderr);
+		(void) fwrite(s, (unsigned)strlen(s),1,stderr);
+		(void) fwrite(errbuf, 2, 1,stderr); 
+	}
+}
+
+char *index2(char *str, char c)
+{
+	char *ret;
+	ret=strchr(str,c);
+	return(ret);
+}
+
+
+int getoptions(int argc, char **argv, char *opts)
+{
+	static int sp = 1;
+	register int c;
+	register char *cp;
+
+	if(sp == 1)
+		if(optind >= argc ||
+		   argv[optind][0] != '-' || argv[optind][1] == '\0')
+			return(EOF);
+		else if(strcmp(argv[optind], "--") == 0) {
+			optind++;
+			return(EOF);
+		}
+	optopt = c = argv[optind][sp];
+	if(c == ':' || (cp=index2(opts, c)) == NULL) {
+		ERR(": illegal option -- ", c,argv);
+		if(argv[optind][++sp] == '\0') {
+			optind++;
+			sp = 1;
+		}
+		return('?');
+	}
+	if(*++cp == ':') {
+		if(argv[optind][sp+1] != '\0')
+			optarg = &argv[optind++][sp+1];
+		else if(++optind >= argc) {
+			ERR(": option requires an argument -- ", c,argv);
+			sp = 1;
+			return('?');
+		} else
+			optarg = argv[optind++];
+		sp = 1;
+	} else {
+		if(argv[optind][++sp] == '\0') {
+			sp = 1;
+			optind++;
+		}
+		optarg = NULL;
+	}
+	return(c);
+}
diff --git a/src/globals.h b/src/globals.h
new file mode 100644
index 0000000..ab91bd2
--- /dev/null
+++ b/src/globals.h
@@ -0,0 +1,16 @@
+extern char     *optarg;
+extern int optind, opterr;
+extern int errno;
+
+double original_percent=10; /* Automatic changing: 10, to 1, then 0.1 then 0.01% */
+double percent;
+double magnitude, phase;
+double Zo=Z0; /* Z0 is defined in yagi.h, Zo can be set in optimise */
+struct performance_data weight,max;
+double max_gain=1, boom_factor=1000, diameter, best_perf;
+int popsize=0;
+int iterations, fitness_method=0;
+double vswr=1.0;
+double boom_sd, length_sd;
+int errno;
+int K_times=1, K_times_max=10;
diff --git a/src/input.c b/src/input.c
new file mode 100644
index 0000000..eb254ef
--- /dev/null
+++ b/src/input.c
@@ -0,0 +1,210 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+/* This program, called 'input' asks the user for information about the
+yagi. This includes the number of elements, design frequency, dimension and
+locations of elements.  It also asks for a range of frequencies to plot
+the antenna details over (eg 144-146MHz) and an angular step size (eg 5deg)
+over which the antenna pattern is plotted in both theta and phi (in this case
+0deg, 5deg, 10deg, 15 deg ... 180deg). This program just writes all this
+information into a file, which can be read by 'yagi'. The file created by
+this program has the extension .out and is a text file, so it can be editied 
+manually if required. Be warned though,  'yagi' may not report errors in the
+.out file, so extreme care is necessary if the .out file file is edited
+manually! 
+*/
+
+#include <stdio.h>
+#include <malloc.h>
+#include <math.h>
+#include "nrutil.h"
+#include "yagi.h"
+
+extern int optind, opterr;
+
+int main(int argc, char **argv)
+{
+	double frequency, diameter, **d, **p;
+	double min_f, max_f, step_f, angular_step;
+	int elements, driven, i, fixed_diameter, boom, parasitic, c, hflg=0, errflg=0;
+	double scale_factor;
+	char response, *filename, *notes, *type, data_entry;
+	FILE *fp;
+
+	filename = string(0L, 1000L);
+	notes = string(0L, 1000L);
+	type = string(0L, 1000L);
+
+   while ((c =	getoptions(argc,argv,"h")) != -1)
+   switch	(c) 
+   {
+			 case 'h':  /* help */
+				hflg=1;
+			      	break;
+			 case '?':   /*  */
+				errflg=1;
+				break;
+	}
+	if(hflg || errflg)
+	{
+		usage_input(argv[0]);
+		exit(0);
+	}
+	printf("Yagi-Uda antenna analysis programs, version %.2f\n", version());
+	printf("Written by Dr. David Kirkby Ph.D. (G8WRB, email:david.kirkby at onetel.net)\n");
+	printf("\nThis program asks for length, diameter and position of antenna elements then\n");
+	printf("writes them to a file you specify. Data is written in m (metres)\n \n");
+	printf("Enter any notes on this design (up to 400 characters): ");
+	gets(notes);
+	printf("Enter a filename to write data to ");
+	gets(filename);
+	printf("Enter the centre frequency in MHz ");
+	scanf("%lf", &frequency);
+	printf("Enter the minimum frequency in MHz ");
+	scanf("%lf", &min_f);
+	printf("Enter the maximum frequency in MHz ");
+	scanf("%lf", &max_f);
+	printf("Enter the frequency steps in MHz ");
+	scanf("%lf", &step_f);
+	if(min_f > frequency)
+		nrerror("The minimum frequency has been set higher than the centre frequency");
+	if(max_f < frequency)
+		nrerror("The maximum frequency has been set lower than the centre frequency");
+	printf("\nData can be entered in imperial (inches) metric (mm) or wavelengths (lambda)\n");
+	printf("Please enter i (for imperial), m (for metric) or w (for wavelengths). ");
+	scanf("%c", &data_entry);
+	scanf("%c", &data_entry);
+	/* The file produced by this is always written in metres.  */
+	if(data_entry=='i' || data_entry=='I')
+	{
+		scale_factor=39.37; /* inches in 1m */
+		type="\"\"";
+	}
+	else if(data_entry=='m' || data_entry=='m')
+	{
+		scale_factor=1000.0; /* mm in 1m */
+		type="mm";
+	}
+	else if(data_entry=='w' || data_entry=='w')
+	{
+		scale_factor=frequency/300; /* wavelegths in 1m */
+		type="lambda";
+	}
+	else
+		exit(1);
+	printf("Enter the number of elements for the antenna ");
+	scanf("%d",&elements);
+	/* printf("Enter the number of driven elements ");
+	scanf("%d", &driven); */
+	driven=1;
+	parasitic=elements-driven;
+	d=dmatrix(1L, (long) driven, 1L, 6L);
+	p=dmatrix(1L, (long) parasitic , 1L, 4L);
+	printf("Enter the angular step size in degrees for the gain to be plotted ");
+	scanf("%lf",&angular_step);
+	/* printf("Are any of the elements tappered? ");
+	scanf("%c", &response);
+	scanf("%c", &response);
+	if(response =='y' || response == 'Y')
+	{
+		tappered=TRUE;
+		printf("\nSorry: this program as yet can't handle tapered elements.\n");
+		exit(1);
+	}
+	*/
+	printf("Are all the elements of the same diameter ? ");
+	scanf("%c",&response);
+	scanf("%c",&response);
+	if(response=='Y' || response =='y')
+	{
+		printf("Enter the diameter of the elements (in %s) ", type);
+		scanf("%lf", &diameter);
+		fixed_diameter=TRUE;
+	}
+	else
+		fixed_diameter=FALSE;
+	boom=TRUE;
+	for(i=1;i<=driven;++i) 
+	{
+		printf("\n\nEnter location of the driven element in %s (wrt. reflector at x=0) ", type);
+		scanf("%lf", &d[i][X]);
+		d[i][Y]=0;	
+		if( boom != TRUE)
+		{
+			printf("Enter the y position of the driven element (in %s) ", type);
+			scanf("%lf", &d[i][Y]);
+		}
+		else
+			d[i][Y]=0.0;
+		printf("Enter length of the driven element (in %s) ", type);
+		scanf("%lf", &d[i][LENGTH]);
+		if(fixed_diameter == TRUE)
+			d[i][DIAMETER]=diameter;
+		else
+		{
+			printf("Enter the diameter of the driven element (in %s) ", type);
+			scanf("%lf", &d[i][DIAMETER]);
+		}
+		/*
+		printf("Enter the voltage driving this element ");
+		scanf("%lf", &d[i][VOLTAGE_R]);
+		printf("Enter the phase driving this element ");
+		scanf("%lf", &d[i][VOLTAGE_I]);
+		*/
+		d[i][VOLTAGE_R]=1.0;
+		d[i][VOLTAGE_I]=0.0;
+	}
+	for(i=1;i<=elements-driven;++i) 
+	{
+	        if(i==1) /* The reflector */
+		{
+		   printf("\nEnter length of the reflector (in %s) ", type);
+		   scanf("%lf", &p[1][LENGTH]);
+		   if(boom != TRUE)
+		   {
+			printf("\nEnter the y position of the reflector (in %s) ", type);
+			scanf("%lf", &p[i][Y]);
+		   }
+		   if(fixed_diameter == TRUE)
+			p[i][DIAMETER]=diameter;
+		   else
+		   {
+			printf("Enter the diameter of the reflector (in %s) ", type);
+			scanf("%lf", &p[i][DIAMETER]);
+		   }
+		}
+		else /* a director */
+		{
+		   printf("\n\nEnter location of director %d in %s (wrt. reflector at x=0.0) ", i-1, type);
+		   scanf("%lf", &p[i][X]);
+		   if( boom != TRUE)
+		   {
+			printf("Enter the y position of director %d (in %s) ", i-1, type);
+			scanf("%lf", &p[i][Y]);
+		   }
+		   else
+			p[i][Y]=0.0;
+		   printf("Enter the length of director %d (in %s) ", i-1,type);
+		   scanf("%lf", &p[i][LENGTH]);
+		   if(fixed_diameter == TRUE)
+			p[i][DIAMETER]=diameter;
+		   else
+		   {
+			printf("Enter the diameter of director %d (in %s) ", i-1, type);
+			scanf("%lf", &p[i][DIAMETER]);
+		   }
+		}
+	}
+	/* Now write data to disk */
+	fp=fopen(filename,"wt");
+	write_input_data_to_disk(fp, notes, frequency, min_f, max_f, step_f, elements   , driven, parasitic, angular_step, d, p, scale_factor); 
+	fclose(fp);
+	free_string(filename,0L, 1000L);
+	free_string(notes,0L, 1000L);
+	free_string(type,0L, 1000L);
+	free_dmatrix(d, 1L, (long) driven, 1L, 6L);
+	free_dmatrix(p, 1L, (long) parasitic , 1L, 4L);
+	exit(0);
+}
+
diff --git a/src/install-sh b/src/install-sh
new file mode 100644
index 0000000..e9de238
--- /dev/null
+++ b/src/install-sh
@@ -0,0 +1,251 @@
+#!/bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5 (mit/util/scripts/install.sh).
+#
+# Copyright 1991 by the Massachusetts Institute of Technology
+#
+# Permission to use, copy, modify, distribute, and sell this software and its
+# documentation for any purpose is hereby granted without fee, provided that
+# the above copyright notice appear in all copies and that both that
+# copyright notice and this permission notice appear in supporting
+# documentation, and that the name of M.I.T. not be used in advertising or
+# publicity pertaining to distribution of the software without specific,
+# written prior permission.  M.I.T. makes no representations about the
+# suitability of this software for any purpose.  It is provided "as is"
+# without express or implied warranty.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.  It can only install one file at a time, a restriction
+# shared with many OS's install programs.
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+    case $1 in
+	-c) instcmd="$cpprog"
+	    shift
+	    continue;;
+
+	-d) dir_arg=true
+	    shift
+	    continue;;
+
+	-m) chmodcmd="$chmodprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-o) chowncmd="$chownprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-g) chgrpcmd="$chgrpprog $2"
+	    shift
+	    shift
+	    continue;;
+
+	-s) stripcmd="$stripprog"
+	    shift
+	    continue;;
+
+	-t=*) transformarg=`echo $1 | sed 's/-t=//'`
+	    shift
+	    continue;;
+
+	-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+	    shift
+	    continue;;
+
+	*)  if [ x"$src" = x ]
+	    then
+		src=$1
+	    else
+		# this colon is to work around a 386BSD /bin/sh bug
+		:
+		dst=$1
+	    fi
+	    shift
+	    continue;;
+    esac
+done
+
+if [ x"$src" = x ]
+then
+	echo "install:	no input file specified"
+	exit 1
+else
+	true
+fi
+
+if [ x"$dir_arg" != x ]; then
+	dst=$src
+	src=""
+	
+	if [ -d $dst ]; then
+		instcmd=:
+		chmodcmd=""
+	else
+		instcmd=mkdir
+	fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad 
+# if $src (and thus $dsttmp) contains '*'.
+
+	if [ -f $src -o -d $src ]
+	then
+		true
+	else
+		echo "install:  $src does not exist"
+		exit 1
+	fi
+	
+	if [ x"$dst" = x ]
+	then
+		echo "install:	no destination specified"
+		exit 1
+	else
+		true
+	fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+	if [ -d $dst ]
+	then
+		dst="$dst"/`basename $src`
+	else
+		true
+	fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+#  this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='	
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+	pathcomp="${pathcomp}${1}"
+	shift
+
+	if [ ! -d "${pathcomp}" ] ;
+        then
+		$mkdirprog "${pathcomp}"
+	else
+		true
+	fi
+
+	pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+	$doit $instcmd $dst &&
+
+	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+	if [ x"$transformarg" = x ] 
+	then
+		dstfile=`basename $dst`
+	else
+		dstfile=`basename $dst $transformbasename | 
+			sed $transformarg`$transformbasename
+	fi
+
+# don't allow the sed command to completely eliminate the filename
+
+	if [ x"$dstfile" = x ] 
+	then
+		dstfile=`basename $dst`
+	else
+		true
+	fi
+
+# Make a temp file name in the proper directory.
+
+	dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+	$doit $instcmd $src $dsttmp &&
+
+	trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing.  If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+	if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+	if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+	if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+	if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+	$doit $rmcmd -f $dstdir/$dstfile &&
+	$doit $mvcmd $dsttmp $dstdir/$dstfile 
+
+fi &&
+
+
+exit 0
diff --git a/src/linear.c b/src/linear.c
new file mode 100644
index 0000000..e8863ce
--- /dev/null
+++ b/src/linear.c
@@ -0,0 +1,44 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <math.h>
+#include "yagi.h"
+
+/* This function attemnts to optimise by setting the currents of the last N
+(user specifies N) directios to have the same magnitude of cureent. We do this
+by computing the currents in the last N directors, then finding the sd from the
+mean. Then we optimise to reduce the sd. We take as one argument the 'old_sd'
+. If we manage to reduce it, we change this value. */
+
+int linear_current_optimisation_test(struct FCOMPLEX *cur, double *old_sd, int elements, int parasites, struct flags flag) 
+{
+	double mean, SD, current_on_this_element, sum_of_squares=0.0, total_I=0.0;
+	int total_elements_tested,k;
+	total_elements_tested=flag.Cflg; /* The user wants to test this number */
+	if(total_elements_tested > elements -1)
+	{
+		printf("We can only try to get the currents similar on the %d elements, and we dont have the %d elements that you requsted via the -C option\n", elements-1, flag.Cflg);
+		exit(1);
+	}
+	for(k=elements; k>elements-total_elements_tested; k--)
+	{
+		current_on_this_element=sqrt(cur[k].r*cur[k].r+cur[k].i*cur[k].i);
+		total_I+=current_on_this_element;
+	}
+	/* find the mean element current */
+	mean=total_I/(double)(total_elements_tested);
+	/* now find sum of the squares of the deviations form the mean */
+	for(k=elements; k>=elements-total_elements_tested; k--)
+	{
+		sum_of_squares+=pow(sqrt(cur[k].r*cur[k].r+cur[k].i*cur[k].i)-mean,2.0);
+	}
+	SD=sum_of_squares/(double) (elements-1);
+	if(SD <  *old_sd)
+	{
+		*old_sd=SD;
+		return(TRUE); /* currents are closer to being equal */
+	}
+	else
+		return(FALSE);
+}
diff --git a/src/lub_hack.c b/src/lub_hack.c
new file mode 100644
index 0000000..1770812
--- /dev/null
+++ b/src/lub_hack.c
@@ -0,0 +1,25 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include "yagi.h"
+
+void lubksb(double **a, int n, int *indx, double b[])
+{
+	int i,ii=0,ip,j;
+	double sum;
+
+	for (i=1;i<=n;i++) {
+		ip=indx[i];
+		sum=b[ip];
+		b[ip]=b[i];
+		if (ii)
+			for (j=ii;j<=i-1;j++) sum -= a[i][j]*b[j];
+		else if (sum) ii=i;
+		b[i]=sum;
+	}
+	for (i=n;i>=1;i--) {
+		sum=b[i];
+		for (j=i+1;j<=n;j++) sum -= a[i][j]*b[j];
+		b[i]=sum/a[i][i];
+	}
+}
diff --git a/src/lud_hack.c b/src/lud_hack.c
new file mode 100644
index 0000000..afae0af
--- /dev/null
+++ b/src/lud_hack.c
@@ -0,0 +1,62 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <math.h>
+#define NRANSI
+#include "nrutil.h" 
+/* #include "yagi.h" */
+#define TINY 1.0e-20;
+
+void ludcmp(double **a, int n, int *indx, double *d)
+{
+	int i,imax,j,k;
+	double big,dum,sum,temp;
+	double *vv;
+
+	vv=dvector(1,n);
+	*d=1.0;
+	for (i=1;i<=n;i++) {
+		big=0.0;
+		for (j=1;j<=n;j++)
+			if ((temp=fabs(a[i][j])) > big) big=temp;
+		if (big == 0.0) nrerror("Singular matrix in routine ludcmp");
+		vv[i]=1.0/big;
+	}
+	for (j=1;j<=n;j++) {
+		for (i=1;i<j;i++) {
+			sum=a[i][j];
+			for (k=1;k<i;k++) sum -= a[i][k]*a[k][j];
+			a[i][j]=sum;
+		}
+		big=0.0;
+		for (i=j;i<=n;i++) {
+			sum=a[i][j];
+			for (k=1;k<j;k++)
+				sum -= a[i][k]*a[k][j];
+			a[i][j]=sum;
+			if ( (dum=vv[i]*fabs(sum)) >= big) {
+				big=dum;
+				imax=i;
+			}
+		}
+		if (j != imax) {
+			for (k=1;k<=n;k++) {
+				dum=a[imax][k];
+				a[imax][k]=a[j][k];
+				a[j][k]=dum;
+			}
+			*d = -(*d);
+			vv[imax]=vv[j];
+		}
+		indx[j]=imax;
+		if (a[j][j] == 0.0) a[j][j]=TINY;
+		if (j != n) {
+			dum=1.0/(a[j][j]);
+			for (i=j+1;i<=n;i++) a[i][j] *= dum;
+		}
+	}
+	free_dvector(vv,1,n);
+}
+#undef TINY
+#undef NRANSI
+/* (C) Copr. 1986-92 Numerical Recipes Software 5#,. */
diff --git a/src/max_gain.c b/src/max_gain.c
new file mode 100644
index 0000000..6543209
--- /dev/null
+++ b/src/max_gain.c
@@ -0,0 +1,59 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <math.h>
+#include <errno.h>
+#include "yagi.h"
+
+extern int errno;
+
+/* The maximum gain of a Yagi is given in the ARRL handbook, 1991, pp33-17
+as 12dB at one wavelength boom length, rising at 2.6 dB 
+each time boom lengtrh is doubled */
+
+double determine_maximum_gain(double f, double boom_length_in_m)
+{
+	double lambda, wavelengths, max_gain;
+
+	lambda=3e8/f;
+
+	wavelengths=boom_length_in_m/lambda; /* boom length in wavelengths */
+	if(wavelengths < 1)
+		max_gain=8.0;
+	else
+		max_gain = 12.0 + 2.6*log2(wavelengths);
+#ifdef DEBUG
+	if(errno)
+	{
+		fprintf(stderr,"Errno =%d in determine_maximum_gain() of max_gain.c\n", errno);
+		exit(1);
+	}
+#endif
+	return(max_gain);
+	
+}
+/* This is another algorithm. Its not as accurate as above, but it gives the
+same result form given number of elements. This allows more accurate comparison
+of fitnesss'es for the GA and -W algorithm, which would otherwise not be possible. */
+double determine_maximum_gain2(int elements)
+{
+	double wavelengths, max_gain;
+
+
+	wavelengths=(elements-1)*0.25; /* boom length in wavelengths */
+	max_gain = 12.0 + 2.6*log2(wavelengths);
+#ifdef DEBUG
+	if(errno)
+	{
+		fprintf(stderr,"Errno =%d in determine_maximum_gain2() of max_gain.c\n", errno);
+		exit(1);
+	}
+#endif
+	return(max_gain);
+	
+}
+double log2(double x)
+{
+	return(log(x)/0.6931471);
+}
diff --git a/src/max_side.c b/src/max_side.c
new file mode 100644
index 0000000..e707142
--- /dev/null
+++ b/src/max_side.c
@@ -0,0 +1,108 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <math.h>
+#include "nrutil.h"
+#include "yagi.h"
+
+/* This routines finds the maximum sidelobe level in the antenna pattern, 
+outside the main beam. The fasteest one, find_max_sidelobe_fast is used by
+optimise when seeing how clean the pattern is. Its not perfect, but its
+fast. 
+
+The other one, find_max_sidelobe_slow is much more accurate, doing a good
+job of finding the sidelobes, but takes longer to do. Hence its not
+really suitable for optimisation, but its okay for 'output' where we dont
+care too much about spped. */
+
+extern double angular_stepsize_2,min_offset_from_peak;
+
+#define BETTER 1
+#define WORSE 2
+
+#define STEP  1   /* anglur step in degrees */
+
+double dB_down_from_peak(double x, double pin, struct  element_data *coordinates, struct FCOMPLEX *current,int elements, double f, double design_f)
+{
+		double ans,gain_H_plane,peak_gain, gain_at_x;
+		gain(90.0, 0.0, pin, f/design_f, coordinates, current, elements, &peak_gain, &gain_H_plane, f, design_f);
+		gain(x, 0.000, pin, f/design_f, coordinates, current, elements, &gain_at_x, &gain_H_plane, f, design_f);
+		ans=peak_gain-gain_at_x;
+		return(ans);
+}
+
+
+double find_max_sidelobe_slow(double gain, double pin,struct element_data *coordinates, struct FCOMPLEX *current, int elements, double frequency,double design_f)
+{
+	double level,best=-1000.0,a=90.0,theta,max=1e8;
+	int k;
+	do{
+		a+=STEP; /* Use 1 degree or similar step*/
+		level=dB_down_from_peak(a,pin,coordinates,current,elements,frequency,design_f);
+		if(level>best)
+		{
+			k=BETTER;
+			best=level;
+		}
+		else
+			k=WORSE;
+		}while(k==BETTER && a<=270.0);
+	a-=STEP;
+	for(theta=a; theta<270.01; theta+=STEP)
+	{
+		level=dB_down_from_peak(theta,pin,coordinates,current,elements,frequency,design_f);
+		if(level<max)
+		{
+			max=level;
+			a=theta;
+		}
+	}
+	return(max);
+}
+
+
+double find_max_sidelobe_fast(double gain, double pin,struct element_data *coordinates, struct FCOMPLEX *current, int elements, double frequency,double design_f)
+{
+	double angle=90.0,min_angle,min,max=270,three_dB_point,min_level=1000000.0;
+	double level, min_times;
+	int N;
+
+	if(min_offset_from_peak==0.0)
+	{
+		three_dB_point=sqrt(41000.0/(pow(10.0,gain/10.0))); 
+		if(three_dB_point > 90.0)
+			min=180.0;
+		else
+			min=90.0+(three_dB_point);
+	}
+	else
+		min=90.0+min_offset_from_peak;
+	if(angular_stepsize_2==0.0)
+		angular_stepsize_2=three_dB_point/30.0; /* step sixe to use - rough */
+		/* Since this is only an approximate quick method, you cant expect 
+		supeurb accuracy - use _fast if you want that. I'll evaluate at 
+		1/10th of the beamwidth, so if the 3dB beamwidth is estimated to be
+		40 deg, we will evualate every 4 deg. However, we need to evalate at
+		precise 270 degrees, otherwise its possible the max sidelobe will be 
+		less than the FB, which is silly. To avoid this, I'll ensure its   
+		evaluated at 270 deg, so the step size will be altered to do this. */
+   min_times=(max-min)/angular_stepsize_2;
+	N=(int) (min_times+1.0);
+
+	for(angle=min; angle <=max;angle+=(max-min)/N)
+	{
+		level=dB_down_from_peak(angle,pin,coordinates,current,elements,frequency,design_f);
+		if(level<min_level)
+		{
+			min_level=level;
+			min_angle=angle;
+		}
+	}
+	/* printf("min=%.2f min_angle=%.2f angle=%.2f f=%f\n ",min_level,min_angle,angle,frequency);  */
+	return(min_level);
+}
+
+
+
+			
diff --git a/src/missing b/src/missing
new file mode 100644
index 0000000..7789652
--- /dev/null
+++ b/src/missing
@@ -0,0 +1,190 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+# Franc,ois Pinard <pinard at iro.umontreal.ca>, 1996.
+
+# 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 2, 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., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+if test $# -eq 0; then
+  echo 1>&2 "Try \`$0 --help' for more information"
+  exit 1
+fi
+
+case "$1" in
+
+  -h|--h|--he|--hel|--help)
+    echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+  -h, --help      display this help and exit
+  -v, --version   output version information and exit
+
+Supported PROGRAM values:
+  aclocal      touch file \`aclocal.m4'
+  autoconf     touch file \`configure'
+  autoheader   touch file \`config.h.in'
+  automake     touch all \`Makefile.in' files
+  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
+  flex         create \`lex.yy.c', if possible, from existing .c
+  lex          create \`lex.yy.c', if possible, from existing .c
+  makeinfo     touch the output file
+  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]"
+    ;;
+
+  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+    echo "missing - GNU libit 0.0"
+    ;;
+
+  -*)
+    echo 1>&2 "$0: Unknown \`$1' option"
+    echo 1>&2 "Try \`$0 --help' for more information"
+    exit 1
+    ;;
+
+  aclocal)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`acinclude.m4' or \`configure.in'.  You might want
+         to install the \`Automake' and \`Perl' packages.  Grab them from
+         any GNU archive site."
+    touch aclocal.m4
+    ;;
+
+  autoconf)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`configure.in'.  You might want to install the
+         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
+         archive site."
+    touch configure
+    ;;
+
+  autoheader)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`acconfig.h' or \`configure.in'.  You might want
+         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
+         from any GNU archive site."
+    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.in`
+    test -z "$files" && files="config.h"
+    touch_files=
+    for f in $files; do
+      case "$f" in
+      *:*) touch_files="$touch_files "`echo "$f" |
+				       sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+      *) touch_files="$touch_files $f.in";;
+      esac
+    done
+    touch $touch_files
+    ;;
+
+  automake)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'.
+         You might want to install the \`Automake' and \`Perl' packages.
+         Grab them from any GNU archive site."
+    find . -type f -name Makefile.am -print |
+	   sed 's/\.am$/.in/' |
+	   while read f; do touch "$f"; done
+    ;;
+
+  bison|yacc)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified a \`.y' file.  You may need the \`Bison' package
+         in order for those modifications to take effect.  You can get
+         \`Bison' from any GNU archive site."
+    rm -f y.tab.c y.tab.h
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+	case "$LASTARG" in
+	*.y)
+	    SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+	    if [ -f "$SRCFILE" ]; then
+	         cp "$SRCFILE" y.tab.c
+	    fi
+	    SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+	    if [ -f "$SRCFILE" ]; then
+	         cp "$SRCFILE" y.tab.h
+	    fi
+	  ;;
+	esac
+    fi
+    if [ ! -f y.tab.h ]; then
+	echo >y.tab.h
+    fi
+    if [ ! -f y.tab.c ]; then
+	echo 'main() { return 0; }' >y.tab.c
+    fi
+    ;;
+
+  lex|flex)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified a \`.l' file.  You may need the \`Flex' package
+         in order for those modifications to take effect.  You can get
+         \`Flex' from any GNU archive site."
+    rm -f lex.yy.c
+    if [ $# -ne 1 ]; then
+        eval LASTARG="\${$#}"
+	case "$LASTARG" in
+	*.l)
+	    SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+	    if [ -f "$SRCFILE" ]; then
+	         cp "$SRCFILE" lex.yy.c
+	    fi
+	  ;;
+	esac
+    fi
+    if [ ! -f lex.yy.c ]; then
+	echo 'main() { return 0; }' >lex.yy.c
+    fi
+    ;;
+
+  makeinfo)
+    echo 1>&2 "\
+WARNING: \`$1' is missing on your system.  You should only need it if
+         you modified a \`.texi' or \`.texinfo' file, or any other file
+         indirectly affecting the aspect of the manual.  The spurious
+         call might also be the consequence of using a buggy \`make' (AIX,
+         DU, IRIX).  You might want to install the \`Texinfo' package or
+         the \`GNU make' package.  Grab either from any GNU archive site."
+    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
+    if test -z "$file"; then
+      file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
+    fi
+    touch $file
+    ;;
+
+  *)
+    echo 1>&2 "\
+WARNING: \`$1' is needed, and you do not seem to have it handy on your
+         system.  You might have modified some files without having the
+         proper tools for further handling them.  Check the \`README' file,
+         it often tells you about the needed prerequirements for installing
+         this package.  You may also peek at any GNU archive site, in case
+         some other package would contain this missing \`$1' program."
+    exit 1
+    ;;
+esac
+
+exit 0
diff --git a/src/mkinstalldirs b/src/mkinstalldirs
new file mode 100644
index 0000000..4f58503
--- /dev/null
+++ b/src/mkinstalldirs
@@ -0,0 +1,40 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+# Author: Noah Friedman <friedman at prep.ai.mit.edu>
+# Created: 1993-05-16
+# Public domain
+
+# $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $
+
+errstatus=0
+
+for file
+do
+   set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+   shift
+
+   pathcomp=
+   for d
+   do
+     pathcomp="$pathcomp$d"
+     case "$pathcomp" in
+       -* ) pathcomp=./$pathcomp ;;
+     esac
+
+     if test ! -d "$pathcomp"; then
+        echo "mkdir $pathcomp"
+
+        mkdir "$pathcomp" || lasterr=$?
+
+        if test ! -d "$pathcomp"; then
+  	  errstatus=$lasterr
+        fi
+     fi
+
+     pathcomp="$pathcomp/"
+   done
+done
+
+exit $errstatus
+
+# mkinstalldirs ends here
diff --git a/src/mpr_hack.c b/src/mpr_hack.c
new file mode 100644
index 0000000..4f8c23f
--- /dev/null
+++ b/src/mpr_hack.c
@@ -0,0 +1,21 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include "yagi.h"
+
+void mprove(double **a,double **alud,int n,int *indx,double *b,double *x)
+{
+	int j,i;
+	double sdp;
+	double *r;
+
+	r=dvector(1,n);
+	for (i=1;i<=n;i++) {
+		sdp = -b[i];
+		for (j=1;j<=n;j++) sdp += a[i][j]*x[j];
+		r[i]=sdp;
+	}
+	lubksb(alud,n,indx,r);
+	for (i=1;i<=n;i++) x[i] -= r[i];
+	free_dvector(r,1,n);
+}
diff --git a/src/mutual.c b/src/mutual.c
new file mode 100644
index 0000000..1095dcd
--- /dev/null
+++ b/src/mutual.c
@@ -0,0 +1,113 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <math.h>
+#include <errno.h>
+#include "yagi.h"
+
+extern int errno;
+
+void mutual_impedance(int i, int j, double frequency, int driven, int parasitic, double **d, double **p, double **impedance)
+{
+	double xi, yi, xj, yj, li, lj, s, lamda, real, imag, mean_length;
+	int col;
+	/* first find location x,y of first element */
+	if(i<=driven)				/* i is a  driven element*/
+	{
+		xi=d[i][X];
+		yi=d[i][Y];
+		li=d[i][LENGTH];
+	}
+	else if (i>driven)			/* i is a  parasitic  element */
+	{
+		xi=p[i-driven][X];
+		yi=p[i-driven][Y];
+		li=p[i-driven][LENGTH];
+	}
+	if(j<=driven)				/* j is a  driven element*/
+	{
+		xj=d[j][X];
+		yj=d[j][Y];
+		lj=d[j][LENGTH];
+	}
+	else if (j>driven)			/* i is a  parasitic  element */
+	{
+		col=j-driven;
+		xj=p[col][X]; 
+		yj=p[col][Y];
+		lj=p[col][LENGTH];
+	}
+	/* compute distance from element i to element j */
+	s=sqrt((xi-xj)*(xi-xj)+(yi-yj)*(yi-yj)); /* in metres */
+	mean_length=(li+lj)/2.0;
+	lamda=3e8/frequency; 
+	z21(lamda, s , mean_length , &real, &imag);
+	/* fill in Zij and Zji at the same time, as matrix is symmetric. */
+	impedance[i][(2*j)-1]=real; /* real; */
+	impedance[i][2*j]=imag; /* imag; */
+	impedance[j][2*i-1]=real; /* real; */
+	impedance[j][2*i]=imag; /* imag; */
+
+#ifdef DEBUG
+	if(errno)
+	{
+		fprintf(stderr,"Errno =%d in  mutual.c\n", errno);
+		exit(1);
+	}
+#endif
+}
+
+/* To find the mutual impedance between to arbitary length, thin elements
+I used the equations on Krauss, Antennas, McGraw Hill, 1988, pp426 and
+427. Original work from Brown and King, 'High Frequency Models in Antenna
+Investigations', Proc IRE, vol 22, pp457-480, April 1934*/
+void z21(double lamda, double d, double l, double *r21, double *x21)
+{
+
+	double  b, cos_bl, sin_bl, sin_bl_over_2, cos_bl_over_2, c, s ;
+	double t1, t2, t3, t4;
+	double si_t1, ci_t1, si_t4, ci_t4, ci_bd, si_bd;
+	double ci_t2, si_t2, ci_t3, si_t3;
+
+	b=M_PI*2/lamda;
+	t1=b*(sqrt(d*d+l*l)+l);
+	t2=0.5*b*(sqrt(4*d*d+l*l)-l);
+	t3=0.5*b*(sqrt(4*d*d+l*l)+l);
+	t4=b*(sqrt(d*d+l*l)-l);
+	/* To save findinding the same slow trigometric and ever slower
+	si and ci functions, I'll just look them up once */
+	cos_bl=cos(b*l);
+	sin_bl=sin(b*l);
+	sin_bl_over_2=sin(b*l/2);
+	cos_bl_over_2=cos(b*l/2);
+	s=sin_bl_over_2*sin_bl_over_2;
+	c=cos_bl_over_2*cos_bl_over_2;
+
+	cisi(t1, &ci_t1, &si_t1);
+	cisi(t2,&ci_t2, &si_t2);
+	cisi(t3,&ci_t3, &si_t3);
+	cisi(t4, &ci_t4, &si_t4);
+	cisi(b*d,&ci_bd, &si_bd);
+	/* Real part of mutual impedance, computed as equation on page
+	426 of Kraus */
+	*r21=(30/s)*(2*(2+cos_bl)*ci_bd
+	-4*c*( ci_t2 + ci_t3 )
+	+cos_bl*( ci_t4 + ci_t1 )
+	+sin_bl* ( si_t1 - si_t4 -2*si_t3 +2*si_t2 ) );
+
+	/* Imaginary part of mutual impedance, computed as equation on page
+	427 of Kraus */
+	*x21=(30/s)*(-2*(2+cos_bl)*si_bd
+	+4*c*( si_t2 + si_t3 )
+	-cos_bl*( si_t4 + si_t1 )
+	+sin_bl* ( ci_t1 - ci_t4 -2*ci_t3 +2*ci_t2 ) );
+#ifdef DEBUG
+	if(errno)
+	{
+		fprintf(stderr,"Errno =%d in  z21() mutual.c\n", errno);
+		exit(1);
+	}
+#endif
+}  
+
diff --git a/src/new_length.c b/src/new_length.c
new file mode 100644
index 0000000..7a15404
--- /dev/null
+++ b/src/new_length.c
@@ -0,0 +1,50 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include "yagi.h"
+
+/* The function lew_length, computes the length of a dipole to have the same
+reactance as an old dipole */
+
+double new_length(double old_l, double old_dia, double lambda, double new_dia)
+{
+	double old_r, old_x, r, x,l;
+	self(old_dia/2.0, old_l, lambda, &old_r, &old_x);
+	/* printf("old r=%f old l=%f old x=%f\n",old_r,old_l,old_x); */
+	if(old_dia > new_dia)
+		l=0.50001*lambda;	
+	else
+		l=old_l;
+	do{ 
+		l-=0.1*lambda;
+		self(new_dia/2.0, l, lambda, &r, &x);
+	}while(x>old_x);
+	l+=0.1*lambda;
+	do{ 
+		l-=0.01*lambda;
+		self(new_dia/2.0, l, lambda, &r, &x);
+	}while(x>old_x);
+	l+=0.01*lambda;
+	do{ 
+		l-=0.001*lambda;
+		self(new_dia/2.0, l, lambda, &r, &x);
+	}while(x>old_x);
+	l+=0.001*lambda;
+	do{ 
+		l-=0.0001*lambda;
+		self(new_dia/2.0, l, lambda, &r, &x);
+	}while(x>old_x);
+	l+=0.0001*lambda;
+	do{ 
+		l-=0.00001*lambda;
+		self(new_dia/2.0, l, lambda, &r, &x);
+	}while(x>old_x);
+	l+=0.00001*lambda;
+	do{ 
+		l-=0.00001*lambda;
+		self(new_dia/2.0, l, lambda, &r, &x);
+	}while(x>old_x);
+	/* printf("new r=%f new l=%f new x=%f\n",r,l,x); */
+	return(l);
+}
diff --git a/src/nr_hack.h b/src/nr_hack.h
new file mode 100644
index 0000000..3fc1806
--- /dev/null
+++ b/src/nr_hack.h
@@ -0,0 +1,19 @@
+/* Here are the prototypes of the routines that are in the book 'Numerical
+recipes in C' by Press et al, 1992. All references to 'float' in that book 
+have been changed to 'double' here. Hence the definitions are not the same.
+ie a routine:
+				 void cisi(float x, float *ci, float *si);
+
+has been changed to:
+
+             void cisi(double x, double *ci, double *si);
+
+Hence all the C routines used here *must* be converted to double. Please *dont*
+use the numerical recipes header file 'nr.h', use my 'nr_hacked.h' */
+
+
+void lubksb(double **a, int n, int *indx, double b[]); 
+void ludcmp(double **a, int n, int *indx, double *d); 
+void cisi(double x, double *ci, double *si); 
+
+/* END OF NUMERICAL RECIPES ROUTINES */
diff --git a/src/nrutil.c b/src/nrutil.c
new file mode 100644
index 0000000..195c9f9
--- /dev/null
+++ b/src/nrutil.c
@@ -0,0 +1,618 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#if defined(__STDC__) || defined(ANSI) || defined(NRANSI) /* ANSI */
+
+#include <stdio.h>
+#include <stddef.h>
+#ifndef GCC
+   
+#endif
+#define NR_END 1
+#define FREE_ARG char*
+
+void nrerror(char error_text[])
+/* Numerical Recipes standard error handler */
+{
+	fprintf(stderr,"Numerical Recipes run-time error...\n");
+	fprintf(stderr,"%s\n",error_text);
+	fprintf(stderr,"...now exiting to system...\n");
+	exit(1);
+}
+
+float *vector(long nl, long nh)
+/* allocate a float vector with subscript range v[nl..nh] */
+{
+	float *v;
+
+	v=(float *)malloc((size_t) ((nh-nl+1+NR_END)*sizeof(float)));
+	if (!v) nrerror("allocation failure in vector()");
+	return v-nl+NR_END;
+}
+
+int *ivector(long nl, long nh)
+/* allocate an int vector with subscript range v[nl..nh] */
+{
+	int *v;
+
+	v=(int *)malloc((size_t) ((nh-nl+1+NR_END)*sizeof(int)));
+	if (!v) nrerror("allocation failure in ivector()");
+	return v-nl+NR_END;
+}
+
+unsigned char *cvector(long nl, long nh)
+/* allocate an unsigned char vector with subscript range v[nl..nh] */
+{
+	unsigned char *v;
+
+	v=(unsigned char *)malloc((size_t) ((nh-nl+1+NR_END)*sizeof(unsigned char)));
+	if (!v) nrerror("allocation failure in cvector()");
+	return v-nl+NR_END;
+}
+
+unsigned long *lvector(long nl, long nh)
+/* allocate an unsigned long vector with subscript range v[nl..nh] */
+{
+	unsigned long *v;
+
+	v=(unsigned long *)malloc((size_t) ((nh-nl+1+NR_END)*sizeof(long)));
+	if (!v) nrerror("allocation failure in lvector()");
+	return v-nl+NR_END;
+}
+
+double *dvector(long nl, long nh)
+/* allocate a double vector with subscript range v[nl..nh] */
+{
+	double *v;
+	v=(double *)malloc((size_t) ((nh-nl+1+NR_END)*sizeof(double)));
+	if (!v) nrerror("allocation failure in dvector()");
+	return v-nl+NR_END;
+}
+
+float **matrix(long nrl, long nrh, long ncl, long nch)
+/* allocate a float matrix with subscript range m[nrl..nrh][ncl..nch] */
+{
+	long i, nrow=nrh-nrl+1,ncol=nch-ncl+1;
+	float **m;
+
+	/* allocate pointers to rows */
+	m=(float **) malloc((size_t)((nrow+NR_END)*sizeof(float*)));
+	if (!m) nrerror("allocation failure 1 in matrix()");
+	m += NR_END;
+	m -= nrl;
+
+	/* allocate rows and set pointers to them */
+	m[nrl]=(float *) malloc((size_t)((nrow*ncol+NR_END)*sizeof(float)));
+	if (!m[nrl]) nrerror("allocation failure 2 in matrix()");
+	m[nrl] += NR_END;
+	m[nrl] -= ncl;
+
+	for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol;
+
+	/* return pointer to array of pointers to rows */
+	return m;
+}
+
+double **dmatrix(long nrl, long nrh, long ncl, long nch)
+/* allocate a double matrix with subscript range m[nrl..nrh][ncl..nch] */
+{
+	long i, nrow=nrh-nrl+1,ncol=nch-ncl+1;
+	double **m;
+
+	/* allocate pointers to rows */
+	m=(double **) malloc((size_t)((nrow+NR_END)*sizeof(double*)));
+	if (!m) nrerror("allocation failure 1 in matrix()");
+	m += NR_END;
+	m -= nrl;
+
+	/* allocate rows and set pointers to them */
+	m[nrl]=(double *) malloc((size_t)((nrow*ncol+NR_END)*sizeof(double)));
+	if (!m[nrl]) nrerror("allocation failure 2 in matrix()");
+	m[nrl] += NR_END;
+	m[nrl] -= ncl;
+
+	for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol;
+
+	/* return pointer to array of pointers to rows */
+	return m;
+}
+
+int **imatrix(long nrl, long nrh, long ncl, long nch)
+/* allocate a int matrix with subscript range m[nrl..nrh][ncl..nch] */
+{
+	long i, nrow=nrh-nrl+1,ncol=nch-ncl+1;
+	int **m;
+
+	/* allocate pointers to rows */
+	m=(int **) malloc((size_t)((nrow+NR_END)*sizeof(int*)));
+	if (!m) nrerror("allocation failure 1 in matrix()");
+	m += NR_END;
+	m -= nrl;
+
+
+	/* allocate rows and set pointers to them */
+	m[nrl]=(int *) malloc((size_t)((nrow*ncol+NR_END)*sizeof(int)));
+	if (!m[nrl]) nrerror("allocation failure 2 in matrix()");
+	m[nrl] += NR_END;
+	m[nrl] -= ncl;
+
+	for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol;
+
+	/* return pointer to array of pointers to rows */
+	return m;
+}
+
+float **submatrix(float **a, long oldrl, long oldrh, long oldcl, long oldch,
+	long newrl, long newcl)
+/* point a submatrix [newrl..][newcl..] to a[oldrl..oldrh][oldcl..oldch] */
+{
+	long i,j,nrow=oldrh-oldrl+1,ncol=oldcl-newcl;
+	float **m;
+
+	/* allocate array of pointers to rows */
+	m=(float **) malloc((size_t) ((nrow+NR_END)*sizeof(float*)));
+	if (!m) nrerror("allocation failure in submatrix()");
+	m += NR_END;
+	m -= newrl;
+
+	/* set pointers to rows */
+	for(i=oldrl,j=newrl;i<=oldrh;i++,j++) m[j]=a[i]+ncol;
+
+	/* return pointer to array of pointers to rows */
+	return m;
+}
+
+float **convert_matrix(float *a, long nrl, long nrh, long ncl, long nch)
+/* allocate a float matrix m[nrl..nrh][ncl..nch] that points to the matrix
+declared in the standard C manner as a[nrow][ncol], where nrow=nrh-nrl+1
+and ncol=nch-ncl+1. The routine should be called with the address
+&a[0][0] as the first argument. */
+{
+	long i,j,nrow=nrh-nrl+1,ncol=nch-ncl+1;
+	float **m;
+
+	/* allocate pointers to rows */
+	m=(float **) malloc((size_t) ((nrow+NR_END)*sizeof(float*)));
+	if (!m) nrerror("allocation failure in convert_matrix()");
+	m += NR_END;
+	m -= nrl;
+
+	/* set pointers to rows */
+	m[nrl]=a-ncl;
+	for(i=1,j=nrl+1;i<nrow;i++,j++) m[j]=m[j-1]+ncol;
+	/* return pointer to array of pointers to rows */
+	return m;
+}
+
+float ***f3tensor(long nrl, long nrh, long ncl, long nch, long ndl, long ndh)
+/* allocate a float 3tensor with range t[nrl..nrh][ncl..nch][ndl..ndh] */
+{
+	long i,j,nrow=nrh-nrl+1,ncol=nch-ncl+1,ndep=ndh-ndl+1;
+	float ***t;
+
+	/* allocate pointers to pointers to rows */
+	t=(float ***) malloc((size_t)((nrow+NR_END)*sizeof(float**)));
+	if (!t) nrerror("allocation failure 1 in f3tensor()");
+	t += NR_END;
+	t -= nrl;
+
+	/* allocate pointers to rows and set pointers to them */
+	t[nrl]=(float **) malloc((size_t)((nrow*ncol+NR_END)*sizeof(float*)));
+	if (!t[nrl]) nrerror("allocation failure 2 in f3tensor()");
+	t[nrl] += NR_END;
+	t[nrl] -= ncl;
+
+	/* allocate rows and set pointers to them */
+	t[nrl][ncl]=(float *) malloc((size_t)((nrow*ncol*ndep+NR_END)*sizeof(float)));
+	if (!t[nrl][ncl]) nrerror("allocation failure 3 in f3tensor()");
+	t[nrl][ncl] += NR_END;
+	t[nrl][ncl] -= ndl;
+
+	for(j=ncl+1;j<=nch;j++) t[nrl][j]=t[nrl][j-1]+ndep;
+	for(i=nrl+1;i<=nrh;i++) {
+		t[i]=t[i-1]+ncol;
+		t[i][ncl]=t[i-1][ncl]+ncol*ndep;
+		for(j=ncl+1;j<=nch;j++) t[i][j]=t[i][j-1]+ndep;
+	}
+
+	/* return pointer to array of pointers to rows */
+	return t;
+}
+
+void free_vector(float *v, long nl, long nh)
+/* free a float vector allocated with vector() */
+{
+	free((FREE_ARG) (v+nl-NR_END));
+}
+
+void free_ivector(int *v, long nl, long nh)
+/* free an int vector allocated with ivector() */
+{
+	free((FREE_ARG) (v+nl-NR_END));
+}
+
+void free_cvector(unsigned char *v, long nl, long nh)
+/* free an unsigned char vector allocated with cvector() */
+{
+	free((FREE_ARG) (v+nl-NR_END));
+}
+
+void free_lvector(unsigned long *v, long nl, long nh)
+/* free an unsigned long vector allocated with lvector() */
+{
+	free((FREE_ARG) (v+nl-NR_END));
+}
+
+void free_dvector(double *v, long nl, long nh)
+/* free a double vector allocated with dvector() */
+{
+	free((FREE_ARG) (v+nl-NR_END));
+}
+
+void free_matrix(float **m, long nrl, long nrh, long ncl, long nch)
+/* free a float matrix allocated by matrix() */
+{
+	free((FREE_ARG) (m[nrl]+ncl-NR_END));
+	free((FREE_ARG) (m+nrl-NR_END));
+}
+
+void free_dmatrix(double **m, long nrl, long nrh, long ncl, long nch)
+/* free a double matrix allocated by dmatrix() */
+{
+	free((FREE_ARG) (m[nrl]+ncl-NR_END));
+	free((FREE_ARG) (m+nrl-NR_END));
+}
+
+void free_imatrix(int **m, long nrl, long nrh, long ncl, long nch)
+/* free an int matrix allocated by imatrix() */
+{
+	free((FREE_ARG) (m[nrl]+ncl-NR_END));
+	free((FREE_ARG) (m+nrl-NR_END));
+}
+
+void free_submatrix(float **b, long nrl, long nrh, long ncl, long nch)
+/* free a submatrix allocated by submatrix() */
+{
+	free((FREE_ARG) (b+nrl-NR_END));
+}
+
+void free_convert_matrix(float **b, long nrl, long nrh, long ncl, long nch)
+/* free a matrix allocated by convert_matrix() */
+{
+	free((FREE_ARG) (b+nrl-NR_END));
+}
+
+void free_f3tensor(float ***t, long nrl, long nrh, long ncl, long nch,
+	long ndl, long ndh)
+/* free a float f3tensor allocated by f3tensor() */
+{
+	free((FREE_ARG) (t[nrl][ncl]+ndl-NR_END));
+	free((FREE_ARG) (t[nrl]+ncl-NR_END));
+	free((FREE_ARG) (t+nrl-NR_END));
+}
+
+#else /* ANSI */
+/* traditional - K&R */
+
+#include <stdio.h>
+#define NR_END 1
+#define FREE_ARG char*
+
+void nrerror(error_text)
+char error_text[];
+/* Numerical Recipes standard error handler */
+{
+	void exit();
+
+	fprintf(stderr,"Numerical Recipes run-time error...\n");
+	fprintf(stderr,"%s\n",error_text);
+	fprintf(stderr,"...now exiting to system...\n");
+	exit(1);
+}
+
+float *vector(nl,nh)
+long nh,nl;
+/* allocate a float vector with subscript range v[nl..nh] */
+{
+	float *v;
+
+	v=(float *)malloc((unsigned int) ((nh-nl+1+NR_END)*sizeof(float)));
+	if (!v) nrerror("allocation failure in vector()");
+	return v-nl+NR_END;
+}
+
+int *ivector(nl,nh)
+long nh,nl;
+/* allocate an int vector with subscript range v[nl..nh] */
+{
+	int *v;
+
+	v=(int *)malloc((unsigned int) ((nh-nl+1+NR_END)*sizeof(int)));
+	if (!v) nrerror("allocation failure in ivector()");
+	return v-nl+NR_END;
+}
+
+unsigned char *cvector(nl,nh)
+long nh,nl;
+/* allocate an unsigned char vector with subscript range v[nl..nh] */
+{
+	unsigned char *v;
+
+	v=(unsigned char *)malloc((unsigned int) ((nh-nl+1+NR_END)*sizeof(unsigned char)));
+	if (!v) nrerror("allocation failure in cvector()");
+	return v-nl+NR_END;
+}
+
+unsigned long *lvector(nl,nh)
+long nh,nl;
+/* allocate an unsigned long vector with subscript range v[nl..nh] */
+{
+	unsigned long *v;
+
+	v=(unsigned long *)malloc((unsigned int) ((nh-nl+1+NR_END)*sizeof(long)));
+	if (!v) nrerror("allocation failure in lvector()");
+	return v-nl+NR_END;
+}
+
+double *dvector(nl,nh)
+long nh,nl;
+/* allocate a double vector with subscript range v[nl..nh] */
+{
+	double *v;
+
+	v=(double *)malloc((unsigned int) ((nh-nl+1+NR_END)*sizeof(double)));
+	if (!v) nrerror("allocation failure in dvector()");
+	return v-nl+NR_END;
+}
+
+float **matrix(nrl,nrh,ncl,nch)
+long nch,ncl,nrh,nrl;
+/* allocate a float matrix with subscript range m[nrl..nrh][ncl..nch] */
+{
+	long i, nrow=nrh-nrl+1,ncol=nch-ncl+1;
+	float **m;
+
+	/* allocate pointers to rows */
+	m=(float **) malloc((unsigned int)((nrow+NR_END)*sizeof(float*)));
+	if (!m) nrerror("allocation failure 1 in matrix()");
+	m += NR_END;
+	m -= nrl;
+
+	/* allocate rows and set pointers to them */
+	m[nrl]=(float *) malloc((unsigned int)((nrow*ncol+NR_END)*sizeof(float)));
+	if (!m[nrl]) nrerror("allocation failure 2 in matrix()");
+	m[nrl] += NR_END;
+	m[nrl] -= ncl;
+
+	for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol;
+
+	/* return pointer to array of pointers to rows */
+	return m;
+}
+
+double **dmatrix(nrl,nrh,ncl,nch)
+long nch,ncl,nrh,nrl;
+/* allocate a double matrix with subscript range m[nrl..nrh][ncl..nch] */
+{
+	long i, nrow=nrh-nrl+1,ncol=nch-ncl+1;
+	double **m;
+
+	/* allocate pointers to rows */
+	m=(double **) malloc((unsigned int)((nrow+NR_END)*sizeof(double*)));
+	if (!m) nrerror("allocation failure 1 in matrix()");
+	m += NR_END;
+	m -= nrl;
+
+	/* allocate rows and set pointers to them */
+	m[nrl]=(double *) malloc((unsigned int)((nrow*ncol+NR_END)*sizeof(double)));
+	if (!m[nrl]) nrerror("allocation failure 2 in matrix()");
+	m[nrl] += NR_END;
+	m[nrl] -= ncl;
+
+	for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol;
+
+	/* return pointer to array of pointers to rows */
+	return m;
+}
+
+int **imatrix(nrl,nrh,ncl,nch)
+long nch,ncl,nrh,nrl;
+/* allocate a int matrix with subscript range m[nrl..nrh][ncl..nch] */
+{
+	long i, nrow=nrh-nrl+1,ncol=nch-ncl+1;
+	int **m;
+
+	/* allocate pointers to rows */
+	m=(int **) malloc((unsigned int)((nrow+NR_END)*sizeof(int*)));
+	if (!m) nrerror("allocation failure 1 in matrix()");
+	m += NR_END;
+	m -= nrl;
+
+
+	/* allocate rows and set pointers to them */
+	m[nrl]=(int *) malloc((unsigned int)((nrow*ncol+NR_END)*sizeof(int)));
+	if (!m[nrl]) nrerror("allocation failure 2 in matrix()");
+	m[nrl] += NR_END;
+	m[nrl] -= ncl;
+
+	for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol;
+
+	/* return pointer to array of pointers to rows */
+	return m;
+}
+
+float **submatrix(a,oldrl,oldrh,oldcl,oldch,newrl,newcl)
+float **a;
+long newcl,newrl,oldch,oldcl,oldrh,oldrl;
+/* point a submatrix [newrl..][newcl..] to a[oldrl..oldrh][oldcl..oldch] */
+{
+	long i,j,nrow=oldrh-oldrl+1,ncol=oldcl-newcl;
+	float **m;
+
+	/* allocate array of pointers to rows */
+	m=(float **) malloc((unsigned int) ((nrow+NR_END)*sizeof(float*)));
+	if (!m) nrerror("allocation failure in submatrix()");
+	m += NR_END;
+	m -= newrl;
+
+	/* set pointers to rows */
+	for(i=oldrl,j=newrl;i<=oldrh;i++,j++) m[j]=a[i]+ncol;
+
+	/* return pointer to array of pointers to rows */
+	return m;
+}
+
+float **convert_matrix(a,nrl,nrh,ncl,nch)
+float *a;
+long nch,ncl,nrh,nrl;
+/* allocate a float matrix m[nrl..nrh][ncl..nch] that points to the matrix
+declared in the standard C manner as a[nrow][ncol], where nrow=nrh-nrl+1
+and ncol=nch-ncl+1. The routine should be called with the address
+&a[0][0] as the first argument. */
+{
+	long i,j,nrow=nrh-nrl+1,ncol=nch-ncl+1;
+	float **m;
+
+	/* allocate pointers to rows */
+	m=(float **) malloc((unsigned int) ((nrow+NR_END)*sizeof(float*)));
+	if (!m)	nrerror("allocation failure in convert_matrix()");
+	m += NR_END;
+	m -= nrl;
+
+	/* set pointers to rows */
+	m[nrl]=a-ncl;
+	for(i=1,j=nrl+1;i<nrow;i++,j++) m[j]=m[j-1]+ncol;
+	/* return pointer to array of pointers to rows */
+	return m;
+}
+
+float ***f3tensor(nrl,nrh,ncl,nch,ndl,ndh)
+long nch,ncl,ndh,ndl,nrh,nrl;
+/* allocate a float 3tensor with range t[nrl..nrh][ncl..nch][ndl..ndh] */
+{
+	long i,j,nrow=nrh-nrl+1,ncol=nch-ncl+1,ndep=ndh-ndl+1;
+	float ***t;
+
+	/* allocate pointers to pointers to rows */
+	t=(float ***) malloc((unsigned int)((nrow+NR_END)*sizeof(float**)));
+	if (!t) nrerror("allocation failure 1 in f3tensor()");
+	t += NR_END;
+	t -= nrl;
+
+	/* allocate pointers to rows and set pointers to them */
+	t[nrl]=(float **) malloc((unsigned int)((nrow*ncol+NR_END)*sizeof(float*)));
+	if (!t[nrl]) nrerror("allocation failure 2 in f3tensor()");
+	t[nrl] += NR_END;
+	t[nrl] -= ncl;
+
+	/* allocate rows and set pointers to them */
+	t[nrl][ncl]=(float *) malloc((unsigned int)((nrow*ncol*ndep+NR_END)*sizeof(float)));
+	if (!t[nrl][ncl]) nrerror("allocation failure 3 in f3tensor()");
+	t[nrl][ncl] += NR_END;
+	t[nrl][ncl] -= ndl;
+
+	for(j=ncl+1;j<=nch;j++) t[nrl][j]=t[nrl][j-1]+ndep;
+	for(i=nrl+1;i<=nrh;i++) {
+		t[i]=t[i-1]+ncol;
+		t[i][ncl]=t[i-1][ncl]+ncol*ndep;
+		for(j=ncl+1;j<=nch;j++) t[i][j]=t[i][j-1]+ndep;
+	}
+
+	/* return pointer to array of pointers to rows */
+	return t;
+}
+
+void free_vector(v,nl,nh)
+float *v;
+long nh,nl;
+/* free a float vector allocated with vector() */
+{
+	free((FREE_ARG) (v+nl-NR_END));
+}
+
+void free_ivector(v,nl,nh)
+int *v;
+long nh,nl;
+/* free an int vector allocated with ivector() */
+{
+	free((FREE_ARG) (v+nl-NR_END));
+}
+
+void free_cvector(v,nl,nh)
+long nh,nl;
+unsigned char *v;
+/* free an unsigned char vector allocated with cvector() */
+{
+	free((FREE_ARG) (v+nl-NR_END));
+}
+
+void free_lvector(v,nl,nh)
+long nh,nl;
+unsigned long *v;
+/* free an unsigned long vector allocated with lvector() */
+{
+	free((FREE_ARG) (v+nl-NR_END));
+}
+
+void free_dvector(v,nl,nh)
+double *v;
+long nh,nl;
+/* free a double vector allocated with dvector() */
+{
+	free((FREE_ARG) (v+nl-NR_END));
+}
+
+void free_matrix(m,nrl,nrh,ncl,nch)
+float **m;
+long nch,ncl,nrh,nrl;
+/* free a float matrix allocated by matrix() */
+{
+	free((FREE_ARG) (m[nrl]+ncl-NR_END));
+	free((FREE_ARG) (m+nrl-NR_END));
+}
+
+void free_dmatrix(m,nrl,nrh,ncl,nch)
+double **m;
+long nch,ncl,nrh,nrl;
+/* free a double matrix allocated by dmatrix() */
+{
+	free((FREE_ARG) (m[nrl]+ncl-NR_END));
+	free((FREE_ARG) (m+nrl-NR_END));
+}
+
+void free_imatrix(m,nrl,nrh,ncl,nch)
+int **m;
+long nch,ncl,nrh,nrl;
+/* free an int matrix allocated by imatrix() */
+{
+	free((FREE_ARG) (m[nrl]+ncl-NR_END));
+	free((FREE_ARG) (m+nrl-NR_END));
+}
+
+void free_submatrix(b,nrl,nrh,ncl,nch)
+float **b;
+long nch,ncl,nrh,nrl;
+/* free a submatrix allocated by submatrix() */
+{
+	free((FREE_ARG) (b+nrl-NR_END));
+}
+
+void free_convert_matrix(b,nrl,nrh,ncl,nch)
+float **b;
+long nch,ncl,nrh,nrl;
+/* free a matrix allocated by convert_matrix() */
+{
+	free((FREE_ARG) (b+nrl-NR_END));
+}
+
+void free_f3tensor(t,nrl,nrh,ncl,nch,ndl,ndh)
+float ***t;
+long nch,ncl,ndh,ndl,nrh,nrl;
+/* free a float f3tensor allocated by f3tensor() */
+{
+	free((FREE_ARG) (t[nrl][ncl]+ndl-NR_END));
+	free((FREE_ARG) (t[nrl]+ncl-NR_END));
+	free((FREE_ARG) (t+nrl-NR_END));
+}
+
+#endif /* ANSI */
diff --git a/src/nrutil.h b/src/nrutil.h
new file mode 100644
index 0000000..2e821ce
--- /dev/null
+++ b/src/nrutil.h
@@ -0,0 +1,101 @@
+#ifndef _NR_UTILS_H_
+#define _NR_UTILS_H_
+/*
+static float sqrarg;
+#define SQR(a) ((sqrarg=(a)) == 0.0 ? 0.0 : sqrarg*sqrarg)
+
+static double dsqrarg;
+#define DSQR(a) ((dsqrarg=(a)) == 0.0 ? 0.0 : dsqrarg*dsqrarg)
+
+static double dmaxarg1,dmaxarg2;
+#define DMAX(a,b) (dmaxarg1=(a),dmaxarg2=(b),(dmaxarg1) > (dmaxarg2) ?\
+        (dmaxarg1) : (dmaxarg2))
+
+static double dminarg1,dminarg2;
+#define DMIN(a,b) (dminarg1=(a),dminarg2=(b),(dminarg1) < (dminarg2) ?\
+        (dminarg1) : (dminarg2))
+
+static float maxarg1,maxarg2;
+#define FMAX(a,b) (maxarg1=(a),maxarg2=(b),(maxarg1) > (maxarg2) ?\
+        (maxarg1) : (maxarg2))
+
+static float minarg1,minarg2;
+#define FMIN(a,b) (minarg1=(a),minarg2=(b),(minarg1) < (minarg2) ?\
+        (minarg1) : (minarg2))
+
+static long lmaxarg1,lmaxarg2;
+#define LMAX(a,b) (lmaxarg1=(a),lmaxarg2=(b),(lmaxarg1) > (lmaxarg2) ?\
+        (lmaxarg1) : (lmaxarg2))
+
+static long lminarg1,lminarg2;
+#define LMIN(a,b) (lminarg1=(a),lminarg2=(b),(lminarg1) < (lminarg2) ?\
+        (lminarg1) : (lminarg2))
+
+static int imaxarg1,imaxarg2;
+#define IMAX(a,b) (imaxarg1=(a),imaxarg2=(b),(imaxarg1) > (imaxarg2) ?\
+        (imaxarg1) : (imaxarg2))
+
+static int iminarg1,iminarg2;
+#define IMIN(a,b) (iminarg1=(a),iminarg2=(b),(iminarg1) < (iminarg2) ?\
+        (iminarg1) : (iminarg2))
+*/
+#define SIGN(a,b) ((b) >= 0.0 ? fabs(a) : -fabs(a))
+
+#if defined(__STDC__) || defined(ANSI) || defined(NRANSI) /* ANSI */
+
+void nrerror(char error_text[]);
+float *vector(long nl, long nh);
+int *ivector(long nl, long nh);
+unsigned char *cvector(long nl, long nh);
+unsigned long *lvector(long nl, long nh);
+double *dvector(long nl, long nh);
+float **matrix(long nrl, long nrh, long ncl, long nch);
+double **dmatrix(long nrl, long nrh, long ncl, long nch);
+int **imatrix(long nrl, long nrh, long ncl, long nch);
+float **submatrix(float **a, long oldrl, long oldrh, long oldcl, long oldch,
+	long newrl, long newcl);
+float **convert_matrix(float *a, long nrl, long nrh, long ncl, long nch);
+float ***f3tensor(long nrl, long nrh, long ncl, long nch, long ndl, long ndh);
+void free_vector(float *v, long nl, long nh);
+void free_ivector(int *v, long nl, long nh);
+void free_cvector(unsigned char *v, long nl, long nh);
+void free_lvector(unsigned long *v, long nl, long nh);
+void free_dvector(double *v, long nl, long nh);
+void free_matrix(float **m, long nrl, long nrh, long ncl, long nch);
+void free_dmatrix(double **m, long nrl, long nrh, long ncl, long nch);
+void free_imatrix(int **m, long nrl, long nrh, long ncl, long nch);
+void free_submatrix(float **b, long nrl, long nrh, long ncl, long nch);
+void free_convert_matrix(float **b, long nrl, long nrh, long ncl, long nch);
+void free_f3tensor(float ***t, long nrl, long nrh, long ncl, long nch,
+	long ndl, long ndh);
+
+#else /* ANSI */
+/* traditional - K&R */
+
+void nrerror();
+float *vector();
+float **matrix();
+float **submatrix();
+float **convert_matrix();
+float ***f3tensor();
+double *dvector();
+double **dmatrix();
+int *ivector();
+int **imatrix();
+unsigned char *cvector();
+unsigned long *lvector();
+void free_vector();
+void free_dvector();
+void free_ivector();
+void free_cvector();
+void free_lvector();
+void free_matrix();
+void free_submatrix();
+void free_convert_matrix();
+void free_dmatrix();
+void free_imatrix();
+void free_f3tensor();
+
+#endif /* ANSI */
+
+#endif /* _NR_UTILS_H_ */
diff --git a/src/optimise.c b/src/optimise.c
new file mode 100644
index 0000000..7d3a951
--- /dev/null
+++ b/src/optimise.c
@@ -0,0 +1,310 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <math.h>
+#include <sys/types.h>
+#include <memory.h>
+#include <string.h>
+#include <errno.h>
+#include <ctype.h>
+#include "nrutil.h"
+#include "yagi.h"
+#include "globals.h"
+
+int main(int argc, char **argv)
+{
+
+	FILE *fp, *update_fp, *fp_out;
+	char *input_filename, notes[1000];
+	char *output_filename, *update_filename, *line, *ofile;
+	int elements, driven, parasitic;
+	int  ii;
+	int  *indx, i, better=FALSE;
+	double **A, *x,*v,*b,**z,pin,old_perf=-10000.0, new_perf=-1000.0;
+	double **driven_data, **parasitic_data, angular_step, scale_factor=1.0;
+	double **driven_data_tmp, **parasitic_data_tmp;
+	double **driven_data_global_best, **parasitic_data_global_best;
+	double design_frequency, min_frequency, max_frequency, step_frequency;
+	double E_fwd, E_back, H_fwd, H_back, frequency, old_SD_of_currents=1e100;
+	struct flags flag;
+	struct FCOMPLEX *voltage, *current, input_impedance, z_centre;
+	struct element_data *coordinates;
+	struct performance_data mean, best_performance,start,changes,worst;
+	/* Zero all the flags in the structure flag. Some compilers allow
+         me to zero them when I define it in the header file, but not all.
+         Hope this method is less compiler specific. */
+	memset(  (char *) &flag , 0, sizeof(flag));
+	/* Set the structs to have sensible values to start with. */
+   set_performance_structures(&weight,&max,&best_performance,&worst);
+	opterr=0;
+	ofile=string(0L,100L);
+	/* Since there are so many command line options to get, as of version 1.10
+	of the software, all the options are got from a sepparate file, using lots
+	of global variables! */
+	flag.eflg=31;    /* set elements to move */
+	flag.oflg=32805; /* Set things to optimise for */
+	test_for_stop_file(); /* Exit if the file "stop" exists */
+	get_command_line_options(argc, argv,&flag);
+	if(!flag.Tflg && !flag.tflg)
+		optimising_for(flag);
+	/* a function check_flags() does all the checking to make sure flags 
+	set (by user adding options) are reasonable. It also acts on many of them. */
+	check_flags(flag, argc, optind, argv[0]);
+	iterations=atoi(argv[optind+1]);
+	if(flag.Aflg)
+		iterations=2;
+	/* allocate memory for strings */
+	input_filename=string(0L,100L);
+	line=string(0L,MAX_LINE);
+	output_filename=string(0L,100L);
+	update_filename=string(0L,100L);
+	seedRNG(); 
+	/* Create a file showing best gain, fb-ratio etc achieved to date */
+	/* This might typically have the name 'antenna.up' */ 
+	strcpy(update_filename,argv[optind]); 
+	strcat(update_filename,".up");
+	update_fp=fopen(update_filename,"wt"); /* Remove filname.up */
+	fclose(update_fp);
+	strcpy(input_filename,argv[optind]);
+	fp=fopen(input_filename,"rt");
+	if(fp == NULL)
+	{
+		fprintf(stderr,"Cant open %s\n", input_filename);
+		exit(10);
+	}
+	else
+		fclose(fp);
+	strcpy(output_filename,input_filename);
+	strcat(output_filename,".bes");
+	fp_out=fopen(output_filename,"wb");  /* Remove filname.bes */
+	fclose(fp_out);
+	/* since the size of all the arrays depends on the number of elements,
+	lets first find out how many elements we have, including driven and 
+	parasitic sepparately.  Then try to allocate all the memory we need. If we 
+	fail, then not much time is wasted. */
+	elements=get_number_of_elements(input_filename, &driven, &parasitic);
+	/* allocate all memory */
+	driven_data=dmatrix(1L,(long)(driven),1L,6L); 
+	parasitic_data=dmatrix(1L,(long) (parasitic),1L,4L); 
+	driven_data_global_best=dmatrix(1L,(long)(driven),1L,6L); 
+	parasitic_data_global_best=dmatrix(1L,(long) (parasitic),1L,4L); 
+	driven_data_tmp=dmatrix(1L,(long)(driven),1L,6L); 
+	parasitic_data_tmp=dmatrix(1L,(long) (parasitic),1L,4L); 
+	z=dmatrix(1L,(long) elements, 1L, elements*2L);
+	A=dmatrix(1L, 2L*elements, 1L, 2L*elements);   /* A.x=b for large matrices */
+	x=dvector(1L, 2L*elements);
+	b=dvector(1L, 2L*elements);
+
+	current=FCOMPLEXvector(1L,(long) elements); 
+	voltage=FCOMPLEXvector(1L,(long) elements);
+
+	coordinates=element_data_vector(1,elements); /* x,y &l of centre of ele's */
+	v=dvector(1L,2L*elements); 
+	indx=ivector(1,2L*elements);
+
+	read_yagi_data(line, input_filename, &design_frequency, &min_frequency,                &max_frequency, &step_frequency, driven, driven_data, parasitic,                parasitic_data,&angular_step);
+
+	/* make a copy of the element data, as we will randomise it 
+	Copy from 'parasitic_data' to 'parasitic_data_tmp' etc */
+	errno=0;
+	/* cp _data to _data_global_best */
+	copy_matrix(driven,6,driven_data_global_best, driven_data);
+	copy_matrix(parasitic,4,parasitic_data_global_best,parasitic_data); 
+	/* cp _data to _data_tmp */
+	copy_matrix(driven,6,driven_data_tmp, driven_data);
+	copy_matrix(parasitic,4,parasitic_data_tmp,parasitic_data); 
+	/* Find the maximum likely gain, given the boom length */
+	max.gain=determine_maximum_gain2(elements);
+	if(flag.Kflg==0)
+		K_times_max=1;
+	/* If a genetic algorithm is used, call the genetic algorithm
+	and exit */
+	if(flag.gflg) /* Do this if using the genetic algorithm */
+	{
+		genetic_algorithm(output_filename, update_filename, flag,\
+		 design_frequency, min_frequency, max_frequency, step_frequency, \
+		 angular_step, driven, parasitic, driven_data, parasitic_data, v, z, \
+		 &pin, voltage, current, &input_impedance, coordinates, A, b, indx, \
+		 &mean); 
+		printf("The best design is in a file \"%s\". You should check it thoroughly\n",output_filename);
+		printf("and if its better than %s, copy %s to %s\n",input_filename,\
+		 output_filename, input_filename);
+		exit (0);
+	}
+	if(flag.wflg) /* Do for wide band use */
+		sprintf(notes,"This has been run through optimise and optimised for \
+		 wide-band use over the frequency range %.3f MHz to %.3fMHz. \n", \
+		 min_frequency/1e6, max_frequency/1e6);
+	for(i=1; i<=iterations; ++i) /* main loop */
+	{
+		percent=change_max_percentage_changes(i,iterations,original_percent);
+		/* By default flag.wflg is set to zero, hence the following loop
+		will be exectude only once. If the flag was set to +2, the loop
+		is executed 3 times and we get the average performance */
+		for(ii=-1; ii<flag.wflg;++ii)
+		{
+			if(ii==-1)
+			{
+				frequency=design_frequency;
+				/* Zero mean structure */
+				memset((char *) &mean,0,sizeof(mean));
+			}
+			if(ii==0)
+				frequency=min_frequency;
+			if(ii==1)
+				frequency=max_frequency;
+			solve_equations(frequency, driven, parasitic, driven_data, parasitic_data, v, z, &pin, voltage, current, &input_impedance, coordinates, A, b, indx);
+			if(ii==-1)
+				z_centre=input_impedance;
+		   /* compute gain at theta=90, phi=0 (forward direction) */
+			gain(90,0,pin,frequency/design_frequency,coordinates,current,elements,&E_fwd,&H_fwd,frequency,design_frequency);
+	   	/* now compute gain in the reverse direction */
+			gain(270,0,pin,frequency/design_frequency,coordinates,current, \
+			elements,&E_back,&H_back,frequency,design_frequency);
+			/* put the performance in a structure performance_data */
+			set_mean_structure(input_impedance,E_fwd,E_back,flag, \
+			pin, coordinates, current, elements,frequency,design_frequency,&mean);
+			if(i==1)
+				start=mean;
+		}
+		if(flag.wflg)
+		{
+			mean.gain/=3.0; mean.fb/=3.0; mean.swr/=3.0; 
+		}
+		if(flag.Wflg || flag.gflg)
+		{
+			old_perf=performance(flag, best_performance, max, weight,start);
+			new_perf=performance(flag, mean, max, weight,start);
+			if(new_perf > old_perf)
+				better=TRUE;
+			else
+				better=FALSE;
+			if((better==TRUE) && flag.Cflg)
+				better=linear_current_optimisation_test(current, &old_SD_of_currents, elements, parasitic, flag);
+		}
+		else if(flag.Aflg)
+			better=TRUE;
+		else
+		{
+			better=is_it_better(flag.oflg,mean,best_performance);
+			if((better==TRUE) && flag.Cflg)
+				better=linear_current_optimisation_test(current, &old_SD_of_currents, elements, parasitic, flag);
+		}
+		if(better==TRUE && !flag.Tflg)
+		{
+			/* The function do_since_better() does most things that need to
+			be done if we have a better design. These include writing the 
+			new antenna description to disk, print the new performance to disk 
+			and to stdout, etc */  
+
+			/* We write the input impedance at the centre of the band - not
+			averaging, but the swr is averaged */
+
+			do_since_better(i,output_filename, update_filename, z_centre, \
+			 mean, flag, notes, design_frequency, min_frequency, \
+			 max_frequency, step_frequency, elements, driven, parasitic, \
+			 angular_step,driven_data,parasitic_data,scale_factor, new_perf); 
+			/* now set the best performance to the performance of this iteration*/
+
+			best_performance=mean;
+			/* Copy current new design (_data) to the place we keep the best
+			design (_data_tmp) */
+			/* copy _data to _data_global_best */
+			copy_matrix(driven,6,driven_data_global_best,driven_data);
+			copy_matrix(parasitic,4,parasitic_data_global_best,parasitic_data);
+			K_times=0;
+		}
+		else if (better == FALSE || flag.Tflg) /* no improvement */
+		{
+			/* Restored original data, without any randomisation */
+			K_times++;
+			if(K_times<K_times_max) /* usual case */
+			{
+				/* Retriev data from tmp into data */
+				copy_matrix(driven,6,driven_data,driven_data_tmp);
+				copy_matrix(parasitic,4,parasitic_data,parasitic_data_tmp);
+			}
+			else
+			{
+				/* Retrieve data from _global_best to data, then put
+				data in tmp */
+				copy_matrix(driven,6,driven_data,driven_data_global_best);
+				copy_matrix(parasitic,4,parasitic_data,parasitic_data_global_best);
+				copy_matrix(driven,6,driven_data_tmp,driven_data);
+				copy_matrix(parasitic,4,parasitic_data_tmp,parasitic_data);
+				K_times=0;
+			}
+			if(flag.Tflg) /* Want to find the sensitivity to constuction errors */
+			{
+				if(mean.gain<worst.gain)
+					worst.gain=mean.gain;
+				if(mean.fb<worst.fb)
+					worst.fb=mean.fb;
+				if(mean.swr > worst.swr)
+					worst.swr=mean.swr;
+				if(mean.sidelobe < worst.sidelobe)
+					worst.sidelobe=mean.sidelobe;
+			}
+		}
+      /* The following line looks for a file 'stop' in the current directory
+		and stops next time if it finds it. For  DOS use, calling the function
+		kbhit() - keyboard hit, might be better, so the user kits the keyboard
+		to stop the program. We pause after 100 iterations. With a much faster/
+		slower machine, you might want to change this */
+		end_if_stop_exists(&i,iterations,100);
+		dynamic_changing_of_weights(i,1,&weight);
+		if(!flag.Tflg && !flag.Aflg)/*user doesnt want to test sensitivity */  
+			randomise(flag.eflg, design_frequency/1e6, percent, driven_data, parasitic_data, driven, parasitic); 
+		else if(flag.Aflg)
+			automatic_enhancement(flag,design_frequency,driven_data,parasitic_data, driven,parasitic,voltage, current, &input_impedance, v,z,A,b,indx,coordinates);
+		else if(flag.Tflg) /* Check sensitivity to construction errors */
+			sensitivity(boom_sd, length_sd, driven_data, parasitic_data, driven, parasitic); 
+
+	} /* End of main loop, now finished trying to better the design */
+	if(!flag.Tflg)
+	{
+		printf("The best design is in a file \"%s\". You should check it thoroughly\n",output_filename);
+		printf("and if its better than %s, copy %s to %s\n",input_filename,output_filename, input_filename);
+		printf("For your information, the original data on the antenna was:\n");
+		print_relavent_performance_data(stdout,"Start data:",0,flag,start,0.0,0,0);
+		print_relavent_performance_data(stdout,"Final data:",0,flag,best_performance,0.0,0,0); 
+		changes=subtract_structures(best_performance,start);
+		print_relavent_performance_data(stdout,"Changes:   ",0,flag,changes,0.0,0,0); 
+	}
+	else if (flag.Tflg) /* find worst design */
+	{
+		printf("For your inforation, the original data on the antenna was:\n");
+		print_relavent_performance_data(stdout,"Start data:",0,flag,start,0.0,0,0);
+		print_relavent_performance_data(stdout,"Worst data:",0,flag,worst,0.0,0,0); 
+		changes=subtract_structures(worst,start);
+		print_relavent_performance_data(stdout,"Changes:   ",0,flag,changes,0.0,0,0); 
+		printf("\nTolerance parameters were: Length_SD(t)=%.3fmm Boom_SD(T) = %.3fmm\n",length_sd,boom_sd);
+	} 
+
+	/* free strings */
+	free_string(input_filename, 0L,100L);
+	free_string(line, 0L, MAX_LINE);
+	free_string(update_filename, 0L, 100L);
+	free_string(output_filename,0L, 100L);
+	free_string(ofile,0L,100L);
+	/* free vectors */
+	free_dvector(x,1L, 2L*elements);
+	free_dvector(b,1L, 2L*elements);
+	free_dvector(v,1L,2L*elements); 
+	free_ivector(indx, 1L, 2L*elements);
+	/* free matrices */
+	free_dmatrix(z,1L,(long) elements, 1L, elements*2L);
+	free_dmatrix(A,1L, 2L*elements, 1L, 2L*elements);
+	free_dmatrix(driven_data,1L,(long)(driven),1L,6L); 
+	free_dmatrix(parasitic_data,1L,(long) (parasitic),1L,4L); 
+	free_dmatrix(parasitic_data_global_best,1L,(long) (parasitic),1L,4L); 
+	free_dmatrix(driven_data_global_best,1L,(long) (parasitic),1L,6L); 
+	free_dmatrix(driven_data_tmp,1L,(long)(driven),1L,6L); 
+	free_dmatrix(parasitic_data_tmp,1L,(long) (parasitic),1L,4L); 
+	/* free FCOMPLEX vectors */
+	free_FCOMPLEXvector(current, 1L,(long) elements); 
+	free_FCOMPLEXvector(voltage, 1L,(long) elements);
+	free_element_data_vector(coordinates,1,elements);
+	exit(0);
+}
diff --git a/src/optimising_for.c b/src/optimising_for.c
new file mode 100644
index 0000000..1c13299
--- /dev/null
+++ b/src/optimising_for.c
@@ -0,0 +1,60 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <math.h>
+#include <string.h>
+#include <ctype.h>
+#include "yagi.h"
+
+extern struct performance_data max;
+
+void optimising_for(struct flags flag)
+{
+	int choice; 
+	if(flag.gflg)
+	{
+		printf("Will optimise using a genetic algorithm\n");
+		choice=flag.gflg;
+	}
+	else if(flag.Wflg)
+	{
+		printf("Will optimise using a weighted combination of parameters\n");
+		choice=flag.Wflg;
+	}
+	else if(flag.wflg)
+	{
+		printf("Will optimise over a wide band\n");
+		choice=flag.wflg;
+	}
+	else
+	{
+		printf("Will optimise insisting all selected parameters improve.\n");
+		choice=flag.oflg;
+	}
+	if((choice&GAIN)==GAIN)
+		printf("Optimising for maximum possible gain.\n");
+	if((choice&FB)==FB && (choice&REASONABLE)==0)
+		printf("Optimising for maximum possible FB ratio.\n");
+	if((choice&FB)==FB && (choice&REASONABLE)==REASONABLE)
+		printf("Optimising for FB ratio to a maximum of %.3fdB.\n",max.fb);
+	if((choice&RESISTANCE)==RESISTANCE && (choice&REASONABLE)==0)
+		printf("Optimising for an input resistance as close as possible to Z0.\n");
+	if((choice&RESISTANCE)==RESISTANCE && (choice&REASONABLE)==REASONABLE)
+		printf("Optimising for an input resistance of Z0 +/- %.3f Ohms\n",max.r);
+	if((choice&REACTANCE)==REACTANCE && (choice&REASONABLE)==0)
+		printf("Optimising for an input reactance as close as possible to zero.\n");
+	if((choice&REACTANCE)==REACTANCE && (choice&REASONABLE)==REASONABLE)
+		printf("Optimising for an input reactance of 0 +/- %.3f Ohms\n",max.x);
+	if((choice&VSWR)==VSWR && (choice&REASONABLE)==REASONABLE)
+		printf("Optimising for an input VSWR of less than %.3f:1\n",max.swr);
+	
+	if((choice&VSWR)==VSWR && (choice&REASONABLE)==0)
+		printf("Optimising for an input VSWR as low as possible\n");
+	
+	if((choice&SIDE_LOBE_LEVEL)==SIDE_LOBE_LEVEL && (choice&REASONABLE)==0)
+		printf("Optimising for the most significant side to be as small as possible.\n");
+	if((choice&SIDE_LOBE_LEVEL)==SIDE_LOBE_LEVEL && (choice&REASONABLE)==REASONABLE)
+		printf("Optimising for the most significant sidelobe to be at least %.3f dB down\n",max.sidelobe);
+}
+
diff --git a/src/output.c b/src/output.c
new file mode 100644
index 0000000..48696e4
--- /dev/null
+++ b/src/output.c
@@ -0,0 +1,296 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+/*
+A few changes have been made, including:
+1) Memory is freed, rather than lying on the OS
+2) Memory is no longer repeatdly allocated, which meant excessive use 
+of system memory.
+*/
+#include <stdio.h>
+#ifdef HAVE_STDLIB_H
+
+#endif
+#include <malloc.h>
+#include <math.h>
+#include <string.h>
+#include <sys/types.h>
+#include "yagi.h"
+
+double Zo=Z0; /* Z0 is defined in yagi.h */
+
+extern int optind, opterr;
+extern char *optarg;
+double min_offset_from_peak, angular_stepsize_2; /* not needed */
+
+double pin, design_f, normalised_f, f;
+double gain_E_plane, gain_H_plane, peak_gain;
+struct element_data *coordinates;
+struct FCOMPLEX *current;
+int elements;
+double rrange_min=RRANGE_MIN;
+double rrange_max=RRANGE_MAX;
+
+
+int main(int argc, char **argv)
+{
+	FILE *ifp, *ofp, *gain_fp;
+	FILE *gnuplot_filename_fp; 
+	FILE *gnuplot_log_command_filename_fp;
+	FILE *gnuplot_lin_command_filename_fp;
+	char *input_filename, *output_filename, *temp; 
+	char *gnuplot_log_command_filename;
+	char *gnuplot_lin_command_filename;
+	char *gain_filename; 
+	char *gnuplot_filename; 
+	char *original_filename;
+	double min_f, max_f, step_f, vswr, angular_step,theta;
+	double magnitude, phase,max_SL,E_max=E_MAX, H_max=H_MAX;
+	struct FCOMPLEX *voltage, input_impedance;
+	double fb_ratio,gain_E_plane_back;
+	double gain_H_plane_back;
+	struct flags flag;
+	struct pattern pattern_shape;
+	int  c, step=0;
+	input_filename=string(0L, 100L);
+	gnuplot_filename=string(0L, 400L);
+	gnuplot_log_command_filename=string(0L, 400L);
+	gnuplot_lin_command_filename=string(0L, 400L);
+	output_filename=string(0L, 100L);
+	original_filename=string(0L, 100L);
+	gain_filename=string(0L, 100L);
+	memset((char *) &flag, 0, sizeof(flag));
+   while ((c =  getoptions(argc,argv,"cehpsr:E:H:R:Z:")) != -1)
+   switch       (c) 
+   {   	case 'c':
+	      flag.cflg=1;
+	      break;
+	case 'p':  /* Print data for gnuplot_log */
+		flag.pflg=1;
+	      break;
+	case 'e':  /* suppress E- plane 3dB BW */
+		flag.eflg=1;
+	      break;
+	case 'h':  /* suppress H- plane 3dB BW */
+	flag.hflg=1;
+	      break;
+	 case 'r':  /* suppress H- plane 3dB BW */
+		rrange_min=atof(optarg);
+	      break;
+	 case 'R':  /* suppress H- plane 3dB BW */
+	rrange_max=atof(optarg);
+	      break;
+	 case 's':   /* suppress diagnostics */
+		flag.sflg=1;
+	      break;
+          case 'E':             /* Max angle in E plane to look for -3dB */
+			      E_max=atof(optarg);
+               break;
+          case 'H':
+               H_max=atof(optarg); /* max angle in H plane to look for -3dB */
+               break;
+          case 'Z':        /* Zo */
+               Zo=atof(optarg);
+               break;
+			 case '?':   /* default */
+					flag.errflg=1;
+					break;
+	}
+	if((argc-optind != 1) || flag.errflg)
+	{
+		usage_output(argv[0]);
+		exit(0);
+	}
+	/* The file read by 'output' is expected to have a .out extension.
+	'output' creates files with extensions:
+	.dat     Containing the basic broperties of impedance, gain etc as a function
+		 of frequency.
+	.gai     Contains field patterns (gain) in the both H and E plane.
+	
+	We here get all the file names, then open files. */
+	strcpy(input_filename, argv[optind]);
+	strcpy(original_filename, argv[optind]);
+	strcpy(output_filename, *(argv+optind));
+	strcpy(gain_filename, *(argv+optind));
+       
+	strcat(input_filename,".out");
+	strcat(output_filename,".dat");
+	strcat(gain_filename,".gai");
+	ifp=fopen(input_filename,"rb");
+	ofp=fopen(output_filename,"wb");
+	gain_fp=fopen(gain_filename,"wt");
+	if(ifp == NULL)
+	{
+		fprintf(stderr,"Cant open %s\n", input_filename);
+		exit(10);
+	}
+
+	temp=string(0L,100L);
+	/* No longer need to refer to files by names, we just use the 
+	file pointers, so free memory associated with names. */
+	free_string(output_filename,0L,100L);
+	free_string(gain_filename,0L,100L);
+	/* Read the header on the .out file, which is usually 100 Bytes,
+	but can be defined in yagi.h as HEADER_SIZE */
+	elements=read_header(ifp, ofp, &min_f, &max_f, &step_f, &design_f, &angular_step);
+	/* Creatre an array of structures, so contain the x and y locations of 
+	each element, and the lengths of the elements. All dimensions are in m */
+	coordinates=element_data_vector(1,elements); /* x,y &l of centre of ele's */
+	/* read into memory the x,y, and lengths of all elements */
+	fread((char *) &coordinates[1], sizeof(struct element_data),elements,ifp);
+	/* Create arrays to hold real and imaginary components of voltage */
+	voltage=FCOMPLEXvector(1,elements);
+	current=FCOMPLEXvector(1,elements);
+	/* read voltages applied to elements into memory */
+	fread((char *) &voltage[1], sizeof(struct FCOMPLEX),elements, ifp);
+	/* Now print a one line header to put into .dat file */
+	fprintf(ofp,"  f(MHz) E(deg) H(deg)  R     jX    VSWR   Gain(dBi)     FB(dB)    SideLobes(dB)\n\n");
+	if(flag.pflg==1)
+	{
+		if(angular_step > 10)
+		{
+			fprintf(stderr,"The angular step site is set at less that 10 degress. Edit the file %s, change the ANGULAR_STEP to 10 degrees or less, then rerun 'yagi %s' and 'output -p %s'\n", original_filename, original_filename, original_filename);
+			exit(12);
+
+		}
+		sprintf(gnuplot_log_command_filename,"%s.glog",original_filename);
+		sprintf(gnuplot_lin_command_filename,"%s.glin",original_filename);
+		gnuplot_log_command_filename_fp=fopen(gnuplot_log_command_filename,"w");
+		gnuplot_lin_command_filename_fp=fopen(gnuplot_lin_command_filename,"w");
+		write_gnuplot_header(gnuplot_log_command_filename_fp,f,original_filename,step,LOG);
+		write_gnuplot_header(gnuplot_lin_command_filename_fp,f,original_filename,step,LIN);
+	}
+	/* compute data at every frequency of interest */
+	for(f=min_f; f<=max_f; f+=step_f)
+	{
+		normalised_f=f/design_f;
+		fread((char *) &current[1], sizeof(struct FCOMPLEX),elements, ifp);
+		z_input(voltage[1], current[1], &input_impedance);
+		/* Compute magnitude and phase of reflection coefficient */
+		reflection_coefficient(input_impedance, &magnitude, &phase);
+		/* Compute VSWR from magnitude of reflection coefficient */
+		vswr=calculate_vswr(magnitude);
+		/* Calculate power input to antenna */
+		pin=calculate_power_input(input_impedance.r,current[1]); /* in Watts */
+		if(pin < 0.0)
+		{
+			fprintf(stderr,"input power less than 0! Probably due to self or mutual impedance being inaccurate when current not sinusidal\n");
+			fprintf(stderr,"f=%f MHz Zin=%f +i%f\n",f/1e6, input_impedance.r, input_impedance.i);
+		}
+		/* compute gain at theta=90, phi=0 (forward direction) */
+		gain(90, 0, pin, normalised_f, coordinates, current, elements, &gain_E_plane, &gain_H_plane, f, design_f );
+		/* compute gain at theta -90 degrees (ie back - direction) */
+		gain(270, 0, pin, normalised_f, coordinates, current, elements, &gain_E_plane_back, &gain_H_plane_back, f, design_f); 
+		fb_ratio=gain_E_plane-gain_E_plane_back;  /* in dB, so subtract */
+		/* If the values of impedance are too large, the cant be printed in
+		the .dat file. Hence we truncate them. At this point, the numbers
+		are so large, that we are not likely to be able to use them anyway. */
+		if(input_impedance.r > 9999999)
+			input_impedance.r = 9999999;
+		if(input_impedance.i > 9999999)
+			input_impedance.i = 9999999;
+		if(input_impedance.r < -9999999)
+			input_impedance.r = -9999999;
+		if(input_impedance.i < -9999999)
+			input_impedance.i = -9999999;
+	
+	   /* Find the most importent bits of the pattern info */
+
+		/* Estimiate 3dB bandwidth using .See '-E' and '-H' options */
+		peak_gain=gain_E_plane;
+		if(flag.hflg || elements==1)
+			pattern_shape.three_dB_H=0.0;  
+		else
+	      pattern_shape.three_dB_H=(double) zbrent(error_3dB_H, 0.0,H_max,0.1);  
+		if(flag.eflg)
+			pattern_shape.three_dB_E=0.0;  
+		else
+		 	pattern_shape.three_dB_E=(double) zbrent(error_3dB_E, 90.0,E_max,0.1); 
+		if(flag.cflg==1)
+		{
+			max_SL=find_max_sidelobe_slow(peak_gain, pin,coordinates,current,elements,f,design_f); 
+		}
+		else
+			max_SL=0.0;
+		fprintf(ofp,"%9.3f %3.1f  %3.1f %6.2f %6.2f %6.3f %10.3f %10.3f %10.3f\n",f/1e6,2*(pattern_shape.three_dB_E-90), 2*pattern_shape.three_dB_H,input_impedance.r, input_impedance.i, vswr, peak_gain, fb_ratio,max_SL);
+		write_gain_at_various_angles(gain_fp, angular_step, pin, normalised_f, f, coordinates, current, elements, design_f); 
+		if((min_f < max_f) && !flag.sflg)
+			printf("%s completed  %5.1f%%\n",argv[0],100*(f-min_f)/(max_f-min_f));
+		if(flag.pflg == 1) /* Plot results in files suitable for gnuplot */
+		{
+			step++;
+			sprintf(gnuplot_filename,"%s.%.4f.g",original_filename,f/1e6);
+			gnuplot_filename_fp=fopen(gnuplot_filename,"w");
+
+			for(theta=0;theta<360;theta+=angular_step)
+			{
+		        	gain(theta+90.0, 0, pin, normalised_f, coordinates, current, elements, &gain_E_plane, &gain_H_plane, f, design_f );
+				if(gain_E_plane < rrange_min)
+				    gain_E_plane= rrange_min;
+				if(gain_H_plane < rrange_min)
+				    gain_H_plane= rrange_min;
+				fprintf(gnuplot_filename_fp,"%11.3f %11.3f %11.3f %8.3f %11.3f %11.3f %11.3f %11.3f %11.3f\n",theta,gain_E_plane,gain_H_plane,vswr,pow(10.0,gain_E_plane/10.0),pow(10.0,gain_H_plane/10.0),0.0,0.0,0.0);
+				/*
+				if(theta<=90)
+					zz=-40.0;
+				else if (theta > 90 && theta <= 180)
+					zz=-20.0;
+				else if (theta > 180 && theta <= 270)
+					zz=0.0;
+				else
+					zz=10.0;
+				fprintf(gnuplot_log_filename_fp,"%11.3f %11.3f %11.3f %8.3f %11.3f %11.3f\n",theta,zz,gain_H_plane,vswr,0.0,0.0,0.0);
+				*/
+			}
+			fprintf(gnuplot_log_command_filename_fp,"plot '%s' using 1:2\n",gnuplot_filename);
+			fprintf(gnuplot_lin_command_filename_fp,"plot '%s' using 1:5\n",gnuplot_filename);
+			fprintf(gnuplot_lin_command_filename_fp,"pause -1 \"Hit RETURN to see pattern at %.4f MHz on a linear scale\"\n",f);
+			fprintf(gnuplot_log_command_filename_fp,"pause -1 \"Hit RETURN to see pattern at %.4f MHz on a log scale\"\n",f);
+		}
+	}
+	if(flag.pflg==1)
+	{
+		fclose(gnuplot_filename_fp);
+		fclose(gnuplot_log_command_filename_fp);
+		fclose(gnuplot_lin_command_filename_fp);
+	}
+	output_filename=string(0L, 100L);
+	original_filename=string(0L, 100L);
+	gain_filename=string(0L, 100L);
+	/* free strings not already freed */
+	free_string(input_filename,0L,100L);
+	free_string(temp,0L,100L);
+	free_string(gnuplot_filename,0L, 400L);
+	free_string(gnuplot_log_command_filename,0L, 400L);
+	free_string(gnuplot_lin_command_filename,0L, 400L);
+        free_string(output_filename, 0L, 100L);
+	free_string(original_filename, 0L,100L); 
+	free_string(gain_filename, 0L, 100L);
+	/* free vectors */
+	free_FCOMPLEXvector(voltage,1L,(long) elements);
+	free_FCOMPLEXvector(current,1L,(long) elements);
+
+	fclose(ifp); 
+	fclose(gain_fp);
+	exit(0);
+}
+
+
+
+double error_3dB_E(double x)
+{
+		double ans;
+
+		gain(x, 0, pin, normalised_f, coordinates, current, elements, &gain_E_plane, &gain_H_plane, f, design_f );
+		ans=peak_gain-gain_E_plane-3.01;
+		return(ans);
+}
+
+double error_3dB_H(double x)
+{
+		double ans;
+
+		gain(0, x, pin, normalised_f, coordinates, current, elements, &gain_E_plane, &gain_H_plane, f, design_f );
+		ans=peak_gain-gain_H_plane-3.01;
+		return(ans);
+}
diff --git a/src/perform.c b/src/perform.c
new file mode 100644
index 0000000..02d9e30
--- /dev/null
+++ b/src/perform.c
@@ -0,0 +1,137 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <math.h>
+#include <string.h>
+#include <errno.h>
+#include "yagi.h"
+
+/* The function performance gives a performance rating for the antenna
+between 0 and 1, for use in a genetic algorithm to get performance. All
+parameters are roughly linear */ 
+
+extern int errno;
+extern double Zo;
+
+double performance(struct flags flag, struct performance_data data, struct performance_data max, struct performance_data weight, struct performance_data start)
+{
+	double a, x_err, fb,swr,product_of_weights;
+	struct performance_data perform;
+	double max_fb;
+	int items=0;
+	memset((char*) &perform,1,sizeof(perform));
+	/* perform.gain=1.0; perform.fb=1.0; perform.swr=1.0;
+	perform.fb=1.0; perform.r=1.0; perform.x=1.0;
+	perform.sidelobe=1.0; */
+	product_of_weights=1.0;
+	weight.sidelobe/=100.0;
+	/* To normalise the fitness, we must divide by the products of the
+	weights, so this must be found. */
+	if(weight.gain!=0.0)
+		product_of_weights=weight.gain;
+	if(weight.fb!=0.0)
+		product_of_weights*=weight.fb;
+	if(weight.r!=0.0)
+		product_of_weights*=weight.r;
+	if(weight.x!=0.0)
+		product_of_weights*=weight.x;
+	if(weight.swr!=0.0)
+		product_of_weights*=weight.swr;
+	if(weight.sidelobe!=0.0)
+		product_of_weights*=weight.sidelobe;
+	if(  ((flag.Wflg&GAIN)==GAIN) ||  ((flag.gflg&GAIN)==GAIN) )
+	{
+		/* gain=pow(10.0,data.gain/10.0);       
+		start_gain=pow(10.0,(start.gain-1.0)/10.0);       
+		max_gain=pow(10.0,max.gain/10.0);
+		if(gain>1.2*max_gain)
+			gain=max_gain;
+		perform.gain=weight.gain*(gain-start_gain)/(max_gain-start_gain); */
+		perform.gain=weight.gain*(data.gain-5)/(max.gain-5);
+		/* printf("perform.g= %f g=%f\n", perform.gain, data.gain);  */
+		if(perform.gain < 0)
+			perform.gain=0.0;
+		items++;
+	}
+	if(  ((flag.Wflg&FB)==FB) ||  ((flag.gflg&FB)==FB) )
+	{
+		fb=pow(10.0,data.fb/10.0);       
+		max_fb=pow(10.0,max.fb/10.0);
+		if((fb>max_fb) &(!flag.Oflg))
+			fb=max_fb; 
+		perform.fb=weight.fb*fb/max_fb; 
+		items++;
+	}
+	if(  ((flag.Wflg&RESISTANCE)==RESISTANCE) || ((flag.gflg&RESISTANCE)==RESISTANCE))
+	{
+		perform.r=(1-pow(fabs(Zo-data.r)/Zo,0.25));  
+		if(data.r<0.7*Zo || data.r > 1.4*Zo)
+			perform.r/=10.0;
+		items++;
+	}
+	if(  ((flag.Wflg&REACTANCE)==REACTANCE) || ((flag.gflg&REACTANCE)==REACTANCE))
+	{
+		x_err=fabs(data.x)/Zo;  
+		if(x_err > 1.0)
+			x_err=1.0;
+		perform.x=1-pow(x_err,0.28);
+		items++;
+	}
+	if(  ((flag.Wflg&VSWR)==VSWR) ||  ((flag.gflg&VSWR)==VSWR) )
+	{
+		swr=data.swr;
+		/* The follwing, fitness=(1-((swr-1)/(swr+1))^2), gives a fitness
+		proportional to the fraction of power radiated, assuming all 
+		reflected power is absorbed. Unfortunately, it gives too high a#
+		fitness to a poor VSWR, so was abandoned */
+		/* perform.swr=weight.swr*(1-pow((swr-1.0)/(swr+1.0),2.0) ) ;    */
+
+
+		/* The folloing is an imperical relationship developed by me, by writing
+		a number of VSWR's down (1.0, 1.1, 1.5, 2.0, 3.0 and infinity and 
+		writing down what I donsidered their fitness (1.0, 0.9, 0.8, 0.5 and 0.1)
+		then fitting a polynomial thru em. The fitness dont work out exactly
+		as above, but they seem reasonable. This has a maximum value of 
+		0.98220 at VSWR=1.0, but I wont bother addeding the scale factor
+		1/.98220 = 1.0181, since this will not improve things - only slow the 
+		program a bit! */
+		/* perform.swr=2.86298/(swr*swr) - 1.88078/(swr*swr*swr); */
+		/* Another imperical one */
+		/* if(swr > 7.2925)
+			perform.swr=1.0/(swr);
+		else */
+			perform.swr=1.0-log10(swr); 
+		/* if(swr>7.76124)
+			perform.swr=1.0/(swr*swr);
+		else
+			perform.swr=1.0-log10(swr); */
+			
+		/* printf("swr=%f fit = %f\n", swr, perform.swr);  */
+		items++;
+	}
+	if(  ((flag.Wflg&SIDE_LOBE_LEVEL)==SIDE_LOBE_LEVEL) ||  ((flag.gflg&SIDE_LOBE_LEVEL)==SIDE_LOBE_LEVEL) )
+	{
+		/* sidelobe_level=pow(10.0,data.sidelobe/10.0);       
+		max_sidelobe=pow(10.0,max.sidelobe/10.0);
+		if((sidelobe_level>max_sidelobe) & !flag.Oflg)
+			sidelobe_level=max_sidelobe;  
+		perform.sidelobe=weight.sidelobe*sidelobe_level/max_sidelobe; */
+		perform.sidelobe=weight.sidelobe*data.sidelobe/max.sidelobe; 
+		items++;
+	}
+	/* a=(perform.gain*perform.fb*perform.r*perform.x*perform.swr*perform.sidelobe)/product_of_weights; */
+	a=(perform.gain+perform.fb+perform.r+perform.x+perform.swr+perform.sidelobe)/(double) items;
+#ifdef DEBUG
+	if(errno)
+	{
+		fprintf(stderr,"Errno =%d in perform.c\n", errno);
+		exit(1);
+	}
+#endif
+	return(a);
+}
+
+
+
+
diff --git a/src/power_input.c b/src/power_input.c
new file mode 100644
index 0000000..f52f985
--- /dev/null
+++ b/src/power_input.c
@@ -0,0 +1,27 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <math.h>
+#include <errno.h>
+#include "yagi.h"
+
+extern int errno;
+
+/* uses formulae of page 1-12 of Lawsons book. No idea where
+it comes from! */
+
+double calculate_power_input(double real_z, struct  FCOMPLEX current)
+{
+	double power_input;
+	power_input=0.5*Cabs(current)*Cabs(current)*real_z;
+
+#ifdef DEBUG
+if(errno)
+	{
+		fprintf(stderr,"Errno =%d in pin.c\n", errno);
+		exit(1);
+	}
+#endif
+	return(power_input);
+}
diff --git a/src/print_relavent_performance_data.c b/src/print_relavent_performance_data.c
new file mode 100644
index 0000000..d44667e
--- /dev/null
+++ b/src/print_relavent_performance_data.c
@@ -0,0 +1,27 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include "yagi.h"
+
+void print_relavent_performance_data(FILE *fp,char *s, int i, struct flags flag , struct performance_data data, double fitness, int Z_Q, int fitness_Q)
+{
+	if(i!=0)
+		fprintf(fp,"%5d ",i);
+	else
+	{}
+	fprintf(fp,"%sG=%5.2fdBi,FB=%6.2fdB,",s,data.gain,data.fb);
+	fprintf(fp,"SL=%5.2fdB,",data.sidelobe);		
+	fprintf(fp,"SWR=%5.2f",data.swr);
+	if(Z_Q==TRUE)
+	{
+		fprintf(fp,",Z=%6.2f",data.r);
+		if(data.x<0.0)
+			fprintf(fp,"-j%6.2f",-data.x);
+		else
+			fprintf(fp,"+j%6.2f",data.x);
+	}
+	if(fitness_Q==TRUE)
+		fprintf(fp,",%.3f",fitness);
+	fprintf(fp,"\n");
+}
diff --git a/src/print_z_matrix.c b/src/print_z_matrix.c
new file mode 100644
index 0000000..374809d
--- /dev/null
+++ b/src/print_z_matrix.c
@@ -0,0 +1,17 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include "yagi.h"
+
+void print_z_matrix(double frequency, int elements, double **z)
+{
+	int i,j;		
+	printf("Z - Matrix at frequency = %f\n", frequency);
+	for(i=1;i<=elements;++i)
+	{
+		for(j=1;j<=2*elements;++j)
+			printf("% 7.2f ", z[i][j]);
+		printf("\n");
+	}  
+}
diff --git a/src/random.c b/src/random.c
new file mode 100644
index 0000000..957c585
--- /dev/null
+++ b/src/random.c
@@ -0,0 +1,88 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+/* I got fed up with every compiler system using a different name for the
+random number generator(s). So I use two random number generators in 
+th main code:
+
+1) randreal() Returns a double in range 0 to 1.
+2) randint()  Returns an integer in range 0 to 2^15-1.
+
+DONT change the names 'randreal' and 'randint' in all the other sources
+file. But DO edit the source of the two functions 'randreal' and
+'randint' in this C file. Let them call whatever you like/works on your
+system. 
+
+If you use another system (eg VAX), I suggest you put this in functions
+randreal and reandint:
+
+randint()
+{
+#ifdef VAX
+return(VAX_integer_random_number_generator());
+#endif
+}
+
+
+*/
+
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#endif
+
+#include <stdio.h>
+#include <math.h>
+
+#ifdef HAVE_RANDOM_H
+#include <random.h>  
+#endif
+
+
+#include <values.h>
+#include "yagi.h"
+
+double randreal(void)
+{
+	return(drand48());
+}
+double randnorm(void)
+{
+	static short paired=0 ;
+	static double second ;
+	double x,y,rad,fac ;
+
+	if (paired=!paired)
+	{
+		do {
+		x=2.0*randreal()-1.0 ;
+		y=2.0*randreal()-1.0 ;
+		rad=x*x+y*y ;
+		} while((rad>1.0)||(rad=0.0));
+		fac=sqrt(2.0*log(rad)/rad) ;
+		second=(x*fac) ;
+		paired=!paired ;
+		return (y*fac) ;
+	} else return (second);
+}       
+		
+		
+int randint(void)
+{
+	return( (int) lrand48()/65535 );
+}
+
+/* Since two random number gerators are used (a float and an int type), its
+usually necessary to seed both sepparately */
+void seedRNG(void)
+{
+	long seed_time;
+
+	time(&seed_time); /* set seed_time to the number of seconds since Jan 1980 */
+
+	srand48(seed_time);  /* Seed the float type */
+
+}
diff --git a/src/randomise.c b/src/randomise.c
new file mode 100644
index 0000000..4873222
--- /dev/null
+++ b/src/randomise.c
@@ -0,0 +1,122 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <math.h>
+#include <errno.h>
+#ifdef sun
+
+#endif
+#include "yagi.h"
+
+extern double boom_factor;
+extern int errno;
+#define MIN_RDS   0.05 /* Minimum reflector-driven spacing in lambda */
+
+void randomise(int randomisation_method, double frequency, double max_percent, double **driven_data, double**parasitic_data, int driven, int parasites)
+{
+	int i,elements;
+	static int run_first_time=0;
+	double y, old_boom_length, new_boom_length, a, lambda,**z,l,x,taper;
+	static double max_boom_length;
+	lambda=300/frequency;
+	if(run_first_time==0)
+	{
+		max_boom_length=(1+boom_factor/100)*parasitic_data[parasites][X];
+	}
+	run_first_time++;
+	if ((randomisation_method & DRIVEN_LENGTH) == DRIVEN_LENGTH) /* 1 */
+	{
+		for(i=1;i<=driven; ++i) /* randomise the driven */
+		{
+			y=1+0.02*max_percent*(randreal()-0.5);
+			driven_data[i][LENGTH]*=y;
+		}
+	}
+	if ((randomisation_method & DRIVEN_POSITION) == DRIVEN_POSITION) /* 2 */
+	{
+		for(i=1;i<=driven; ++i) /* randomise the driven position */
+		{
+			y=1+0.02*max_percent*(randreal()-0.5);
+			driven_data[i][X]*=y;
+		}
+	}
+	if ((randomisation_method & REFLECTOR_LENGTH) == REFLECTOR_LENGTH) /* 4 */
+	{
+
+	   /* reflector position stays at x=0 */
+		y=1+0.02*max_percent*(randreal()-0.5);
+		parasitic_data[1][LENGTH]*=y;
+	}
+
+	if ((randomisation_method & DIRECTOR_LENGTH) == DIRECTOR_LENGTH) /* 8 */
+	{
+		for(i=2; i<=parasites; ++i)
+		{
+			y=1+0.02*max_percent*(randreal()-0.5);
+			parasitic_data[i][LENGTH]*=y;
+			/* make sure directors dont get longer down the boom */
+			if((parasitic_data[i][LENGTH]>parasitic_data[i-1][LENGTH]) && (i>2))
+				parasitic_data[i][LENGTH]=parasitic_data[i-1][LENGTH]; 
+		}
+	}
+
+	if ((randomisation_method & DIRECTOR_POSITION) == DIRECTOR_POSITION) /* 16 */
+	{
+		old_boom_length=parasitic_data[parasites][X];    
+		y=1+0.02*max_percent*(randreal()-0.5);
+		new_boom_length=old_boom_length*y;
+		if(new_boom_length > max_boom_length)
+			new_boom_length=max_boom_length;
+		/* rearrange directors */
+		for(i=2; i<=parasites; ++i)
+		{
+			y=1+0.02*max_percent*(randreal()-0.5);
+			parasitic_data[i][X]*=y*(new_boom_length/old_boom_length);
+		}
+	}
+	if ((randomisation_method & ALL_ELEMENT_LENGTHS_IDENTICAL)==ALL_ELEMENT_LENGTHS_IDENTICAL) /* 32 */
+	{
+			y=1+0.02*max_percent*(randreal()-0.5);
+			for(i=1; i<=driven; ++i)
+				driven_data[i][LENGTH]*=y;
+			for(i=1; i<=parasites; ++i)
+				parasitic_data[i][LENGTH]=driven_data[1][LENGTH];
+	}
+	if ((randomisation_method & LINEAR_TAPER)==LINEAR_TAPER) /* 64 */
+	{
+		a=1+(0.1*randreal()); /* 1.00 to 1.1 */
+		taper=(a-1)/driven_data[1][X];
+		parasitic_data[1][LENGTH]=a*driven_data[1][3]; /* reflector = a*driven */
+		for(i=2; i<=parasites; ++i)
+				parasitic_data[i][LENGTH]=parasitic_data[1][3]-taper*(parasitic_data[i][X]-driven_data[1][X]);
+	}
+
+	if ((randomisation_method & RESONATE_DRIVEN)==RESONATE_DRIVEN) /* 128 */
+	{
+		if(run_first_time==1)
+		{
+			elements=driven+parasites;
+			z=dmatrix(1L,(long)elements,2L,2L*(long)elements);
+			l=0.44*lambda;
+			do
+			{
+				driven_data[1][LENGTH]=l;			
+				self_impedance(1, frequency*1e6,driven,parasites,driven_data,z);
+				l+=0.00005*lambda;
+				driven_data[1][LENGTH]=l;			
+				x=z[1][2];
+			}while(z[1][2]<0.0);
+			printf("Driven element set to :l=%f m = %f wavlengths\n",l,l/lambda);
+			free_dmatrix(z,1L,elements,1L,2L*elements);
+		}
+	}
+#ifdef DEBUG
+	if(errno)
+	{
+	fprintf(stderr,"Errno =%d in randomis.c\n", errno);
+	exit(1);
+	}
+#endif
+}
+
diff --git a/src/rantest.c b/src/rantest.c
new file mode 100644
index 0000000..4ab7f2e
--- /dev/null
+++ b/src/rantest.c
@@ -0,0 +1,31 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include "yagi.h"
+
+#define MAX 1000
+
+void         seedRNG();
+int main(int argc, char **argv)
+{
+	int i, k;
+	double realtype=0, inttype=0;
+
+	k=MAX;
+
+	seedRNG();
+
+	printf("This program prints a few integers and reals, to test your implementation of the random number generator (RNG) is okay. Run the program again to check they produce a different set of numbers - if not the RNG is not seeded correctly.\n");
+	for(i=1;i<=10;++i)
+		printf("%f %d\n", randreal(), randint());
+	printf("Now we print the average of %d floats and integers. If the figures are wildly different from those expected, check the RNG. The integer type must retun a number between 0 and 2^15-1. If It returns one between 0 and 2^31-1, you will need to modify the function randint()\n",k);
+	for(i=1;i<=MAX;++i)
+	{
+		realtype+=randreal();
+		inttype+=randint();
+	}
+	printf("The mean of %d floats was %.4f. It should have been about 0.5\n", MAX, realtype/MAX);
+	printf("The mean of %d integers was %.4f. It should have been about 16384\n", MAX, inttype/MAX);
+	exit(0);
+}
diff --git a/src/read_header.c b/src/read_header.c
new file mode 100644
index 0000000..5072045
--- /dev/null
+++ b/src/read_header.c
@@ -0,0 +1,46 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <errno.h>
+#include "yagi.h"
+extern int errno;
+
+int read_header(FILE *ifp, FILE *ofp, double *min_f, double *max_f,
+	 double *step_f, double *f, double *angular_step)
+{
+	int elements, driven, parasitic;
+
+	fread((char *) &elements, sizeof(elements), 1, ifp);
+	fread((char *) &driven, sizeof(driven), 1, ifp);
+	fread((char *) &parasitic, sizeof(parasitic), 1, ifp);
+	fread((char *) min_f, sizeof(*min_f), 1, ifp);
+	fread((char *) max_f,sizeof(*max_f), 1, ifp);
+	fread((char *) f, sizeof(*f), 1, ifp);
+	fread((char *) step_f, sizeof(*step_f), 1, ifp);
+	fread((char *) angular_step, sizeof(*angular_step), 1, ifp);
+	fseek(ifp, HEADER_SIZE, SEEK_SET);             /* skip rest of header */
+	/* now we make some basic checks on the header, to see nothing is too
+	far wrong. */
+	if( (*max_f < *min_f) || *angular_step==0 || driven+parasitic != elements || (*step_f >  *max_f))
+	{
+		fprintf(stderr,"Error in input file\n");
+		fprintf(stderr,"driven=%d parasitic=%d elements=%d\n",driven,parasitic,elements);
+		fprintf(stderr,"min_f=%f max_f=%f step_f=%f\n",*min_f, *max_f, *step_f);
+		fprintf(stderr,"angular_step=%f \n", *angular_step);
+		exit(19);
+	}
+	fprintf(ofp,"# Driven=%d parasitic=%d total-elements=%d design=%.3fMHz\n", driven, parasitic, elements,  *f/1e6);
+	fprintf(ofp,"# Checked from %.3fMHz to %.3fMHz.\n", *min_f/1e6, *max_f/1e6);
+
+#ifdef DEBUG
+	if(errno)
+	{
+		fprintf(stderr,"Errno =%d in read_hea.c\n", errno);
+		exit(1);
+	}
+#endif
+	return(elements);
+}
diff --git a/src/read_yagi_data.c b/src/read_yagi_data.c
new file mode 100644
index 0000000..d933823
--- /dev/null
+++ b/src/read_yagi_data.c
@@ -0,0 +1,79 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <string.h>
+#include "yagi.h"
+
+void read_yagi_data(char *one_line, char *input_filename, double *frequency, double *min_frequency, double *max_frequency, double *step_frequency, int driven , double **d, int parasitic, double **p, double *angular_step)
+{
+	FILE *ifp;
+	char *null, *tmp;
+	int i;
+
+	null=string(0L,MAX_LINE);
+
+	tmp=string(0L,MAX_LINE);
+	ifp=fopen(input_filename, "rt");
+	if(ifp == NULL)
+	{
+		fprintf(stderr,"Sorry, cant find file:  %s\n", input_filename);
+		exit(2);
+	}
+	/* Read one_line by one_line, looking for data on the elements */
+	while(!feof(ifp))
+	{
+		fgets(one_line, MAX_LINE-1, ifp);
+
+		if(strncmp(one_line,"STEP_FREQUENCY",14) == 0)  
+		{
+			sscanf(one_line,"%s %lf", null, step_frequency);
+			*step_frequency*=1e6;
+		}
+		if(strncmp(one_line,"MIN_FREQUENCY",13) == 0)  
+		{
+			sscanf(one_line,"%s %lf", null, min_frequency);
+			*min_frequency*=1e6;
+		}
+		if(strncmp(one_line,"MAX_FREQUENCY",13) == 0)  
+		{
+			sscanf(one_line,"%s %lf", null, max_frequency);
+			*max_frequency*=1e6;
+		}
+		if(strncmp(one_line,"ANGULAR_STEP",12) == 0)  
+		{
+			sscanf(one_line,"%s %lf", null, angular_step);
+		}
+		if(strncmp(one_line,"FREQUENCY",9) == 0)  
+		{
+			sscanf(one_line,"%s %lf", null, frequency);
+			*frequency*=1e6;
+		}
+		if(strncmp(one_line,"DATA_PARASITIC",14) == 0)  
+		{
+			one_line+=14;
+			for(i=1;i<=parasitic; ++i)
+			{
+				fgets(one_line, MAX_LINE-1, ifp);
+				sscanf(one_line,"\n%lf %lf %lf %lf",&p[i][X], &p[i][Y], &p[i][LENGTH], &p[i][DIAMETER] );
+			}
+		}
+		if(strncmp(one_line,"DATA_DRIVEN",11) == 0)  
+		{
+			one_line+=11; /* skip DATA_DRIVEN */
+			for(i=1;i<=driven; ++i)
+				sscanf(one_line, "%lf %lf %lf %lf %lf %lf\n", &d[i][X], &d[i][Y], &d[i][LENGTH], &d[i][DIAMETER], &d[i][VOLTAGE_R], &d[i][VOLTAGE_I]);
+		}
+	}
+	fclose(ifp);
+	if(*min_frequency > *max_frequency || *angular_step <= 0 || *step_frequency <=0.0 || *frequency <=0.0 )
+	{
+		fprintf(stderr,"Error in input file %s. Please check:\n", input_filename);
+		fprintf(stderr,"FREQUENCY, MIN_FREQUENCY, MAX_FREQUENCY, STEP_FREQUENCY and ANGULAR_STEP\n");
+		exit(1);
+	}
+
+	free_string(null,0L,MAX_LINE); 
+	free_string(tmp,0L,MAX_LINE); 
+}
+
diff --git a/src/reflection_coefficient.c b/src/reflection_coefficient.c
new file mode 100644
index 0000000..cd432da
--- /dev/null
+++ b/src/reflection_coefficient.c
@@ -0,0 +1,28 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <math.h>
+#include <errno.h>
+#include "yagi.h"
+extern int errno;
+extern double Zo;
+
+void reflection_coefficient(struct FCOMPLEX zi, double *magnitude, double *phase)
+{
+	struct FCOMPLEX zo, rho;
+
+	/* reflection coefficient rho = (Zi-Zo)/(Zi+Zo) */
+	zo.r=Zo;
+	zo.i=0;
+	rho=Cdiv(Csub(zi, zo), Cadd(zi,zo));
+	*magnitude=Cabs(rho);
+	*phase=atan2(rho.i,rho.r);
+#ifdef DEBUG
+	if(errno)
+	{
+	fprintf(stderr,"Errno =%d in refco.c \n", errno);
+	exit(1);
+	}
+#endif
+}
diff --git a/src/self.c b/src/self.c
new file mode 100644
index 0000000..adfca05
--- /dev/null
+++ b/src/self.c
@@ -0,0 +1,47 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#ifndef i386
+ 
+#endif
+#include <math.h>
+#include <errno.h>
+#include "yagi.h"
+extern int errno;
+
+void self_impedance(int i, double frequency, int driven, int parasitic, double **data, double **impedance)
+{
+	int j, row, column_real, column_imag, max_data, ii;
+	double lambda,  x , length,  diameter;
+	double radius, real;
+
+	ii=i;
+	/* Put the complex value of impedance for each element into
+	the array. This is a complex, as the array sizes for
+	driven and parasitic elements are different */
+
+	/* first compute the wavelength */
+	lambda=3e8/frequency;
+
+	row=i; 				   /* write data to row, column_real_or_imag */
+	column_real=2*i-1;
+	column_imag=2*i;
+	if(i <= driven)
+	{
+		max_data=MAX_DRIVEN;
+	}
+	else if (i > driven)    			 /* parasitic element */
+	{
+		max_data=MAX_PARASITIC;
+		i-=driven;							/* read from i-driven */
+	}
+	diameter=data[i][DIAMETER];
+	length=data[i][LENGTH];
+	j=2*ii-1;
+	/* Use method in 'Antenna Theory' Baluns ' */
+	radius=diameter/2.0;   /* radius */
+	self(radius,length,lambda,&real,&x);
+	impedance[row][column_imag]= x; /* write imaginary data to array */
+	impedance[ii][j]= real;  
+}
diff --git a/src/self2.c b/src/self2.c
new file mode 100644
index 0000000..6adb965
--- /dev/null
+++ b/src/self2.c
@@ -0,0 +1,70 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <math.h>
+#include "yagi.h"
+
+/* This routine finds the self impedance of a dipole of arbitrary
+length 'length' , radius 'r' at a wavelength 'wavelength' 
+
+Both the real part R and the imaginary part X are returned. R is
+found from Antenna Theory, Analysis and Design, by Balans (Published
+by Harper and Row). 
+
+The real part, Rin is found by computing the radiation resistance Rr 
+(equ 4-70, pp 124) then computing Rin=Rr/(sin(k l/2)^2, as given by 
+equ 7-30a, pp 294. 
+
+The reactive part, Xin is found by computing Xm (equ 7-33, pp 294)
+then using xin=Xm/(sin(k l/2)^2 (equ 70-30b pp 294). */
+
+void self(double r, double length, double lambda, double *Rin, double *Xin)
+{
+	double beta, mu, epsilon,eta,sin_bl,cos_bl,current_scale_factor;
+	double bl, ci_bl, si_bl, ci_2bl, si_2bl,Xm,Rr;
+
+	beta=2*M_PI/lambda;
+	mu=4*M_PI*1e-7;
+	epsilon=8.854187818e-12;
+	eta=sqrt(mu/epsilon);
+	bl=beta*length;
+
+	/* We often need si(bl) , si(2*bl), ci(bl), ci(2*bl). These are
+	time consuming to calculate, so I calculate just once. The Numerical
+	recipes routine cisi, calculates both si and ci at the same time,
+	so I wont use my routines ci and si, which both simply call cisi,
+	but was one of the results */
+	cisi(bl, &ci_bl, &si_bl);
+	cisi(2*bl, &ci_2bl, &si_2bl);
+	sin_bl=sin(bl);
+	cos_bl=cos(bl);
+	/* imaginary part of zin given by Balans, pp 294 */
+	Xm=(eta/(4*M_PI)) * 
+	(2*si_bl+ cos_bl*( 2*si_bl - si_2bl ) 
+	-sin_bl*( 2*ci_bl-ci_2bl-ci(2*beta*r*r/length)) ); 
+	current_scale_factor=sin(bl/2)*sin(bl/2); /* sin(bl/2)^2 */
+	*Xin=Xm/current_scale_factor; /* Xin=Xm/(sin(bl/2)*sin(bl/2)); */
+	/* The radiation resistance, as described by Balans C. A. Antenna theory,
+	pp124, Published by Harper and Row, (1982)  */
+
+	/* Rr=(eta/(M_PI*2.0))*(EULER+log(bl)-ci_bl+0.5*sin_bl*
+	(si_2bl-2.0*si_bl)+0.5*cos_bl
+	*(EULER+log(bl/2)+ci_2bl-2*ci_bl)); */
+	Rr=(eta/(2.0*M_PI))*(EULER+log(bl)-ci_bl+0.5*sin_bl*(si_2bl-2.0*si_bl)+0.5*cos_bl*(EULER+log(bl/2.0)+ci_2bl-2*ci_bl));
+	*Rin=Rr/current_scale_factor;
+	/* printf("Rr=%f Rin=%f csf=%f\n",Rr,*Rin,current_scale_factor); */
+	/* I'm a little bothered that Rin falls to ~60 Ohms at 
+	resonance. Lawson suggested using 73, which would imply a large error.
+	A graph in RadCom by G3SEK would suggest the 60 Ohms is too low. A 
+	graph in Krauss, would suggest ~70 Ohms, so what is going on????
+	I thought I'd use an equation in Krauss, but since this is the 
+	Brown and King formuala given in Balans, that too gives ~60 Ohms.
+	The formula in Krass ignores the diameter, but gives much the same values
+	as the Balan's method */
+	/* Now compute by method in Krauss, pp 421. */
+	/* cot_bl_over_2=1.0/(tan(bl/2.0)); */
+
+	/* *Rin=30.0*(   (1.0-(cot_bl_over_2*cot_bl_over_2))*Cin(2.0*bl)+4*cot_bl_over_2*cot_bl_over_2*Cin(bl)+2.0*cot_bl_over_2*(si_2bl-2.0*si_bl)        ); 
+	printf("Rin=%f\n",*Rin); */
+}
diff --git a/src/selftest.c b/src/selftest.c
new file mode 100644
index 0000000..4be38f2
--- /dev/null
+++ b/src/selftest.c
@@ -0,0 +1,18 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <math.h>
+#include "yagi.h"
+
+int main(int argc, char **argv)
+{
+   double r=0.0008, x, real, length, lambda=300/8.05;
+   for(length=0.45*lambda; length <=0.52*lambda; length+=0.001*lambda) 
+   {
+      self(r, length, lambda, &real, &x);
+      printf("Z = %f  %f jX \n", length/lambda,real,x);
+   }
+   printf("\n");
+   exit(0);
+}
diff --git a/src/sens.c b/src/sens.c
new file mode 100644
index 0000000..b79f0a4
--- /dev/null
+++ b/src/sens.c
@@ -0,0 +1,48 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+/* file sens.c */
+
+#include <stdio.h>
+#include <math.h>
+
+#include <errno.h>
+#include "yagi.h"
+
+extern int errno;
+extern double boom_factor;
+
+void sensitivity(double boom_sd, double length_sd, double **driven_data, double**parasitic_data, int driven, int parasites)
+{
+	int i;
+	double x,y;
+	/* data in 2D arrays is in m. User enters SD in mm, hence *0.001 */
+
+	
+	/* adjust director length only. Keep at x=0 */
+
+	x=parasitic_data[1][LENGTH];
+	parasitic_data[1][LENGTH]+=length_sd*0.001*gaussian();
+	y=parasitic_data[1][LENGTH];
+	/* Adjust other parasites */
+	for(i=2;i<=parasites;++i)
+	{
+		parasitic_data[i][X]+=boom_sd*0.001*gaussian();
+		parasitic_data[i][LENGTH]+=length_sd*0.001*gaussian();
+	}
+	for(i=1; i<=driven; ++i)
+	{
+		driven_data[i][X]+=boom_sd*0.001*gaussian();
+		driven_data[i][LENGTH]+=length_sd*0.001*gaussian();
+	}
+
+#ifdef DEBUG
+	if(errno)
+	{
+		fprintf(stderr,"Errno =%d in sens.c\n", errno);
+		exit(1);
+	}
+#endif
+
+}
+
diff --git a/src/set_mean_structure.c b/src/set_mean_structure.c
new file mode 100644
index 0000000..f1e51c8
--- /dev/null
+++ b/src/set_mean_structure.c
@@ -0,0 +1,26 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include "yagi.h"
+
+void set_mean_structure(struct FCOMPLEX input_impedance, \
+double E_fwd, double E_back,struct flags flag, double pin,struct element_data *coordinates, struct FCOMPLEX *current, int elements, double frequency, double design_frequency, struct performance_data *mean_performance)
+{
+	
+	double magnitude,phase,vswr;
+	int choice;
+	choice=flag.oflg;
+	reflection_coefficient(input_impedance,&magnitude,&phase);
+	vswr=calculate_vswr(magnitude);
+	mean_performance->gain=+E_fwd;
+	mean_performance->fb=+(E_fwd-E_back);
+	mean_performance->swr=+vswr;
+	mean_performance->r=input_impedance.r;   /* in Ohms */
+	mean_performance->x=input_impedance.i;   /* in Ohms */
+	if((choice&SIDE_LOBE_LEVEL)==SIDE_LOBE_LEVEL  || flag.Tflg || ((flag.Wflg&SIDE_LOBE_LEVEL)==SIDE_LOBE_LEVEL) )
+		mean_performance->sidelobe+=find_max_sidelobe_fast(E_fwd, pin,coordinates,current,elements,frequency,design_frequency);
+	else
+		mean_performance->sidelobe=0.0;
+}
+
diff --git a/src/set_performance_structures.c b/src/set_performance_structures.c
new file mode 100644
index 0000000..544a5d8
--- /dev/null
+++ b/src/set_performance_structures.c
@@ -0,0 +1,34 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include "yagi.h"
+/* This function set the structures to have sensible values. They
+often get altered, by command line options */
+void set_performance_structures(struct performance_data *weight, struct \
+performance_data *max, struct performance_data *best, struct performance_data *worst)
+{
+	weight->swr=1.0; /* initial weights. Use can change */
+	weight->fb=1.0;
+	weight->sidelobe=1.0;
+	weight->gain=1.0;
+
+	max->fb=REASONABLE_FB;   /* Initial max values worth getting.  */
+	max->swr=REASONABLE_SWR; /* ie reasonable values, set in yagi.h */
+	max->r=REASONABLE_R;    /* user can change these with options */
+	max->x=REASONABLE_X;    /* such as -fy, -sy, -ry, -xy, -py */
+	max->sidelobe=REASONABLE_SIDELOBE; /* where 'y' is a double */
+
+	best->swr=99.0; /* Assumed values of the staring antenna ie. poor antenna */
+	best->gain=-1000.0;
+	best->fb=-1000.0;
+	best->r=1000.0;
+	best->x=1e19;
+	best->sidelobe=-1000.0;
+
+	worst->gain=1000.0;
+	worst->sidelobe=1000.0;
+	worst->fb=1000.0;
+	worst->swr=1.00;	
+
+}
diff --git a/src/show_all_optimise_parameters.c b/src/show_all_optimise_parameters.c
new file mode 100644
index 0000000..6255816
--- /dev/null
+++ b/src/show_all_optimise_parameters.c
@@ -0,0 +1,41 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <errno.h>
+#include "yagi.h"
+extern int errno;
+
+/* Since there are a large number of parametres set in the header file
+and 'optimise.c', I've added a function to print the lot. This will
+be more accurate than putting them in the man page, since that tends
+to get out of date */
+
+extern double  percent;
+extern double Zo, boom_factor;
+extern struct performance_data max,weight;
+
+void show_all_optimise_parameters(char *exefile,struct flags flag)
+{
+	int choice=flag.oflg;
+	printf("%s version %.2f\n", exefile,version() );
+	printf("Zo=%f Ohms \n", Zo);
+	printf("Acceptable VSWR < %.3f:1\n", max.swr);
+	printf("Acceptable FB > %.3f dB\n", max.fb);
+	printf("Acceptable reactance < %.3f Ohms\n", max.x);
+	printf("Acceptable resistance %.3f < R < %.3f Ohms\n", Zo-max.r, Zo+max.r);
+	printf("Maximum percentage change between each iteration is %.6f%%\n", percent);
+	printf("weight_gain=%.4f weight_fb=%.5f weight_swr=%.4f\n", weight.gain, weight.fb, weight.swr);
+	printf("Type of elements moved/adjusted is %d\n", flag.eflg);
+	printf("Default choice of optimisation method is %d\n", choice);
+	printf("Boom will not extend by more than %.3f%%\n", boom_factor);
+
+#ifdef DEBUG
+	if(errno)
+	{
+		fprintf(stderr,"Errno =%d in showopt.c\n", errno);
+		exit(1);
+	}
+#endif
+}
+
diff --git a/src/solve.c b/src/solve.c
new file mode 100644
index 0000000..0b315b8
--- /dev/null
+++ b/src/solve.c
@@ -0,0 +1,130 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <memory.h>
+#include <errno.h>
+#include "yagi.h"
+extern int errno;
+
+#define MAX_NON_ITERATIVE 100000
+
+void solve_equations(double frequency, int driven, int parasitic, double **driven_data, double **parasitic_data, double *v, double **z, double *pin, struct FCOMPLEX *voltage, struct FCOMPLEX *current, struct FCOMPLEX *input_impedance, struct element_data *coordinates, double **A, double *b, int *indx)
+{
+	int elements, element_number, i, j;
+	double d, **A_pre_LUdcmp, *b_copy, t1, t2;
+	elements=driven+parasitic;
+	fill_z_matrix(frequency,driven,parasitic,driven_data,parasitic_data, z);
+	/* Now we must fill the V vector, which gives the voltage at the centre of
+	each driven element. Since we know the magnitude of the voltage and phase,
+	we can calculate the real and imaginary components of voltage. NB */
+	fill_v_vector(driven, parasitic, driven_data, v);
+
+	/* We now have the voltage vector V, and the impedance matrix Z. All
+	we need to do now is solve a set of NxN equations, where N is the
+	number of elements, to get N values of current, which we can put in
+	the I matrix.
+	Unfortunately, this is not trivual, by any standards!!!  It is
+	complicated by the fact the the N equations are all complex. 
+	The method used us a brute-force approach mentioned by Press
+	in their 2nd Edition of the Numerical Recipes in C book. Here we
+	put the data in the form:
+	
+	|Zr -Zi|   |Ir|   = |Vr|   which we will call A.x=b
+	|Zi  Zr|   |Ii|     |Vi| 
+		
+	so the Z data goes now in a 2Nx2N matrix. This is a bit wasteful of space
+	and time, but it will do here. */
+	/* Copy impedance data from 'z' to matrix A */
+	copy_complex_data_to_real_matrix(elements,z,A);
+	/* The following function prints to stantard output the z matrix of the
+	antenna. It is really only used during debugging, so it can be commented
+	out normally. */
+	/* print_z_matrix(frequency,elements,z);  */
+	/* read voltage data from v into b */
+	for(i=1;i<=elements;++i)
+	{
+		b[i]= v[2*i-1];           /* real data */
+		b[i+elements]=v[2*i];    /* imaginary data */
+		voltage[i].r=v[2*i-1];
+		voltage[i].i=v[2*i];
+	}
+	/* If there are a lot of elements, its possible that rounding errors
+	will destroy the accuracy of the results. If there are more than 
+	MAX_NON_ITERATIVE elements, we do the usual LU decompositioon and
+	back-substitution, then do an iterative improvement of the 
+	solution */
+	if(elements > MAX_NON_ITERATIVE)
+	{
+		A_pre_LUdcmp=dmatrix(1L, 2L*(long)elements, 1L, 2L*(long) elements);
+		b_copy=dvector(1L, 2L*(long)elements);
+		/* I had troubled using memcpy to copy matrices - probably becuase
+		they are offset by  1 */
+		copy_matrix(2*elements, 2*elements, A_pre_LUdcmp, A);
+		/* copy vector b */
+		for(j=1;j<=2*elements;++j)
+			b_copy[j]=b[j];
+	}
+	/* Perform a LU decompositon of A */
+	ludcmp(A, elements*2, indx, &d);
+	/* We now have the voltages in b. After lubksb is run, we get the 
+	currents in b . A contains an LU decomposed version of the original A*/
+	lubksb(A, 2*elements, indx, b); /* current's in b after lubksb has run*/
+	if(elements>MAX_NON_ITERATIVE)
+	{
+		t1=b[1];
+		mprove(A_pre_LUdcmp, A, 2*elements, indx, b_copy, v);
+		free_dmatrix(A_pre_LUdcmp,1L, 2L*(long)elements, 1L, 2L*(long) elements);
+		/* free_dvector(bcopy,1L,2L*elements); */
+	   t2=b[1];
+		if(t1!=t2)
+		{
+			printf("b[1]'s differ before and after mprove: before = %.16f after =%.16f\n", t1, t2);
+			exit(1);
+		}
+	}
+	/* Put currents an FCOMPLEX matrix current[element] 
+	currents are stored in b as r,r,r,r ..... i,i,i,i */
+	for(element_number=1;element_number<=elements;element_number++) 
+	{
+		current[element_number].r=b[element_number];
+		current[element_number].i=b[element_number+elements];
+	} 
+	z_input(voltage[1], current[1], input_impedance);
+	*pin=calculate_power_input(input_impedance->r,current[1]); /* in Watts */
+	/* Sometimes the input power goes < 0. I'm not sure why this occurs, but
+	the implication is that the antenna is a source of energy, which is silly.
+	The gain is negative then (not in dB), so taking the log to put in dB
+	would cause a numerical error. When this occurs, we print a message to
+	stderr, then write the data in a file "problem". The user may then 
+	investigate what went wrong. */
+	if(*pin <= 0.0)
+	{
+		/* fprintf(stderr,"Input power less than 0! Undesirable, but non-fatal error.\n"); */
+		*pin=1e20; /* Force it to a large value */
+   /* do_since_better(0,"problem","problem",*input_impedance, \
+	rubbish,flag, "This causes Pin < 0.0 - findout why!",frequency, frequency, \
+	frequency,frequency/10.0, elements, driven, parasitic, \
+	180.0, driven_data, parasitic_data, 1.0, 0.0); */
+	} 
+	for(i=1;i<=driven;++i)
+	{
+		coordinates[i].x=driven_data[i][X];
+		coordinates[i].y=driven_data[i][Y];
+		coordinates[i].length=driven_data[i][LENGTH];
+	}
+	for(i=driven+1;i<=elements;++i)
+	{
+		coordinates[i].x=parasitic_data[i-driven][X];
+		coordinates[i].y=parasitic_data[i-driven][Y];
+		coordinates[i].length=parasitic_data[i-driven][LENGTH];
+	}
+
+#ifdef DEBUG
+	if(errno)
+	{
+	fprintf(stderr,"Errno =%d in solve.c\n", errno);
+	exit(1);
+	}
+#endif
+}
diff --git a/src/string.c b/src/string.c
new file mode 100644
index 0000000..3a2c4f7
--- /dev/null
+++ b/src/string.c
@@ -0,0 +1,98 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <malloc.h>
+#include "yagi.h"
+
+
+/* The authors of the book 'Numerical Recipes in C' were kind enough
+to make the utility routines in the files 'nrutil.c' and 'nrutil.h'
+public domain. Hence I can include both without any problems */
+
+
+#define NR_END 1
+#define FREE_ARG char*
+
+#ifndef size_t         /* gcc needs this */
+#define size_t int
+#endif
+
+char *string(long nl,long nh)
+{
+	char *v;
+
+	v=(char *)malloc((unsigned) (nh-nl+1)*sizeof(char));
+	if (!v) nrerror("allocation failure in string()");
+	return v-nl;
+}
+
+void free_string(char *v, long nl, long nh)
+/* free a string allocated with string() */
+{
+	/* free((FREE_ARG) (v+nl-NR_END)); */
+	free((FREE_ARG) (v+nl));
+}
+
+struct FCOMPLEX **FCOMPLEXmatrix(long nrl, long nrh, long ncl, long nch)
+/* allocate a FCOMPLEX matrix with subscript range m[nrl..nrh][ncl..nch] */
+{
+	long i, nrow=nrh-nrl+1,ncol=nch-ncl+1;
+	struct FCOMPLEX **m;
+
+	/* allocate pointers to rows */
+	m=(struct FCOMPLEX **) malloc((size_t)((nrow+NR_END)*sizeof(struct
+	FCOMPLEX*)));
+	if (!m) nrerror("allocation failure 1 in matrix()");
+	m += NR_END;
+	m -= nrl;
+
+	/* allocate rows and set pointers to them */
+	m[nrl]=(struct FCOMPLEX *) malloc((size_t)((nrow*ncol+NR_END)*sizeof(struct FCOMPLEX)));
+	if (!m[nrl]) nrerror("allocation failure 2 in matrix()");
+	m[nrl] += NR_END;
+	m[nrl] -= ncl;
+
+	for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol;
+
+	/* return pointer to array of pointers to rows */
+	return m;
+}
+
+struct element_data *element_data_vector(long nl, long nh)
+/* allocate an element_data vector with subscript range v[nl..nh] */
+{
+	struct element_data *v;
+
+	v=(struct element_data  *)malloc((size_t) ((nh-nl+1+NR_END)*sizeof(struct element_data)));
+	if (!v) nrerror("allocation failure in element_data_vector()");
+	return v-nl+NR_END;
+}
+
+struct FCOMPLEX *FCOMPLEXvector(long nl, long nh)
+/* allocate a FCOMPLEX vector with subscript range v[nl..nh] */
+{
+	struct FCOMPLEX *v;
+
+	v=(struct FCOMPLEX *)malloc((size_t) ((nh-nl+1+NR_END)*sizeof(struct FCOMPLEX)));
+	if (!v) nrerror("allocation failure in FCOMPLEXvector()");
+	return v-nl+NR_END;
+}
+
+void free_FCOMPLEXmatrix(struct FCOMPLEX **m, long nrl, long nrh, long ncl, long nch)
+{
+        free((FREE_ARG) (m[nrl]+ncl-NR_END));
+        free((FREE_ARG) (m+nrl-NR_END));
+}
+
+void free_FCOMPLEXvector( struct FCOMPLEX *v, long nl, long nh)
+{
+        free((FREE_ARG) (v+nl-NR_END));
+
+}
+
+void free_element_data_vector( struct element_data *v, long nl, long nh)
+{
+        free((FREE_ARG) (v+nl-NR_END));
+
+}
diff --git a/src/subtract_structures.c b/src/subtract_structures.c
new file mode 100644
index 0000000..c9c421e
--- /dev/null
+++ b/src/subtract_structures.c
@@ -0,0 +1,20 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <math.h>
+#include "yagi.h"
+
+struct performance_data subtract_structures(struct performance_data a, struct performance_data b)
+{
+	struct performance_data ans;
+
+	ans.gain=a.gain-b.gain;
+	ans.fb=a.fb-b.fb;
+	ans.swr=a.swr-b.swr;
+	ans.r=a.r-b.r;
+	ans.x=a.x-b.x;
+	ans.sidelobe=a.sidelobe-b.sidelobe;
+	return(ans);
+}
+
diff --git a/src/test2.c b/src/test2.c
new file mode 100644
index 0000000..ed76fe0
--- /dev/null
+++ b/src/test2.c
@@ -0,0 +1,81 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <math.h>
+#include <errno.h>
+#include "yagi.h"
+
+extern int errno;
+
+int main(int argc, char **argv)
+{
+	double r,x,d;
+	for(d=0.0000001;d<=1;d+=0.02)
+	{
+		z21(1.0,d,0.5, &r, &x);
+		printf("%f %f %f %f \n", d,r,x, sqrt(r*r+x*x));
+	}
+	exit(0);
+}
+
+/* To find the mutual impedance between to arbitary length, thin elements
+I used the equations on Krauss, Antennas, McGraw Hill, 1988, pp426 and
+427. Original work from Brown and King, 'High Frequency Models in Antenna
+Investigations', Proc IRE, vol 22, pp457-480, April 1934*/
+void z21(double lamda, double d, double l, double *r21, double *x21)
+{
+
+	double  b, cos_bl, sin_bl, sin_bl_over_2, cos_bl_over_2, c, s ;
+	double t1, t2, t3, t4;
+	double si_t1, ci_t1, si_t4, ci_t4, ci_bd, si_bd;
+	double ci_t2, si_t2, ci_t3, si_t3;
+
+	b=M_PI*2/lamda;
+	t1=b*(sqrt(d*d+l*l)+l);
+	t2=0.5*b*(sqrt(4*d*d+l*l)-l);
+	t3=0.5*b*(sqrt(4*d*d+l*l)+l);
+	t4=b*(sqrt(d*d+l*l)-l);
+	/* To save findinding the same slow trigometric and ever slower
+	si and ci functions, I'll just look them up once */
+	cos_bl=cos(b*l);
+	sin_bl=sin(b*l);
+	sin_bl_over_2=sin(b*l/2);
+	cos_bl_over_2=cos(b*l/2);
+	s=sin_bl_over_2*sin_bl_over_2;
+	c=cos_bl_over_2*cos_bl_over_2;
+
+	cisi(t1, &ci_t1, &si_t1);
+	cisi(t2,&ci_t2, &si_t2);
+	cisi(t3,&ci_t3, &si_t3);
+	cisi(t4, &ci_t4, &si_t4);
+	cisi(b*d,&ci_bd, &si_bd);
+	/* Real part of mutual impedance, computed as equation on page
+	426 of Kraus */
+	*r21=(30/s)*(2*(2+cos_bl)*ci_bd
+	-4*c*( ci_t2 + ci_t3 )
+	+cos_bl*( ci_t4 + ci_t1 )
+	+sin_bl* ( si_t1 - si_t4 -2*si_t3 +2*si_t2 ) );
+
+	/* Imaginary part of mutual impedance, computed as equation on page
+	427 of Kraus */
+	*x21=(30/s)*(-2*(2+cos_bl)*si_bd
+	+4*c*( si_t2 + si_t3 )
+	-cos_bl*( si_t4 + si_t1 )
+	+sin_bl* ( ci_t1 - ci_t4 -2*ci_t3 +2*ci_t2 ) );
+#ifdef DEBUG
+	if(errno)
+	{
+		fprintf(stderr,"Errno =%d in  z21() mutual.c\n", errno);
+		exit(1);
+	}
+#endif
+}  
+
+double ci(double x)			/* cosine integral */
+{
+	double null, result;
+
+	cisi(x, &result, &null);
+	return(result);
+}
diff --git a/src/test_stop.c b/src/test_stop.c
new file mode 100644
index 0000000..855dd77
--- /dev/null
+++ b/src/test_stop.c
@@ -0,0 +1,18 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include "yagi.h"
+
+extern int errno;
+
+void test_for_stop_file(void)
+{
+	if (   fopen("stop","r") !=NULL        )
+	{
+		fprintf(stderr,"Remove the file \"stop\" first\n");
+		exit(1);
+	}
+	else
+		errno=0;
+}
diff --git a/src/usage_first.c b/src/usage_first.c
new file mode 100644
index 0000000..813b67e
--- /dev/null
+++ b/src/usage_first.c
@@ -0,0 +1,18 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include "yagi.h"
+
+void usage_first(char *exefile) 
+{
+	fprintf(stderr,"\nYagi-Uda antenna analysis programs, version %.2f\n", version());
+	fprintf(stderr,"Written by Dr. David Kirkby Ph.D. G8WRB (email:david.kirkby at onetel.net)\n");
+	fprintf(stderr,"Usage: %s filename elements min_f f max_f step_f diameter\n",exefile);
+	fprintf(stderr,"       where frequencies are in MHz and diameter is in mm\n");
+	fprintf(stderr,"'first' is used to define an antenna quickly, according to DL6WU designs.\n");
+	fprintf(stderr,"It is much faster in use than 'input'\n");
+		fprintf(stderr,"Example: first 145e20 20 144 145 146 .1 6.3\n\n");
+		fprintf(stderr,"will make a file '145e20' containing a description of a 20 element DL6WU yagi, \nfor 144-146 MHz, designed at 145MHz, which 'yagi' will calculate in steps of \n0.1MHz. The antenna uses 6.3mm diameter elements.\n");
+
+}
diff --git a/src/usage_input.c b/src/usage_input.c
new file mode 100644
index 0000000..6cdb0fe
--- /dev/null
+++ b/src/usage_input.c
@@ -0,0 +1,27 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include "yagi.h"
+
+void usage_input(char *exefile)
+{
+
+	fprintf(stderr,"\nYagi-Uda antenna analysis programs, version %.2f\n", version());
+	fprintf(stderr,"Written by David Kirkby BSc MSc G8WRB (email:david.kirkby at onetel.net)\n");
+	fprintf(stderr, "\nUSAGE: %s  [-h] \n\n", exefile);
+
+	fprintf(stderr, "Where the only option is:\n");
+	fprintf(stderr, "   -h     Print this help screen\n\n\n");
+
+	fprintf(stderr,"'input' is an interactive program, that asks the user for formation  about  \n");
+	fprintf(stderr,"a  Yagi  design,  such as position of elements, spacing between elements,\n");
+	fprintf(stderr,"frequency span of interest and a  filename to  save the data to. It then \n");
+	fprintf(stderr,"writes this information into an ASCII file, which can be read by 'yagi' or \n");
+	fprintf(stderr,"'optimise'. The file is  ASCII  and  it's format  is  easily  understood\n");
+	fprintf(stderr,"by inspection (there are comments printed in it), so it can if necessary\n");
+	fprintf(stderr,"be edited manually. After running 'input' and specifying a filename \n");
+	fprintf(stderr,"(for example 144e10) you should then type 'yagi 144e10' then 'output 144e10'\n");
+	fprintf(stderr,"and then and optionally 'optimise 144e10'.\n");
+}
+
diff --git a/src/usage_optimise.c b/src/usage_optimise.c
new file mode 100644
index 0000000..b4d7f83
--- /dev/null
+++ b/src/usage_optimise.c
@@ -0,0 +1,32 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <string.h>
+#include "yagi.h"
+
+extern double percent;
+extern double  Zo;
+extern struct performance_data max;
+
+void usage_optimise(char *str)
+	{
+
+		fprintf(stderr,"\nYagi-Uda antenna analysis programs, version %.2f\n", version());
+		fprintf(stderr,"Written by Dr. David Kirkby Ph.D. G8WRB (email:david.kirkby at onetel.net)\n");
+		fprintf(stderr, "\nUSAGE: %s  [options] filename iterations.\n\n", str);
+		fprintf(stderr,"The default behaviour of 'optimise' is to optimise the Yagi description \ncontained in the file 'filename', adjusting the lengths and positions of just \nthe parasitic elements upto %.2f%% each time, to achieve a better gain, vswr and F/B ratio, but not bothering to go beyond reasonable limits currently set at:\n",percent);
+		fprintf(stderr,"  F/B ratio > %.1f dB\n", max.fb);
+		fprintf(stderr,"  %f < Rin < %f \n", Zo-max.r, Zo+max.r);
+		fprintf(stderr,"  | Xin | < %.2f Ohms\n", max.x);
+		fprintf(stderr,"  VSWR < %.2f:1\n", max.swr);
+		fprintf(stderr,"This will continue for the number of iterations specified in 'iterations' or \nuntil a file called 'stop' is created in the current directory.\n");
+		fprintf(stderr,"These are a number of options for 'optimise' which can adjust such things as:\n");
+		fprintf(stderr," -gx=GA, -ox = improve all, -Wx = weighted\n");
+		fprintf(stderr," -gx or ox or -Wx where x=1(G),2(FB),4(R),8(X),16(VSWR),32 (SL)\n"); 
+		fprintf(stderr," -f, -p, -r, -s, -x Set reasonable values of F/B, pattern cleanliness, R, VSWR and X\n");
+		fprintf(stderr," -F, -G, P, -R -S and -X Set weights of F/B, gain , pattern cleanliness, resistance, VSWR and reactance, (all need -W or -g flags)\n");
+		fprintf(stderr,"There are many many more options. See man page, optimise.doc, or optimise.ps. Sensible use of these options will give you a decent Yagi.\n"); 
+		exit(1);
+	}
+
diff --git a/src/usage_output.c b/src/usage_output.c
new file mode 100644
index 0000000..2f1bff9
--- /dev/null
+++ b/src/usage_output.c
@@ -0,0 +1,34 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include "yagi.h"
+
+extern double xrange_min;
+extern double xrange_max;
+extern double yrange_min;
+extern double yrange_max;
+extern double rrange_min;
+extern double rrange_max;
+
+void usage_output(char *exefile)
+{
+		double Zo=Z0;        
+		double H_max=H_MAX;
+		double E_max=E_MAX;
+
+		fprintf(stderr,"\nYagi-Uda antenna analysi program output, version %.2f\n", version());
+		fprintf(stderr,"Written by Dr. David Kirkby Ph.D. G8WRB (email:david.kirkby at onetel.net)\n");
+		fprintf(stderr, "\nUSAGE: %s [-cehps] [-E E_max -H H_max -r min -R max -Z Zo] filename \n\n", exefile);
+		fprintf(stderr, "Where options are:\n");
+		fprintf(stderr, "\n -c  Calculate sidelobe levels (slows program considerably).\n");
+		fprintf(stderr, " -e  Suppress calculation of 3dB E-plane BW.\n");
+		fprintf(stderr, " -h  Suppress calculation of 3dB H-plane BW.\n");
+		fprintf(stderr, " -p  Put data into filename.freq, filename.glog and filename.glin for gnuplot\n");
+		fprintf(stderr, " -s  Suppress diagnostic output.\n");
+		fprintf(stderr, " -E  Max angle to find the 3dB point. Min=90, max=180  (default = %.0f degrees)\n", E_max);
+		fprintf(stderr, " -H  Max angle to find the 3dB point. Min=0, max=90    (default = %.0f degrees)\n", H_max); 
+		fprintf(stderr, " -r  Set minimum range on the radial gnuplot log graph (default = %.0f dB)\n", rrange_min);
+		fprintf(stderr, " -R  Set maximum range on the radial gnuplot lin graph (default = %.0f dB)\n", rrange_max);
+		fprintf(stderr, " -Z  Set characteristic impedance                      (default = %.0f Ohms)\n\n", Zo);
+}
diff --git a/src/usage_yagi.c b/src/usage_yagi.c
new file mode 100644
index 0000000..661a7bf
--- /dev/null
+++ b/src/usage_yagi.c
@@ -0,0 +1,20 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include "yagi.h"
+
+void usage_yagi(char *exefile)
+{
+	
+		fprintf(stderr,"\nYagi-Uda antenna analysis programs, version %.2f\n", version());
+		fprintf(stderr,"Written by Dr. David Kirkby Ph.D. G8WRB (email:david.kirkby at onetel.net)\n");
+		fprintf(stderr, "\nUSAGE: %s  [-dhps] filename \n\n", exefile);
+		fprintf(stderr, "Where options are:\n");
+		fprintf(stderr, "   -d     Display  bar-graphs, proportional to element currents\n");
+		fprintf(stderr, "   -h     Print this help screen\n");
+		fprintf(stderr, "   -p     Print Z matrix to screen.\n");
+		fprintf(stderr, "   -s     Suppress diagnostic output\n");
+		fprintf(stderr, "'yagi' computes the currents at the centre of of each element of an antenna \ndescribed in 'filename', where 'filename' was created by 'input' or 'first'.\n");
+		fprintf(stderr, "After running 'yagi filename' type 'output filename'\n");
+}
diff --git a/src/version.c b/src/version.c
new file mode 100644
index 0000000..799938d
--- /dev/null
+++ b/src/version.c
@@ -0,0 +1,12 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <math.h>
+
+double version(void)
+{
+
+	double ver=atof(VERSION);
+	return(ver);
+}
+
diff --git a/src/vswr.c b/src/vswr.c
new file mode 100644
index 0000000..82f1b0e
--- /dev/null
+++ b/src/vswr.c
@@ -0,0 +1,28 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <math.h>
+
+#include <errno.h>
+#include "yagi.h"
+extern int errno;
+
+
+/* We calculate the vswr, given the magnitude of the reflection 
+coefficient */ 
+double calculate_vswr(double magnitude)
+{
+	double swr;
+	if(magnitude > 0.98 )
+		magnitude=0.98;
+	swr=(1+magnitude)/(1-magnitude);
+#ifdef DEBUG
+	if(errno)
+	{
+		fprintf(stderr,"Errno =%d in vswr.c\n", errno);
+		exit(1);
+	}
+#endif
+	return(swr);
+}
diff --git a/src/write_coordinates.c b/src/write_coordinates.c
new file mode 100644
index 0000000..db093c8
--- /dev/null
+++ b/src/write_coordinates.c
@@ -0,0 +1,31 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <math.h>
+#include <errno.h>
+#include "yagi.h"
+extern int errno;
+
+/* This function write the x and y locations of the centre of the element and
+the length of the elements to disk */
+
+void write_coordinates_of_elements_to_disk(FILE *ofp, int driven,
+int parasitic, double **d, double **p)
+{
+	int element_number, before;
+	before=ftell(ofp);
+	for(element_number=1;element_number<=driven;++element_number)   
+		fwrite((char *) &d[element_number][1], sizeof(double),3, ofp);  
+	for(element_number=1;element_number<=parasitic;++element_number)        
+		fwrite((char *) &p[element_number][1], sizeof(double),3, ofp);
+
+#ifdef DEBUG
+	if(errno)
+	{
+		fprintf(stderr,"Errno =%d in write_co.c\n", errno);
+		exit(1);
+	}
+#endif
+}
+
diff --git a/src/write_gain.c b/src/write_gain.c
new file mode 100644
index 0000000..a7c86a2
--- /dev/null
+++ b/src/write_gain.c
@@ -0,0 +1,43 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <math.h>
+#include <errno.h>
+#include "yagi.h"
+extern int errno;
+
+
+void write_gain_at_various_angles(FILE *gain_fp, double angular_step, double pin, double normalised_f, double f, struct element_data *coordinates, struct FCOMPLEX *current, int elements, double design_f)
+{
+	double theta, phi, gain_E_plane, gain_H_plane, E_plane_gain, H_plane_gain;
+	double peak_gain;
+	static int run_first_time=0;
+		fprintf(gain_fp,"#  f(MHz)     theta   gain-E(dBi)   G(E)-peak   phi    gain-H(dBi)  G(H)-peak\n");
+		run_first_time=1;
+	gain(90.0,0,pin,normalised_f,coordinates, current, elements, &gain_E_plane, &peak_gain, f, design_f);
+	for(phi=-180;phi <=180.0;phi+=angular_step)
+	{
+			theta=90+phi; /* 	Just helps program a bit. I'm not saying it is!! */
+			/* compute gain(phi, 90) */
+
+			gain(90.0,phi+360,pin,normalised_f,coordinates, current, elements, &gain_E_plane, &gain_H_plane, f, design_f);
+
+			H_plane_gain=gain_H_plane;
+
+			theta=90+phi; /* 	Just helps program a bit. I'm not saying it is!! */
+			/* compute gain(theta,0) where thete =90-270 degrees */
+			gain(theta+360,0,pin,normalised_f,coordinates, current, elements, &gain_E_plane, &gain_H_plane, f, design_f);
+			E_plane_gain=gain_E_plane;
+			fprintf(gain_fp,"%10.4f %10.4f %10.4f %10.4f %10.4f %10.4f %10.4f\n",f/1e6, theta, E_plane_gain, E_plane_gain-peak_gain, phi, H_plane_gain, H_plane_gain-peak_gain);
+	}
+
+#ifdef DEBUG
+	if(errno)
+	{
+		fprintf(stderr,"Errno =%d in write_ga.c\n", errno);
+		exit(1);
+	}
+#endif
+}
+
diff --git a/src/write_gnuplot_header.c b/src/write_gnuplot_header.c
new file mode 100644
index 0000000..d38c641
--- /dev/null
+++ b/src/write_gnuplot_header.c
@@ -0,0 +1,41 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include "yagi.h"
+
+/* These range variables select the graph range and are defined in output.c */
+
+extern double xrange_min, xrange_max, yrange_min, yrange_max, rrange_min, rrange_max;
+
+void write_gnuplot_header(FILE *fp, double f, char *filename, int step, int lin_or_log)
+{
+	fprintf(fp,"#\n");
+	fprintf(fp,"# $Id: %s,v 1.4 1993/09/27 17:10:59 alex Exp $\n",filename);
+	fprintf(fp,"#\n");
+	fprintf(fp,"#\n");
+	fprintf(fp,"# Analsed from %s with Yagi-Uda \n", filename);
+	fprintf(fp,"set angles degrees\n"); 
+	fprintf(fp,"set size square\n");
+	fprintf(fp,"set polar\n");
+	fprintf(fp,"set grid polar 15.\n");
+	fprintf(fp,"set noborder\n");
+	fprintf(fp,"set noparam\n");
+	fprintf(fp,"set lines\n");
+	if(lin_or_log == LIN)
+	{
+
+	} 
+	else if (lin_or_log==LOG)
+	{
+		fprintf(fp,"set xrange [%f:%f]\n",-(rrange_max-rrange_min), rrange_max-rrange_min);
+		fprintf(fp,"set yrange [%f:%f]\n",-(rrange_max-rrange_min), rrange_max-rrange_min);
+		fprintf(fp,"set rrange [%f:%f]\n",rrange_min, rrange_max);
+		fprintf(fp,"set trange [-pi:pi]\n");
+	}
+	fprintf(fp,"set xtics 0, 10, %f\n",-rrange_min+rrange_max);
+	fprintf(fp,"set ytics 0, 10, %f\n",-rrange_min+rrange_max);
+	fprintf(fp,"set xtics axis mirror\n");
+	fprintf(fp,"set ytics axis mirror\n");
+	fprintf(fp,"set data style line\n");
+}
+
diff --git a/src/write_header_to_disk.c b/src/write_header_to_disk.c
new file mode 100644
index 0000000..a9761c6
--- /dev/null
+++ b/src/write_header_to_disk.c
@@ -0,0 +1,33 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <errno.h>
+#include "yagi.h"
+
+extern int errno;
+
+void write_header_to_disk(FILE *ofp, int elements, int driven,
+int parasitic, double min_frequency, double max_frequency, double frequency,
+double step_frequency, double angular_step)
+{
+	fwrite((char *) &elements, sizeof(elements), 1, ofp);
+	fwrite((char *) &driven, sizeof(driven), 1, ofp);
+	fwrite((char *) &parasitic, sizeof(parasitic), 1, ofp);
+	fwrite((char *)&min_frequency, sizeof(min_frequency), 1, ofp);
+	fwrite((char *)&max_frequency,sizeof(max_frequency), 1, ofp);
+	fwrite((char *)&frequency, sizeof(frequency), 1, ofp);
+	fwrite((char *)&step_frequency, sizeof(step_frequency), 1, ofp);
+	fwrite((char *)&angular_step, sizeof(angular_step), 1, ofp);
+	fseek(ofp, HEADER_SIZE,SEEK_SET);
+
+#ifdef DEBUG
+	if(errno)
+	{
+		fprintf(stderr,"Errno =%d in header.c\n", errno);
+		exit(1);
+	}
+#endif
+}
diff --git a/src/write_input_data.c b/src/write_input_data.c
new file mode 100644
index 0000000..1fe5a15
--- /dev/null
+++ b/src/write_input_data.c
@@ -0,0 +1,32 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include "yagi.h"
+
+void write_input_data_to_disk(FILE *fp, char *notes, double frequency, double min_f,double max_f, double step_f, int elements,int driven,int parasitic, double angular_step, double **d, double **p, double scale_factor) 
+{
+	int i; 
+	fprintf(fp, "NOTES %s\n", notes);
+	fprintf(fp, "FREQUENCY %f\n", frequency);
+	fprintf(fp, "MIN_FREQUENCY %f\n", min_f);
+	fprintf(fp, "MAX_FREQUENCY %f\n", max_f);
+	fprintf(fp, "STEP_FREQUENCY %f\n", step_f);
+	fprintf(fp, "ELEMENTS %d\n", elements);
+	fprintf(fp, "DRIVEN %d\n", driven);
+	fprintf(fp, "PARASITIC %d\n", elements-driven);
+	fprintf(fp, "ANGULAR_STEP   %f\n", angular_step);
+	fprintf(fp, "#DATA_DRIVEN        x         y       length     diameter voltage(r) voltage(i)\n");
+	fprintf(fp, "DATA_DRIVEN ");
+	for(i=1; i<=driven; ++i)
+		fprintf(fp," %10.5f %10.5f %10.5f %10.5f %10.5f %10.5f", d[i][1]/scale_factor, d[i][2]/scale_factor, d[i][3]/scale_factor, d[i][4]/scale_factor, d[i][5], d[i][6]);
+	fprintf(fp, "\n#DATA_PARASITIC     x         y       length     diameter\n");
+	fprintf(fp, "DATA_PARASITIC\n");
+	for(i=1; i<=elements-driven; ++i)
+	{
+	if(i==1)
+		fprintf(fp,"             %10.5f %10.5f %10.5f %10.5f reflector\n", p[i][X]/scale_factor, p[i][Y]/scale_factor, p[i][LENGTH]/scale_factor, p[i][4]/scale_factor);
+	else
+		fprintf(fp,"             %10.5f %10.5f %10.5f %10.5f D%d\n", p[i][X]/scale_factor, p[i][Y]/scale_factor, p[i][LENGTH]/scale_factor, p[i][4]/scale_factor,i-1);
+	}
+}
diff --git a/src/yagi.c b/src/yagi.c
new file mode 100644
index 0000000..975e3ca
--- /dev/null
+++ b/src/yagi.c
@@ -0,0 +1,241 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+/* According to the method given in the book:
+Yagi Antenna Design, by Dr. James L. Lawson, W2PV, ARRL.
+Essentially, the self impedance Zxx of an elemnt is found. Then the mutural 
+impedance between two elements Zxy is found. Then the currents and voltages
+are computed  since:
+
+I1 Z11 + I2 Z12 + I3 Z13 = V1
+I1 Z21 + I2 Z22 + I3 Z23 = V2
+I1 Z31 + I2 Z32 + I3 Z33 = V3
+
+For just element 1 being driven, V2 = V3 = 0.
+The input impedance is Zin= V_driven / I_driven
+gain and other parameters can be found, as required. See book for
+formulae */
+
+
+#include <stdio.h>
+#include <malloc.h>
+#include <math.h>
+#include <errno.h>
+#include "yagi.h"
+
+extern int optind, opterr, errno;
+
+int main(int argc, char **argv)
+{
+	char *output_filename, *input_filename, *line;
+	double **driven_data, **parasitic_data, **z, frequency, *v, **A, *b, *x;
+	double d=0.0, real=0.0, imaginary=0.0, min_frequency=0.0, max_frequency=0.0;
+	double step_frequency=0.0;  
+	double angular_step=0.0;
+	int   helpflg=0, errflg=0, pflg=0, dflg=0;
+	int elements=-1, driven=-1, parasitic=-1, i=0, j=0, *indx;
+	int element_number=0, c=0, sflg=0;
+	FILE *ofp;
+	struct FCOMPLEX *current, *voltage;
+	 /* necessary with gcc under DOS */
+	opterr=0;
+
+   while ((c =  getoptions(argc, argv, "dhps")) != -1)
+   switch       (c) 
+   {
+			 case 'd': /* display currents */
+				dflg=1;
+				break;
+			 case 'h':   /* help */
+				helpflg=1;
+				break;
+			case 'p':
+				pflg=1;
+				break;
+			 case 's':   /* suppress all messages*/
+				sflg=1;
+				break;
+			 case '?':
+				errflg=1;
+				break;
+	}
+
+	if(errflg || helpflg || (argc-optind)!=1)
+	{
+		usage_yagi(argv[0]);
+		exit(1); 
+	}
+	/* allocate memory, using routines similar to that in Numerical Recipes */
+	input_filename=string(0L,90L);
+	line=string(0L,MAX_LINE);
+	output_filename=string(0L,90L);
+	output_filename=get_data_filenames(optind, argv, input_filename);
+	if(errno)
+	   fprintf(stderr, "Errno = %d in yagi.c\n", errno);
+	/* since the size of all the arrays depends on the number of elements,
+	lets first find out how many elements we have,including driven and 
+	parasitic sepparately.  Then try to allocate all the memory we need. If we 
+	fail, then not much time is wasted. */
+	elements=get_number_of_elements(input_filename, &driven, &parasitic);
+	indx=ivector(1,2L*elements);
+
+	/* allocate all memory */
+	driven_data=dmatrix(1L,(long)(driven),1L,6L); /* 6 bits of info on each driven ele */
+	if(parasitic > 0)
+		parasitic_data=dmatrix(1L,(long) (parasitic),1L,4L); /* 4 on each parasitic ele */
+	/* the impedance matrix for the impedance Z11 to Znn, needs an NxN
+	matrix. Since the data is complex, it needs 2*N by N, where N is
+	the total number of elelemnts */
+	z=dmatrix(1L,(long) elements, 1L, elements*2L);
+	A=dmatrix(1L, 2L*elements, 1L, 2L*elements);   /* A.x=b for large matrices */
+	x=dvector(1L, 2L*elements);
+	b=dvector(1L, 2L*elements);
+	/* read text file containing yagi description into memory */
+	read_yagi_data(line, input_filename, &frequency, &min_frequency, &max_frequency, 
+	&step_frequency, driven, driven_data, parasitic, parasitic_data, &angular_step);
+	/* write some data to a disk file. A header of 100 items will be written 
+	first. I doubt if I will ever need 100 items, but its better to have too 
+	many, rather than too few. */
+	if(errno)
+	   fprintf(stderr, "Errno = %d in yagi.c 2\n", errno);
+	ofp=fopen(output_filename,"wb");
+	errno=0;
+	write_header_to_disk(ofp, elements, driven, parasitic,min_frequency, max_frequency, frequency, step_frequency, angular_step);  
+	/* write the x and y coordinates of the centre of the element, and the
+	length in m */
+
+	write_coordinates_of_elements_to_disk(ofp, driven, parasitic, driven_data, parasitic_data); 
+	/* Now we have all the data in memory about the elements, we can calculate
+	the impedance matrices. This will be a square matrix, of size NxN, where
+	N is the number of elements in the yagi. The components on the diaganol
+	Z11, Z22, Z33 etc, will be the self impedance of each element. The
+	off-diagonal components, Zij (Z12, Z13 etc are the mutual impedance between
+	elements. */
+	current=FCOMPLEXvector(1L,(long) elements); 
+	voltage=FCOMPLEXvector(1L,(long) elements);
+
+
+	v=dvector(1L,2L*elements); 
+
+	for(frequency=min_frequency; frequency <=max_frequency; frequency+=step_frequency)
+	{
+		fill_z_matrix(frequency,driven,parasitic,driven_data,parasitic_data, z);
+		/* Now we must fill the V vector, which gives the voltage at the centre of
+		each driven element. Since we know the magnitude of the voltage and phase,
+		we can calculate the real and imaginary components of voltage. NB */
+		fill_v_vector(driven, parasitic, driven_data, v);
+		/* We now have the voltage vector V, and the impedance matrix Z. All
+		we need to do now is solve a set of NxN equations, where N is the
+		number of elements, to get N values of current, which we can put in
+		the I matrix.
+		Unfortunately, this is not trivual, by any standards!!!  It is
+		complicated by the fact the the N equations are all complex. 
+		The method used us a brute-force approach mentioned by Press
+		in their 2nd Edition of the Numerical Recipes in C book. Here we
+		put the data in the form:
+	
+		|Zr -Zc|   |Ic|   = |Vr|   which we will call A.x=b
+		|Zc  Zr|   |Ic|     |Vc| 
+		
+		so the Z data goes now in a 2Nx2N matrix. This is a bit wasteful of space
+		and time, but it will do here. */
+		/* Read impedance data from 'z' to matrix A */
+		for(i=1;i<=elements;++i)
+		{
+			for(j=1;j<=elements;++j)
+			{
+				A[i][j]=z[i][2*j-1];   /* real data, top left corner of Z */
+				A[i+elements][j+elements]=z[i][2*j-1]; /* Bot right, real data */
+				A[i][j+elements]=-z[i][2*j]; /* imaginary, top right */
+				A[i+elements][j]=z[i][2*j]; /* bottom left, imaginary */
+			}
+		}
+		/* The following function prints to stantard output the z matrix of the
+		antenna. It is really only used during debugging, so it can be commented
+		out normally. */
+		if(pflg)
+			print_z_matrix(frequency,elements,z);    
+		/* read voltage data from v to b */
+		for(i=1;i<=elements;++i)
+		{
+			b[i]= v[2*i-1];                                                 /* real data */
+			b[i+elements]=v[2*i];                           /* complex data */
+			voltage[i].r=v[2*i-1];
+			voltage[i].i=v[2*i];
+		/*
+			if(isnand(voltage[i].r) || isnand (voltage[i].i) || isnand(b[i]) || isnand(b[i+elements]) ||
+			(voltage[i].r) < 0.001)
+			{
+			   fprintf(stderr, "b[%d]=%f b[%d]=%f %f %f\n", i, b[i], i+elements, b[i+elements], voltage[i].r, voltage[i].i);
+			}
+		*/
+		}
+		/* we now write the voltage data to disk, but only once, *not* at
+		every frequency, since its fixed */
+		if(frequency==min_frequency)
+		{
+			fwrite((char *) &voltage[1], sizeof(struct FCOMPLEX), elements, ofp);
+		}
+		/* Perform a LU decompositon of A */
+#ifdef DEBUG2
+		for(test=1;test <= 2*elements; ++test)
+		{
+		  for( =1;  <= 2*elements; ++)
+		    printf("A[%d][%d]=%f\n", test, , A[test][]);
+		}
+#endif
+		ludcmp(A, elements*2, indx, &d); 
+		/* We now have the voltages in b. After lubksb is run, we get the 
+		currents in b */
+
+		lubksb(A, 2*elements, indx, b); /* current's in b after lubksb has run*/
+		/* Put currents an FCOMPLEX matrix current[element] 
+		currents are stored in b as r,r,r,r ..... i,i,i,i */
+		for(element_number=1;element_number<=elements;element_number++) 
+		{
+			current[element_number].r=b[element_number];
+			current[element_number].i=b[element_number+elements];
+		} 
+		if(dflg)
+			display_antenna_currents(current,elements);
+		fwrite((char *) &current[1], sizeof(struct FCOMPLEX), elements, ofp);
+		real=b[1]/((b[1]*b[1])+(b[1+elements]*b[1+elements]));
+		imaginary=-b[1+elements]/((b[1]*b[1])+(b[1+elements]*b[1+elements]));
+	   /* printf("f=%.2f MHz z = 1/(%f + i %f) = %f + i%lf \n", frequency/1e6, b[1], b[1+elements], real, imaginary);   */
+
+		if(min_frequency < max_frequency && !sflg)
+		{
+			printf("%s completed %5.1f%% f=%f MHz\n",argv[0],100*(frequency-min_frequency)/(max_frequency-min_frequency), frequency);
+		}
+	}
+	if(errno)
+	   fprintf(stderr, "Errno = %d in yagi.c 3\n", errno);
+	printf("\n");
+	fclose(ofp);
+
+	/* free strings */
+	free_string(input_filename,0L,90L);
+	free_string(line,0L,(long) MAX_LINE);
+	free_string(output_filename,0L,90L);
+
+	/* free vectors */
+	free_dvector(x,1L, 2L*elements);
+	free_dvector(b,1L, 2L*elements);
+	free_dvector(v,1L, 2L*elements);
+	free_ivector(indx,1,2L*elements);
+	free_FCOMPLEXvector(current,1L,(long) elements); 
+	free_FCOMPLEXvector(voltage,1L,(long) elements);
+	/* free matrices */
+	free_dmatrix(driven_data,1L,(long)(driven),1L,6L);
+	// free_dmatrix(parasitic_data,1L,(long) parasitic,1L,4L); 
+	free_dmatrix(z,1L,(long) elements, 1L, elements*2L);
+	free_dmatrix(A,1L, 2L*elements, 1L, 2L*elements); 
+	if(errno)
+	{
+	   fprintf(stderr, "Errno = %d in yagi.c 4\n", errno);
+	   exit (errno);
+	}
+	else
+		exit(0);
+}
diff --git a/src/yagi.h b/src/yagi.h
new file mode 100644
index 0000000..0597bab
--- /dev/null
+++ b/src/yagi.h
@@ -0,0 +1,199 @@
+#include <stdio.h>
+#include "nrutil.h"
+#include "com_hack.h"
+#include "nr_hack.h"
+
+#ifndef TRUE
+#define TRUE 1
+#endif
+
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#define LIN 0 
+#define LOG 1
+
+#define MAX_LINE  100  /* Maximum characters on one line of input file */
+
+#define DRIVEN_LENGTH      1 /* What to move - see randomis.c */
+#define DRIVEN_POSITION    2
+#define REFLECTOR_LENGTH   4
+#define DIRECTOR_LENGTH    8
+#define DIRECTOR_POSITION 16
+#define ALL_ELEMENT_LENGTHS_IDENTICAL 32
+#define LINEAR_TAPER                  64
+#define RESONATE_DRIVEN              128
+
+/* better criteria, see optimise and better.c */
+
+#define GAIN                  1
+#define FB                    2
+#define RESISTANCE            4
+#define REACTANCE             8
+#define VSWR                 16
+#define SIDE_LOBE_LEVEL      32
+#define REASONABLE        32768 
+
+#define REASONABLE_G
+#define REASONABLE_FB       27
+#define REASONABLE_R         5
+#define REASONABLE_X         5
+#define REASONABLE_SWR       1.1
+#define REASONABLE_SIDELOBE 23
+
+#ifndef Z0
+#define Z0                             50
+#endif
+#define E_MAX 179.0
+#define H_MAX 60.0
+
+#define RRANGE_MIN -50.0
+#define RRANGE_MAX  20.0
+
+#define EULER 0.57721566
+
+#define MAX_DRIVEN                 6 /* There are 6 bits info on a driven ele */
+#define MAX_PARASITIC              4 /* But only 4 on a parasitic */
+
+#define  X 			                 1/* index into driven and parasitic arrays */
+#define  Y 			                 2
+#define  LENGTH	                 3
+#define	DIAMETER	                 4
+#define	VOLTAGE_R                 5/* Volt and phase not on parasistic ele */
+#define	VOLTAGE_I                 6
+#define 	REAL			              0
+#define 	IMAGINARY	              1
+#define  HEADER_SIZE             100/* size of header in .out files in bytes */   
+
+typedef struct element_data {double x,y,length;} fred;
+
+typedef struct performance_data {double r,x,gain,fb,swr,sidelobe;} f4;
+
+typedef struct flags {int aflg, bflg, cflg, dflg, eflg, errflg,fflg;
+		int gflg, hflg, iflg, jflg, kflg, lflg, mflg, nflg, oflg, pflg;
+		int qflg, rflg, sflg, tflg, uflg, vflg, wflg, xflg, yflg, zflg;
+		int Aflg, Bflg, Cflg, Dflg, Eflg, Fflg, Gflg, Hflg, Iflg, Jflg;
+		int Kflg, Lflg, Mflg, Nflg, Oflg, Pflg, Qflg, Rflg, Sflg, Tflg;
+		int Uflg, Vflg, Wflg, Xflg, Yflg, Zoflg;} f2;
+
+typedef struct pattern {
+			double three_dB_E, three_dB_H;
+			double first_null_E, first_null_level_E;
+			double first_null_H, first_null_level_H;
+			double first_sidelobe_E, first_sidelobe_level_E;
+			double first_sidelobe_H, first_sidelobe_level_H;
+								}f3;
+int main(int argc, char **argv);
+int linear_current_optimisation_test(struct FCOMPLEX *cur, double *old_sd, int elements, int parasites, struct flags flag);
+void display_currents( struct FCOMPLEX *currents, int elements);
+void dynamic_changing_of_weights(int i, int div, struct performance_data *weight);
+double Cin(double x);
+double ci(double x);
+double new_length(double oldl,double old_dia, double lambda, double new_dia);
+void end_if_stop_exists(int *i, int iterations,int divisor);
+struct performance_data subtract_structures(struct performance_data a, struct performance_data b);
+void print_relavent_performance_data(FILE *fp, char *s, int i, struct flags flag, struct performance_data data,double fitness, int Z_Q, int fitness_Q);
+/* char *s, int i, structure flags flag, \
+structure performance_data data); */
+void set_mean_structure(struct FCOMPLEX input_impedance,double E_fwd, double E_back,struct flags flag, double pin,struct element_data *coordinates, struct FCOMPLEX *current, int elements, double f, double design_f, struct performance_data *mean);
+void test_for_stop_file(void);
+void set_performance_structures(struct performance_data *weight, struct performance_data *max, struct performance_data *best, struct performance_data *worst);
+void optimising_for(struct flags flag);
+double dB_down_from_peak(double x, double pin, struct  element_data *coordinates, struct FCOMPLEX *current,int elements, double f,double design_f);
+double find_max_sidelobe_fast(double gain, double pin,struct element_data *coordinates, struct FCOMPLEX *current, int elements, double frequency,double design_f);
+double find_max_sidelobe_slow(double gain, double pin,struct element_data *coordinates, struct FCOMPLEX *current, int elements, double frequency,double design_f);
+void copy_matrix(int length, int width, double **to, double **from);
+char *get_data_filenames(int argc, char **argv, char *input);
+char *string(long lower, long upper);
+void free_string(char *string, long lower, long upper);
+int get_number_of_elements(char *datafile, int *driven, int *parasitic);
+void read_yagi_data(char *line, char *file, double *frequency, double *min_frequency, double*max_frequency, double *step_frequency, int dr, double **dr_data, int parasitic, double **para_data, double *angular_step);
+void   self_impedance(int i, double frequency, int driven, int parasitic, double **data, double **impedance);
+void self2(double r, double l, double wavel, double *rin, double *xin);
+void   mutual_impedance(int i, int j, double frequency, int driven, int parasitic, double **d, double **p, double **impedance);
+void   fill_z_matrix(double frequency, int driven, int parasitic, double **d, double **p, double **impedance);
+void z21(double lamda, double d, double mean_length, double *r21, double *x21);
+double ci(double); 
+void fill_v_vector(int driven, int parasitic, double **d, double *v_vector);
+void write_header_to_disk(FILE *ofp, int elements, int driven,
+int parasitic, double min_frequency, double max_frequency, double frequency,
+double step_frequency, double angular_step);
+void write_vector(double *v, int elements, FILE *ofp);
+int  read_header(FILE *ifp, FILE *ofp, double *min_f, double *max_f, double *step_f, double *f, double *angular_step);
+void z_input(struct FCOMPLEX v, struct FCOMPLEX i, struct FCOMPLEX *z);
+void reflection_coefficient(struct FCOMPLEX z_input, double *mag, double *phase);
+double calculate_vswr(double magnitude);
+double calculate_power_input(double real_z, struct FCOMPLEX current);
+void   write_coordinates_of_elements_to_disk(FILE *ofp, int driven,
+int parasitic, double **driven_data, double **parasitic_data);
+void gain(double theta, double phi, double  pin, double normallised_f, struct
+element_data *cordinates,struct FCOMPLEX *current, int elements, double *E, double *H, double actual_frequency, double design_frequency);
+struct FCOMPLEX E_to_complex_power(struct FCOMPLEX x);
+struct FCOMPLEX **FCOMPLEXmatrix(long a, long b, long c, long d);
+void free_FCOMPLEXmatrix(struct FCOMPLEX **m, long nrl, long nrh, long ncl, long nch);
+void free_FCOMPLEXvector(struct FCOMPLEX *v, long nrl, long nrh);
+void free_element_data_vector( struct element_data *v, long nl, long nh);
+double change_max_percentage_changes(int i, int iterations, double orig_pc);
+struct FCOMPLEX *FCOMPLEXvector(long a, long b);
+struct element_data *element_data_vector(long low, long high);
+void print_z_matrix(double f, int elements, double **z_matrix);
+void write_gain_at_various_angles(FILE *gain_fp, double angular_step, double pin, double normalised_f, double f, struct element_data *coordinates, struct FCOMPLEX *current, int elements, double design_f);
+
+void write_input_data_to_disk(FILE *fp, char *notes, double frequency, double min_f, double max_f, double step_f, int elements ,int driven,int parasitic, double angular_step,double **d, double **p, double scale_factor); 
+void randomise(int randomisation_method, double frequency, double percent, double **driven_data, double **parasitic_data, int driven, int parasitic);
+void automatic_enhancement(struct flags flag, double frequency, double **driven_data, double **parasitic_data, int driven, int parasitic, struct FCOMPLEX *voltage, struct FCOMPLEX *current, struct FCOMPLEX *input_Z, double *v, double **z, double **A, double *b, int *indx, struct element_data *coordinates);
+
+/* int is_it_better(int criteria,struct performance_data new,struct performance_data best);  */
+int is_it_better(int criteria, struct performance_data n, struct performance_data b);
+double version(void);
+void get_command_line_options(int argc, char **argv, struct flags *f);
+void write_data_for_gnuplot(FILE *fp1,FILE  *fp2,FILE *fp3,FILE *fp4,FILE *fp5,FILE *fp6, double f,double normalised_f,double input_impedance_r, double input_impedance_i, double vswr, double gain_E_plane,double  fb_ratio);
+void usage_first(char *str);
+void usage_input(char *str);
+void usage_yagi(char *str);
+void usage_output(char *str);
+void usage_optimise(char *str);
+void write_file_for_gnuplot_to_load(FILE *fp, char *filename);
+
+double performance(struct flags flag, struct performance_data data,struct performance_data weights, struct performance_data max, struct performance_data start);
+int getoptions(int argc, char **argv, char *opts);
+
+void copy_complex_data_to_real_matrix(int elements, double **from, double **to);
+void show_all_first_parameters(char *exefile);
+void show_all_optimise_parameters(char *exefile,struct flags flag);
+double randreal(void);
+int    randint(void);
+void solve_equations(double frequency, int driven, int parasitic, double **driven_data, double **parasitic_data, double *v, double **z, double *pin, struct FCOMPLEX *voltage, struct FCOMPLEX *current, struct FCOMPLEX *input_impedance, struct element_data *coordinates, double **A, double *b, int *indx);
+void genetic_algorithm(char *output_filename, char *update_filename, struct flags flag, double frequency, double minf, double maxf, double stepf, double angular_step, int driven ,int  parasitic, double **driven_data, double **parasitic_data, double *v, double **zz, double
+*pin, struct FCOMPLEX *voltage, struct FCOMPLEX *current, struct FCOMPLEX
+*input_impedance, struct element_data *coordinates, double **A, double *b, int
+*indx,struct performance_data *mean_performance);
+
+double get_genetic_algorithm_fitness(struct flags flag, double frequency, int driven, int parasitic, double **driven_data, double **parasitic_data, double *v, double **z, double *pin, struct FCOMPLEX *voltage, struct FCOMPLEX *current, struct FCOMPLEX *input_impedance, struct element_data *coordinates, double **A, double  *b, int *indx, struct performance_data *data2);
+
+void check_flags(struct flags flag, int argc, int optind, char *exefilename);
+void error_message(char *str);
+double determine_maximum_gain(double f, double  l);
+double determine_maximum_gain2(int elements);
+
+
+void do_since_better(int i, char *output_filename, char *update_filename, struct FCOMPLEX input_impedance, struct performance_data n,struct flags flag,char * notes,double frequency, double min_frequency,double max_frequency,double  step_frequency,int elements, int driven,int parasitic,double angular_step,double **driven_data,double **parasitic_data,double scale_factor,double new_performance);
+double gaussian();
+void sensitivity(double boom_sd, double length_sd, double **driven_data, double**parasitic_data, int driven, int parasites);
+double log2(double x);
+void mprove(double **a ,double **LU_of_a,int n, int *indx, double *b, double *x);
+void seedRNG(void);
+double error_3dB_E(double x); 
+double error_3dB_H(double x); 
+double zbrent(double (*func)(), double x1, double x2, double tol);  
+double Objective(char *gene);
+int GA_Free(void);
+int GA_Error(char *error_mesg);
+void SetPrint(int a);
+int Initialise(int popsise, int genesize);
+int Selection(FILE *fd, int gene);
+double ss2r(char *string, int pos, int len);
+void write_gnuplot_header(FILE *fp, double f, char *filename, int step, int lin_or_log);
+void self(double r, double length, double lambda, double *Rin, double *Xin);
+void display_antenna_currents(struct FCOMPLEX *current, int elements);
diff --git a/src/z_input.c b/src/z_input.c
new file mode 100644
index 0000000..04bded0
--- /dev/null
+++ b/src/z_input.c
@@ -0,0 +1,27 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <stdio.h>
+#include <math.h>
+#include <errno.h>
+#include "yagi.h"
+extern int errno;
+
+/* compute the input impedance (driving impedance) */
+
+void z_input(struct FCOMPLEX v, struct FCOMPLEX i, struct FCOMPLEX *impedance)
+{
+	*impedance=Cdiv(v,i);
+       /* printf("Voltage=%f + i %f\n", v.r, v.i);
+	printf("Current = %f + i %f \n", i.r, i.i); 
+	printf("Z = V/I = %f + %f \n", impedance->r, impedance->i); */
+
+#ifdef DEBUG
+	if(errno)
+	{
+		fprintf(stderr,"Errno =%d in z_input() in z_input.c\n", errno);
+		exit(1);
+	}
+#endif
+}
+
diff --git a/src/zbr_hack.c b/src/zbr_hack.c
new file mode 100644
index 0000000..e932d07
--- /dev/null
+++ b/src/zbr_hack.c
@@ -0,0 +1,74 @@
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#include <math.h>
+#include "yagi.h"
+
+#define ITMAX 100
+#define EPS 3.0e-8
+
+double  zbrent(double (*error_3dB) (double x),double x1,double x2, double tol)
+{
+	int iter;
+	double a=x1,b=x2,c,d,e,min1,min2;
+	double fa=(*error_3dB)(a),fb=(*error_3dB)(b),fc,p,q,r,s,tol1,xm;
+	void nrerror();
+	/* printf("x1=%f fa=%f x2=%f fb=%f\n", x1,fa,x2,fb); */
+	if (fb*fa > 0.0) nrerror("Root must be bracketed in ZBRENT - try the -e or -h options to output");
+	fc=fb;
+	for (iter=1;iter<=ITMAX;iter++) {
+		if (fb*fc > 0.0) {
+			c=a;
+			fc=fa;
+			e=d=b-a;
+		}
+		if (fabs(fc) < fabs(fb)) {
+			a=b;
+			b=c;
+			c=a;
+			fa=fb;
+			fb=fc;
+			fc=fa;
+		}
+		tol1=2.0*EPS*fabs(b)+0.5*tol;
+		xm=0.5*(c-b);
+		if (fabs(xm) <= tol1 || fb == 0.0) return b;
+		if (fabs(e) >= tol1 && fabs(fa) > fabs(fb)) {
+			s=fb/fa;
+			if (a == c) {
+				p=2.0*xm*s;
+				q=1.0-s;
+			} else {
+				q=fa/fc;
+				r=fb/fc;
+				p=s*(2.0*xm*q*(q-r)-(b-a)*(r-1.0));
+				q=(q-1.0)*(r-1.0)*(s-1.0);
+			}
+			if (p > 0.0)  q = -q;
+			p=fabs(p);
+			min1=3.0*xm*q-fabs(tol1*q);
+			min2=fabs(e*q);
+			if (2.0*p < (min1 < min2 ? min1 : min2)) {
+				e=d;
+				d=p/q;
+			} else {
+				d=xm;
+				e=d;
+			}
+		} else {
+			d=xm;
+			e=d;
+		}
+		a=b;
+		fa=fb;
+		if (fabs(d) > tol1)
+			b += d;
+		else
+			b += (xm > 0.0 ? fabs(tol1) : -fabs(tol1));
+		fb=(*error_3dB)(b);
+	}
+	nrerror("Maximum number of iterations exceeded in ZBRENT");
+}
+
+#undef ITMAX
+#undef EPS

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-hamradio/yagiuda.git



More information about the pkg-hamradio-commits mailing list