summaryrefslogtreecommitdiff
path: root/release/src/router/bpalogin
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2015-01-03 12:04:58 +0100
committerAndreas Baumann <mail@andreasbaumann.cc>2015-01-03 12:04:58 +0100
commit008d0be72b2f160382c6e880765e96b64a050c65 (patch)
tree36f48a98a3815a408e2ce1693dd182af90f80305 /release/src/router/bpalogin
parent611becfb8726c60cb060368541ad98191d4532f5 (diff)
downloadtomato-008d0be72b2f160382c6e880765e96b64a050c65.tar.gz
tomato-008d0be72b2f160382c6e880765e96b64a050c65.tar.bz2
imported original firmware WRT54GL_v4.30.11_11_US
Diffstat (limited to 'release/src/router/bpalogin')
-rw-r--r--release/src/router/bpalogin/COPYING340
-rw-r--r--release/src/router/bpalogin/CREDITS13
-rw-r--r--release/src/router/bpalogin/INSTALL63
-rw-r--r--release/src/router/bpalogin/Makefile46
-rw-r--r--release/src/router/bpalogin/Makefile.in71
-rw-r--r--release/src/router/bpalogin/Makefile.os224
-rw-r--r--release/src/router/bpalogin/README16
-rwxr-xr-xrelease/src/router/bpalogin/bpaloginbin0 -> 133552 bytes
-rwxr-xr-xrelease/src/router/bpalogin/bpalogin.bsd14
-rw-r--r--release/src/router/bpalogin/bpalogin.c143
-rw-r--r--release/src/router/bpalogin/bpalogin.conf45
-rwxr-xr-xrelease/src/router/bpalogin/bpalogin.conf.sh219
-rw-r--r--release/src/router/bpalogin/bpalogin.h323
-rw-r--r--release/src/router/bpalogin/bpalogin.h.in320
-rw-r--r--release/src/router/bpalogin/bpalogin.init53
-rwxr-xr-xrelease/src/router/bpalogin/configure4128
-rw-r--r--release/src/router/bpalogin/configure.in27
-rw-r--r--release/src/router/bpalogin/gen_md5.c352
-rw-r--r--release/src/router/bpalogin/get_time.c20
-rw-r--r--release/src/router/bpalogin/get_time.h1
-rwxr-xr-xrelease/src/router/bpalogin/install-sh251
-rw-r--r--release/src/router/bpalogin/md5.h12
-rw-r--r--release/src/router/bpalogin/protocol.c733
-rw-r--r--release/src/router/bpalogin/transaction.c370
-rw-r--r--release/src/router/bpalogin/unixmain.c405
25 files changed, 7989 insertions, 0 deletions
diff --git a/release/src/router/bpalogin/COPYING b/release/src/router/bpalogin/COPYING
new file mode 100644
index 00000000..60549be5
--- /dev/null
+++ b/release/src/router/bpalogin/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) 19yy <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) 19yy 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/release/src/router/bpalogin/CREDITS b/release/src/router/bpalogin/CREDITS
new file mode 100644
index 00000000..7b576a1f
--- /dev/null
+++ b/release/src/router/bpalogin/CREDITS
@@ -0,0 +1,13 @@
+BPALogin was originally written by Shane Hyde.
+It is currently maintained by William Rose <wdrose@sourceforge.net>
+
+The following people have contributed code & or suggestions -
+ * Paul Smedley <psmedley@chariot.net.au> for OS/2 patches
+ * Lincoln Dale
+ * Mathew Ramsay
+ * Jason Patterson
+ * Mark Hammond
+ * and many others ...
+
+Shane no longer maintains BPALogin, and the project has been released under
+the GNU GPL. It is hosted by SourceForge: http://bpalogin.sourceforge.net/
diff --git a/release/src/router/bpalogin/INSTALL b/release/src/router/bpalogin/INSTALL
new file mode 100644
index 00000000..e13a5055
--- /dev/null
+++ b/release/src/router/bpalogin/INSTALL
@@ -0,0 +1,63 @@
+BPALogin
+--------
+
+ These are generic installation instructions. Specific instructions
+for BPALogin follow.
+
+ 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.
+
+ 6. Run the bpalogin.conf.sh script with the location of the newly
+ installed bpalogin.conf.
+
+ e.g. If installed under /usr/local:
+ # ./bpalogin.conf.sh /usr/local/etc/bpalogin.conf
+
+ 7. Start BPALogin using either the init script, or using
+ # /usr/local/sbin/bpalogin -c /etc/bpalogin.conf
+
diff --git a/release/src/router/bpalogin/Makefile b/release/src/router/bpalogin/Makefile
new file mode 100644
index 00000000..0481a1ac
--- /dev/null
+++ b/release/src/router/bpalogin/Makefile
@@ -0,0 +1,46 @@
+###########################################################################
+# Makefile for BPALogin v2.0
+##
+
+##
+# Install locations as determined by configure
+prefix=/usr/local
+exec_prefix=${prefix}
+SBINPATH=${exec_prefix}/sbin
+ETCPATH=${prefix}/etc
+
+##
+# Locations of system utilities as determined by configure
+#CC=mipsel-linux-gcc
+CHKCONFIG=/sbin/chkconfig
+INSTALL=/usr/bin/install -c
+SED=/bin/sed
+
+##
+#
+CFLAGS=-g -O2 -Wall
+LIBS=-lnsl
+LDFLAGS=
+
+OBJS = bpalogin.o protocol.o transaction.o gen_md5.o unixmain.o get_time.o
+
+bpalogin: $(OBJS)
+ $(CC) -o $@ $(OBJS) $(LIBS) $(LDFLAGS)
+
+.c.o:
+ $(CC) $(CFLAGS) -c $<
+
+clean:
+ rm -fr *.o
+
+distclean: clean
+ rm -f bpalogin config.log config.cache config.status Makefile bpalogin.h
+
+bpalogin.h: bpalogin.h.in
+ $(SED) 's#@@BPALOGIN_CONF@@#$(ETCPATH)/bpalogin.conf#' < bpalogin.h.in > bpalogin.h
+
+$(OBJS): bpalogin.h
+
+install: bpalogin
+ install bpalogin $(INSTALLDIR)/usr/sbin
+ $(STRIP) $(INSTALLDIR)/usr/sbin/bpalogin
diff --git a/release/src/router/bpalogin/Makefile.in b/release/src/router/bpalogin/Makefile.in
new file mode 100644
index 00000000..df8505d9
--- /dev/null
+++ b/release/src/router/bpalogin/Makefile.in
@@ -0,0 +1,71 @@
+###########################################################################
+# Makefile for BPALogin v2.0
+##
+
+##
+# Install locations as determined by configure
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+SBINPATH=@sbindir@
+ETCPATH=@sysconfdir@
+
+##
+# Locations of system utilities as determined by configure
+CC=@CC@
+CHKCONFIG=@CHKCONFIG@
+INSTALL=@INSTALL@
+SED=@SED@
+
+##
+#
+CFLAGS=@CFLAGS@ -Wall
+LIBS=@LIBS@
+LDFLAGS=@LDFLAGS@
+
+OBJS = bpalogin.o protocol.o transaction.o gen_md5.o unixmain.o
+
+bpalogin: $(OBJS)
+ $(CC) -o $@ $(OBJS) $(LIBS) $(LDFLAGS)
+
+.c.o:
+ $(CC) $(CFLAGS) -c $<
+
+clean:
+ rm -fr *.o
+
+distclean: clean
+ rm -f bpalogin config.log config.cache config.status Makefile bpalogin.h
+
+bpalogin.h: bpalogin.h.in
+ $(SED) 's#@@BPALOGIN_CONF@@#$(ETCPATH)/bpalogin.conf#' < bpalogin.h.in > bpalogin.h
+
+$(OBJS): bpalogin.h
+
+install: bpalogin bpalogin.init bpalogin.bsd
+ case `uname -s` in \
+ Linux*) \
+ mkdir -p $(RPM_BUILD_ROOT)$(ETCPATH)/rc.d/init.d ; \
+ $(INSTALL) -m 755 bpalogin.init \
+ $(RPM_BUILD_ROOT)$(ETCPATH)/rc.d/init.d/bpalogin ; \
+ \
+ if [ -z "$(RPM_BUILD_ROOT)" -a -x "$(CHKCONFIG)" ]; then \
+ $(CHKCONFIG) --add bpalogin ; \
+ fi ; \
+ ;; \
+ \
+ FreeBSD*) \
+ mkdir -p $(ETCPATH)/rc.d ; \
+ $(INSTALL) -m 755 bpalogin.bsd $(ETCPATH)/rc.d/bpalogin.sh ; \
+ ;; \
+ \
+ *) \
+ echo "###" ; \
+ echo "# You will need to add BPALogin to your startup scripts." ; \
+ echo "###" ; \
+ ;; \
+ esac ; \
+
+ mkdir -p $(RPM_BUILD_ROOT)$(SBINPATH)
+ mkdir -p $(RPM_BUILD_ROOT)$(ETCPATH)
+ $(INSTALL) -m 755 bpalogin $(RPM_BUILD_ROOT)$(SBINPATH)
+ $(INSTALL) -m 600 bpalogin.conf $(RPM_BUILD_ROOT)$(ETCPATH)
diff --git a/release/src/router/bpalogin/Makefile.os2 b/release/src/router/bpalogin/Makefile.os2
new file mode 100644
index 00000000..fc436743
--- /dev/null
+++ b/release/src/router/bpalogin/Makefile.os2
@@ -0,0 +1,24 @@
+CFLAGS=-O2 -Wall
+CC=gcc
+LIBS=
+LDFLAGS=-lsocket -lsyslog -Zexe
+
+OBJS = bpalogin.o protocol.o transaction.o gen_md5.o unixmain.o
+
+bpalogin: $(OBJS)
+ $(CC) -o $@ $(OBJS) $(LIBS) $(LDFLAGS)
+
+.c.o:
+ $(CC) $(CFLAGS) -c $<
+
+clean:
+ rm -fr *.o
+
+distclean: clean
+ rm -f bpalogin.exe config.log config.cache config.status Makefile bpalogin.h
+
+bpalogin.h: bpalogin.h.in
+ sed 's#@@BPALOGIN_CONF@@#/etc/bpalogin.cfg#' < bpalogin.h.in > bpalogin.h
+
+$(OBJS): bpalogin.h
+
diff --git a/release/src/router/bpalogin/README b/release/src/router/bpalogin/README
new file mode 100644
index 00000000..f2b2e0b0
--- /dev/null
+++ b/release/src/router/bpalogin/README
@@ -0,0 +1,16 @@
+BPALogin
+--------
+
+This is a client to connect to Telstra's Big Pond Broadband powered by Cable.
+
+This client should run on -
+
+ * Linux
+ * Solaris
+ * FreeBSD
+ * Most other Unices.
+
+BPALogin was created by Shane Hyde, and is released under the GNU GPL.
+It is now maintained by William Rose <wdrose@sourceforge.net>.
+
+The latest version is at http://bpalogin.sourceforge.net/
diff --git a/release/src/router/bpalogin/bpalogin b/release/src/router/bpalogin/bpalogin
new file mode 100755
index 00000000..f37f0b81
--- /dev/null
+++ b/release/src/router/bpalogin/bpalogin
Binary files differ
diff --git a/release/src/router/bpalogin/bpalogin.bsd b/release/src/router/bpalogin/bpalogin.bsd
new file mode 100755
index 00000000..631db44a
--- /dev/null
+++ b/release/src/router/bpalogin/bpalogin.bsd
@@ -0,0 +1,14 @@
+#!/bin/sh
+case "$1" in
+start)
+ /usr/local/sbin/bpalogin
+ echo -n ' bpalogin'
+ ;;
+stop)
+ killall bpalogin
+ ;;
+*)
+ echo "Usage: ${0##*/}: { start | stop }" 2>&1
+ exit 65
+ ;;
+esac
diff --git a/release/src/router/bpalogin/bpalogin.c b/release/src/router/bpalogin/bpalogin.c
new file mode 100644
index 00000000..5d1e245a
--- /dev/null
+++ b/release/src/router/bpalogin/bpalogin.c
@@ -0,0 +1,143 @@
+/*
+** BPALogin - lightweight portable BIDS2 login client
+** Copyright (c) 2001-3 Shane Hyde, and others.
+**
+** 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+**
+*/
+
+#include "bpalogin.h"
+
+/*
+** Main processing loop. Logs in, handles heartbeats, and logs out on request
+**
+** Returns - 0 - We are no longer connected, and should not retry.
+** 1 - We are no longer connnected and should retry.
+*/
+int mainloop(struct session * s)
+{
+ int err;
+ struct sockaddr_in listenaddr;
+ struct hostent * he;
+ int addrsize;
+ FILE *fp;
+
+ s->lastheartbeat = 0;
+ s->sequence = 0;
+ s->listensock = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
+
+ s->localaddr.sin_family = AF_INET;
+ s->localaddr.sin_port = htons(s->localport);
+ if(strcmp(s->localaddress,""))
+ {
+ s->debug(0,"Using local address %s\n",s->localaddress);
+ he = gethostbyname(s->localaddress);
+
+ if(he)
+ {
+ s->localaddr.sin_addr.s_addr = *((int*)(he->h_addr_list[0]));
+ }
+ else
+ {
+ s->localaddr.sin_addr.s_addr = inet_addr(s->localaddress);
+ }
+ }
+ else
+ {
+ s->localaddr.sin_addr.s_addr = INADDR_ANY;
+ }
+
+ addrsize = sizeof(struct sockaddr_in);
+ err = bind(s->listensock,(struct sockaddr *)&s->localaddr,sizeof(s->localaddr));
+ err = getsockname(s->listensock,(struct sockaddr *)&listenaddr,&addrsize);
+
+ //s->sessionid = time(NULL);
+ s->sessionid = get_time(NULL);
+
+ s->listenport = ntohs(listenaddr.sin_port);
+ strcpy(s->osname,"whocares");
+ strcpy(s->osrelease,"notme");
+
+ he = gethostbyname(s->authserver);
+
+ if(he)
+ {
+ s->authhost.sin_addr.s_addr = *((int*)(he->h_addr_list[0]));
+ }
+ else
+ {
+ s->authhost.sin_addr.s_addr = inet_addr(s->authserver);
+ }
+
+ s->authhost.sin_port = htons(s->authport);
+ s->authhost.sin_family = AF_INET;
+
+ s->debug(0,"Auth host = %s:%d\n",s->authserver,s->authport);
+ s->debug(0,"Auth domain = %s\n",s->authdomain);
+ s->debug(0,"Listening on port %d\n",s->listenport);
+
+ if(test_connect_success // by honor, for debug
+ || login(s))
+ {
+ s->onconnected(s->listenport);
+ if(!handle_heartbeats(s))
+ {
+ int i;
+ s->ondisconnected(0);
+ s->noncritical("Sleeping for 10 seconds (1)");
+ for(i=0;i<10;i++)
+ {
+ if(s->shutdown)
+ return 0;
+ else
+ sleep(1);
+ }
+ }
+ else
+ {
+ closesocket(s->listensock);
+ return 0;
+ }
+ closesocket(s->listensock);
+ }
+ else
+ {
+ int i;
+ s->noncritical("Sleeping for 10 seconds (2)");
+ for(i=0;i<10;i++)
+ {
+ if(s->shutdown)
+ return 0;
+ else
+ sleep(1);
+ }
+ closesocket(s->listensock);
+ }
+ return 1;
+}
+
+int
+log_to_file(char *buf) // add by honor
+{
+ FILE *fp;
+
+ if ((fp = fopen("/tmp/ppp/log", "w"))) {
+ fprintf(fp, "%s", buf);
+ fclose(fp);
+ return 1;
+ }
+ return 0;
+}
+
diff --git a/release/src/router/bpalogin/bpalogin.conf b/release/src/router/bpalogin/bpalogin.conf
new file mode 100644
index 00000000..3bdeefcd
--- /dev/null
+++ b/release/src/router/bpalogin/bpalogin.conf
@@ -0,0 +1,45 @@
+# Default debug level is 1. Values range from 0-2 with 0 being silent
+# All information goes to the syslog.
+#debuglevel 1
+
+# The user name you have for your BPA account
+username yourname
+
+# Your BPA password
+password yourpass
+
+# The default auth server is "sm-server" You can override this value, but
+# you would only do this if you have not set your default domain correctly
+# in your /etc/resolv.conf
+#authserver sm-server
+
+# You can override the default domain if you have your
+# resolv.conf set to not include the BPA domains.
+#authdomain vic.bigpond.net.au
+
+# The loginprog will be executed whenever BPALogin connects successfully
+# you could have it run a script to start a firewall, etc. The first
+# parm to the program will be the port number
+#connectedprog /etc/rc.d/rc.masq
+#disconnectedprog /etc/rc.d/rc.masq
+
+# If you want to bind BPALogin to a specific address rather than all
+# sockets, you can do that here.
+#localaddress 0.0.0.0
+
+# You can now define the listen port instead of a random port
+# This will help with firewalls.
+localport 5050
+
+# Logging can be sent to syslog or stdout.
+#logging syslog
+
+# Set the minimum heartbeat interval. This can protect against
+# DoS attacks.
+#minheartbeatinterval 60
+
+# Set the maximum heartbeat interval. Sometimes the DCE server will not
+# send a heartbeat for a long time (i.e. longer than seven minutes) but
+# the connection is still open. BPALogin will normally treat this as a
+# failed connection unless you raise the maximum interval.
+#maxheartbeatinterval 420
diff --git a/release/src/router/bpalogin/bpalogin.conf.sh b/release/src/router/bpalogin/bpalogin.conf.sh
new file mode 100755
index 00000000..c37170b5
--- /dev/null
+++ b/release/src/router/bpalogin/bpalogin.conf.sh
@@ -0,0 +1,219 @@
+#!/bin/sh
+#
+# Configuration script for BPALogin
+#
+# Creates a new bpalogin.conf file based on the installed template, prompting
+# for overrides.
+#
+# Relies heavily on the formatting of the bpalogin.conf file and is sensitive
+# to whitespace! Be careful when changing bpalogin.conf.
+#
+# Copyright 2003 William Rose <wdrose@sourceforge.net> and licensed under the
+# GNU GPL, as per the rest of BPALogin.
+###
+
+CONFIG_FILE="${1:-/etc/bpalogin.conf}"
+TMP_DIR="${TMPDIR:-/tmp}"
+NEW_CONFIG="`mktemp $TMP_DIR/bpalogin.conf-XXXXXX`"
+
+if ! [ -r "$CONFIG_FILE" ]
+then
+ echo "Usage: bpalogin.conf.sh config-file-name"
+ exit 1
+fi
+
+eval `cat "$CONFIG_FILE" | \
+(while read
+ do
+ case "$REPLY" in
+ '# '*)
+ # Comment line
+ ;;
+
+ '#'*)
+ # Unspecified option
+ REPLY="${REPLY#\#}"
+ if [ -n "$REPLY" ]
+ then
+ name="${REPLY%% *}"
+ value="${REPLY#* }"
+
+ echo "$name=\"$value\""
+ echo "${name}_disabled=\"yes\""
+ disabled="$disabled $name"
+ fi
+ ;;
+
+ *)
+ # Empty line or specified option
+ if [ -n "$REPLY" ]
+ then
+ name="${REPLY%% *}"
+ value="${REPLY#* }"
+
+ echo "$name=\"$value\""
+ echo "${name}_disabled=\"no\""
+ variables="$variables $name"
+ fi
+ ;;
+ esac
+ done
+ echo "variables=\"${variables# }\""
+ echo "disabled=\"${disabled# }\""
+)`
+
+##
+# Prompt for new values for already configured variables.
+#
+if [ -n "$variables" ]
+then
+ cat <<EOF
+
+
+BPALogin Configuration
+----------------------
+
+You will now be prompted for some basic details about your connection.
+
+When prompted, the current information is displayed in square brackets.
+Press Enter to accept the current information, or else type the new details
+and press Enter.
+
+
+EOF
+
+ for var in $variables
+ do
+ echo -n "Enter $var [`eval 'echo $'$var`]: "
+ if read && [ -n "$REPLY" ]
+ then
+ eval "$var=\"$REPLY\""
+ fi
+ done
+fi
+
+##
+# Prompt for additional configuration details if disabled configuration
+# options were detected.
+if [ -n "$disabled" ]
+then
+ echo
+ echo -n "Would you like to configure additional options? (y/n): "
+ read
+ case "$REPLY" in
+ [Yy]*)
+ cat <<EOF
+
+
+Additional Configuration
+------------------------
+
+You will now be prompted for some additional details about your connection.
+
+When prompted, the default information is displayed in square brackets.
+Press Enter to use the default information in your configuration file, or
+else type the new details. If you do not wish to have any value recorded
+in your configuration file, type # and press Enter.
+
+
+EOF
+ for var in $disabled
+ do
+ echo -n "Enter $var [`eval 'echo $'$var`]: "
+ if read
+ then
+ if [ -n "$REPLY" ]
+ then
+ if [ "$REPLY" = "#" ]
+ then
+ eval "${var}_disabled=\"yes\""
+ else
+ eval "${var}_disabled=\"no\""
+ eval "$var=\"$REPLY\""
+ fi
+ else
+ eval "${var}_disabled=\"no\""
+ fi
+ fi
+ done
+ ;;
+ *)
+ ;;
+ esac
+fi
+
+
+##
+# Create the new bpalogin.conf file
+cat "$CONFIG_FILE" | \
+(while read;
+ do
+ case "$REPLY" in
+ '# '*)
+ # Comment line
+ echo $REPLY >> "$NEW_CONFIG"
+ ;;
+
+ '#'*)
+ # Unspecified option
+ REPLY="${REPLY#\#}"
+ if [ -n "$REPLY" ]
+ then
+ name="${REPLY%% *}"
+
+ if eval "[ \"\$${name}_disabled\" = \"yes\" ]"
+ then
+ echo "#$name `eval 'echo $'$name`" >> "$NEW_CONFIG"
+ else
+ echo "$name `eval 'echo $'$name`" >> "$NEW_CONFIG"
+ fi
+ else
+ echo $REPLY >> "$NEW_CONFIG"
+ fi
+ ;;
+
+ *)
+ if [ -n "$REPLY" ]
+ then
+ name="${REPLY%% *}"
+
+ if eval "[ \"\$${name}_disabled\" = \"yes\" ]"
+ then
+ echo "#$name `eval 'echo $'$name`" >> "$NEW_CONFIG"
+ else
+ echo "$name `eval 'echo $'$name`" >> "$NEW_CONFIG"
+ fi
+ else
+ echo $REPLY >> "$NEW_CONFIG"
+ fi
+ ;;
+ esac
+ done)
+
+echo
+echo "New configuration successfully saved in $NEW_CONFIG"
+echo -n "Overwrite $CONFIG_FILE with this file? (y/n) "
+read
+
+case "$REPLY" in
+ [Yy]*)
+ if mv "$NEW_CONFIG" "$CONFIG_FILE"
+ then
+ echo "Your BPALogin configuration file has been updated."
+ else
+ echo "Action failed. Please copy $NEW_CONFIG to $CONFIG_FILE manually."
+ fi
+
+ if ! chmod 600 "$CONFIG_FILE"
+ then
+ echo "Unable to change permissions for your configuration file."
+ echo "Please check your configuration file is not readable by others."
+ fi
+ ;;
+ *)
+ echo "Your original BPALogin configuration file was not changed."
+ ;;
+esac
+
+echo
+
diff --git a/release/src/router/bpalogin/bpalogin.h b/release/src/router/bpalogin/bpalogin.h
new file mode 100644
index 00000000..c812cdb6
--- /dev/null
+++ b/release/src/router/bpalogin/bpalogin.h
@@ -0,0 +1,323 @@
+/*
+** BPALogin - lightweight portable BIDS2 login client
+** Copyright (c) 2001-3 Shane Hyde, and others.
+**
+** 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+**
+*/
+
+/**
+ * Changes:
+ *
+ * 2001-12-05: wdrose Added errno.h to list of UNIX-only includes.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+
+#ifndef _WIN32
+#include <unistd.h>
+#include <errno.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <syslog.h>
+#include <arpa/inet.h>
+#endif
+
+#include <time.h>
+#include <signal.h>
+#include <sys/types.h>
+#include "get_time.h"
+
+#ifdef _WIN32
+#include <winsock.h>
+#endif
+
+/*
+** Win32 & BeOS use a closesocket call, and unices use a close call, this define fixes this up
+*/
+#ifndef _WIN32
+int closesocket(int);
+//#define closesocket close
+#endif
+
+
+#ifdef _WIN32
+#define NOSYSLOG
+#define HAS_VNSPRINTF
+
+#define sleep(x) Sleep((x)*1000)
+#endif
+
+/*
+** This is needed for compiling with EMX under OS/2
+*/
+#ifdef __EMX__
+ #define strcasecmp stricmp
+#endif
+
+
+#define TRUE 1
+#define FALSE 0
+
+#define LOGIN_SOFTWARE "bpalogin"
+#define LOGIN_VERSION 1
+
+#define MAXUSERNAME 25
+#define MAXPASSWORD 25
+#define MAXAUTHSERVER 80
+#define MAXAUTHDOMAIN 80
+#define MAXLOGINPROG 256
+#define MAXCONFFILE 256
+#define MAXLOCALADDRESS 32
+#define MAXDDNSCONFFILE 256
+
+#define DEFAULT_DEBUG 1
+#define DEFAULT_AUTHSERVER "sm-server"
+#define DEFAULT_AUTHDOMAIN ""
+#define DEFAULT_AUTHPORT 5050
+#define DEFAULT_CONFFILE "/usr/local/etc/bpalogin.conf"
+/*
+** state engine codes
+*/
+#define STATE_NEED_PROTOCOL 0
+#define STATE_SEND_PROT_REQ 1
+#define STATE_AWAIT_NEG_RESP 2
+#define STATE_SEND_LOGIN_REQ 3
+#define STATE_AWAIT_LOGIN_AUTH_RESP 4
+#define STATE_SEND_LOGIN_AUTH_REQ 5
+#define STATE_AWAIT_LOGIN_RESP 6
+#define STATE_SEND_LOGOUT_REQ 7
+#define STATE_AWAIT_LOGOUT_AUTH_RESP 8
+#define STATE_SEND_LOGOUT_AUTH_REQ 9
+#define STATE_AWAIT_LOGOUT_RESP 10
+#define STATE_IDLE_LOGIN 11
+#define STATE_RECEIVED_STATUS_REQ 12
+#define STATE_RECEIVED_RESTART_REQ 13
+#define STATE_IDLE_LOGOFF 14
+
+/*
+** message type codes
+*/
+#define T_MSG_MIN 1
+#define T_MSG_PROTOCOL_NEG_REQ 1
+#define T_MSG_PROTOCOL_NEG_RESP 2
+#define T_MSG_LOGIN_REQ 3
+#define T_MSG_LOGIN_AUTH_REQ 4
+#define T_MSG_LOGIN_RESP 5
+#define T_MSG_LOGOUT_REQ 6
+#define T_MSG_LOGOUT_AUTH_RESP 7
+#define T_MSG_LOGOUT_RESP 8
+#define T_MSG_AUTH_RESP 9
+#define T_MSG_AUTH_REQ 10
+#define T_MSG_STATUS_REQ 11
+#define T_MSG_STATUS_RESP 12
+#define T_MSG_RESTART_REQ 13
+#define T_MSG_RESTART_RESP 14
+#define T_MSG_MAX 14
+
+/*
+** message parameter codes
+*/
+#define T_PARAM_MIN 1
+#define T_PARAM_PROTOCOL_LIST 1
+#define T_PARAM_PROTOCOL_SELECT 2
+#define T_PARAM_CLIENT_VERSION 3
+#define T_PARAM_OS_IDENTITY 4
+#define T_PARAM_OS_VERSION 5
+#define T_PARAM_REASON_CODE 6
+#define T_PARAM_USERNAME 7
+#define T_PARAM_REQ_PORT 8
+#define T_PARAM_RESPONSE_TEXT 9
+#define T_PARAM_STATUS_CODE 10
+#define T_PARAM_AUTH_CREDENTIALS 11
+#define T_PARAM_NONCE 12
+#define T_PARAM_SEQNUM 13
+#define T_PARAM_HASH_METHOD 14
+#define T_PARAM_LOGIN_SERVICE_PORT 15
+#define T_PARAM_LOGOUT_SERVICE_PORT 16
+#define T_PARAM_STATUS_SERVICE_PORT 17
+#define T_PARAM_SUSPEND_IND 18
+#define T_PARAM_STATUS_AUTH 19
+#define T_PARAM_RESTART_AUTH 20
+#define T_PARAM_TIMESTAMP 21
+#define T_PARAM_TSMLIST 22
+#define T_PARAM_LOGIN_PARAM_HASH 23
+#define T_PARAM_LOGIN_SERVER_HOST 24
+#define T_PARAM_MAX 24
+
+/*
+** login reason codes
+*/
+#define T_LOGIN_REASON_CODE_NORMAL 0
+#define T_LOGIN_REASON_CODE_REAUTH 1
+
+/*
+** logout reason codes
+*/
+#define T_LOGOUT_REASON_CODE_USER_INITIATED 0
+#define T_LOGOUT_REASON_CODE_APP_SHUTDOWN 1
+#define T_LOGOUT_REASON_CODE_OS_SHUTDOWN 2
+#define T_LOGOUT_REASON_CODE_UNKNOWN 3
+
+/*
+** client status transaction codes
+*/
+#define T_STATUS_TRANSACTION_OK 0
+
+/*
+** restart reasons
+*/
+#define T_RESTART_ADMIN 0
+
+/*
+** auth responses
+*/
+#define T_AUTH_NOHASH 0
+#define T_AUTH_MD5_HASH 1
+
+/*
+** protocol types
+*/
+#define T_PROTOCOL_CHAL 1
+
+/*
+** status return codes
+*/
+#define T_STATUS_SUCCESS 0
+#define T_STATUS_USERNAME_NOT_FOUND 1
+#define T_STATUS_INCORRECT_PASSWORD 2
+#define T_STATUS_ACCOUNT_DISABLED 3
+#define T_STATUS_USER_DISABLED 4
+#define T_STATUS_LOGIN_SUCCESSFUL_ALREADY_LOGGED_IN 100
+#define T_STATUS_LOGIN_RETRY_LIMIT 101
+#define T_STATUS_LOGIN_SUCCESSFUL_SWVER 102
+#define T_STATUS_LOGIN_FAIL_SW 103
+#define T_STATUS_LOGOUT_SUCCESSFUL_ALREADY_DISCONNECTED 200
+#define T_STATUS_LOGOUT_AUTH_RETRY_LIMIT 201
+#define T_STATUS_LOGIN_SUCCESS_SWVER 300
+#define T_STATUS_LOGIN_FAIL_SWVER 301
+#define T_STATUS_LOGIN_FAIL_INV_PROT 302
+#define T_STATUS_LOGIN_UNKNOWN 500
+#define T_STATUS_FAIL_USERNAME_VALIDATE 501
+#define T_STATUS_FAIL_PASSWORD_VALIDATE 502
+
+typedef unsigned short INT2;
+typedef unsigned int INT4;
+
+struct transaction
+{
+ char data[1512];
+ int length;
+};
+
+/*
+** This structure holds all information necessary to connect/disconnect
+*/
+struct session
+{
+ /*
+ ** Control paramters
+ */
+ char username[MAXUSERNAME];
+ char password[MAXPASSWORD];
+ char authserver[MAXAUTHSERVER];
+ char authdomain[MAXAUTHDOMAIN];
+ unsigned short authport;
+ char connectedprog[MAXLOGINPROG];
+ char disconnectedprog[MAXLOGINPROG];
+ void * pUserData;
+ int shutdown;
+ char localaddress[MAXLOCALADDRESS];
+ unsigned short localport;
+ int minheartbeat, maxheartbeat;
+
+ /*
+ ** Callback functions
+ */
+ void (*debug)(int,char *,...);
+ void (*critical)(char *);
+ void (*noncritical)(char *,...);
+ void (*onconnected)(int listenport);
+ void (*ondisconnected)(int reason);
+
+ /*
+ ** Internal data
+ */
+ INT4 sessionid;
+ INT2 listenport;
+ struct sockaddr_in authhost;
+ char osname[80];
+ char osrelease[80];
+ int listensock;
+ struct sockaddr_in localaddr;
+ struct sockaddr_in localipaddress;
+
+ INT2 protocol;
+ INT2 loginserviceport;
+ char loginserverhost[128];
+ INT2 hashmethod;
+ char nonce[17];
+ INT2 retcode;
+ INT2 logoutport;
+ INT2 statusport;
+ char tsmlist[512];
+ char tsmlist_s[512][20];
+ struct sockaddr_in tsmlist_in[20];
+ int tsmcount;
+ char resptext[512];
+ INT4 timestamp;
+
+ time_t lastheartbeat;
+ int recenthb;
+ INT4 sequence;
+ struct sockaddr_in fromaddr;
+};
+
+/*
+** Prototypes
+*/
+int mainloop(struct session *);
+int handle_heartbeats(struct session *);
+
+void start_transaction(struct transaction * t,INT2 msgtype,INT4 sessionid);
+void send_transaction(struct session *s,int socket,struct transaction * t);
+INT2 receive_transaction(struct session *s,int socket,struct transaction * t);
+INT2 receive_udp_transaction(struct session *s,int socket,struct transaction * t,struct sockaddr_in *addr);
+void send_udp_transaction(struct session * s,struct transaction * t);
+
+int extract_valueINT2(struct session *s,struct transaction * t,INT2 parm,INT2 *v);
+int extract_valueINT4(struct session *s,struct transaction *,INT2,INT4 *);
+int extract_valuestring(struct session *s,struct transaction *,INT2,char *);
+
+void add_field_string(struct session *s,struct transaction * t,INT2 fn,char * p);
+void add_field_data(struct session *s,struct transaction * t,INT2 fn,char * p,int c);
+void add_field_INT2(struct session *s,struct transaction * t,INT2 fn,INT2 v);
+void add_field_INT4(struct session *s,struct transaction * t,INT2 fn,INT4 v);
+
+int login(struct session *);
+int logout(INT2,struct session *);
+
+INT2 read_INT2(void *);
+INT4 read_INT4(void *);
+
+void socketerror(struct session *,const char *);
+
+extern int test_connect_success;
+
diff --git a/release/src/router/bpalogin/bpalogin.h.in b/release/src/router/bpalogin/bpalogin.h.in
new file mode 100644
index 00000000..9bc84080
--- /dev/null
+++ b/release/src/router/bpalogin/bpalogin.h.in
@@ -0,0 +1,320 @@
+/*
+** BPALogin - lightweight portable BIDS2 login client
+** Copyright (c) 2001-3 Shane Hyde, and others.
+**
+** 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+**
+*/
+
+/**
+ * Changes:
+ *
+ * 2001-12-05: wdrose Added errno.h to list of UNIX-only includes.
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+
+#ifndef _WIN32
+#include <unistd.h>
+#include <errno.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netdb.h>
+#include <syslog.h>
+#include <arpa/inet.h>
+#endif
+
+#include <time.h>
+#include <signal.h>
+#include <sys/types.h>
+
+#ifdef _WIN32
+#include <winsock.h>
+#endif
+
+/*
+** Win32 & BeOS use a closesocket call, and unices use a close call, this define fixes this up
+*/
+#ifndef _WIN32
+int closesocket(int);
+//#define closesocket close
+#endif
+
+
+#ifdef _WIN32
+#define NOSYSLOG
+#define HAS_VNSPRINTF
+
+#define sleep(x) Sleep((x)*1000)
+#endif
+
+/*
+** This is needed for compiling with EMX under OS/2
+*/
+#ifdef __EMX__
+ #define strcasecmp stricmp
+#endif
+
+
+#define TRUE 1
+#define FALSE 0
+
+#define LOGIN_SOFTWARE "bpalogin"
+#define LOGIN_VERSION 1
+
+#define MAXUSERNAME 25
+#define MAXPASSWORD 25
+#define MAXAUTHSERVER 80
+#define MAXAUTHDOMAIN 80
+#define MAXLOGINPROG 256
+#define MAXCONFFILE 256
+#define MAXLOCALADDRESS 32
+#define MAXDDNSCONFFILE 256
+
+#define DEFAULT_DEBUG 1
+#define DEFAULT_AUTHSERVER "sm-server"
+#define DEFAULT_AUTHDOMAIN ""
+#define DEFAULT_AUTHPORT 5050
+#define DEFAULT_CONFFILE "@@BPALOGIN_CONF@@"
+/*
+** state engine codes
+*/
+#define STATE_NEED_PROTOCOL 0
+#define STATE_SEND_PROT_REQ 1
+#define STATE_AWAIT_NEG_RESP 2
+#define STATE_SEND_LOGIN_REQ 3
+#define STATE_AWAIT_LOGIN_AUTH_RESP 4
+#define STATE_SEND_LOGIN_AUTH_REQ 5
+#define STATE_AWAIT_LOGIN_RESP 6
+#define STATE_SEND_LOGOUT_REQ 7
+#define STATE_AWAIT_LOGOUT_AUTH_RESP 8
+#define STATE_SEND_LOGOUT_AUTH_REQ 9
+#define STATE_AWAIT_LOGOUT_RESP 10
+#define STATE_IDLE_LOGIN 11
+#define STATE_RECEIVED_STATUS_REQ 12
+#define STATE_RECEIVED_RESTART_REQ 13
+#define STATE_IDLE_LOGOFF 14
+
+/*
+** message type codes
+*/
+#define T_MSG_MIN 1
+#define T_MSG_PROTOCOL_NEG_REQ 1
+#define T_MSG_PROTOCOL_NEG_RESP 2
+#define T_MSG_LOGIN_REQ 3
+#define T_MSG_LOGIN_AUTH_REQ 4
+#define T_MSG_LOGIN_RESP 5
+#define T_MSG_LOGOUT_REQ 6
+#define T_MSG_LOGOUT_AUTH_RESP 7
+#define T_MSG_LOGOUT_RESP 8
+#define T_MSG_AUTH_RESP 9
+#define T_MSG_AUTH_REQ 10
+#define T_MSG_STATUS_REQ 11
+#define T_MSG_STATUS_RESP 12
+#define T_MSG_RESTART_REQ 13
+#define T_MSG_RESTART_RESP 14
+#define T_MSG_MAX 14
+
+/*
+** message parameter codes
+*/
+#define T_PARAM_MIN 1
+#define T_PARAM_PROTOCOL_LIST 1
+#define T_PARAM_PROTOCOL_SELECT 2
+#define T_PARAM_CLIENT_VERSION 3
+#define T_PARAM_OS_IDENTITY 4
+#define T_PARAM_OS_VERSION 5
+#define T_PARAM_REASON_CODE 6
+#define T_PARAM_USERNAME 7
+#define T_PARAM_REQ_PORT 8
+#define T_PARAM_RESPONSE_TEXT 9
+#define T_PARAM_STATUS_CODE 10
+#define T_PARAM_AUTH_CREDENTIALS 11
+#define T_PARAM_NONCE 12
+#define T_PARAM_SEQNUM 13
+#define T_PARAM_HASH_METHOD 14
+#define T_PARAM_LOGIN_SERVICE_PORT 15
+#define T_PARAM_LOGOUT_SERVICE_PORT 16
+#define T_PARAM_STATUS_SERVICE_PORT 17
+#define T_PARAM_SUSPEND_IND 18
+#define T_PARAM_STATUS_AUTH 19
+#define T_PARAM_RESTART_AUTH 20
+#define T_PARAM_TIMESTAMP 21
+#define T_PARAM_TSMLIST 22
+#define T_PARAM_LOGIN_PARAM_HASH 23
+#define T_PARAM_LOGIN_SERVER_HOST 24
+#define T_PARAM_MAX 24
+
+/*
+** login reason codes
+*/
+#define T_LOGIN_REASON_CODE_NORMAL 0
+#define T_LOGIN_REASON_CODE_REAUTH 1
+
+/*
+** logout reason codes
+*/
+#define T_LOGOUT_REASON_CODE_USER_INITIATED 0
+#define T_LOGOUT_REASON_CODE_APP_SHUTDOWN 1
+#define T_LOGOUT_REASON_CODE_OS_SHUTDOWN 2
+#define T_LOGOUT_REASON_CODE_UNKNOWN 3
+
+/*
+** client status transaction codes
+*/
+#define T_STATUS_TRANSACTION_OK 0
+
+/*
+** restart reasons
+*/
+#define T_RESTART_ADMIN 0
+
+/*
+** auth responses
+*/
+#define T_AUTH_NOHASH 0
+#define T_AUTH_MD5_HASH 1
+
+/*
+** protocol types
+*/
+#define T_PROTOCOL_CHAL 1
+
+/*
+** status return codes
+*/
+#define T_STATUS_SUCCESS 0
+#define T_STATUS_USERNAME_NOT_FOUND 1
+#define T_STATUS_INCORRECT_PASSWORD 2
+#define T_STATUS_ACCOUNT_DISABLED 3
+#define T_STATUS_USER_DISABLED 4
+#define T_STATUS_LOGIN_SUCCESSFUL_ALREADY_LOGGED_IN 100
+#define T_STATUS_LOGIN_RETRY_LIMIT 101
+#define T_STATUS_LOGIN_SUCCESSFUL_SWVER 102
+#define T_STATUS_LOGIN_FAIL_SW 103
+#define T_STATUS_LOGOUT_SUCCESSFUL_ALREADY_DISCONNECTED 200
+#define T_STATUS_LOGOUT_AUTH_RETRY_LIMIT 201
+#define T_STATUS_LOGIN_SUCCESS_SWVER 300
+#define T_STATUS_LOGIN_FAIL_SWVER 301
+#define T_STATUS_LOGIN_FAIL_INV_PROT 302
+#define T_STATUS_LOGIN_UNKNOWN 500
+#define T_STATUS_FAIL_USERNAME_VALIDATE 501
+#define T_STATUS_FAIL_PASSWORD_VALIDATE 502
+
+typedef unsigned short INT2;
+typedef unsigned int INT4;
+
+struct transaction
+{
+ char data[1512];
+ int length;
+};
+
+/*
+** This structure holds all information necessary to connect/disconnect
+*/
+struct session
+{
+ /*
+ ** Control paramters
+ */
+ char username[MAXUSERNAME];
+ char password[MAXPASSWORD];
+ char authserver[MAXAUTHSERVER];
+ char authdomain[MAXAUTHDOMAIN];
+ unsigned short authport;
+ char connectedprog[MAXLOGINPROG];
+ char disconnectedprog[MAXLOGINPROG];
+ void * pUserData;
+ int shutdown;
+ char localaddress[MAXLOCALADDRESS];
+ unsigned short localport;
+ int minheartbeat, maxheartbeat;
+
+ /*
+ ** Callback functions
+ */
+ void (*debug)(int,char *,...);
+ void (*critical)(char *);
+ void (*noncritical)(char *,...);
+ void (*onconnected)(int listenport);
+ void (*ondisconnected)(int reason);
+
+ /*
+ ** Internal data
+ */
+ INT4 sessionid;
+ INT2 listenport;
+ struct sockaddr_in authhost;
+ char osname[80];
+ char osrelease[80];
+ int listensock;
+ struct sockaddr_in localaddr;
+ struct sockaddr_in localipaddress;
+
+ INT2 protocol;
+ INT2 loginserviceport;
+ char loginserverhost[128];
+ INT2 hashmethod;
+ char nonce[17];
+ INT2 retcode;
+ INT2 logoutport;
+ INT2 statusport;
+ char tsmlist[512];
+ char tsmlist_s[512][20];
+ struct sockaddr_in tsmlist_in[20];
+ int tsmcount;
+ char resptext[512];
+ INT4 timestamp;
+
+ time_t lastheartbeat;
+ int recenthb;
+ INT4 sequence;
+ struct sockaddr_in fromaddr;
+};
+
+/*
+** Prototypes
+*/
+int mainloop(struct session *);
+int handle_heartbeats(struct session *);
+
+void start_transaction(struct transaction * t,INT2 msgtype,INT4 sessionid);
+void send_transaction(struct session *s,int socket,struct transaction * t);
+INT2 receive_transaction(struct session *s,int socket,struct transaction * t);
+INT2 receive_udp_transaction(struct session *s,int socket,struct transaction * t,struct sockaddr_in *addr);
+void send_udp_transaction(struct session * s,struct transaction * t);
+
+int extract_valueINT2(struct session *s,struct transaction * t,INT2 parm,INT2 *v);
+int extract_valueINT4(struct session *s,struct transaction *,INT2,INT4 *);
+int extract_valuestring(struct session *s,struct transaction *,INT2,char *);
+
+void add_field_string(struct session *s,struct transaction * t,INT2 fn,char * p);
+void add_field_data(struct session *s,struct transaction * t,INT2 fn,char * p,int c);
+void add_field_INT2(struct session *s,struct transaction * t,INT2 fn,INT2 v);
+void add_field_INT4(struct session *s,struct transaction * t,INT2 fn,INT4 v);
+
+int login(struct session *);
+int logout(INT2,struct session *);
+
+INT2 read_INT2(void *);
+INT4 read_INT4(void *);
+
+void socketerror(struct session *,const char *);
+
diff --git a/release/src/router/bpalogin/bpalogin.init b/release/src/router/bpalogin/bpalogin.init
new file mode 100644
index 00000000..6048e715
--- /dev/null
+++ b/release/src/router/bpalogin/bpalogin.init
@@ -0,0 +1,53 @@
+#!/bin/sh
+#
+# bpalogin This shell script takes care of starting and stopping
+# bpalogin.
+#
+# chkconfig: 345 50 50
+# description: A daemon to connect to Big Pond Advance Cable
+#
+# processname: bpalogin
+# config: /etc/bpalogin.conf
+
+# Source function library.
+. /etc/rc.d/init.d/functions
+
+# Source networking configuration.
+. /etc/sysconfig/network
+
+# Check that networking is up.
+[ ${NETWORKING} = "no" ] && exit 0
+
+[ -f /usr/sbin/bpalogin ] || exit 0
+
+# See how we were called.
+case "$1" in
+ start)
+ # Start daemons.
+
+ echo -n "Starting bpalogin: "
+ /usr/sbin/bpalogin -c /etc/bpalogin.conf
+ echo
+ touch /var/lock/subsys/bpalogin
+ ;;
+ stop)
+ # Stop daemons.
+ echo -n "Shutting down bpalogin: "
+ killproc bpalogin
+ echo
+ rm -f /var/lock/subsys/bpalogin
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ status)
+ status bpalogin
+ ;;
+ *)
+ echo "Usage: bpalogin {start|stop|restart|status}"
+ exit 1
+esac
+
+exit 0
+
diff --git a/release/src/router/bpalogin/configure b/release/src/router/bpalogin/configure
new file mode 100755
index 00000000..b40d3ea6
--- /dev/null
+++ b/release/src/router/bpalogin/configure
@@ -0,0 +1,4128 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.53.
+#
+# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
+# Free Software Foundation, Inc.
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
+fi
+
+# NLS nuisances.
+# Support unset when possible.
+if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+(set +x; test -n "`(LANG=C; export LANG) 2>&1`") &&
+ { $as_unset LANG || test "${LANG+set}" != set; } ||
+ { LANG=C; export LANG; }
+(set +x; test -n "`(LC_ALL=C; export LC_ALL) 2>&1`") &&
+ { $as_unset LC_ALL || test "${LC_ALL+set}" != set; } ||
+ { LC_ALL=C; export LC_ALL; }
+(set +x; test -n "`(LC_TIME=C; export LC_TIME) 2>&1`") &&
+ { $as_unset LC_TIME || test "${LC_TIME+set}" != set; } ||
+ { LC_TIME=C; export LC_TIME; }
+(set +x; test -n "`(LC_CTYPE=C; export LC_CTYPE) 2>&1`") &&
+ { $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set; } ||
+ { LC_CTYPE=C; export LC_CTYPE; }
+(set +x; test -n "`(LANGUAGE=C; export LANGUAGE) 2>&1`") &&
+ { $as_unset LANGUAGE || test "${LANGUAGE+set}" != set; } ||
+ { LANGUAGE=C; export LANGUAGE; }
+(set +x; test -n "`(LC_COLLATE=C; export LC_COLLATE) 2>&1`") &&
+ { $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set; } ||
+ { LC_COLLATE=C; export LC_COLLATE; }
+(set +x; test -n "`(LC_NUMERIC=C; export LC_NUMERIC) 2>&1`") &&
+ { $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set; } ||
+ { LC_NUMERIC=C; export LC_NUMERIC; }
+(set +x; test -n "`(LC_MESSAGES=C; export LC_MESSAGES) 2>&1`") &&
+ { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } ||
+ { LC_MESSAGES=C; export LC_MESSAGES; }
+
+
+# Name of the executable.
+as_me=`(basename "$0") 2>/dev/null ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)$' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conftest.sh
+ echo "exit 0" >>conftest.sh
+ chmod +x conftest.sh
+ if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conftest.sh
+fi
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" || {
+ # Find who we are. Look in the path if we contain no path at all
+ # relative or not.
+ case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+ ;;
+ esac
+ # We did not find ourselves, most probably we were run as `sh COMMAND'
+ # in which case we are not to be found in the path.
+ if test "x$as_myself" = x; then
+ as_myself=$0
+ fi
+ if test ! -f "$as_myself"; then
+ { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
+ { (exit 1); exit 1; }; }
+ fi
+ case $CONFIG_SHELL in
+ '')
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for as_base in sh bash ksh sh5; do
+ case $as_dir in
+ /*)
+ if ("$as_dir/$as_base" -c '
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
+ CONFIG_SHELL=$as_dir/$as_base
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+ fi;;
+ esac
+ done
+done
+;;
+ esac
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line before each line; the second 'sed' does the real
+ # work. The second script uses 'N' to pair each line-number line
+ # with the numbered line, and appends trailing '-' during
+ # substitution so that $LINENO is not a special case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-)
+ sed '=' <$as_myself |
+ sed '
+ N
+ s,$,-,
+ : loop
+ s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+ t loop
+ s,-$,,
+ s,^['$as_cr_digits']*\n,,
+ ' >$as_me.lineno &&
+ chmod +x $as_me.lineno ||
+ { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensible to this).
+ . ./$as_me.lineno
+ # Exit status is that of the last command.
+ exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+ *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T=' ' ;;
+ *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+ *) ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ # We could just check for DJGPP; but this test a) works b) is more generic
+ # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+ if test -f conf$$.exe; then
+ # Don't use ln at all; we don't have any links
+ as_ln_s='cp -p'
+ else
+ as_ln_s='ln -s'
+ fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; }
+
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+exec 6>&1
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Maximum number of lines to put in a shell here document.
+# This variable seems obsolete. It should probably be removed, and
+# only ac_max_sed_lines should be used.
+: ${ac_max_here_lines=38}
+
+# Identity of this package.
+PACKAGE_NAME=
+PACKAGE_TARNAME=
+PACKAGE_VERSION=
+PACKAGE_STRING=
+PACKAGE_BUGREPORT=
+
+ac_unique_file="bpalogin.c"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+# include <stdint.h>
+# endif
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+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
+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
+ac_env_build_alias_set=${build_alias+set}
+ac_env_build_alias_value=$build_alias
+ac_cv_env_build_alias_set=${build_alias+set}
+ac_cv_env_build_alias_value=$build_alias
+ac_env_host_alias_set=${host_alias+set}
+ac_env_host_alias_value=$host_alias
+ac_cv_env_host_alias_set=${host_alias+set}
+ac_cv_env_host_alias_value=$host_alias
+ac_env_target_alias_set=${target_alias+set}
+ac_env_target_alias_value=$target_alias
+ac_cv_env_target_alias_set=${target_alias+set}
+ac_cv_env_target_alias_value=$target_alias
+ac_env_CC_set=${CC+set}
+ac_env_CC_value=$CC
+ac_cv_env_CC_set=${CC+set}
+ac_cv_env_CC_value=$CC
+ac_env_CFLAGS_set=${CFLAGS+set}
+ac_env_CFLAGS_value=$CFLAGS
+ac_cv_env_CFLAGS_set=${CFLAGS+set}
+ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_LDFLAGS_set=${LDFLAGS+set}
+ac_env_LDFLAGS_value=$LDFLAGS
+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
+ac_cv_env_LDFLAGS_value=$LDFLAGS
+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_env_CPPFLAGS_value=$CPPFLAGS
+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+ac_env_CPP_set=${CPP+set}
+ac_env_CPP_value=$CPP
+ac_cv_env_CPP_set=${CPP+set}
+ac_cv_env_CPP_value=$CPP
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures this package to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+_ACEOF
+
+ cat <<_ACEOF
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --datadir=DIR read-only architecture-independent data [PREFIX/share]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --infodir=DIR info documentation [PREFIX/info]
+ --mandir=DIR man documentation [PREFIX/man]
+_ACEOF
+
+ cat <<\_ACEOF
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+
+ cat <<\_ACEOF
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
+ headers in a nonstandard directory <include dir>
+ CPP C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+_ACEOF
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ ac_popdir=`pwd`
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d $ac_dir || continue
+ ac_builddir=.
+
+if test "$ac_dir" != .; then
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ # A "../" for each directory in $ac_dir_suffix.
+ ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+ ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+ .) # No --srcdir option. We are building in place.
+ ac_srcdir=.
+ if test -z "$ac_top_builddir"; then
+ ac_top_srcdir=.
+ else
+ ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+ fi ;;
+ [\\/]* | ?:[\\/]* ) # Absolute path.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir ;;
+ *) # Relative path.
+ ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
+# absolute.
+ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
+ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd`
+ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
+ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
+
+ cd $ac_dir
+ # Check for guested configure; otherwise get Cygnus style configure.
+ if test -f $ac_srcdir/configure.gnu; then
+ echo
+ $SHELL $ac_srcdir/configure.gnu --help=recursive
+ elif test -f $ac_srcdir/configure; then
+ echo
+ $SHELL $ac_srcdir/configure --help=recursive
+ elif test -f $ac_srcdir/configure.ac ||
+ test -f $ac_srcdir/configure.in; then
+ echo
+ $ac_configure --help
+ else
+ echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi
+ cd $ac_popdir
+ done
+fi
+
+test -n "$ac_init_help" && exit 0
+if $ac_init_version; then
+ cat <<\_ACEOF
+
+Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
+Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit 0
+fi
+exec 5>config.log
+cat >&5 <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by $as_me, which was
+generated by GNU Autoconf 2.53. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+hostinfo = `(hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ echo "PATH: $as_dir"
+done
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell meta-characters.
+ac_configure_args=
+ac_sep=
+for ac_arg
+do
+ case $ac_arg in
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c | -n ) continue ;;
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ continue ;;
+ *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+ ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+ ac_sep=" " ;;
+ esac
+ # Get rid of the leading space.
+done
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Be sure not to use single quotes in there, as some shells,
+# such as our DU 5.0 friend, will then `close' the trap.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+ cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+{
+ (set) 2>&1 |
+ case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ sed -n \
+ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+ ;;
+ *)
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+}
+ echo
+ if test -s confdefs.h; then
+ cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+ echo
+ sed "/^$/d" confdefs.h
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ echo "$as_me: caught signal $ac_signal"
+ echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core core.* *.core &&
+ rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+ ' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo >confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer explicitly selected file to automatically selected ones.
+if test -z "$CONFIG_SITE"; then
+ if test "x$prefix" != xNONE; then
+ 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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+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
+ set dummy "$as_dir/$ac_word" ${1+"$@"}
+ shift
+ ac_cv_prog_CC="$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+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" >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH" >&2;}
+ { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+ "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+ (eval $ac_compiler --version </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+ (eval $ac_compiler -v </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+ (eval $ac_compiler -V </dev/null >&5) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+#ifdef F77_DUMMY_MAIN
+# ifdef __cplusplus
+ extern "C"
+# endif
+ int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+echo "$as_me:$LINENO: checking for C compiler default output" >&5
+echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
+ (eval $ac_link_default) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # Find the output, starting from the most likely. This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+
+# Be careful to initialize this variable, since it used to be cached.
+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
+ac_cv_exeext=
+for ac_file in `ls a_out.exe a.exe conftest.exe 2>/dev/null;
+ ls a.out conftest 2>/dev/null;
+ ls a.* conftest.* 2>/dev/null`; do
+ case $ac_file in
+ *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb | *.xSYM ) ;;
+ a.out ) # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ # FIXME: I believe we export ac_cv_exeext for Libtool --akim.
+ export ac_cv_exeext
+ break;;
+ * ) break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables" >&5
+echo "$as_me: error: C compiler cannot create executables" >&2;}
+ { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
+
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+ if { ac_try='./$ac_file'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ fi
+fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+rm -f a.out a.exe conftest$ac_cv_exeext
+ac_clean_files=$ac_clean_files_save
+# Check the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do
+ case $ac_file in
+ *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ export ac_cv_exeext
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link" >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+if test "${ac_cv_objext+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+#ifdef F77_DUMMY_MAIN
+# ifdef __cplusplus
+ extern "C"
+# endif
+ int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile" >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+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"
+#include "confdefs.h"
+
+#ifdef F77_DUMMY_MAIN
+# ifdef __cplusplus
+ extern "C"
+# endif
+ int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_compiler_gnu=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_compiler_gnu=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+#ifdef F77_DUMMY_MAIN
+# ifdef __cplusplus
+ extern "C"
+# endif
+ int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat 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
+# Some people use a C++ compiler to compile C. Since we use `exit',
+# in C++ we need to declare it. In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+ choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ for ac_declaration in \
+ ''\
+ '#include <stdlib.h>' \
+ 'extern "C" void std::exit (int) throw (); using std::exit;' \
+ 'extern "C" void std::exit (int); using std::exit;' \
+ 'extern "C" void exit (int) throw ();' \
+ 'extern "C" void exit (int);' \
+ 'void exit (int);'
+do
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+$ac_declaration
+#ifdef F77_DUMMY_MAIN
+# ifdef __cplusplus
+ extern "C"
+# endif
+ int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+continue
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_declaration
+#ifdef F77_DUMMY_MAIN
+# ifdef __cplusplus
+ extern "C"
+# endif
+ int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+exit (42);
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ break
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+ echo '#ifdef __cplusplus' >>confdefs.h
+ echo $ac_declaration >>confdefs.h
+ echo '#endif' >>confdefs.h
+fi
+
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+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'
+
+
+
+
+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.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <assert.h>
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ egrep -v '^ *\+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ egrep -v '^ *\+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <assert.h>
+ Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ egrep -v '^ *\+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether non-existent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ egrep -v '^ *\+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ # 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" >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+ (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+ ac_status=$?
+ egrep -v '^ *\+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_cv_header_stdc=yes
+else
+ echo "$as_me: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ ac_cv_header_stdc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "memchr" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "free" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+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"
+#include "confdefs.h"
+#include <ctype.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ exit(2);
+ exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+
+for ac_header in sys/time.h syslog.h unistd.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"
+#include "confdefs.h"
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "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=$?
+ egrep -v '^ *\+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null; then
+ if test -s conftest.err; then
+ ac_cpp_err=$ac_c_preproc_warn_flag
+ else
+ ac_cpp_err=
+ fi
+else
+ ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ 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;};;
+ 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;};;
+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
+
+
+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"
+#include "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;
+#ifdef F77_DUMMY_MAIN
+# ifdef __cplusplus
+ extern "C"
+# endif
+ int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX -qlanglvl=ansi
+# Ultrix and OSF/1 -std1
+# HP-UX 10.20 and later -Ae
+# HP-UX older versions -Aa -D_HPUX_SOURCE
+# SVR4 -Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
+
+fi
+
+case "x$ac_cv_prog_cc_stdc" in
+ x|xno)
+ echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+ *)
+ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+ CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
+echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
+if test "${ac_cv_c_const+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+#ifdef F77_DUMMY_MAIN
+# ifdef __cplusplus
+ extern "C"
+# endif
+ int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+/* FIXME: Include the comments suggested by Paul. */
+#ifndef __cplusplus
+ /* Ultrix mips cc rejects this. */
+ typedef int charset[2];
+ const charset x;
+ /* SunOS 4.1.1 cc rejects this. */
+ char const *const *ccp;
+ char **p;
+ /* NEC SVR4.0.2 mips cc rejects this. */
+ struct point {int x, y;};
+ static struct point const zero = {0,0};
+ /* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in
+ an arm of an if-expression whose if-part is not a constant
+ expression */
+ const char *g = "string";
+ ccp = &g + (g ? g-g : 0);
+ /* HPUX 7.0 cc rejects these. */
+ ++ccp;
+ p = (char**) ccp;
+ ccp = (char const *const *) p;
+ { /* SCO 3.2v4 cc rejects this. */
+ char *t;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+ }
+ { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+ }
+ { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+ }
+ { /* AIX XL C 1.02.0.0 rejects this saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; };
+ struct s *b; b->j = 5;
+ }
+ { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+ }
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_c_const=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_c_const=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
+echo "${ECHO_T}$ac_cv_c_const" >&6
+if test $ac_cv_c_const = no; then
+
+cat >>confdefs.h <<\_ACEOF
+#define const
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
+echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6
+if test "${ac_cv_header_time+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+
+#ifdef F77_DUMMY_MAIN
+# ifdef __cplusplus
+ extern "C"
+# endif
+ int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+if ((struct tm *) 0)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_header_time=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_header_time=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
+echo "${ECHO_T}$ac_cv_header_time" >&6
+if test $ac_cv_header_time = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define TIME_WITH_SYS_TIME 1
+_ACEOF
+
+fi
+
+
+echo "$as_me:$LINENO: checking return type of signal handlers" >&5
+echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6
+if test "${ac_cv_type_signal+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <signal.h>
+#ifdef signal
+# undef signal
+#endif
+#ifdef __cplusplus
+extern "C" void (*signal (int, void (*)(int)))(int);
+#else
+void (*signal ()) ();
+#endif
+
+#ifdef F77_DUMMY_MAIN
+# ifdef __cplusplus
+ extern "C"
+# endif
+ int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+int i;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_type_signal=void
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_type_signal=int
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5
+echo "${ECHO_T}$ac_cv_type_signal" >&6
+
+cat >>confdefs.h <<_ACEOF
+#define RETSIGTYPE $ac_cv_type_signal
+_ACEOF
+
+
+
+for ac_func in vprintf
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
+char (*f) ();
+
+#ifdef F77_DUMMY_MAIN
+# ifdef __cplusplus
+ extern "C"
+# endif
+ int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+f = $ac_func;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+echo "$as_me:$LINENO: checking for _doprnt" >&5
+echo $ECHO_N "checking for _doprnt... $ECHO_C" >&6
+if test "${ac_cv_func__doprnt+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char _doprnt (); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char _doprnt ();
+char (*f) ();
+
+#ifdef F77_DUMMY_MAIN
+# ifdef __cplusplus
+ extern "C"
+# endif
+ int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub__doprnt) || defined (__stub____doprnt)
+choke me
+#else
+f = _doprnt;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_func__doprnt=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_func__doprnt=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func__doprnt" >&5
+echo "${ECHO_T}$ac_cv_func__doprnt" >&6
+if test $ac_cv_func__doprnt = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_DOPRNT 1
+_ACEOF
+
+fi
+
+fi
+done
+
+
+
+
+
+
+for ac_func in select socket strcspn strerror
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func ();
+char (*f) ();
+
+#ifdef F77_DUMMY_MAIN
+# ifdef __cplusplus
+ extern "C"
+# endif
+ int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+f = $ac_func;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
+echo "$as_me:$LINENO: checking for gethostbyname in -lnsl" >&5
+echo $ECHO_N "checking for gethostbyname in -lnsl... $ECHO_C" >&6
+if test "${ac_cv_lib_nsl_gethostbyname+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lnsl $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char gethostbyname ();
+#ifdef F77_DUMMY_MAIN
+# ifdef __cplusplus
+ extern "C"
+# endif
+ int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+gethostbyname ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_nsl_gethostbyname=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_nsl_gethostbyname=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_gethostbyname" >&5
+echo "${ECHO_T}$ac_cv_lib_nsl_gethostbyname" >&6
+if test $ac_cv_lib_nsl_gethostbyname = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBNSL 1
+_ACEOF
+
+ LIBS="-lnsl $LIBS"
+
+fi
+
+
+echo "$as_me:$LINENO: checking for connect in -lsocket" >&5
+echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6
+if test "${ac_cv_lib_socket_connect+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lsocket $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+/* Override any gcc2 internal prototype to avoid an error. */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char connect ();
+#ifdef F77_DUMMY_MAIN
+# ifdef __cplusplus
+ extern "C"
+# endif
+ int F77_DUMMY_MAIN() { return 1; }
+#endif
+int
+main ()
+{
+connect ();
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -s conftest$ac_exeext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_lib_socket_connect=yes
+else
+ echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_socket_connect=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_socket_connect" >&5
+echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6
+if test $ac_cv_lib_socket_connect = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBSOCKET 1
+_ACEOF
+
+ LIBS="-lsocket $LIBS"
+
+fi
+
+
+# Extract the first word of "chkconfig", so it can be a program name with args.
+set dummy chkconfig; 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_path_CHKCONFIG+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case $CHKCONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_CHKCONFIG="$CHKCONFIG" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH:/sbin:/usr/sbin:/usr/local/sbin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_CHKCONFIG="$as_dir/$ac_word$ac_exec_ext"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ ;;
+esac
+fi
+CHKCONFIG=$ac_cv_path_CHKCONFIG
+
+if test -n "$CHKCONFIG"; then
+ echo "$as_me:$LINENO: result: $CHKCONFIG" >&5
+echo "${ECHO_T}$CHKCONFIG" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+# Extract the first word of "sed", so it can be a program name with args.
+set dummy sed; 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_path_SED+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ case $SED in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_SED="$SED" # Let the user override the test with a path.
+ ;;
+ *)
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH:/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_path_SED="$as_dir/$ac_word$ac_exec_ext"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+
+ ;;
+esac
+fi
+SED=$ac_cv_path_SED
+
+if test -n "$SED"; then
+ echo "$as_me:$LINENO: result: $SED" >&5
+echo "${ECHO_T}$SED" >&6
+else
+ echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+ac_config_files="$ac_config_files 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 overriden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, don't put newlines in cache variables' values.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+{
+ (set) 2>&1 |
+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
+ *ac_space=\ *)
+ # `set' does not quote correctly, so add quotes (double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \).
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;;
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n \
+ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+ ;;
+ esac;
+} |
+ sed '
+ t clear
+ : clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ : end' >>confcache
+if cmp -s $cache_file confcache; then :; else
+ if test -w $cache_file; then
+ 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
+
+
+
+: ${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
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+ set -o posix
+fi
+
+# NLS nuisances.
+# Support unset when possible.
+if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
+fi
+
+(set +x; test -n "`(LANG=C; export LANG) 2>&1`") &&
+ { $as_unset LANG || test "${LANG+set}" != set; } ||
+ { LANG=C; export LANG; }
+(set +x; test -n "`(LC_ALL=C; export LC_ALL) 2>&1`") &&
+ { $as_unset LC_ALL || test "${LC_ALL+set}" != set; } ||
+ { LC_ALL=C; export LC_ALL; }
+(set +x; test -n "`(LC_TIME=C; export LC_TIME) 2>&1`") &&
+ { $as_unset LC_TIME || test "${LC_TIME+set}" != set; } ||
+ { LC_TIME=C; export LC_TIME; }
+(set +x; test -n "`(LC_CTYPE=C; export LC_CTYPE) 2>&1`") &&
+ { $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set; } ||
+ { LC_CTYPE=C; export LC_CTYPE; }
+(set +x; test -n "`(LANGUAGE=C; export LANGUAGE) 2>&1`") &&
+ { $as_unset LANGUAGE || test "${LANGUAGE+set}" != set; } ||
+ { LANGUAGE=C; export LANGUAGE; }
+(set +x; test -n "`(LC_COLLATE=C; export LC_COLLATE) 2>&1`") &&
+ { $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set; } ||
+ { LC_COLLATE=C; export LC_COLLATE; }
+(set +x; test -n "`(LC_NUMERIC=C; export LC_NUMERIC) 2>&1`") &&
+ { $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set; } ||
+ { LC_NUMERIC=C; export LC_NUMERIC; }
+(set +x; test -n "`(LC_MESSAGES=C; export LC_MESSAGES) 2>&1`") &&
+ { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } ||
+ { LC_MESSAGES=C; export LC_MESSAGES; }
+
+
+# Name of the executable.
+as_me=`(basename "$0") 2>/dev/null ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)$' \| \
+ . : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+ /^X\/\(\/\/\)$/{ s//\1/; q; }
+ /^X\/\(\/\).*/{ s//\1/; q; }
+ s/.*/./; q'`
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ echo "#! /bin/sh" >conftest.sh
+ echo "exit 0" >>conftest.sh
+ chmod +x conftest.sh
+ if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conftest.sh
+fi
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" || {
+ # Find who we are. Look in the path if we contain no path at all
+ # relative or not.
+ case $0 in
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
+
+ ;;
+ esac
+ # We did not find ourselves, most probably we were run as `sh COMMAND'
+ # in which case we are not to be found in the path.
+ if test "x$as_myself" = x; then
+ as_myself=$0
+ fi
+ if test ! -f "$as_myself"; then
+ { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ case $CONFIG_SHELL in
+ '')
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for as_base in sh bash ksh sh5; do
+ case $as_dir in
+ /*)
+ if ("$as_dir/$as_base" -c '
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then
+ CONFIG_SHELL=$as_dir/$as_base
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+ fi;;
+ esac
+ done
+done
+;;
+ esac
+
+ # 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
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" $as_nl"
+
+# CDPATH.
+$as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; }
+
+exec 6>&1
+
+# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling. Logging --version etc. is OK.
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+} >&5
+cat >&5 <<_CSEOF
+
+This file was extended by $as_me, which was
+generated by GNU Autoconf 2.53. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+_CSEOF
+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
+echo >&5
+_ACEOF
+
+# Files that config.status was made for.
+if test -n "$ac_config_files"; then
+ echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_headers"; then
+ echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+ echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+ echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number, then exit
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+
+Configuration files:
+$config_files
+
+Report bugs to <bug-autoconf@gnu.org>."
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+config.status
+configured by $0, generated by GNU Autoconf 2.53,
+ with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+srcdir=$srcdir
+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[^=]*=\(.*\)'`
+ shift
+ set dummy "$ac_option" "$ac_optarg" ${1+"$@"}
+ shift
+ ;;
+ -*);;
+ *) # This is not an option, so the user has probably given explicit
+ # arguments.
+ ac_need_defaults=false;;
+ esac
+
+ case $1 in
+ # Handling of the options.
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ echo "running $SHELL $0 " $ac_configure_args " --no-create --no-recursion"
+ exec $SHELL $0 $ac_configure_args --no-create --no-recursion ;;
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+ --version | --vers* | -V )
+ echo "$ac_cs_version"; exit 0 ;;
+ --he | --h)
+ # Conflict between --help and --header
+ { { echo "$as_me:$LINENO: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2;}
+ { (exit 1); exit 1; }; };;
+ --help | --hel | -h )
+ echo "$ac_cs_usage"; exit 0 ;;
+ --debug | --d* | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ shift
+ CONFIG_FILES="$CONFIG_FILES $1"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ shift
+ CONFIG_HEADERS="$CONFIG_HEADERS $1"
+ ac_need_defaults=false;;
+
+ # This is an error.
+ -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2;}
+ { (exit 1); exit 1; }; } ;;
+
+ *) ac_config_targets="$ac_config_targets $1" ;;
+
+ esac
+ shift
+done
+
+_ACEOF
+
+
+
+
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_config_target in $ac_config_targets
+do
+ case "$ac_config_target" in
+ # Handling of arguments.
+ "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ *) { { 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
+fi
+
+# Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+ trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+ trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+: ${TMPDIR=/tmp}
+{
+ tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` &&
+ test -n "$tmp" && test -d "$tmp"
+} ||
+{
+ tmp=$TMPDIR/cs$$-$RANDOM
+ (umask 077 && mkdir $tmp)
+} ||
+{
+ echo "$me: cannot create a temporary directory in $TMPDIR" >&2
+ { (exit 1); exit 1; }
+}
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+
+#
+# CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "\$CONFIG_FILES"; then
+ # Protect against being on the right side of a sed subst in config.status.
+ sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
+ s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
+s,@SHELL@,$SHELL,;t t
+s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s,@exec_prefix@,$exec_prefix,;t t
+s,@prefix@,$prefix,;t t
+s,@program_transform_name@,$program_transform_name,;t t
+s,@bindir@,$bindir,;t t
+s,@sbindir@,$sbindir,;t t
+s,@libexecdir@,$libexecdir,;t t
+s,@datadir@,$datadir,;t t
+s,@sysconfdir@,$sysconfdir,;t t
+s,@sharedstatedir@,$sharedstatedir,;t t
+s,@localstatedir@,$localstatedir,;t t
+s,@libdir@,$libdir,;t t
+s,@includedir@,$includedir,;t t
+s,@oldincludedir@,$oldincludedir,;t t
+s,@infodir@,$infodir,;t t
+s,@mandir@,$mandir,;t t
+s,@build_alias@,$build_alias,;t t
+s,@host_alias@,$host_alias,;t t
+s,@target_alias@,$target_alias,;t t
+s,@DEFS@,$DEFS,;t t
+s,@ECHO_C@,$ECHO_C,;t t
+s,@ECHO_N@,$ECHO_N,;t t
+s,@ECHO_T@,$ECHO_T,;t t
+s,@LIBS@,$LIBS,;t t
+s,@CC@,$CC,;t t
+s,@CFLAGS@,$CFLAGS,;t t
+s,@LDFLAGS@,$LDFLAGS,;t t
+s,@CPPFLAGS@,$CPPFLAGS,;t t
+s,@ac_ct_CC@,$ac_ct_CC,;t t
+s,@EXEEXT@,$EXEEXT,;t t
+s,@OBJEXT@,$OBJEXT,;t t
+s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
+s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
+s,@INSTALL_DATA@,$INSTALL_DATA,;t t
+s,@CPP@,$CPP,;t t
+s,@CHKCONFIG@,$CHKCONFIG,;t t
+s,@SED@,$SED,;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'`
+ { case "$ac_dir" in
+ [\\/]* | ?:[\\/]* ) as_incr_dir=;;
+ *) as_incr_dir=.;;
+esac
+as_dummy="$ac_dir"
+for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do
+ case $as_mkdir_dir in
+ # Skip DOS drivespec
+ ?:) as_incr_dir=$as_mkdir_dir ;;
+ *)
+ as_incr_dir=$as_incr_dir/$as_mkdir_dir
+ test -d "$as_incr_dir" ||
+ mkdir "$as_incr_dir" ||
+ { { echo "$as_me:$LINENO: error: cannot create \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create \"$ac_dir\"" >&2;}
+ { (exit 1); exit 1; }; }
+ ;;
+ esac
+done; }
+
+ 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,@configure_input@,$configure_input,;t t
+s,@srcdir@,$ac_srcdir,;t t
+s,@abs_srcdir@,$ac_abs_srcdir,;t t
+s,@top_srcdir@,$ac_top_srcdir,;t t
+s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t
+s,@builddir@,$ac_builddir,;t t
+s,@abs_builddir@,$ac_abs_builddir,;t t
+s,@top_builddir@,$ac_top_builddir,;t t
+s,@abs_top_builddir@,$ac_abs_top_builddir,;t t
+s,@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
+
+{ (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=:
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || { (exit 1); exit 1; }
+fi
+
diff --git a/release/src/router/bpalogin/configure.in b/release/src/router/bpalogin/configure.in
new file mode 100644
index 00000000..d2d42da8
--- /dev/null
+++ b/release/src/router/bpalogin/configure.in
@@ -0,0 +1,27 @@
+dnl Process this file with autoconf to produce a configure script.
+AC_INIT(bpalogin.c)
+
+dnl Checks for programs.
+AC_PROG_CC
+AC_PROG_INSTALL
+
+dnl Checks for libraries.
+
+dnl Checks for header files.
+AC_HEADER_STDC
+AC_CHECK_HEADERS(sys/time.h syslog.h unistd.h)
+
+dnl Checks for typedefs, structures, and compiler characteristics.
+AC_C_CONST
+AC_HEADER_TIME
+
+dnl Checks for library functions.
+AC_TYPE_SIGNAL
+AC_FUNC_VPRINTF
+AC_CHECK_FUNCS(select socket strcspn strerror)
+AC_CHECK_LIB(nsl, gethostbyname)
+AC_CHECK_LIB(socket, connect)
+
+AC_PATH_PROG(CHKCONFIG, chkconfig, , $PATH:/sbin:/usr/sbin:/usr/local/sbin)
+AC_PATH_PROG(SED, sed, , $PATH:/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin)
+AC_OUTPUT(Makefile)
diff --git a/release/src/router/bpalogin/gen_md5.c b/release/src/router/bpalogin/gen_md5.c
new file mode 100644
index 00000000..418771fb
--- /dev/null
+++ b/release/src/router/bpalogin/gen_md5.c
@@ -0,0 +1,352 @@
+
+/*
+ * COMPILE WITH:
+ * gcc -Wall gen_md5.c -o gen_md5
+ */
+
+
+/* taken from RFC-1321/Appendix A.3 */
+
+/*
+ * MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
+ */
+
+/*
+ * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All rights
+ * reserved.
+ *
+ * License to copy and use this software is granted provided that it is
+ * identified as the "RSA Data Security, Inc. MD5 Message-Digest Algorithm"
+ * in all material mentioning or referencing this software or this function.
+ *
+ * License is also granted to make and use derivative works provided that such
+ * works are identified as "derived from the RSA Data Security, Inc. MD5
+ * Message-Digest Algorithm" in all material mentioning or referencing the
+ * derived work.
+ *
+ * RSA Data Security, Inc. makes no representations concerning either the
+ * merchantability of this software or the suitability of this software for
+ * any particular purpose. It is provided "as is" without express or implied
+ * warranty of any kind.
+ *
+ * These notices must be retained in any copies of any part of this
+ * documentation and/or software.
+ */
+
+#include <stdio.h>
+
+#include "md5.h"
+
+/*
+ * Constants for MD5Transform routine.
+ */
+#define S11 7
+#define S12 12
+#define S13 17
+#define S14 22
+#define S21 5
+#define S22 9
+#define S23 14
+#define S24 20
+#define S31 4
+#define S32 11
+#define S33 16
+#define S34 23
+#define S41 6
+#define S42 10
+#define S43 15
+#define S44 21
+
+static void MD5Transform(unsigned int[4], unsigned char[64]);
+static void Encode(unsigned char *, unsigned int*, unsigned int);
+static void Decode(unsigned int*, unsigned char *, unsigned int);
+static void MD5_memcpy(unsigned char *, unsigned char *, unsigned int);
+static void MD5_memset(char *, int, unsigned int);
+
+static unsigned char PADDING[64] =
+{
+ 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+/*
+ * F, G, H and I are basic MD5 functions.
+ */
+/* #define F(x, y, z) (((x) & (y)) | ((~x) & (z))) */
+#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
+#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
+#define H(x, y, z) ((x) ^ (y) ^ (z))
+#define I(x, y, z) ((y) ^ ((x) | (~z)))
+
+/*
+ * ROTATE_LEFT rotates x left n bits.
+ */
+#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
+
+/*
+ * FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. Rotation is
+ * separate from addition to prevent recomputation.
+ */
+#define FF(a, b, c, d, x, s, ac) { (a) += F ((b), (c), (d)) + (x) + (unsigned int)(ac); (a) = ROTATE_LEFT ((a), (s)); (a) += (b); }
+#define GG(a, b, c, d, x, s, ac) { (a) += G ((b), (c), (d)) + (x) + (unsigned int)(ac); (a) = ROTATE_LEFT ((a), (s)); (a) += (b); }
+#define HH(a, b, c, d, x, s, ac) { (a) += H ((b), (c), (d)) + (x) + (unsigned int)(ac); (a) = ROTATE_LEFT ((a), (s)); (a) += (b); }
+#define II(a, b, c, d, x, s, ac) { (a) += I ((b), (c), (d)) + (x) + (unsigned int)(ac); (a) = ROTATE_LEFT ((a), (s)); (a) += (b); }
+
+/*
+ * MD5 initialization. Begins an MD5 operation, writing a new context.
+ */
+void
+MD5Init(MD5_CTX * context)
+{
+ context->count[0] = context->count[1] = 0;
+ /*
+ * Load magic initialization constants.
+ */
+ context->state[0] = 0x67452301;
+ context->state[1] = 0xefcdab89;
+ context->state[2] = 0x98badcfe;
+ context->state[3] = 0x10325476;
+}
+
+/*
+ * MD5 block update operation. Continues an MD5 message-digest operation,
+ * processing another message block, and updating the context.
+ */
+void
+MD5Update(MD5_CTX * context, unsigned char *input, unsigned int inputLen)
+{
+ unsigned int i, index, partLen;
+
+ /* Compute number of bytes mod 64 */
+ index = (unsigned int) ((context->count[0] >> 3) & 0x3F);
+
+ /* Update number of bits */
+ if ((context->count[0] += ((unsigned int) inputLen << 3))
+ < ((unsigned int) inputLen << 3))
+ context->count[1]++;
+ context->count[1] += ((unsigned int) inputLen >> 29);
+
+ partLen = 64 - index;
+
+ /*
+ * Transform as many times as possible.
+ */
+ if (inputLen >= partLen) {
+ MD5_memcpy(&context->buffer[index], input, partLen);
+ MD5Transform(context->state, context->buffer);
+
+ for (i = partLen; i + 63 < inputLen; i += 64)
+ MD5Transform(context->state, &input[i]);
+
+ index = 0;
+ } else
+ i = 0;
+
+ /* Buffer remaining input */
+ MD5_memcpy(&context->buffer[index], &input[i], inputLen - i);
+}
+
+/*
+ * MD5 finalization. Ends an MD5 message-digest operation, writing the the
+ * message digest and zeroizing the context.
+ */
+void
+MD5Final(unsigned char digest[16], MD5_CTX * context)
+{
+ unsigned char bits[8];
+ unsigned int index, padLen;
+
+ /* Save number of bits */
+ Encode(bits, context->count, 8);
+
+ /*
+ * Pad out to 56 mod 64.
+ */
+ index = (unsigned int) ((context->count[0] >> 3) & 0x3f);
+ padLen = (index < 56) ? (56 - index) : (120 - index);
+ MD5Update(context, PADDING, padLen);
+
+ /* Append length (before padding) */
+ MD5Update(context, bits, 8);
+ /* Store state in digest */
+ Encode(digest, context->state, 16);
+
+ /*
+ * Zeroize sensitive information.
+ */
+ MD5_memset((char *) context, 0, sizeof(*context));
+}
+
+/*
+ * MD5 basic transformation. Transforms state based on block.
+ */
+static void
+MD5Transform(unsigned int state[4], unsigned char block[64])
+{
+ unsigned int a = state[0], b = state[1], c = state[2], d = state[3], x[16];
+
+ Decode(x, block, 64);
+
+ /* Round 1 */
+ FF(a, b, c, d, x[0], S11, 0xd76aa478); /* 1 */
+ FF(d, a, b, c, x[1], S12, 0xe8c7b756); /* 2 */
+ FF(c, d, a, b, x[2], S13, 0x242070db); /* 3 */
+ FF(b, c, d, a, x[3], S14, 0xc1bdceee); /* 4 */
+ FF(a, b, c, d, x[4], S11, 0xf57c0faf); /* 5 */
+ FF(d, a, b, c, x[5], S12, 0x4787c62a); /* 6 */
+ FF(c, d, a, b, x[6], S13, 0xa8304613); /* 7 */
+ FF(b, c, d, a, x[7], S14, 0xfd469501); /* 8 */
+ FF(a, b, c, d, x[8], S11, 0x698098d8); /* 9 */
+ FF(d, a, b, c, x[9], S12, 0x8b44f7af); /* 10 */
+ FF(c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */
+ FF(b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */
+ FF(a, b, c, d, x[12], S11, 0x6b901122); /* 13 */
+ FF(d, a, b, c, x[13], S12, 0xfd987193); /* 14 */
+ FF(c, d, a, b, x[14], S13, 0xa679438e); /* 15 */
+ FF(b, c, d, a, x[15], S14, 0x49b40821); /* 16 */
+
+ /* Round 2 */
+ GG(a, b, c, d, x[1], S21, 0xf61e2562); /* 17 */
+ GG(d, a, b, c, x[6], S22, 0xc040b340); /* 18 */
+ GG(c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */
+ GG(b, c, d, a, x[0], S24, 0xe9b6c7aa); /* 20 */
+ GG(a, b, c, d, x[5], S21, 0xd62f105d); /* 21 */
+ GG(d, a, b, c, x[10], S22, 0x2441453); /* 22 */
+ GG(c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */
+ GG(b, c, d, a, x[4], S24, 0xe7d3fbc8); /* 24 */
+ GG(a, b, c, d, x[9], S21, 0x21e1cde6); /* 25 */
+ GG(d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */
+ GG(c, d, a, b, x[3], S23, 0xf4d50d87); /* 27 */
+ GG(b, c, d, a, x[8], S24, 0x455a14ed); /* 28 */
+ GG(a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */
+ GG(d, a, b, c, x[2], S22, 0xfcefa3f8); /* 30 */
+ GG(c, d, a, b, x[7], S23, 0x676f02d9); /* 31 */
+ GG(b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */
+
+ /* Round 3 */
+ HH(a, b, c, d, x[5], S31, 0xfffa3942); /* 33 */
+ HH(d, a, b, c, x[8], S32, 0x8771f681); /* 34 */
+ HH(c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */
+ HH(b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */
+ HH(a, b, c, d, x[1], S31, 0xa4beea44); /* 37 */
+ HH(d, a, b, c, x[4], S32, 0x4bdecfa9); /* 38 */
+ HH(c, d, a, b, x[7], S33, 0xf6bb4b60); /* 39 */
+ HH(b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */
+ HH(a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */
+ HH(d, a, b, c, x[0], S32, 0xeaa127fa); /* 42 */
+ HH(c, d, a, b, x[3], S33, 0xd4ef3085); /* 43 */
+ HH(b, c, d, a, x[6], S34, 0x4881d05); /* 44 */
+ HH(a, b, c, d, x[9], S31, 0xd9d4d039); /* 45 */
+ HH(d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */
+ HH(c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */
+ HH(b, c, d, a, x[2], S34, 0xc4ac5665); /* 48 */
+
+ /* Round 4 */
+ II(a, b, c, d, x[0], S41, 0xf4292244); /* 49 */
+ II(d, a, b, c, x[7], S42, 0x432aff97); /* 50 */
+ II(c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */
+ II(b, c, d, a, x[5], S44, 0xfc93a039); /* 52 */
+ II(a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */
+ II(d, a, b, c, x[3], S42, 0x8f0ccc92); /* 54 */
+ II(c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */
+ II(b, c, d, a, x[1], S44, 0x85845dd1); /* 56 */
+ II(a, b, c, d, x[8], S41, 0x6fa87e4f); /* 57 */
+ II(d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */
+ II(c, d, a, b, x[6], S43, 0xa3014314); /* 59 */
+ II(b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */
+ II(a, b, c, d, x[4], S41, 0xf7537e82); /* 61 */
+ II(d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */
+ II(c, d, a, b, x[2], S43, 0x2ad7d2bb); /* 63 */
+ II(b, c, d, a, x[9], S44, 0xeb86d391); /* 64 */
+
+ state[0] += a;
+ state[1] += b;
+ state[2] += c;
+ state[3] += d;
+
+ /*
+ * Zeroize sensitive information.
+ */
+ MD5_memset((char *) x, 0, sizeof(x));
+}
+
+/*
+ * Encodes input (unsigned int) into output (unsigned char). Assumes len is a
+ * multiple of 4.
+ */
+static void
+Encode(unsigned char *output, unsigned int * input, unsigned int len)
+{
+ unsigned int i, j;
+
+ for (i = 0, j = 0; j < len; i++, j += 4) {
+ output[j] = (unsigned char) (input[i] & 0xff);
+ output[j + 1] = (unsigned char) ((input[i] >> 8) & 0xff);
+ output[j + 2] = (unsigned char) ((input[i] >> 16) & 0xff);
+ output[j + 3] = (unsigned char) ((input[i] >> 24) & 0xff);
+ }
+}
+
+/*
+ * Decodes input (unsigned char) into output (unsigned int). Assumes len is a
+ * multiple of 4.
+ */
+static void
+Decode(unsigned int * output, unsigned char *input, unsigned int len)
+{
+ unsigned int i, j;
+
+ for (i = 0, j = 0; j < len; i++, j += 4)
+ output[i] = ((unsigned int) input[j]) | (((unsigned int) input[j + 1]) << 8) |
+ (((unsigned int) input[j + 2]) << 16) | (((unsigned int) input[j + 3]) << 24);
+}
+
+/*
+ * Note: Replace "for loop" with standard memcpy if possible.
+ */
+
+static void
+MD5_memcpy(unsigned char *output, unsigned char *input, unsigned int len)
+{
+ unsigned int i;
+ for (i = 0; i < len; i++)
+ output[i] = input[i];
+}
+
+/*
+ * Note: Replace "for loop" with standard memset if possible.
+ */
+static void
+MD5_memset(char *output, int value, unsigned int len)
+{
+ unsigned int i;
+ for (i = 0; i < len; i++)
+ output[i] = (char) value;
+}
+
+/*
+static void
+MDString(char *string, size_t len)
+{
+ MD5_CTX context;
+ unsigned char digest[16];
+ MD5Init(&context);
+ MD5Update(&context, string, len);
+ MD5Final(digest, &context);
+ printf("%s\t", string);
+ MDPrint(digest);
+ printf("\n");
+}
+*/
+/*
+static void
+MDPrint(unsigned char digest[16])
+{
+ unsigned int i;
+ for (i = 0; i < 16; i++)
+ / printf("%02x", digest[i]); *
+ printf("%c", digest[i]);
+}
+*/
+
diff --git a/release/src/router/bpalogin/get_time.c b/release/src/router/bpalogin/get_time.c
new file mode 100644
index 00000000..62cbbbc9
--- /dev/null
+++ b/release/src/router/bpalogin/get_time.c
@@ -0,0 +1,20 @@
+#include <stdio.h>
+#include <sys/sysinfo.h>
+#include <time.h>
+
+#define USE_UPTIME 1
+
+// When system time change, the lease table will error, so we use system uptime
+time_t // long int
+get_time(time_t *t){
+#ifdef USE_UPTIME
+ struct sysinfo info;
+
+ sysinfo(&info);
+
+ return info.uptime;
+#else
+ return time(0);
+#endif
+}
+
diff --git a/release/src/router/bpalogin/get_time.h b/release/src/router/bpalogin/get_time.h
new file mode 100644
index 00000000..16463635
--- /dev/null
+++ b/release/src/router/bpalogin/get_time.h
@@ -0,0 +1 @@
+time_t get_time(time_t *t);
diff --git a/release/src/router/bpalogin/install-sh b/release/src/router/bpalogin/install-sh
new file mode 100755
index 00000000..e9de2384
--- /dev/null
+++ b/release/src/router/bpalogin/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/release/src/router/bpalogin/md5.h b/release/src/router/bpalogin/md5.h
new file mode 100644
index 00000000..2e952947
--- /dev/null
+++ b/release/src/router/bpalogin/md5.h
@@ -0,0 +1,12 @@
+/* MD5 context. */
+typedef struct {
+ unsigned int state[4]; /* state (ABCD) */
+ unsigned int count[2]; /* number of bits, modulo 2^64 (lsb first) */
+ unsigned char buffer[64]; /* input buffer */
+} MD5_CTX;
+
+void MD5Init(MD5_CTX *);
+void MD5Update(MD5_CTX *, unsigned char *, unsigned int);
+void MD5Final(unsigned char[16], MD5_CTX *);
+
+#define MD5_DIGEST_CHARS 16
diff --git a/release/src/router/bpalogin/protocol.c b/release/src/router/bpalogin/protocol.c
new file mode 100644
index 00000000..eb51f025
--- /dev/null
+++ b/release/src/router/bpalogin/protocol.c
@@ -0,0 +1,733 @@
+/*
+** BPALogin - lightweight portable BIDS2 login client
+** Copyright (c) 2001-3 Shane Hyde, and others.
+**
+** 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+**
+*/
+
+#include "bpalogin.h"
+#include "md5.h"
+
+
+void genmd5(char *p,int len,char *digest)
+{
+ MD5_CTX context;
+ MD5Init(&context);
+ MD5Update(&context, p, len);
+ MD5Final(digest, &context);
+}
+
+/*
+** This functions makes the MD5 based data packet which is used to login,
+** logout and handle heartbeats
+*/
+void makecredentials(char * credentials,struct session *s,INT2 msg,INT4 extra)
+{
+ INT2 j = htons(msg);
+ int i=0;
+ char buffer[150];
+ INT4 ts = htonl(extra);
+
+ memcpy(buffer,s->nonce,16);
+ i += 16;
+ memcpy(buffer+i,s->password,strlen(s->password));
+ i += strlen(s->password);
+ memcpy(buffer+i,&(ts),sizeof(INT4));
+ i += sizeof(INT4);
+ memcpy(buffer+i,&j,sizeof(INT2));
+ i += sizeof(INT2);
+
+ genmd5(buffer,i,credentials);
+}
+
+/*
+** Login to the Authentication server
+**
+** Returns - 0 - failed to login for some reason.
+** 1 - Logged in successfully
+*/
+int login(struct session * s)
+{
+ int err;
+ char credentials[16];
+ time_t logintime;
+
+ int authsocket;
+ struct transaction t;
+ INT2 transactiontype;
+ int addrsize;
+
+ s->debug(0,"login(): init");
+
+ s->localaddr.sin_port = htons(0);
+
+//=================================================================================================================
+#if 0
+ syslog(LOG_DEBUG, "1=========================================T_MSG_LOGIN_REQ sending..."); //by tallest debug 0210
+ struct transaction ttt;
+ char datattt[]={0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,0x10
+ ,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2c,0x2d,0x2e,0x2f,0x20
+ ,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,0x30
+ ,0x41,0x42,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0x40
+ ,0x51,0x52,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5a,0x5b,0x5c,0x5d,0x5e,0x5f,0x50
+ ,0x61,0x62,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,0x60
+ ,0x71,0x72,0x73,0x74};
+ ttt.length = 100;
+ memcpy(ttt.data, datattt, 100);
+
+ dump_transaction(s,&ttt);
+ s->debug(3, "2=========================================T_MSG_LOGIN_REQ sending..."); //by tallest debug 0210
+#endif
+//================================================================================================================
+ authsocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+ err = bind(authsocket,(struct sockaddr *)&s->localaddr,sizeof(struct sockaddr_in));
+ if(err)
+ {
+ socketerror(s,"Error binding auth socket");
+ closesocket(authsocket);
+ return 0;
+ }
+
+ err = connect(authsocket,(struct sockaddr *)&s->authhost,sizeof(struct sockaddr_in));
+
+ if(err)
+ {
+ socketerror(s,"Cant connect to auth server");
+ closesocket(authsocket);
+ return 0;
+ }
+ addrsize = sizeof(struct sockaddr_in);
+ err = getsockname(authsocket,(struct sockaddr *)&s->localipaddress,&addrsize);
+
+ /*
+ ** start the negotiation
+ */
+ start_transaction(&t,T_MSG_PROTOCOL_NEG_REQ,s->sessionid);
+ add_field_INT2(s,&t,T_PARAM_CLIENT_VERSION,LOGIN_VERSION * 100);
+ add_field_string(s,&t,T_PARAM_OS_IDENTITY,s->osname);
+ add_field_string(s,&t,T_PARAM_OS_VERSION,s->osrelease);
+ add_field_INT2(s,&t,T_PARAM_PROTOCOL_LIST,T_PROTOCOL_CHAL);
+
+ s->debug(0,"tallest: T_MSG_PROTOCOL_NEG_REQ sending... "); //by tallest debug 0210
+ send_transaction(s,authsocket,&t);
+
+ transactiontype = receive_transaction(s,authsocket,&t);
+ if(transactiontype != T_MSG_PROTOCOL_NEG_RESP)
+ {
+ s->debug(0,"T_MSG_PROTOCOL_NEG_RESP - error transaction type (%d)",transactiontype);
+ return 0;
+ }
+
+ extract_valueINT2(s,&t,T_PARAM_STATUS_CODE,&s->retcode);
+ extract_valuestring(s,&t,T_PARAM_LOGIN_SERVER_HOST,s->loginserverhost);
+ extract_valueINT2(s,&t,T_PARAM_PROTOCOL_SELECT,&s->protocol);
+
+ if(s->protocol != T_PROTOCOL_CHAL)
+ {
+ s->debug(0,"T_MSG_PROTOCOL_NEG_RESP - Unsupported protocol (%d)",s->protocol);
+ return 0;
+ }
+
+ s->debug(0,"login(): retcode1 = [%d]\n", s->retcode);
+
+ switch(s->retcode)
+ {
+ case T_STATUS_SUCCESS:
+ case T_STATUS_LOGIN_SUCCESS_SWVER:
+ break;
+ case T_STATUS_LOGIN_FAIL_SWVER:
+ {
+ s->debug(0,"T_MSG_PROTOCOL_NEG_RESP - Login failure: software version");
+ return 0;
+ }
+ case T_STATUS_LOGIN_FAIL_INV_PROT:
+ {
+ s->debug(0,"T_MSG_PROTOCOL_NEG_RESP - Login failure: invalid protocol");
+ return 0;
+ }
+ case T_STATUS_LOGIN_UNKNOWN:
+ {
+ s->debug(0,"T_MSG_PROTOCOL_NEG_RESP - Login failure: unknown");
+ return 0;
+ }
+ }
+
+ closesocket(authsocket);
+
+ authsocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+ err = bind(authsocket,(struct sockaddr *)&s->localaddr,sizeof(struct sockaddr_in));
+ if(err)
+ {
+ socketerror(s,"Error binding auth socket 2");
+ closesocket(authsocket);
+ return 0;
+ }
+ err = connect(authsocket,(struct sockaddr *)&s->authhost,sizeof(struct sockaddr_in));
+ if(err)
+ {
+ socketerror(s,"Error connecting auth socket 2");
+ closesocket(authsocket);
+ return 0;
+ }
+
+ start_transaction(&t,T_MSG_LOGIN_REQ,s->sessionid);
+ add_field_string(s,&t,T_PARAM_USERNAME,s->username);
+ add_field_INT2(s,&t,T_PARAM_CLIENT_VERSION,LOGIN_VERSION * 100);
+ add_field_string(s,&t,T_PARAM_OS_IDENTITY,s->osname);
+ add_field_string(s,&t,T_PARAM_OS_VERSION,s->osrelease);
+ add_field_INT2(s,&t,T_PARAM_REASON_CODE,T_LOGIN_REASON_CODE_NORMAL);
+ add_field_INT2(s,&t,T_PARAM_REQ_PORT,s->listenport);
+
+ s->debug(0,"tallest: T_MSG_LOGIN_REQ sending... "); //by tallest debug 0210
+ send_transaction(s,authsocket,&t);
+
+ transactiontype = receive_transaction(s,authsocket,&t);
+ if(transactiontype == T_MSG_LOGIN_RESP)
+ goto skippo;
+
+ if(transactiontype != T_MSG_AUTH_RESP)
+ {
+ s->debug(0,"T_MSG_AUTH_RESP - error transaction type (%d)",transactiontype);
+ return 0;
+ }
+
+ if(!extract_valueINT2(s,&t,T_PARAM_HASH_METHOD,&s->hashmethod))
+ {
+ s->debug(0,"T_MSG_AUTH_RESP - no hashmethod provided");
+ return 0;
+ }
+ if(!extract_valuestring(s,&t,T_PARAM_NONCE,s->nonce))
+ {
+ s->debug(0,"T_MSG_AUTH_RESP - no nonce supplied");
+ return 0;
+ }
+
+ if(s->hashmethod == T_AUTH_MD5_HASH)
+ {
+ genmd5(s->password,strlen(s->password),s->password);
+ }
+
+ start_transaction(&t,T_MSG_LOGIN_AUTH_REQ,s->sessionid);
+
+ //s->timestamp = time(NULL);
+ s->timestamp = get_time(NULL);
+ makecredentials(credentials,s,T_MSG_LOGIN_AUTH_REQ,s->timestamp);
+
+ add_field_data(s,&t,T_PARAM_AUTH_CREDENTIALS,credentials,16);
+ add_field_INT4(s,&t,T_PARAM_TIMESTAMP,s->timestamp);
+
+ s->debug(0,"tallest: T_MSG_LOGIN_AUTH_REQ sending... "); //by tallest debug 0210
+ send_transaction(s,authsocket,&t);
+
+ transactiontype = receive_transaction(s,authsocket,&t);
+skippo:
+ if(transactiontype != T_MSG_LOGIN_RESP)
+ {
+ s->debug(0,"T_MSG_LOGIN_RESP - error transaction type (%d)",transactiontype);
+ return 0;
+ }
+
+ extract_valueINT2(s,&t,T_PARAM_STATUS_CODE,&s->retcode);
+ s->debug(0,"login(): retcode2 = [%d]\n", s->retcode);
+ switch(s->retcode)
+ {
+ case T_STATUS_SUCCESS:
+ case T_STATUS_LOGIN_SUCCESSFUL_SWVER:
+ case T_STATUS_LOGIN_SUCCESSFUL_ALREADY_LOGGED_IN:
+ break;
+ case T_STATUS_USERNAME_NOT_FOUND:
+ {
+ s->debug(0,"T_MSG_LOGIN_RESP - Login failure: username not known");
+ log_to_file("AUTH_FAIL");
+ return 0;
+ }
+ case T_STATUS_INCORRECT_PASSWORD:
+ {
+ s->debug(0,"T_MSG_LOGIN_RESP - Login failure: incorrect password");
+ log_to_file("AUTH_FAIL");
+ return 0;
+ }
+ case T_STATUS_ACCOUNT_DISABLED:
+ {
+ s->debug(0,"T_MSG_LOGIN_RESP - Login failure: Account disabled");
+ log_to_file("AUTH_FAIL");
+ return 0;
+ }
+ case T_STATUS_LOGIN_RETRY_LIMIT:
+ case T_STATUS_USER_DISABLED:
+ case T_STATUS_FAIL_USERNAME_VALIDATE:
+ case T_STATUS_FAIL_PASSWORD_VALIDATE:
+ case T_STATUS_LOGIN_UNKNOWN:
+ {
+ s->debug(0,"T_MSG_LOGIN_RESP - Login failure: other error");
+ log_to_file("AUTH_FAIL");
+ return 0;
+ }
+ }
+
+ extract_valueINT2(s,&t,T_PARAM_LOGOUT_SERVICE_PORT,&s->logoutport);
+ extract_valueINT2(s,&t,T_PARAM_STATUS_SERVICE_PORT,&s->statusport);
+ extract_valuestring(s,&t,T_PARAM_TSMLIST,s->tsmlist);
+ extract_valuestring(s,&t,T_PARAM_RESPONSE_TEXT,s->resptext);
+ {
+ int i,n;
+ char * p = s->tsmlist;
+ char t[200];
+ char *tp = t;
+ s->tsmcount = 0;
+
+ while((n = strcspn(p," ,"))!=0)
+ {
+ strncpy(t,p,n);
+ t[n] = 0;
+ p += n +1;
+ strcpy(s->tsmlist_s[s->tsmcount],t);
+ strcat(s->tsmlist_s[s->tsmcount],s->authdomain);
+ s->tsmcount++;
+ }
+ for(i=0;i<s->tsmcount;i++)
+ {
+ struct hostent * he;
+
+ he = gethostbyname(s->tsmlist_s[i]);
+ if(he)
+ {
+ s->tsmlist_in[i].sin_addr.s_addr = *((int*)(he->h_addr_list[0]));
+ }
+ else
+ {
+ //s->tsmlist_in[i].sin_addr.s_addr = inet_addr(s->tsmlist_s[i]);
+ s->tsmlist_in[i].sin_addr.s_addr = inet_addr(s->authserver);
+ }
+ s->debug(1,"Will accept heartbeats from %s = %s\n",s->tsmlist_s[i],inet_ntoa(s->tsmlist_in[i].sin_addr));
+ }
+ }
+ logintime = get_time(NULL);
+
+ s->debug(0,"Logged on as %s - successful at %d\n",s->username, logintime);
+ s->sequence = 0;
+ //s->lastheartbeat = time(NULL);
+ s->lastheartbeat = get_time(NULL);
+ s->recenthb = 0;
+
+ closesocket(authsocket);
+ s->debug(0,"login(): end");
+ return 1;
+}
+
+//=========================== by tallest ==============================================
+
+/*
+** Login to the Authentication server
+**
+** Returns - 0 - failed to reauth for some reason.
+** 1 - Logged in successfully
+*/
+#if 1
+int re_auth(struct session * s)
+{
+ int err;
+ char credentials[16];
+ time_t logintime;
+
+ int authsocket;
+ struct transaction t;
+ INT2 transactiontype;
+ int addrsize;
+
+ s->debug(0,"Re-authentication(): init");
+
+ s->localaddr.sin_port = htons(0);
+
+ authsocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+ err = bind(authsocket,(struct sockaddr *)&s->localaddr,sizeof(struct sockaddr_in));
+ if(err)
+ {
+ socketerror(s,"Re-authentication Error binding auth socket");
+ closesocket(authsocket);
+ return 0;
+ }
+
+ err = connect(authsocket,(struct sockaddr *)&s->authhost,sizeof(struct sockaddr_in));
+
+ if(err)
+ {
+ socketerror(s,"Re-authentication Cant connect to auth server");
+ closesocket(authsocket);
+ return 0;
+ }
+ addrsize = sizeof(struct sockaddr_in);
+ err = getsockname(authsocket,(struct sockaddr *)&s->localipaddress,&addrsize);
+
+ authsocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+ err = bind(authsocket,(struct sockaddr *)&s->localaddr,sizeof(struct sockaddr_in));
+ if(err)
+ {
+ socketerror(s,"Re-authentication Error binding auth socket 2");
+ closesocket(authsocket);
+ return 0;
+ }
+ err = connect(authsocket,(struct sockaddr *)&s->authhost,sizeof(struct sockaddr_in));
+ if(err)
+ {
+ socketerror(s,"Re-authentication Error connecting auth socket 2");
+ closesocket(authsocket);
+ return 0;
+ }
+
+ start_transaction(&t,T_MSG_LOGIN_REQ,s->sessionid);
+ add_field_string(s,&t,T_PARAM_USERNAME,s->username);
+ add_field_INT2(s,&t,T_PARAM_CLIENT_VERSION,LOGIN_VERSION * 100);
+ add_field_string(s,&t,T_PARAM_OS_IDENTITY,s->osname);
+ add_field_string(s,&t,T_PARAM_OS_VERSION,s->osrelease);
+ add_field_INT2(s,&t,T_PARAM_REASON_CODE,T_LOGIN_REASON_CODE_NORMAL);
+ add_field_INT2(s,&t,T_PARAM_REQ_PORT,s->listenport);
+
+ s->debug(0,"tallest: Re-authentication T_MSG_LOGIN_REQ sending... "); //by tallest debug 0210
+ send_transaction(s,authsocket,&t);
+
+ transactiontype = receive_transaction(s,authsocket,&t);
+ if(transactiontype == T_MSG_LOGIN_RESP)
+ goto skip_re_auth;
+
+ if(transactiontype != T_MSG_AUTH_RESP)
+ {
+ s->debug(0,"Re-authentication T_MSG_AUTH_RESP - error transaction type (%d)",transactiontype);
+ return 0;
+ }
+
+ if(!extract_valueINT2(s,&t,T_PARAM_HASH_METHOD,&s->hashmethod))
+ {
+ s->debug(0,"Re-authentication T_MSG_AUTH_RESP - no hashmethod provided");
+ return 0;
+ }
+ if(!extract_valuestring(s,&t,T_PARAM_NONCE,s->nonce))
+ {
+ s->debug(0,"Re-authentication T_MSG_AUTH_RESP - no nonce supplied");
+ return 0;
+ }
+
+ if(s->hashmethod == T_AUTH_MD5_HASH)
+ {
+ genmd5(s->password,strlen(s->password),s->password);
+ }
+
+ start_transaction(&t,T_MSG_LOGIN_AUTH_REQ,s->sessionid);
+
+ s->timestamp = get_time(NULL);
+ makecredentials(credentials,s,T_MSG_LOGIN_AUTH_REQ,s->timestamp);
+
+ add_field_data(s,&t,T_PARAM_AUTH_CREDENTIALS,credentials,16);
+ add_field_INT4(s,&t,T_PARAM_TIMESTAMP,s->timestamp);
+
+ s->debug(0,"tallest:Re-authentication T_MSG_LOGIN_AUTH_REQ sending... "); //by tallest debug 0210
+ send_transaction(s,authsocket,&t);
+
+ transactiontype = receive_transaction(s,authsocket,&t);
+skip_re_auth:
+ if(transactiontype != T_MSG_LOGIN_RESP)
+ {
+ s->debug(0,"Re-authentication T_MSG_LOGIN_RESP - error transaction type (%d)",transactiontype);
+ return 0;
+ }
+
+ extract_valueINT2(s,&t,T_PARAM_STATUS_CODE,&s->retcode);
+ s->debug(0,"Re-authentication(): retcode2 = [%d]\n", s->retcode);
+ switch(s->retcode)
+ {
+ case T_STATUS_SUCCESS:
+ case T_STATUS_LOGIN_SUCCESSFUL_SWVER:
+ case T_STATUS_LOGIN_SUCCESSFUL_ALREADY_LOGGED_IN:
+ break;
+ case T_STATUS_USERNAME_NOT_FOUND:
+ {
+ s->debug(0,"Re-authentication T_MSG_LOGIN_RESP - Login failure: username not known");
+ log_to_file("AUTH_FAIL");
+ return 0;
+ }
+ case T_STATUS_INCORRECT_PASSWORD:
+ {
+ s->debug(0,"Re-authentication T_MSG_LOGIN_RESP - Login failure: incorrect password");
+ log_to_file("AUTH_FAIL");
+ return 0;
+ }
+ case T_STATUS_ACCOUNT_DISABLED:
+ {
+ s->debug(0,"Re-authentication T_MSG_LOGIN_RESP - Login failure: Account disabled");
+ log_to_file("AUTH_FAIL");
+ return 0;
+ }
+ case T_STATUS_LOGIN_RETRY_LIMIT:
+ case T_STATUS_USER_DISABLED:
+ case T_STATUS_FAIL_USERNAME_VALIDATE:
+ case T_STATUS_FAIL_PASSWORD_VALIDATE:
+ case T_STATUS_LOGIN_UNKNOWN:
+ {
+ s->debug(0,"Re-authentication T_MSG_LOGIN_RESP - Login failure: other error");
+ log_to_file("AUTH_FAIL");
+ return 0;
+ }
+ }
+
+ extract_valueINT2(s,&t,T_PARAM_LOGOUT_SERVICE_PORT,&s->logoutport);
+ extract_valueINT2(s,&t,T_PARAM_STATUS_SERVICE_PORT,&s->statusport);
+ extract_valuestring(s,&t,T_PARAM_TSMLIST,s->tsmlist);
+ extract_valuestring(s,&t,T_PARAM_RESPONSE_TEXT,s->resptext);
+ {
+ int i,n;
+ char * p = s->tsmlist;
+ char t[200];
+ char *tp = t;
+ s->tsmcount = 0;
+
+ while((n = strcspn(p," ,"))!=0)
+ {
+ strncpy(t,p,n);
+ t[n] = 0;
+ p += n +1;
+ strcpy(s->tsmlist_s[s->tsmcount],t);
+ strcat(s->tsmlist_s[s->tsmcount],s->authdomain);
+ s->tsmcount++;
+ }
+ for(i=0;i<s->tsmcount;i++)
+ {
+ struct hostent * he;
+
+ he = gethostbyname(s->tsmlist_s[i]);
+ if(he)
+ {
+ s->tsmlist_in[i].sin_addr.s_addr = *((int*)(he->h_addr_list[0]));
+ }
+ else
+ {
+ s->tsmlist_in[i].sin_addr.s_addr = inet_addr(s->authserver);
+ }
+ s->debug(1,"Re-authentication Will accept heartbeats from %s = %s\n",s->tsmlist_s[i],inet_ntoa(s->tsmlist_in[i].sin_addr));
+ }
+ }
+ logintime = get_time(NULL);
+
+ s->debug(0,"Re-authentication as %s - successful at %d\n",s->username, logintime);
+ s->lastheartbeat = get_time(NULL);
+ s->recenthb = 0;
+
+ closesocket(authsocket);
+ s->debug(0,"Re-authentication (): end");
+ return 1;
+}
+#endif
+
+//=========================================================================
+
+/*
+** Handle heartbeats, wait for the following events to happen -
+**
+** 1. A heartbeat packet arrives, in which case we reply correctly
+** 2. A timeout occured (ie no heartbeat arrived within 7 minutes)
+** 3. The socket was closed.
+**
+** Returns - 0 - Heartbeat timeout, and subsequent login failed to connect
+** 1 - Socket closed on us, presuming the user wants to shut down.
+*/
+int handle_heartbeats(struct session *s)
+{
+ INT2 transactiontype;
+ struct transaction t;
+
+ while(1)
+ {
+ transactiontype = receive_udp_transaction(s,s->listensock,&t,&s->fromaddr);
+
+ if(transactiontype == 0xffff)
+ {
+ s->debug(0,"Timed out waiting for heartbeat - logging on\n");
+ //if(!login(s))
+ if(!re_auth(s))
+ return 0;
+ }
+ else if(transactiontype == 0xfffd)
+ {
+ s->debug(0,"Badly structured packet received - discarding\n");
+ }
+ else if(transactiontype == 0xfffe)
+ {
+ s->debug(0,"Socket closed - shutting down\n");
+ return 1;
+ }
+ else if(transactiontype == T_MSG_STATUS_REQ)
+ {
+ char buf[16];
+
+ start_transaction(&t,T_MSG_STATUS_RESP,s->sessionid);
+ add_field_INT2(s,&t,T_PARAM_STATUS_CODE,T_STATUS_TRANSACTION_OK);
+
+ s->sequence++;
+ makecredentials(buf,s,T_MSG_STATUS_RESP,s->sequence);
+ add_field_data(s,&t,T_PARAM_STATUS_AUTH,buf,16);
+ add_field_INT4(s,&t,T_PARAM_SEQNUM,s->sequence);
+
+ s->debug(1,"tallest: T_MSG_STATUS_RESP(UDP) sending...\n"); //by tallest debug 0210
+ send_udp_transaction(s,&t);
+
+ //s->lastheartbeat = time(NULL);
+ s->lastheartbeat = get_time(NULL);
+
+ s->debug(1,"Responded to heartbeat at %d\n", s->lastheartbeat);
+ }
+ else if(transactiontype == T_MSG_RESTART_REQ)
+ {
+ s->debug(0,"Restart request - unimplemented");
+ return 0;
+ }
+ else
+ {
+ /*
+ ** Melbourne servers were sending spurious UDP packets after authentication
+ ** This works around it.
+ */
+ s->debug(0,"Unknown heartbeat message %d ",transactiontype);
+ }
+ }
+ /*
+ ** Should never get here
+ */
+ return 0;
+}
+
+/*
+** Logout of the BIDS2 system
+**
+** Returns - 0 - Could not connect to logout.
+** 1 - Logout successful.
+*/
+int logout(INT2 reason,struct session * s)
+{
+ int err;
+ char credentials[16];
+ time_t logintime;
+
+ int authsocket;
+ struct transaction t;
+ INT2 transactiontype;
+
+ s->debug(0,"logout(): init");
+
+ s->localaddr.sin_port = htons(0);
+ authsocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+ err = bind(authsocket,(struct sockaddr *)&s->localaddr,sizeof(struct sockaddr_in));
+ if(err)
+ {
+ socketerror(s,"Error binding logout auth socket");
+ closesocket(authsocket);
+ return 0;
+ }
+ err = connect(authsocket,(struct sockaddr *)&s->authhost,sizeof(struct sockaddr_in));
+ if(err)
+ {
+ socketerror(s,"Error connecting logout auth socket");
+ closesocket(authsocket);
+ return 0;
+ }
+
+ /*
+ ** start the negotiation
+ */
+ start_transaction(&t,T_MSG_LOGOUT_REQ,s->sessionid);
+ add_field_string(s,&t,T_PARAM_USERNAME,s->username);
+ add_field_INT2(s,&t,T_PARAM_CLIENT_VERSION,LOGIN_VERSION * 100);
+ add_field_string(s,&t,T_PARAM_OS_IDENTITY,s->osname);
+ add_field_string(s,&t,T_PARAM_OS_VERSION,s->osrelease);
+ add_field_INT2(s,&t,T_PARAM_REASON_CODE,reason);
+
+ s->debug(0,"tallest: T_MSG_LOGOUT_REQ sending... "); //by tallest debug 0210
+ send_transaction(s,authsocket,&t);
+
+ transactiontype = receive_transaction(s,authsocket,&t);
+ if(transactiontype != T_MSG_AUTH_RESP)
+ {
+ s->critical("logic error");
+ }
+
+ if(!extract_valueINT2(s,&t,T_PARAM_HASH_METHOD,&s->hashmethod))
+ {
+ s->critical("AUTH: no hashmethod");
+ }
+ if(!extract_valuestring(s,&t,T_PARAM_NONCE,s->nonce))
+ {
+ s->critical("Auth: no nonce");
+ }
+
+ if(s->hashmethod == T_AUTH_MD5_HASH)
+ {
+ genmd5(s->password,strlen(s->password),s->password);
+ }
+
+ start_transaction(&t,T_MSG_LOGOUT_AUTH_RESP,s->sessionid);
+
+ //s->timestamp = time(NULL);
+ s->timestamp = get_time(NULL);
+ makecredentials(credentials,s,T_MSG_LOGOUT_AUTH_RESP,s->timestamp);
+
+ add_field_data(s,&t,T_PARAM_AUTH_CREDENTIALS,credentials,16);
+ add_field_INT4(s,&t,T_PARAM_TIMESTAMP,s->timestamp);
+
+ s->debug(0,"tallest: T_MSG_LOGOUT_AUTH_RESP sending... "); //by tallest debug 0210
+ send_transaction(s,authsocket,&t);
+
+ transactiontype = receive_transaction(s,authsocket,&t);
+ if(transactiontype != T_MSG_LOGOUT_RESP)
+ {
+ s->critical("logic error");
+ }
+
+ extract_valueINT2(s,&t,T_PARAM_STATUS_CODE,&s->retcode);
+
+ s->debug(0,"logout(): retcode = [%d]", s->retcode);
+ switch(s->retcode)
+ {
+ case T_STATUS_SUCCESS:
+ case T_STATUS_LOGOUT_SUCCESSFUL_ALREADY_DISCONNECTED:
+ break;
+ case T_STATUS_USERNAME_NOT_FOUND:
+ s->critical("Login failure: username not known");
+ case T_STATUS_INCORRECT_PASSWORD:
+ s->critical("Login failure: incorrect password");
+ case T_STATUS_ACCOUNT_DISABLED:
+ s->critical("Login failure: disabled");
+ case T_STATUS_LOGIN_RETRY_LIMIT:
+ case T_STATUS_USER_DISABLED:
+ case T_STATUS_FAIL_USERNAME_VALIDATE:
+ case T_STATUS_FAIL_PASSWORD_VALIDATE:
+ case T_STATUS_LOGIN_UNKNOWN:
+ s->critical("Login failure: other error");
+ }
+
+ extract_valueINT2(s,&t,T_PARAM_LOGOUT_SERVICE_PORT,&s->logoutport);
+ extract_valueINT2(s,&t,T_PARAM_STATUS_SERVICE_PORT,&s->statusport);
+ extract_valuestring(s,&t,T_PARAM_TSMLIST,s->tsmlist);
+ extract_valuestring(s,&t,T_PARAM_RESPONSE_TEXT,s->resptext);
+
+ //logintime = time(NULL);
+ logintime = get_time(NULL);
+
+ s->debug(0,"Logged out successful at %d\n",logintime);
+
+ closesocket(authsocket);
+
+ s->debug(0,"logout(): end");
+
+ return 1;
+}
diff --git a/release/src/router/bpalogin/transaction.c b/release/src/router/bpalogin/transaction.c
new file mode 100644
index 00000000..e3a0b451
--- /dev/null
+++ b/release/src/router/bpalogin/transaction.c
@@ -0,0 +1,370 @@
+/*
+** BPALogin - lightweight portable BIDS2 login client
+** Copyright (c) 2001-3 Shane Hyde, and others.
+**
+** 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+**
+*/
+
+#include "bpalogin.h"
+
+void add_trans_data(struct transaction * t,char *p,int count)
+{
+ memcpy(t->data+t->length,p,count);
+ t->length += count;
+}
+
+void add_int2field(struct transaction * t,INT2 v)
+{
+ add_trans_data(t,(char *)&v,2);
+}
+
+void add_int4field(struct transaction * t,INT4 v)
+{
+ add_trans_data(t,(char *)&v,4);
+}
+
+void add_string(struct transaction * t,char *s)
+{
+ add_int2field(t,htons((INT2)(strlen(s)+4)));
+ add_trans_data(t,s,strlen(s));
+}
+
+void add_data(struct transaction * t,char *s,int c)
+{
+ add_int2field(t,htons((INT2)(c+4)));
+ add_trans_data(t,s,c);
+}
+
+void add_field_string(struct session *s,struct transaction * t,INT2 fn,char * p)
+{
+ //s->debug(2,"Sending parm %d value %s\n",fn,p);
+
+ add_int2field(t,htons(fn));
+ add_string(t,p);
+}
+
+void add_field_data(struct session *s,struct transaction * t,INT2 fn,char * p,int c)
+{
+ //s->debug(2,"Sending parm %d value %s\n",fn,p);
+
+ add_int2field(t,htons(fn));
+ add_data(t,p,c);
+}
+
+void add_field_INT2(struct session *s,struct transaction * t,INT2 fn,INT2 v)
+{
+ //s->debug(2,"Sending parm %d value %d\n",fn,v);
+
+ add_int2field(t,htons(fn));
+ add_int2field(t,htons(6));
+ add_int2field(t,htons(v));
+}
+
+void add_field_INT4(struct session *s,struct transaction * t,INT2 fn,INT4 v)
+{
+ //s->debug(2,"Sending parm %d value %d\n",fn,v);
+
+ add_int2field(t,htons(fn));
+ add_int2field(t,htons(8));
+ add_int4field(t,htonl(v));
+}
+
+void start_transaction(struct transaction * t,INT2 msgtype,INT4 sessionid)
+{
+ t->length = 0;
+ memset(t->data,0,1512);
+ add_int2field(t,htons(msgtype));
+ add_int2field(t,htons(0));
+ add_int4field(t,htonl(sessionid));
+}
+
+void dump_transaction(struct session * s,struct transaction * t)
+{
+return;
+ int i;
+ char * p = t->data;
+ char pkt[1500];
+ char *pktp = &pkt;
+ memset(pkt,0,1500);
+ i = 0;
+#if 0 // by tallest debug 0210
+ while(i < t->length)
+ {
+ s->debug(3,"%d:%02x ",i,(unsigned char)*(p));
+
+ p++;
+ i++;
+ }
+ s->debug(3,"\n");
+#endif
+#if 0
+ s->debug(3,"transaction data : ===== start =====");
+ while(i < t->length)
+ {
+ sprintf(pktp,"%02x ",(unsigned char)*(p));
+
+ pktp = pktp+3;
+ p++;
+ i++;
+ if(!(i%32)){
+ s->debug(3,"%s;",pktp-96);
+ }
+
+ if(i == t->length){
+ int j;
+ j = (i%32)*3;
+ s->debug(3,"%s;",pktp-j);
+ }
+ }
+ //syslog(LOG_DEBUG,"data: %s",pkt);
+ s->debug(3,"transaction data : ===== end =====");
+#endif
+}
+
+void dump_sent_transaction(struct session *s,struct transaction * t)
+{
+ s->debug(3,"Sent transaction:\n");
+ dump_transaction(s,t);
+}
+
+void dump_recv_transaction(struct session *s,struct transaction * t)
+{
+ s->debug(3,"Received transaction:\n");
+ dump_transaction(s,t);
+}
+
+void send_transaction(struct session *s,int socket,struct transaction * t)
+{
+ int r;
+ INT2 * lll;
+
+ lll = (INT2 *)(t->data+2);
+ *lll = htons((INT2)t->length);
+
+ r = send(socket,(void *)t,t->length,0);
+ dump_sent_transaction(s,t);
+}
+
+void send_udp_transaction(struct session * s,struct transaction * t)
+{
+ int r;
+
+ INT2 * lll;
+
+ lll = (INT2 *)(t->data+2);
+ *lll = htons((INT2)t->length);
+
+ s->fromaddr.sin_port = htons(s->statusport);
+ r = sendto(s->listensock,(void *)t,t->length,0,(struct sockaddr *)&s->fromaddr,sizeof(s->fromaddr));
+ dump_sent_transaction(s,t);
+}
+
+INT2 receive_transaction(struct session *s,int socket,struct transaction * t)
+{
+ INT2 * v;
+ int r = recv(socket,(char *)t,1500,0);
+
+ t->length = r;
+ dump_recv_transaction(s,t);
+
+ v = (INT2 *)t;
+
+ return r>0?ntohs(*v):0;
+}
+
+int check_hb_packet(struct session * s,struct transaction * t,int length)
+{
+ INT2 type;
+
+ type = ntohs(*(INT2 *)t);
+ if(type != T_MSG_STATUS_REQ)
+ {
+ s->debug(0,"Incorrect transaction type %d",type);
+ return 0;
+ }
+
+ if(length != 8)
+ {
+ s->debug(0,"Incorrect transaction length %d",length);
+ return 0;
+ }
+ return 1;
+}
+
+INT2 receive_udp_transaction(struct session *s,int socket,struct transaction * t,struct sockaddr_in *addr)
+{
+ struct timeval timeval;
+ fd_set readfds;
+ INT2 * v;
+ int l = sizeof(struct sockaddr_in);
+ int r,i;
+
+ timeval.tv_sec = s->maxheartbeat;
+ timeval.tv_usec = 0;
+ FD_ZERO(&readfds);
+ FD_SET(socket,&readfds);
+
+ r = select(socket+1,&readfds,NULL,NULL,&timeval);
+
+ if(r == -1)
+ {
+ return (INT2) 0xfffe;
+ }
+ else if(!r)
+ {
+ return (INT2) 0xffff;
+ }
+ else
+ {
+ r = recvfrom(socket,(char *)t,1500,0,(struct sockaddr*)addr,&l);
+ if(r==-1)
+ return (INT2) 0xfffe;
+
+ //if(s->lastheartbeat + s->minheartbeat > time(NULL))
+ if(s->lastheartbeat + s->minheartbeat > get_time(NULL))
+ {
+ s->recenthb++;
+ if(s->recenthb > 3)
+ {
+ s->debug(0,"Heartbeats arriving too quickly - discarding\n");
+ return (INT2)0xfffd;
+
+ }
+ }
+ else
+ s->recenthb = 0;
+
+ //s->lastheartbeat = time(NULL);
+ s->lastheartbeat = get_time(NULL);
+ }
+
+ for(i = 0;i<s->tsmcount;i++)
+ {
+ if(addr->sin_addr.s_addr == s->tsmlist_in[i].sin_addr.s_addr)
+ break;
+ }
+ if(i == s->tsmcount)
+ {
+ s->debug(0,"Received a heartbeat from unexpected source %s:%d\n",inet_ntoa(addr->sin_addr),ntohs(addr->sin_port));
+ return (INT2)0xfffd;
+ }
+
+ t->length = r;
+
+ dump_recv_transaction(s,t);
+ /*
+ ** Lets make sure this packet is structured correctly
+ */
+ if(!check_hb_packet(s,t,r))
+ {
+ return (INT2)0xfffd;
+ }
+
+ dump_recv_transaction(s,t);
+
+ v = (INT2 *)t;
+
+ return r>0?ntohs(*v):0;
+}
+
+char * locate_parm(struct transaction * t,INT2 parm)
+{
+ char * p = t->data,*pp,*lp,*vp;
+ INT2 p1;
+ INT2 l;
+ int i;
+
+ i = 8;
+ p += 8;
+ while(i < t->length)
+ {
+ pp = p;
+ lp = p+2;
+ vp = p+4;
+
+ l = read_INT2(lp);
+ p1 = read_INT2(pp);
+
+ if(parm == p1)
+ {
+ return vp;
+ }
+ p += l;
+ i += l;
+ }
+ return NULL;
+}
+
+int extract_valueINT2(struct session *s,struct transaction * t,INT2 parm,INT2 *v)
+{
+ INT2 * pp = (INT2 *)locate_parm(t,parm);
+ if(pp)
+ {
+ *v = read_INT2(pp);
+ s->debug(2,"Received parm %d value %d\n",parm,*v);
+
+ return TRUE;
+ }
+ return FALSE;
+}
+
+int extract_valueINT4(struct session *s,struct transaction * t,INT2 parm,INT4 *v)
+{
+ INT4 * pp = (INT4 *)locate_parm(t,parm);
+ if(pp)
+ {
+ *v = read_INT4(pp);
+ s->debug(2,"Received parm %d value %d\n",parm,*v);
+
+ return TRUE;
+ }
+ return FALSE;
+}
+
+int extract_valuestring(struct session *s,struct transaction * t,INT2 parm,char * v)
+{
+ char * pp = locate_parm(t,parm);
+ if(pp)
+ {
+ INT2 l = read_INT2(pp-2);
+ memcpy(v,pp,l-4);
+ *(v+l-4) = 0;
+ s->debug(2,"Received parm %d value %s\n",parm,v);
+
+ return TRUE;
+ }
+ return FALSE;
+}
+
+INT2 read_INT2(void *pp)
+{
+#ifdef __i386
+ return ntohs(*((INT2*)pp));
+#else
+ unsigned char * p = (unsigned char *)pp;
+ return (((INT2)(*p))<<8) + ((INT2)(*(p+1)));
+#endif
+}
+
+INT4 read_INT4(void *pp)
+{
+#ifdef __i386
+ return ntohl(*((INT4*)pp));
+#else
+ unsigned char * p = (unsigned char *)pp;
+ return (((INT4)(*p))<<24) + (((INT4)(*(p+1)))<<16) + (((INT4)(*(p+2)))<<8) + (((INT4)(*(p+3))));
+#endif
+}
diff --git a/release/src/router/bpalogin/unixmain.c b/release/src/router/bpalogin/unixmain.c
new file mode 100644
index 00000000..576896d8
--- /dev/null
+++ b/release/src/router/bpalogin/unixmain.c
@@ -0,0 +1,405 @@
+/*
+** BPALogin - lightweight portable BIDS2 login client
+** Copyright (c) 2001-3 Shane Hyde, and others.
+**
+** 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+**
+*/
+
+/**
+ * Changes:
+ * 2001-09-19: wdrose Fixed incorrect use of single fork() to put
+ * BPALogin into background. Replaced with
+ * fork(), setsid(), fork().
+ *
+ * 2001-12-05: wdrose Added fix gleaned from Sam Johnston to include
+ * errno.h for errno, rather than assuming it is an
+ * extern int.
+ */
+#include "bpalogin.h"
+
+#define BPALOGIN_BANNER \
+ "BPALogin v2.0.2 - portable BigPond Broadband login client"
+
+struct session s;
+int debug_level = DEFAULT_DEBUG;
+int dosyslog = 1;
+
+int test_connect_success = 0;
+
+int parse_parms(struct session *,char * conffile);
+void usage( void );
+void debug(int l,char *s,...);
+
+void onconnected(int i)
+{
+ if(strcmp(s.connectedprog,""))
+ {
+ char buf[500];
+ sprintf(buf,"%.500s %d %d",s.connectedprog,s.listenport,getpid()); // modify by honor
+
+ syslog(LOG_INFO, "The user logged in successfully");
+
+ debug(0,"Executing external command - %s\n",buf);
+ system(buf);
+ }
+}
+
+void ondisconnected(int reason)
+{
+ if(strcmp(s.disconnectedprog,""))
+ {
+ char buf[500];
+ sprintf(buf,"%.500s %d",s.disconnectedprog,reason);
+
+ syslog(LOG_INFO, "The user logged in successfully");
+
+ debug(0,"Executing external command - %s\n",buf);
+ system(buf);
+ }
+}
+
+void critical(char *s)
+{
+ if(dosyslog)
+ syslog(LOG_CRIT,"Critical error: %s\n",s);
+ else
+ printf("Critical error: %s\n",s);
+ exit(1);
+}
+
+void debug(int l,char *s,...)
+{
+ va_list ap;
+ va_start(ap,s);
+ if(debug_level > l)
+ {
+ int pri;
+ char buf[256];
+
+ switch(l)
+ {
+ case 0:
+ pri = LOG_INFO;
+ break;
+ case 1:
+ pri = LOG_INFO;
+ break;
+ case 2:
+ case 3:
+ default:
+ pri = LOG_INFO;
+ break;
+ }
+ vsprintf(buf,s,ap);
+ if(dosyslog)
+ syslog(pri,"%s",buf);
+ else
+ printf("%s",buf);
+ }
+ va_end(ap);
+}
+
+void noncritical(char *s,...)
+{
+ char buf[256];
+
+ va_list ap;
+ va_start(ap,s);
+ vsprintf(buf,s,ap);
+ if(dosyslog)
+ syslog(LOG_CRIT,buf);
+ else
+ printf(buf);
+ va_end(ap);
+}
+
+void onsignal(int i)
+{
+ syslog(LOG_INFO, "heartbeat daemon shut down");
+ debug(1,"Signal caught\n");
+ logout(0,&s);
+ s.ondisconnected(0);
+ closelog();
+ exit(1);
+}
+
+int main(int argc,char* argv[])
+{
+ int makedaemon = 1;
+ char conffile[256];
+
+ int c;
+
+ signal(SIGINT,onsignal);
+ signal(SIGHUP,onsignal);
+ signal(SIGTERM,onsignal);
+
+ strcpy(s.authserver,DEFAULT_AUTHSERVER);
+ strcpy(s.authdomain,DEFAULT_AUTHDOMAIN);
+ s.authport = DEFAULT_AUTHPORT;
+ strcpy(s.username,"");
+ strcpy(s.password,"");
+ strcpy(s.connectedprog,"");
+ strcpy(s.disconnectedprog,"");
+ strcpy(conffile,DEFAULT_CONFFILE);
+ strcpy(s.localaddress,"");
+ s.localport = 0;
+ s.minheartbeat = 60;
+ s.maxheartbeat = 840;
+
+ while( (c = getopt( argc, argv, "c:d:l:Dt" )) > -1 ) {
+ switch( c ) {
+ case 'c':
+ strncpy( conffile, optarg, MAXCONFFILE);
+ break;
+ case 't':
+ test_connect_success = 1;
+ break;
+ case '?':
+ usage();
+ exit(1);
+ break;
+ }
+ }
+
+ if(!parse_parms(&s,conffile)) {
+ printf( "bpalogin: Could not read configuration file (%s)\n\n",
+ conffile );
+ usage();
+ exit(1);
+ }
+
+ optind = 1;
+ while( (c = getopt( argc, argv, "c:d:l:Dt" )) > -1 ) {
+ switch( c ) {
+ case 'D':
+ makedaemon = 0;
+ break;
+ case 'c':
+ break;
+ case 'd':
+ debug_level = atoi(optarg);
+ break;
+ case 'l':
+ if( strcasecmp( optarg, "stdout" ) == 0 )
+ dosyslog = 0;
+ else
+ dosyslog = 1;
+ break;
+ case '?':
+ break;
+ case ':':
+ break;
+ case 't':
+ break;
+ }
+ }
+
+ if(makedaemon) {
+ /**
+ * Original code did not perform the setsid() or second fork(), and
+ * hence did not correctly make itself a daemon. There is a library
+ * call in FreeBSD (daemon) that does the actions below, but the
+ * portability is unknown.
+ */
+ switch( fork() ) {
+ case 0:
+ break;
+
+ case -1:
+ perror("Could not run BPALogin in the background");
+ exit(1);
+ break;
+
+ default:
+ exit(0);
+ break;
+ }
+
+ if( setsid() < 0 ) {
+ perror("Could not run BPALogin in the background");
+ exit(1);
+ }
+
+ /**
+ * while not strictly necessary, the second fork ensures we stay
+ * detached from a terminal by preventing the program using its
+ * status as session leader to regain a terminal.
+ */
+ switch( fork() ) {
+ case 0:
+ break;
+
+ case -1:
+ perror("Could not run BPALogin in the background");
+ exit(1);
+ break;
+
+ default:
+ exit(0);
+ break;
+ }
+ }
+
+
+ openlog("bpalogin",LOG_PID,LOG_DAEMON);
+
+ if(dosyslog)
+ syslog( LOG_INFO, BPALOGIN_BANNER "\n" );
+ else
+ printf( BPALOGIN_BANNER "\n");
+
+ if(!strcmp(s.username,""))
+ {
+ critical("Username has not been set");
+ exit(1);
+ }
+ if(!strcmp(s.password,""))
+ {
+ critical("Password has not been set");
+ exit(1);
+ }
+ s.debug = debug;
+ s.critical = critical;
+ s.noncritical = noncritical;
+ s.onconnected = onconnected;
+ s.ondisconnected = ondisconnected;
+
+ while(mainloop(&s));
+ s.ondisconnected(0);
+
+ exit(0);
+}
+
+int parse_parms(struct session *s,char * conffile)
+{
+ char buf[512];
+ FILE * f;
+
+ f = fopen(conffile,"rt");
+ if(!f)
+ {
+ debug(0,"Cannot open conf file\n");
+ return FALSE;
+ }
+
+ while(fgets(buf,400,f) != NULL)
+ {
+ char parm[100];
+ char value[100];
+
+ if(buf[0] == '#')
+ continue;
+
+ /**
+ * Problem with using sscanf(buf, "%s %s"), parm, value):
+ * usernames with periods et al are not picked up correctly.
+ * Really need to use strtok.
+ */
+ sscanf(buf,"%s %s",parm,value);
+ debug(2,"Parameter %s set to %s\n",parm,value);
+
+ if(!strcasecmp(parm,"username"))
+ {
+ strcpy(s->username,value);
+ }
+ else if(!strcasecmp(parm,"password"))
+ {
+ strcpy(s->password,value);
+ }
+ else if(!strcasecmp(parm,"authdomain"))
+ {
+ strcpy(s->authdomain,".");
+ strcat(s->authdomain,value);
+ }
+ else if(!strcasecmp(parm,"authserver"))
+ {
+ strcpy(s->authserver,value);
+ }
+ else if(!strcasecmp(parm,"localaddress"))
+ {
+ strcpy(s->localaddress,value);
+ }
+ else if(!strcasecmp(parm,"logging"))
+ {
+ /*
+ if(!strcasecmp("stdout",value) ||
+ !strcasecmp("sysout",value)) dosyslog = 0; // for compatibility
+ if(!strcasecmp("syslog",value)) dosyslog = 1;
+ */
+ if(!strcasecmp("stdout",value) ||
+ !strcasecmp("sysout",value)) dosyslog = 1; // for compatibility
+ if(!strcasecmp("syslog",value)) dosyslog = 0;
+ }
+ else if(!strcasecmp(parm,"debuglevel"))
+ {
+ debug_level = atoi(value);
+ }
+ else if(!strcasecmp(parm,"minheartbeatinterval"))
+ {
+ s->minheartbeat = atoi(value);
+ }
+ else if(!strcasecmp(parm,"maxheartbeatinterval"))
+ {
+ s->maxheartbeat = atoi(value);
+ }
+ else if(!strcasecmp(parm,"localport"))
+ {
+ s->localport = atoi(value);
+ }
+ else if(!strcasecmp(parm,"connectedprog"))
+ {
+ strcpy(s->connectedprog,value);
+ }
+ else if(!strcasecmp(parm,"disconnectedprog"))
+ {
+ strcpy(s->disconnectedprog,value);
+ }
+ }
+
+ fclose(f);
+ //strcat(s->authserver,s->authdomain);
+ return TRUE;
+}
+
+void usage( void )
+{
+ printf( BPALOGIN_BANNER "\n");
+ printf("Copyright (c) 2001-3 Shane Hyde and others\n\n");
+ printf("This program is *not* a product of Big Pond Advance\n\n");
+ printf("Usage: bpalogin [-c file] [-d level] [-l style] [-D]\n\n");
+ printf(" -c file Specifies the configuration file to use\n");
+ printf(" (default is %s)\n\n", DEFAULT_CONFFILE);
+ printf(" -d level Set the verbosity of log messages\n");
+ printf(" (0 is quiet, 2 is most verbose)\n\n");
+ printf(" -l style Use syslog or stdout for messages\n\n" );
+ printf(" -D Dont run bpalogin as a daemon (run in "
+ "foreground)\n\n");
+ printf("Command line options override the values in the configuration "
+ "file\n");
+}
+
+int closesocket(int s)
+{
+ return close(s);
+}
+
+void socketerror(struct session *s, const char * str)
+{
+ char buf[200];
+ sprintf(buf,"%.100s - %.80s",str,strerror(errno));
+ s->noncritical(buf);
+}